!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).ol={})}(this,(function(t){"use strict";function e(){return function(){throw new Error("Unimplemented abstract method.")}()}var i=0;function n(t){return t.ol_uid||(t.ol_uid=String(++i))}var r,o=(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(t,e)},function(t,e){function i(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),a=function(t){function e(e){var i=this,n="Assertion failed. See https://openlayers.org/en/"+("v"+"6.5.0".split("-")[0])+"/doc/errors/#"+e+" for details.";return(i=t.call(this,n)||this).code=e,i.name="AssertionError",i.message=n,i}return o(e,t),e}(Error),s=function(){function t(t){this.propagationStopped,this.type=t,this.target=null}return t.prototype.preventDefault=function(){this.propagationStopped=!0},t.prototype.stopPropagation=function(){this.propagationStopped=!0},t}(),l="propertychange",u=function(){function t(){this.disposed=!1}return t.prototype.dispose=function(){this.disposed||(this.disposed=!0,this.disposeInternal())},t.prototype.disposeInternal=function(){},t}();function h(t,e){return t>e?1:t=0}function p(t,e,i){var n=t.length;if(t[0]<=e)return 0;if(e<=t[n-1])return n-1;var r=void 0;if(i>0){for(r=1;r0)},e.prototype.removeEventListener=function(t,e){var i=this.listeners_&&this.listeners_[t];if(i){var n=i.indexOf(e);-1!==n&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=v,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}},e}(u),E="change",T="error",P="contextmenu",R="click",O="dblclick",F="dragenter",I="dragover",M="drop",A="keydown",L="keypress",k="load",D="resize",j="touchmove",G="wheel";function N(t,e,i,n,r){if(n&&n!==t&&(i=i.bind(n)),r){var o=i;i=function(){t.removeEventListener(e,i),o.apply(this,arguments)}}var a={target:t,type:e,listener:i};return t.addEventListener(e,i),a}function z(t,e,i,n){return N(t,e,i,n,!0)}function B(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),x(t))}var U=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),X=function(t){function e(){var e=t.call(this)||this;return e.revision_=0,e}return U(e,t),e.prototype.changed=function(){++this.revision_,this.dispatchEvent(E)},e.prototype.getRevision=function(){return this.revision_},e.prototype.on=function(t,e){if(Array.isArray(t)){for(var i=t.length,n=new Array(i),r=0;r0;)this.pop()},e.prototype.extend=function(t){for(var e=0,i=t.length;er&&(l|=Nt),so&&(l|=Gt),l===Dt&&(l=jt),l}function qt(){return[1/0,1/0,-1/0,-1/0]}function Jt(t,e,i,n,r){return r?(r[0]=t,r[1]=e,r[2]=i,r[3]=n,r):[t,e,i,n]}function Qt(t){return Jt(1/0,1/0,-1/0,-1/0,t)}function $t(t,e){var i=t[0],n=t[1];return Jt(i,n,i,n,e)}function te(t,e){return function(t,e){for(var i=0,n=e.length;it[2]&&(t[2]=e[2]),e[1]t[3]&&(t[3]=e[3]),t}function re(t,e){e[0]t[2]&&(t[2]=e[0]),e[1]t[3]&&(t[3]=e[1])}function oe(t,e,i,n,r){for(;ie[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function xe(t){return t[2]1)for(var o=t[2]-t[0],a=t[3]-t[1],s=0;s1?(i=r,n=o):l>0&&(i+=a*l,n+=s*l)}return Pe(t,e,i,n)}function Pe(t,e,i,n){var r=i-t,o=n-e;return r*r+o*o}function Re(t){return 180*t/Math.PI}function Oe(t){return t*Math.PI/180}function Fe(t,e){var i=t%e;return i*e<0?i+e:i}function Ie(t,e,i){return t+i*(e-t)}var Me=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Ae=6378137*Math.PI,Le=[-Ae,-Ae,Ae,Ae],ke=[-180,-85,180,85],De=6378137*Math.log(Math.tan(Math.PI/2)),je=function(t){function e(e){return t.call(this,{code:e,units:xt,extent:Le,global:!0,worldExtent:ke,getPointResolution:function(t,e){return t/be(e[1]/6378137)}})||this}return Me(e,t),e}(Se),Ge=[new je("EPSG:3857"),new je("EPSG:102100"),new je("EPSG:102113"),new je("EPSG:900913"),new je("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Ne(t,e,i){var n=t.length,r=i>1?i:2,o=e;void 0===o&&(o=r>2?t.slice():new Array(n));for(var a=0;aDe?s=De:s<-De&&(s=-De),o[a+1]=s}return o}function ze(t,e,i){var n=t.length,r=i>1?i:2,o=e;void 0===o&&(o=r>2?t.slice():new Array(n));for(var a=0;aa)return 1;if(a>o)return-1}return 0}function ti(t,e){var i,n,r=t[0],o=t[1],a=e[0],s=e[1],l=a[0],u=a[1],h=s[0],c=s[1],p=h-l,f=c-u,d=0===p&&0===f?0:(p*(r-l)+f*(o-u))/(p*p+f*f||0);return d<=0?(i=l,n=u):d>=1?(i=h,n=c):(i=l+d*p,n=u+d*f),[i,n]}function ei(t,e){for(var i=!0,n=t.length-1;n>=0;--n)if(t[n]!=e[n]){i=!1;break}return i}function ii(t,e){var i=Math.cos(e),n=Math.sin(e),r=t[0]*i-t[1]*n,o=t[1]*i+t[0]*n;return t[0]=r,t[1]=o,t}function ni(t,e){var i=t[0]-e[0],n=t[1]-e[1];return i*i+n*n}function ri(t,e){return Math.sqrt(ni(t,e))}function oi(t,e){return ni(t,ti(t,e))}function ai(t,e){if(e.canWrapX()){var i=ve(e.getExtent()),n=function(t,e,i){var n=e.getExtent(),r=0;if(e.canWrapX()&&(t[0]n[2])){var o=i||ve(n);r=Math.floor((t[0]-n[0])/o)}return r}(t,e,i);n&&(t[0]-=n*i)}return t}function si(t,e,i){var n;if(void 0!==e){for(var r=0,o=t.length;r1)s=i;else{if(p>0){for(var f=0;fr&&(r=u),o=s,a=l}return r}function Di(t,e,i,n,r){for(var o=0,a=i.length;o0;){for(var c=u.pop(),p=u.pop(),f=0,d=t[p],g=t[p+1],_=t[c],y=t[c+1],v=p+n;vf&&(h=v,f=m)}f>r&&(l[(h-e)/n]=1,p+n0&&g>f)&&(d<0&&_0&&_>d)?(s=c,l=p):(o[a++]=s,o[a++]=l,u=s,h=l,s=c,l=p)}}return o[a++]=s,o[a++]=l,a}function Vi(t,e,i,n,r,o,a,s){for(var l=0,u=i.length;lo&&(u-s)*(o-l)-(r-s)*(h-l)>0&&a++:h<=o&&(u-s)*(o-l)-(r-s)*(h-l)<0&&a--,s=u,l=h}return 0!==a}function rn(t,e,i,n,r,o){if(0===i.length)return!1;if(!nn(t,e,i[0],n,r,o))return!1;for(var a=1,s=i.length;aw&&rn(t,e,i,n,u=(c+p)/2,g)&&(x=u,w=S),c=p}return isNaN(x)&&(x=r[o]),a?(a.push(x,g,w),a):[x,g,w]}function an(t,e,i,n,r){for(var o,a=[t[e],t[e+1]],s=[];e+n=r[0]&&o[2]<=r[2]||(o[1]>=r[1]&&o[3]<=r[3]||an(t,e,i,n,(function(t,e){return function(t,e,i){var n=!1,r=Ht(t,e),o=Ht(t,i);if(r===jt||o===jt)n=!0;else{var a=t[0],s=t[1],l=t[2],u=t[3],h=e[0],c=e[1],p=i[0],f=i[1],d=(f-c)/(p-h),g=void 0,_=void 0;o&Gt&&!(r&Gt)&&(n=(g=p-(f-u)/d)>=a&&g<=l),n||!(o&Nt)||r&Nt||(n=(_=f-(p-l)*d)>=s&&_<=u),n||!(o&zt)||r&zt||(n=(g=p-(f-s)/d)>=a&&g<=l),n||!(o&Bt)||r&Bt||(n=(_=f-(p-a)*d)>=s&&_<=u)}return n}(r,t,e)})))))}function ln(t,e,i,n,r){if(!function(t,e,i,n,r){return!!sn(t,e,i,n,r)||(!!nn(t,e,i,n,r[0],r[1])||(!!nn(t,e,i,n,r[0],r[3])||(!!nn(t,e,i,n,r[2],r[1])||!!nn(t,e,i,n,r[2],r[3]))))}(t,e,i[0],n,r))return!1;if(1===i.length)return!0;for(var o=1,a=i.length;o0}function cn(t,e,i,n,r){for(var o=void 0!==r&&r,a=0,s=i.length;a>1)],e))<0?a=n+1:(s=n,l=!r);return l?a:~a}(d,v);m<0?(l=(v-d[-m-2])/(d[-m-1]-d[-m-2]),s=e+(-m-2)*n):s=e+m*n}var x=a>1?a:2,w=o||new Array(x);for(g=0;g>1;r=1024){var r=0;for(var o in t)0==(3&r++)&&(delete t[o],--e)}n=function(t){var e,i,n,r,o;zn.exec(t)&&(t=Un(t));if(Nn.exec(t)){var a=t.length-1,s=void 0;s=a<=4?1:2;var l=4===a||8===a;e=parseInt(t.substr(1+0*s,s),16),i=parseInt(t.substr(1+1*s,s),16),n=parseInt(t.substr(1+2*s,s),16),r=l?parseInt(t.substr(1+3*s,s),16):255,1==s&&(e=(e<<4)+e,i=(i<<4)+i,n=(n<<4)+n,l&&(r=(r<<4)+r)),o=[e,i,n,r/255]}else 0==t.indexOf("rgba(")?Vn(o=t.slice(5,-1).split(",").map(Number)):0==t.indexOf("rgb(")?((o=t.slice(4,-1).split(",").map(Number)).push(1),Vn(o)):it(!1,14);return o}(i),t[i]=n,++e}return n}}();function Wn(t){return Array.isArray(t)?t:Xn(t)}function Vn(t){return t[0]=Ce(t[0]+.5|0,0,255),t[1]=Ce(t[1]+.5|0,0,255),t[2]=Ce(t[2]+.5|0,0,255),t[3]=Ce(t[3],0,1),t}function Yn(t){var e=t[0];e!=(0|e)&&(e=e+.5|0);var i=t[1];i!=(0|i)&&(i=i+.5|0);var n=t[2];return n!=(0|n)&&(n=n+.5|0),"rgba("+e+","+i+","+n+","+(void 0===t[3]?1:t[3])+")"}function Kn(t){return Array.isArray(t)?Yn(t):t}var Zn="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"",Hn=-1!==Zn.indexOf("firefox"),qn=(-1!==Zn.indexOf("safari")&&Zn.indexOf("chrom"),-1!==Zn.indexOf("webkit")&&-1==Zn.indexOf("edge")),Jn=-1!==Zn.indexOf("macintosh"),Qn="undefined"!=typeof devicePixelRatio?devicePixelRatio:1,$n="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,tr="undefined"!=typeof Image&&Image.prototype.decode,er=function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch(t){}return t}();function ir(t,e,i){var n=i&&i.length?i.shift():$n?new OffscreenCanvas(t||300,e||300):document.createElement("canvas");return t&&(n.width=t),e&&(n.height=e),n.getContext("2d")}function nr(t,e){var i=e.parentNode;i&&i.replaceChild(t,e)}function rr(t){return t&&t.parentNode?t.parentNode.removeChild(t):null}var or=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"),ar=["style","variant","weight","size","lineHeight","family"],sr=function(t){var e=t.match(or);if(!e)return null;for(var i={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"},n=0,r=ar.length;n=t.maxResolution)return!1;var n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}function to(t,e,i,n,r){!function t(e,i,n,r,o){for(;r>n;){if(r-n>600){var a=r-n+1,s=i-n+1,l=Math.log(a),u=.5*Math.exp(2*l/3),h=.5*Math.sqrt(l*u*(a-u)/a)*(s-a/2<0?-1:1),c=Math.max(n,Math.floor(i-s*u/a+h)),p=Math.min(r,Math.floor(i+(a-s)*u/a+h));t(e,i,c,p,o)}var f=e[i],d=n,g=r;for(eo(e,n,i),o(e[r],f)>0&&eo(e,n,r);d0;)g--}0===o(e[n],f)?eo(e,n,g):(g++,eo(e,g,r)),g<=i&&(n=g+1),i<=g&&(r=g-1)}}(t,e,i||0,n||t.length-1,r||io)}function eo(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function io(t,e){return te?1:0}class no{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const i=[];if(!go(t,e))return i;const n=this.toBBox,r=[];for(;e;){for(let o=0;o=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(n,r,e)}_split(t,e){const i=t[e],n=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,n);const o=this._chooseSplitIndex(i,r,n),a=_o(i.children.splice(o,i.children.length-o));a.height=i.height,a.leaf=i.leaf,oo(i,this.toBBox),oo(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)}_splitRoot(t,e){this.data=_o([t,e]),this.data.height=t.height+1,this.data.leaf=!1,oo(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let n,r=1/0,o=1/0;for(let a=e;a<=i-e;a++){const e=ao(t,0,a,this.toBBox),s=ao(t,a,i,this.toBBox),l=po(e,s),u=ho(e)+ho(s);l=e;n--){const e=t.children[n];so(a,t.leaf?r(e):e),s+=co(a)}return s}_adjustParentBBoxes(t,e,i){for(let n=i;n>=0;n--)so(e[n],t)}_condense(t){for(let e,i=t.length-1;i>=0;i--)0===t[i].children.length?i>0?(e=t[i-1].children,e.splice(e.indexOf(t[i]),1)):this.clear():oo(t[i],this.toBBox)}}function ro(t,e,i){if(!i)return e.indexOf(t);for(let n=0;n=t.minX&&e.maxY>=t.minY}function _o(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function yo(t,e,i,n,r){const o=[e,i];for(;o.length;){if((i=o.pop())-(e=o.pop())<=n)continue;const a=e+Math.ceil((i-e)/n/2)*n;to(t,a,e,i,r),o.push(e,a,a,i)}}var vo=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),mo="renderOrder",xo=function(t){function e(e){var i=this,n=e||{},r=m({},n);return delete r.style,delete r.renderBuffer,delete r.updateWhileAnimating,delete r.updateWhileInteracting,(i=t.call(this,r)||this).declutter_=void 0!==n.declutter&&n.declutter,i.renderBuffer_=void 0!==n.renderBuffer?n.renderBuffer:100,i.style_=null,i.styleFunction_=void 0,i.setStyle(n.style),i.updateWhileAnimating_=void 0!==n.updateWhileAnimating&&n.updateWhileAnimating,i.updateWhileInteracting_=void 0!==n.updateWhileInteracting&&n.updateWhileInteracting,i}return vo(e,t),e.prototype.getDeclutter=function(){return this.declutter_},e.prototype.getFeatures=function(e){return t.prototype.getFeatures.call(this,e)},e.prototype.getRenderBuffer=function(){return this.renderBuffer_},e.prototype.getRenderOrder=function(){return this.get(mo)},e.prototype.getStyle=function(){return this.style_},e.prototype.getStyleFunction=function(){return this.styleFunction_},e.prototype.getUpdateWhileAnimating=function(){return this.updateWhileAnimating_},e.prototype.getUpdateWhileInteracting=function(){return this.updateWhileInteracting_},e.prototype.renderDeclutter=function(t){t.declutterTree||(t.declutterTree=new no(9)),this.getRenderer().renderDeclutter(t)},e.prototype.setRenderOrder=function(t){this.set(mo,t)},e.prototype.setStyle=function(t){this.style_=void 0!==t?t:Fr,this.styleFunction_=null===t?void 0:function(t){var e;if("function"==typeof t)e=t;else{var i;if(Array.isArray(t))i=t;else it("function"==typeof t.getZIndex,41),i=[t];e=function(){return i}}return e}(this.style_),this.changed()},e}(Qr),wo=0,So=1,Co=2,bo=3,Eo=4,To=5,Po=6,Ro=7,Oo=8,Fo=9,Io=10,Mo=11,Ao=12,Lo=[Oo],ko=[Ao],Do=[So],jo=[bo],Go=function(){function t(){}return t.prototype.drawCustom=function(t,e,i){},t.prototype.drawGeometry=function(t){},t.prototype.setStyle=function(t){},t.prototype.drawCircle=function(t,e){},t.prototype.drawFeature=function(t,e){},t.prototype.drawGeometryCollection=function(t,e){},t.prototype.drawLineString=function(t,e){},t.prototype.drawMultiLineString=function(t,e){},t.prototype.drawMultiPoint=function(t,e){},t.prototype.drawMultiPolygon=function(t,e){},t.prototype.drawPoint=function(t,e){},t.prototype.drawPolygon=function(t,e){},t.prototype.drawText=function(t,e){},t.prototype.setFillStrokeStyle=function(t,e){},t.prototype.setImageStyle=function(t,e){},t.prototype.setTextStyle=function(t,e){},t}(),No=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),zo=function(t){function e(e,i,n,r){var o=t.call(this)||this;return o.tolerance=e,o.maxExtent=i,o.pixelRatio=r,o.maxLineWidth=0,o.resolution=n,o.beginGeometryInstruction1_=null,o.beginGeometryInstruction2_=null,o.bufferedMaxExtent_=null,o.instructions=[],o.coordinates=[],o.tmpCoordinate_=[],o.hitDetectionInstructions=[],o.state={},o}return No(e,t),e.prototype.applyPixelRatio=function(t){var e=this.pixelRatio;return 1==e?t:t.map((function(t){return t*e}))},e.prototype.appendFlatPointCoordinates=function(t,e){for(var i=this.getBufferedMaxExtent(),n=this.tmpCoordinate_,r=this.coordinates,o=r.length,a=0,s=t.length;ah&&this.instructions.push([Eo,h,r,t,i,Yi])):l==ut&&(n=t.getFlatCoordinates(),this.coordinates.push(n[0],n[1]),r=this.coordinates.length,this.instructions.push([Eo,h,r,t,i]));this.endGeometry(e)},e.prototype.beginGeometry=function(t,e){this.beginGeometryInstruction1_=[wo,e,0,t],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[wo,e,0,t],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)},e.prototype.finish=function(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}},e.prototype.reverseHitDetectionInstructions=function(){var t,e=this.hitDetectionInstructions;e.reverse();var i,n,r=e.length,o=-1;for(t=0;tthis.maxLineWidth&&(this.maxLineWidth=i.lineWidth,this.bufferedMaxExtent_=null)}else i.strokeStyle=void 0,i.lineCap=void 0,i.lineDash=null,i.lineDashOffset=void 0,i.lineJoin=void 0,i.lineWidth=void 0,i.miterLimit=void 0},e.prototype.createFill=function(t){var e=t.fillStyle,i=[Io,e];return"string"!=typeof e&&i.push(!0),i},e.prototype.applyStroke=function(t){this.instructions.push(this.createStroke(t))},e.prototype.createStroke=function(t){return[Mo,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]},e.prototype.updateFillStyle=function(t,e){var i=t.fillStyle;"string"==typeof i&&t.currentFillStyle==i||(void 0!==i&&this.instructions.push(e.call(this,t)),t.currentFillStyle=i)},e.prototype.updateStrokeStyle=function(t,e){var i=t.strokeStyle,n=t.lineCap,r=t.lineDash,o=t.lineDashOffset,a=t.lineJoin,s=t.lineWidth,l=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=n||r!=t.currentLineDash&&!g(t.currentLineDash,r)||t.currentLineDashOffset!=o||t.currentLineJoin!=a||t.currentLineWidth!=s||t.currentMiterLimit!=l)&&(void 0!==i&&e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=r,t.currentLineDashOffset=o,t.currentLineJoin=a,t.currentLineWidth=s,t.currentMiterLimit=l)},e.prototype.endGeometry=function(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;var e=[Ro,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)},e.prototype.getBufferedMaxExtent=function(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Wt(this.maxExtent),this.maxLineWidth>0)){var t=this.resolution*(this.maxLineWidth+1)/2;Xt(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_},e}(Go),Bo=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Uo=function(t){function e(e,i,n,r){var o=t.call(this,e,i,n,r)||this;return o.hitDetectionImage_=null,o.image_=null,o.imagePixelRatio_=void 0,o.anchorX_=void 0,o.anchorY_=void 0,o.height_=void 0,o.opacity_=void 0,o.originX_=void 0,o.originY_=void 0,o.rotateWithView_=void 0,o.rotation_=void 0,o.scale_=void 0,o.width_=void 0,o.declutterImageWithText_=void 0,o}return Bo(e,t),e.prototype.drawPoint=function(t,e){if(this.image_){this.beginGeometry(t,e);var i=t.getFlatCoordinates(),n=t.getStride(),r=this.coordinates.length,o=this.appendFlatPointCoordinates(i,n);this.instructions.push([Po,r,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterImageWithText_]),this.hitDetectionInstructions.push([Po,r,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterImageWithText_]),this.endGeometry(e)}},e.prototype.drawMultiPoint=function(t,e){if(this.image_){this.beginGeometry(t,e);var i=t.getFlatCoordinates(),n=t.getStride(),r=this.coordinates.length,o=this.appendFlatPointCoordinates(i,n);this.instructions.push([Po,r,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterImageWithText_]),this.hitDetectionInstructions.push([Po,r,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterImageWithText_]),this.endGeometry(e)}},e.prototype.finish=function(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,t.prototype.finish.call(this)},e.prototype.setImageStyle=function(t,e){var i=t.getAnchor(),n=t.getSize(),r=t.getHitDetectionImage(),o=t.getImage(this.pixelRatio),a=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=r,this.image_=o,this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=a[0],this.originY_=a[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=n[0],this.declutterImageWithText_=e},e}(zo),Xo=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Wo=function(t){function e(e,i,n,r){return t.call(this,e,i,n,r)||this}return Xo(e,t),e.prototype.drawFlatCoordinates_=function(t,e,i,n){var r=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,i,n,!1,!1),a=[Fo,r,o];return this.instructions.push(a),this.hitDetectionInstructions.push(a),i},e.prototype.drawLineString=function(t,e){var i=this.state,n=i.strokeStyle,r=i.lineWidth;if(void 0!==n&&void 0!==r){this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([Mo,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset],Do);var o=t.getFlatCoordinates(),a=t.getStride();this.drawFlatCoordinates_(o,0,o.length,a),this.hitDetectionInstructions.push(ko),this.endGeometry(e)}},e.prototype.drawMultiLineString=function(t,e){var i=this.state,n=i.strokeStyle,r=i.lineWidth;if(void 0!==n&&void 0!==r){this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([Mo,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset],Do);for(var o=t.getEnds(),a=t.getFlatCoordinates(),s=t.getStride(),l=0,u=0,h=o.length;ut&&(y>_&&(_=y,d=v,g=o),y=0,v=o-r)),a=s,h=p,c=f),l=m,u=x}return(y+=s)>_?[v,o]:[d,g]}var Zo=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Ho={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},qo={Circle:Yo,Default:zo,Image:Uo,LineString:Wo,Polygon:Yo,Text:function(t){function e(e,i,n,r){var o=t.call(this,e,i,n,r)||this;return o.labels_=null,o.text_="",o.textOffsetX_=0,o.textOffsetY_=0,o.textRotateWithView_=void 0,o.textRotation_=0,o.textFillState_=null,o.fillStates={},o.textStrokeState_=null,o.strokeStates={},o.textState_={},o.textStates={},o.textKey_="",o.fillKey_="",o.strokeKey_="",o.declutterImageWithText_=void 0,o}return Zo(e,t),e.prototype.finish=function(){var e=t.prototype.finish.call(this);return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e},e.prototype.drawText=function(t,e){var i=this.textFillState_,n=this.textStrokeState_,r=this.textState_;if(""!==this.text_&&r&&(i||n)){var o=this.coordinates,a=o.length,s=t.getType(),l=null,u=t.getStride();if(r.placement!==Lr||s!=ht&&s!=dt&&s!=pt&&s!=gt){var h=r.overflow?null:[];switch(s){case ut:case ft:l=t.getFlatCoordinates();break;case ht:l=t.getFlatMidpoint();break;case yt:l=t.getCenter();break;case dt:l=t.getFlatMidpoints(),u=2;break;case pt:l=t.getFlatInteriorPoint(),r.overflow||h.push(l[2]/this.resolution),u=3;break;case gt:var c=t.getFlatInteriorPoints();l=[];for(w=0,S=c.length;wR[2]}else E=x>T;var O,F=Math.PI,I=[],M=S+n===e;if(_=0,y=C,p=t[e=S],f=t[e+1],M){v();var A=Math.atan2(f-g,p-d);E&&(A+=A>0?-F:F);var L=(T+x)/2,k=(P+w)/2;return I[0]=[L,k,(b-o)/2,A,r],I}for(var D=0,j=r.length;D0?-F:F),void 0!==O){var N=G-O;if(N+=N>F?-2*F:N<-F?2*F:0,Math.abs(N)>a)return null}O=G;for(var z=D,B=0;Dt?t-l:r,x=o+u>e?e-u:o,w=f[3]+m*c[0]+f[1],S=f[0]+x*c[1]+f[2],C=y-f[3],b=v-f[0];return(d||0!==h)&&(pa[0]=C,ga[0]=C,pa[1]=b,fa[1]=b,fa[0]=C+w,da[0]=fa[0],da[1]=b+S,ga[1]=da[1]),0!==h?(Rt(_=Ot([1,0,0,1,0,0],i,n,1,1,h,-i,-n),pa),Rt(_,fa),Rt(_,da),Rt(_,ga),Jt(Math.min(pa[0],fa[0],da[0],ga[0]),Math.min(pa[1],fa[1],da[1],ga[1]),Math.max(pa[0],fa[0],da[0],ga[0]),Math.max(pa[1],fa[1],da[1],ga[1]),ca)):Jt(Math.min(C,C+w),Math.min(b,b+S),Math.max(C,C+w),Math.max(b,b+S),ca),p&&(y=Math.round(y),v=Math.round(v)),{drawImageX:y,drawImageY:v,drawImageW:m,drawImageH:x,originX:l,originY:u,declutterBox:{minX:ca[0],minY:ca[1],maxX:ca[2],maxY:ca[3],value:g},canvasTransform:_,scale:c}},t.prototype.replayImageOrLabel_=function(t,e,i,n,r,o,a){var s=!(!o&&!a),l=n.declutterBox,u=t.canvas,h=a?a[2]*n.scale[0]/2:0;return l.minX-h<=u.width/e&&l.maxX+h>=0&&l.minY-h<=u.height/e&&l.maxY+h>=0&&(s&&this.replayTextBackground_(t,pa,fa,da,ga,o,a),wr(t,n.canvasTransform,r,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0},t.prototype.fill_=function(t){if(this.alignFill_){var e=Rt(this.renderedTransform_,[0,0]),i=512*this.pixelRatio;t.save(),t.translate(e[0]%i,e[1]%i),t.rotate(this.viewRotation_)}t.fill(),this.alignFill_&&t.restore()},t.prototype.setStrokeStyle_=function(t,e){t.strokeStyle=e[1],t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.setLineDash&&(t.lineDashOffset=e[7],t.setLineDash(e[6]))},t.prototype.drawLabelWithPointPlacement_=function(t,e,i,n){var r=this.textStates[e],o=this.createLabel(t,e,n,i),a=this.strokeStates[i],s=this.pixelRatio,l=va(t,r.textAlign||"center"),u=Ho[r.textBaseline||"middle"],h=a&&a.lineWidth?a.lineWidth:0;return{label:o,anchorX:l*(o.width/s-2*r.scale[0])+2*(.5-l)*h,anchorY:u*o.height/s+2*(.5-u)*h}},t.prototype.execute_=function(t,e,i,n,r,o,a,s){var l,u,h;this.pixelCoordinates_&&g(i,this.renderedTransform_)?l=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),l=Ei(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),u=this.renderedTransform_,h=i,u[0]=h[0],u[1]=h[1],u[2]=h[2],u[3]=h[3],u[4]=h[4],u[5]=h[5]);for(var c,p,f,d,_,y,v,m,x,w,S,C,b,E,T,P,R=0,O=n.length,F=0,I=0,M=0,A=null,L=null,k=this.coordinateCache_,D=this.viewRotation_,j=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,G={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:D},N=this.instructions!=n||this.overlaps?0:200;RN&&(this.fill_(t),I=0),M>N&&(t.stroke(),M=0),I||M||(t.beginPath(),d=NaN,_=NaN),++R;break;case Co:var B=l[F=z[1]],U=l[F+1],X=l[F+2]-B,W=l[F+3]-U,V=Math.sqrt(X*X+W*W);t.moveTo(B+V,U),t.arc(B,U,V,0,2*Math.PI,!0),++R;break;case bo:t.closePath(),++R;break;case Eo:F=z[1],c=z[2];var Y=z[3],K=z[4],Z=6==z.length?z[5]:void 0;G.geometry=Y,G.feature=b,R in k||(k[R]=[]);var H=k[R];Z?Z(l,F,c,2,H):(H[0]=l[F],H[1]=l[F+1],H.length=2),K(H,G),++R;break;case Po:F=z[1],c=z[2],m=z[3],p=z[4],f=z[5];var q=z[6],J=z[7],Q=z[8],$=z[9],tt=z[10],et=z[11],it=z[12],nt=z[13],rt=z[14];if(!m&&z.length>=19){x=z[18],w=z[19],S=z[20],C=z[21];var ot=this.drawLabelWithPointPlacement_(x,w,S,C);m=ot.label,z[3]=m;var at=z[22];p=(ot.anchorX-at)*this.pixelRatio,z[4]=p;var st=z[23];f=(ot.anchorY-st)*this.pixelRatio,z[5]=f,q=m.height,z[6]=q,nt=m.width,z[13]=nt}var lt=void 0;z.length>24&&(lt=z[24]);var ut=void 0,ht=void 0,ct=void 0;z.length>16?(ut=z[15],ht=z[16],ct=z[17]):(ut=ur,ht=!1,ct=!1),tt&&j?et+=D:tt||j||(et-=D);for(var pt=0;Fi)break;var s=n[a];s||(s=[],n[a]=s),s.push(4*((t+r)*e+(t+o))+3),r>0&&s.push(4*((t-r)*e+(t+o))+3),o>0&&(s.push(4*((t+r)*e+(t-o))+3),r>0&&s.push(4*((t-r)*e+(t-o))+3))}for(var l=[],u=(r=0,n.length);r0){if(!o||p!==aa&&p!==ua||-1!==o.indexOf(t)){var u=(f[s]-3)/4,h=n-u%a,d=n-(u/a|0),g=r(t,e,h*h+d*d);if(g)return g}c.clearRect(0,0,a,a);break}}var g,_,y,v,m,x=Object.keys(this.executorsByZIndex_).map(Number);for(x.sort(h),g=x.length-1;g>=0;--g){var w=x[g].toString();for(y=this.executorsByZIndex_[w],_=xa.length-1;_>=0;--_)if(void 0!==(v=y[p=xa[_]])&&(m=v.executeHitDetection(c,s,i,d,u)))return m}},t.prototype.getClipCoords=function(t){var e=this.maxExtent_;if(!e)return null;var i=e[0],n=e[1],r=e[2],o=e[3],a=[i,n,i,o,r,o,r,n];return Ei(a,0,8,2,t,a),a},t.prototype.isEmpty=function(){return S(this.executorsByZIndex_)},t.prototype.execute=function(t,e,i,n,r,o,a){var s=Object.keys(this.executorsByZIndex_).map(Number);s.sort(h),this.maxExtent_&&(t.save(),this.clip(t,i));var l,u,c,p,f,d,g=o||xa;for(a&&s.reverse(),l=0,u=s.length;lthis.maxCacheSize_},t.prototype.expire=function(){if(this.canExpireCache()){var t=0;for(var e in this.cache_){var i=this.cache_[e];0!=(3&t++)||i.hasListener()||(delete this.cache_[e],--this.cacheSize_)}}},t.prototype.get=function(t,e,i){var n=Aa(t,e,i);return n in this.cache_?this.cache_[n]:null},t.prototype.set=function(t,e,i,n){var r=Aa(t,e,i);this.cache_[r]=n,++this.cacheSize_},t.prototype.setSize=function(t){this.maxCacheSize_=t,this.expire()},t}()),ka=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Da=function(t){function i(e,i,n,r){var o=t.call(this)||this;return o.extent=e,o.pixelRatio_=n,o.resolution=i,o.state=r,o}return ka(i,t),i.prototype.changed=function(){this.dispatchEvent(E)},i.prototype.getExtent=function(){return this.extent},i.prototype.getImage=function(){return e()},i.prototype.getPixelRatio=function(){return this.pixelRatio_},i.prototype.getResolution=function(){return this.resolution},i.prototype.getState=function(){return this.state},i.prototype.load=function(){e()},i}(b),ja=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Ga=function(t){function e(e,i,n,r,o,a){var s=t.call(this,e,i,n,Fn)||this;return s.src_=r,s.image_=new Image,null!==o&&(s.image_.crossOrigin=o),s.unlisten_=null,s.state=Fn,s.imageLoadFunction_=a,s}return ja(e,t),e.prototype.getImage=function(){return this.image_},e.prototype.handleImageError_=function(){this.state=An,this.unlistenImage_(),this.changed()},e.prototype.handleImageLoad_=function(){void 0===this.resolution&&(this.resolution=de(this.extent)/this.image_.height),this.state=Mn,this.unlistenImage_(),this.changed()},e.prototype.load=function(){this.state!=Fn&&this.state!=An||(this.state=In,this.changed(),this.imageLoadFunction_(this,this.src_),this.unlisten_=Na(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},e.prototype.setImage=function(t){this.image_=t},e.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},e}(Da);function Na(t,e,i){var n=t;if(n.src&&tr){var r=n.decode(),o=!0;return r.then((function(){o&&e()})).catch((function(t){o&&("EncodingError"===t.name&&"Invalid image type."===t.message?e():i())})),function(){o=!1}}var a=[z(n,k,e),z(n,T,i)];return function(){a.forEach(B)}}var za=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Ba=null,Ua=function(t){function e(e,i,n,r,o,a){var s=t.call(this)||this;return s.hitDetectionImage_=null,s.image_=e||new Image,null!==r&&(s.image_.crossOrigin=r),s.canvas_={},s.color_=a,s.unlisten_=null,s.imageState_=o,s.size_=n,s.src_=i,s.tainted_,s}return za(e,t),e.prototype.isTainted_=function(){if(void 0===this.tainted_&&this.imageState_===Mn){Ba||(Ba=ir(1,1)),Ba.drawImage(this.image_,0,0);try{Ba.getImageData(0,0,1,1),this.tainted_=!1}catch(t){Ba=null,this.tainted_=!0}}return!0===this.tainted_},e.prototype.dispatchChangeEvent_=function(){this.dispatchEvent(E)},e.prototype.handleImageError_=function(){this.imageState_=An,this.unlistenImage_(),this.dispatchChangeEvent_()},e.prototype.handleImageLoad_=function(){this.imageState_=Mn,this.size_?(this.image_.width=this.size_[0],this.image_.height=this.size_[1]):this.size_=[this.image_.width,this.image_.height],this.unlistenImage_(),this.dispatchChangeEvent_()},e.prototype.getImage=function(t){return this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_},e.prototype.getPixelRatio=function(t){return this.replaceColor_(t),this.canvas_[t]?t:1},e.prototype.getImageState=function(){return this.imageState_},e.prototype.getHitDetectionImage=function(){if(!this.hitDetectionImage_)if(this.isTainted_()){var t=this.size_[0],e=this.size_[1],i=ir(t,e);i.fillRect(0,0,t,e),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_},e.prototype.getSize=function(){return this.size_},e.prototype.getSrc=function(){return this.src_},e.prototype.load=function(){if(this.imageState_==Fn){this.imageState_=In;try{this.image_.src=this.src_}catch(t){this.handleImageError_()}this.unlisten_=Na(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}},e.prototype.replaceColor_=function(t){if(this.color_&&!this.canvas_[t]){var e=document.createElement("canvas");this.canvas_[t]=e,e.width=Math.ceil(this.image_.width*t),e.height=Math.ceil(this.image_.height*t);var i=e.getContext("2d");if(i.scale(t,t),i.drawImage(this.image_,0,0),i.globalCompositeOperation="multiply","multiply"===i.globalCompositeOperation||this.isTainted_())i.fillStyle=Bn(this.color_),i.fillRect(0,0,e.width,e.height),i.globalCompositeOperation="destination-in",i.drawImage(this.image_,0,0);else{for(var n=i.getImageData(0,0,e.width,e.height),r=n.data,o=this.color_[0]/255,a=this.color_[1]/255,s=this.color_[2]/255,l=this.color_[3],u=0,h=r.length;u0,6);var p=void 0!==r.src?Fn:Mn;return i.color_=void 0!==r.color?Wn(r.color):null,i.iconImage_=function(t,e,i,n,r,o){var a=La.get(e,n,o);return a||(a=new Ua(t,e,i,n,r,o),La.set(e,n,o,a)),a}(u,c,h,i.crossOrigin_,p,i.color_),i.offset_=void 0!==r.offset?r.offset:[0,0],i.offsetOrigin_=void 0!==r.offsetOrigin?r.offsetOrigin:Ia,i.origin_=null,i.size_=void 0!==r.size?r.size:null,i}return Xa(e,t),e.prototype.clone=function(){var t=this.getScale();return new e({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,crossOrigin:this.crossOrigin_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,src:this.getSrc(),offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,size:null!==this.size_?this.size_.slice():void 0,opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView()})},e.prototype.getAnchor=function(){if(this.normalizedAnchor_)return this.normalizedAnchor_;var t=this.anchor_,e=this.getSize();if(this.anchorXUnits_==Pa||this.anchorYUnits_==Pa){if(!e)return null;t=this.anchor_.slice(),this.anchorXUnits_==Pa&&(t[0]*=e[0]),this.anchorYUnits_==Pa&&(t[1]*=e[1])}if(this.anchorOrigin_!=Ia){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),this.anchorOrigin_!=Ma&&this.anchorOrigin_!=Fa||(t[0]=-t[0]+e[0]),this.anchorOrigin_!=Oa&&this.anchorOrigin_!=Fa||(t[1]=-t[1]+e[1])}return this.normalizedAnchor_=t,this.normalizedAnchor_},e.prototype.setAnchor=function(t){this.anchor_=t,this.normalizedAnchor_=null},e.prototype.getColor=function(){return this.color_},e.prototype.getImage=function(t){return this.iconImage_.getImage(t)},e.prototype.getPixelRatio=function(t){return this.iconImage_.getPixelRatio(t)},e.prototype.getImageSize=function(){return this.iconImage_.getSize()},e.prototype.getHitDetectionImageSize=function(){return this.getImageSize()},e.prototype.getImageState=function(){return this.iconImage_.getImageState()},e.prototype.getHitDetectionImage=function(){return this.iconImage_.getHitDetectionImage()},e.prototype.getOrigin=function(){if(this.origin_)return this.origin_;var t=this.offset_,e=this.getDisplacement();if(this.offsetOrigin_!=Ia){var i=this.getSize(),n=this.iconImage_.getSize();if(!i||!n)return null;t=t.slice(),this.offsetOrigin_!=Ma&&this.offsetOrigin_!=Fa||(t[0]=n[0]-i[0]-t[0]),this.offsetOrigin_!=Oa&&this.offsetOrigin_!=Fa||(t[1]=n[1]-i[1]-t[1])}return t[0]+=e[0],t[1]+=e[1],this.origin_=t,this.origin_},e.prototype.getSrc=function(){return this.iconImage_.getSrc()},e.prototype.getSize=function(){return this.size_?this.size_:this.iconImage_.getSize()},e.prototype.listenImageChange=function(t){this.iconImage_.addEventListener(E,t)},e.prototype.load=function(){this.iconImage_.load()},e.prototype.unlistenImageChange=function(t){this.iconImage_.removeEventListener(E,t)},e}(Gn);var Va={Point:function(t,e,i,n,r){var o,a=i.getImage(),s=i.getText();r&&(t=r,o=a&&s&&s.getText()?{}:void 0);if(a){if(a.getImageState()!=Mn)return;var l=t.getBuilder(i.getZIndex(),aa);l.setImageStyle(a,o),l.drawPoint(e,n)}if(s&&s.getText()){var u=t.getBuilder(i.getZIndex(),ua);u.setTextStyle(s,o),u.drawText(e,n)}},LineString:function(t,e,i,n,r){var o=i.getStroke();if(o){var a=t.getBuilder(i.getZIndex(),sa);a.setFillStrokeStyle(null,o),a.drawLineString(e,n)}var s=i.getText();if(s&&s.getText()){var l=(r||t).getBuilder(i.getZIndex(),ua);l.setTextStyle(s),l.drawText(e,n)}},Polygon:function(t,e,i,n,r){var o=i.getFill(),a=i.getStroke();if(o||a){var s=t.getBuilder(i.getZIndex(),la);s.setFillStrokeStyle(o,a),s.drawPolygon(e,n)}var l=i.getText();if(l&&l.getText()){var u=(r||t).getBuilder(i.getZIndex(),ua);u.setTextStyle(l),u.drawText(e,n)}},MultiPoint:function(t,e,i,n,r){var o,a=i.getImage(),s=i.getText();r&&(t=r,o=a&&s&&s.getText()?{}:void 0);if(a){if(a.getImageState()!=Mn)return;var l=t.getBuilder(i.getZIndex(),aa);l.setImageStyle(a,o),l.drawMultiPoint(e,n)}if(s&&s.getText()){var u=(r||t).getBuilder(i.getZIndex(),ua);u.setTextStyle(s,o),u.drawText(e,n)}},MultiLineString:function(t,e,i,n,r){var o=i.getStroke();if(o){var a=t.getBuilder(i.getZIndex(),sa);a.setFillStrokeStyle(null,o),a.drawMultiLineString(e,n)}var s=i.getText();if(s&&s.getText()){var l=(r||t).getBuilder(i.getZIndex(),ua);l.setTextStyle(s),l.drawText(e,n)}},MultiPolygon:function(t,e,i,n,r){var o=i.getFill(),a=i.getStroke();if(a||o){var s=t.getBuilder(i.getZIndex(),la);s.setFillStrokeStyle(o,a),s.drawMultiPolygon(e,n)}var l=i.getText();if(l&&l.getText()){var u=(r||t).getBuilder(i.getZIndex(),ua);u.setTextStyle(l),u.drawText(e,n)}},GeometryCollection:function(t,e,i,n,r){var o,a,s=e.getGeometriesArray();for(o=0,a=s.length;o0&&(a.width=0),this.container;var u=Math.round(t.size[0]*i),h=Math.round(t.size[1]*i);a.width!=u||a.height!=h?(a.width=u,a.height=h,a.style.transform!==r&&(a.style.transform=r)):this.containerReused||o.clearRect(0,0,u,h),this.preRender(o,t);var c=t.viewState,p=(c.projection,!1);if(n.extent&&this.clipping){var f=bi(n.extent);(p=!Kt(f,t.extent)&&me(f,t.extent))&&this.clipUnrotated(o,t,f)}this.renderWorlds(s,t),p&&o.restore(),this.postRender(o,t);var d=n.opacity,g=this.container;return d!==parseFloat(g.style.opacity)&&(g.style.opacity=1===d?"":String(d)),this.renderedRotation_!==c.rotation&&(this.renderedRotation_=c.rotation,this.hitDetectionImageData_=null),this.container},e.prototype.getFeatures=function(t){return new Promise(function(e){if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){var i=[this.context.canvas.width,this.context.canvas.height];Rt(this.pixelTransform,i);var n=this.renderedCenter_,r=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,s=this.renderedExtent_,l=this.getLayer(),u=[],c=i[0]/2,p=i[1]/2;u.push(this.getRenderTransform(n,r,o,.5,c,p,0).slice());var f=l.getSource(),d=a.getExtent();if(f.getWrapX()&&a.canWrapX()&&!Kt(d,s)){for(var g=s[0],_=ve(d),y=0,v=void 0;gd[2];)v=_*++y,u.push(this.getRenderTransform(n,r,o,.5,c,p,v).slice()),g-=_}this.hitDetectionImageData_=function(t,e,i,n,r,o,a){var s=ir(t[0]/2,t[1]/2);s.imageSmoothingEnabled=!1;for(var l=s.canvas,u=new Ta(s,.5,r,null,a),c=i.length,p=Math.floor(16777215/c),f={},d=1;d<=c;++d){var g=i[d-1],_=g.getStyleFunction()||n;if(n){var y=_(g,o);if(y){Array.isArray(y)||(y=[y]);for(var v="#"+("000000"+(d*p).toString(16)).slice(-6),m=0,x=y.length;m=i[2])){var r=ve(i),o=Math.floor((n[0]-i[0])/r)*r;t[0]-=o,t[2]-=o}return t}(y[0],u);w[0]v[0]&&w[2]>v[2]&&y.push([w[0]-m,w[1],w[2]-m,w[3]])}if(!this.dirty_&&this.renderedResolution_==h&&this.renderedRevision_==p&&this.renderedRenderOrder_==d&&Kt(this.renderedExtent_,_))return this.replayGroupChanged=!1,!0;this.replayGroup_=null,this.dirty_=!1;var S,C=new Jo(Ka(h,c),_,h,c);this.getLayer().getDeclutter()&&(S=new Jo(Ka(h,c),_,h,c));for(var b=0,E=y.length;b=200&&s.status<300){var n=e.getType(),l=void 0;n==ps||n==fs?l=s.responseText:n==ds?(l=s.responseXML)||(l=(new DOMParser).parseFromString(s.responseText,"application/xml")):n==cs&&(l=s.response),l?o(e.readFeatures(l,{extent:i,featureProjection:r}),e.readProjection(l)):a()}else a()},s.onerror=a,s.send()}(t,e,i,n,r,(function(t,e){void 0!==o&&o(t),s.addFeatures(t)}),a||v)}}var _s=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),ys=function(t){function e(e,i,n){var r=t.call(this,e)||this;return r.feature=i,r.features=n,r}return _s(e,t),e}(s),vs=function(t){function e(e){var i=this,n=e||{};(i=t.call(this,{attributions:n.attributions,projection:void 0,state:Hr,wrapX:void 0===n.wrapX||n.wrapX})||this).loader_=v,i.format_=n.format,i.overlaps_=void 0===n.overlaps||n.overlaps,i.url_=n.url,void 0!==n.loader?i.loader_=n.loader:void 0!==i.url_&&(it(i.format_,7),i.loader_=gs(i.url_,i.format_)),i.strategy_=void 0!==n.strategy?n.strategy:hs;var r,o,a=void 0===n.useSpatialIndex||n.useSpatialIndex;return i.featuresRtree_=a?new $a:null,i.loadedExtentsRtree_=new $a,i.nullGeometryFeatures_={},i.idIndex_={},i.uidIndex_={},i.featureChangeKeys_={},i.featuresCollection_=null,Array.isArray(n.features)?o=n.features:n.features&&(o=(r=n.features).getArray()),a||void 0!==r||(r=new et(o)),void 0!==o&&i.addFeaturesInternal(o),void 0!==r&&i.bindFeaturesCollection_(r),i}return _s(e,t),e.prototype.addFeature=function(t){this.addFeatureInternal(t),this.changed()},e.prototype.addFeatureInternal=function(t){var e=n(t);if(this.addToIndex_(e,t)){this.setupChangeEvents_(e,t);var i=t.getGeometry();if(i){var r=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(r,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new ys(ns,t))}else this.featuresCollection_&&this.featuresCollection_.remove(t)},e.prototype.setupChangeEvents_=function(t,e){this.featureChangeKeys_[t]=[N(e,E,this.handleFeatureChange_,this),N(e,l,this.handleFeatureChange_,this)]},e.prototype.addToIndex_=function(t,e){var i=!0,n=e.getId();return void 0!==n&&(n.toString()in this.idIndex_?i=!1:this.idIndex_[n.toString()]=e),i&&(it(!(t in this.uidIndex_),30),this.uidIndex_[t]=e),i},e.prototype.addFeatures=function(t){this.addFeaturesInternal(t),this.changed()},e.prototype.addFeaturesInternal=function(t){for(var e=[],i=[],r=[],o=0,a=t.length;ot)throw new Error("Tile load sequence violation");this.state=t,this.changed()},i.prototype.load=function(){e()},i.prototype.getAlpha=function(t,e){if(!this.transition_)return 1;var i=this.transitionStarts_[t];if(i){if(-1===i)return 1}else i=e,this.transitionStarts_[t]=i;var n=e-i+1e3/60;return n>=this.transition_?1:bs(n/this.transition_)},i.prototype.inTransition=function(t){return!!this.transition_&&-1!==this.transitionStarts_[t]},i.prototype.endTransition=function(t){this.transition_&&(this.transitionStarts_[t]=-1)},i}(b),Fs=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Is=function(t){function e(e,i,n,r,o,a){var s=t.call(this,e,i,a)||this;return s.crossOrigin_=r,s.src_=n,s.key=n,s.image_=new Image,null!==r&&(s.image_.crossOrigin=r),s.unlisten_=null,s.tileLoadFunction_=o,s}return Fs(e,t),e.prototype.getImage=function(){return this.image_},e.prototype.handleImageError_=function(){var t;this.state=Ss,this.unlistenImage_(),this.image_=((t=ir(1,1)).fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas),this.changed()},e.prototype.handleImageLoad_=function(){var t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=ws:this.state=Cs,this.unlistenImage_(),this.changed()},e.prototype.load=function(){this.state==Ss&&(this.state=ms,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==ms&&(this.state=xs,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=Na(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},e.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},e}(Os);var Ms=function(){function t(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}return t.prototype.begin=function(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0},t.prototype.update=function(t,e){this.points_.push(t,e,Date.now())},t.prototype.end=function(){if(this.points_.length<6)return!1;var t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]0&&this.points_[i+2]>t;)i-=3;var n=this.points_[e+2]-this.points_[i+2];if(n<1e3/60)return!1;var r=this.points_[e]-this.points_[i],o=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(o,r),this.initialVelocity_=Math.sqrt(r*r+o*o)/n,this.initialVelocity_>this.minVelocity_},t.prototype.getDistance=function(){return(this.minVelocity_-this.initialVelocity_)/this.decay_},t.prototype.getAngle=function(){return this.angle_},t}(),As=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Ls=function(t){function i(e){var i=t.call(this)||this;return i.map_=e,i}return As(i,t),i.prototype.dispatchRenderEvent=function(t,i){e()},i.prototype.calculateMatrices2D=function(t){var e=t.viewState,i=t.coordinateToPixelTransform,n=t.pixelToCoordinateTransform;Ot(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),Ft(n,i)},i.prototype.forEachFeatureAtCoordinate=function(t,e,i,n,r,o,a,s){var l,u=e.viewState;function h(t,e,i,n){return r.call(o,e,t?i:null,n)}var c=u.projection,p=ai(t.slice(),c),f=[[0,0]];if(c.canWrapX()&&n){var d=ve(c.getExtent());f.push([-d,0],[d,0])}for(var g=e.layerStatesArray,_=g.length,y=[],v=[],m=0;m=0;--x){var w=g[x],S=w.layer;if(S.hasRenderer()&&$r(w,u)&&a.call(s,S)){var C=S.getRenderer(),b=S.getSource();if(C&&b){var E=b.getWrapX()?p:t,T=h.bind(null,w.managed);v[0]=E[0]+f[m][0],v[1]=E[1]+f[m][1],l=C.forEachFeatureAtCoordinate(v,e,i,T,y)}if(l)return l}}if(0!==y.length){var P=1/y.length;return y.forEach((function(t,e){return t.distanceSq+=e*P})),y.sort((function(t,e){return t.distanceSq-e.distanceSq})),y.some((function(t){return l=t.callback(t.feature,t.layer,t.geometry)})),l}},i.prototype.forEachLayerAtPixel=function(t,i,n,r,o){return e()},i.prototype.hasFeatureAtCoordinate=function(t,e,i,n,r,o){return void 0!==this.forEachFeatureAtCoordinate(t,e,i,n,_,this,r,o)},i.prototype.getMap=function(){return this.map_},i.prototype.renderFrame=function(t){e()},i.prototype.scheduleExpireIconCache=function(t){La.canExpireCache()&&t.postRenderFunctions.push(ks)},i}(u);function ks(t,e){La.expire()}var Ds=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),js=function(t){function e(e){var i=t.call(this,e)||this;i.fontChangeListenerKey_=N(hr,l,e.redrawText.bind(e)),i.element_=document.createElement("div");var n=i.element_.style;n.position="absolute",n.width="100%",n.height="100%",n.zIndex="0",i.element_.className="ol-unselectable ol-layers";var r=e.getViewport();return r.insertBefore(i.element_,r.firstChild||null),i.children_=[],i.renderedVisible_=!0,i}return Ds(e,t),e.prototype.dispatchRenderEvent=function(t,e){var i=this.getMap();if(i.hasListener(t)){var n=new ea(t,void 0,e);i.dispatchEvent(n)}},e.prototype.disposeInternal=function(){B(this.fontChangeListenerKey_),this.element_.parentNode.removeChild(this.element_),t.prototype.disposeInternal.call(this)},e.prototype.renderFrame=function(t){if(t){this.calculateMatrices2D(t),this.dispatchRenderEvent(xn,t);var e=t.layerStatesArray.sort((function(t,e){return t.zIndex-e.zIndex})),i=t.viewState;this.children_.length=0;for(var n=[],r=null,o=0,a=e.length;o=0;--o)n[o].renderDeclutter(t);!function(t,e){for(var i=t.childNodes,n=0;;++n){var r=i[n],o=e[n];if(!r&&!o)break;r!==o&&(r?o?t.insertBefore(o,r):(t.removeChild(r),--n):t.appendChild(o))}}(this.element_,this.children_),this.dispatchRenderEvent(wn,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}else this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1)},e.prototype.forEachLayerAtPixel=function(t,e,i,n,r){for(var o=e.viewState,a=e.layerStatesArray,s=a.length-1;s>=0;--s){var l=a[s],u=l.layer;if(u.hasRenderer()&&$r(l,o)&&r(u)){var h=u.getRenderer().getDataAtPixel(t,e,i);if(h){var c=n(u,h);if(c)return c}}}},e}(Ls),Gs=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Ns="layers",zs=function(t){function e(e){var i=this,n=e||{},r=m({},n);delete r.layers;var o=n.layers;return(i=t.call(this,r)||this).layersListenerKeys_=[],i.listenerKeys_={},i.addEventListener(H(Ns),i.handleLayersChanged_),o?Array.isArray(o)?o=new et(o.slice(),{unique:!0}):it("function"==typeof o.getArray,43):o=new et(void 0,{unique:!0}),i.setLayers(o),i}return Gs(e,t),e.prototype.handleLayerChange_=function(){this.changed()},e.prototype.handleLayersChanged_=function(){this.layersListenerKeys_.forEach(B),this.layersListenerKeys_.length=0;var t=this.getLayers();for(var e in this.layersListenerKeys_.push(N(t,q,this.handleLayersAdd_,this),N(t,J,this.handleLayersRemove_,this)),this.listenerKeys_)this.listenerKeys_[e].forEach(B);x(this.listenerKeys_);for(var i=t.getArray(),r=0,o=i.length;rthis.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_},e.prototype.disposeInternal=function(){this.relayedListenerKey_&&(B(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(j,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(B(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(B),this.dragListenerKeys_.length=0,this.element_=null,t.prototype.disposeInternal.call(this)},e}(b),qs="postrender",Js="movestart",Qs="moveend",$s="layergroup",tl="size",el="target",il="view",nl=function(){function t(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}return t.prototype.clear=function(){this.elements_.length=0,this.priorities_.length=0,x(this.queuedElements_)},t.prototype.dequeue=function(){var 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));var n=this.keyFunction_(i);return delete this.queuedElements_[n],i},t.prototype.enqueue=function(t){it(!(this.keyFunction_(t)in this.queuedElements_),31);var e=this.priorityFunction_(t);return e!=1/0&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)},t.prototype.getCount=function(){return this.elements_.length},t.prototype.getLeftChildIndex_=function(t){return 2*t+1},t.prototype.getRightChildIndex_=function(t){return 2*t+2},t.prototype.getParentIndex_=function(t){return t-1>>1},t.prototype.heapify_=function(){var t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)},t.prototype.isEmpty=function(){return 0===this.elements_.length},t.prototype.isKeyQueued=function(t){return t in this.queuedElements_},t.prototype.isQueued=function(t){return this.isKeyQueued(this.keyFunction_(t))},t.prototype.siftUp_=function(t){for(var e=this.elements_,i=this.priorities_,n=e.length,r=e[t],o=i[t],a=t;t>1;){var s=this.getLeftChildIndex_(t),l=this.getRightChildIndex_(t),u=lt;){var a=this.getParentIndex_(e);if(!(n[a]>o))break;i[e]=i[a],n[e]=n[a],e=a}i[e]=r,n[e]=o},t.prototype.reprioritize=function(){var t,e,i,n=this.priorityFunction_,r=this.elements_,o=this.priorities_,a=0,s=r.length;for(e=0;e0;)n=(i=this.dequeue()[0]).getKey(),i.getState()!==ms||n in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[n]=!0,++this.tilesLoading_,++r,i.load())},e}(nl);var al="center",sl="resolution",ll="rotation";function ul(t,e,i){return function(n,r,o,a,s){if(n){var l=e?0:o[0]*r,u=e?0:o[1]*r,h=s?s[0]:0,c=s?s[1]:0,p=t[0]+l/2+h,f=t[2]-l/2+h,d=t[1]+u/2+c,g=t[3]-u/2+c;p>f&&(f=p=(f+p)/2),d>g&&(g=d=(g+d)/2);var _=Ce(n[0],p,f),y=Ce(n[1],d,g),v=30*r;return a&&i&&(_+=-v*Math.log(1+Math.max(0,p-n[0])/v)+v*Math.log(1+Math.max(0,n[0]-f)/v),y+=-v*Math.log(1+Math.max(0,d-n[1])/v)+v*Math.log(1+Math.max(0,n[1]-g)/v)),[_,y]}}}function hl(t){return t}function cl(t,e,i,n){var r=ve(e)/i[0],o=de(e)/i[1];return n?Math.min(t,Math.max(r,o)):Math.min(t,Math.min(r,o))}function pl(t,e,i){var 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),Ce(n,i/2,2*e)}function fl(t,e,i,n,r){return function(o,a,s,l){if(void 0!==o){var u=n?cl(t,n,s,r):t;return(void 0===i||i)&&l?pl(o,u,e):Ce(o,e,u)}}}function dl(t){return void 0!==t?0:void 0}function gl(t){return void 0!==t?t:void 0}var _l=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),yl=function(t){function e(e){var i=t.call(this)||this,n=m({},e);return i.hints_=[0,0],i.animations_=[],i.updateAnimationKey_,i.projection_=fi(n.projection,"EPSG:3857"),i.viewportSize_=[100,100],i.targetCenter_=null,i.targetResolution_,i.targetRotation_,i.cancelAnchor_=void 0,n.center&&(n.center=Si(n.center,i.projection_)),n.extent&&(n.extent=bi(n.extent,i.projection_)),i.applyOptions_(n),i}return _l(e,t),e.prototype.applyOptions_=function(t){var e=function(t){var e,i,n,r=void 0!==t.minZoom?t.minZoom:0,o=void 0!==t.maxZoom?t.maxZoom:28,a=void 0!==t.zoomFactor?t.zoomFactor:2,s=void 0!==t.multiWorld&&t.multiWorld,l=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,u=void 0!==t.showFullExtent&&t.showFullExtent,h=fi(t.projection,"EPSG:3857"),c=h.getExtent(),f=t.constrainOnlyCenter,d=t.extent;s||d||!h.isGlobal()||(f=!1,d=c);if(void 0!==t.resolutions){var g=t.resolutions;i=g[r],n=void 0!==g[o]?g[o]:g[g.length-1],e=t.constrainResolution?function(t,e,i,n){return function(r,o,a,s){if(void 0!==r){var l=t[0],u=t[t.length-1],h=i?cl(l,i,a,n):l;if(s)return void 0===e||e?pl(r,h,u):Ce(r,u,h);var c=Math.min(h,r),f=Math.floor(p(t,c,o));return t[f]>h&&f1&&"function"==typeof arguments[i-1]&&(e=arguments[i-1],--i),!this.isDef()){var n=arguments[i-1];return n.center&&this.setCenterInternal(n.center),void 0!==n.zoom&&this.setZoom(n.zoom),void 0!==n.rotation&&this.setRotation(n.rotation),void(e&&vl(e,!0))}for(var r=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,s=this.targetRotation_,l=[],u=0;u0},e.prototype.getInteracting=function(){return this.hints_[ba]>0},e.prototype.cancelAnimations=function(){var t;this.setHint(Ca,-this.hints_[Ca]);for(var e=0,i=this.animations_.length;e=0;--i){for(var n=this.animations_[i],r=!0,o=0,a=n.length;o0?l/s.duration:1;u>=1?(s.complete=!0,u=1):r=!1;var h=s.easing(u);if(s.sourceCenter){var c=s.sourceCenter[0],p=s.sourceCenter[1],f=c+h*(s.targetCenter[0]-c),d=p+h*(s.targetCenter[1]-p);this.targetCenter_=[f,d]}if(s.sourceResolution&&s.targetResolution){var g=1===h?s.targetResolution:s.sourceResolution+h*(s.targetResolution-s.sourceResolution);if(s.anchor){var _=this.getViewportSize_(this.getRotation()),y=this.constraints_.resolution(g,0,_,!0);this.targetCenter_=this.calculateCenterZoom(y,s.anchor)}this.targetResolution_=g,this.applyTargetState_(!0)}if(void 0!==s.sourceRotation&&void 0!==s.targetRotation){var v=1===h?Fe(s.targetRotation+Math.PI,2*Math.PI)-Math.PI:s.sourceRotation+h*(s.targetRotation-s.sourceRotation);if(s.anchor){var m=this.constraints_.rotation(v,!0);this.targetCenter_=this.calculateCenterRotate(m,s.anchor)}this.targetRotation_=v}if(this.applyTargetState_(!0),e=!0,!s.complete)break}}if(r){this.animations_[i]=null,this.setHint(Ca,-1);var x=n[0].callback;x&&vl(x,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}},e.prototype.calculateCenterRotate=function(t,e){var i,n,r,o=this.getCenterInternal();return void 0!==o&&(ii(i=[o[0]-e[0],o[1]-e[1]],t-this.getRotation()),r=e,(n=i)[0]+=+r[0],n[1]+=+r[1]),i},e.prototype.calculateCenterZoom=function(t,e){var i,n=this.getCenterInternal(),r=this.getResolution();void 0!==n&&void 0!==r&&(i=[e[0]-t*(e[0]-n[0])/r,e[1]-t*(e[1]-n[1])/r]);return i},e.prototype.getViewportSize_=function(t){var e=this.viewportSize_;if(t){var 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},e.prototype.setViewportSize=function(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)},e.prototype.getCenter=function(){var t=this.getCenterInternal();return t?wi(t,this.getProjection()):t},e.prototype.getCenterInternal=function(){return this.get(al)},e.prototype.getConstraints=function(){return this.constraints_},e.prototype.getConstrainResolution=function(){return this.options_.constrainResolution},e.prototype.getHints=function(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()},e.prototype.calculateExtent=function(t){return Ci(this.calculateExtentInternal(t),this.getProjection())},e.prototype.calculateExtentInternal=function(t){var e=t||this.getViewportSize_(),i=this.getCenterInternal();it(i,1);var n=this.getResolution();it(void 0!==n,2);var r=this.getRotation();return it(void 0!==r,3),fe(i,n,r,e)},e.prototype.getMaxResolution=function(){return this.maxResolution_},e.prototype.getMinResolution=function(){return this.minResolution_},e.prototype.getMaxZoom=function(){return this.getZoomForResolution(this.minResolution_)},e.prototype.setMaxZoom=function(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))},e.prototype.getMinZoom=function(){return this.getZoomForResolution(this.maxResolution_)},e.prototype.setMinZoom=function(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))},e.prototype.setConstrainResolution=function(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))},e.prototype.getProjection=function(){return this.projection_},e.prototype.getResolution=function(){return this.get(sl)},e.prototype.getResolutions=function(){return this.resolutions_},e.prototype.getResolutionForExtent=function(t,e){return this.getResolutionForExtentInternal(bi(t,this.getProjection()),e)},e.prototype.getResolutionForExtentInternal=function(t,e){var i=e||this.getViewportSize_(),n=ve(t)/i[0],r=de(t)/i[1];return Math.max(n,r)},e.prototype.getResolutionForValueFunction=function(t){var e=t||2,i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(i/n)/Math.log(e);return function(t){return i/Math.pow(e,t*r)}},e.prototype.getRotation=function(){return this.get(ll)},e.prototype.getValueForResolutionFunction=function(t){var e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(i/n)/e;return function(t){return Math.log(i/t)/e/r}},e.prototype.getViewportSizeMinusPadding_=function(t){var e=this.getViewportSize_(t),i=this.padding;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e},e.prototype.getState=function(){var t=this.getProjection(),e=this.getResolution(),i=this.getRotation(),n=this.getCenterInternal(),r=this.padding;if(r){var o=this.getViewportSizeMinusPadding_();n=xl(n,this.getViewportSize_(),[o[0]/2+r[3],o[1]/2+r[0]],e,i)}return{center:n.slice(0),projection:void 0!==t?t:null,resolution:e,rotation:i,zoom:this.getZoom()}},e.prototype.getZoom=function(){var t,e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t},e.prototype.getZoomForResolution=function(t){var e,i,n=this.minZoom_||0;if(this.resolutions_){var r=p(this.resolutions_,t,1);n=r,e=this.resolutions_[r],i=r==this.resolutions_.length-1?2:e/this.resolutions_[r+1]}else e=this.maxResolution_,i=this.zoomFactor_;return n+Math.log(e/t)/Math.log(i)},e.prototype.getResolutionForZoom=function(t){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;var e=Ce(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,Ce(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)},e.prototype.fit=function(t,e){var i;if(it(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,24),Array.isArray(t))it(!xe(t),25),i=_n(n=bi(t,this.getProjection()));else if(t.getType()===yt){var n;(i=_n(n=bi(t.getExtent(),this.getProjection()))).rotate(this.getRotation(),ce(n))}else{i=t}this.fitInternal(i,e)},e.prototype.fitInternal=function(t,e){var i=e||{},n=i.size;n||(n=this.getViewportSizeMinusPadding_());var r,o=void 0!==i.padding?i.padding:[0,0,0,0],a=void 0!==i.nearest&&i.nearest;r=void 0!==i.minResolution?i.minResolution:void 0!==i.maxZoom?this.getResolutionForZoom(i.maxZoom):0;for(var s=t.getFlatCoordinates(),l=this.getRotation(),u=Math.cos(-l),h=Math.sin(-l),c=1/0,p=1/0,f=-1/0,d=-1/0,g=t.getStride(),_=0,y=s.length;_=0;s--){var l=a[s];if(l.getMap()===this&&l.getActive()&&this.getTargetElement())if(!l.handleEvent(t)||t.propagationStopped)break}}},e.prototype.handlePostRender=function(){var t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){var i=this.maxTilesLoading_,n=i;if(t){var r=t.viewHints;if(r[Ca]||r[ba]){var o=!tr&&Date.now()-t.time>8;i=o?0:8,n=o?0:2}}e.getTilesLoading()0&&t[1]>0}(i)&&n&&n.isDef()){var a=n.getHints(this.frameState_?this.frameState_.viewHints:void 0),s=n.getState();o={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutterTree:null,extent:fe(s.center,s.resolution,s.rotation,i),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:i,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:s,viewHints:a,wantedTiles:{}}}if(this.frameState_=o,this.renderer_.renderFrame(o),o){if(o.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,o.postRenderFunctions),r)(!this.previousExtent_||!xe(this.previousExtent_)&&!ie(o.extent,this.previousExtent_))&&(this.dispatchEvent(new Us(Js,this,r)),this.previousExtent_=Qt(this.previousExtent_));this.previousExtent_&&!o.viewHints[Ca]&&!o.viewHints[ba]&&!ie(o.extent,this.previousExtent_)&&(this.dispatchEvent(new Us(Qs,this,o)),Wt(o.extent,this.previousExtent_))}this.dispatchEvent(new Us(qs,this,o)),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout((function(){e.postRenderTimeoutHandle_=void 0,e.handlePostRender()}),0))},e.prototype.setLayerGroup=function(t){this.set($s,t)},e.prototype.setSize=function(t){this.set(tl,t)},e.prototype.setTarget=function(t){this.set(el,t)},e.prototype.setView=function(t){this.set(il,t)},e.prototype.updateSize=function(){var t=this.getTargetElement();if(t){var e=getComputedStyle(t);this.setSize([t.offsetWidth-parseFloat(e.borderLeftWidth)-parseFloat(e.paddingLeft)-parseFloat(e.paddingRight)-parseFloat(e.borderRightWidth),t.offsetHeight-parseFloat(e.borderTopWidth)-parseFloat(e.paddingTop)-parseFloat(e.paddingBottom)-parseFloat(e.borderBottomWidth)])}else this.setSize(void 0);this.updateViewportSize_()},e.prototype.updateViewportSize_=function(){var t=this.getView();if(t){var e=void 0,i=getComputedStyle(this.viewport_);i.width&&i.height&&(e=[parseInt(i.width,10),parseInt(i.height,10)]),t.setViewportSize(e)}},e}(K);var Cl=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),bl=function(t){function e(e){var i=t.call(this)||this,n=e.element;return!n||e.target||n.style.pointerEvents||(n.style.pointerEvents="auto"),i.element=n||null,i.target_=null,i.map_=null,i.listenerKeys=[],e.render&&(i.render=e.render),e.target&&i.setTarget(e.target),i}return Cl(e,t),e.prototype.disposeInternal=function(){rr(this.element),t.prototype.disposeInternal.call(this)},e.prototype.getMap=function(){return this.map_},e.prototype.setMap=function(t){this.map_&&rr(this.element);for(var e=0,i=this.listenerKeys.length;e0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!g(e,this.renderedAttributions_)){!function(t){for(;t.lastChild;)t.removeChild(t.lastChild)}(this.ulElement_);for(var n=0,r=e.length;n0&&e%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.duration_,easing:Es}):t.setRotation(0))}},e.prototype.render=function(t){var e=t.frameState;if(e){var i=e.viewState.rotation;if(i!=this.rotation_){var n="rotate("+i+"rad)";if(this.autoHide_){var r=this.element.classList.contains("ol-hidden");r||0!==i?r&&0!==i&&this.element.classList.remove("ol-hidden"):this.element.classList.add("ol-hidden")}this.label_.style.transform=n}this.rotation_=i}},e}(bl),Ol=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Fl=function(t){function e(e){var i=this,n=e||{};i=t.call(this,{element:document.createElement("div"),target:n.target})||this;var r=void 0!==n.className?n.className:"ol-zoom",o=void 0!==n.delta?n.delta:1,a=void 0!==n.zoomInClassName?n.zoomInClassName:r+"-in",s=void 0!==n.zoomOutClassName?n.zoomOutClassName:r+"-out",l=void 0!==n.zoomInLabel?n.zoomInLabel:"+",u=void 0!==n.zoomOutLabel?n.zoomOutLabel:"−",h=void 0!==n.zoomInTipLabel?n.zoomInTipLabel:"Zoom in",c=void 0!==n.zoomOutTipLabel?n.zoomOutTipLabel:"Zoom out",p=document.createElement("button");p.className=a,p.setAttribute("type","button"),p.title=h,p.appendChild("string"==typeof l?document.createTextNode(l):l),p.addEventListener(R,i.handleClick_.bind(i,o),!1);var f=document.createElement("button");f.className=s,f.setAttribute("type","button"),f.title=c,f.appendChild("string"==typeof u?document.createTextNode(u):u),f.addEventListener(R,i.handleClick_.bind(i,-o),!1);var d=r+" ol-unselectable ol-control",g=i.element;return g.className=d,g.appendChild(p),g.appendChild(f),i.duration_=void 0!==n.duration?n.duration:250,i}return Ol(e,t),e.prototype.handleClick_=function(t,e){e.preventDefault(),this.zoomByDelta_(t)},e.prototype.zoomByDelta_=function(t){var e=this.getMap().getView();if(e){var i=e.getZoom();if(void 0!==i){var n=e.getConstrainedZoom(i+t);this.duration_>0?(e.getAnimating()&&e.cancelAnimations(),e.animate({zoom:n,duration:this.duration_,easing:Es})):e.setZoom(n)}}},e}(bl),Il=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Ml="degrees",Al="imperial",Ll="nautical",kl="metric",Dl="us",jl=[1,2,5],Gl=function(t){function e(e){var i=this,n=e||{},r=void 0!==n.className?n.className:n.bar?"ol-scale-bar":"ol-scale-line";return(i=t.call(this,{element:document.createElement("div"),render:n.render,target:n.target})||this).innerElement_=document.createElement("div"),i.innerElement_.className=r+"-inner",i.element.className=r+" ol-unselectable",i.element.appendChild(i.innerElement_),i.viewState_=null,i.minWidth_=void 0!==n.minWidth?n.minWidth:64,i.renderedVisible_=!1,i.renderedWidth_=void 0,i.renderedHTML_="",i.addEventListener(H("units"),i.handleUnitsChanged_),i.setUnits(n.units||kl),i.scaleBar_=n.bar||!1,i.scaleBarSteps_=n.steps||4,i.scaleBarText_=n.text||!1,i.dpi_=n.dpi||void 0,i}return Il(e,t),e.prototype.getUnits=function(){return this.get("units")},e.prototype.handleUnitsChanged_=function(){this.updateElement_()},e.prototype.setUnits=function(t){this.set("units",t)},e.prototype.setDpi=function(t){this.dpi_=t},e.prototype.updateElement_=function(){var t=this.viewState_;if(t){var e=t.center,i=t.projection,n=this.getUnits(),r=n==Ml?vt:xt,o=ci(i,t.resolution,e,r),a=this.minWidth_*(this.dpi_||25.4/.28)/(25.4/.28),s=a*o,l="";if(n==Ml){var u=Ct[vt];(s*=u)=a)break;++d}f=this.scaleBar_?this.createScaleBar(c,h,l):h.toFixed(p<0?-p:0)+" "+l,this.renderedHTML_!=f&&(this.innerElement_.innerHTML=f,this.renderedHTML_=f),this.renderedWidth_!=c&&(this.innerElement_.style.width=c+"px",this.renderedWidth_=c),this.renderedVisible_||(this.element.style.display="",this.renderedVisible_=!0)}else this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1)},e.prototype.createScaleBar=function(t,e,i){for(var n="1 : "+Math.round(this.getScaleForResolution()).toLocaleString(),r=[],o=t/this.scaleBarSteps_,a="#ffffff",s=0;s
'+this.createMarker("relative",s)+(s%2==0||2===this.scaleBarSteps_?this.createStepText(s,t,!1,e,i):"")+""),s===this.scaleBarSteps_-1&&r.push(this.createStepText(s+1,t,!0,e,i)),a="#ffffff"===a?"#000000":"#ffffff";return'
'+(this.scaleBarText_?'
'+n+"
":"")+r.join("")+"
"},e.prototype.createMarker=function(t,e){return'
'},e.prototype.createStepText=function(t,e,i,n,r){var o=(0===t?0:Math.round(n/this.scaleBarSteps_*t*100)/100)+(0===t?"":" "+r);return'
'+o+"
"},e.prototype.getScaleForResolution=function(){var t=ci(this.viewState_.projection,this.viewState_.resolution,this.viewState_.center),e=this.dpi_||25.4/.28,i=this.viewState_.projection.getMetersPerUnit();return parseFloat(t.toString())*i*(1e3/25.4)*e},e.prototype.render=function(t){var e=t.frameState;this.viewState_=e?e.viewState:null,this.updateElement_()},e}(bl);var Nl="active",zl=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Bl=function(t){function e(e){var i=t.call(this)||this;return e&&e.handleEvent&&(i.handleEvent=e.handleEvent),i.map_=null,i.setActive(!0),i}return zl(e,t),e.prototype.getActive=function(){return this.get(Nl)},e.prototype.getMap=function(){return this.map_},e.prototype.handleEvent=function(t){return!0},e.prototype.setActive=function(t){this.set(Nl,t)},e.prototype.setMap=function(t){this.map_=t},e}(K);function Ul(t,e,i,n){var r=t.getZoom();if(void 0!==r){var o=t.getConstrainedZoom(r+e),a=t.getResolutionForZoom(o);t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:a,anchor:i,duration:void 0!==n?n:250,easing:Es})}}var Xl=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Wl=function(t){function e(e){var i=t.call(this)||this,n=e||{};return i.delta_=n.delta?n.delta:1,i.duration_=void 0!==n.duration?n.duration:250,i}return Xl(e,t),e.prototype.handleEvent=function(t){var e=!1;if(t.type==Vs.DBLCLICK){var i=t.originalEvent,n=t.map,r=t.coordinate,o=i.shiftKey?-this.delta_:this.delta_;Ul(n.getView(),o,r,this.duration_),i.preventDefault(),e=!0}return!e},e}(Bl),Vl=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Yl=function(t){function e(e){var i=this,n=e||{};return i=t.call(this,n)||this,n.handleDownEvent&&(i.handleDownEvent=n.handleDownEvent),n.handleDragEvent&&(i.handleDragEvent=n.handleDragEvent),n.handleMoveEvent&&(i.handleMoveEvent=n.handleMoveEvent),n.handleUpEvent&&(i.handleUpEvent=n.handleUpEvent),n.stopDown&&(i.stopDown=n.stopDown),i.handlingDownUpSequence=!1,i.trackedPointers_={},i.targetPointers=[],i}return Vl(e,t),e.prototype.getPointerCount=function(){return this.targetPointers.length},e.prototype.handleDownEvent=function(t){return!1},e.prototype.handleDragEvent=function(t){},e.prototype.handleEvent=function(t){if(!t.originalEvent)return!0;var e=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence){if(t.type==Vs.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==Vs.POINTERUP){var i=this.handleUpEvent(t);this.handlingDownUpSequence=i&&this.targetPointers.length>0}}else if(t.type==Vs.POINTERDOWN){var n=this.handleDownEvent(t);this.handlingDownUpSequence=n,e=this.stopDown(n)}else t.type==Vs.POINTERMOVE&&this.handleMoveEvent(t);return!e},e.prototype.handleMoveEvent=function(t){},e.prototype.handleUpEvent=function(t){return!1},e.prototype.stopDown=function(t){return t},e.prototype.updateTrackedPointers_=function(t){if(function(t){var e=t.type;return e===Vs.POINTERDOWN||e===Vs.POINTERDRAG||e===Vs.POINTERUP}(t)){var e=t.originalEvent,i=e.pointerId.toString();t.type==Vs.POINTERUP?delete this.trackedPointers_[i]:(t.type==Vs.POINTERDOWN||i in this.trackedPointers_)&&(this.trackedPointers_[i]=e),this.targetPointers=w(this.trackedPointers_)}},e}(Bl);function Kl(t){for(var e=t.length,i=0,n=0,r=0;r0&&this.condition_(t)){var 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},e}(Yl),lu=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),uu=function(t){function e(e){var i=this,n=e||{};return(i=t.call(this,{stopDown:y})||this).condition_=n.condition?n.condition:Hl,i.lastAngle_=void 0,i.duration_=void 0!==n.duration?n.duration:250,i}return lu(e,t),e.prototype.handleDragEvent=function(t){if(ru(t)){var e=t.map,i=e.getView();if(i.getConstraints().rotation!==dl){var n=e.getSize(),r=t.pixel,o=Math.atan2(n[1]/2-r[1],r[0]-n[0]/2);if(void 0!==this.lastAngle_){var a=o-this.lastAngle_;i.adjustRotationInternal(-a)}this.lastAngle_=o}}},e.prototype.handleUpEvent=function(t){return!ru(t)||(t.map.getView().endInteraction(this.duration_),!1)},e.prototype.handleDownEvent=function(t){return!!ru(t)&&(!(!Ql(t)||!this.condition_(t))&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0))},e}(Yl),hu=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),cu=function(t){function e(e){var i=t.call(this)||this;return i.geometry_=null,i.element_=document.createElement("div"),i.element_.style.position="absolute",i.element_.style.pointerEvents="auto",i.element_.className="ol-box "+e,i.map_=null,i.startPixel_=null,i.endPixel_=null,i}return hu(e,t),e.prototype.disposeInternal=function(){this.setMap(null)},e.prototype.render_=function(){var t=this.startPixel_,e=this.endPixel_,i=this.element_.style;i.left=Math.min(t[0],e[0])+"px",i.top=Math.min(t[1],e[1])+"px",i.width=Math.abs(e[0]-t[0])+"px",i.height=Math.abs(e[1]-t[1])+"px"},e.prototype.setMap=function(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);var e=this.element_.style;e.left="inherit",e.top="inherit",e.width="inherit",e.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)},e.prototype.setPixels=function(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()},e.prototype.createOrUpdateGeometry=function(){var 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 gn([i])},e.prototype.getGeometry=function(){return this.geometry_},e}(u),pu=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),fu="boxstart",du="boxdrag",gu="boxend",_u="boxcancel",yu=function(t){function e(e,i,n){var r=t.call(this,e)||this;return r.coordinate=i,r.mapBrowserEvent=n,r}return pu(e,t),e}(s),vu=function(t){function e(e){var i=t.call(this)||this,n=e||{};return i.box_=new cu(n.className||"ol-dragbox"),i.minArea_=void 0!==n.minArea?n.minArea:64,n.onBoxEnd&&(i.onBoxEnd=n.onBoxEnd),i.startPixel_=null,i.condition_=n.condition?n.condition:Ql,i.boxEndCondition_=n.boxEndCondition?n.boxEndCondition:i.defaultBoxEndCondition,i}return pu(e,t),e.prototype.defaultBoxEndCondition=function(t,e,i){var n=i[0]-e[0],r=i[1]-e[1];return n*n+r*r>=this.minArea_},e.prototype.getGeometry=function(){return this.box_.getGeometry()},e.prototype.handleDragEvent=function(t){this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new yu(du,t.coordinate,t))},e.prototype.handleUpEvent=function(t){this.box_.setMap(null);var e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new yu(e?gu:_u,t.coordinate,t)),!1},e.prototype.handleDownEvent=function(t){return!!this.condition_(t)&&(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new yu(fu,t.coordinate,t)),!0)},e.prototype.onBoxEnd=function(t){},e}(Yl),mu=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),xu=function(t){function e(e){var i=this,n=e||{},r=n.condition?n.condition:iu;return(i=t.call(this,{condition:r,className:n.className||"ol-dragzoom",minArea:n.minArea})||this).duration_=void 0!==n.duration?n.duration:200,i.out_=void 0!==n.out&&n.out,i}return mu(e,t),e.prototype.onBoxEnd=function(t){var e=this.getMap(),i=e.getView(),n=e.getSize(),r=this.getGeometry().getExtent();if(this.out_){var o=i.calculateExtentInternal(n),a=te([e.getPixelFromCoordinateInternal(ue(r)),e.getPixelFromCoordinateInternal(ye(r))]);!function(t,e){var i=(t[2]-t[0])/2*(e-1),n=(t[3]-t[1])/2*(e-1);t[0]-=i,t[2]+=i,t[1]-=n,t[3]+=n}(o,1/i.getResolutionForExtentInternal(a,n)),r=o}var s=i.getConstrainedResolution(i.getResolutionForExtentInternal(r,n)),l=i.getConstrainedCenter(ce(r),s);i.animateInternal({resolution:s,center:l,duration:this.duration_,easing:Es})},e}(vu),wu=37,Su=38,Cu=39,bu=40,Eu=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Tu=function(t){function e(e){var i=t.call(this)||this,n=e||{};return i.defaultCondition_=function(t){return eu(t)&&nu(t)},i.condition_=void 0!==n.condition?n.condition:i.defaultCondition_,i.duration_=void 0!==n.duration?n.duration:100,i.pixelDelta_=void 0!==n.pixelDelta?n.pixelDelta:128,i}return Eu(e,t),e.prototype.handleEvent=function(t){var e=!1;if(t.type==A){var i=t.originalEvent,n=i.keyCode;if(this.condition_(t)&&(n==bu||n==wu||n==Cu||n==Su)){var r=t.map.getView(),o=r.getResolution()*this.pixelDelta_,a=0,s=0;n==bu?s=-o:n==wu?a=-o:n==Cu?a=o:s=o;var l=[a,s];ii(l,r.getRotation()),function(t,e,i){var n=t.getCenterInternal();if(n){var r=[n[0]+e[0],n[1]+e[1]];t.animateInternal({duration:void 0!==i?i:250,easing:Ps,center:t.getConstrainedCenter(r)})}}(r,l,this.duration_),i.preventDefault(),e=!0}}return!e},e}(Bl),Pu=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Ru=function(t){function e(e){var i=t.call(this)||this,n=e||{};return i.condition_=n.condition?n.condition:nu,i.delta_=n.delta?n.delta:1,i.duration_=void 0!==n.duration?n.duration:100,i}return Pu(e,t),e.prototype.handleEvent=function(t){var e=!1;if(t.type==A||t.type==L){var i=t.originalEvent,n=i.charCode;if(this.condition_(t)&&(n=="+".charCodeAt(0)||n=="-".charCodeAt(0))){var r=t.map,o=n=="+".charCodeAt(0)?this.delta_:-this.delta_;Ul(r.getView(),o,void 0,this.duration_),i.preventDefault(),e=!0}}return!e},e}(Bl),Ou=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Fu="trackpad",Iu="wheel",Mu=function(t){function e(e){var i=this,n=e||{};(i=t.call(this,n)||this).totalDelta_=0,i.lastDelta_=0,i.maxDelta_=void 0!==n.maxDelta?n.maxDelta:1,i.duration_=void 0!==n.duration?n.duration:250,i.timeout_=void 0!==n.timeout?n.timeout:80,i.useAnchor_=void 0===n.useAnchor||n.useAnchor,i.constrainResolution_=void 0!==n.constrainResolution&&n.constrainResolution;var r=n.condition?n.condition:Jl;return i.condition_=n.onFocusOnly?Zl(ql,r):r,i.lastAnchor_=null,i.startTime_=void 0,i.timeoutId_,i.mode_=void 0,i.trackpadEventGap_=400,i.trackpadTimeoutId_,i.deltaPerZoom_=300,i}return Ou(e,t),e.prototype.endInteraction_=function(){this.trackpadTimeoutId_=void 0,this.getMap().getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_)},e.prototype.handleEvent=function(t){if(!this.condition_(t))return!0;if(t.type!==G)return!0;var e,i=t.map,n=t.originalEvent;if(n.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.coordinate),t.type==G&&(e=n.deltaY,Hn&&n.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(e/=Qn),n.deltaMode===WheelEvent.DOM_DELTA_LINE&&(e*=40)),0===e)return!1;this.lastDelta_=e;var r=Date.now();void 0===this.startTime_&&(this.startTime_=r),(!this.mode_||r-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(e)<4?Fu:Iu);var o=i.getView();if(this.mode_===Fu&&!o.getConstrainResolution()&&!this.constrainResolution_)return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(o.getAnimating()&&o.cancelAnimations(),o.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),o.adjustZoom(-e/this.deltaPerZoom_,this.lastAnchor_),this.startTime_=r,!1;this.totalDelta_+=e;var a=Math.max(this.timeout_-(r-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,i),a),!1},e.prototype.handleWheelZoom_=function(t){var e=t.getView();e.getAnimating()&&e.cancelAnimations();var i=-Ce(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),Ul(e,i,this.lastAnchor_,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0},e.prototype.setMouseAnchor=function(t){this.useAnchor_=t,t||(this.lastAnchor_=null)},e}(Bl),Au=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Lu=function(t){function e(e){var i=this,n=e||{},r=n;return r.stopDown||(r.stopDown=y),(i=t.call(this,r)||this).anchor_=null,i.lastAngle_=void 0,i.rotating_=!1,i.rotationDelta_=0,i.threshold_=void 0!==n.threshold?n.threshold:.3,i.duration_=void 0!==n.duration?n.duration:250,i}return Au(e,t),e.prototype.handleDragEvent=function(t){var e=0,i=this.targetPointers[0],n=this.targetPointers[1],r=Math.atan2(n.clientY-i.clientY,n.clientX-i.clientX);if(void 0!==this.lastAngle_){var o=r-this.lastAngle_;this.rotationDelta_+=o,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=o}this.lastAngle_=r;var a=t.map,s=a.getView();if(s.getConstraints().rotation!==dl){var l=a.getViewport().getBoundingClientRect(),u=Kl(this.targetPointers);u[0]-=l.left,u[1]-=l.top,this.anchor_=a.getCoordinateFromPixelInternal(u),this.rotating_&&(a.render(),s.adjustRotationInternal(e,this.anchor_))}},e.prototype.handleUpEvent=function(t){return!(this.targetPointers.length<2)||(t.map.getView().endInteraction(this.duration_),!1)},e.prototype.handleDownEvent=function(t){if(this.targetPointers.length>=2){var 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},e}(Yl),ku=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Du=function(t){function e(e){var i=this,n=e||{},r=n;return r.stopDown||(r.stopDown=y),(i=t.call(this,r)||this).anchor_=null,i.duration_=void 0!==n.duration?n.duration:400,i.lastDistance_=void 0,i.lastScaleDelta_=1,i}return ku(e,t),e.prototype.handleDragEvent=function(t){var e=1,i=this.targetPointers[0],n=this.targetPointers[1],r=i.clientX-n.clientX,o=i.clientY-n.clientY,a=Math.sqrt(r*r+o*o);void 0!==this.lastDistance_&&(e=this.lastDistance_/a),this.lastDistance_=a;var s=t.map,l=s.getView();1!=e&&(this.lastScaleDelta_=e);var u=s.getViewport().getBoundingClientRect(),h=Kl(this.targetPointers);h[0]-=u.left,h[1]-=u.top,this.anchor_=s.getCoordinateFromPixelInternal(h),s.render(),l.adjustResolutionInternal(e,this.anchor_)},e.prototype.handleUpEvent=function(t){if(this.targetPointers.length<2){var e=t.map.getView(),i=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,i),!1}return!0},e.prototype.handleDownEvent=function(t){if(this.targetPointers.length>=2){var e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1},e}(Yl),ju=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Gu="addfeatures",Nu=function(t){function e(e,i,n,r){var o=t.call(this,e)||this;return o.features=n,o.file=i,o.projection=r,o}return ju(e,t),e}(s),zu=function(t){function e(e){var i=this,n=e||{};(i=t.call(this,{handleEvent:_})||this).readAsBuffer_=!1,i.formats_=[];for(var r=n.formatConstructors?n.formatConstructors:[],o=0,a=r.length;o0){this.source_&&(this.source_.clear(),this.source_.addFeatures(c)),this.dispatchEvent(new Nu(Gu,t,c,o));break}}},e.prototype.registerListeners_=function(){var t=this.getMap();if(t){var e=this.target?this.target:t.getViewport();this.dropListenKeys_=[N(e,M,this.handleDrop,this),N(e,F,this.handleStop,this),N(e,I,this.handleStop,this),N(e,M,this.handleStop,this)]}},e.prototype.setActive=function(e){!this.getActive()&&e&&this.registerListeners_(),this.getActive()&&!e&&this.unregisterListeners_(),t.prototype.setActive.call(this,e)},e.prototype.setMap=function(e){this.unregisterListeners_(),t.prototype.setMap.call(this,e),this.getActive()&&this.registerListeners_()},e.prototype.tryReadFeatures_=function(t,e,i){try{return t.readFeatures(e,i)}catch(t){return null}},e.prototype.unregisterListeners_=function(){this.dropListenKeys_&&(this.dropListenKeys_.forEach(B),this.dropListenKeys_=null)},e.prototype.handleDrop=function(t){for(var e=t.dataTransfer.files,i=0,n=e.length;i1?1:-1;return e.endInteraction(this.duration_,i),this.lastScaleDelta_=0,!1},e.prototype.handleDownEvent=function(t){return!!ru(t)&&(!!this.condition_(t)&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,this.lastMagnitude_=void 0,!0))},e}(Yl),Xu=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Wu=function(t){function e(e,i,n){var r=t.call(this)||this;if(void 0!==n&&void 0===i)r.setFlatCoordinates(n,e);else{var o=i||0;r.setCenterAndRadius(e,o,n)}return r}return Xu(e,t),e.prototype.clone=function(){var t=new e(this.flatCoordinates.slice(),void 0,this.layout);return t.applyProperties(this),t},e.prototype.closestPointXY=function(t,e,i,n){var r=this.flatCoordinates,o=t-r[0],a=e-r[1],s=o*o+a*a;if(s=e[0]||(t[1]<=e[1]&&t[3]>=e[1]||se(t,this.intersectsCoordinate.bind(this)))}return!1},e.prototype.setCenter=function(t){var e=this.stride,i=this.flatCoordinates[e]-this.flatCoordinates[0],n=t.slice();n[e]=n[0]+i;for(var r=1;r=this.dragVertexDelay_?(this.downPx_=e.pixel,this.shouldHandle_=!this.freehand_,i=!0):this.lastDragTime_=void 0,this.shouldHandle_&&void 0!==this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0));return this.freehand_&&e.type===Vs.POINTERDRAG&&null!==this.sketchFeature_?(this.addToDrawing_(e.coordinate),n=!1):this.freehand_&&e.type===Vs.POINTERDOWN?n=!1:i&&this.getPointerCount()<2?(n=e.type===Vs.POINTERMOVE)&&this.freehand_?(this.handlePointerMove_(e),this.shouldHandle_&&e.originalEvent.preventDefault()):("mouse"===e.originalEvent.pointerType||e.type===Vs.POINTERDRAG&&void 0===this.downTimeout_)&&this.handlePointerMove_(e):e.type===Vs.DBLCLICK&&(n=!1),t.prototype.handleEvent.call(this,e)&&n},e.prototype.handleDownEvent=function(t){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=t.pixel,this.finishCoordinate_||this.startDrawing_(t.coordinate),!0):this.condition_(t)?(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout(function(){this.handlePointerMove_(new Ws(Vs.POINTERMOVE,t.map,t.originalEvent,!1,t.frameState))}.bind(this),this.dragVertexDelay_),this.downPx_=t.pixel,!0):(this.lastDragTime_=void 0,!1)},e.prototype.handleUpEvent=function(t){var e=!0;if(0===this.getPointerCount())if(this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0),this.handlePointerMove_(t),this.shouldHandle_){switch(!0){case!this.finishCoordinate_:if(this.startDrawing_(t.coordinate),this.mode_!==Qu)break;case this.freehand_||this.atFinish_(t.pixel)&&this.finishCondition_(t):this.finishDrawing();break;case!this.freehand_:this.addToDrawing_(t.coordinate)}e=!1}else this.freehand_&&this.abortDrawing();return!e&&this.stopClick_&&t.originalEvent.stopPropagation(),e},e.prototype.handlePointerMove_=function(t){if(this.pointerType_=t.originalEvent.pointerType,this.downPx_&&(!this.freehand_&&this.shouldHandle_||this.freehand_&&!this.shouldHandle_)){var e=this.downPx_,i=t.pixel,n=e[0]-i[0],r=e[1]-i[1],o=n*n+r*r;if(this.shouldHandle_=this.freehand_?o>this.squaredClickTolerance_:o<=this.squaredClickTolerance_,!this.shouldHandle_)return}this.finishCoordinate_?this.modifyDrawing_(t.coordinate):this.createOrUpdateSketchPoint_(t)},e.prototype.atFinish_=function(t){var e=!1;if(this.sketchFeature_){var i=!1,n=[this.finishCoordinate_],r=this.mode_;if(r===Qu)e=!0;else if(r===eh)e=2===this.sketchCoords_.length;else if(r===$u)i=this.sketchCoords_.length>this.minPoints_;else if(r===th){var o=this.sketchCoords_;i=o[0].length>this.minPoints_,n=[o[0][0],o[0][o[0].length-2]]}if(i)for(var a=this.getMap(),s=0,l=n.length;s=this.maxPoints_&&(this.freehand_?i.pop():e=!0),i.push(t.slice()),this.geometryFunction_(i,n,r)):o===th&&((i=this.sketchCoords_[0]).length>=this.maxPoints_&&(this.freehand_?i.pop():e=!0),i.push(t.slice()),e&&(this.finishCoordinate_=i[0]),this.geometryFunction_(this.sketchCoords_,n,r)),this.updateSketchFeatures_(),e&&this.finishDrawing()},e.prototype.removeLastPoint=function(){if(this.sketchFeature_){var t,e=this.sketchFeature_.getGeometry(),i=this.getMap().getView().getProjection(),n=this.mode_;if(n===$u||n===eh){if((t=this.sketchCoords_).splice(-2,1),t.length>=2){this.finishCoordinate_=t[t.length-2].slice();var r=this.finishCoordinate_.slice();t[t.length-1]=r,this.sketchPoint_.setGeometry(new tn(r))}this.geometryFunction_(t,e,i),e.getType()===pt&&this.sketchLine_&&this.createOrUpdateCustomSketchLine_(e)}else if(n===th){(t=this.sketchCoords_[0]).splice(-2,1);var o=this.sketchLine_.getGeometry();if(t.length>=2){r=t[t.length-2].slice();t[t.length-1]=r,this.sketchPoint_.setGeometry(new tn(r))}o.setCoordinates(t),this.geometryFunction_(this.sketchCoords_,e,i)}1===t.length&&this.abortDrawing(),this.updateSketchFeatures_()}},e.prototype.finishDrawing=function(){var t=this.abortDrawing_();if(t){var e=this.sketchCoords_,i=t.getGeometry(),n=this.getMap().getView().getProjection();this.mode_===$u?(e.pop(),this.geometryFunction_(e,i,n)):this.mode_===th&&(e[0].pop(),this.geometryFunction_(e,i,n),e=i.getCoordinates()),this.type_===ft?t.setGeometry(new Zu([e])):this.type_===dt?t.setGeometry(new Yu([e])):this.type_===gt&&t.setGeometry(new qu([e])),this.dispatchEvent(new oh(nh,t)),this.features_&&this.features_.push(t),this.source_&&this.source_.addFeature(t)}},e.prototype.abortDrawing_=function(){this.finishCoordinate_=null;var t=this.sketchFeature_;return this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0),t},e.prototype.abortDrawing=function(){var t=this.abortDrawing_();t&&this.dispatchEvent(new oh(rh,t))},e.prototype.appendCoordinates=function(t){var e,i=this.mode_,n=!this.sketchFeature_;if(n&&this.startDrawing_(t[0]),i===$u||i===eh)e=this.sketchCoords_;else{if(i!==th)return;e=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[]}n&&e.shift(),e.pop();for(var r=0;rc?o[1]:o[0]),a}}return null},e.prototype.handlePointerMove_=function(t){var e=t.pixel,i=t.map,n=this.snapToVertex_(e,i);n||(n=i.getCoordinateFromPixelInternal(e)),this.createOrUpdatePointerFeature_(n)},e.prototype.createOrUpdateExtentFeature_=function(t){var e=this.extentFeature_;return e?t?e.setGeometry(_n(t)):e.setGeometry(void 0):(e=new rt(t?_n(t):{}),this.extentFeature_=e,this.extentOverlay_.getSource().addFeature(e)),e},e.prototype.createOrUpdatePointerFeature_=function(t){var e=this.vertexFeature_;e?e.getGeometry().setCoordinates(t):(e=new rt(new tn(t)),this.vertexFeature_=e,this.vertexOverlay_.getSource().addFeature(e));return e},e.prototype.handleEvent=function(e){return!e.originalEvent||!this.condition_(e)||(e.type!=Vs.POINTERMOVE||this.handlingDownUpSequence||this.handlePointerMove_(e),t.prototype.handleEvent.call(this,e),!1)},e.prototype.handleDownEvent=function(t){var e=t.pixel,i=t.map,n=this.getExtentInternal(),r=this.snapToVertex_(e,i),o=function(t){var e=null,i=null;return t[0]==n[0]?e=n[2]:t[0]==n[2]&&(e=n[0]),t[1]==n[1]?i=n[3]:t[1]==n[3]&&(i=n[1]),null!==e&&null!==i?[e,i]:null};if(r&&n){var a=r[0]==n[0]||r[0]==n[2]?r[0]:null,s=r[1]==n[1]||r[1]==n[3]?r[1]:null;null!==a&&null!==s?this.pointerHandler_=fh(o(r)):null!==a?this.pointerHandler_=dh(o([a,n[1]]),o([a,n[3]])):null!==s&&(this.pointerHandler_=dh(o([n[0],s]),o([n[2],s])))}else r=i.getCoordinateFromPixelInternal(e),this.setExtent([r[0],r[1],r[0],r[1]]),this.pointerHandler_=fh(r);return!0},e.prototype.handleDragEvent=function(t){if(this.pointerHandler_){var e=t.coordinate;this.setExtent(this.pointerHandler_(e)),this.createOrUpdatePointerFeature_(e)}},e.prototype.handleUpEvent=function(t){this.pointerHandler_=null;var e=this.getExtentInternal();return e&&0!==le(e)||this.setExtent(null),!1},e.prototype.setMap=function(e){this.extentOverlay_.setMap(e),this.vertexOverlay_.setMap(e),t.prototype.setMap.call(this,e)},e.prototype.getExtent=function(){return Ci(this.getExtentInternal(),this.getMap().getView().getProjection())},e.prototype.getExtentInternal=function(){return this.extent_},e.prototype.setExtent=function(t){this.extent_=t||null,this.createOrUpdateExtentFeature_(t),this.dispatchEvent(new uh(this.extent_))},e}(Yl);function ch(){var t=Ir();return function(e,i){return t[pt]}}function ph(){var t=Ir();return function(e,i){return t[ut]}}function fh(t){return function(e){return Ut([t,e])}}function dh(t,e){return t[0]==e[0]?function(i){return Ut([t,[i[0],e[1]]])}:t[1]==e[1]?function(i){return Ut([t,[e[0],i[1]]])}:null}var gh=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),_h=[0,0,0,0],yh=[],vh="modifystart",mh="modifyend",xh=function(t){function e(e,i,n){var r=t.call(this,e)||this;return r.features=i,r.mapBrowserEvent=n,r}return gh(e,t),e}(s),wh=function(t){function e(e){var i,n=t.call(this,e)||this;if(n.boundHandleFeatureChange_=n.handleFeatureChange_.bind(n),n.condition_=e.condition?e.condition:ou,n.defaultDeleteCondition_=function(t){return function(t){var e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey}(t)&&tu(t)},n.deleteCondition_=e.deleteCondition?e.deleteCondition:n.defaultDeleteCondition_,n.insertVertexCondition_=e.insertVertexCondition?e.insertVertexCondition:Jl,n.vertexFeature_=null,n.vertexSegments_=null,n.lastPixel_=[0,0],n.ignoreNextSingleClick_=!1,n.featuresBeingModified_=null,n.rBush_=new $a,n.pixelTolerance_=void 0!==e.pixelTolerance?e.pixelTolerance:10,n.snappedToVertex_=!1,n.changingFeature_=!1,n.dragSegments_=[],n.overlay_=new Qa({source:new vs({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.style?e.style:Eh(),updateWhileAnimating:!0,updateWhileInteracting:!0}),n.SEGMENT_WRITERS_={Point:n.writePointGeometry_.bind(n),LineString:n.writeLineStringGeometry_.bind(n),LinearRing:n.writeLineStringGeometry_.bind(n),Polygon:n.writePolygonGeometry_.bind(n),MultiPoint:n.writeMultiPointGeometry_.bind(n),MultiLineString:n.writeMultiLineStringGeometry_.bind(n),MultiPolygon:n.writeMultiPolygonGeometry_.bind(n),Circle:n.writeCircleGeometry_.bind(n),GeometryCollection:n.writeGeometryCollectionGeometry_.bind(n)},n.source_=null,n.hitDetection_=null,e.features?i=e.features:e.source&&(n.source_=e.source,i=new et(n.source_.getFeatures()),n.source_.addEventListener(ns,n.handleSourceAdd_.bind(n)),n.source_.addEventListener(as,n.handleSourceRemove_.bind(n))),!i)throw new Error("The modify interaction requires features, a source or a layer");return e.hitDetection&&(n.hitDetection_=e.hitDetection),n.features_=i,n.features_.forEach(n.addFeature_.bind(n)),n.features_.addEventListener(q,n.handleFeatureAdd_.bind(n)),n.features_.addEventListener(J,n.handleFeatureRemove_.bind(n)),n.lastPointerEvent_=null,n.delta_=[0,0],n}return gh(e,t),e.prototype.addFeature_=function(t){var e=t.getGeometry();if(e){var i=this.SEGMENT_WRITERS_[e.getType()];i&&i(t,e)}var n=this.getMap();n&&n.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,n),t.addEventListener(E,this.boundHandleFeatureChange_)},e.prototype.willModifyFeatures_=function(t,e){if(!this.featuresBeingModified_){this.featuresBeingModified_=new et;for(var i=this.featuresBeingModified_.getArray(),n=0,r=e.length;n=0;--n){for(var r=i[n],o=this.dragSegments_.length-1;o>=0;--o)this.dragSegments_[o][0]===r&&this.dragSegments_.splice(o,1);e.remove(r)}},e.prototype.setActive=function(e){this.vertexFeature_&&!e&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.prototype.setActive.call(this,e)},e.prototype.setMap=function(e){this.overlay_.setMap(e),t.prototype.setMap.call(this,e)},e.prototype.getOverlay=function(){return this.overlay_},e.prototype.handleSourceAdd_=function(t){t.feature&&this.features_.push(t.feature)},e.prototype.handleSourceRemove_=function(t){t.feature&&this.features_.remove(t.feature)},e.prototype.handleFeatureAdd_=function(t){this.addFeature_(t.element)},e.prototype.handleFeatureChange_=function(t){if(!this.changingFeature_){var e=t.target;this.removeFeature_(e),this.addFeature_(e)}},e.prototype.handleFeatureRemove_=function(t){var e=t.element;this.removeFeature_(e)},e.prototype.writePointGeometry_=function(t,e){var i=e.getCoordinates(),n={feature:t,geometry:e,segment:[i,i]};this.rBush_.insert(e.getExtent(),n)},e.prototype.writeMultiPointGeometry_=function(t,e){for(var i=e.getCoordinates(),n=0,r=i.length;n=0;--_)this.insertVertex_(o[_],a)}return!!this.vertexFeature_},e.prototype.handleUpEvent=function(t){for(var e=this.dragSegments_.length-1;e>=0;--e){var i=this.dragSegments_[e][0],n=i.geometry;if(n.getType()===yt){var r=n.getCenter(),o=i.featureSegments[0],a=i.featureSegments[1];o.segment[0]=r,o.segment[1]=r,a.segment[0]=r,a.segment[1]=r,this.rBush_.update($t(r),o);var s=n;this.rBush_.update(s.getExtent(),a)}else this.rBush_.update(Ut(i.segment),i)}return this.featuresBeingModified_&&(this.dispatchEvent(new xh(mh,this.featuresBeingModified_,t)),this.featuresBeingModified_=null),!1},e.prototype.handlePointerMove_=function(t){this.lastPixel_=t.pixel,this.handlePointerAtPixel_(t.pixel,t.map,t.coordinate)},e.prototype.handlePointerAtPixel_=function(t,e,i){var r,o,a=this,s=i||e.getCoordinateFromPixel(t),l=e.getView().getProjection();if(this.hitDetection_){var u="object"==typeof this.hitDetection_?function(t){return t===a.hitDetection_}:void 0;e.forEachFeatureAtPixel(t,(function(t,e,i){if((i=i||t.getGeometry()).getType()===ut){o=i;var n=i.getCoordinates();r=[{feature:t,geometry:i,segment:[n,n]}]}return!0}),{layerFilter:u})}if(!r){var h=Ci(Xt(bi($t(s,_h)),e.getView().getResolution()*this.pixelTolerance_,_h));r=this.rBush_.getInExtent(h)}if(r&&r.length>0){var c=r.sort((function(t,e){return Ch(s,t,l)-Ch(s,e,l)}))[0],p=c.segment,f=bh(s,c,l),d=e.getPixelFromCoordinate(f),g=ri(t,d);if(o||g<=this.pixelTolerance_){var _={};if(_[n(p)]=!0,this.delta_[0]=f[0]-s[0],this.delta_[1]=f[1]-s[1],c.geometry.getType()===yt&&1===c.index)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(f,[c.feature],[c.geometry]);else{var y=e.getPixelFromCoordinate(p[0]),v=e.getPixelFromCoordinate(p[1]),m=ni(d,y),x=ni(d,v);g=Math.sqrt(Math.min(m,x)),this.snappedToVertex_=g<=this.pixelTolerance_,this.snappedToVertex_&&(f=m>x?p[1]:p[0]),this.createOrUpdateVertexFeature_(f,[c.feature],[c.geometry]);var w={};w[n(c.geometry)]=!0;for(var S=1,C=r.length;S=0;--o)c=n((h=(i=p[o])[0]).feature),h.depth&&(c+="-"+h.depth.join("-")),c in f||(f[c]={}),0===i[1]?(f[c].right=h,f[c].index=h.index):1==i[1]&&(f[c].left=h,f[c].index=h.index+1);for(c in f){switch(u=f[c].right,s=f[c].left,(l=(a=f[c].index)-1)<0&&(l=0),t=e=(r=(h=void 0!==s?s:u).geometry).getCoordinates(),d=!1,r.getType()){case dt:e[h.depth[0]].length>2&&(e[h.depth[0]].splice(a,1),d=!0);break;case ht:e.length>2&&(e.splice(a,1),d=!0);break;case gt:t=t[h.depth[1]];case pt:(t=t[h.depth[0]]).length>4&&(a==t.length-1&&(a=0),t.splice(a,1),d=!0,0===a&&(t.pop(),t.push(t[0]),l=t.length-1))}if(d){this.setGeometryCoordinates_(r,e);var g=[];if(void 0!==s&&(this.rBush_.remove(s),g.push(s.segment[0])),void 0!==u&&(this.rBush_.remove(u),g.push(u.segment[1])),void 0!==s&&void 0!==u){var _={depth:h.depth,feature:h.feature,geometry:h.geometry,index:l,segment:g};this.rBush_.insert(Ut(_.segment),_)}this.updateSegmentIndices_(r,a,h.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),p.length=0}}return d},e.prototype.setGeometryCoordinates_=function(t,e){this.changingFeature_=!0,t.setCoordinates(e),this.changingFeature_=!1},e.prototype.updateSegmentIndices_=function(t,e,i,n){this.rBush_.forEachInExtent(t.getExtent(),(function(r){r.geometry===t&&(void 0===i||void 0===r.depth||g(r.depth,i))&&r.index>e&&(r.index+=n)}))},e}(Yl);function Sh(t,e){return t.index-e.index}function Ch(t,e,i){var n=e.geometry;if(n.getType()===yt){var r=n;if(1===e.index){null;var o=ni(r.getCenter(),Si(t)),a=Math.sqrt(o)-r.getRadius();return a*a}}var s=Si(t);return yh[0]=Si(e.segment[0]),yh[1]=Si(e.segment[1]),oi(s,yh)}function bh(t,e,i){var n=e.geometry;if(n.getType()===yt&&1===e.index){var r=n;return wi(r.getClosestPoint(Si(t)))}var o=Si(t);return yh[0]=Si(e.segment[0]),yh[1]=Si(e.segment[1]),wi(ti(o,yh))}function Eh(){var t=Ir();return function(e,i){return t[ut]}}var Th=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Ph="select",Rh=function(t){function e(e,i,n,r){var o=t.call(this,e)||this;return o.selected=i,o.deselected=n,o.mapBrowserEvent=r,o}return Th(e,t),e}(s),Oh={},Fh=function(t){function e(e){var i,n,r=t.call(this)||this,o=e||{};if(r.boundAddFeature_=r.addFeature_.bind(r),r.boundRemoveFeature_=r.removeFeature_.bind(r),r.condition_=o.condition?o.condition:tu,r.addCondition_=o.addCondition?o.addCondition:$l,r.removeCondition_=o.removeCondition?o.removeCondition:$l,r.toggleCondition_=o.toggleCondition?o.toggleCondition:iu,r.multi_=!!o.multi&&o.multi,r.filter_=o.filter?o.filter:_,r.hitTolerance_=o.hitTolerance?o.hitTolerance:0,r.style_=void 0!==o.style?o.style:(d((i=Ir())[pt],i[ht]),d(i[_t],i[ht]),function(t){return t.getGeometry()?i[t.getGeometry().getType()]:null}),r.features_=o.features||new et,o.layers)if("function"==typeof o.layers)n=o.layers;else{var a=o.layers;n=function(t){return c(a,t)}}else n=_;return r.layerFilter_=n,r.featureLayerAssociation_={},r}return Th(e,t),e.prototype.addFeatureLayerAssociation_=function(t,e){this.featureLayerAssociation_[n(t)]=e},e.prototype.getFeatures=function(){return this.features_},e.prototype.getHitTolerance=function(){return this.hitTolerance_},e.prototype.getLayer=function(t){return this.featureLayerAssociation_[n(t)]},e.prototype.setHitTolerance=function(t){this.hitTolerance_=t},e.prototype.setMap=function(e){this.getMap()&&this.style_&&this.features_.forEach(this.restorePreviousStyle_.bind(this)),t.prototype.setMap.call(this,e),e?(this.features_.addEventListener(q,this.boundAddFeature_),this.features_.addEventListener(J,this.boundRemoveFeature_),this.style_&&this.features_.forEach(this.applySelectedStyle_.bind(this))):(this.features_.removeEventListener(q,this.boundAddFeature_),this.features_.removeEventListener(J,this.boundRemoveFeature_))},e.prototype.addFeature_=function(t){var e=t.element;this.style_&&this.applySelectedStyle_(e)},e.prototype.removeFeature_=function(t){var e=t.element;this.style_&&this.restorePreviousStyle_(e)},e.prototype.getStyle=function(){return this.style_},e.prototype.applySelectedStyle_=function(t){var e=n(t);e in Oh||(Oh[e]=t.getStyle()),t.setStyle(this.style_)},e.prototype.restorePreviousStyle_=function(t){for(var i=this.getMap().getInteractions().getArray(),r=i.length-1;r>=0;--r){var o=i[r];if(o!==this&&o instanceof e&&o.getStyle()&&-1!==o.getFeatures().getArray().lastIndexOf(t))return void t.setStyle(o.getStyle())}var a=n(t);t.setStyle(Oh[a]),delete Oh[a]},e.prototype.removeFeatureLayerAssociation_=function(t){delete this.featureLayerAssociation_[n(t)]},e.prototype.handleEvent=function(t){if(!this.condition_(t))return!0;var e=this.addCondition_(t),i=this.removeCondition_(t),n=this.toggleCondition_(t),r=!e&&!i&&!n,o=t.map,a=this.getFeatures(),s=[],l=[];if(r){x(this.featureLayerAssociation_),o.forEachFeatureAtPixel(t.pixel,function(t,e){if(this.filter_(t,e))return l.push(t),this.addFeatureLayerAssociation_(t,e),!this.multi_}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(var u=a.getLength()-1;u>=0;--u){var h=a.item(u),p=l.indexOf(h);p>-1?l.splice(p,1):(a.remove(h),s.push(h))}0!==l.length&&a.extend(l)}else{o.forEachFeatureAtPixel(t.pixel,function(t,r){if(this.filter_(t,r))return!e&&!n||c(a.getArray(),t)?(i||n)&&c(a.getArray(),t)&&(s.push(t),this.removeFeatureLayerAssociation_(t)):(l.push(t),this.addFeatureLayerAssociation_(t,r)),!this.multi_}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(var f=s.length-1;f>=0;--f)a.remove(s[f]);a.extend(l)}return(l.length>0||s.length>0)&&this.dispatchEvent(new Rh(Ph,l,s,t)),!0},e}(Bl);var Ih=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();function Mh(t){return t.feature?t.feature:t.element?t.element:void 0}var Ah=[],Lh=function(t){function e(e){var i=this,n=e||{},r=n;return r.handleDownEvent||(r.handleDownEvent=_),r.stopDown||(r.stopDown=y),(i=t.call(this,r)||this).source_=n.source?n.source:null,i.vertex_=void 0===n.vertex||n.vertex,i.edge_=void 0===n.edge||n.edge,i.features_=n.features?n.features:null,i.featuresListenerKeys_=[],i.featureChangeListenerKeys_={},i.indexedFeaturesExtents_={},i.pendingFeatures_={},i.pixelTolerance_=void 0!==n.pixelTolerance?n.pixelTolerance:10,i.rBush_=new $a,i.SEGMENT_WRITERS_={Point:i.writePointGeometry_.bind(i),LineString:i.writeLineStringGeometry_.bind(i),LinearRing:i.writeLineStringGeometry_.bind(i),Polygon:i.writePolygonGeometry_.bind(i),MultiPoint:i.writeMultiPointGeometry_.bind(i),MultiLineString:i.writeMultiLineStringGeometry_.bind(i),MultiPolygon:i.writeMultiPolygonGeometry_.bind(i),GeometryCollection:i.writeGeometryCollectionGeometry_.bind(i),Circle:i.writeCircleGeometry_.bind(i)},i}return Ih(e,t),e.prototype.addFeature=function(t,e){var i=void 0===e||e,r=n(t),o=t.getGeometry();if(o){var a=this.SEGMENT_WRITERS_[o.getType()];a&&(this.indexedFeaturesExtents_[r]=o.getExtent([1/0,1/0,-1/0,-1/0]),a(t,o))}i&&(this.featureChangeListenerKeys_[r]=N(t,E,this.handleFeatureChange_,this))},e.prototype.forEachFeatureAdd_=function(t){this.addFeature(t)},e.prototype.forEachFeatureRemove_=function(t){this.removeFeature(t)},e.prototype.getFeatures_=function(){var t;return this.features_?t=this.features_:this.source_&&(t=this.source_.getFeatures()),t},e.prototype.handleEvent=function(e){var i=this.snapTo(e.pixel,e.coordinate,e.map);return i.snapped&&(e.coordinate=i.vertex.slice(0,2),e.pixel=i.vertexPixel),t.prototype.handleEvent.call(this,e)},e.prototype.handleFeatureAdd_=function(t){var e=Mh(t);this.addFeature(e)},e.prototype.handleFeatureRemove_=function(t){var e=Mh(t);this.removeFeature(e)},e.prototype.handleFeatureChange_=function(t){var e=t.target;if(this.handlingDownUpSequence){var i=n(e);i in this.pendingFeatures_||(this.pendingFeatures_[i]=e)}else this.updateFeature_(e)},e.prototype.handleUpEvent=function(t){var e=w(this.pendingFeatures_);return e.length&&(e.forEach(this.updateFeature_.bind(this)),this.pendingFeatures_={}),!1},e.prototype.removeFeature=function(t,e){var i=void 0===e||e,r=n(t),o=this.indexedFeaturesExtents_[r];if(o){var a=this.rBush_,s=[];a.forEachInExtent(o,(function(e){t===e.feature&&s.push(e)}));for(var l=s.length-1;l>=0;--l)a.remove(s[l])}i&&(B(this.featureChangeListenerKeys_[r]),delete this.featureChangeListenerKeys_[r])},e.prototype.setMap=function(e){var i=this.getMap(),n=this.featuresListenerKeys_,r=this.getFeatures_();i&&(n.forEach(B),n.length=0,r.forEach(this.forEachFeatureRemove_.bind(this))),t.prototype.setMap.call(this,e),e&&(this.features_?n.push(N(this.features_,q,this.handleFeatureAdd_,this),N(this.features_,J,this.handleFeatureRemove_,this)):this.source_&&n.push(N(this.source_,ns,this.handleFeatureAdd_,this),N(this.source_,as,this.handleFeatureRemove_,this)),r.forEach(this.forEachFeatureAdd_.bind(this)))},e.prototype.snapTo=function(t,e,i){var n=Ut([i.getCoordinateFromPixel([t[0]-this.pixelTolerance_,t[1]+this.pixelTolerance_]),i.getCoordinateFromPixel([t[0]+this.pixelTolerance_,t[1]-this.pixelTolerance_])]),r=this.rBush_.getInExtent(n);this.vertex_&&!this.edge_&&(r=r.filter((function(t){return t.feature.getGeometry().getType()!==yt})));var o=!1,a=null,s=null;if(0===r.length)return{snapped:o,vertex:a,vertexPixel:s};i.getView().getProjection();for(var l,u=Si(e),h=1/0,c=0;cv?d[1]:d[0],s=i.getPixelFromCoordinate(a))}else if(this.edge_){var m=l.feature.getGeometry().getType()===yt;if(m){var x=l.feature.getGeometry();null,a=wi(function(t,e){var i=e.getRadius(),n=e.getCenter(),r=n[0],o=n[1],a=t[0]-r,s=t[1]-o;0===a&&0===s&&(a=1);var l=Math.sqrt(a*a+s*s);return[r+i*a/l,o+i*s/l]}(u,x))}else Ah[0]=Si(d[0]),Ah[1]=Si(d[1]),a=wi(ti(u,Ah));if(ri(t,s=i.getPixelFromCoordinate(a))<=this.pixelTolerance_&&(o=!0,this.vertex_&&!m)){g=i.getPixelFromCoordinate(d[0]),_=i.getPixelFromCoordinate(d[1]),y=ni(s,g),v=ni(s,_);Math.sqrt(Math.min(y,v))<=this.pixelTolerance_&&(a=y>v?d[1]:d[0],s=i.getPixelFromCoordinate(a))}}return o&&(s=[Math.round(s[0]),Math.round(s[1])]),{snapped:o,vertex:a,vertexPixel:s}},e.prototype.updateFeature_=function(t){this.removeFeature(t,!1),this.addFeature(t,!1)},e.prototype.writeCircleGeometry_=function(t,e){this.getMap().getView().getProjection();for(var i=yn(e).getCoordinates()[0],n=0,r=i.length-1;n0&&this.getCount()>this.highWaterMark},t.prototype.clear=function(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null},t.prototype.containsKey=function(t){return this.entries_.hasOwnProperty(t)},t.prototype.forEach=function(t){for(var e=this.oldest_;e;)t(e.value_,e.key_,this),e=e.newer},t.prototype.get=function(t,e){var i=this.entries_[t];return it(void 0!==i,15),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_},t.prototype.remove=function(t){var e=this.entries_[t];return it(void 0!==e,15),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_},t.prototype.getCount=function(){return this.count_},t.prototype.getKeys=function(){var t,e=new Array(this.count_),i=0;for(t=this.newest_;t;t=t.older)e[i++]=t.key_;return e},t.prototype.getValues=function(){var t,e=new Array(this.count_),i=0;for(t=this.newest_;t;t=t.older)e[i++]=t.value_;return e},t.prototype.peekLast=function(){return this.oldest_.value_},t.prototype.peekLastKey=function(){return this.oldest_.key_},t.prototype.peekFirstKey=function(){return this.newest_.key_},t.prototype.pop=function(){var 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_},t.prototype.replace=function(t,e){this.get(t),this.entries_[t].value_=e},t.prototype.set=function(t,e){it(!(t in this.entries_),16);var 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_},t.prototype.setSize=function(t){this.highWaterMark=t},t}();function Yh(t,e,i,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=i,n):[t,e,i]}function Kh(t,e,i){return t+"/"+e+"/"+i}function Zh(t){return Kh(t[0],t[1],t[2])}function Hh(t){return(t[1]<this.maxX&&(this.maxX=t.maxX),t.minYthis.maxY&&(this.maxY=t.maxY)},t.prototype.getHeight=function(){return this.maxY-this.minY+1},t.prototype.getSize=function(){return[this.getWidth(),this.getHeight()]},t.prototype.getWidth=function(){return this.maxX-this.minX+1},t.prototype.intersects=function(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY},t}();function $h(t,e,i,n,r){return void 0!==r?(r.minX=t,r.maxX=e,r.minY=i,r.maxY=n,r):new Qh(t,e,i,n)}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var tc=function(t,e){return t(e={exports:{}},e.exports),e.exports}((function(t,e){t.exports=function(t,e,i){t="default"in t?t.default:t,i="default"in i?i.default:i;var n=function(){function t(t,e){for(var i=0;ie.getMaxResolution()||y=0?t:"children"}}]),o}(t);return window.ol&&window.ol.control&&(window.ol.control.LayerSwitcher=o),o}(bl,X,zs)})),ec=function(){function t(){this.dataProjection=null,this.defaultFeatureProjection=null}return t.prototype.getReadOptions=function(t,e){var i;if(e){var n=e.dataProjection?hi(e.dataProjection):this.readProjection(t);e.extent&&n&&n.getUnits()===wt&&(n=hi(n)).setWorldExtent(e.extent),i={dataProjection:n,featureProjection:e.featureProjection}}return this.adaptOptions(i)},t.prototype.adaptOptions=function(t){return m({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection},t)},t.prototype.getType=function(){return e()},t.prototype.readFeature=function(t,i){return e()},t.prototype.readFeatures=function(t,i){return e()},t.prototype.readGeometry=function(t,i){return e()},t.prototype.readProjection=function(t){return e()},t.prototype.writeFeature=function(t,i){return e()},t.prototype.writeFeatures=function(t,i){return e()},t.prototype.writeGeometry=function(t,i){return e()},t}();function ic(t,e,i){var n,r=i?hi(i.featureProjection):null,o=i?hi(i.dataProjection):null;if(n=r&&o&&!di(r,o)?(e?t.clone():t).transform(e?r:o,e?o:r):t,e&&i&&void 0!==i.decimals){var a=Math.pow(10,i.decimals);n===t&&(n=t.clone()),n.applyTransform((function(t){for(var e=0,i=t.length;e0?i[0]:null},i.prototype.readFeatureFromNode=function(t,e){return null},i.prototype.readFeatures=function(t,e){if(t){if("string"==typeof t){var i=_c(t);return this.readFeaturesFromDocument(i,e)}return gc(t)?this.readFeaturesFromDocument(t,e):this.readFeaturesFromNode(t,e)}return[]},i.prototype.readFeaturesFromDocument=function(t,e){for(var i=[],n=t.firstChild;n;n=n.nextSibling)n.nodeType==Node.ELEMENT_NODE&&d(i,this.readFeaturesFromNode(n,e));return i},i.prototype.readFeaturesFromNode=function(t,i){return e()},i.prototype.readGeometry=function(t,e){if(t){if("string"==typeof t){var i=_c(t);return this.readGeometryFromDocument(i,e)}return gc(t)?this.readGeometryFromDocument(t,e):this.readGeometryFromNode(t,e)}return null},i.prototype.readGeometryFromDocument=function(t,e){return null},i.prototype.readGeometryFromNode=function(t,e){return null},i.prototype.readProjection=function(t){if(t){if("string"==typeof t){var e=_c(t);return this.readProjectionFromDocument(e)}return gc(t)?this.readProjectionFromDocument(t):this.readProjectionFromNode(t)}return null},i.prototype.readProjectionFromDocument=function(t){return this.dataProjection},i.prototype.readProjectionFromNode=function(t){return this.dataProjection},i.prototype.writeFeature=function(t,e){var i=this.writeFeatureNode(t,e);return this.xmlSerializer_.serializeToString(i)},i.prototype.writeFeatureNode=function(t,e){return null},i.prototype.writeFeatures=function(t,e){var i=this.writeFeaturesNode(t,e);return this.xmlSerializer_.serializeToString(i)},i.prototype.writeFeaturesNode=function(t,e){return null},i.prototype.writeGeometry=function(t,e){var i=this.writeGeometryNode(t,e);return this.xmlSerializer_.serializeToString(i)},i.prototype.writeGeometryNode=function(t,e){return null},i}(ec);function Lc(t){var e,i=dc(t,!1);return(e=/^\s*(true|1)|(false|0)\s*$/.exec(i))?void 0!==e[1]||!1:void 0}function kc(t){var e,i=dc(t,!1);return(e=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*$/i.exec(i))?parseFloat(e[1]):void 0}function Dc(t){return dc(t,!1).trim()}function jc(t,e){Nc(t,e?"1":"0")}function Gc(t,e){var i=e.toPrecision();t.appendChild(Ic().createTextNode(i))}function Nc(t,e){t.appendChild(Ic().createTextNode(e))}var zc,Bc,Uc,Xc,Wc,Vc,Yc,Kc,Zc,Hc,qc=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Jc=["http://www.google.com/kml/ext/2.2"],Qc=[null,"http://earth.google.com/kml/2.0","http://earth.google.com/kml/2.1","http://earth.google.com/kml/2.2","http://www.opengis.net/kml/2.2"],$c={fraction:Pa,pixels:Ra,insetPixels:Ra},tp=Ec(Qc,{ExtendedData:Yp,Region:Kp,MultiGeometry:xc(jp,"geometry"),LineString:xc(Lp,"geometry"),LinearRing:xc(kp,"geometry"),Point:xc(Gp,"geometry"),Polygon:xc(zp,"geometry"),Style:xc(Up),StyleMap:function(t,e){var i=xp.call(this,t,e);if(!i)return;var n=e[e.length-1];Array.isArray(i)?n.Style=i:"string"==typeof i?n.styleUrl=i:it(!1,38)},address:xc(Dc),description:xc(Dc),name:xc(Dc),open:xc(Lc),phoneNumber:xc(Dc),styleUrl:xc(yp),visibility:xc(Lc)},Ec(Jc,{MultiTrack:xc((function(t,e){var i=Pc([],Pp,t,e);if(!i)return;return new Yu(i)}),"geometry"),Track:xc(Op,"geometry")})),ep=Ec(Qc,{ExtendedData:Yp,Region:Kp,Link:function(t,e){Tc(ip,t,e)},address:xc(Dc),description:xc(Dc),name:xc(Dc),open:xc(Lc),phoneNumber:xc(Dc),visibility:xc(Lc)}),ip=Ec(Qc,{href:xc(_p)}),np=Ec(Qc,{LatLonAltBox:function(t,e){var i=Pc({},qp,t,e);if(!i)return;var n=e[e.length-1],r=[parseFloat(i.west),parseFloat(i.south),parseFloat(i.east),parseFloat(i.north)];n.extent=r,n.altitudeMode=i.altitudeMode,n.minAltitude=parseFloat(i.minAltitude),n.maxAltitude=parseFloat(i.maxAltitude)},Lod:function(t,e){var i=Pc({},Jp,t,e);if(!i)return;var n=e[e.length-1];n.minLodPixels=parseFloat(i.minLodPixels),n.maxLodPixels=parseFloat(i.maxLodPixels),n.minFadeExtent=parseFloat(i.minFadeExtent),n.maxFadeExtent=parseFloat(i.maxFadeExtent)}}),rp=Ec(Qc,["Document","Placemark"]),op=Ec(Qc,{Document:wc((function(t,e,i){Rc({node:t},nf,rf,e,i,void 0,this)})),Placemark:wc(Rf)}),ap=null,sp=null,lp=null,up=null,hp=null,cp=null;function pp(t){return t}var fp=function(t){function e(e){var i=t.call(this)||this,n=e||{};return cp||(ap=new Cn({color:zc=[255,255,255,1]}),sp=new Wa({anchor:Bc=[20,2],anchorOrigin:Oa,anchorXUnits:Uc=Ra,anchorYUnits:Xc=Ra,crossOrigin:"anonymous",rotation:0,scale:Yc=.5,size:Wc=[64,64],src:Vc="https://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png"}),Kc="NO_IMAGE",lp=new On({color:zc,width:1}),Zc=new On({color:[51,51,51,1],width:2}),up=new kr({font:"bold 16px Helvetica",fill:ap,stroke:Zc,scale:.8}),hp=new Rr({fill:ap,image:sp,text:up,stroke:lp,zIndex:0}),cp=[hp]),i.dataProjection=hi("EPSG:4326"),i.defaultStyle_=n.defaultStyle?n.defaultStyle:cp,i.extractStyles_=void 0===n.extractStyles||n.extractStyles,i.writeStyles_=void 0===n.writeStyles||n.writeStyles,i.sharedStyles_={},i.showPointNames_=void 0===n.showPointNames||n.showPointNames,i.crossOrigin_=void 0!==n.crossOrigin?n.crossOrigin:"anonymous",i.iconUrlFunction_=n.iconUrlFunction?n.iconUrlFunction:pp,i}return qc(e,t),e.prototype.readDocumentOrFolder_=function(t,e){var i=Pc([],Ec(Qc,{Document:yc(this.readDocumentOrFolder_,this),Folder:yc(this.readDocumentOrFolder_,this),Placemark:vc(this.readPlacemark_,this),Style:this.readSharedStyle_.bind(this),StyleMap:this.readSharedStyleMap_.bind(this)}),t,e,this);return i||void 0},e.prototype.readPlacemark_=function(t,e){var i=Pc({geometry:null},tp,t,e,this);if(i){var n=new rt,r=t.getAttribute("id");null!==r&&n.setId(r);var o=e[0],a=i.geometry;if(a&&ic(a,!1,o),n.setGeometry(a),delete i.geometry,this.extractStyles_){var s=function(t,e,i,n,r){return function(o,a){var s=r,l="",u=[];if(s){var h=o.getGeometry();if(h){var c=h.getType();s=c===_t?(u=h.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return e===ut||e===ft}))).length>0:c===ut||c===ft}}s&&(l=o.get("name"),(s=s&&!!l)&&l.search(/&[^&]+;/)>-1&&(Hc||(Hc=document.createElement("textarea")),Hc.innerHTML=l,l=Hc.value));var p=i;if(t?p=t:e&&(p=function t(e,i,n){return Array.isArray(e)?e:"string"==typeof e?t(n[e],i,n):i}(e,i,n)),s){var f=function(t,e){var i=[0,0],n="start",r=t.getImage();if(r){var o=r.getImageSize();if(null===o&&(o=Wc),2==o.length){var a=r.getScaleArray();i[0]=a[0]*o[0]/2,i[1]=-a[1]*o[1]/2,n="left"}}var s=t.getText();s?((s=s.clone()).setFont(s.getFont()||up.getFont()),s.setScale(s.getScale()||up.getScale()),s.setFill(s.getFill()||up.getFill()),s.setStroke(s.getStroke()||Zc)):s=up.clone();return s.setText(e),s.setOffsetX(i[0]),s.setOffsetY(i[1]),s.setTextAlign(n),new Rr({image:r,text:s})}(p[0],l);return u.length>0?(f.setGeometry(new sc(u)),[f,new Rr({geometry:p[0].getGeometry(),image:null,fill:p[0].getFill(),stroke:p[0].getStroke(),text:null})].concat(p.slice(1))):f}return p}}(i.Style,i.styleUrl,this.defaultStyle_,this.sharedStyles_,this.showPointNames_);n.setStyle(s)}return delete i.Style,n.setProperties(i,!0),n}},e.prototype.readSharedStyle_=function(t,e){var i=t.getAttribute("id");if(null!==i){var n=Up.call(this,t,e);if(n){var r=void 0,o=t.baseURI;if(o&&"about:blank"!=o||(o=window.location.href),o)r=new URL("#"+i,o).href;else r="#"+i;this.sharedStyles_[r]=n}}},e.prototype.readSharedStyleMap_=function(t,e){var i=t.getAttribute("id");if(null!==i){var n=xp.call(this,t,e);if(n){var r,o=t.baseURI;if(o&&"about:blank"!=o||(o=window.location.href),o)r=new URL("#"+i,o).href;else r="#"+i;this.sharedStyles_[r]=n}}},e.prototype.readFeatureFromNode=function(t,e){if(!c(Qc,t.namespaceURI))return null;var i=this.readPlacemark_(t,[this.getReadOptions(t,e)]);return i||null},e.prototype.readFeaturesFromNode=function(t,e){if(!c(Qc,t.namespaceURI))return[];var i,n=t.localName;if("Document"==n||"Folder"==n)return(i=this.readDocumentOrFolder_(t,[this.getReadOptions(t,e)]))||[];if("Placemark"==n){var r=this.readPlacemark_(t,[this.getReadOptions(t,e)]);return r?[r]:[]}if("kml"==n){i=[];for(var o=t.firstElementChild;o;o=o.nextElementSibling){var a=this.readFeaturesFromNode(o,e);a&&d(i,a)}return i}return[]},e.prototype.readName=function(t){if(t){if("string"==typeof t){var e=_c(t);return this.readNameFromDocument(e)}return gc(t)?this.readNameFromDocument(t):this.readNameFromNode(t)}},e.prototype.readNameFromDocument=function(t){for(var e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE){var i=this.readNameFromNode(e);if(i)return i}},e.prototype.readNameFromNode=function(t){for(var e=t.firstElementChild;e;e=e.nextElementSibling)if(c(Qc,e.namespaceURI)&&"name"==e.localName)return Dc(e);for(e=t.firstElementChild;e;e=e.nextElementSibling){var i=e.localName;if(c(Qc,e.namespaceURI)&&("Document"==i||"Folder"==i||"Placemark"==i||"kml"==i)){var n=this.readNameFromNode(e);if(n)return n}}},e.prototype.readNetworkLinks=function(t){var e=[];if("string"==typeof t){var i=_c(t);d(e,this.readNetworkLinksFromDocument(i))}else gc(t)?d(e,this.readNetworkLinksFromDocument(t)):d(e,this.readNetworkLinksFromNode(t));return e},e.prototype.readNetworkLinksFromDocument=function(t){for(var e=[],i=t.firstChild;i;i=i.nextSibling)i.nodeType==Node.ELEMENT_NODE&&d(e,this.readNetworkLinksFromNode(i));return e},e.prototype.readNetworkLinksFromNode=function(t){for(var e=[],i=t.firstElementChild;i;i=i.nextElementSibling)if(c(Qc,i.namespaceURI)&&"NetworkLink"==i.localName){var n=Pc({},ep,i,[]);e.push(n)}for(i=t.firstElementChild;i;i=i.nextElementSibling){var r=i.localName;!c(Qc,i.namespaceURI)||"Document"!=r&&"Folder"!=r&&"kml"!=r||d(e,this.readNetworkLinksFromNode(i))}return e},e.prototype.readRegion=function(t){var e=[];if("string"==typeof t){var i=_c(t);d(e,this.readRegionFromDocument(i))}else gc(t)?d(e,this.readRegionFromDocument(t)):d(e,this.readRegionFromNode(t));return e},e.prototype.readRegionFromDocument=function(t){for(var e=[],i=t.firstChild;i;i=i.nextSibling)i.nodeType==Node.ELEMENT_NODE&&d(e,this.readRegionFromNode(i));return e},e.prototype.readRegionFromNode=function(t){for(var e=[],i=t.firstElementChild;i;i=i.nextElementSibling)if(c(Qc,i.namespaceURI)&&"Region"==i.localName){var n=Pc({},np,i,[]);e.push(n)}for(i=t.firstElementChild;i;i=i.nextElementSibling){var r=i.localName;!c(Qc,i.namespaceURI)||"Document"!=r&&"Folder"!=r&&"kml"!=r||d(e,this.readRegionFromNode(i))}return e},e.prototype.writeFeaturesNode=function(t,e){e=this.adaptOptions(e);var i=fc(Qc[4],"kml"),n="http://www.w3.org/2000/xmlns/";i.setAttributeNS(n,"xmlns:gx",Jc[0]),i.setAttributeNS(n,"xmlns:xsi","http://www.w3.org/2001/XMLSchema-instance"),i.setAttributeNS("http://www.w3.org/2001/XMLSchema-instance","xsi:schemaLocation","http://www.opengis.net/kml/2.2 https://developers.google.com/kml/schema/kml22gx.xsd");var r={node:i},o={};t.length>1?o.Document=t:1==t.length&&(o.Placemark=t[0]);var a=rp[i.namespaceURI],s=bc(o,a);return Rc(r,op,Cc,s,[e],a,this),i},e}(Ac);function dp(t){var e=dc(t,!1),i=/^\s*#?\s*([0-9A-Fa-f]{8})\s*$/.exec(e);if(i){var n=i[1];return[parseInt(n.substr(6,2),16),parseInt(n.substr(4,2),16),parseInt(n.substr(2,2),16),parseInt(n.substr(0,2),16)/255]}}function gp(t){var e=dc(t,!1),i=[];e=e.replace(/\s*,\s*/g,",");for(var n,r=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?),([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s+|,|$)(?:([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s+|$))?\s*/i;n=r.exec(e);){var o=parseFloat(n[1]),a=parseFloat(n[2]),s=n[3]?parseFloat(n[3]):0;i.push(o,a,s),e=e.substr(n[0].length)}if(""===e)return i}function _p(t){var e=dc(t,!1).trim(),i=t.baseURI;return i&&"about:blank"!=i||(i=window.location.href),i?new URL(e,i).href:e}function yp(t){var e=dc(t,!1).trim().replace(/^(?!.*#)/,"#"),i=t.baseURI;return i&&"about:blank"!=i||(i=window.location.href),i?new URL(e,i).href:e}function vp(t){return kc(t)}var mp=Ec(Qc,{Pair:function(t,e){var i=Pc({},Zp,t,e,this);if(!i)return;var n=i.key;if(n&&"normal"==n){var r=i.styleUrl;r&&(e[e.length-1]=r);var o=i.Style;o&&(e[e.length-1]=o)}}});function xp(t,e){return Pc(void 0,mp,t,e,this)}var wp=Ec(Qc,{Icon:xc((function(t,e){var i=Pc({},Fp,t,e);return i||null})),color:xc(dp),heading:xc(kc),hotSpot:xc((function(t){var e,i=t.getAttribute("xunits"),n=t.getAttribute("yunits");return e="insetPixels"!==i?"insetPixels"!==n?Oa:Ia:"insetPixels"!==n?Fa:Ma,{x:parseFloat(t.getAttribute("x")),xunits:$c[i],y:parseFloat(t.getAttribute("y")),yunits:$c[n],origin:e}})),scale:xc(vp)});var Sp=Ec(Qc,{color:xc(dp),scale:xc(vp)});var Cp=Ec(Qc,{color:xc(dp),width:xc(kc)});var bp=Ec(Qc,{color:xc(dp),fill:xc(Lc),outline:xc(Lc)});var Ep=Ec(Qc,{coordinates:mc(gp)});function Tp(t,e){return Pc(null,Ep,t,e)}var Pp=Ec(Jc,{Track:vc(Op)});var Rp=Ec(Qc,{when:function(t,e){var i=e[e.length-1].whens,n=dc(t,!1),r=Date.parse(n);i.push(isNaN(r)?0:r)}},Ec(Jc,{coord:function(t,e){var i=e[e.length-1].flatCoordinates,n=dc(t,!1),r=/^\s*([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s*$/i.exec(n);if(r){var o=parseFloat(r[1]),a=parseFloat(r[2]),s=parseFloat(r[3]);i.push(o,a,s,0)}else i.push(0,0,0,0)}}));function Op(t,e){var i=Pc({flatCoordinates:[],whens:[]},Rp,t,e);if(i){for(var n=i.flatCoordinates,r=i.whens,o=0,a=Math.min(n.length,r.length);o0,h=l.href;h?n=h:u&&(n=Vc);var c,p=Oa,f=i.hotSpot;f?(r=[f.x,f.y],o=f.xunits,a=f.yunits,p=f.origin):n===Vc?(r=Bc,o=Uc,a=Xc):/^http:\/\/maps\.(?:google|gstatic)\.com\//.test(n)&&(r=[.5,0],o=Pa,a=Pa);var d,g=l.x,_=l.y;void 0!==g&&void 0!==_&&(c=[g,_]);var y,v=l.w,m=l.h;void 0!==v&&void 0!==m&&(d=[v,m]);var x=i.heading;void 0!==x&&(y=Oe(x));var w=i.scale,S=i.color;if(u){n==Vc&&(d=Wc,void 0===w&&(w=Yc));var C=new Wa({anchor:r,anchorOrigin:p,anchorXUnits:o,anchorYUnits:a,crossOrigin:this.crossOrigin_,offset:c,offsetOrigin:Oa,rotation:y,scale:w,size:d,src:this.iconUrlFunction_(n),color:S});s.imageStyle=C}else s.imageStyle=Kc}},LabelStyle:function(t,e){var i=Pc({},Sp,t,e);if(i){var n=e[e.length-1],r=new kr({fill:new Cn({color:"color"in i?i.color:zc}),scale:i.scale});n.textStyle=r}},LineStyle:function(t,e){var i=Pc({},Cp,t,e);if(i){var n=e[e.length-1],r=new On({color:"color"in i?i.color:zc,width:"width"in i?i.width:1});n.strokeStyle=r}},PolyStyle:function(t,e){var i=Pc({},bp,t,e);if(i){var n=e[e.length-1],r=new Cn({color:"color"in i?i.color:zc});n.fillStyle=r;var o=i.fill;void 0!==o&&(n.fill=o);var a=i.outline;void 0!==a&&(n.outline=a)}}});function Up(t,e){var i=Pc({},Bp,t,e,this);if(!i)return null;var n,r="fillStyle"in i?i.fillStyle:ap,o=i.fill;void 0===o||o||(r=null),"imageStyle"in i?i.imageStyle!=Kc&&(n=i.imageStyle):n=sp;var a="textStyle"in i?i.textStyle:up,s="strokeStyle"in i?i.strokeStyle:lp,l=i.outline;return void 0===l||l?[new Rr({fill:r,image:n,stroke:s,text:a,zIndex:void 0})]:[new Rr({geometry:function(t){var e=t.getGeometry(),i=e.getType();return i===_t?new sc(e.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return e!==pt&&e!==gt}))):i!==pt&&i!==gt?e:void 0},fill:r,image:n,stroke:s,text:a,zIndex:void 0}),new Rr({geometry:function(t){var e=t.getGeometry(),i=e.getType();return i===_t?new sc(e.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return e===pt||e===gt}))):i===pt||i===gt?e:void 0},fill:r,stroke:null,zIndex:void 0})]}function Xp(t,e){var i,n,r,o=e.length,a=new Array(e.length),s=new Array(e.length),l=new Array(e.length);i=!1,n=!1,r=!1;for(var u=0;u0){var y=bc(r,a);Rc(n,Ef,Pf,[{names:a,values:y}],i)}var v=i[0],m=e.getGeometry();m&&(m=ic(m,!0,v)),Rc(n,Ef,_f,[m],i)}var Of=Ec(Qc,["extrude","tessellate","altitudeMode","coordinates"]),Ff=Ec(Qc,{extrude:wc(jc),tessellate:wc(jc),altitudeMode:wc(Nc),coordinates:wc((function(t,e,i){var n,r=i[i.length-1],o=r.layout,a=r.stride;o==ot||o==st?n=2:o==at||o==lt?n=3:it(!1,34);var s=e.length,l="";if(s>0){l+=e[0];for(var u=1;u=0;o--)this.postProcessPasses_[o].init(t);e.bindTexture(e.TEXTURE_2D,null),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.enable(e.BLEND),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA),e.useProgram(this.currentProgram_),this.applyFrameState(t),this.applyUniforms(t)},e.prototype.prepareDrawToRenderTarget=function(t,e,i){var n=this.getGL(),r=e.getSize();n.bindFramebuffer(n.FRAMEBUFFER,e.getFramebuffer()),n.viewport(0,0,r[0],r[1]),n.bindTexture(n.TEXTURE_2D,e.getTexture()),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.enable(n.BLEND),n.blendFunc(n.ONE,i?n.ZERO:n.ONE_MINUS_SRC_ALPHA),n.useProgram(this.currentProgram_),this.applyFrameState(t),this.applyUniforms(t)},e.prototype.drawElements=function(t,e){var i=this.getGL(),n=i.UNSIGNED_INT,r=e-t,o=4*t;i.drawElements(i.TRIANGLES,r,n,o)},e.prototype.finalizeDraw=function(t){for(var e=0;ethis.size_[0]||e>=this.size_[1])return hd[0]=0,hd[1]=0,hd[2]=0,hd[3]=0,hd;this.readAll();var i=Math.floor(t)+(this.size_[1]-Math.floor(e)-1)*this.size_[0];return hd[0]=this.data_[4*i],hd[1]=this.data_[4*i+1],hd[2]=this.data_[4*i+2],hd[3]=this.data_[4*i+3],hd},t.prototype.getTexture=function(){return this.texture_},t.prototype.getFramebuffer=function(){return this.framebuffer_},t.prototype.updateSize_=function(){var t=this.size_,e=this.helper_.getGL();this.texture_=this.helper_.createTexture(t,null,this.texture_),e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer_),e.viewport(0,0,t[0],t[1]),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this.texture_,0),this.data_=new Uint8Array(t[0]*t[1]*4)},t}(),pd=new Blob(['var e="function"==typeof Object.assign?Object.assign:function(e,n){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),r=1,o=arguments.length;r=.5&&R>=.5){var O=a.opacity,F=void 0;1!==O&&(F=this.context.globalAlpha,this.context.globalAlpha=O),this.context.drawImage(C,0,0,+C.width,+C.height,Math.round(E),Math.round(T),Math.round(P),Math.round(R)),1!==O&&(this.context.globalAlpha=F)}return this.postRender(v,t),w&&v.restore(),y!==x.style.transform&&(x.style.transform=y),this.container},e}(na),Td=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Pd=function(t){function e(e){return t.call(this,e)||this}return Td(e,t),e.prototype.createRenderer=function(){return new Ed(this)},e}(Cd),Rd=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Od=function(t){function e(e){var i=t.call(this,e)||this;return i.extentChanged=!0,i.renderedExtent_=null,i.renderedPixelRatio,i.renderedProjection=null,i.renderedRevision,i.renderedTiles=[],i.newTiles_=!1,i.tmpExtent=[1/0,1/0,-1/0,-1/0],i.tmpTileRange_=new Qh(0,0,0,0),i}return Rd(e,t),e.prototype.isDrawableTile=function(t){var e=this.getLayer(),i=t.getState(),n=e.getUseInterimTilesOnError();return i==ws||i==Cs||i==Ss&&!n},e.prototype.getTile=function(t,e,i,n){var r=n.pixelRatio,o=n.viewState.projection,a=this.getLayer(),s=a.getSource().getTile(t,e,i,r,o);return s.getState()==Ss&&(a.getUseInterimTilesOnError()?a.getPreload()>0&&(this.newTiles_=!0):s.setState(ws)),this.isDrawableTile(s)||(s=s.getInterimTile()),s},e.prototype.loadedTileCallback=function(e,i,n){return!!this.isDrawableTile(n)&&t.prototype.loadedTileCallback.call(this,e,i,n)},e.prototype.prepareFrame=function(t){return!!this.getLayer().getSource()},e.prototype.renderFrame=function(t,e){var i=t.layerStatesArray[t.layerIndex],r=t.viewState,o=r.projection,a=r.resolution,s=r.center,l=r.rotation,u=t.pixelRatio,c=this.getLayer(),p=c.getSource(),f=p.getRevision(),d=p.getTileGridForProjection(o),g=d.getZForResolution(a,p.zDirection),_=d.getResolution(g),y=t.extent,v=i.extent&&bi(i.extent);v&&(y=ge(y,bi(i.extent)));var x=p.getTilePixelRatio(u),w=Math.round(t.size[0]*x),S=Math.round(t.size[1]*x);if(l){var C=Math.round(Math.sqrt(w*w+S*S));w=C,S=C}var b=_*w/2/x,E=_*S/2/x,T=[s[0]-b,s[1]-E,s[0]+b,s[1]+E],P=d.getTileRangeForExtentAndZ(y,g),R={};R[g]={};var O=this.createLoadedTileFinder(p,o,R),F=this.tmpExtent,I=this.tmpTileRange_;this.newTiles_=!1;for(var M=P.minX;M<=P.maxX;++M)for(var A=P.minY;A<=P.maxY;++A){var L=this.getTile(g,M,A,t);if(this.isDrawableTile(L)){var k=n(this);if(L.getState()==ws){R[g][L.tileCoord.toString()]=L;var D=L.inTransition(k);this.newTiles_||!D&&-1!==this.renderedTiles.indexOf(L)||(this.newTiles_=!0)}if(1===L.getAlpha(k,t.time))continue}var j=d.getTileCoordChildTileRange(L.tileCoord,I,F),G=!1;j&&(G=O(g+1,j)),G||d.forEachTileCoordParentTileRange(L.tileCoord,O,I,F)}var N=_/a;Ot(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/x,1/x,l,-w/2,-S/2);var z=Cr(this.pixelTransform);this.useContainer(e,z,i.opacity);var B=this.context,U=B.canvas;Ft(this.inversePixelTransform,this.pixelTransform),Ot(this.tempTransform,w/2,S/2,N,N,0,-w/2,-S/2),U.width!=w||U.height!=S?(U.width=w,U.height=S):this.containerReused||B.clearRect(0,0,w,S),v&&this.clipUnrotated(B,t,v),m(B,p.getContextOptions()),this.preRender(B,t),this.renderedTiles.length=0;var X,W,V,Y=Object.keys(R).map(Number);Y.sort(h),1!==i.opacity||this.containerReused&&!p.getOpaque(t.viewState.projection)?(X=[],W=[]):Y=Y.reverse();for(var K=Y.length-1;K>=0;--K){var Z=Y[K],H=p.getTilePixelSize(Z,u,o),q=d.getResolution(Z)/_,J=H[0]*q*N,Q=H[1]*q*N,$=d.getTileCoordForCoordAndZ(_e(T),Z),tt=d.getTileCoordExtent($),et=Rt(this.tempTransform,[x*(tt[0]-T[0])/_,x*(T[3]-tt[3])/_]),it=x*p.getGutterForProjection(o),nt=R[Z];for(var rt in nt){var ot=(L=nt[rt]).tileCoord,at=et[0]-($[1]-ot[1])*J,st=Math.round(at+J),lt=et[1]-($[2]-ot[2])*Q,ut=Math.round(lt+Q),ht=st-(M=Math.round(at)),ct=ut-(A=Math.round(lt)),pt=g===Z;if(!(D=pt&&1!==L.getAlpha(n(this),t.time)))if(X){B.save(),V=[M,A,M+ht,A,M+ht,A+ct,M,A+ct];for(var ft=0,dt=X.length;ft0||i&&0===o)}))),17),!t.origins)for(var o=0,a=this.resolutions_.length-1;o=this.minZoom;){if(e(s,2===this.zoomFactor_?$h(r=Math.floor(r/2),r,o=Math.floor(o/2),o,i):this.getTileRangeForExtentAndZ(a,s,i)))return!0;--s}return!1},t.prototype.getExtent=function(){return this.extent_},t.prototype.getMaxZoom=function(){return this.maxZoom},t.prototype.getMinZoom=function(){return this.minZoom},t.prototype.getOrigin=function(t){return this.origin_?this.origin_:this.origins_[t]},t.prototype.getResolution=function(t){return this.resolutions_[t]},t.prototype.getResolutions=function(){return this.resolutions_},t.prototype.getTileCoordChildTileRange=function(t,e,i){if(t[0]0?n:Math.max(a/s[0],o/s[1]),u=r+1,h=new Array(u),c=0;ci||i>e.getMaxZoom())return!1;var o=e.getFullTileRange(i);return!o||o.containsXY(n,r)}(t,n)?t:null},i.prototype.clear=function(){this.tileCache.clear()},i.prototype.refresh=function(){this.clear(),t.prototype.refresh.call(this)},i.prototype.updateCacheSize=function(t,e){var i=this.getTileCacheForProjection(e);t>i.highWaterMark&&(i.highWaterMark=t)},i.prototype.useTile=function(t,e,i,n){},i}(es),Xd=function(t){function e(e,i){var n=t.call(this,e)||this;return n.tile=i,n}return Bd(e,t),e}(s);function Wd(t,e){var i=/\{z\}/g,n=/\{x\}/g,r=/\{y\}/g,o=/\{-y\}/g;return function(a,s,l){return a?t.replace(i,a[0].toString()).replace(n,a[1].toString()).replace(r,a[2].toString()).replace(o,(function(){var t=a[0],i=e.getFullTileRange(t);return it(i,55),(i.getHeight()-a[2]-1).toString()})):void 0}}function Vd(t){return 1===t.length?t[0]:function(e,i,n){if(e){var r=Fe(Hh(e),t.length);return t[r](e,i,n)}}}var Yd,Kd=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Zd=function(t){function e(i){var n=t.call(this,{attributions:i.attributions,cacheSize:i.cacheSize,opaque:i.opaque,projection:i.projection,state:i.state,tileGrid:i.tileGrid,tilePixelRatio:i.tilePixelRatio,wrapX:i.wrapX,transition:i.transition,key:i.key,attributionsCollapsible:i.attributionsCollapsible,zDirection:i.zDirection})||this;return n.generateTileUrlFunction_=n.tileUrlFunction===e.prototype.tileUrlFunction,n.tileLoadFunction=i.tileLoadFunction,i.tileUrlFunction&&(n.tileUrlFunction=i.tileUrlFunction),n.urls=null,i.urls?n.setUrls(i.urls):i.url&&n.setUrl(i.url),n.tileLoadingKeys_={},n}return Kd(e,t),e.prototype.getTileLoadFunction=function(){return this.tileLoadFunction},e.prototype.getTileUrlFunction=function(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction},e.prototype.getUrls=function(){return this.urls},e.prototype.handleTileChange=function(t){var e,i=t.target,r=n(i),o=i.getState();o==xs?(this.tileLoadingKeys_[r]=!0,e=Md):r in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[r],e=o==Ss?Ld:o==ws?Ad:void 0),null!=e&&this.dispatchEvent(new Xd(e,i))},e.prototype.setTileLoadFunction=function(t){this.tileCache.clear(),this.tileLoadFunction=t,this.changed()},e.prototype.setTileUrlFunction=function(t,e){this.tileUrlFunction=t,this.tileCache.pruneExceptNewestZ(),void 0!==e?this.setKey(e):this.changed()},e.prototype.setUrl=function(t){var e=function(t){var e=[],i=/\{([a-z])-([a-z])\}/.exec(t);if(i){var n=i[1].charCodeAt(0),r=i[2].charCodeAt(0),o=void 0;for(o=n;o<=r;++o)e.push(t.replace(i[0],String.fromCharCode(o)));return e}if(i=/\{(\d+)-(\d+)\}/.exec(t)){for(var a=parseInt(i[2],10),s=parseInt(i[1],10);s<=a;s++)e.push(t.replace(i[0],s.toString()));return e}return e.push(t),e}(t);this.urls=e,this.setUrls(e)},e.prototype.setUrls=function(t){this.urls=t;var e=t.join("\n");this.generateTileUrlFunction_?this.setTileUrlFunction(function(t,e){for(var i=t.length,n=new Array(i),r=0;rthis.sourceWorldWidth_/2){var e=[[t.source[0][0],t.source[0][1]],[t.source[1][0],t.source[1][1]],[t.source[2][0],t.source[2][1]]];e[0][0]-y>this.sourceWorldWidth_/2&&(e[0][0]-=this.sourceWorldWidth_),e[1][0]-y>this.sourceWorldWidth_/2&&(e[1][0]-=this.sourceWorldWidth_),e[2][0]-y>this.sourceWorldWidth_/2&&(e[2][0]-=this.sourceWorldWidth_);var i=Math.min(e[0][0],e[1][0],e[2][0]);Math.max(e[0][0],e[1][0],e[2][0])-i.5&&h<1,f=!1;if(l>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_)f=ve(Ut([t,e,i,n]))/this.targetWorldWidth_>.25||f;!p&&this.sourceProj_.isGlobal()&&h&&(f=h>.25||f)}if(!(!f&&this.maxSourceExtent_&&isFinite(u[0])&&isFinite(u[1])&&isFinite(u[2])&&isFinite(u[3]))||me(u,this.maxSourceExtent_)){var d=0;if(!(f||isFinite(r[0])&&isFinite(r[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(a[0])&&isFinite(a[1])&&isFinite(s[0])&&isFinite(s[1])))if(l>0)f=!0;else if(1!=(d=(isFinite(r[0])&&isFinite(r[1])?0:8)+(isFinite(o[0])&&isFinite(o[1])?0:4)+(isFinite(a[0])&&isFinite(a[1])?0:2)+(isFinite(s[0])&&isFinite(s[1])?0:1))&&2!=d&&4!=d&&8!=d)return;if(l>0){if(!f){var g=[(t[0]+i[0])/2,(t[1]+i[1])/2],_=this.transformInv_(g),y=void 0;if(p)y=(Fe(r[0],c)+Fe(a[0],c))/2-Fe(_[0],c);else y=(r[0]+a[0])/2-_[0];var v=(r[1]+a[1])/2-_[1];f=y*y+v*v>this.errorThresholdSquared_}if(f){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){var m=[(e[0]+i[0])/2,(e[1]+i[1])/2],x=this.transformInv_(m),w=[(n[0]+t[0])/2,(n[1]+t[1])/2],S=this.transformInv_(w);this.addQuad_(t,e,m,w,r,o,x,S,l-1),this.addQuad_(w,m,i,n,S,x,a,s,l-1)}else{var C=[(t[0]+e[0])/2,(t[1]+e[1])/2],b=this.transformInv_(C),E=[(i[0]+n[0])/2,(i[1]+n[1])/2],T=this.transformInv_(E);this.addQuad_(t,C,E,n,r,b,T,s,l-1),this.addQuad_(C,e,i,E,b,o,a,T,l-1)}return}}if(p){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}0==(11&d)&&this.addTriangle_(t,i,n,r,a,s),0==(14&d)&&this.addTriangle_(t,i,e,r,a,o),d&&(0==(13&d)&&this.addTriangle_(e,n,t,o,s,r),0==(7&d)&&this.addTriangle_(e,n,i,o,s,a))}},t.prototype.calculateSourceExtent=function(){var t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach((function(e,i,n){var r=e.source;re(t,r[0]),re(t,r[1]),re(t,r[2])})),t},t.prototype.getTriangles=function(){return this.triangles_},t}(),tg={imageSmoothingEnabled:!1,msImageSmoothingEnabled:!1};function eg(t,e,i,n,r){t.beginPath(),t.moveTo(0,0),t.lineTo(e,i),t.lineTo(n,r),t.closePath(),t.save(),t.clip(),t.fillRect(0,0,Math.max(e,n)+1,Math.max(i,r)),t.restore()}function ig(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function ng(t,e,i,n){var r=yi(i,e,t),o=ci(e,n,i),a=e.getMetersPerUnit();void 0!==a&&(o*=a);var s=t.getMetersPerUnit();void 0!==s&&(o/=s);var l=t.getExtent();if(!l||Yt(l,r)){var u=ci(t,o,r)/o;isFinite(u)&&u>0&&(o/=u)}return o}function rg(t,e,i,n,r,o,a,s,l,u,h,c){var p=ir(Math.round(i*t),Math.round(i*e));if(m(p,c),0===l.length)return p.canvas;function f(t){return Math.round(t*i)/i}p.scale(i,i),p.globalCompositeOperation="lighter";var d=[1/0,1/0,-1/0,-1/0];l.forEach((function(t,e,i){ne(d,t.extent)}));var g=ve(d),_=de(d),y=ir(Math.round(i*g/n),Math.round(i*_/n));m(y,c);var v=i/n;l.forEach((function(t,e,i){var n=t.extent[0]-d[0],r=-(t.extent[3]-d[3]),o=ve(t.extent),a=de(t.extent);t.image.width>0&&t.image.height>0&&y.drawImage(t.image,u,u,t.image.width-2*u,t.image.height-2*u,n*v,r*v,o*v,a*v)}));var x=_e(a);return s.getTriangles().forEach((function(t,e,r){var a=t.source,s=t.target,l=a[0][0],u=a[0][1],h=a[1][0],g=a[1][1],_=a[2][0],v=a[2][1],m=f((s[0][0]-x[0])/o),w=f(-(s[0][1]-x[1])/o),S=f((s[1][0]-x[0])/o),C=f(-(s[1][1]-x[1])/o),b=f((s[2][0]-x[0])/o),E=f(-(s[2][1]-x[1])/o),T=l,P=u;l=0,u=0;var R=function(t){for(var e=t.length,i=0;ir&&(r=a,n=o)}if(0===r)return null;var s=t[n];t[n]=t[i],t[i]=s;for(var l=i+1;l=0;p--){c[p]=t[p][e]/t[p][p];for(var f=p-1;f>=0;f--)t[f][e]-=t[f][p]*c[p]}return c}([[h-=T,g-=P,0,0,S-m],[_-=T,v-=P,0,0,b-m],[0,0,h,g,C-w],[0,0,_,v,E-w]]);if(R){if(p.save(),p.beginPath(),function(){if(void 0===Yd){var t=document.createElement("canvas").getContext("2d");t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",eg(t,4,5,4,0),eg(t,4,5,0,5);var e=t.getImageData(0,0,3,3).data;Yd=ig(e,0)||ig(e,4)||ig(e,8)}return Yd}()||c===tg){p.moveTo(S,C);for(var O=m-S,F=w-C,I=0;I<4;I++)p.lineTo(S+f((I+1)*O/4),C+f(I*F/3)),3!=I&&p.lineTo(S+f((I+1)*O/4),C+f((I+1)*F/3));p.lineTo(b,E)}else p.moveTo(S,C),p.lineTo(m,w),p.lineTo(b,E);p.clip(),p.transform(R[0],R[2],R[1],R[3],m,w),p.translate(d[0]-T,d[3]-P),p.scale(n/i,-n/i),p.drawImage(y.canvas,0,0),p.restore()}})),h&&(p.save(),p.globalCompositeOperation="source-over",p.strokeStyle="black",p.lineWidth=1,s.getTriangles().forEach((function(t,e,i){var n=t.target,r=(n[0][0]-x[0])/o,a=-(n[0][1]-x[1])/o,s=(n[1][0]-x[0])/o,l=-(n[1][1]-x[1])/o,u=(n[2][0]-x[0])/o,h=-(n[2][1]-x[1])/o;p.beginPath(),p.moveTo(s,l),p.lineTo(r,a),p.lineTo(u,h),p.closePath(),p.stroke()})),p.restore()),p.canvas}var og=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),ag=function(t){function e(e,i,n,r,o,a,s,l,u,h,c,p){var f=t.call(this,o,ms)||this;f.renderEdges_=void 0!==c&&c,f.contextOptions_=p,f.pixelRatio_=s,f.gutter_=l,f.canvas_=null,f.sourceTileGrid_=i,f.targetTileGrid_=r,f.wrappedTileCoord_=a||o,f.sourceTiles_=[],f.sourcesListenerKeys_=null,f.sourceZ_=0;var d=r.getTileCoordExtent(f.wrappedTileCoord_),g=f.targetTileGrid_.getExtent(),_=f.sourceTileGrid_.getExtent(),y=g?ge(d,g):d;if(0===le(y))return f.state=Cs,f;var v=e.getExtent();v&&(_=_?ge(_,v):v);var m=r.getResolution(f.wrappedTileCoord_[0]),x=function(t,e,i,n){var r=ce(i),o=ng(t,e,r,n);return(!isFinite(o)||o<=0)&&se(i,(function(i){return o=ng(t,e,i,n),isFinite(o)&&o>0})),o}(e,n,y,m);if(!isFinite(x)||x<=0)return f.state=Cs,f;var w=void 0!==h?h:.5;if(f.triangulation_=new $d(e,n,y,_,x*w,m),0===f.triangulation_.getTriangles().length)return f.state=Cs,f;f.sourceZ_=i.getZForResolution(x);var S=f.triangulation_.calculateSourceExtent();if(_&&(e.canWrapX()?(S[1]=Ce(S[1],_[1],_[3]),S[3]=Ce(S[3],_[1],_[3])):S=ge(S,_)),le(S)){for(var C=i.getTileRangeForExtentAndZ(S,f.sourceZ_),b=C.minX;b<=C.maxX;b++)for(var E=C.minY;E<=C.maxY;E++){var T=u(f.sourceZ_,b,E,s);T&&f.sourceTiles_.push(T)}0===f.sourceTiles_.length&&(f.state=Cs)}else f.state=Cs;return f}return og(e,t),e.prototype.getImage=function(){return this.canvas_},e.prototype.reproject_=function(){var t=[];if(this.sourceTiles_.forEach(function(e,i,n){e&&e.getState()==ws&&t.push({extent:this.sourceTileGrid_.getTileCoordExtent(e.tileCoord),image:e.getImage()})}.bind(this)),this.sourceTiles_.length=0,0===t.length)this.state=Ss;else{var e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),n="number"==typeof i?i:i[0],r="number"==typeof i?i:i[1],o=this.targetTileGrid_.getResolution(e),a=this.sourceTileGrid_.getResolution(this.sourceZ_),s=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=rg(n,r,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,s,this.triangulation_,t,this.gutter_,this.renderEdges_,this.contextOptions_),this.state=ws}this.changed()},e.prototype.load=function(){if(this.state==ms){this.state=xs,this.changed();var t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(function(e,i,n){var r=e.getState();if(r==ms||r==xs){t++;var o=N(e,E,(function(i){var n=e.getState();n!=ws&&n!=Ss&&n!=Cs||(B(o),0===--t&&(this.unlistenSources_(),this.reproject_()))}),this);this.sourcesListenerKeys_.push(o)}}.bind(this)),this.sourceTiles_.forEach((function(t,e,i){t.getState()==ms&&t.load()})),0===t&&setTimeout(this.reproject_.bind(this),0)}},e.prototype.unlistenSources_=function(){this.sourcesListenerKeys_.forEach(B),this.sourcesListenerKeys_=null},e}(Os),sg=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),lg=function(t){function e(e){var i=t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,opaque:e.opaque,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:ug,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection})||this;return i.crossOrigin=void 0!==e.crossOrigin?e.crossOrigin:null,i.tileClass=void 0!==e.tileClass?e.tileClass:Is,i.tileCacheForProjection={},i.tileGridForProjection={},i.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,i.contextOptions_=!1===e.imageSmoothing?tg:void 0,i.renderReprojectionEdges_=!1,i}return sg(e,t),e.prototype.canExpireCache=function(){if(this.tileCache.canExpireCache())return!0;for(var t in this.tileCacheForProjection)if(this.tileCacheForProjection[t].canExpireCache())return!0;return!1},e.prototype.expireCache=function(t,e){var i=this.getTileCacheForProjection(t);for(var n in this.tileCache.expireCache(this.tileCache==i?e:{}),this.tileCacheForProjection){var r=this.tileCacheForProjection[n];r.expireCache(r==i?e:{})}},e.prototype.getContextOptions=function(){return this.contextOptions_},e.prototype.getGutterForProjection=function(t){return this.getProjection()&&t&&!di(this.getProjection(),t)?0:this.getGutter()},e.prototype.getGutter=function(){return 0},e.prototype.getKey=function(){return t.prototype.getKey.call(this)+(this.contextOptions_?"\n"+JSON.stringify(this.contextOptions_):"")},e.prototype.getOpaque=function(e){return!(this.getProjection()&&e&&!di(this.getProjection(),e))&&t.prototype.getOpaque.call(this,e)},e.prototype.getTileGridForProjection=function(t){var e=this.getProjection();if(!this.tileGrid||e&&!di(e,t)){var i=n(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=jd(t)),this.tileGridForProjection[i]}return this.tileGrid},e.prototype.getTileCacheForProjection=function(t){var e=this.getProjection();if(!e||di(e,t))return this.tileCache;var i=n(t);return i in this.tileCacheForProjection||(this.tileCacheForProjection[i]=new Jh(this.tileCache.highWaterMark)),this.tileCacheForProjection[i]},e.prototype.createTile_=function(t,e,i,n,r,o){var a=[t,e,i],s=this.getTileCoordForTileUrlFunction(a,r),l=s?this.tileUrlFunction(s,n,r):void 0,u=new this.tileClass(a,void 0!==l?ms:Cs,void 0!==l?l:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return u.key=o,u.addEventListener(E,this.handleTileChange.bind(this)),u},e.prototype.getTile=function(t,e,i,n,r){var o=this.getProjection();if(o&&r&&!di(o,r)){var a=this.getTileCacheForProjection(r),s=[t,e,i],l=void 0,u=Zh(s);a.containsKey(u)&&(l=a.get(u));var h=this.getKey();if(l&&l.key==h)return l;var c=this.getTileGridForProjection(o),p=this.getTileGridForProjection(r),f=this.getTileCoordForTileUrlFunction(s,r),d=new ag(o,c,r,p,s,f,this.getTilePixelRatio(n),this.getGutter(),function(t,e,i,n){return this.getTileInternal(t,e,i,n,o)}.bind(this),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.contextOptions_);return d.key=h,l?(d.interimTile=l,d.refreshInterimChain(),a.replace(u,d)):a.set(u,d),d}return this.getTileInternal(t,e,i,n,o||r)},e.prototype.getTileInternal=function(t,e,i,n,r){var o=null,a=Kh(t,e,i),s=this.getKey();if(this.tileCache.containsKey(a)){if((o=this.tileCache.get(a)).key!=s){var l=o;o=this.createTile_(t,e,i,n,r,s),l.getState()==ms?o.interimTile=l.interimTile:o.interimTile=l,o.refreshInterimChain(),this.tileCache.replace(a,o)}}else o=this.createTile_(t,e,i,n,r,s),this.tileCache.set(a,o);return o},e.prototype.setRenderReprojectionEdges=function(t){if(this.renderReprojectionEdges_!=t){for(var e in this.renderReprojectionEdges_=t,this.tileCacheForProjection)this.tileCacheForProjection[e].clear();this.changed()}},e.prototype.setTileGridForProjection=function(t,e){var i=hi(t);if(i){var r=n(i);r in this.tileGridForProjection||(this.tileGridForProjection[r]=e)}},e}(Zd);function ug(t,e){t.getImage().src=e}var hg=1,cg=2,pg=4,fg=8,dg=16,gg=31,_g={};function yg(t){if("number"==typeof t)return hg;if("boolean"==typeof t)return fg;if("string"==typeof t)return e=t,zn.test(e)&&(e=Un(e)),Nn.test(e)||0===e.indexOf("rgba(")||0===e.indexOf("rgb(")?pg|cg:cg;var e;if(!Array.isArray(t))throw new Error("Unhandled value type: "+JSON.stringify(t));var i=t;if(i.every((function(t){return"number"==typeof t})))return 3===i.length||4===i.length?pg|dg:dg;if("string"!=typeof i[0])throw new Error("Expected an expression operator but received: "+JSON.stringify(i));var n=_g[i[0]];if(void 0===n)throw new Error("Unrecognized expression operator: "+JSON.stringify(i));return n.getReturnType(i.slice(1))}function vg(t){var e=t.toString();return-1===e.indexOf(".")?e+".0":e}function mg(t){if(t.length<2||t.length>4)throw new Error("`formatArray` can only output `vec2`, `vec3` or `vec4` arrays.");return"vec"+t.length+"("+t.map(vg).join(", ")+")"}function xg(t,e){return void 0===t.stringLiteralsMap[e]&&(t.stringLiteralsMap[e]=Object.keys(t.stringLiteralsMap).length),t.stringLiteralsMap[e]}function wg(t,e,i){if(Array.isArray(e)&&"string"==typeof e[0]){var n=_g[e[0]];if(void 0===n)throw new Error("Unrecognized expression operator: "+JSON.stringify(e));return n.toGlsl(t,e.slice(1),i)}var r,o=yg(e);return(o&hg)>0?vg(e):(o&fg)>0?e.toString():(o&cg)>0&&(void 0===i||i==cg)?function(t,e){return vg(xg(t,e))}(t,e.toString()):(o&pg)>0&&(void 0===i||i==pg)?((r=Wn(e).slice()).length<4&&r.push(1),mg(r.map((function(t,e){return e<3?t/255:t})))):(o&dg)>0?mg(e):void 0}function Sg(t){if(!(yg(t)&hg))throw new Error("A numeric value was expected, got "+JSON.stringify(t)+" instead")}function Cg(t){for(var e=0;ee)throw new Error("At most "+e+" arguments were expected, got "+t.length+" instead")}function Og(t){if(t.length%2!=0)throw new Error("An even amount of arguments was expected, got "+t+" instead")}function Fg(t,e){if(i=e,Math.log2(i)%1!=0)throw new Error("Could not infer only one type from the following expression: "+JSON.stringify(t));var i}function Ig(t){return{getReturnType:function(t){return fg},toGlsl:function(e,i){Tg(i,2);for(var n=gg,r=0;r"]={getReturnType:function(t){return fg},toGlsl:function(t,e){return Tg(e,2),Cg(e),"("+wg(t,e[0])+" > "+wg(t,e[1])+")"}},_g[">="]={getReturnType:function(t){return fg},toGlsl:function(t,e){return Tg(e,2),Cg(e),"("+wg(t,e[0])+" >= "+wg(t,e[1])+")"}},_g["<"]={getReturnType:function(t){return fg},toGlsl:function(t,e){return Tg(e,2),Cg(e),"("+wg(t,e[0])+" < "+wg(t,e[1])+")"}},_g["<="]={getReturnType:function(t){return fg},toGlsl:function(t,e){return Tg(e,2),Cg(e),"("+wg(t,e[0])+" <= "+wg(t,e[1])+")"}},_g["=="]=Ig("=="),_g["!="]=Ig("!="),_g["!"]={getReturnType:function(t){return fg},toGlsl:function(t,e){return Tg(e,1),Eg(e[0]),"(!"+wg(t,e[0])+")"}},_g.all=Mg("&&"),_g.any=Mg("||"),_g.between={getReturnType:function(t){return fg},toGlsl:function(t,e){Tg(e,3),Cg(e);var i=wg(t,e[1]),n=wg(t,e[2]),r=wg(t,e[0]);return"("+r+" >= "+i+" && "+r+" <= "+n+")"}},_g.array={getReturnType:function(t){return dg},toGlsl:function(t,e){Pg(e,2),Rg(e,4),Cg(e);var i=e.map((function(e){return wg(t,e,hg)}));return"vec"+e.length+"("+i.join(", ")+")"}},_g.color={getReturnType:function(t){return pg},toGlsl:function(t,e){Pg(e,3),Rg(e,4),Cg(e);var i=e;3===e.length&&i.push(1);var n=e.map((function(e,i){return wg(t,e,hg)+(i<3?" / 255.0":"")}));return"vec"+e.length+"("+n.join(", ")+")"}},_g.interpolate={getReturnType:function(t){for(var e=pg|hg,i=3;i=1;l-=2){s="("+o+" == "+wg(t,e[l])+" ? "+wg(t,e[l+1],r)+" : "+(s||a)+")"}return s}},_g.case={getReturnType:function(t){for(var e=gg,i=1;i=0;o-=2){s="("+wg(t,e[o])+" ? "+wg(t,e[o+1],r)+" : "+(s||a)+")"}return s}};var Ag=function(){function t(){this.uniforms=[],this.attributes=[],this.varyings=[],this.sizeExpression="vec2(1.0)",this.rotationExpression="0.0",this.offsetExpression="vec2(0.0)",this.colorExpression="vec4(1.0)",this.texCoordExpression="vec4(0.0, 0.0, 1.0, 1.0)",this.discardExpression="false",this.rotateWithView=!1}return t.prototype.addUniform=function(t){return this.uniforms.push(t),this},t.prototype.addAttribute=function(t){return this.attributes.push(t),this},t.prototype.addVarying=function(t,e,i){return this.varyings.push({name:t,type:e,expression:i}),this},t.prototype.setSizeExpression=function(t){return this.sizeExpression=t,this},t.prototype.setRotationExpression=function(t){return this.rotationExpression=t,this},t.prototype.setSymbolOffsetExpression=function(t){return this.offsetExpression=t,this},t.prototype.setColorExpression=function(t){return this.colorExpression=t,this},t.prototype.setTextureCoordinateExpression=function(t){return this.texCoordExpression=t,this},t.prototype.setFragmentDiscardExpression=function(t){return this.discardExpression=t,this},t.prototype.setSymbolRotateWithView=function(t){return this.rotateWithView=t,this},t.prototype.getSizeExpression=function(){return this.sizeExpression},t.prototype.getOffsetExpression=function(){return this.offsetExpression},t.prototype.getColorExpression=function(){return this.colorExpression},t.prototype.getTextureCoordinateExpression=function(){return this.texCoordExpression},t.prototype.getFragmentDiscardExpression=function(){return this.discardExpression},t.prototype.getSymbolVertexShader=function(t){var e=this.rotateWithView?"u_offsetScaleMatrix * u_offsetRotateMatrix":"u_offsetScaleMatrix",i=this.attributes,n=this.varyings;return t&&(i=i.concat("vec4 a_hitColor"),n=n.concat({name:"v_hitColor",type:"vec4",expression:"a_hitColor"})),"precision mediump float;\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_offsetScaleMatrix;\nuniform mat4 u_offsetRotateMatrix;\nuniform float u_time;\nuniform float u_zoom;\nuniform float u_resolution;\n"+this.uniforms.map((function(t){return"uniform "+t+";"})).join("\n")+"\nattribute vec2 a_position;\nattribute float a_index;\n"+i.map((function(t){return"attribute "+t+";"})).join("\n")+"\nvarying vec2 v_texCoord;\nvarying vec2 v_quadCoord;\n"+n.map((function(t){return"varying "+t.type+" "+t.name+";"})).join("\n")+"\nvoid main(void) {\n mat4 offsetMatrix = "+e+";\n vec2 halfSize = "+this.sizeExpression+" * 0.5;\n vec2 offset = "+this.offsetExpression+";\n float angle = "+this.rotationExpression+";\n float offsetX;\n float offsetY;\n if (a_index == 0.0) {\n offsetX = (offset.x - halfSize.x) * cos(angle) + (offset.y - halfSize.y) * sin(angle);\n offsetY = (offset.y - halfSize.y) * cos(angle) - (offset.x - halfSize.x) * sin(angle);\n } else if (a_index == 1.0) {\n offsetX = (offset.x + halfSize.x) * cos(angle) + (offset.y - halfSize.y) * sin(angle);\n offsetY = (offset.y - halfSize.y) * cos(angle) - (offset.x + halfSize.x) * sin(angle);\n } else if (a_index == 2.0) {\n offsetX = (offset.x + halfSize.x) * cos(angle) + (offset.y + halfSize.y) * sin(angle);\n offsetY = (offset.y + halfSize.y) * cos(angle) - (offset.x + halfSize.x) * sin(angle);\n } else {\n offsetX = (offset.x - halfSize.x) * cos(angle) + (offset.y + halfSize.y) * sin(angle);\n offsetY = (offset.y + halfSize.y) * cos(angle) - (offset.x - halfSize.x) * sin(angle);\n }\n vec4 offsets = offsetMatrix * vec4(offsetX, offsetY, 0.0, 0.0);\n gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0) + offsets;\n vec4 texCoord = "+this.texCoordExpression+";\n float u = a_index == 0.0 || a_index == 3.0 ? texCoord.s : texCoord.p;\n float v = a_index == 2.0 || a_index == 3.0 ? texCoord.t : texCoord.q;\n v_texCoord = vec2(u, v);\n u = a_index == 0.0 || a_index == 3.0 ? 0.0 : 1.0;\n v = a_index == 2.0 || a_index == 3.0 ? 0.0 : 1.0;\n v_quadCoord = vec2(u, v);\n"+n.map((function(t){return" "+t.name+" = "+t.expression+";"})).join("\n")+"\n}"},t.prototype.getSymbolFragmentShader=function(t){var e=t?" if (gl_FragColor.a < 0.1) { discard; } gl_FragColor = v_hitColor;":"",i=this.varyings;return t&&(i=i.concat({name:"v_hitColor",type:"vec4",expression:"a_hitColor"})),"precision mediump float;\nuniform float u_time;\nuniform float u_zoom;\nuniform float u_resolution;\n"+this.uniforms.map((function(t){return"uniform "+t+";"})).join("\n")+"\nvarying vec2 v_texCoord;\nvarying vec2 v_quadCoord;\n"+i.map((function(t){return"varying "+t.type+" "+t.name+";"})).join("\n")+"\nvoid main(void) {\n if ("+this.discardExpression+") { discard; }\n gl_FragColor = "+this.colorExpression+";\n gl_FragColor.rgb *= gl_FragColor.a;\n"+e+"\n}"},t}();var Lg=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),kg=function(t){function e(e){var i=this,n=m({},e);return(i=t.call(this,n)||this).parseResult_=function(t){var e=t.symbol,i=void 0!==e.size?e.size:1,n=e.color||"white",r=e.textureCoord||[0,0,1,1],o=e.offset||[0,0],a=void 0!==e.opacity?e.opacity:1,s=void 0!==e.rotation?e.rotation:0,l={inFragmentShader:!1,variables:[],attributes:[],stringLiteralsMap:{}},u=wg(l,i,dg|hg),h=wg(l,o,dg),c=wg(l,r,dg),p=wg(l,s,hg),f={inFragmentShader:!0,variables:l.variables,attributes:[],stringLiteralsMap:l.stringLiteralsMap},d=wg(f,n,pg),g=wg(f,a,hg),_="1.0",y="vec2("+wg(f,i,dg|hg)+").x";switch(e.symbolType){case"square":case"image":break;case"circle":_="(1.0-smoothstep(1.-4./"+y+",1.,dot(v_quadCoord-.5,v_quadCoord-.5)*4.))";break;case"triangle":var v="(v_quadCoord*2.-1.)",m="(atan("+v+".x,"+v+".y))";_="(1.0-smoothstep(.5-3./"+y+",.5,cos(floor(.5+"+m+"/2.094395102)*2.094395102-"+m+")*length("+v+")))";break;default:throw new Error("Unexpected symbol type: "+e.symbolType)}var x=(new Ag).setSizeExpression("vec2("+u+")").setRotationExpression(p).setSymbolOffsetExpression(h).setTextureCoordinateExpression(c).setSymbolRotateWithView(!!e.rotateWithView).setColorExpression("vec4("+d+".rgb, "+d+".a * "+g+" * "+_+")");if(t.filter){var w=wg(f,t.filter,fg);x.setFragmentDiscardExpression("!"+w)}var S={};if(f.variables.forEach((function(e){x.addUniform("float u_"+e),S["u_"+e]=function(){if(!t.variables||void 0===t.variables[e])throw new Error("The following variable is missing from the style: "+e);var i=t.variables[e];return"string"==typeof i&&(i=xg(l,i)),void 0!==i?i:-9999999}})),"image"===e.symbolType&&e.src){var C=new Image;C.src=e.src,x.addUniform("sampler2D u_texture").setColorExpression(x.getColorExpression()+" * texture2D(u_texture, v_texCoord)"),S.u_texture=C}return f.attributes.forEach((function(t){-1===l.attributes.indexOf(t)&&l.attributes.push(t),x.addVarying("v_"+t,"float","a_"+t)})),l.attributes.forEach((function(t){x.addAttribute("float a_"+t)})),{builder:x,attributes:l.attributes.map((function(t){return{name:t,callback:function(e,i){var n=i[t];return"string"==typeof n&&(n=xg(l,n)),void 0!==n?n:-9999999}}})),uniforms:S}}(e.style),i.hitDetectionDisabled_=!!e.disableHitDetection,i}return Lg(e,t),e.prototype.createRenderer=function(){return new gd(this,{className:this.getClassName(),vertexShader:this.parseResult_.builder.getSymbolVertexShader(),fragmentShader:this.parseResult_.builder.getSymbolFragmentShader(),hitVertexShader:!this.hitDetectionDisabled_&&this.parseResult_.builder.getSymbolVertexShader(!0),hitFragmentShader:!this.hitDetectionDisabled_&&this.parseResult_.builder.getSymbolFragmentShader(!0),uniforms:this.parseResult_.uniforms,attributes:this.parseResult_.attributes})},e.prototype.disposeInternal=function(){this.getRenderer().disposeInternal(),t.prototype.disposeInternal.call(this)},e}(Qr),Dg=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();var jg=function(t){function e(e){var i=this,r=void 0!==e.hidpi&&e.hidpi;return(i=t.call(this,{cacheSize:e.cacheSize,crossOrigin:"anonymous",imageSmoothing:e.imageSmoothing,opaque:!0,projection:hi("EPSG:3857"),reprojectionErrorThreshold:e.reprojectionErrorThreshold,state:Zr,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:r?2:1,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition})||this).hidpi_=r,i.culture_=void 0!==e.culture?e.culture:"en-us",i.maxZoom_=void 0!==e.maxZoom?e.maxZoom:-1,i.apiKey_=e.key,i.imagerySet_=e.imagerySet,function(t,e,i,r){var o=document.createElement("script"),a="olc_"+n(e);function s(){delete window[a],o.parentNode.removeChild(o)}o.async=!0,o.src=t+(-1==t.indexOf("?")?"?":"&")+(r||"callback")+"="+a;var l=setTimeout((function(){s(),i&&i()}),1e4);window[a]=function(t){clearTimeout(l),s(),e(t)},document.getElementsByTagName("head")[0].appendChild(o)}("https://dev.virtualearth.net/REST/v1/Imagery/Metadata/"+i.imagerySet_+"?uriScheme=https&include=ImageryProviders&key="+i.apiKey_+"&c="+i.culture_,i.handleImageryMetadataResponse.bind(i),void 0,"jsonp"),i}return Dg(e,t),e.prototype.getApiKey=function(){return this.apiKey_},e.prototype.getImagerySet=function(){return this.imagerySet_},e.prototype.handleImageryMetadataResponse=function(t){if(200==t.statusCode&&"OK"==t.statusDescription&&"ValidCredentials"==t.authenticationResultCode&&1==t.resourceSets.length&&1==t.resourceSets[0].resources.length){var e=t.resourceSets[0].resources[0],i=-1==this.maxZoom_?e.zoomMax:this.maxZoom_,n=zd(this.getProjection()),r=this.hidpi_?2:1,o=e.imageWidth==e.imageHeight?e.imageWidth/r:[e.imageWidth/r,e.imageHeight/r],a=Gd({extent:n,minZoom:e.zoomMin,maxZoom:i,tileSize:o});this.tileGrid=a;var s=this.culture_,l=this.hidpi_;if(this.tileUrlFunction=Vd(e.imageUrlSubdomains.map((function(t){var i=[0,0,0],n=e.imageUrl.replace("{subdomain}",t).replace("{culture}",s);return function(t,e,r){if(t){Yh(t[0],t[1],t[2],i);var o=n;return l&&(o+="&dpi=d1&device=mobile"),o.replace("{quadkey}",function(t){var e,i,n=t[0],r=new Array(n),o=1<>=1;return r.join("")}(i))}}}))),e.imageryProviders){var u=gi(hi("EPSG:4326"),this.getProjection());this.setAttributions(function(t){var i=[],n=t.viewState,r=this.getTileGrid(),o=r.getZForResolution(n.resolution,this.zDirection),a=r.getTileCoordForCoordAndZ(n.center,o)[0];return e.imageryProviders.map((function(e){for(var n=!1,r=e.coverageAreas,o=0,s=r.length;o=l.zoomMin&&a<=l.zoomMax){var h=l.bbox;if(me(we([h[1],h[0],h[3],h[2]],u),t.extent)){n=!0;break}}}n&&i.push(e.attribution)})),i.push('Terms of Use'),i}.bind(this))}this.setState(Hr)}else this.setState(qr)},e}(lg),Gg=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Ng=function(t){function e(e){var i=e||{},n=void 0!==i.projection?i.projection:"EPSG:3857",r=void 0!==i.tileGrid?i.tileGrid:Gd({extent:zd(n),maxResolution:i.maxResolution,maxZoom:i.maxZoom,minZoom:i.minZoom,tileSize:i.tileSize});return t.call(this,{attributions:i.attributions,cacheSize:i.cacheSize,crossOrigin:i.crossOrigin,imageSmoothing:i.imageSmoothing,opaque:i.opaque,projection:n,reprojectionErrorThreshold:i.reprojectionErrorThreshold,tileGrid:r,tileLoadFunction:i.tileLoadFunction,tilePixelRatio:i.tilePixelRatio,tileUrlFunction:i.tileUrlFunction,url:i.url,urls:i.urls,wrapX:void 0===i.wrapX||i.wrapX,transition:i.transition,attributionsCollapsible:i.attributionsCollapsible,zDirection:i.zDirection})||this}return Gg(e,t),e}(lg),zg=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Bg=function(t){function e(e,i,n,r,o,a,s){var l=this,u=e.getExtent(),h=i.getExtent(),c=h?ge(n,h):n,p=ng(e,i,ce(c),r),f=new $d(e,i,c,u,.5*p,r),d=a(f.calculateSourceExtent(),p,o),g=d?Fn:Ln,_=d?d.getPixelRatio():1;return(l=t.call(this,n,r,_,g)||this).targetProj_=i,l.maxSourceExtent_=u,l.triangulation_=f,l.targetResolution_=r,l.targetExtent_=n,l.sourceImage_=d,l.sourcePixelRatio_=_,l.contextOptions_=s,l.canvas_=null,l.sourceListenerKey_=null,l}return zg(e,t),e.prototype.disposeInternal=function(){this.state==In&&this.unlistenSource_(),t.prototype.disposeInternal.call(this)},e.prototype.getImage=function(){return this.canvas_},e.prototype.getProjection=function(){return this.targetProj_},e.prototype.reproject_=function(){var t=this.sourceImage_.getState();if(t==Mn){var e=ve(this.targetExtent_)/this.targetResolution_,i=de(this.targetExtent_)/this.targetResolution_;this.canvas_=rg(e,i,this.sourcePixelRatio_,this.sourceImage_.getResolution(),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0,void 0,this.contextOptions_)}this.state=t,this.changed()},e.prototype.load=function(){if(this.state==Fn){this.state=In,this.changed();var t=this.sourceImage_.getState();t==Mn||t==An?this.reproject_():(this.sourceListenerKey_=N(this.sourceImage_,E,(function(t){var e=this.sourceImage_.getState();e!=Mn&&e!=An||(this.unlistenSource_(),this.reproject_())}),this),this.sourceImage_.load())}},e.prototype.unlistenSource_=function(){B(this.sourceListenerKey_),this.sourceListenerKey_=null},e}(Da),Ug=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Xg="imageloadstart",Wg="imageloadend",Vg="imageloaderror",Yg=function(t){function e(e,i){var n=t.call(this,e)||this;return n.image=i,n}return Ug(e,t),e}(s),Kg=function(t){function i(e){var i=t.call(this,{attributions:e.attributions,projection:e.projection,state:e.state})||this;return i.resolutions_=void 0!==e.resolutions?e.resolutions:null,i.reprojectedImage_=null,i.reprojectedRevision_=0,i.contextOptions_=!1===e.imageSmoothing?tg:void 0,i}return Ug(i,t),i.prototype.getResolutions=function(){return this.resolutions_},i.prototype.getContextOptions=function(){return this.contextOptions_},i.prototype.findNearestResolution=function(t){if(this.resolutions_){var e=p(this.resolutions_,t,0);t=this.resolutions_[e]}return t},i.prototype.getImage=function(t,e,i,n){var r=this.getProjection();if(r&&n&&!di(r,n)){if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&di(this.reprojectedImage_.getProjection(),n)&&this.reprojectedImage_.getResolution()==e&&ie(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new Bg(r,n,t,e,i,function(t,e,i){return this.getImageInternal(t,e,i,r)}.bind(this),this.contextOptions_),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}return r&&(n=r),this.getImageInternal(t,e,i,n)},i.prototype.getImageInternal=function(t,i,n,r){return e()},i.prototype.handleImageChange=function(t){var e=t.target;switch(e.getState()){case In:this.loading=!0,this.dispatchEvent(new Yg(Xg,e));break;case Mn:this.loading=!1,this.dispatchEvent(new Yg(Wg,e));break;case An:this.loading=!1,this.dispatchEvent(new Yg(Vg,e))}},i}(es);function Zg(t,e){t.getImage().src=e}function Hg(t,e){var i=[];Object.keys(e).forEach((function(t){null!==e[t]&&void 0!==e[t]&&i.push(t+"="+encodeURIComponent(e[t]))}));var n=i.join("&");return(t=-1===(t=t.replace(/[?&]$/,"")).indexOf("?")?t+"?":t+"&")+n}var qg="carmentaserver",Jg="geoserver",Qg="mapserver",$g="qgis",t_=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),e_=[101,101],i_=function(t){function e(e){var i=this,n=e||{};return(i=t.call(this,{attributions:n.attributions,imageSmoothing:n.imageSmoothing,projection:n.projection,resolutions:n.resolutions})||this).crossOrigin_=void 0!==n.crossOrigin?n.crossOrigin:null,i.url_=n.url,i.imageLoadFunction_=void 0!==n.imageLoadFunction?n.imageLoadFunction:Zg,i.params_=n.params||{},i.v13_=!0,i.updateV13_(),i.serverType_=n.serverType,i.hidpi_=void 0===n.hidpi||n.hidpi,i.image_=null,i.imageSize_=[0,0],i.renderedRevision_=0,i.ratio_=void 0!==n.ratio?n.ratio:1.5,i}return t_(e,t),e.prototype.getFeatureInfoUrl=function(t,e,i,n){if(void 0!==this.url_){var r=hi(i),o=this.getProjection();o&&o!==r&&(e=ng(o,r,t,e),t=yi(t,r,o));var a=fe(t,e,0,e_),s={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.params_.LAYERS};m(s,this.params_,n);var l=Math.floor((t[0]-a[0])/e),u=Math.floor((a[3]-t[1])/e);return s[this.v13_?"I":"X"]=l,s[this.v13_?"J":"Y"]=u,this.getRequestUrl_(a,e_,1,o||r,s)}},e.prototype.getLegendUrl=function(t,e){if(void 0!==this.url_){var i={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){var n=this.params_.LAYERS;if(!(!Array.isArray(n)||1===n.length))return;i.LAYER=n}if(void 0!==t){var r=this.getProjection()?this.getProjection().getMetersPerUnit():1;i.SCALE=t*r/28e-5}return m(i,e),Hg(this.url_,i)}},e.prototype.getParams=function(){return this.params_},e.prototype.getImageInternal=function(t,e,i,n){if(void 0===this.url_)return null;e=this.findNearestResolution(e),1==i||this.hidpi_&&void 0!==this.serverType_||(i=1);var r=e/i,o=ce(t),a=fe(o,r,0,[Math.ceil(ve(t)/r),Math.ceil(de(t)/r)]),s=fe(o,r,0,[Math.ceil(this.ratio_*ve(t)/r),Math.ceil(this.ratio_*de(t)/r)]),l=this.image_;if(l&&this.renderedRevision_==this.getRevision()&&l.getResolution()==e&&l.getPixelRatio()==i&&Kt(l.getExtent(),a))return l;var u={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};m(u,this.params_),this.imageSize_[0]=Math.round(ve(s)/r),this.imageSize_[1]=Math.round(de(s)/r);var h=this.getRequestUrl_(s,this.imageSize_,i,n,u);return this.image_=new Ga(s,e,i,h,this.crossOrigin_,this.imageLoadFunction_),this.renderedRevision_=this.getRevision(),this.image_.addEventListener(E,this.handleImageChange.bind(this)),this.image_},e.prototype.getImageLoadFunction=function(){return this.imageLoadFunction_},e.prototype.getRequestUrl_=function(t,e,i,n,r){if(it(void 0!==this.url_,9),r[this.v13_?"CRS":"SRS"]=n.getCode(),"STYLES"in this.params_||(r.STYLES=""),1!=i)switch(this.serverType_){case Jg:var o=90*i+.5|0;"FORMAT_OPTIONS"in r?r.FORMAT_OPTIONS+=";dpi:"+o:r.FORMAT_OPTIONS="dpi:"+o;break;case Qg:r.MAP_RESOLUTION=90*i;break;case qg:case $g:r.DPI=90*i;break;default:it(!1,8)}r.WIDTH=e[0],r.HEIGHT=e[1];var a,s=n.getAxisOrientation();return a=this.v13_&&"ne"==s.substr(0,2)?[t[1],t[0],t[3],t[2]]:t,r.BBOX=a.join(","),Hg(this.url_,r)},e.prototype.getUrl=function(){return this.url_},e.prototype.setImageLoadFunction=function(t){this.image_=null,this.imageLoadFunction_=t,this.changed()},e.prototype.setUrl=function(t){t!=this.url_&&(this.url_=t,this.image_=null,this.changed())},e.prototype.updateParams=function(t){m(this.params_,t),this.updateV13_(),this.image_=null,this.changed()},e.prototype.updateV13_=function(){var t=this.params_.VERSION||"1.3.0";this.v13_=$e(t,"1.3")>=0},e}(Kg),n_=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),r_=function(t){function e(e){var i,n=e||{};i=void 0!==n.attributions?n.attributions:['© OpenStreetMap contributors.'];var r=void 0!==n.crossOrigin?n.crossOrigin:"anonymous",o=void 0!==n.url?n.url:"https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png";return t.call(this,{attributions:i,attributionsCollapsible:!1,cacheSize:n.cacheSize,crossOrigin:r,imageSmoothing:n.imageSmoothing,maxZoom:void 0!==n.maxZoom?n.maxZoom:19,opaque:void 0===n.opaque||n.opaque,reprojectionErrorThreshold:n.reprojectionErrorThreshold,tileLoadFunction:n.tileLoadFunction,transition:n.transition,url:o,wrapX:n.wrapX})||this}return n_(e,t),e}(Ng),o_=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),a_=function(t){function e(e){var i=this,n=e||{},r=n.params||{},o=!("TRANSPARENT"in r)||r.TRANSPARENT;return(i=t.call(this,{attributions:n.attributions,cacheSize:n.cacheSize,crossOrigin:n.crossOrigin,imageSmoothing:n.imageSmoothing,opaque:!o,projection:n.projection,reprojectionErrorThreshold:n.reprojectionErrorThreshold,tileClass:n.tileClass,tileGrid:n.tileGrid,tileLoadFunction:n.tileLoadFunction,url:n.url,urls:n.urls,wrapX:void 0===n.wrapX||n.wrapX,transition:n.transition})||this).gutter_=void 0!==n.gutter?n.gutter:0,i.params_=r,i.v13_=!0,i.serverType_=n.serverType,i.hidpi_=void 0===n.hidpi||n.hidpi,i.tmpExtent_=[1/0,1/0,-1/0,-1/0],i.updateV13_(),i.setKey(i.getKeyForParams_()),i}return o_(e,t),e.prototype.getFeatureInfoUrl=function(t,e,i,n){var r=hi(i),o=this.getProjection(),a=this.getTileGrid();a||(a=this.getTileGridForProjection(r));var s=a.getZForResolution(e,this.zDirection),l=a.getTileCoordForCoordAndZ(t,s);if(!(a.getResolutions().length<=l[0])){var u=a.getResolution(l[0]),h=a.getTileCoordExtent(l,this.tmpExtent_),c=jn(a.getTileSize(l[0]),this.tmpSize),p=this.gutter_;0!==p&&(c=kn(c,p,this.tmpSize),h=Xt(h,u*p,h)),o&&o!==r&&(u=ng(o,r,t,u),h=function(t,e,i,n){return we(t,_i(e,i),void 0,n)}(h,r,o),t=yi(t,r,o));var f={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.params_.LAYERS};m(f,this.params_,n);var d=Math.floor((t[0]-h[0])/u),g=Math.floor((h[3]-t[1])/u);return f[this.v13_?"I":"X"]=d,f[this.v13_?"J":"Y"]=g,this.getRequestUrl_(l,c,h,1,o||r,f)}},e.prototype.getLegendUrl=function(t,e){if(void 0!==this.urls[0]){var i={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){var n=this.params_.LAYERS;if(!(!Array.isArray(n)||1===n.length))return;i.LAYER=n}if(void 0!==t){var r=this.getProjection()?this.getProjection().getMetersPerUnit():1;i.SCALE=t*r/28e-5}return m(i,e),Hg(this.urls[0],i)}},e.prototype.getGutter=function(){return this.gutter_},e.prototype.getParams=function(){return this.params_},e.prototype.getRequestUrl_=function(t,e,i,n,r,o){var a=this.urls;if(a){if(o.WIDTH=e[0],o.HEIGHT=e[1],o[this.v13_?"CRS":"SRS"]=r.getCode(),"STYLES"in this.params_||(o.STYLES=""),1!=n)switch(this.serverType_){case Jg:var s=90*n+.5|0;"FORMAT_OPTIONS"in o?o.FORMAT_OPTIONS+=";dpi:"+s:o.FORMAT_OPTIONS="dpi:"+s;break;case Qg:o.MAP_RESOLUTION=90*n;break;case qg:case $g:o.DPI=90*n;break;default:it(!1,52)}var l,u=r.getAxisOrientation(),h=i;if(this.v13_&&"ne"==u.substr(0,2)){var c=void 0;c=i[0],h[0]=i[1],h[1]=c,c=i[2],h[2]=i[3],h[3]=c}if(o.BBOX=h.join(","),1==a.length)l=a[0];else l=a[Fe(Hh(t),a.length)];return Hg(l,o)}},e.prototype.getTilePixelRatio=function(t){return this.hidpi_&&void 0!==this.serverType_?t:1},e.prototype.getKeyForParams_=function(){var t=0,e=[];for(var i in this.params_)e[t++]=i+"-"+this.params_[i];return e.join("/")},e.prototype.updateParams=function(t){m(this.params_,t),this.updateV13_(),this.setKey(this.getKeyForParams_())},e.prototype.updateV13_=function(){var t=this.params_.VERSION||"1.3.0";this.v13_=$e(t,"1.3")>=0},e.prototype.tileUrlFunction=function(t,e,i){var n=this.getTileGrid();if(n||(n=this.getTileGridForProjection(i)),!(n.getResolutions().length<=t[0])){1==e||this.hidpi_&&void 0!==this.serverType_||(e=1);var r=n.getResolution(t[0]),o=n.getTileCoordExtent(t,this.tmpExtent_),a=jn(n.getTileSize(t[0]),this.tmpSize),s=this.gutter_;0!==s&&(a=kn(a,s,this.tmpSize),o=Xt(o,r*s,o)),1!=e&&(a=Dn(a,e,this.tmpSize));var l={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};return m(l,this.params_),this.getRequestUrl_(t,a,o,e,i,l)}},e}(lg);X.unByKey=W;let s_={Control:bl,Zoom:Fl,Attribution:Tl,ScaleLine:Gl,LayerSwitcher:tc},l_={GeoJSON:hc,KML:fp},u_={Group:zs,Tile:Qd,Vector:Qa,WebGLPoints:kg,Heatmap:wd,Image:Pd},h_={toLonLat:function(t,e){var i=yi(t,void 0!==e?e:"EPSG:3857","EPSG:4326"),n=i[0];return(n<-180||n>180)&&(i[0]=Fe(n+180,360)-180),i},fromLonLat:function(t,e){return yi(t,"EPSG:4326",void 0!==e?e:"EPSG:3857")}},c_={LineString:Rn,Point:tn,MultiPoint:Zu},p_={Icon:Wa,Style:Rr,Text:kr,Stroke:On,Fill:Cn,Circle:Pr},f_={OSM:r_,XYZ:Ng,TileWMS:a_,BingMaps:jg,Vector:vs,ImageWMS:i_};t.Collection=et,t.Feature=rt,t.Map=Wh,t.Observable=X,t.View=yl,t.control=s_,t.format=l_,t.geom=c_,t.interaction=Uh,t.layer=u_,t.proj=h_,t.source=f_,t.sphere=Qe,t.style=p_,Object.defineProperty(t,"__esModule",{value:!0})})); //# sourceMappingURL=ol-custom.js.map