!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 n=0;function i(t){return t.ol_uid||(t.ol_uid=String(++n))}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 n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a=function(t){function e(e){var n=this,i="Assertion failed. See https://openlayers.org/en/"+("v"+"6.4.3".split("-")[0])+"/doc/errors/#"+e+" for details.";return(n=t.call(this,i)||this).code=e,n.name="AssertionError",n.message=i,n}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,n){var i=t.length;if(t[0]<=e)return 0;if(e<=t[i-1])return i-1;var r=void 0;if(n>0){for(r=1;r0)},e.prototype.removeEventListener=function(t,e){var n=this.listeners_&&this.listeners_[t];if(n){var i=n.indexOf(e);-1!==i&&(this.pendingRemovals_&&t in this.pendingRemovals_?(n[i]=v,++this.pendingRemovals_[t]):(n.splice(i,1),0===n.length&&delete this.listeners_[t]))}},e}(u),E="change",T="error",P="contextmenu",R="click",F="dblclick",O="dragenter",I="dragover",A="drop",M="keydown",L="keypress",k="load",D="resize",G="touchmove",j="wheel";function N(t,e,n,i,r){if(i&&i!==t&&(n=n.bind(i)),r){var o=n;n=function(){t.removeEventListener(e,n),o.apply(this,arguments)}}var a={target:t,type:e,listener:n};return t.addEventListener(e,n),a}function z(t,e,n,i){return N(t,e,n,i,!0)}function B(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),x(t))}var U=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),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 n=t.length,i=new Array(n),r=0;r0;)this.pop()},e.prototype.extend=function(t){for(var e=0,n=t.length;er&&(l|=Nt),so&&(l|=jt),l===Dt&&(l=Gt),l}function qt(){return[1/0,1/0,-1/0,-1/0]}function Jt(t,e,n,i,r){return r?(r[0]=t,r[1]=e,r[2]=n,r[3]=i,r):[t,e,n,i]}function Qt(t){return Jt(1/0,1/0,-1/0,-1/0,t)}function $t(t,e){var n=t[0],i=t[1];return Jt(n,i,n,i,e)}function te(t,e){return function(t,e){for(var n=0,i=e.length;nt[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,n,i,r){for(;ne[0]?i[0]=t[0]:i[0]=e[0],t[1]>e[1]?i[1]=t[1]:i[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?(n=r,i=o):l>0&&(n+=a*l,i+=s*l)}return Pe(t,e,n,i)}function Pe(t,e,n,i){var r=n-t,o=i-e;return r*r+o*o}function Re(t){return 180*t/Math.PI}function Fe(t){return t*Math.PI/180}function Oe(t,e){var n=t%e;return n*e<0?n+e:n}function Ie(t,e,n){return t+n*(e-t)}var Ae=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Me=6378137*Math.PI,Le=[-Me,-Me,Me,Me],ke=[-180,-85,180,85],De=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 Ae(e,t),e}(Se),Ge=[new De("EPSG:3857"),new De("EPSG:102100"),new De("EPSG:102113"),new De("EPSG:900913"),new De("urn:ogc:def:crs:EPSG:6.18:3:3857"),new De("urn:ogc:def:crs:EPSG::3857"),new De("http://www.opengis.net/gml/srs/epsg.xml#3857")];function je(t,e,n){var i=t.length,r=n>1?n:2,o=e;void 0===o&&(o=r>2?t.slice():new Array(i));for(var a=Me,s=0;sa?l=a:l<-a&&(l=-a),o[s+1]=l}return o}function Ne(t,e,n){var i=t.length,r=n>1?n:2,o=e;void 0===o&&(o=r>2?t.slice():new Array(i));for(var a=0;a=1?(n=h,i=c):(n=l+d*p,i=u+d*f),[n,i]}function $e(t,e){for(var n=!0,i=t.length-1;i>=0;--i)if(t[i]!=e[i]){n=!1;break}return n}function tn(t,e){var n=Math.cos(e),i=Math.sin(e),r=t[0]*n-t[1]*i,o=t[1]*n+t[0]*i;return t[0]=r,t[1]=o,t}function en(t,e){var n=t[0]-e[0],i=t[1]-e[1];return n*n+i*i}function nn(t,e){return Math.sqrt(en(t,e))}function rn(t,e){return en(t,Qe(t,e))}function on(t,e){if(e.canWrapX()){var n=ve(e.getExtent()),i=function(t,e,n){var i=e.getExtent(),r=0;if(e.canWrapX()&&(t[0]i[2])){var o=n||ve(i);r=Math.floor((t[0]-i[0])/o)}return r}(t,e,n);i&&(t[0]-=i*n)}return t}function an(t,e,n){var i;if(void 0!==e){for(var r=0,o=t.length;r1)s=n;else{if(p>0){for(var f=0;fr&&(r=u),o=s,a=l}return r}function kn(t,e,n,i,r){for(var o=0,a=n.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+i;vf&&(h=v,f=m)}f>r&&(l[(h-e)/i]=1,p+i0&&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 Wn(t,e,n,i,r,o,a,s){for(var l=0,u=n.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 ni(t,e,n,i,r,o){if(0===n.length)return!1;if(!ei(t,e,n[0],i,r,o))return!1;for(var a=1,s=n.length;aw&&ni(t,e,n,i,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 ri(t,e,n,i,r){for(var o,a=[t[e],t[e+1]],s=[];e+i=r[0]&&o[2]<=r[2]||(o[1]>=r[1]&&o[3]<=r[3]||ri(t,e,n,i,(function(t,e){return function(t,e,n){var i=!1,r=Ht(t,e),o=Ht(t,n);if(r===Gt||o===Gt)i=!0;else{var a=t[0],s=t[1],l=t[2],u=t[3],h=e[0],c=e[1],p=n[0],f=n[1],d=(f-c)/(p-h),g=void 0,_=void 0;o&jt&&!(r&jt)&&(i=(g=p-(f-u)/d)>=a&&g<=l),i||!(o&Nt)||r&Nt||(i=(_=f-(p-l)*d)>=s&&_<=u),i||!(o&zt)||r&zt||(i=(g=p-(f-s)/d)>=a&&g<=l),i||!(o&Bt)||r&Bt||(i=(_=f-(p-a)*d)>=s&&_<=u)}return i}(r,t,e)})))))}function ai(t,e,n,i,r){if(!function(t,e,n,i,r){return!!oi(t,e,n,i,r)||(!!ei(t,e,n,i,r[0],r[1])||(!!ei(t,e,n,i,r[0],r[3])||(!!ei(t,e,n,i,r[2],r[1])||!!ei(t,e,n,i,r[2],r[3]))))}(t,e,n[0],i,r))return!1;if(1===n.length)return!0;for(var o=1,a=n.length;oo||(u==o&&l>=a||(r=s,o=u,a=l))}return r}(t,e,n,i),s=a-i;s=n&&(l=e);var u=t[s],h=t[s+1],c=t[a],p=t[a+1],f=t[l],d=t[l+1];return c*d+u*p+h*f-(h*c+p*f+u*d)<0}function ui(t,e,n,i,r){for(var o=void 0!==r&&r,a=0,s=n.length;a>1)],e))<0?a=i+1:(s=i,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)*i):s=e+m*i}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)}i=function(t){var e,n,i,r,o;Gi.exec(t)&&(t=ji(t));if(Di.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),n=parseInt(t.substr(1+1*s,s),16),i=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,n=(n<<4)+n,i=(i<<4)+i,l&&(r=(r<<4)+r)),o=[e,n,i,r/255]}else 0==t.indexOf("rgba(")?Bi(o=t.slice(5,-1).split(",").map(Number)):0==t.indexOf("rgb(")?((o=t.slice(4,-1).split(",").map(Number)).push(1),Bi(o)):nt(!1,14);return o}(n),t[n]=i,++e}return i}}();function zi(t){return Array.isArray(t)?t:Ni(t)}function Bi(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 Ui(t){var e=t[0];e!=(0|e)&&(e=e+.5|0);var n=t[1];n!=(0|n)&&(n=n+.5|0);var i=t[2];return i!=(0|i)&&(i=i+.5|0),"rgba("+e+","+n+","+i+","+(void 0===t[3]?1:t[3])+")"}function Xi(t){return Array.isArray(t)?Ui(t):t}var Wi="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"",Vi=-1!==Wi.indexOf("firefox"),Ki=(-1!==Wi.indexOf("safari")&&Wi.indexOf("chrom"),-1!==Wi.indexOf("webkit")&&-1==Wi.indexOf("edge")),Yi=-1!==Wi.indexOf("macintosh"),Zi="undefined"!=typeof devicePixelRatio?devicePixelRatio:1,Hi="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,qi="undefined"!=typeof Image&&Image.prototype.decode,Ji=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 Qi(t,e,n){var i=n&&n.length?n.shift():Hi?new OffscreenCanvas(t||300,e||300):document.createElement("canvas");return t&&(i.width=t),e&&(i.height=e),i.getContext("2d")}function $i(t,e){var n=e.parentNode;n&&n.replaceChild(t,e)}function tr(t){return t&&t.parentNode?t.parentNode.removeChild(t):null}var er=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"),nr=["style","variant","weight","size","lineHeight","family"],ir=function(t){var e=t.match(er);if(!e)return null;for(var n={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"},i=0,r=nr.length;i=t.maxResolution)return!1;var i=e.zoom;return i>t.minZoom&&i<=t.maxZoom}var qr=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Jr="renderOrder",Qr=function(t){function e(e){var n=this,i=e||{},r=m({},i);return delete r.style,delete r.renderBuffer,delete r.updateWhileAnimating,delete r.updateWhileInteracting,(n=t.call(this,r)||this).declutter_=void 0!==i.declutter&&i.declutter,n.renderBuffer_=void 0!==i.renderBuffer?i.renderBuffer:100,n.style_=null,n.styleFunction_=void 0,n.setStyle(i.style),n.updateWhileAnimating_=void 0!==i.updateWhileAnimating&&i.updateWhileAnimating,n.updateWhileInteracting_=void 0!==i.updateWhileInteracting&&i.updateWhileInteracting,n}return qr(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(Jr)},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.setRenderOrder=function(t){this.set(Jr,t)},e.prototype.setStyle=function(t){this.style_=void 0!==t?t:Tr,this.styleFunction_=null===t?void 0:function(t){var e;if("function"==typeof t)e=t;else{var n;if(Array.isArray(t))n=t;else nt("function"==typeof t.getZIndex,41),n=[t];e=function(){return n}}return e}(this.style_),this.changed()},e}(Zr),$r=0,to=1,eo=2,no=3,io=4,ro=5,oo=6,ao=7,so=8,lo=9,uo=10,ho=11,co=12,po=[so],fo=[co],go=[to],_o=[no],yo=function(){function t(){}return t.prototype.drawCustom=function(t,e,n){},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}(),vo=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),mo=function(t){function e(e,n,i,r){var o=t.call(this)||this;return o.tolerance=e,o.maxExtent=n,o.pixelRatio=r,o.maxLineWidth=0,o.resolution=i,o.beginGeometryInstruction1_=null,o.beginGeometryInstruction2_=null,o.bufferedMaxExtent_=null,o.instructions=[],o.coordinates=[],o.tmpCoordinate_=[],o.hitDetectionInstructions=[],o.state={},o}return vo(e,t),e.prototype.applyPixelRatio=function(t){var e=this.pixelRatio;return 1==e?t:t.map((function(t){return t*e}))},e.prototype.appendFlatCoordinates=function(t,e,n,i,r,o){var a=this.coordinates.length,s=this.getBufferedMaxExtent();o&&(e+=i);var l,u,h,c=t[e],p=t[e+1],f=this.tmpCoordinate_,d=!0;for(l=e+i;lthis.maxLineWidth&&(this.maxLineWidth=n.lineWidth,this.bufferedMaxExtent_=null)}else n.strokeStyle=void 0,n.lineCap=void 0,n.lineDash=null,n.lineDashOffset=void 0,n.lineJoin=void 0,n.lineWidth=void 0,n.miterLimit=void 0},e.prototype.createFill=function(t){var e=t.fillStyle,n=[uo,e];return"string"!=typeof e&&n.push(!0),n},e.prototype.applyStroke=function(t){this.instructions.push(this.createStroke(t))},e.prototype.createStroke=function(t){return[ho,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 n=t.fillStyle;"string"==typeof n&&t.currentFillStyle==n||(void 0!==n&&this.instructions.push(e.call(this,t)),t.currentFillStyle=n)},e.prototype.updateStrokeStyle=function(t,e){var n=t.strokeStyle,i=t.lineCap,r=t.lineDash,o=t.lineDashOffset,a=t.lineJoin,s=t.lineWidth,l=t.miterLimit;(t.currentStrokeStyle!=n||t.currentLineCap!=i||r!=t.currentLineDash&&!g(t.currentLineDash,r)||t.currentLineDashOffset!=o||t.currentLineJoin!=a||t.currentLineWidth!=s||t.currentMiterLimit!=l)&&(void 0!==n&&e.call(this,t),t.currentStrokeStyle=n,t.currentLineCap=i,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=[ao,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}(yo),xo=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),wo=function(t){function e(e,n,i,r){var o=t.call(this,e,n,i,r)||this;return o.declutterGroups_=null,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}return xo(e,t),e.prototype.drawCoordinates_=function(t,e,n,i){return this.appendFlatCoordinates(t,e,n,i,!1,!1)},e.prototype.drawPoint=function(t,e){if(this.image_){this.beginGeometry(t,e);var n=t.getFlatCoordinates(),i=t.getStride(),r=this.coordinates.length,o=this.drawCoordinates_(n,0,n.length,i);this.instructions.push([oo,r,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,this.declutterGroups_,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.hitDetectionInstructions.push([oo,r,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.declutterGroups_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_]),this.endGeometry(e)}},e.prototype.drawMultiPoint=function(t,e){if(this.image_){this.beginGeometry(t,e);var n=t.getFlatCoordinates(),i=t.getStride(),r=this.coordinates.length,o=this.drawCoordinates_(n,0,n.length,i);this.instructions.push([oo,r,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,this.declutterGroups_,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.hitDetectionInstructions.push([oo,r,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.declutterGroups_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_]),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 n=t.getAnchor(),i=t.getSize(),r=t.getHitDetectionImage(),o=t.getImage(this.pixelRatio),a=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=n[0],this.anchorY_=n[1],this.declutterGroups_=e,this.hitDetectionImage_=r,this.image_=o,this.height_=i[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_=i[0]},e}(mo),So=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Co=function(t){function e(e,n,i,r){return t.call(this,e,n,i,r)||this}return So(e,t),e.prototype.drawFlatCoordinates_=function(t,e,n,i){var r=this.coordinates.length,o=this.appendFlatCoordinates(t,e,n,i,!1,!1),a=[lo,r,o];return this.instructions.push(a),this.hitDetectionInstructions.push(a),n},e.prototype.drawLineString=function(t,e){var n=this.state,i=n.strokeStyle,r=n.lineWidth;if(void 0!==i&&void 0!==r){this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([ho,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,n.lineDash,n.lineDashOffset],go);var o=t.getFlatCoordinates(),a=t.getStride();this.drawFlatCoordinates_(o,0,o.length,a),this.hitDetectionInstructions.push(fo),this.endGeometry(e)}},e.prototype.drawMultiLineString=function(t,e){var n=this.state,i=n.strokeStyle,r=n.lineWidth;if(void 0!==i&&void 0!==r){this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([ho,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,n.lineDash,n.lineDashOffset],go);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 Po=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Ro={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},Fo={Circle:Eo,Default:mo,Image:wo,LineString:Co,Polygon:Eo,Text:function(t){function e(e,n,i,r){var o=t.call(this,e,n,i,r)||this;return o.declutterGroups_,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}return Po(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 n=this.textFillState_,i=this.textStrokeState_,r=this.textState_;if(""!==this.text_&&r&&(n||i)){var o,a,s=this.coordinates.length,l=t.getType(),u=null,h=2,c=t.getStride();if(r.placement===Or){if(!me(this.getBufferedMaxExtent(),t.getExtent()))return;var p=void 0;if(u=t.getFlatCoordinates(),l==ht)p=[u.length];else if(l==dt)p=t.getEnds();else if(l==pt)p=t.getEnds().slice(0,1);else if(l==gt){var f=t.getEndss();for(p=[],o=0,a=f.length;or;){if(o-r>600){var s=o-r+1,l=i-r+1,u=Math.log(s),h=.5*Math.exp(2*u/3),c=.5*Math.sqrt(u*h*(s-h)/s)*(l-s/2<0?-1:1),p=Math.max(r,Math.floor(i-l*h/s+c)),f=Math.min(o,Math.floor(i+(s-l)*h/s+c));t(n,i,p,f,a)}var d=n[i],g=r,_=o;for(e(n,r,i),a(n[o],d)>0&&e(n,r,o);g<_;){for(e(n,g,_),g++,_--;a(n[g],d)<0;)g++;for(;a(n[_],d)>0;)_--}0===a(n[r],d)?e(n,r,_):(_++,e(n,_,o)),_<=i&&(r=_+1),i<=_&&(o=_-1)}}(t,i,r||0,o||t.length-1,a||n)}function e(t,e,n){var i=t[e];t[e]=t[n],t[n]=i}function n(t,e){return te?1:0}var i=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function r(t,e,n){if(!n)return e.indexOf(t);for(var i=0;i=t.minX&&e.maxY>=t.minY}function d(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function g(e,n,i,r,o){for(var a=[n,i];a.length;)if(!((i=a.pop())-(n=a.pop())<=r)){var s=n+Math.ceil((i-n)/r/2)*r;t(e,s,n,i,o),a.push(n,s,s,i)}}return i.prototype.all=function(){return this._all(this.data,[])},i.prototype.search=function(t){var e=this.data,n=[];if(!f(t,e))return n;for(var i=this.toBBox,r=[];e;){for(var o=0;o=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(i,r,e)},i.prototype._split=function(t,e){var n=t[e],i=n.children.length,r=this._minEntries;this._chooseSplitAxis(n,r,i);var a=this._chooseSplitIndex(n,r,i),s=d(n.children.splice(a,n.children.length-a));s.height=n.height,s.leaf=n.leaf,o(n,this.toBBox),o(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(n,s)},i.prototype._splitRoot=function(t,e){this.data=d([t,e]),this.data.height=t.height+1,this.data.leaf=!1,o(this.data,this.toBBox)},i.prototype._chooseSplitIndex=function(t,e,n){for(var i,r,o,s,l,u,c,p=1/0,f=1/0,d=e;d<=n-e;d++){var g=a(t,0,d,this.toBBox),_=a(t,d,n,this.toBBox),y=(r=g,o=_,s=void 0,l=void 0,u=void 0,c=void 0,s=Math.max(r.minX,o.minX),l=Math.max(r.minY,o.minY),u=Math.min(r.maxX,o.maxX),c=Math.min(r.maxY,o.maxY),Math.max(0,u-s)*Math.max(0,c-l)),v=h(g)+h(_);y=e;f--){var d=t.children[f];s(l,t.leaf?r(d):d),u+=c(l)}return u},i.prototype._adjustParentBBoxes=function(t,e,n){for(var i=n;i>=0;i--)s(e[i],t)},i.prototype._condense=function(t){for(var e=t.length-1,n=void 0;e>=0;e--)0===t[e].children.length?e>0?(n=t[e-1].children).splice(n.indexOf(t[e]),1):this.clear():o(t[e],this.toBBox)},i}()}));function Vo(t,e,n,i,r,o,a,s,l,u,h,c){var p,f=[];if(c){var d=En(t,e,n,i,c,[t[e],t[e+1]]);p=d[0]>d[d.length-i]}else p=t[e]>t[n-i];for(var g,_,y=r.length,v=t[e],m=t[e+1],x=t[e+=i],w=t[e+1],S=0,C=Math.sqrt(Math.pow(x-v,2)+Math.pow(w-m,2)),b=!1,E=0;E0?-Math.PI:Math.PI),void 0!==_){var I=O-_;if(b=b||0!==I,I+=I>Math.PI?-2*Math.PI:I<-Math.PI?2*Math.PI:0,Math.abs(I)>a)return null}_=O;var A=F/C,M=Ie(v,x,A),L=Ie(m,w,A);f[g]=[M,L,P/2,O,T],o+=P}return b?f:[[f[0][0],f[0][1],f[0][2],f[0][3],r]]}var Ko=[1/0,1/0,-1/0,-1/0],Yo=[1,0,0,1,0,0],Zo=[],Ho=[],qo=[],Jo=[],Qo=function(){function t(t,e,n,i,r){this.overlaps=n,this.pixelRatio=e,this.resolution=t,this.alignFill_,this.declutterItems=[],this.instructions=i.instructions,this.coordinates=i.coordinates,this.coordinateCache_={},this.renderBuffer_=r,this.renderedTransform_=[1,0,0,1,0,0],this.hitDetectionInstructions=i.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=i.fillStates||{},this.strokeStates=i.strokeStates||{},this.textStates=i.textStates||{},this.widths_={},this.labels_={}}return t.prototype.createLabel=function(t,e,n,i){var r=t+e+n+i;if(this.labels_[r])return this.labels_[r];var o=i?this.strokeStates[i]:null,a=n?this.fillStates[n]:null,s=this.textStates[e],l=this.pixelRatio,u=[s.scale[0]*l,s.scale[1]*l],h=Ro[s.textAlign||"center"],c=i&&o.lineWidth?o.lineWidth:0,p=t.split("\n"),f=p.length,d=[],g=function(t,e,n){for(var i=e.length,r=0,o=0;or.width?r.width-h:g,w=l+c>r.height?r.height-c:l,S=_[3]+x*f[0]+_[1],C=_[0]+w*f[1]+_[2],b=n-_[3],E=i-_[0];(m||0!==p)&&(Zo[0]=b,Jo[0]=b,Zo[1]=E,Ho[1]=E,Ho[0]=b+S,qo[0]=Ho[0],qo[1]=E+C,Jo[1]=qo[1]);var T=null;if(0!==p){var P=n+o,R=i+a;T=Ft(Yo,P,R,1,1,p,-P,-R),Rt(Yo,Zo),Rt(Yo,Ho),Rt(Yo,qo),Rt(Yo,Jo),Jt(Math.min(Zo[0],Ho[0],qo[0],Jo[0]),Math.min(Zo[1],Ho[1],qo[1],Jo[1]),Math.max(Zo[0],Ho[0],qo[0],Jo[0]),Math.max(Zo[1],Ho[1],qo[1],Jo[1]),Ko)}else Jt(b,E,b+S,E+C,Ko);var F=0,O=0;if(s){var I=this.renderBuffer_;I[0]=Math.max(I[0],ve(Ko)),F=I[0],I[1]=Math.max(I[1],de(Ko)),O=I[1]}var A=t.canvas,M=v?v[2]*f[0]/2:0,L=Ko[0]-M<=(A.width+F)/e&&Ko[2]+M>=-F/e&&Ko[1]-M<=(A.height+O)/e&&Ko[3]+M>=-O/e;if(d&&(n=Math.round(n),i=Math.round(i)),s){if(!L&&1==s[0])return!1;var k=L?[t,T?T.slice(0):null,u,r,h,c,x,w,n,i,f,Ko.slice()]:null;k&&(m&&k.push(y,v,Zo.slice(0),Ho.slice(0),qo.slice(0),Jo.slice(0)),s.push(k))}else L&&(m&&this.replayTextBackground_(t,Zo,Ho,qo,Jo,y,v,!1),vr(t,T,u,r,h,c,x,w,n,i,f));return!0},t.prototype.fill_=function(t){if(this.alignFill_){var e=Rt(this.renderedTransform_,[0,0]),n=512*this.pixelRatio;t.save(),t.translate(e[0]%n,e[1]%n),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.renderDeclutter=function(t,e,n,i){for(var r=[],o=1,a=t.length;o12&&this.replayTextBackground_(c[0],c[14],c[15],c[16],c[17],c[12],c[13],!0),vr.apply(void 0,c),f!==n&&(p.globalAlpha=f)}}return t.length=1,i},t.prototype.drawLabelWithPointPlacement_=function(t,e,n,i){var r=this.textStates[e],o=this.createLabel(t,e,i,n),a=this.strokeStates[n],s=this.pixelRatio,l=Ro[r.textAlign||"center"],u=Ro[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,n,i,r,o,a){var s,l,u;this.declutterItems.length=0,this.pixelCoordinates_&&g(n,this.renderedTransform_)?s=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),s=bn(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),l=this.renderedTransform_,u=n,l[0]=u[0],l[1]=u[1],l[2]=u[2],l[3]=u[3],l[4]=u[4],l[5]=u[5]);for(var h,c,p,f,d,_,y,v,m,x,w,S,C,b,E,T,P,R=0,F=i.length,O=0,I=0,A=0,M=null,L=null,k=this.coordinateCache_,D=this.viewRotation_,G=Math.round(1e12*Math.atan2(-n[1],n[0]))/1e12,j={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:D},N=this.instructions!=i||this.overlaps?0:200;RN&&(this.fill_(t),I=0),A>N&&(t.stroke(),A=0),I||A||(t.beginPath(),f=NaN,d=NaN),++R;break;case eo:var B=s[O=z[1]],U=s[O+1],X=s[O+2]-B,W=s[O+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 no:t.closePath(),++R;break;case io:O=z[1],h=z[2];var K=z[3],Y=z[4],Z=6==z.length?z[5]:void 0;j.geometry=K,j.feature=E,R in k||(k[R]=[]);var H=k[R];Z?Z(s,O,h,2,H):(H[0]=s[O],H[1]=s[O+1],H.length=2),Y(H,j),++R;break;case oo:O=z[1],h=z[2],x=z[3],c=z[4],p=z[5],m=o?null:z[6];var q=z[7],J=z[8],Q=z[9],$=z[10],tt=z[11],et=z[12],nt=z[13],it=z[14];if(!x&&z.length>=19){w=z[18],S=z[19],C=z[20],b=z[21];var rt=this.drawLabelWithPointPlacement_(w,S,C,b);x=rt.label,z[3]=x;var ot=z[22];c=(rt.anchorX-ot)*this.pixelRatio,z[4]=c;var at=z[23];p=(rt.anchorY-at)*this.pixelRatio,z[5]=p,q=x.height,z[7]=q,it=x.width,z[14]=it}var st=void 0;z.length>24&&(st=z[24]);var lt=void 0,ut=void 0,ht=void 0;z.length>16?(lt=z[15],ut=z[16],ht=z[17]):(lt=or,ut=!1,ht=!1),tt&&G?et+=D:tt||G||(et-=D);for(var ct=0,pt=0;O=o;)na(n,t+r,t+o),na(n,t+o,t+r),na(n,t-o,t+r),na(n,t-r,t+o),na(n,t-r,t-o),na(n,t-o,t-r),na(n,t+o,t-r),na(n,t+r,t-o),o++,2*((a+=1+2*o)-r)+1>0&&(a+=1-2*(r-=1));return ea[t]=n,n}(i);function f(t){for(var e=u.getImageData(0,0,a,a).data,n=0;n0){var s=void 0;return(!o||c!=No&&c!=Uo||-1!==o.indexOf(t))&&(s=r(t)),s||void u.clearRect(0,0,a,a)}}var d,g,_,y,v,m=Object.keys(this.executorsByZIndex_).map(Number);for(m.sort(h),d=m.length-1;d>=0;--d){var x=m[d].toString();for(_=this.executorsByZIndex_[x],g=$o.length-1;g>=0;--g)if(void 0!==(y=_[c=$o[g]])&&(v=y.executeHitDetection(u,s,n,f,l)))return v}},t.prototype.getClipCoords=function(t){var e=this.maxExtent_;if(!e)return null;var n=e[0],i=e[1],r=e[2],o=e[3],a=[n,i,n,o,r,o,r,i];return bn(a,0,8,2,t,a),a},t.prototype.isEmpty=function(){return S(this.executorsByZIndex_)},t.prototype.execute=function(t,e,n,i,r,o,a){var s=Object.keys(this.executorsByZIndex_).map(Number);s.sort(h),this.maxExtent_&&(t.save(),this.clip(t,n));var l,u,c,p,f,d,g=o||$o;for(l=0,u=s.length;l=r)for(i=r;ithis.maxCacheSize_},t.prototype.expire=function(){if(this.canExpireCache()){var t=0;for(var e in this.cache_){var n=this.cache_[e];0!=(3&t++)||n.hasListener()||(delete this.cache_[e],--this.cacheSize_)}}},t.prototype.get=function(t,e,n){var i=fa(t,e,n);return i in this.cache_?this.cache_[i]:null},t.prototype.set=function(t,e,n,i){var r=fa(t,e,n);this.cache_[r]=i,++this.cacheSize_},t.prototype.setSize=function(t){this.maxCacheSize_=t,this.expire()},t}()),ga=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),_a=function(t){function n(e,n,i,r){var o=t.call(this)||this;return o.extent=e,o.pixelRatio_=i,o.resolution=n,o.state=r,o}return ga(n,t),n.prototype.changed=function(){this.dispatchEvent(E)},n.prototype.getExtent=function(){return this.extent},n.prototype.getImage=function(){return e()},n.prototype.getPixelRatio=function(){return this.pixelRatio_},n.prototype.getResolution=function(){return this.resolution},n.prototype.getState=function(){return this.state},n.prototype.load=function(){e()},n}(b),ya=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();!function(t){function e(e,n,i,r,o,a){var s=t.call(this,e,n,i,Ri)||this;return s.src_=r,s.image_=new Image,null!==o&&(s.image_.crossOrigin=o),s.unlisten_=null,s.state=Ri,s.imageLoadFunction_=a,s}ya(e,t),e.prototype.getImage=function(){return this.image_},e.prototype.handleImageError_=function(){this.state=Ii,this.unlistenImage_(),this.changed()},e.prototype.handleImageLoad_=function(){void 0===this.resolution&&(this.resolution=de(this.extent)/this.image_.height),this.state=Oi,this.unlistenImage_(),this.changed()},e.prototype.load=function(){this.state!=Ri&&this.state!=Ii||(this.state=Fi,this.changed(),this.imageLoadFunction_(this,this.src_),this.unlisten_=va(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)}}(_a);function va(t,e,n){var i=t;if(i.src&&qi){var r=i.decode(),o=!0;return r.then((function(){o&&e()})).catch((function(t){o&&("EncodingError"===t.name&&"Invalid image type."===t.message?e():n())})),function(){o=!1}}var a=[z(i,k,e),z(i,T,n)];return function(){a.forEach(B)}}var ma=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),xa=null,wa=function(t){function e(e,n,i,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_=i,s.src_=n,s.tainted_,s}return ma(e,t),e.prototype.isTainted_=function(){if(void 0===this.tainted_&&this.imageState_===Oi){xa||(xa=Qi(1,1)),xa.drawImage(this.image_,0,0);try{xa.getImageData(0,0,1,1),this.tainted_=!1}catch(t){xa=null,this.tainted_=!0}}return!0===this.tainted_},e.prototype.dispatchChangeEvent_=function(){this.dispatchEvent(E)},e.prototype.handleImageError_=function(){this.imageState_=Ii,this.unlistenImage_(),this.dispatchChangeEvent_()},e.prototype.handleImageLoad_=function(){this.imageState_=Oi,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],n=Qi(t,e);n.fillRect(0,0,t,e),this.hitDetectionImage_=n.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_==Ri){this.imageState_=Fi;try{this.image_.src=this.src_}catch(t){this.handleImageError_()}this.unlisten_=va(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 n=e.getContext("2d");if(n.scale(t,t),n.drawImage(this.image_,0,0),this.isTainted_()){var i=this.color_;return n.globalCompositeOperation="multiply",n.fillStyle="rgb("+i[0]+","+i[1]+","+i[2]+")",n.fillRect(0,0,e.width,e.height),n.globalCompositeOperation="destination-in",void n.drawImage(this.image_,0,0)}for(var r=n.getImageData(0,0,e.width,e.height),o=r.data,a=this.color_[0]/255,s=this.color_[1]/255,l=this.color_[2]/255,u=0,h=o.length;u0,6);var p=void 0!==r.src?Ri:Oi;return n.color_=void 0!==r.color?zi(r.color):null,n.iconImage_=function(t,e,n,i,r,o){var a=da.get(e,i,o);return a||(a=new wa(t,e,n,i,r,o),da.set(e,i,o,a)),a}(u,c,h,n.crossOrigin_,p,n.color_),n.offset_=void 0!==r.offset?r.offset:[0,0],n.offsetOrigin_=void 0!==r.offsetOrigin?r.offsetOrigin:ca,n.origin_=null,n.size_=void 0!==r.size?r.size:null,n}return Sa(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_==sa||this.anchorYUnits_==sa){if(!e)return null;t=this.anchor_.slice(),this.anchorXUnits_==sa&&(t[0]*=e[0]),this.anchorYUnits_==sa&&(t[1]*=e[1])}if(this.anchorOrigin_!=ca){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),this.anchorOrigin_!=pa&&this.anchorOrigin_!=ha||(t[0]=-t[0]+e[0]),this.anchorOrigin_!=ua&&this.anchorOrigin_!=ha||(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_!=ca){var n=this.getSize(),i=this.iconImage_.getSize();if(!n||!i)return null;t=t.slice(),this.offsetOrigin_!=pa&&this.offsetOrigin_!=ha||(t[0]=i[0]-n[0]-t[0]),this.offsetOrigin_!=ua&&this.offsetOrigin_!=ha||(t[1]=i[1]-n[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}(ki);var ba={Point:function(t,e,n,i){var r=n.getImage();if(r){if(r.getImageState()!=Oi)return;var o=t.getBuilder(n.getZIndex(),No);o.setImageStyle(r,t.addDeclutter(!1)),o.drawPoint(e,i)}var a=n.getText();if(a){var s=t.getBuilder(n.getZIndex(),Uo);s.setTextStyle(a,t.addDeclutter(!!r)),s.drawText(e,i)}},LineString:function(t,e,n,i){var r=n.getStroke();if(r){var o=t.getBuilder(n.getZIndex(),zo);o.setFillStrokeStyle(null,r),o.drawLineString(e,i)}var a=n.getText();if(a){var s=t.getBuilder(n.getZIndex(),Uo);s.setTextStyle(a,t.addDeclutter(!1)),s.drawText(e,i)}},Polygon:function(t,e,n,i){var r=n.getFill(),o=n.getStroke();if(r||o){var a=t.getBuilder(n.getZIndex(),Bo);a.setFillStrokeStyle(r,o),a.drawPolygon(e,i)}var s=n.getText();if(s){var l=t.getBuilder(n.getZIndex(),Uo);l.setTextStyle(s,t.addDeclutter(!1)),l.drawText(e,i)}},MultiPoint:function(t,e,n,i){var r=n.getImage();if(r){if(r.getImageState()!=Oi)return;var o=t.getBuilder(n.getZIndex(),No);o.setImageStyle(r,t.addDeclutter(!1)),o.drawMultiPoint(e,i)}var a=n.getText();if(a){var s=t.getBuilder(n.getZIndex(),Uo);s.setTextStyle(a,t.addDeclutter(!!r)),s.drawText(e,i)}},MultiLineString:function(t,e,n,i){var r=n.getStroke();if(r){var o=t.getBuilder(n.getZIndex(),zo);o.setFillStrokeStyle(null,r),o.drawMultiLineString(e,i)}var a=n.getText();if(a){var s=t.getBuilder(n.getZIndex(),Uo);s.setTextStyle(a,t.addDeclutter(!1)),s.drawText(e,i)}},MultiPolygon:function(t,e,n,i){var r=n.getFill(),o=n.getStroke();if(o||r){var a=t.getBuilder(n.getZIndex(),Bo);a.setFillStrokeStyle(r,o),a.drawMultiPolygon(e,i)}var s=n.getText();if(s){var l=t.getBuilder(n.getZIndex(),Uo);l.setTextStyle(s,t.addDeclutter(!1)),l.drawText(e,i)}},GeometryCollection:function(t,e,n,i){var r,o,a=e.getGeometriesArray();for(r=0,o=a.length;r0&&(a.width=0),this.container;var l=Math.round(t.size[0]*n),u=Math.round(t.size[1]*n);a.width!=l||a.height!=u?(a.width=l,a.height=u,a.style.transform!==r&&(a.style.transform=r)):this.containerReused||o.clearRect(0,0,l,u),this.preRender(o,t);var c=t.extent,p=t.viewState,f=p.center,d=p.resolution,g=p.projection,_=p.rotation,y=g.getExtent(),v=this.getLayer().getSource(),m=!1;if(i.extent&&this.clipping){var x=Cn(i.extent);(m=!Yt(x,t.extent)&&me(x,t.extent))&&this.clipUnrotated(o,t,x)}var w=t.viewHints,S=!(w[ia]||w[ra]),C=this.getRenderTransform(f,d,_,n,l,u,0),b=this.getLayer().getDeclutter()?{}:null;if(s.execute(o,1,C,_,S,void 0,b),v.getWrapX()&&g.canWrapX()&&!Yt(y,c)){for(var E=c[0],T=ve(y),P=0,R=void 0;Ey[2];){R=T*++P;var O=this.getRenderTransform(f,d,_,n,l,u,R);s.execute(o,1,O,_,S,void 0,b),E-=T}}if(b){var I=t.viewHints;!function(t,e,n,i,r,o){for(var a=Object.keys(t).map(Number).sort(h),s=0,l=a.length;s0&&(c=d,o.push({items:d.declutterItems,opacity:i}))}}(b,o,_,1,!(I[ia]||I[ra]),t.declutterItems)}m&&o.restore(),this.postRender(o,t);var A=i.opacity,M=this.container;return A!==parseFloat(M.style.opacity)&&(M.style.opacity=1===A?"":String(A)),this.renderedRotation_!==p.rotation&&(this.renderedRotation_=p.rotation,this.hitDetectionImageData_=null),this.container},e.prototype.getFeatures=function(t){return new Promise(function(e,n){if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){var i=[this.context.canvas.width,this.context.canvas.height];Rt(this.pixelTransform,i);var r=this.renderedCenter_,o=this.renderedResolution_,a=this.renderedRotation_,s=this.renderedProjection_,l=this.renderedExtent_,u=this.getLayer(),c=[],p=i[0]/2,f=i[1]/2;c.push(this.getRenderTransform(r,o,a,.5,p,f,0).slice());var d=u.getSource(),g=s.getExtent();if(d.getWrapX()&&s.canWrapX()&&!Yt(g,l)){for(var _=l[0],y=ve(g),v=0,m=void 0;_g[2];)m=y*++v,c.push(this.getRenderTransform(r,o,a,.5,p,f,m).slice()),_-=y}this.hitDetectionImageData_=function(t,e,n,i,r,o,a){var s=Qi(t[0]/2,t[1]/2);s.imageSmoothingEnabled=!1;for(var l=s.canvas,u=new aa(s,.5,r,null,a),c=n.length,p=Math.floor(16777215/c),f={},d=1;d<=c;++d){var g=n[d-1],_=g.getStyleFunction()||i;if(i){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=n[2])){var r=ve(n),o=Math.floor((i[0]-n[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&&Yt(this.renderedExtent_,_))return this.replayGroupChanged=!1,!0;this.replayGroup_=null,this.dirty_=!1;for(var S=new Oo(Ta(h,c),_,h,c,e.getDeclutter()),C=0,b=y.length;C=200&&s.status<300){var o=e.getType(),l=void 0;o==Ua||o==Xa?l=s.responseText:o==Wa?(l=s.responseXML)||(l=(new DOMParser).parseFromString(s.responseText,"application/xml")):o==Ba&&(l=s.response),l?n.call(this,e.readFeatures(l,{extent:r,featureProjection:a}),e.readProjection(l)):i.call(this)}else i.call(this)}.bind(this),s.onerror=function(){i.call(this)}.bind(this),s.send()}}(t,e,(function(t,e){"function"==typeof this.addFeatures&&this.addFeatures(t)}),v)}var Ka=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Ya=function(t){function e(e,n){var i=t.call(this,e)||this;return i.feature=n,i}return Ka(e,t),e}(s),Za=function(t){function e(e){var n=this,i=e||{};(n=t.call(this,{attributions:i.attributions,projection:void 0,state:Vr,wrapX:void 0===i.wrapX||i.wrapX})||this).loader_=v,n.format_=i.format,n.overlaps_=void 0===i.overlaps||i.overlaps,n.url_=i.url,void 0!==i.loader?n.loader_=i.loader:void 0!==n.url_&&(nt(n.format_,7),n.loader_=Va(n.url_,n.format_)),n.strategy_=void 0!==i.strategy?i.strategy:za;var r,o,a=void 0===i.useSpatialIndex||i.useSpatialIndex;return n.featuresRtree_=a?new Aa:null,n.loadedExtentsRtree_=new Aa,n.nullGeometryFeatures_={},n.idIndex_={},n.uidIndex_={},n.featureChangeKeys_={},n.featuresCollection_=null,Array.isArray(i.features)?o=i.features:i.features&&(o=(r=i.features).getArray()),a||void 0!==r||(r=new et(o)),void 0!==o&&n.addFeaturesInternal(o),void 0!==r&&n.bindFeaturesCollection_(r),n}return Ka(e,t),e.prototype.addFeature=function(t){this.addFeatureInternal(t),this.changed()},e.prototype.addFeatureInternal=function(t){var e=i(t);if(this.addToIndex_(e,t)){this.setupChangeEvents_(e,t);var n=t.getGeometry();if(n){var r=n.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(r,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new Ya(Da,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 n=!0,i=e.getId();return void 0!==i&&(i.toString()in this.idIndex_?n=!1:this.idIndex_[i.toString()]=e),n&&(nt(!(t in this.uidIndex_),30),this.uidIndex_[t]=e),n},e.prototype.addFeatures=function(t){this.addFeaturesInternal(t),this.changed()},e.prototype.addFeaturesInternal=function(t){for(var e=[],n=[],r=[],o=0,a=t.length;ot)throw new Error("Tile load sequence violation");this.state=t,this.changed()},n.prototype.load=function(){e()},n.prototype.getAlpha=function(t,e){if(!this.transition_)return 1;var n=this.transitionStarts_[t];if(n){if(-1===n)return 1}else n=e,this.transitionStarts_[t]=n;var i=e-n+1e3/60;return i>=this.transition_?1:ts(i/this.transition_)},n.prototype.inTransition=function(t){return!!this.transition_&&-1!==this.transitionStarts_[t]},n.prototype.endTransition=function(t){this.transition_&&(this.transitionStarts_[t]=-1)},n}(b),as=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),ss=function(t){function e(e,n,i,r,o,a){var s=t.call(this,e,n,a)||this;return s.crossOrigin_=r,s.src_=i,s.image_=new Image,null!==r&&(s.image_.crossOrigin=r),s.unlisten_=null,s.tileLoadFunction_=o,s}return as(e,t),e.prototype.getImage=function(){return this.image_},e.prototype.getKey=function(){return this.src_},e.prototype.handleImageError_=function(){var t;this.state=Qa,this.unlistenImage_(),this.image_=((t=Qi(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=Ja:this.state=$a,this.unlistenImage_(),this.changed()},e.prototype.load=function(){this.state==Qa&&(this.state=Ha,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==Ha&&(this.state=qa,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=va(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},e.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},e}(os);var ls=function(){function t(t,e,n){this.decay_=t,this.minVelocity_=e,this.delay_=n,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_[n+2]>t;)n-=3;var i=this.points_[e+2]-this.points_[n+2];if(i<1e3/60)return!1;var r=this.points_[e]-this.points_[n],o=this.points_[e+1]-this.points_[n+1];return this.angle_=Math.atan2(o,r),this.initialVelocity_=Math.sqrt(r*r+o*o)/i,this.initialVelocity_>this.minVelocity_},t.prototype.getDistance=function(){return(this.minVelocity_-this.initialVelocity_)/this.decay_},t.prototype.getAngle=function(){return this.angle_},t}(),us=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),hs=function(t){function n(e){var n=t.call(this)||this;return n.map_=e,n.declutterTree_=null,n}return us(n,t),n.prototype.dispatchRenderEvent=function(t,n){e()},n.prototype.calculateMatrices2D=function(t){var e=t.viewState,n=t.coordinateToPixelTransform,i=t.pixelToCoordinateTransform;Ft(n,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),Ot(i,n)},n.prototype.forEachFeatureAtCoordinate=function(t,e,n,i,r,o,a,s){var l,u=e.viewState;function h(t,e,n){return r.call(o,e,t?n:null)}var c=u.projection,p=on(t.slice(),c),f=[[0,0]];if(c.canWrapX()&&i){var d=ve(c.getExtent());f.push([-d,0],[d,0])}var g,_=e.layerStatesArray,y=_.length;this.declutterTree_&&(g=this.declutterTree_.all().map((function(t){return t.value})));for(var v=[],m=0;m=0;--x){var w=_[x],S=w.layer;if(S.hasRenderer()&&Hr(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,n,T,g)}if(l)return l}}},n.prototype.forEachLayerAtPixel=function(t,n,i,r,o){return e()},n.prototype.hasFeatureAtCoordinate=function(t,e,n,i,r,o){return void 0!==this.forEachFeatureAtCoordinate(t,e,n,i,_,this,r,o)},n.prototype.getMap=function(){return this.map_},n.prototype.renderFrame=function(t){this.declutterTree_=function(t,e){e&&e.clear();for(var n=t.declutterItems,i=n.length-1;i>=0;--i)for(var r=n[i],o=r.items,a=0,s=o.length;a=0;--s){var l=a[s],u=l.layer;if(u.hasRenderer()&&Hr(l,o)&&r(u)){var h=u.getRenderer().getDataAtPixel(t,e,n);if(h){var c=i(u,h);if(c)return c}}}},e}(hs),ds=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),gs="layers",_s=function(t){function e(e){var n=this,i=e||{},r=m({},i);delete r.layers;var o=i.layers;return(n=t.call(this,r)||this).layersListenerKeys_=[],n.listenerKeys_={},n.addEventListener(H(gs),n.handleLayersChanged_),o?Array.isArray(o)?o=new et(o.slice(),{unique:!0}):nt("function"==typeof o.getArray,43):o=new et(void 0,{unique:!0}),n.setLayers(o),n}return ds(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 n=t.getArray(),r=0,o=n.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(G,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),Ts="postrender",Ps="movestart",Rs="moveend",Fs="layergroup",Os="size",Is="target",As="view",Ms=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_,n=t[0];1==t.length?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));var i=this.keyFunction_(n);return delete this.queuedElements_[i],n},t.prototype.enqueue=function(t){nt(!(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_,n=this.priorities_,i=e.length,r=e[t],o=n[t],a=t;t>1;){var s=this.getLeftChildIndex_(t),l=this.getRightChildIndex_(t),u=lt;){var a=this.getParentIndex_(e);if(!(i[a]>o))break;n[e]=n[a],i[e]=i[a],e=a}n[e]=r,i[e]=o},t.prototype.reprioritize=function(){var t,e,n,i=this.priorityFunction_,r=this.elements_,o=this.priorities_,a=0,s=r.length;for(e=0;e0;)i=(n=this.dequeue()[0]).getKey(),n.getState()!==Ha||i in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[i]=!0,++this.tilesLoading_,++r,n.load())},e}(Ms);var Ds="center",Gs="resolution",js="rotation";function Ns(t,e,n){return function(i,r,o,a){if(i){var s=e?0:o[0]*r,l=e?0:o[1]*r,u=t[0]+s/2,h=t[2]-s/2,c=t[1]+l/2,p=t[3]-l/2;u>h&&(h=u=(h+u)/2),c>p&&(p=c=(p+c)/2);var f=Ce(i[0],u,h),d=Ce(i[1],c,p),g=30*r;return a&&n&&(f+=-g*Math.log(1+Math.max(0,u-i[0])/g)+g*Math.log(1+Math.max(0,i[0]-h)/g),d+=-g*Math.log(1+Math.max(0,c-i[1])/g)+g*Math.log(1+Math.max(0,i[1]-p)/g)),[f,d]}}}function zs(t){return t}function Bs(t,e,n,i){var r=ve(e)/n[0],o=de(e)/n[1];return i?Math.min(t,Math.max(r,o)):Math.min(t,Math.min(r,o))}function Us(t,e,n){var i=Math.min(t,e);return i*=Math.log(1+50*Math.max(0,t/e-1))/50+1,n&&(i=Math.max(i,n),i/=Math.log(1+50*Math.max(0,n/t-1))/50+1),Ce(i,n/2,2*e)}function Xs(t,e,n,i,r){return function(o,a,s,l){if(void 0!==o){var u=i?Bs(t,i,s,r):t;return(void 0===n||n)&&l?Us(o,u,e):Ce(o,e,u)}}}function Ws(t){return void 0!==t?0:void 0}function Vs(t){return void 0!==t?t:void 0}var Ks=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Ys=function(t){function e(e){var n=t.call(this)||this,i=m({},e);return n.hints_=[0,0],n.animations_=[],n.updateAnimationKey_,n.projection_=pn(i.projection,"EPSG:3857"),n.viewportSize_=[100,100],n.targetCenter_=null,n.targetResolution_,n.targetRotation_,n.cancelAnchor_=void 0,i.center&&(i.center=wn(i.center,n.projection_)),i.extent&&(i.extent=Cn(i.extent,n.projection_)),n.applyOptions_(i),n}return Ks(e,t),e.prototype.applyOptions_=function(t){var e=function(t){var e,n,i,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=pn(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;n=g[r],i=void 0!==g[o]?g[o]:g[g.length-1],e=t.constrainResolution?function(t,e,n,i){return function(r,o,a,s){if(void 0!==r){var l=t[0],u=t[t.length-1],h=n?Bs(l,n,a,i):l;if(s)return void 0===e||e?Us(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[n-1]&&(e=arguments[n-1],--n),!this.isDef()){var i=arguments[n-1];return i.center&&this.setCenterInternal(i.center),void 0!==i.zoom&&this.setZoom(i.zoom),void 0!==i.rotation&&this.setRotation(i.rotation),void(e&&Zs(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_[ra]>0},e.prototype.cancelAnimations=function(){var t;this.setHint(ia,-this.hints_[ia]);for(var e=0,n=this.animations_.length;e=0;--n){for(var i=this.animations_[n],r=!0,o=0,a=i.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?Oe(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_[n]=null,this.setHint(ia,-1);var x=i[0].callback;x&&Zs(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 n,i,r,o=this.getCenterInternal();return void 0!==o&&(tn(n=[o[0]-e[0],o[1]-e[1]],t-this.getRotation()),r=e,(i=n)[0]+=+r[0],i[1]+=+r[1]),n},e.prototype.calculateCenterZoom=function(t,e){var n,i=this.getCenterInternal(),r=this.getResolution();void 0!==i&&void 0!==r&&(n=[e[0]-t*(e[0]-i[0])/r,e[1]-t*(e[1]-i[1])/r]);return n},e.prototype.getViewportSize_=function(t){var e=this.viewportSize_;if(t){var n=e[0],i=e[1];return[Math.abs(n*Math.cos(t))+Math.abs(i*Math.sin(t)),Math.abs(n*Math.sin(t))+Math.abs(i*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?xn(t,this.getProjection()):t},e.prototype.getCenterInternal=function(){return this.get(Ds)},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 Sn(this.calculateExtentInternal(t),this.getProjection())},e.prototype.calculateExtentInternal=function(t){var e=t||this.getViewportSize_(),n=this.getCenterInternal();nt(n,1);var i=this.getResolution();nt(void 0!==i,2);var r=this.getRotation();return nt(void 0!==r,3),fe(n,i,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(Gs)},e.prototype.getResolutions=function(){return this.resolutions_},e.prototype.getResolutionForExtent=function(t,e){return this.getResolutionForExtentInternal(Cn(t,this.getProjection()),e)},e.prototype.getResolutionForExtentInternal=function(t,e){var n=e||this.getViewportSize_(),i=ve(t)/n[0],r=de(t)/n[1];return Math.max(i,r)},e.prototype.getResolutionForValueFunction=function(t){var e=t||2,n=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,r=Math.log(n/i)/Math.log(e);return function(t){return n/Math.pow(e,t*r)}},e.prototype.getRotation=function(){return this.get(js)},e.prototype.getValueForResolutionFunction=function(t){var e=Math.log(t||2),n=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,r=Math.log(n/i)/e;return function(t){return Math.log(n/t)/e/r}},e.prototype.getState=function(){var t=this.getCenterInternal(),e=this.getProjection(),n=this.getResolution(),i=this.getRotation();return{center:t.slice(0),projection:void 0!==e?e:null,resolution:n,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,n,i=this.minZoom_||0;if(this.resolutions_){var r=p(this.resolutions_,t,1);i=r,e=this.resolutions_[r],n=r==this.resolutions_.length-1?2:e/this.resolutions_[r+1]}else e=this.maxResolution_,n=this.zoomFactor_;return i+Math.log(e/t)/Math.log(n)},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),n=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(n,Ce(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)},e.prototype.fit=function(t,e){var n,i=m({size:this.getViewportSize_()},e||{});if(nt(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,24),Array.isArray(t))nt(!xe(t),25),n=di(r=Cn(t,this.getProjection()));else if(t.getType()===yt){var r;(n=di(r=Cn(t.getExtent(),this.getProjection()))).rotate(this.getRotation(),ce(r))}else{n=t}this.fitInternal(n,i)},e.prototype.fitInternal=function(t,e){var n=e||{},i=n.size;i||(i=this.getViewportSize_());var r,o=void 0!==n.padding?n.padding:[0,0,0,0],a=void 0!==n.nearest&&n.nearest;r=void 0!==n.minResolution?n.minResolution:void 0!==n.maxZoom?this.getResolutionForZoom(n.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;a--){var s=o[a];if(s.getActive())if(!s.handleEvent(t))break}}},e.prototype.handlePostRender=function(){var t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){var n=this.maxTilesLoading_,i=n;if(t){var r=t.viewHints;if(r[ia]||r[ra]){var o=!qi&&Date.now()-t.time>8;n=o?0:8,i=o?0:2}}e.getTilesLoading()0&&t[1]>0}(e)&&n&&n.isDef()){var o=n.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=n.getState();r={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutterItems:i?i.declutterItems:[],extent:fe(a.center,a.resolution,a.rotation,e),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:e,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{}}}if(this.frameState_=r,this.renderer_.renderFrame(r),r){if(r.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,r.postRenderFunctions),i)(!this.previousExtent_||!xe(this.previousExtent_)&&!ne(r.extent,this.previousExtent_))&&(this.dispatchEvent(new vs(Ps,this,i)),this.previousExtent_=Qt(this.previousExtent_));this.previousExtent_&&!r.viewHints[ia]&&!r.viewHints[ra]&&!ne(r.extent,this.previousExtent_)&&(this.dispatchEvent(new vs(Rs,this,r)),Wt(r.extent,this.previousExtent_))}this.dispatchEvent(new vs(Ts,this,r)),this.postRenderTimeoutHandle_=setTimeout(this.handlePostRender.bind(this),0)},e.prototype.setLayerGroup=function(t){this.set(Fs,t)},e.prototype.setSize=function(t){this.set(Os,t)},e.prototype.setTarget=function(t){this.set(Is,t)},e.prototype.setView=function(t){this.set(As,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,n=getComputedStyle(this.viewport_);n.width&&n.height&&(e=[parseInt(n.width,10),parseInt(n.height,10)]),t.setViewportSize(e)}},e}(Y);var Qs=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),$s=function(t){function e(e){var n=t.call(this)||this,i=e.element;return!i||e.target||i.style.pointerEvents||(i.style.pointerEvents="auto"),n.element=i||null,n.target_=null,n.map_=null,n.listenerKeys=[],e.render&&(n.render=e.render),e.target&&n.setTarget(e.target),n}return Qs(e,t),e.prototype.disposeInternal=function(){tr(this.element),t.prototype.disposeInternal.call(this)},e.prototype.getMap=function(){return this.map_},e.prototype.setMap=function(t){this.map_&&tr(this.element);for(var e=0,n=this.listenerKeys.length;e0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!g(e,this.renderedAttributions_)){!function(t){for(;t.lastChild;)t.removeChild(t.lastChild)}(this.ulElement_);for(var i=0,r=e.length;i0&&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 n=e.viewState.rotation;if(n!=this.rotation_){var i="rotate("+n+"rad)";if(this.autoHide_){var r=this.element.classList.contains("ol-hidden");r||0!==n?r&&0!==n&&this.element.classList.remove("ol-hidden"):this.element.classList.add("ol-hidden")}this.label_.style.transform=i}this.rotation_=n}},e}($s),rl=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),ol=function(t){function e(e){var n=this,i=e||{};n=t.call(this,{element:document.createElement("div"),target:i.target})||this;var r=void 0!==i.className?i.className:"ol-zoom",o=void 0!==i.delta?i.delta:1,a=void 0!==i.zoomInLabel?i.zoomInLabel:"+",s=void 0!==i.zoomOutLabel?i.zoomOutLabel:"−",l=void 0!==i.zoomInTipLabel?i.zoomInTipLabel:"Zoom in",u=void 0!==i.zoomOutTipLabel?i.zoomOutTipLabel:"Zoom out",h=document.createElement("button");h.className=r+"-in",h.setAttribute("type","button"),h.title=l,h.appendChild("string"==typeof a?document.createTextNode(a):a),h.addEventListener(R,n.handleClick_.bind(n,o),!1);var c=document.createElement("button");c.className=r+"-out",c.setAttribute("type","button"),c.title=u,c.appendChild("string"==typeof s?document.createTextNode(s):s),c.addEventListener(R,n.handleClick_.bind(n,-o),!1);var p=r+" ol-unselectable ol-control",f=n.element;return f.className=p,f.appendChild(h),f.appendChild(c),n.duration_=void 0!==i.duration?i.duration:250,n}return rl(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 n=e.getZoom();if(void 0!==n){var i=e.getConstrainedZoom(n+t);this.duration_>0?(e.getAnimating()&&e.cancelAnimations(),e.animate({zoom:i,duration:this.duration_,easing:es})):e.setZoom(i)}}},e}($s),al=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),sl="degrees",ll="imperial",ul="nautical",hl="metric",cl="us",pl=[1,2,5],fl=function(t){function e(e){var n=this,i=e||{},r=void 0!==i.className?i.className:i.bar?"ol-scale-bar":"ol-scale-line";return(n=t.call(this,{element:document.createElement("div"),render:i.render,target:i.target})||this).innerElement_=document.createElement("div"),n.innerElement_.className=r+"-inner",n.element.className=r+" ol-unselectable",n.element.appendChild(n.innerElement_),n.viewState_=null,n.minWidth_=void 0!==i.minWidth?i.minWidth:64,n.renderedVisible_=!1,n.renderedWidth_=void 0,n.renderedHTML_="",n.addEventListener(H("units"),n.handleUnitsChanged_),n.setUnits(i.units||hl),n.scaleBar_=i.bar||!1,n.scaleBarSteps_=i.steps||4,n.scaleBarText_=i.text||!1,n.dpi_=i.dpi||void 0,n}return al(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,n=t.projection,i=this.getUnits(),r=i==sl?vt:xt,o=hn(n,t.resolution,e,r),a=this.minWidth_*(this.dpi_||25.4/.28)/(25.4/.28),s=a*o,l="";if(i==sl){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,n){for(var i="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,n):"")+""),s===this.scaleBarSteps_-1&&r.push(this.createStepText(s+1,t,!0,e,n)),a="#ffffff"===a?"#000000":"#ffffff";return'
'+(this.scaleBarText_?'
'+i+"
":"")+r.join("")+"
"},e.prototype.createMarker=function(t,e){return'
'},e.prototype.createStepText=function(t,e,n,i,r){var o=(0===t?0:Math.round(i/this.scaleBarSteps_*t*100)/100)+(0===t?"":" "+r);return'
'+o+"
"},e.prototype.getScaleForResolution=function(){var t=hn(this.viewState_.projection,this.viewState_.resolution,this.viewState_.center),e=this.dpi_||25.4/.28,n=this.viewState_.projection.getMetersPerUnit();return parseFloat(t.toString())*n*39.37*e},e.prototype.render=function(t){var e=t.frameState;this.viewState_=e?e.viewState:null,this.updateElement_()},e}($s);var dl="active",gl=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),_l=function(t){function e(e){var n=t.call(this)||this;return e&&e.handleEvent&&(n.handleEvent=e.handleEvent),n.map_=null,n.setActive(!0),n}return gl(e,t),e.prototype.getActive=function(){return this.get(dl)},e.prototype.getMap=function(){return this.map_},e.prototype.handleEvent=function(t){return!0},e.prototype.setActive=function(t){this.set(dl,t)},e.prototype.setMap=function(t){this.map_=t},e}(Y);function yl(t,e,n,i){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:n,duration:void 0!==i?i:250,easing:es})}}var vl=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),ml=function(t){function e(e){var n=t.call(this)||this,i=e||{};return n.delta_=i.delta?i.delta:1,n.duration_=void 0!==i.duration?i.duration:250,n}return vl(e,t),e.prototype.handleEvent=function(t){var e=!1;if(t.type==ws.DBLCLICK){var n=t.originalEvent,i=t.map,r=t.coordinate,o=n.shiftKey?-this.delta_:this.delta_;yl(i.getView(),o,r,this.duration_),t.preventDefault(),e=!0}return!e},e}(_l),xl=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),wl=function(t){function e(e){var n=this,i=e||{};return n=t.call(this,i)||this,i.handleDownEvent&&(n.handleDownEvent=i.handleDownEvent),i.handleDragEvent&&(n.handleDragEvent=i.handleDragEvent),i.handleMoveEvent&&(n.handleMoveEvent=i.handleMoveEvent),i.handleUpEvent&&(n.handleUpEvent=i.handleUpEvent),i.stopDown&&(n.stopDown=i.stopDown),n.handlingDownUpSequence=!1,n.trackedPointers_={},n.targetPointers=[],n}return xl(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==ws.POINTERDRAG)this.handleDragEvent(t),t.preventDefault();else if(t.type==ws.POINTERUP){var n=this.handleUpEvent(t);this.handlingDownUpSequence=n&&this.targetPointers.length>0}}else if(t.type==ws.POINTERDOWN){var i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==ws.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===ws.POINTERDOWN||e===ws.POINTERDRAG||e===ws.POINTERUP}(t)){var e=t.originalEvent,n=e.pointerId.toString();t.type==ws.POINTERUP?delete this.trackedPointers_[n]:(t.type==ws.POINTERDOWN||n in this.trackedPointers_)&&(this.trackedPointers_[n]=e),this.targetPointers=w(this.trackedPointers_)}},e}(_l);function Sl(t){for(var e=t.length,n=0,i=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}(wl),Gl=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),jl=function(t){function e(e){var n=this,i=e||{};return(n=t.call(this,{stopDown:y})||this).condition_=i.condition?i.condition:bl,n.lastAngle_=void 0,n.duration_=void 0!==i.duration?i.duration:250,n}return Gl(e,t),e.prototype.handleDragEvent=function(t){if(Ml(t)){var e=t.map,n=e.getView();if(n.getConstraints().rotation!==Ws){var i=e.getSize(),r=t.pixel,o=Math.atan2(i[1]/2-r[1],r[0]-i[0]/2);if(void 0!==this.lastAngle_){var a=o-this.lastAngle_;n.adjustRotationInternal(-a)}this.lastAngle_=o}}},e.prototype.handleUpEvent=function(t){return!Ml(t)||(t.map.getView().endInteraction(this.duration_),!1)},e.prototype.handleDownEvent=function(t){return!!Ml(t)&&(!(!Pl(t)||!this.condition_(t))&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0))},e}(wl),Nl=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),zl=function(t){function e(e){var n=t.call(this)||this;return n.geometry_=null,n.element_=document.createElement("div"),n.element_.style.position="absolute",n.element_.style.pointerEvents="auto",n.element_.className="ol-box "+e,n.map_=null,n.startPixel_=null,n.endPixel_=null,n}return Nl(e,t),e.prototype.disposeInternal=function(){this.setMap(null)},e.prototype.render_=function(){var t=this.startPixel_,e=this.endPixel_,n=this.element_.style;n.left=Math.min(t[0],e[0])+"px",n.top=Math.min(t[1],e[1])+"px",n.width=Math.abs(e[0]-t[0])+"px",n.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_,n=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);n[4]=n[0].slice(),this.geometry_?this.geometry_.setCoordinates([n]):this.geometry_=new fi([n])},e.prototype.getGeometry=function(){return this.geometry_},e}(u),Bl=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Ul="boxstart",Xl="boxdrag",Wl="boxend",Vl=function(t){function e(e,n,i){var r=t.call(this,e)||this;return r.coordinate=n,r.mapBrowserEvent=i,r}return Bl(e,t),e}(s),Kl=function(t){function e(e){var n=t.call(this)||this,i=e||{};return n.box_=new zl(i.className||"ol-dragbox"),n.minArea_=void 0!==i.minArea?i.minArea:64,i.onBoxEnd&&(n.onBoxEnd=i.onBoxEnd),n.startPixel_=null,n.condition_=i.condition?i.condition:Pl,n.boxEndCondition_=i.boxEndCondition?i.boxEndCondition:n.defaultBoxEndCondition,n}return Bl(e,t),e.prototype.defaultBoxEndCondition=function(t,e,n){var i=n[0]-e[0],r=n[1]-e[1];return i*i+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 Vl(Xl,t.coordinate,t))},e.prototype.handleUpEvent=function(t){return this.box_.setMap(null),this.boxEndCondition_(t,this.startPixel_,t.pixel)&&(this.onBoxEnd(t),this.dispatchEvent(new Vl(Wl,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 Vl(Ul,t.coordinate,t)),!0)},e.prototype.onBoxEnd=function(t){},e}(wl),Yl=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Zl=function(t){function e(e){var n=this,i=e||{},r=i.condition?i.condition:Il;return(n=t.call(this,{condition:r,className:i.className||"ol-dragzoom",minArea:i.minArea})||this).duration_=void 0!==i.duration?i.duration:200,n.out_=void 0!==i.out&&i.out,n}return Yl(e,t),e.prototype.onBoxEnd=function(t){var e=this.getMap(),n=e.getView(),i=e.getSize(),r=this.getGeometry().getExtent();if(this.out_){var o=n.calculateExtentInternal(i),a=te([e.getPixelFromCoordinateInternal(ue(r)),e.getPixelFromCoordinateInternal(ye(r))]);!function(t,e){var n=(t[2]-t[0])/2*(e-1),i=(t[3]-t[1])/2*(e-1);t[0]-=n,t[2]+=n,t[1]-=i,t[3]+=i}(o,1/n.getResolutionForExtentInternal(a,i)),r=o}var s=n.getConstrainedResolution(n.getResolutionForExtentInternal(r,i)),l=n.getConstrainedCenter(ce(r),s);n.animateInternal({resolution:s,center:l,duration:this.duration_,easing:es})},e}(Kl),Hl=37,ql=38,Jl=39,Ql=40,$l=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),tu=function(t){function e(e){var n=t.call(this)||this,i=e||{};return n.defaultCondition_=function(t){return Ol(t)&&Al(t)},n.condition_=void 0!==i.condition?i.condition:n.defaultCondition_,n.duration_=void 0!==i.duration?i.duration:100,n.pixelDelta_=void 0!==i.pixelDelta?i.pixelDelta:128,n}return $l(e,t),e.prototype.handleEvent=function(t){var e=!1;if(t.type==M){var n=t.originalEvent.keyCode;if(this.condition_(t)&&(n==Ql||n==Hl||n==Jl||n==ql)){var i=t.map.getView(),r=i.getResolution()*this.pixelDelta_,o=0,a=0;n==Ql?a=-r:n==Hl?o=-r:n==Jl?o=r:a=r;var s=[o,a];tn(s,i.getRotation()),function(t,e,n){var i=t.getCenterInternal();if(i){var r=[i[0]+e[0],i[1]+e[1]];t.animateInternal({duration:void 0!==n?n:250,easing:is,center:t.getConstrainedCenter(r)})}}(i,s,this.duration_),t.preventDefault(),e=!0}}return!e},e}(_l),eu=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),nu=function(t){function e(e){var n=t.call(this)||this,i=e||{};return n.condition_=i.condition?i.condition:Al,n.delta_=i.delta?i.delta:1,n.duration_=void 0!==i.duration?i.duration:100,n}return eu(e,t),e.prototype.handleEvent=function(t){var e=!1;if(t.type==M||t.type==L){var n=t.originalEvent.charCode;if(this.condition_(t)&&(n=="+".charCodeAt(0)||n=="-".charCodeAt(0))){var i=t.map,r=n=="+".charCodeAt(0)?this.delta_:-this.delta_;yl(i.getView(),r,void 0,this.duration_),t.preventDefault(),e=!0}}return!e},e}(_l),iu=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),ru="trackpad",ou="wheel",au=function(t){function e(e){var n=this,i=e||{};(n=t.call(this,i)||this).totalDelta_=0,n.lastDelta_=0,n.maxDelta_=void 0!==i.maxDelta?i.maxDelta:1,n.duration_=void 0!==i.duration?i.duration:250,n.timeout_=void 0!==i.timeout?i.timeout:80,n.useAnchor_=void 0===i.useAnchor||i.useAnchor,n.constrainResolution_=void 0!==i.constrainResolution&&i.constrainResolution;var r=i.condition?i.condition:Tl;return n.condition_=i.onFocusOnly?Cl(El,r):r,n.lastAnchor_=null,n.startTime_=void 0,n.timeoutId_,n.mode_=void 0,n.trackpadEventGap_=400,n.trackpadTimeoutId_,n.deltaPerZoom_=300,n}return iu(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!==j)return!0;t.preventDefault();var e,n=t.map,i=t.originalEvent;if(this.useAnchor_&&(this.lastAnchor_=t.coordinate),t.type==j&&(e=i.deltaY,Vi&&i.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(e/=Zi),i.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?ru:ou);var o=n.getView();if(this.mode_===ru&&!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,n),a),!1},e.prototype.handleWheelZoom_=function(t){var e=t.getView();e.getAnimating()&&e.cancelAnimations();var n=-Ce(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),yl(e,n,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}(_l),su=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),lu=function(t){function e(e){var n=this,i=e||{},r=i;return r.stopDown||(r.stopDown=y),(n=t.call(this,r)||this).anchor_=null,n.lastAngle_=void 0,n.rotating_=!1,n.rotationDelta_=0,n.threshold_=void 0!==i.threshold?i.threshold:.3,n.duration_=void 0!==i.duration?i.duration:250,n}return su(e,t),e.prototype.handleDragEvent=function(t){var e=0,n=this.targetPointers[0],i=this.targetPointers[1],r=Math.atan2(i.clientY-n.clientY,i.clientX-n.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!==Ws){var l=a.getViewport().getBoundingClientRect(),u=Sl(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}(wl),uu=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),hu=function(t){function e(e){var n=this,i=e||{},r=i;return r.stopDown||(r.stopDown=y),(n=t.call(this,r)||this).anchor_=null,n.duration_=void 0!==i.duration?i.duration:400,n.lastDistance_=void 0,n.lastScaleDelta_=1,n}return uu(e,t),e.prototype.handleDragEvent=function(t){var e=1,n=this.targetPointers[0],i=this.targetPointers[1],r=n.clientX-i.clientX,o=n.clientY-i.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=Sl(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(),n=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,n),!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}(wl),cu=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),pu="addfeatures",fu=function(t){function e(e,n,i,r){var o=t.call(this,e)||this;return o.features=i,o.file=n,o.projection=r,o}return cu(e,t),e}(s),du=function(t){function e(e){var n=this,i=e||{};return(n=t.call(this,{handleEvent:_})||this).formatConstructors_=i.formatConstructors?i.formatConstructors:[],n.projection_=i.projection?un(i.projection):null,n.dropListenKeys_=null,n.source_=i.source||null,n.target=i.target?i.target:null,n}return cu(e,t),e.prototype.handleResult_=function(t,e){var n=e.target.result,i=this.getMap(),r=this.projection_;r||(r=i.getView().getProjection());for(var o=this.formatConstructors_,a=0,s=o.length;a0){this.source_&&(this.source_.clear(),this.source_.addFeatures(u)),this.dispatchEvent(new fu(pu,t,u,r));break}}},e.prototype.registerListeners_=function(){var t=this.getMap();if(t){var e=this.target?this.target:t.getViewport();this.dropListenKeys_=[N(e,A,this.handleDrop,this),N(e,O,this.handleStop,this),N(e,I,this.handleStop,this),N(e,A,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,n){try{return t.readFeatures(e,n)}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,n=0,i=e.length;n1?1:-1;return e.endInteraction(this.duration_,n),this.lastScaleDelta_=0,!1},e.prototype.handleDownEvent=function(t){return!!Ml(t)&&(!!this.condition_(t)&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,this.lastMagnitude_=void 0,!0))},e}(wl),yu=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),vu=function(t){function e(e,n,i){var r=t.call(this)||this;if(void 0!==i&&void 0===n)r.setFlatCoordinates(i,e);else{var o=n||0;r.setCenterAndRadius(e,o,i)}return r}return yu(e,t),e.prototype.clone=function(){return new e(this.flatCoordinates.slice(),void 0,this.layout)},e.prototype.closestPointXY=function(t,e,n,i){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,n=this.flatCoordinates[e]-this.flatCoordinates[0],i=t.slice();i[e]=i[0]+n;for(var r=1;r=this.dragVertexDelay_?(this.downPx_=e.pixel,this.shouldHandle_=!this.freehand_,n=!0):this.lastDragTime_=void 0,this.shouldHandle_&&void 0!==this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0));return this.freehand_&&e.type===ws.POINTERDRAG&&null!==this.sketchFeature_?(this.addToDrawing_(e.coordinate),i=!1):this.freehand_&&e.type===ws.POINTERDOWN?i=!1:n?(i=e.type===ws.POINTERMOVE)&&this.freehand_?(this.handlePointerMove_(e),this.shouldHandle_&&e.preventDefault()):("mouse"==e.originalEvent.pointerType||e.type===ws.POINTERDRAG&&void 0===this.downTimeout_)&&this.handlePointerMove_(e):e.type===ws.DBLCLICK&&(i=!1),t.prototype.handleEvent.call(this,e)&&i},e.prototype.handleDownEvent=function(t){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=t.pixel,this.finishCoordinate_||this.startDrawing_(t),!0):this.condition_(t)?(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout(function(){this.handlePointerMove_(new xs(ws.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;this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0),this.handlePointerMove_(t);var n=this.mode_===Fu;return this.shouldHandle_?(this.finishCoordinate_?this.freehand_||n?this.finishDrawing():this.atFinish_(t)?this.finishCondition_(t)&&this.finishDrawing():this.addToDrawing_(t.coordinate):(this.startDrawing_(t),this.mode_===Tu&&this.finishDrawing()),e=!1):this.freehand_&&this.abortDrawing(),!e&&this.stopClick_&&t.stopPropagation(),e},e.prototype.handlePointerMove_=function(t){if(this.downPx_&&(!this.freehand_&&this.shouldHandle_||this.freehand_&&!this.shouldHandle_)){var e=this.downPx_,n=t.pixel,i=e[0]-n[0],r=e[1]-n[1],o=i*i+r*r;if(this.shouldHandle_=this.freehand_?o>this.squaredClickTolerance_:o<=this.squaredClickTolerance_,!this.shouldHandle_)return}this.finishCoordinate_?this.modifyDrawing_(t):this.createOrUpdateSketchPoint_(t)},e.prototype.atFinish_=function(t){var e=!1;if(this.sketchFeature_){var n=!1,i=[this.finishCoordinate_];if(this.mode_===Pu)n=this.sketchCoords_.length>this.minPoints_;else if(this.mode_===Ru){var r=this.sketchCoords_;n=r[0].length>this.minPoints_,i=[r[0][0],r[0][r[0].length-2]]}if(n)for(var o=t.map,a=0,s=i.length;a=this.maxPoints_&&(this.freehand_?n.pop():e=!0),n.push(t.slice()),this.geometryFunction_(n,i,r)):this.mode_===Ru&&((n=this.sketchCoords_[0]).length>=this.maxPoints_&&(this.freehand_?n.pop():e=!0),n.push(t.slice()),e&&(this.finishCoordinate_=n[0]),this.geometryFunction_(this.sketchCoords_,i,r)),this.updateSketchFeatures_(),e&&this.finishDrawing()},e.prototype.removeLastPoint=function(){if(this.sketchFeature_){var t,e=this.sketchFeature_.getGeometry(),n=this.getMap().getView().getProjection();this.mode_===Pu?((t=this.sketchCoords_).splice(-2,1),this.geometryFunction_(t,e,n),t.length>=2&&(this.finishCoordinate_=t[t.length-2].slice())):this.mode_===Ru&&((t=this.sketchCoords_[0]).splice(-2,1),this.sketchLine_.getGeometry().setCoordinates(t),this.geometryFunction_(this.sketchCoords_,e,n)),0===t.length&&this.abortDrawing(),this.updateSketchFeatures_()}},e.prototype.finishDrawing=function(){var t=this.abortDrawing_();if(t){var e=this.sketchCoords_,n=t.getGeometry(),i=this.getMap().getView().getProjection();this.mode_===Pu?(e.pop(),this.geometryFunction_(e,n,i)):this.mode_===Ru&&(e[0].pop(),this.geometryFunction_(e,n,i),e=n.getCoordinates()),this.type_===ft?t.setGeometry(new Su([e])):this.type_===dt?t.setGeometry(new xu([e])):this.type_===gt&&t.setGeometry(new bu([e])),this.dispatchEvent(new Mu(Iu,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 Mu(Au,t))},e.prototype.appendCoordinates=function(t){var e=this.mode_,n=[];e===Pu?n=this.sketchCoords_:e===Ru&&(n=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[]);for(var i=n.pop(),r=0;rc?o[1]:o[0]),a}}return null},e.prototype.handlePointerMove_=function(t){var e=t.pixel,n=t.map,i=this.snapToVertex_(e,n);i||(i=n.getCoordinateFromPixelInternal(e)),this.createOrUpdatePointerFeature_(i)},e.prototype.createOrUpdateExtentFeature_=function(t){var e=this.extentFeature_;return e?t?e.setGeometry(di(t)):e.setGeometry(void 0):(e=new rt(t?di(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 $n(t)),this.vertexFeature_=e,this.vertexOverlay_.getSource().addFeature(e));return e},e.prototype.handleEvent=function(e){return!e.originalEvent||!this.condition_(e)||(e.type!=ws.POINTERMOVE||this.handlingDownUpSequence||this.handlePointerMove_(e),t.prototype.handleEvent.call(this,e),!1)},e.prototype.handleDownEvent=function(t){var e=t.pixel,n=t.map,i=this.getExtentInternal(),r=this.snapToVertex_(e,n),o=function(t){var e=null,n=null;return t[0]==i[0]?e=i[2]:t[0]==i[2]&&(e=i[0]),t[1]==i[1]?n=i[3]:t[1]==i[3]&&(n=i[1]),null!==e&&null!==n?[e,n]:null};if(r&&i){var a=r[0]==i[0]||r[0]==i[2]?r[0]:null,s=r[1]==i[1]||r[1]==i[3]?r[1]:null;null!==a&&null!==s?this.pointerHandler_=Bu(o(r)):null!==a?this.pointerHandler_=Uu(o([a,i[1]]),o([a,i[3]])):null!==s&&(this.pointerHandler_=Uu(o([i[0],s]),o([i[2],s])))}else r=n.getCoordinateFromPixelInternal(e),this.setExtent([r[0],r[1],r[0],r[1]]),this.pointerHandler_=Bu(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 Sn(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 Gu(this.extent_))},e}(wl);function Nu(){var t=Pr();return function(e,n){return t[pt]}}function zu(){var t=Pr();return function(e,n){return t[ut]}}function Bu(t){return function(e){return Ut([t,e])}}function Uu(t,e){return t[0]==e[0]?function(n){return Ut([t,[n[0],e[1]]])}:t[1]==e[1]?function(n){return Ut([t,[e[0],n[1]]])}:null}var Xu=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Wu=[0,0,0,0],Vu=[],Ku="modifystart",Yu="modifyend",Zu=function(t){function e(e,n,i){var r=t.call(this,e)||this;return r.features=n,r.mapBrowserEvent=i,r}return Xu(e,t),e}(s),Hu=function(t){function e(e){var n,i=t.call(this,e)||this;if(i.boundHandleFeatureChange_=i.handleFeatureChange_.bind(i),i.condition_=e.condition?e.condition:Ll,i.defaultDeleteCondition_=function(t){return function(t){var e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey}(t)&&Fl(t)},i.deleteCondition_=e.deleteCondition?e.deleteCondition:i.defaultDeleteCondition_,i.insertVertexCondition_=e.insertVertexCondition?e.insertVertexCondition:Tl,i.vertexFeature_=null,i.vertexSegments_=null,i.lastPixel_=[0,0],i.ignoreNextSingleClick_=!1,i.modified_=!1,i.rBush_=new Aa,i.pixelTolerance_=void 0!==e.pixelTolerance?e.pixelTolerance:10,i.snappedToVertex_=!1,i.changingFeature_=!1,i.dragSegments_=[],i.overlay_=new Ia({source:new Za({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.style?e.style:$u(),updateWhileAnimating:!0,updateWhileInteracting:!0}),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),Circle:i.writeCircleGeometry_.bind(i),GeometryCollection:i.writeGeometryCollectionGeometry_.bind(i)},i.source_=null,e.source?(i.source_=e.source,n=new et(i.source_.getFeatures()),i.source_.addEventListener(Da,i.handleSourceAdd_.bind(i)),i.source_.addEventListener(Na,i.handleSourceRemove_.bind(i))):n=e.features,!n)throw new Error("The modify interaction requires features or a source");return i.features_=n,i.features_.forEach(i.addFeature_.bind(i)),i.features_.addEventListener(q,i.handleFeatureAdd_.bind(i)),i.features_.addEventListener(J,i.handleFeatureRemove_.bind(i)),i.lastPointerEvent_=null,i}return Xu(e,t),e.prototype.addFeature_=function(t){var e=t.getGeometry();if(e){var n=this.SEGMENT_WRITERS_[e.getType()];n&&n(t,e)}var i=this.getMap();i&&i.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,i),t.addEventListener(E,this.boundHandleFeatureChange_)},e.prototype.willModifyFeatures_=function(t){this.modified_||(this.modified_=!0,this.dispatchEvent(new Zu(Ku,this.features_,t)))},e.prototype.removeFeature_=function(t){this.removeFeatureSegmentData_(t),this.vertexFeature_&&0===this.features_.getLength()&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.removeEventListener(E,this.boundHandleFeatureChange_)},e.prototype.removeFeatureSegmentData_=function(t){var e=this.rBush_,n=[];e.forEach((function(e){t===e.feature&&n.push(e)}));for(var i=n.length-1;i>=0;--i){for(var r=n[i],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 n=e.getCoordinates(),i={feature:t,geometry:e,segment:[n,n]};this.rBush_.insert(e.getExtent(),i)},e.prototype.writeMultiPointGeometry_=function(t,e){for(var n=e.getCoordinates(),i=0,r=n.length;i=0;--_)this.insertVertex_.apply(this,o[_])}return!!this.vertexFeature_},e.prototype.handleUpEvent=function(t){for(var e=this.dragSegments_.length-1;e>=0;--e){var n=this.dragSegments_[e][0],i=n.geometry;if(i.getType()===yt){var r=i.getCenter(),o=n.featureSegments[0],a=n.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=i;this.rBush_.update(s.getExtent(),a)}else this.rBush_.update(Ut(n.segment),n)}return this.modified_&&(this.dispatchEvent(new Zu(Yu,this.features_,t)),this.modified_=!1),!1},e.prototype.handlePointerMove_=function(t){this.lastPixel_=t.pixel,this.handlePointerAtPixel_(t.pixel,t.map,t.coordinate)},e.prototype.handlePointerAtPixel_=function(t,e,n){var r=n||e.getCoordinateFromPixel(t),o=e.getView().getProjection(),a=Sn(Xt(Cn($t(r,Wu)),e.getView().getResolution()*this.pixelTolerance_,Wu)),s=this.rBush_.getInExtent(a);if(s.length>0){s.sort((function(t,e){return Ju(r,t,o)-Ju(r,e,o)}));var l=s[0],u=l.segment,h=Qu(r,l,o),c=e.getPixelFromCoordinate(h),p=nn(t,c);if(p<=this.pixelTolerance_){var f={};if(l.geometry.getType()===yt&&1===l.index)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(h);else{var d=e.getPixelFromCoordinate(u[0]),g=e.getPixelFromCoordinate(u[1]),_=en(c,d),y=en(c,g);p=Math.sqrt(Math.min(_,y)),this.snappedToVertex_=p<=this.pixelTolerance_,this.snappedToVertex_&&(h=_>y?u[1]:u[0]),this.createOrUpdateVertexFeature_(h);for(var v=1,m=s.length;v=0;--o)c=i((h=(n=p[o])[0]).feature),h.depth&&(c+="-"+h.depth.join("-")),c in f||(f[c]={}),0===n[1]?(f[c].right=h,f[c].index=h.index):1==n[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,n,i){this.rBush_.forEachInExtent(t.getExtent(),(function(r){r.geometry===t&&(void 0===n||void 0===r.depth||g(r.depth,n))&&r.index>e&&(r.index+=i)}))},e}(wl);function qu(t,e){return t.index-e.index}function Ju(t,e,n){var i=e.geometry;if(i.getType()===yt){var r=i;if(1===e.index){null;var o=en(r.getCenter(),wn(t)),a=Math.sqrt(o)-r.getRadius();return a*a}}var s=wn(t);return Vu[0]=wn(e.segment[0]),Vu[1]=wn(e.segment[1]),rn(s,Vu)}function Qu(t,e,n){var i=e.geometry;if(i.getType()===yt&&1===e.index){var r=i;return xn(r.getClosestPoint(wn(t)))}var o=wn(t);return Vu[0]=wn(e.segment[0]),Vu[1]=wn(e.segment[1]),xn(Qe(o,Vu))}function $u(){var t=Pr();return function(e,n){return t[ut]}}var th=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),eh="select",nh=function(t){function e(e,n,i,r){var o=t.call(this,e)||this;return o.selected=n,o.deselected=i,o.mapBrowserEvent=r,o}return th(e,t),e}(s),ih={},rh=function(t){function e(e){var n,i,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:Fl,r.addCondition_=o.addCondition?o.addCondition:Rl,r.removeCondition_=o.removeCondition?o.removeCondition:Rl,r.toggleCondition_=o.toggleCondition?o.toggleCondition:Il,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((n=Pr())[pt],n[ht]),d(n[_t],n[ht]),function(t){return t.getGeometry()?n[t.getGeometry().getType()]:null}),r.features_=o.features||new et,o.layers)if("function"==typeof o.layers)i=o.layers;else{var a=o.layers;i=function(t){return c(a,t)}}else i=_;return r.layerFilter_=i,r.featureLayerAssociation_={},r}return th(e,t),e.prototype.addFeatureLayerAssociation_=function(t,e){this.featureLayerAssociation_[i(t)]=e},e.prototype.getFeatures=function(){return this.features_},e.prototype.getHitTolerance=function(){return this.hitTolerance_},e.prototype.getLayer=function(t){return this.featureLayerAssociation_[i(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=i(t);e in ih||(ih[e]=t.getStyle()),t.setStyle(this.style_)},e.prototype.restorePreviousStyle_=function(t){var n=i(t),r=this.getMap().getInteractions().getArray().filter((function(n){return n instanceof e&&n.getStyle()&&-1!==n.getFeatures().getArray().indexOf(t)}));r.length>0?t.setStyle(r[r.length-1].getStyle()):(t.setStyle(ih[n]),delete ih[n])},e.prototype.removeFeatureLayerAssociation_=function(t){delete this.featureLayerAssociation_[i(t)]},e.prototype.handleEvent=function(t){if(!this.condition_(t))return!0;var e=this.addCondition_(t),n=this.removeCondition_(t),i=this.toggleCondition_(t),r=!e&&!n&&!i,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&&!i||c(a.getArray(),t)?(n||i)&&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 nh(eh,l,s,t)),!0},e}(_l);var oh=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();function ah(t){return t.feature?t.feature:t.element?t.element:void 0}var sh=[],lh=function(t){function e(e){var n=this,i=e||{},r=i;return r.handleDownEvent||(r.handleDownEvent=_),r.stopDown||(r.stopDown=y),(n=t.call(this,r)||this).source_=i.source?i.source:null,n.vertex_=void 0===i.vertex||i.vertex,n.edge_=void 0===i.edge||i.edge,n.features_=i.features?i.features:null,n.featuresListenerKeys_=[],n.featureChangeListenerKeys_={},n.indexedFeaturesExtents_={},n.pendingFeatures_={},n.pixelTolerance_=void 0!==i.pixelTolerance?i.pixelTolerance:10,n.rBush_=new Aa,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),GeometryCollection:n.writeGeometryCollectionGeometry_.bind(n),Circle:n.writeCircleGeometry_.bind(n)},n}return oh(e,t),e.prototype.addFeature=function(t,e){var n=void 0===e||e,r=i(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))}n&&(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 n=this.snapTo(e.pixel,e.coordinate,e.map);return n.snapped&&(e.coordinate=n.vertex.slice(0,2),e.pixel=n.vertexPixel),t.prototype.handleEvent.call(this,e)},e.prototype.handleFeatureAdd_=function(t){var e=ah(t);this.addFeature(e)},e.prototype.handleFeatureRemove_=function(t){var e=ah(t);this.removeFeature(e)},e.prototype.handleFeatureChange_=function(t){var e=t.target;if(this.handlingDownUpSequence){var n=i(e);n in this.pendingFeatures_||(this.pendingFeatures_[n]=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 n=void 0===e||e,r=i(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])}n&&(B(this.featureChangeListenerKeys_[r]),delete this.featureChangeListenerKeys_[r])},e.prototype.setMap=function(e){var n=this.getMap(),i=this.featuresListenerKeys_,r=this.getFeatures_();n&&(i.forEach(B),i.length=0,r.forEach(this.forEachFeatureRemove_.bind(this))),t.prototype.setMap.call(this,e),e&&(this.features_?i.push(N(this.features_,q,this.handleFeatureAdd_,this),N(this.features_,J,this.handleFeatureRemove_,this)):this.source_&&i.push(N(this.source_,Da,this.handleFeatureAdd_,this),N(this.source_,Na,this.handleFeatureRemove_,this)),r.forEach(this.forEachFeatureAdd_.bind(this)))},e.prototype.snapTo=function(t,e,n){var i=Ut([n.getCoordinateFromPixel([t[0]-this.pixelTolerance_,t[1]+this.pixelTolerance_]),n.getCoordinateFromPixel([t[0]+this.pixelTolerance_,t[1]-this.pixelTolerance_])]),r=this.rBush_.getInExtent(i);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};n.getView().getProjection();for(var l,u=wn(e),h=1/0,c=0;cv?d[1]:d[0],s=n.getPixelFromCoordinate(a))}else if(this.edge_){var m=l.feature.getGeometry().getType()===yt;if(m){var x=l.feature.getGeometry();null,a=xn(function(t,e){var n=e.getRadius(),i=e.getCenter(),r=i[0],o=i[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+n*a/l,o+n*s/l]}(u,x))}else sh[0]=wn(d[0]),sh[1]=wn(d[1]),a=xn(Qe(u,sh));if(nn(t,s=n.getPixelFromCoordinate(a))<=this.pixelTolerance_&&(o=!0,this.vertex_&&!m)){g=n.getPixelFromCoordinate(d[0]),_=n.getPixelFromCoordinate(d[1]),y=en(s,g),v=en(s,_);Math.sqrt(Math.min(y,v))<=this.pixelTolerance_&&(a=y>v?d[1]:d[0],s=n.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 n=gi(e).getCoordinates()[0],i=0,r=n.length-1;i0&&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 n=this.entries_[t];return nt(void 0!==n,15),n===this.newest_||(n===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(n.newer.older=n.older,n.older.newer=n.newer),n.newer=null,n.older=this.newest_,this.newest_.newer=n,this.newest_=n),n.value_},t.prototype.remove=function(t){var e=this.entries_[t];return nt(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_),n=0;for(t=this.newest_;t;t=t.older)e[n++]=t.key_;return e},t.prototype.getValues=function(){var t,e=new Array(this.count_),n=0;for(t=this.newest_;t;t=t.older)e[n++]=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){nt(!(t in this.entries_),16);var n={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[t]=n,++this.count_},t.prototype.setSize=function(t){this.highWaterMark=t},t}();function xh(t,e,n,i){return void 0!==i?(i[0]=t,i[1]=e,i[2]=n,i):[t,e,n]}function wh(t,e,n){return t+"/"+e+"/"+n}function Sh(t){return wh(t[0],t[1],t[2])}function Ch(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 Ph(t,e,n,i,r){return void 0!==r?(r.minX=t,r.maxX=e,r.minY=n,r.maxY=i,r):new Th(t,e,n,i)}var Rh=Xo((function(t,e){t.exports=function(t,e){t="default"in t?t.default:t;var n=function(){function t(t,e){for(var n=0;ne.getMaxResolution()||_=0?t:"children"}}]),r}(t);return window.ol&&window.ol.control&&(window.ol.control.LayerSwitcher=r),r}($s,X)})),Fh=function(){function t(){this.dataProjection=null,this.defaultFeatureProjection=null}return t.prototype.getReadOptions=function(t,e){var n;if(e){var i=e.dataProjection?un(e.dataProjection):this.readProjection(t);e.extent&&i&&i.getUnits()===wt&&(i=un(i)).setWorldExtent(e.extent),n={dataProjection:i,featureProjection:e.featureProjection}}return this.adaptOptions(n)},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,n){return e()},t.prototype.readFeatures=function(t,n){return e()},t.prototype.readGeometry=function(t,n){return e()},t.prototype.readProjection=function(t){return e()},t.prototype.writeFeature=function(t,n){return e()},t.prototype.writeFeatures=function(t,n){return e()},t.prototype.writeGeometry=function(t,n){return e()},t}();function Oh(t,e,n){var i,r=n?un(n.featureProjection):null,o=n?un(n.dataProjection):null;if(i=r&&o&&!fn(r,o)?(e?t.clone():t).transform(e?r:o,e?o:r):t,e&&n&&void 0!==n.decimals){var a=Math.pow(10,n.decimals);i===t&&(i=t.clone()),i.applyTransform((function(t){for(var e=0,n=t.length;e0?n[0]:null},n.prototype.readFeatureFromNode=function(t,e){return null},n.prototype.readFeatures=function(t,e){if(t){if("string"==typeof t){var n=Wh(t);return this.readFeaturesFromDocument(n,e)}return Xh(t)?this.readFeaturesFromDocument(t,e):this.readFeaturesFromNode(t,e)}return[]},n.prototype.readFeaturesFromDocument=function(t,e){for(var n=[],i=t.firstChild;i;i=i.nextSibling)i.nodeType==Node.ELEMENT_NODE&&d(n,this.readFeaturesFromNode(i,e));return n},n.prototype.readFeaturesFromNode=function(t,n){return e()},n.prototype.readGeometry=function(t,e){if(t){if("string"==typeof t){var n=Wh(t);return this.readGeometryFromDocument(n,e)}return Xh(t)?this.readGeometryFromDocument(t,e):this.readGeometryFromNode(t,e)}return null},n.prototype.readGeometryFromDocument=function(t,e){return null},n.prototype.readGeometryFromNode=function(t,e){return null},n.prototype.readProjection=function(t){if(t){if("string"==typeof t){var e=Wh(t);return this.readProjectionFromDocument(e)}return Xh(t)?this.readProjectionFromDocument(t):this.readProjectionFromNode(t)}return null},n.prototype.readProjectionFromDocument=function(t){return this.dataProjection},n.prototype.readProjectionFromNode=function(t){return this.dataProjection},n.prototype.writeFeature=function(t,e){var n=this.writeFeatureNode(t,e);return this.xmlSerializer_.serializeToString(n)},n.prototype.writeFeatureNode=function(t,e){return null},n.prototype.writeFeatures=function(t,e){var n=this.writeFeaturesNode(t,e);return this.xmlSerializer_.serializeToString(n)},n.prototype.writeFeaturesNode=function(t,e){return null},n.prototype.writeGeometry=function(t,e){var n=this.writeGeometryNode(t,e);return this.xmlSerializer_.serializeToString(n)},n.prototype.writeGeometryNode=function(t,e){return null},n}(Fh);function lc(t){var e,n=Uh(t,!1);return(e=/^\s*(true|1)|(false|0)\s*$/.exec(n))?void 0!==e[1]||!1:void 0}function uc(t){var e,n=Uh(t,!1);return(e=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*$/i.exec(n))?parseFloat(e[1]):void 0}function hc(t){return Uh(t,!1).trim()}function cc(t,e){fc(t,e?"1":"0")}function pc(t,e){var n=e.toPrecision();t.appendChild(oc().createTextNode(n))}function fc(t,e){t.appendChild(oc().createTextNode(e))}var dc,gc,_c,yc,vc,mc,xc,wc,Sc,Cc,bc=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Ec=["http://www.google.com/kml/ext/2.2"],Tc=[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"],Pc={fraction:sa,pixels:la,insetPixels:la},Rc=$h(Tc,{ExtendedData:vp,Region:mp,MultiGeometry:Zh(up,"geometry"),LineString:Zh(ap,"geometry"),LinearRing:Zh(sp,"geometry"),Point:Zh(hp,"geometry"),Polygon:Zh(pp,"geometry"),Style:Zh(dp),StyleMap:function(t,e){var n=Kc.call(this,t,e);if(!n)return;var i=e[e.length-1];Array.isArray(n)?i.Style=n:"string"==typeof n?i.styleUrl=n:nt(!1,38)},address:Zh(hc),description:Zh(hc),name:Zh(hc),open:Zh(lc),phoneNumber:Zh(hc),styleUrl:Zh(Xc),visibility:Zh(lc)},$h(Ec,{MultiTrack:Zh((function(t,e){var n=ec([],$c,t,e);if(!n)return;return new xu(n)}),"geometry"),Track:Zh(ep,"geometry")})),Fc=$h(Tc,{ExtendedData:vp,Region:mp,Link:function(t,e){tc(Oc,t,e)},address:Zh(hc),description:Zh(hc),name:Zh(hc),open:Zh(lc),phoneNumber:Zh(hc),visibility:Zh(lc)}),Oc=$h(Tc,{href:Zh(Xc)}),Ic=$h(Tc,{LatLonAltBox:function(t,e){var n=ec({},Sp,t,e);if(!n)return;var i=e[e.length-1],r=[parseFloat(n.west),parseFloat(n.south),parseFloat(n.east),parseFloat(n.north)];i.extent=r,i.altitudeMode=n.altitudeMode,i.minAltitude=parseFloat(n.minAltitude),i.maxAltitude=parseFloat(n.maxAltitude)},Lod:function(t,e){var n=ec({},Cp,t,e);if(!n)return;var i=e[e.length-1];i.minLodPixels=parseFloat(n.minLodPixels),i.maxLodPixels=parseFloat(n.maxLodPixels),i.minFadeExtent=parseFloat(n.minFadeExtent),i.maxFadeExtent=parseFloat(n.maxFadeExtent)}}),Ac=$h(Tc,["Document","Placemark"]),Mc=$h(Tc,{Document:Hh((function(t,e,n){nc({node:t},Rp,Fp,e,n,void 0,this)})),Placemark:Hh($p)}),Lc=null,kc=null,Dc=null,Gc=null,jc=null,Nc=null;var zc=function(t){function e(e){var n=t.call(this)||this,i=e||{};return Nc||(Lc=new wi({color:dc=[255,255,255,1]}),kc=new Ca({anchor:gc=[20,2],anchorOrigin:ua,anchorXUnits:_c=la,anchorYUnits:yc=la,crossOrigin:"anonymous",rotation:0,scale:xc=.5,size:vc=[64,64],src:mc="https://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png"}),wc="NO_IMAGE",Dc=new Pi({color:dc,width:1}),Sc=new Pi({color:[51,51,51,1],width:2}),Gc=new Ir({font:"bold 16px Helvetica",fill:Lc,stroke:Sc,scale:.8}),jc=new br({fill:Lc,image:kc,text:Gc,stroke:Dc,zIndex:0}),Nc=[jc]),n.dataProjection=un("EPSG:4326"),n.defaultStyle_=i.defaultStyle?i.defaultStyle:Nc,n.extractStyles_=void 0===i.extractStyles||i.extractStyles,n.writeStyles_=void 0===i.writeStyles||i.writeStyles,n.sharedStyles_={},n.showPointNames_=void 0===i.showPointNames||i.showPointNames,n.crossOrigin_=void 0!==i.crossOrigin?i.crossOrigin:"anonymous",n}return bc(e,t),e.prototype.readDocumentOrFolder_=function(t,e){var n=ec([],$h(Tc,{Document:Vh(this.readDocumentOrFolder_,this),Folder:Vh(this.readDocumentOrFolder_,this),Placemark:Kh(this.readPlacemark_,this),Style:this.readSharedStyle_.bind(this),StyleMap:this.readSharedStyleMap_.bind(this)}),t,e,this);return n||void 0},e.prototype.readPlacemark_=function(t,e){var n=ec({geometry:null},Rc,t,e,this);if(n){var i=new rt,r=t.getAttribute("id");null!==r&&i.setId(r);var o=e[0],a=n.geometry;if(a&&Oh(a,!1,o),i.setGeometry(a),delete n.geometry,this.extractStyles_){var s=function(t,e,n,i,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&&(Cc||(Cc=document.createElement("textarea")),Cc.innerHTML=l,l=Cc.value));var p=n;if(t?p=t:e&&(p=function t(e,n,i){return Array.isArray(e)?e:"string"==typeof e?(!(e in i)&&"#"+e in i&&(e="#"+e),t(i[e],n,i)):n}(e,n,i)),s){var f=function(t,e){var n=[0,0],i="start",r=t.getImage();if(r){var o=r.getImageSize();if(null===o&&(o=vc),2==o.length){var a=r.getScaleArray();n[0]=a[0]*o[0]/2,n[1]=-a[1]*o[1]/2,i="left"}}var s=t.getText();s?((s=s.clone()).setFont(s.getFont()||Gc.getFont()),s.setScale(s.getScale()||Gc.getScale()),s.setFill(s.getFill()||Gc.getFill()),s.setStroke(s.getStroke()||Sc)):s=Gc.clone();return s.setText(e),s.setOffsetX(n[0]),s.setOffsetY(n[1]),s.setTextAlign(i),new br({image:r,text:s})}(p[0],l);return u.length>0?(f.setGeometry(new kh(u)),[f,new br({geometry:p[0].getGeometry(),image:null,fill:p[0].getFill(),stroke:p[0].getStroke(),text:null})].concat(p.slice(1))):f}return p}}(n.Style,n.styleUrl,this.defaultStyle_,this.sharedStyles_,this.showPointNames_);i.setStyle(s)}return delete n.Style,i.setProperties(n,!0),i}},e.prototype.readSharedStyle_=function(t,e){var n=t.getAttribute("id");if(null!==n){var i=dp.call(this,t,e);if(i){var r=void 0,o=t.baseURI;if(o&&"about:blank"!=o||(o=window.location.href),o)r=new URL("#"+n,o).href;else r="#"+n;this.sharedStyles_[r]=i}}},e.prototype.readSharedStyleMap_=function(t,e){var n=t.getAttribute("id");if(null!==n){var i=Kc.call(this,t,e);if(i){var r,o=t.baseURI;if(o&&"about:blank"!=o||(o=window.location.href),o)r=new URL("#"+n,o).href;else r="#"+n;this.sharedStyles_[r]=i}}},e.prototype.readFeatureFromNode=function(t,e){if(!c(Tc,t.namespaceURI))return null;var n=this.readPlacemark_(t,[this.getReadOptions(t,e)]);return n||null},e.prototype.readFeaturesFromNode=function(t,e){if(!c(Tc,t.namespaceURI))return[];var n,i=t.localName;if("Document"==i||"Folder"==i)return(n=this.readDocumentOrFolder_(t,[this.getReadOptions(t,e)]))||[];if("Placemark"==i){var r=this.readPlacemark_(t,[this.getReadOptions(t,e)]);return r?[r]:[]}if("kml"==i){n=[];for(var o=t.firstElementChild;o;o=o.nextElementSibling){var a=this.readFeaturesFromNode(o,e);a&&d(n,a)}return n}return[]},e.prototype.readName=function(t){if(t){if("string"==typeof t){var e=Wh(t);return this.readNameFromDocument(e)}return Xh(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 n=this.readNameFromNode(e);if(n)return n}},e.prototype.readNameFromNode=function(t){for(var e=t.firstElementChild;e;e=e.nextElementSibling)if(c(Tc,e.namespaceURI)&&"name"==e.localName)return hc(e);for(e=t.firstElementChild;e;e=e.nextElementSibling){var n=e.localName;if(c(Tc,e.namespaceURI)&&("Document"==n||"Folder"==n||"Placemark"==n||"kml"==n)){var i=this.readNameFromNode(e);if(i)return i}}},e.prototype.readNetworkLinks=function(t){var e=[];if("string"==typeof t){var n=Wh(t);d(e,this.readNetworkLinksFromDocument(n))}else Xh(t)?d(e,this.readNetworkLinksFromDocument(t)):d(e,this.readNetworkLinksFromNode(t));return e},e.prototype.readNetworkLinksFromDocument=function(t){for(var e=[],n=t.firstChild;n;n=n.nextSibling)n.nodeType==Node.ELEMENT_NODE&&d(e,this.readNetworkLinksFromNode(n));return e},e.prototype.readNetworkLinksFromNode=function(t){for(var e=[],n=t.firstElementChild;n;n=n.nextElementSibling)if(c(Tc,n.namespaceURI)&&"NetworkLink"==n.localName){var i=ec({},Fc,n,[]);e.push(i)}for(n=t.firstElementChild;n;n=n.nextElementSibling){var r=n.localName;!c(Tc,n.namespaceURI)||"Document"!=r&&"Folder"!=r&&"kml"!=r||d(e,this.readNetworkLinksFromNode(n))}return e},e.prototype.readRegion=function(t){var e=[];if("string"==typeof t){var n=Wh(t);d(e,this.readRegionFromDocument(n))}else Xh(t)?d(e,this.readRegionFromDocument(t)):d(e,this.readRegionFromNode(t));return e},e.prototype.readRegionFromDocument=function(t){for(var e=[],n=t.firstChild;n;n=n.nextSibling)n.nodeType==Node.ELEMENT_NODE&&d(e,this.readRegionFromNode(n));return e},e.prototype.readRegionFromNode=function(t){for(var e=[],n=t.firstElementChild;n;n=n.nextElementSibling)if(c(Tc,n.namespaceURI)&&"Region"==n.localName){var i=ec({},Ic,n,[]);e.push(i)}for(n=t.firstElementChild;n;n=n.nextElementSibling){var r=n.localName;!c(Tc,n.namespaceURI)||"Document"!=r&&"Folder"!=r&&"kml"!=r||d(e,this.readRegionFromNode(n))}return e},e.prototype.writeFeaturesNode=function(t,e){e=this.adaptOptions(e);var n=Bh(Tc[4],"kml"),i="http://www.w3.org/2000/xmlns/";n.setAttributeNS(i,"xmlns:gx",Ec[0]),n.setAttributeNS(i,"xmlns:xsi","http://www.w3.org/2001/XMLSchema-instance"),n.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:n},o={};t.length>1?o.Document=t:1==t.length&&(o.Placemark=t[0]);var a=Ac[n.namespaceURI],s=Qh(o,a);return nc(r,Mc,Jh,s,[e],a,this),n},e}(sc);function Bc(t){var e=Uh(t,!1),n=/^\s*#?\s*([0-9A-Fa-f]{8})\s*$/.exec(e);if(n){var i=n[1];return[parseInt(i.substr(6,2),16),parseInt(i.substr(4,2),16),parseInt(i.substr(2,2),16),parseInt(i.substr(0,2),16)/255]}}function Uc(t){for(var e,n=Uh(t,!1),i=[],r=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*,\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s*,\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?))?\s*/i;e=r.exec(n);){var o=parseFloat(e[1]),a=parseFloat(e[2]),s=e[3]?parseFloat(e[3]):0;i.push(o,a,s),n=n.substr(e[0].length)}if(""===n)return i}function Xc(t){var e=Uh(t,!1).trim(),n=t.baseURI;return n&&"about:blank"!=n||(n=window.location.href),n?new URL(e,n).href:e}function Wc(t){return uc(t)}var Vc=$h(Tc,{Pair:function(t,e){var n=ec({},xp,t,e,this);if(!n)return;var i=n.key;if(i&&"normal"==i){var r=n.styleUrl;r&&(e[e.length-1]=r);var o=n.Style;o&&(e[e.length-1]=o)}}});function Kc(t,e){return ec(void 0,Vc,t,e,this)}var Yc=$h(Tc,{Icon:Zh((function(t,e){var n=ec({},np,t,e);return n||null})),color:Zh(Bc),heading:Zh(uc),hotSpot:Zh((function(t){var e,n=t.getAttribute("xunits"),i=t.getAttribute("yunits");return e="insetPixels"!==n?"insetPixels"!==i?ua:ca:"insetPixels"!==i?ha:pa,{x:parseFloat(t.getAttribute("x")),xunits:Pc[n],y:parseFloat(t.getAttribute("y")),yunits:Pc[i],origin:e}})),scale:Zh(Wc)});var Zc=$h(Tc,{color:Zh(Bc),scale:Zh(Wc)});var Hc=$h(Tc,{color:Zh(Bc),width:Zh(uc)});var qc=$h(Tc,{color:Zh(Bc),fill:Zh(lc),outline:Zh(lc)});var Jc=$h(Tc,{coordinates:Yh(Uc)});function Qc(t,e){return ec(null,Jc,t,e)}var $c=$h(Ec,{Track:Kh(ep)});var tp=$h(Tc,{when:function(t,e){var n=e[e.length-1].whens,i=Uh(t,!1),r=Date.parse(i);n.push(isNaN(r)?0:r)}},$h(Ec,{coord:function(t,e){var n=e[e.length-1].flatCoordinates,i=Uh(t,!1),r=/^\s*([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s*$/i.exec(i);if(r){var o=parseFloat(r[1]),a=parseFloat(r[2]),s=parseFloat(r[3]);n.push(o,a,s,0)}else n.push(0,0,0,0)}}));function ep(t,e){var n=ec({flatCoordinates:[],whens:[]},tp,t,e);if(n){for(var i=n.flatCoordinates,r=n.whens,o=0,a=Math.min(i.length,r.length);o0,h=l.href;h?i=h:u&&(i=mc);var c,p=ua,f=n.hotSpot;f?(r=[f.x,f.y],o=f.xunits,a=f.yunits,p=f.origin):i===mc?(r=gc,o=_c,a=yc):/^http:\/\/maps\.(?:google|gstatic)\.com\//.test(i)&&(r=[.5,0],o=sa,a=sa);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=n.heading;void 0!==x&&(y=Fe(x));var w=n.scale,S=n.color;if(u){i==mc&&(d=vc,void 0===w&&(w=xc));var C=new Ca({anchor:r,anchorOrigin:p,anchorXUnits:o,anchorYUnits:a,crossOrigin:this.crossOrigin_,offset:c,offsetOrigin:ua,rotation:y,scale:w,size:d,src:i,color:S});s.imageStyle=C}else s.imageStyle=wc}},LabelStyle:function(t,e){var n=ec({},Zc,t,e);if(n){var i=e[e.length-1],r=new Ir({fill:new wi({color:"color"in n?n.color:dc}),scale:n.scale});i.textStyle=r}},LineStyle:function(t,e){var n=ec({},Hc,t,e);if(n){var i=e[e.length-1],r=new Pi({color:"color"in n?n.color:dc,width:"width"in n?n.width:1});i.strokeStyle=r}},PolyStyle:function(t,e){var n=ec({},qc,t,e);if(n){var i=e[e.length-1],r=new wi({color:"color"in n?n.color:dc});i.fillStyle=r;var o=n.fill;void 0!==o&&(i.fill=o);var a=n.outline;void 0!==a&&(i.outline=a)}}});function dp(t,e){var n=ec({},fp,t,e,this);if(!n)return null;var i,r="fillStyle"in n?n.fillStyle:Lc,o=n.fill;void 0===o||o||(r=null),"imageStyle"in n?n.imageStyle!=wc&&(i=n.imageStyle):i=kc;var a="textStyle"in n?n.textStyle:Gc,s="strokeStyle"in n?n.strokeStyle:Dc,l=n.outline;return void 0===l||l?[new br({fill:r,image:i,stroke:s,text:a,zIndex:void 0})]:[new br({geometry:function(t){var e=t.getGeometry(),n=e.getType();return n===_t?new kh(e.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return e!==pt&&e!==gt}))):n!==pt&&n!==gt?e:void 0},fill:r,image:i,stroke:s,text:a,zIndex:void 0}),new br({geometry:function(t){var e=t.getGeometry(),n=e.getType();return n===_t?new kh(e.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return e===pt||e===gt}))):n===pt||n===gt?e:void 0},fill:r,stroke:null,zIndex:void 0})]}function gp(t,e){var n,i,r,o=e.length,a=new Array(e.length),s=new Array(e.length),l=new Array(e.length);n=!1,i=!1,r=!1;for(var u=0;u0){var y=Qh(r,a);nc(i,qp,Qp,[{names:a,values:y}],n)}var v=n[0],m=e.getGeometry();m&&(m=Oh(m,!0,v)),nc(i,qp,Bp,[m],n)}var tf=$h(Tc,["extrude","tessellate","altitudeMode","coordinates"]),ef=$h(Tc,{extrude:Hh(cc),tessellate:Hh(cc),altitudeMode:Hh(fc),coordinates:Hh((function(t,e,n){var i,r=n[n.length-1],o=r.layout,a=r.stride;o==ot||o==st?i=2:o==at||o==lt?i=3:nt(!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,n){var i=this.getGL(),r=e.getSize();i.bindFramebuffer(i.FRAMEBUFFER,e.getFramebuffer()),i.viewport(0,0,r[0],r[1]),i.bindTexture(i.TEXTURE_2D,e.getTexture()),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.enable(i.BLEND),i.blendFunc(i.ONE,n?i.ZERO:i.ONE_MINUS_SRC_ALPHA),i.useProgram(this.currentProgram_),this.applyFrameState(t),this.applyUniforms(t)},e.prototype.drawElements=function(t,e){var n=this.getGL(),i=n.UNSIGNED_INT,r=e-t,o=4*t;n.drawElements(n.TRIANGLES,r,i,o)},e.prototype.finalizeDraw=function(t){for(var e=0;ethis.size_[0]||e>=this.size_[1])return Df[0]=0,Df[1]=0,Df[2]=0,Df[3]=0,Df;this.readAll();var n=Math.floor(t)+(this.size_[1]-Math.floor(e)-1)*this.size_[0];return Df[0]=this.data_[4*n],Df[1]=this.data_[4*n+1],Df[2]=this.data_[4*n+2],Df[3]=this.data_[4*n+3],Df},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}(),jf=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;r0&&(this.newTiles_=!0):s.setState(Ja)),this.isDrawableTile(s)||(s=s.getInterimTile()),s},e.prototype.loadedTileCallback=function(e,n,i){return!!this.isDrawableTile(i)&&t.prototype.loadedTileCallback.call(this,e,n,i)},e.prototype.prepareFrame=function(t){return!!this.getLayer().getSource()},e.prototype.renderFrame=function(t,e){var n=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=n.extent&&Cn(n.extent);v&&(y=ge(y,Cn(n.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 F=this.createLoadedTileFinder(p,o,R),O=this.tmpExtent,I=this.tmpTileRange_;this.newTiles_=!1;for(var A=P.minX;A<=P.maxX;++A)for(var M=P.minY;M<=P.maxY;++M){var L=this.getTile(g,A,M,t);if(this.isDrawableTile(L)){var k=i(this);if(L.getState()==Ja){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 G=d.getTileCoordChildTileRange(L.tileCoord,I,O),j=!1;G&&(j=F(g+1,G)),j||d.forEachTileCoordParentTileRange(L.tileCoord,F,I,O)}var N=_/a;Ft(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/x,1/x,l,-w/2,-S/2);var z=function(t){return Hi?It(t):(mr||(mr=Qi(1,1).canvas),mr.style.transform=It(t),mr.style.transform)}(this.pixelTransform);this.useContainer(e,z,n.opacity);var B=this.context,U=B.canvas;Ot(this.inversePixelTransform,this.pixelTransform),Ft(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,K=Object.keys(R).map(Number);K.sort(h),1!==n.opacity||this.containerReused&&!p.getOpaque(t.viewState.projection)?(X=[],W=[]):K=K.reverse();for(var Y=K.length-1;Y>=0;--Y){var Z=K[Y],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])/_]),nt=x*p.getGutterForProjection(o),it=R[Z];for(var rt in it){var ot=(L=it[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-(A=Math.round(at)),ct=ut-(M=Math.round(lt)),pt=g===Z;if(!(D=pt&&1!==L.getAlpha(i(this),t.time)))if(X){B.save(),V=[A,M,A+ht,M,A+ht,M+ct,A,M+ct];for(var ft=0,dt=X.length;ft0||n&&0===o)}))),17),!t.origins)for(var o=0,a=this.resolutions_.length-1;o=this.minZoom;){if(e(s,2===this.zoomFactor_?Ph(r=Math.floor(r/2),r,o=Math.floor(o/2),o,n):this.getTileRangeForExtentAndZ(a,s,n)))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,n){if(t[0]0?i:Math.max(a/s[0],o/s[1]),u=r+1,h=new Array(u),c=0;cn||n>e.getMaxZoom())return!1;var o,a=e.getExtent();return!(o=a?e.getTileRangeForExtentAndZ(a,n):e.getFullTileRange(n))||o.containsXY(i,r)}(t,i)?t:null},n.prototype.clear=function(){this.tileCache.clear()},n.prototype.refresh=function(){this.clear(),t.prototype.refresh.call(this)},n.prototype.updateCacheSize=function(t,e){var n=this.getTileCacheForProjection(e);t>n.highWaterMark&&(n.highWaterMark=t)},n.prototype.useTile=function(t,e,n,i){},n}(La),ud=function(t){function e(e,n){var i=t.call(this,e)||this;return i.tile=n,i}return sd(e,t),e}(s);function hd(t,e){var n=/\{z\}/g,i=/\{x\}/g,r=/\{y\}/g,o=/\{-y\}/g;return function(a,s,l){return a?t.replace(n,a[0].toString()).replace(i,a[1].toString()).replace(r,a[2].toString()).replace(o,(function(){var t=a[0],n=e.getFullTileRange(t);return nt(n,55),(n.getHeight()-a[2]-1).toString()})):void 0}}function cd(t){return 1===t.length?t[0]:function(e,n,i){if(e){var r=Oe(Ch(e),t.length);return t[r](e,n,i)}}}var pd,fd=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),dd=function(t){function e(n){var i=t.call(this,{attributions:n.attributions,cacheSize:n.cacheSize,opaque:n.opaque,projection:n.projection,state:n.state,tileGrid:n.tileGrid,tilePixelRatio:n.tilePixelRatio,wrapX:n.wrapX,transition:n.transition,key:n.key,attributionsCollapsible:n.attributionsCollapsible,zDirection:n.zDirection})||this;return i.generateTileUrlFunction_=i.tileUrlFunction===e.prototype.tileUrlFunction,i.tileLoadFunction=n.tileLoadFunction,n.tileUrlFunction&&(i.tileUrlFunction=n.tileUrlFunction.bind(i)),i.urls=null,n.urls?i.setUrls(n.urls):n.url&&i.setUrl(n.url),i.tileLoadingKeys_={},i}return fd(e,t),e.prototype.getTileLoadFunction=function(){return this.tileLoadFunction},e.prototype.getTileUrlFunction=function(){return this.tileUrlFunction},e.prototype.getUrls=function(){return this.urls},e.prototype.handleTileChange=function(t){var e,n=t.target,r=i(n),o=n.getState();o==qa?(this.tileLoadingKeys_[r]=!0,e=Qf):r in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[r],e=o==Qa?td:o==Ja?$f:void 0),null!=e&&this.dispatchEvent(new ud(e,n))},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=[],n=/\{([a-z])-([a-z])\}/.exec(t);if(n){var i=n[1].charCodeAt(0),r=n[2].charCodeAt(0),o=void 0;for(o=i;o<=r;++o)e.push(t.replace(n[0],String.fromCharCode(o)));return e}if(n=/\{(\d+)-(\d+)\}/.exec(t)){for(var a=parseInt(n[2],10),s=parseInt(n[1],10);s<=a;s++)e.push(t.replace(n[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 n=t.length,i=new Array(n),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 n=Math.min(e[0][0],e[1][0],e[2][0]);Math.max(e[0][0],e[1][0],e[2][0])-n.5&&h<1,f=!1;if(l>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_)f=ve(Ut([t,e,n,i]))/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]+n[0])/2,(t[1]+n[1])/2],_=this.transformInv_(g),y=void 0;if(p)y=(Oe(r[0],c)+Oe(a[0],c))/2-Oe(_[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]-n[0])<=Math.abs(t[1]-n[1])){var m=[(e[0]+n[0])/2,(e[1]+n[1])/2],x=this.transformInv_(m),w=[(i[0]+t[0])/2,(i[1]+t[1])/2],S=this.transformInv_(w);this.addQuad_(t,e,m,w,r,o,x,S,l-1),this.addQuad_(w,m,n,i,S,x,a,s,l-1)}else{var C=[(t[0]+e[0])/2,(t[1]+e[1])/2],b=this.transformInv_(C),E=[(n[0]+i[0])/2,(n[1]+i[1])/2],T=this.transformInv_(E);this.addQuad_(t,C,E,i,r,b,T,s,l-1),this.addQuad_(C,e,n,E,b,o,a,T,l-1)}return}}if(p){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}0==(11&d)&&this.addTriangle_(t,n,i,r,a,s),0==(14&d)&&this.addTriangle_(t,n,e,r,a,o),d&&(0==(13&d)&&this.addTriangle_(e,i,t,o,s,r),0==(7&d)&&this.addTriangle_(e,i,n,o,s,a))}},t.prototype.calculateSourceExtent=function(){var t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach((function(e,n,i){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}(),xd={imageSmoothingEnabled:!1,msImageSmoothingEnabled:!1};function wd(t,e,n,i,r){t.beginPath(),t.moveTo(0,0),t.lineTo(e,n),t.lineTo(i,r),t.closePath(),t.save(),t.clip(),t.fillRect(0,0,Math.max(e,i)+1,Math.max(n,r)),t.restore()}function Sd(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function Cd(t,e,n,i){var r=_n(n,e,t),o=hn(e,i,n),a=e.getMetersPerUnit();void 0!==a&&(o*=a);var s=t.getMetersPerUnit();void 0!==s&&(o/=s);var l=t.getExtent();if(!l||Kt(l,r)){var u=hn(t,o,r)/o;isFinite(u)&&u>0&&(o/=u)}return o}function bd(t,e,n,i,r,o,a,s,l,u,h,c){var p=Qi(Math.round(n*t),Math.round(n*e));if(m(p,c),0===l.length)return p.canvas;function f(t){return Math.round(t*n)/n}p.scale(n,n),p.globalCompositeOperation="lighter";var d=[1/0,1/0,-1/0,-1/0];l.forEach((function(t,e,n){ie(d,t.extent)}));var g=ve(d),_=de(d),y=Qi(Math.round(n*g/i),Math.round(n*_/i));m(y,c);var v=n/i;l.forEach((function(t,e,n){var i=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,i*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,n=0;nr&&(r=a,i=o)}if(0===r)return null;var s=t[i];t[i]=t[n],t[n]=s;for(var l=n+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===pd){var t=document.createElement("canvas").getContext("2d");t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",wd(t,4,5,4,0),wd(t,4,5,0,5);var e=t.getImageData(0,0,3,3).data;pd=Sd(e,0)||Sd(e,4)||Sd(e,8)}return pd}()||c===xd){p.moveTo(S,C);for(var F=m-S,O=w-C,I=0;I<4;I++)p.lineTo(S+f((I+1)*F/4),C+f(I*O/3)),3!=I&&p.lineTo(S+f((I+1)*F/4),C+f((I+1)*O/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(i/n,-i/n),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,n){var i=t.target,r=(i[0][0]-x[0])/o,a=-(i[0][1]-x[1])/o,s=(i[1][0]-x[0])/o,l=-(i[1][1]-x[1])/o,u=(i[2][0]-x[0])/o,h=-(i[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 Ed=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Td=function(t){function e(e,n,i,r,o,a,s,l,u,h,c,p){var f=t.call(this,o,Ha)||this;f.renderEdges_=void 0!==c&&c,f.contextOptions_=p,f.pixelRatio_=s,f.gutter_=l,f.canvas_=null,f.sourceTileGrid_=n,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=$a,f;var v=e.getExtent();v&&(_=_?ge(_,v):v);var m=r.getResolution(f.wrappedTileCoord_[0]),x=function(t,e,n,i){var r=ce(n),o=Cd(t,e,r,i);return(!isFinite(o)||o<=0)&&se(n,(function(n){return o=Cd(t,e,n,i),isFinite(o)&&o>0})),o}(e,i,y,m);if(!isFinite(x)||x<=0)return f.state=$a,f;var w=void 0!==h?h:.5;if(f.triangulation_=new md(e,i,y,_,x*w,m),0===f.triangulation_.getTriangles().length)return f.state=$a,f;f.sourceZ_=n.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=n.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=$a)}else f.state=$a;return f}return Ed(e,t),e.prototype.getImage=function(){return this.canvas_},e.prototype.reproject_=function(){var t=[];if(this.sourceTiles_.forEach(function(e,n,i){e&&e.getState()==Ja&&t.push({extent:this.sourceTileGrid_.getTileCoordExtent(e.tileCoord),image:e.getImage()})}.bind(this)),this.sourceTiles_.length=0,0===t.length)this.state=Qa;else{var e=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(e),i="number"==typeof n?n:n[0],r="number"==typeof n?n:n[1],o=this.targetTileGrid_.getResolution(e),a=this.sourceTileGrid_.getResolution(this.sourceZ_),s=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=bd(i,r,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,s,this.triangulation_,t,this.gutter_,this.renderEdges_,this.contextOptions_),this.state=Ja}this.changed()},e.prototype.load=function(){if(this.state==Ha){this.state=qa,this.changed();var t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(function(e,n,i){var r=e.getState();if(r==Ha||r==qa){t++;var o=N(e,E,(function(n){var i=e.getState();i!=Ja&&i!=Qa&&i!=$a||(B(o),0===--t&&(this.unlistenSources_(),this.reproject_()))}),this);this.sourcesListenerKeys_.push(o)}}.bind(this)),this.sourceTiles_.forEach((function(t,e,n){t.getState()==Ha&&t.load()})),0===t&&setTimeout(this.reproject_.bind(this),0)}},e.prototype.unlistenSources_=function(){this.sourcesListenerKeys_.forEach(B),this.sourcesListenerKeys_=null},e}(os),Pd=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Rd=function(t){function e(e){var n=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:Fd,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 n.crossOrigin=void 0!==e.crossOrigin?e.crossOrigin:null,n.tileClass=void 0!==e.tileClass?e.tileClass:ss,n.tileCacheForProjection={},n.tileGridForProjection={},n.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,n.contextOptions_=!1===e.imageSmoothing?xd:void 0,n.renderReprojectionEdges_=!1,n}return Pd(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 n=this.getTileCacheForProjection(t);for(var i in this.tileCache.expireCache(this.tileCache==n?e:{}),this.tileCacheForProjection){var r=this.tileCacheForProjection[i];r.expireCache(r==n?e:{})}},e.prototype.getContextOptions=function(){return this.contextOptions_},e.prototype.getGutterForProjection=function(t){return this.getProjection()&&t&&!fn(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&&!fn(this.getProjection(),e))&&t.prototype.getOpaque.call(this,e)},e.prototype.getTileGridForProjection=function(t){var e=this.getProjection();if(!this.tileGrid||e&&!fn(e,t)){var n=i(t);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=id(t)),this.tileGridForProjection[n]}return this.tileGrid},e.prototype.getTileCacheForProjection=function(t){var e=this.getProjection();if(!e||fn(e,t))return this.tileCache;var n=i(t);return n in this.tileCacheForProjection||(this.tileCacheForProjection[n]=new Eh(this.tileCache.highWaterMark)),this.tileCacheForProjection[n]},e.prototype.createTile_=function(t,e,n,i,r,o){var a=[t,e,n],s=this.getTileCoordForTileUrlFunction(a,r),l=s?this.tileUrlFunction(s,i,r):void 0,u=new this.tileClass(a,void 0!==l?Ha:$a,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,n,i,r){var o=this.getProjection();if(o&&r&&!fn(o,r)){var a=this.getTileCacheForProjection(r),s=[t,e,n],l=void 0,u=Sh(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 Td(o,c,r,p,s,f,this.getTilePixelRatio(i),this.getGutter(),function(t,e,n,i){return this.getTileInternal(t,e,n,i,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,n,i,o||r)},e.prototype.getTileInternal=function(t,e,n,i,r){var o=null,a=wh(t,e,n),s=this.getKey();if(this.tileCache.containsKey(a)){if((o=this.tileCache.get(a)).key!=s){var l=o;o=this.createTile_(t,e,n,i,r,s),l.getState()==Ha?o.interimTile=l.interimTile:o.interimTile=l,o.refreshInterimChain(),this.tileCache.replace(a,o)}}else o=this.createTile_(t,e,n,i,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 n=un(t);if(n){var r=i(n);r in this.tileGridForProjection||(this.tileGridForProjection[r]=e)}},e}(dd);function Fd(t,e){t.getImage().src=e}var Od=1,Id=2,Ad=4,Md=8,Ld=16,kd=31,Dd={};function Gd(t){if("number"==typeof t)return Od;if("boolean"==typeof t)return Md;if("string"==typeof t)return e=t,Gi.test(e)&&(e=ji(e)),Di.test(e)||0===e.indexOf("rgba(")||0===e.indexOf("rgb(")?Ad|Id:Id;var e;if(!Array.isArray(t))throw new Error("Unhandled value type: "+JSON.stringify(t));var n=t;if(n.every((function(t){return"number"==typeof t})))return 3===n.length||4===n.length?Ad|Ld:Ld;if("string"!=typeof n[0])throw new Error("Expected an expression operator but received: "+JSON.stringify(n));var i=Dd[n[0]];if(void 0===i)throw new Error("Unrecognized expression operator: "+JSON.stringify(n));return i.getReturnType(n.slice(1))}function jd(t){var e=t.toString();return-1===e.indexOf(".")?e+".0":e}function Nd(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(jd).join(", ")+")"}function zd(t,e){return void 0===t.stringLiteralsMap[e]&&(t.stringLiteralsMap[e]=Object.keys(t.stringLiteralsMap).length),t.stringLiteralsMap[e]}function Bd(t,e,n){if(Array.isArray(e)&&"string"==typeof e[0]){var i=Dd[e[0]];if(void 0===i)throw new Error("Unrecognized expression operator: "+JSON.stringify(e));return i.toGlsl(t,e.slice(1),n)}return(Gd(e)&Od)>0?jd(e):(Gd(e)&Md)>0?e.toString():(Gd(e)&Id)>0&&(void 0===n||n==Id)?function(t,e){return jd(zd(t,e))}(t,e.toString()):(Gd(e)&Ad)>0&&(void 0===n||n==Ad)?((r=zi(e).slice()).length<4&&r.push(1),Nd(r.map((function(t,e){return e<3?t/255:t})))):(Gd(e)&Ld)>0?Nd(e):void 0;var r}function Ud(t){if(!(Gd(t)&Od))throw new Error("A numeric value was expected, got "+JSON.stringify(t)+" instead")}function Xd(t){for(var e=0;ee)throw new Error("At most "+e+" arguments were expected, got "+t.length+" instead")}function Hd(t){if(t.length%2!=0)throw new Error("An even amount of arguments was expected, got "+t+" instead")}function qd(t,e){if(n=e,Math.log2(n)%1!=0)throw new Error("Could not infer only one type from the following expression: "+JSON.stringify(t));var n}function Jd(t){return{getReturnType:function(t){return Md},toGlsl:function(e,n){Kd(n,2);for(var i=kd,r=0;r"]={getReturnType:function(t){return Md},toGlsl:function(t,e){return Kd(e,2),Xd(e),"("+Bd(t,e[0])+" > "+Bd(t,e[1])+")"}},Dd[">="]={getReturnType:function(t){return Md},toGlsl:function(t,e){return Kd(e,2),Xd(e),"("+Bd(t,e[0])+" >= "+Bd(t,e[1])+")"}},Dd["<"]={getReturnType:function(t){return Md},toGlsl:function(t,e){return Kd(e,2),Xd(e),"("+Bd(t,e[0])+" < "+Bd(t,e[1])+")"}},Dd["<="]={getReturnType:function(t){return Md},toGlsl:function(t,e){return Kd(e,2),Xd(e),"("+Bd(t,e[0])+" <= "+Bd(t,e[1])+")"}},Dd["=="]=Jd("=="),Dd["!="]=Jd("!="),Dd["!"]={getReturnType:function(t){return Md},toGlsl:function(t,e){return Kd(e,1),Vd(e[0]),"(!"+Bd(t,e[0])+")"}},Dd.all=Qd("&&"),Dd.any=Qd("||"),Dd.between={getReturnType:function(t){return Md},toGlsl:function(t,e){Kd(e,3),Xd(e);var n=Bd(t,e[1]),i=Bd(t,e[2]),r=Bd(t,e[0]);return"("+r+" >= "+n+" && "+r+" <= "+i+")"}},Dd.array={getReturnType:function(t){return Ld},toGlsl:function(t,e){Yd(e,2),Zd(e,4),Xd(e);var n=e.map((function(e){return Bd(t,e,Od)}));return"vec"+e.length+"("+n.join(", ")+")"}},Dd.color={getReturnType:function(t){return Ad},toGlsl:function(t,e){Yd(e,3),Zd(e,4),Xd(e);var n=e;3===e.length&&n.push(1);var i=e.map((function(e,n){return Bd(t,e,Od)+(n<3?" / 255.0":"")}));return"vec"+e.length+"("+i.join(", ")+")"}},Dd.interpolate={getReturnType:function(t){for(var e=Ad|Od,n=3;n=1;l-=2){s="("+o+" == "+Bd(t,e[l])+" ? "+Bd(t,e[l+1],r)+" : "+(s||a)+")"}return s}},Dd.case={getReturnType:function(t){for(var e=kd,n=1;n=0;o-=2){s="("+Bd(t,e[o])+" ? "+Bd(t,e[o+1],r)+" : "+(s||a)+")"}return s}};var $d=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,n){return this.varyings.push({name:t,type:e,expression:n}),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",n=this.attributes,i=this.varyings;return t&&(n=n.concat("vec4 a_hitColor"),i=i.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"+n.map((function(t){return"attribute "+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 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"+i.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;":"",n=this.varyings;return t&&(n=n.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"+n.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 tg=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),eg=function(t){function e(e){var n=this,i=m({},e);return(n=t.call(this,i)||this).parseResult_=function(t){var e=t.symbol,n=void 0!==e.size?e.size:1,i=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=Bd(l,n,Ld|Od),h=Bd(l,o,Ld),c=Bd(l,r,Ld),p=Bd(l,s,Od),f={inFragmentShader:!0,variables:l.variables,attributes:[],stringLiteralsMap:l.stringLiteralsMap},d=Bd(f,i,Ad),g=Bd(f,a,Od),_="1.0",y="vec2("+Bd(f,n,Ld|Od)+").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 $d).setSizeExpression("vec2("+u+")").setRotationExpression(p).setSymbolOffsetExpression(h).setTextureCoordinateExpression(c).setSymbolRotateWithView(!!e.rotateWithView).setColorExpression("vec4("+d+".rgb, "+d+".a * "+g+" * "+_+")");if(t.filter){var w=Bd(f,t.filter,Md);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 n=t.variables[e];return"string"==typeof n&&(n=zd(l,n)),void 0!==n?n:-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,n){var i=n[t];return"string"==typeof i&&(i=zd(l,i)),void 0!==i?i:-9999999}}})),uniforms:S}}(e.style),n.hitDetectionDisabled_=!!e.disableHitDetection,n}return tg(e,t),e.prototype.createRenderer=function(){return new Bf(this,{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}(Zr),ng=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();var ig=function(t){function e(e){var n=this,r=void 0!==e.hidpi&&e.hidpi;return(n=t.call(this,{cacheSize:e.cacheSize,crossOrigin:"anonymous",imageSmoothing:e.imageSmoothing,opaque:!0,projection:un("EPSG:3857"),reprojectionErrorThreshold:e.reprojectionErrorThreshold,state:Wr,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:r?2:1,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition})||this).hidpi_=r,n.culture_=void 0!==e.culture?e.culture:"en-us",n.maxZoom_=void 0!==e.maxZoom?e.maxZoom:-1,n.apiKey_=e.key,n.imagerySet_=e.imagerySet,function(t,e,n,r){var o=document.createElement("script"),a="olc_"+i(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(),n&&n()}),1e4);window[a]=function(t){clearTimeout(l),s(),e(t)},document.getElementsByTagName("head")[0].appendChild(o)}("https://dev.virtualearth.net/REST/v1/Imagery/Metadata/"+n.imagerySet_+"?uriScheme=https&include=ImageryProviders&key="+n.apiKey_+"&c="+n.culture_,n.handleImageryMetadataResponse.bind(n),void 0,"jsonp"),n}return ng(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],n=-1==this.maxZoom_?e.zoomMax:this.maxZoom_,i=ad(this.getProjection()),r=this.hidpi_?2:1,o=e.imageWidth==e.imageHeight?e.imageWidth/r:[e.imageWidth/r,e.imageHeight/r],a=rd({extent:i,minZoom:e.zoomMin,maxZoom:n,tileSize:o});this.tileGrid=a;var s=this.culture_,l=this.hidpi_;if(this.tileUrlFunction=cd(e.imageUrlSubdomains.map((function(t){var n=[0,0,0],i=e.imageUrl.replace("{subdomain}",t).replace("{culture}",s);return function(t,e,r){if(t){xh(t[0],t[1],t[2],n);var o=i;return l&&(o+="&dpi=d1&device=mobile"),o.replace("{quadkey}",function(t){var e,n,i=t[0],r=new Array(i),o=1<>=1;return r.join("")}(n))}}}))),e.imageryProviders){var u=dn(un("EPSG:4326"),this.getProjection());this.setAttributions(function(t){var n=[],i=t.viewState,r=this.getTileGrid(),o=r.getZForResolution(i.resolution,this.zDirection),a=r.getTileCoordForCoordAndZ(i.center,o)[0];return e.imageryProviders.map((function(e){for(var i=!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)){i=!0;break}}}i&&n.push(e.attribution)})),n.push('Terms of Use'),n}.bind(this))}this.setState(Vr)}else this.setState(Kr)},e}(Rd),rg=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),og=function(t){function e(e){var n=e||{},i=void 0!==n.projection?n.projection:"EPSG:3857",r=void 0!==n.tileGrid?n.tileGrid:rd({extent:ad(i),maxResolution:n.maxResolution,maxZoom:n.maxZoom,minZoom:n.minZoom,tileSize:n.tileSize});return t.call(this,{attributions:n.attributions,cacheSize:n.cacheSize,crossOrigin:n.crossOrigin,imageSmoothing:n.imageSmoothing,opaque:n.opaque,projection:i,reprojectionErrorThreshold:n.reprojectionErrorThreshold,tileGrid:r,tileLoadFunction:n.tileLoadFunction,tilePixelRatio:n.tilePixelRatio,tileUrlFunction:n.tileUrlFunction,url:n.url,urls:n.urls,wrapX:void 0===n.wrapX||n.wrapX,transition:n.transition,attributionsCollapsible:n.attributionsCollapsible,zDirection:n.zDirection})||this}return rg(e,t),e}(Rd);function ag(t,e){var n=[];Object.keys(e).forEach((function(t){null!==e[t]&&void 0!==e[t]&&n.push(t+"="+encodeURIComponent(e[t]))}));var i=n.join("&");return(t=-1===(t=t.replace(/[?&]$/,"")).indexOf("?")?t+"?":t+"&")+i}var sg="carmentaserver",lg="geoserver",ug="mapserver",hg="qgis",cg=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),pg=function(t){function e(e){var n,i=e||{};n=void 0!==i.attributions?i.attributions:['© OpenStreetMap contributors.'];var r=void 0!==i.crossOrigin?i.crossOrigin:"anonymous",o=void 0!==i.url?i.url:"https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png";return t.call(this,{attributions:n,cacheSize:i.cacheSize,crossOrigin:r,imageSmoothing:i.imageSmoothing,opaque:void 0===i.opaque||i.opaque,maxZoom:void 0!==i.maxZoom?i.maxZoom:19,reprojectionErrorThreshold:i.reprojectionErrorThreshold,tileLoadFunction:i.tileLoadFunction,url:o,wrapX:i.wrapX,attributionsCollapsible:!1})||this}return cg(e,t),e}(og),fg=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),dg=function(t){function e(e){var n=this,i=e||{},r=i.params||{},o=!("TRANSPARENT"in r)||r.TRANSPARENT;return(n=t.call(this,{attributions:i.attributions,cacheSize:i.cacheSize,crossOrigin:i.crossOrigin,imageSmoothing:i.imageSmoothing,opaque:!o,projection:i.projection,reprojectionErrorThreshold:i.reprojectionErrorThreshold,tileClass:i.tileClass,tileGrid:i.tileGrid,tileLoadFunction:i.tileLoadFunction,url:i.url,urls:i.urls,wrapX:void 0===i.wrapX||i.wrapX,transition:i.transition})||this).gutter_=void 0!==i.gutter?i.gutter:0,n.params_=r,n.v13_=!0,n.serverType_=i.serverType,n.hidpi_=void 0===i.hidpi||i.hidpi,n.tmpExtent_=[1/0,1/0,-1/0,-1/0],n.updateV13_(),n.setKey(n.getKeyForParams_()),n}return fg(e,t),e.prototype.getFeatureInfoUrl=function(t,e,n,i){var r=un(n),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=Li(a.getTileSize(l[0]),this.tmpSize),p=this.gutter_;0!==p&&(c=Ai(c,p,this.tmpSize),h=Xt(h,u*p,h)),o&&o!==r&&(u=Cd(o,r,t,u),h=function(t,e,n,i){return we(t,gn(e,n),void 0,i)}(h,r,o),t=_n(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_,i);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 n={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){var i=this.params_.LAYERS;if(!(!Array.isArray(i)||1===i.length))return;n.LAYER=i}if(void 0!==t){var r=this.getProjection()?this.getProjection().getMetersPerUnit():1;n.SCALE=t*r*39.37*(25.4/.28)}return m(n,e),ag(this.urls[0],n)}},e.prototype.getGutter=function(){return this.gutter_},e.prototype.getParams=function(){return this.params_},e.prototype.getRequestUrl_=function(t,e,n,i,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!=i)switch(this.serverType_){case lg:var s=90*i+.5|0;"FORMAT_OPTIONS"in o?o.FORMAT_OPTIONS+=";dpi:"+s:o.FORMAT_OPTIONS="dpi:"+s;break;case ug:o.MAP_RESOLUTION=90*i;break;case sg:case hg:o.DPI=90*i;break;default:nt(!1,52)}var l,u=r.getAxisOrientation(),h=n;if(this.v13_&&"ne"==u.substr(0,2)){var c=void 0;c=n[0],h[0]=n[1],h[1]=c,c=n[2],h[2]=n[3],h[3]=c}if(o.BBOX=h.join(","),1==a.length)l=a[0];else l=a[Oe(Ch(t),a.length)];return ag(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 n in this.params_)e[t++]=n+"-"+this.params_[n];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_=function(t,e){for(var n=(""+t).split("."),i=(""+e).split("."),r=0;ra)return 1;if(a>o)return-1}return 0}(t,"1.3")>=0},e.prototype.tileUrlFunction=function(t,e,n){var i=this.getTileGrid();if(i||(i=this.getTileGridForProjection(n)),!(i.getResolutions().length<=t[0])){1==e||this.hidpi_&&void 0!==this.serverType_||(e=1);var r=i.getResolution(t[0]),o=i.getTileCoordExtent(t,this.tmpExtent_),a=Li(i.getTileSize(t[0]),this.tmpSize),s=this.gutter_;0!==s&&(a=Ai(a,s,this.tmpSize),o=Xt(o,r*s,o)),1!=e&&(a=Mi(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,n,l)}},e}(Rd);X.unByKey=W;let gg={Control:$s,Zoom:ol,Attribution:el,ScaleLine:fl,LayerSwitcher:Rh},_g={GeoJSON:jh,KML:zc},yg={Group:_s,Tile:vd,Vector:Ia,WebGLPoints:eg,Heatmap:Yf},vg={toLonLat:function(t,e){var n=_n(t,void 0!==e?e:"EPSG:3857","EPSG:4326"),i=n[0];return(i<-180||i>180)&&(n[0]=Oe(i+180,360)-180),n},fromLonLat:function(t,e){return _n(t,"EPSG:4326",void 0!==e?e:"EPSG:3857")}},mg={LineString:Ti,Point:$n,MultiPoint:Su},xg={Icon:Ca,Style:br,Text:Ir,Stroke:Pi,Fill:wi,Circle:Cr},wg={OSM:pg,XYZ:og,TileWMS:dg,BingMaps:ig,Vector:Za};t.Collection=et,t.Feature=rt,t.Map=vh,t.Observable=X,t.View=Ys,t.control=gg,t.format=_g,t.geom=mg,t.interaction=_h,t.layer=yg,t.proj=vg,t.source=wg,t.sphere=Je,t.style=xg,Object.defineProperty(t,"__esModule",{value:!0})})); //# sourceMappingURL=ol-custom.js.map