!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ol={})}(this,(function(t){"use strict";function e(){return function(){throw new Error("Unimplemented abstract method.")}()}var n=0;function r(t){return t.ol_uid||(t.ol_uid=String(++n))}var i,o=(i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},i(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),s=function(t){function e(e){var n=this,r="Assertion failed. See https://openlayers.org/en/"+("v"+"6.9.0".split("-")[0])+"/doc/errors/#"+e+" for details.";return(n=t.call(this,r)||this).code=e,n.name="AssertionError",n.message=r,n}return o(e,t),e}(Error),a=function(){function t(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}return t.prototype.preventDefault=function(){this.defaultPrevented=!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 r=t.length;if(t[0]<=e)return 0;if(e<=t[r-1])return r-1;var i=void 0;if(n>0){for(i=1;i0?i-1:i:t[i-1]-e0)},e.prototype.removeEventListener=function(t,e){var n=this.listeners_&&this.listeners_[t];if(n){var r=n.indexOf(e);-1!==r&&(this.pendingRemovals_&&t in this.pendingRemovals_?(n[r]=v,++this.pendingRemovals_[t]):(n.splice(r,1),0===n.length&&delete this.listeners_[t]))}},e}(u),T="change",b="error",R="contextmenu",P="click",O="dblclick",F="dragenter",I="dragover",M="drop",L="keydown",A="keypress",D="load",k="resize",j="touchmove",G="wheel";function N(t,e,n,r,i){if(r&&r!==t&&(n=n.bind(r)),i){var o=n;n=function(){t.removeEventListener(e,n),o.apply(this,arguments)}}var s={target:t,type:e,listener:n};return t.addEventListener(e,n),s}function z(t,e,n,r){return N(t,e,n,r,!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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),V=function(t){function e(){var e=t.call(this)||this;return e.on=e.onInternal,e.once=e.onceInternal,e.un=e.unInternal,e.revision_=0,e}return U(e,t),e.prototype.changed=function(){++this.revision_,this.dispatchEvent(T)},e.prototype.getRevision=function(){return this.revision_},e.prototype.onInternal=function(t,e){if(Array.isArray(t)){for(var n=t.length,r=new Array(n),i=0;i0;)this.pop()},e.prototype.extend=function(t){for(var e=0,n=t.length;ei&&(l|=Zt),ao&&(l|=Kt),l===Wt&&(l=Yt),l}function oe(){return[1/0,1/0,-1/0,-1/0]}function se(t,e,n,r,i){return i?(i[0]=t,i[1]=e,i[2]=n,i[3]=r,i):[t,e,n,r]}function ae(t){return se(1/0,1/0,-1/0,-1/0,t)}function le(t,e){var n=t[0],r=t[1];return se(n,r,n,r,e)}function ue(t,e,n,r,i){return fe(ae(i),t,e,n,r)}function he(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function ce(t,e){return e[0]t[2]&&(t[2]=e[2]),e[1]t[3]&&(t[3]=e[3]),t}function pe(t,e){e[0]t[2]&&(t[2]=e[0]),e[1]t[3]&&(t[3]=e[1])}function fe(t,e,n,r,i){for(;ne[0]?r[0]=t[0]:r[0]=e[0],t[1]>e[1]?r[1]=t[1]:r[1]=e[1],t[2]=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function Pe(t){return t[2]1)for(var o=t[2]-t[0],s=t[3]-t[1],a=0;a1?(n=i,r=o):l>0&&(n+=s*l,r+=a*l)}return De(t,e,n,r)}function De(t,e,n,r){var i=n-t,o=r-e;return i*i+o*o}function ke(t){return 180*t/Math.PI}function je(t){return t*Math.PI/180}function Ge(t,e){var n=t%e;return n*e<0?n+e:n}function Ne(t,e,n){return t+n*(e-t)}var ze=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Be=6378137,Ue=Math.PI*Be,Ve=[-Ue,-Ue,Ue,Ue],Xe=[-180,-85,180,85],We=Be*Math.log(Math.tan(Math.PI/2)),Ye=function(t){function e(e){return t.call(this,{code:e,units:St.METERS,extent:Ve,global:!0,worldExtent:Xe,getPointResolution:function(t,e){return t/Me(e[1]/Be)}})||this}return ze(e,t),e}(Fe),Ke=[new Ye("EPSG:3857"),new Ye("EPSG:102100"),new Ye("EPSG:102113"),new Ye("EPSG:900913"),new Ye("http://www.opengis.net/def/crs/EPSG/0/3857"),new Ye("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Ze(t,e,n){var r=t.length,i=n>1?n:2,o=e;void 0===o&&(o=i>2?t.slice():new Array(r));for(var s=0;sWe?a=We:a<-We&&(a=-We),o[s+1]=a}return o}function He(t,e,n){var r=t.length,i=n>1?n:2,o=e;void 0===o&&(o=i>2?t.slice():new Array(r));for(var s=0;ss)return 1;if(s>o)return-1}return 0}function cn(t,e){var n,r,i=t[0],o=t[1],s=e[0],a=e[1],l=s[0],u=s[1],h=a[0],c=a[1],p=h-l,f=c-u,d=0===p&&0===f?0:(p*(i-l)+f*(o-u))/(p*p+f*f||0);return d<=0?(n=l,r=u):d>=1?(n=h,r=c):(n=l+d*p,r=u+d*f),[n,r]}function pn(t,e){for(var n=!0,r=t.length-1;r>=0;--r)if(t[r]!=e[r]){n=!1;break}return n}function fn(t,e){var n=Math.cos(e),r=Math.sin(e),i=t[0]*n-t[1]*r,o=t[1]*n+t[0]*r;return t[0]=i,t[1]=o,t}function dn(t,e){var n=t[0]-e[0],r=t[1]-e[1];return n*n+r*r}function gn(t,e){return Math.sqrt(dn(t,e))}function _n(t,e){return dn(t,cn(t,e))}function yn(t,e){if(e.canWrapX()){var n=be(e.getExtent()),r=function(t,e,n){var r=e.getExtent(),i=0;if(e.canWrapX()&&(t[0]r[2])){var o=n||be(r);i=Math.floor((t[0]-r[0])/o)}return i}(t,e,n);r&&(t[0]-=r*n)}return t}function vn(t,e,n){var r;if(void 0!==e){for(var i=0,o=t.length;i1)a=n;else{if(p>0){for(var f=0;fi&&(i=u),o=a,s=l}return i}function Hn(t,e,n,r,i){for(var o=0,s=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+r;vf&&(h=v,f=m)}f>i&&(l[(h-e)/r]=1,p+r0&&g>f)&&(d<0&&_0&&_>d)?(a=c,l=p):(o[s++]=a,o[s++]=l,u=a,h=l,a=c,l=p)}}return o[s++]=a,o[s++]=l,s}function ir(t,e,n,r,i,o,s,a){for(var l=0,u=n.length;lo&&(u-a)*(o-l)-(i-a)*(h-l)>0&&s++:h<=o&&(u-a)*(o-l)-(i-a)*(h-l)<0&&s--,a=u,l=h}return 0!==s}function vr(t,e,n,r,i,o){if(0===n.length)return!1;if(!yr(t,e,n[0],r,i,o))return!1;for(var s=1,a=n.length;sw&&vr(t,e,n,r,u=(c+p)/2,g)&&(x=u,w=S),c=p}return isNaN(x)&&(x=i[o]),s?(s.push(x,g,w),s):[x,g,w]}function xr(t,e,n,r,i){for(var o=[],s=0,a=n.length;s=i[0]&&o[2]<=i[2]||(o[1]>=i[1]&&o[3]<=i[3]||wr(t,e,n,r,(function(t,e){return function(t,e,n){var r=!1,i=ie(t,e),o=ie(t,n);if(i===Yt||o===Yt)r=!0;else{var s=t[0],a=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&Kt&&!(i&Kt)&&(r=(g=p-(f-u)/d)>=s&&g<=l),r||!(o&Zt)||i&Zt||(r=(_=f-(p-l)*d)>=a&&_<=u),r||!(o&Ht)||i&Ht||(r=(g=p-(f-a)/d)>=s&&g<=l),r||!(o&qt)||i&qt||(r=(_=f-(p-s)*d)>=a&&_<=u)}return r}(i,t,e)})))))}function Cr(t,e,n,r,i){if(!function(t,e,n,r,i){return!!(Sr(t,e,n,r,i)||yr(t,e,n,r,i[0],i[1])||yr(t,e,n,r,i[0],i[3])||yr(t,e,n,r,i[2],i[1])||yr(t,e,n,r,i[2],i[3]))}(t,e,n[0],r,i))return!1;if(1===n.length)return!0;for(var o=1,s=n.length;o0}function br(t,e,n,r,i){for(var o=void 0!==i&&i,s=0,a=n.length;s>1)],e))<0?s=r+1:(a=r,l=!i);return l?s:~s}(d,v);m<0?(l=(v-d[-m-2])/(d[-m-1]-d[-m-2]),a=e+(-m-2)*r):a=e+m*r}var x=s>1?s:2,w=o||new Array(x);for(g=0;g>1;i0&&t[1]>0}function $r(t,e,n){return void 0===n&&(n=[0,0]),n[0]=t[0]*e+.5|0,n[1]=t[1]*e+.5|0,n}function ti(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}var ei=function(){function t(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=ti(t.scale),this.displacement_=t.displacement}return t.prototype.clone=function(){var e=this.getScale();return new t({opacity:this.getOpacity(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice()})},t.prototype.getOpacity=function(){return this.opacity_},t.prototype.getRotateWithView=function(){return this.rotateWithView_},t.prototype.getRotation=function(){return this.rotation_},t.prototype.getScale=function(){return this.scale_},t.prototype.getScaleArray=function(){return this.scaleArray_},t.prototype.getDisplacement=function(){return this.displacement_},t.prototype.getAnchor=function(){return e()},t.prototype.getImage=function(t){return e()},t.prototype.getHitDetectionImage=function(){return e()},t.prototype.getPixelRatio=function(t){return 1},t.prototype.getImageState=function(){return e()},t.prototype.getImageSize=function(){return e()},t.prototype.getOrigin=function(){return e()},t.prototype.getSize=function(){return e()},t.prototype.setOpacity=function(t){this.opacity_=t},t.prototype.setRotateWithView=function(t){this.rotateWithView_=t},t.prototype.setRotation=function(t){this.rotation_=t},t.prototype.setScale=function(t){this.scale_=t,this.scaleArray_=ti(t)},t.prototype.listenImageChange=function(t){e()},t.prototype.load=function(){e()},t.prototype.unlistenImageChange=function(t){e()},t}(),ni=ei,ri=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,ii=/^([a-z]*)$|^hsla?\(.*\)$/i;function oi(t){return"string"==typeof t?t:hi(t)}function si(t){var e=document.createElement("div");if(e.style.color=t,""!==e.style.color){document.body.appendChild(e);var n=getComputedStyle(e).color;return document.body.removeChild(e),n}return""}var ai=function(){var t={},e=0;return function(n){var r;if(t.hasOwnProperty(n))r=t[n];else{if(e>=1024){var i=0;for(var o in t)0==(3&i++)&&(delete t[o],--e)}r=function(t){var e,n,r,i,o;ii.exec(t)&&(t=si(t));if(ri.exec(t)){var s=t.length-1,a=void 0;a=s<=4?1:2;var l=4===s||8===s;e=parseInt(t.substr(1+0*a,a),16),n=parseInt(t.substr(1+1*a,a),16),r=parseInt(t.substr(1+2*a,a),16),i=l?parseInt(t.substr(1+3*a,a),16):255,1==a&&(e=(e<<4)+e,n=(n<<4)+n,r=(r<<4)+r,l&&(i=(i<<4)+i)),o=[e,n,r,i/255]}else 0==t.indexOf("rgba(")?ui(o=t.slice(5,-1).split(",").map(Number)):0==t.indexOf("rgb(")?((o=t.slice(4,-1).split(",").map(Number)).push(1),ui(o)):rt(!1,14);return o}(n),t[n]=r,++e}return r}}();function li(t){return Array.isArray(t)?t:ai(t)}function ui(t){return t[0]=Ie(t[0]+.5|0,0,255),t[1]=Ie(t[1]+.5|0,0,255),t[2]=Ie(t[2]+.5|0,0,255),t[3]=Ie(t[3],0,1),t}function hi(t){var e=t[0];e!=(0|e)&&(e=e+.5|0);var n=t[1];n!=(0|n)&&(n=n+.5|0);var r=t[2];return r!=(0|r)&&(r=r+.5|0),"rgba("+e+","+n+","+r+","+(void 0===t[3]?1:t[3])+")"}function ci(t){return Array.isArray(t)?hi(t):t}function pi(t,e,n,r){var i;return n&&n.length?i=n.shift():Ot?i=new OffscreenCanvas(t||300,e||300):(i=document.createElement("canvas")).style.all="unset",t&&(i.width=t),e&&(i.height=e),i.getContext("2d",r)}function fi(t,e){var n=e.parentNode;n&&n.replaceChild(t,e)}function di(t){return t&&t.parentNode?t.parentNode.removeChild(t):null}var gi="ol-hidden",_i="ol-unselectable",yi="ol-control",vi="ol-collapsed",mi=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"),xi=["style","variant","weight","size","lineHeight","family"],wi=function(t){var e=t.match(mi);if(!e)return null;for(var n={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"},r=0,i=xi.length;r=t.maxResolution)return!1;var r=e.zoom;return r>t.minZoom&&r<=t.maxZoom}var Eo=So;function To(t,e,n,r,i){bo(t,e,n||0,r||t.length-1,i||Po)}function bo(t,e,n,r,i){for(;r>n;){if(r-n>600){var o=r-n+1,s=e-n+1,a=Math.log(o),l=.5*Math.exp(2*a/3),u=.5*Math.sqrt(a*l*(o-l)/o)*(s-o/2<0?-1:1);bo(t,e,Math.max(n,Math.floor(e-s*l/o+u)),Math.min(r,Math.floor(e+(o-s)*l/o+u)),i)}var h=t[e],c=n,p=r;for(Ro(t,n,e),i(t[r],h)>0&&Ro(t,n,r);c0;)p--}0===i(t[n],h)?Ro(t,n,p):Ro(t,++p,r),p<=e&&(n=p+1),e<=p&&(r=p-1)}}function Ro(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function Po(t,e){return te?1:0}class Oo{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const n=[];if(!zo(t,e))return n;const r=this.toBBox,i=[];for(;e;){for(let o=0;o=0&&i[e].children.length>this._maxEntries;)this._split(i,e),e--;this._adjustParentBBoxes(r,i,e)}_split(t,e){const n=t[e],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);const o=this._chooseSplitIndex(n,i,r),s=Bo(n.children.splice(o,n.children.length-o));s.height=n.height,s.leaf=n.leaf,Io(n,this.toBBox),Io(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(n,s)}_splitRoot(t,e){this.data=Bo([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Io(this.data,this.toBBox)}_chooseSplitIndex(t,e,n){let r,i=1/0,o=1/0;for(let s=e;s<=n-e;s++){const e=Mo(t,0,s,this.toBBox),a=Mo(t,s,n,this.toBBox),l=Go(e,a),u=ko(e)+ko(a);l=e;r--){const e=t.children[r];Lo(s,t.leaf?i(e):e),a+=jo(s)}return a}_adjustParentBBoxes(t,e,n){for(let r=n;r>=0;r--)Lo(e[r],t)}_condense(t){for(let e,n=t.length-1;n>=0;n--)0===t[n].children.length?n>0?(e=t[n-1].children,e.splice(e.indexOf(t[n]),1)):this.clear():Io(t[n],this.toBBox)}}function Fo(t,e,n){if(!n)return e.indexOf(t);for(let r=0;r=t.minX&&e.maxY>=t.minY}function Bo(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Uo(t,e,n,r,i){const o=[e,n];for(;o.length;){if((n=o.pop())-(e=o.pop())<=r)continue;const s=e+Math.ceil((n-e)/r/2)*r;To(t,s,e,n,i),o.push(e,s,s,n)}}var 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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Xo="renderOrder",Wo=function(t){function e(e){var n=this,r=e||{},i=m({},r);return delete i.style,delete i.renderBuffer,delete i.updateWhileAnimating,delete i.updateWhileInteracting,(n=t.call(this,i)||this).declutter_=void 0!==r.declutter&&r.declutter,n.renderBuffer_=void 0!==r.renderBuffer?r.renderBuffer:100,n.style_=null,n.styleFunction_=void 0,n.setStyle(r.style),n.updateWhileAnimating_=void 0!==r.updateWhileAnimating&&r.updateWhileAnimating,n.updateWhileInteracting_=void 0!==r.updateWhileInteracting&&r.updateWhileInteracting,n}return Vo(e,t),e.prototype.getDeclutter=function(){return this.declutter_},e.prototype.getFeatures=function(e){return t.prototype.getFeatures.call(this,e)},e.prototype.getRenderBuffer=function(){return this.renderBuffer_},e.prototype.getRenderOrder=function(){return this.get(Xo)},e.prototype.getStyle=function(){return this.style_},e.prototype.getStyleFunction=function(){return this.styleFunction_},e.prototype.getUpdateWhileAnimating=function(){return this.updateWhileAnimating_},e.prototype.getUpdateWhileInteracting=function(){return this.updateWhileInteracting_},e.prototype.renderDeclutter=function(t){t.declutterTree||(t.declutterTree=new Oo(9)),this.getRenderer().renderDeclutter(t)},e.prototype.setRenderOrder=function(t){this.set(Xo,t)},e.prototype.setStyle=function(t){this.style_=void 0!==t?t:Ji,this.styleFunction_=null===t?void 0:function(t){var e;if("function"==typeof t)e=t;else{var n;Array.isArray(t)?n=t:(rt("function"==typeof t.getZIndex,41),n=[t]),e=function(){return n}}return e}(this.style_),this.changed()},e}(Eo),Yo={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},Ko=[Yo.FILL],Zo=[Yo.STROKE],Ho=[Yo.BEGIN_PATH],qo=[Yo.CLOSE_PATH],Jo=Yo,Qo=function(){function t(){}return t.prototype.drawCustom=function(t,e,n,r){},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}(),$o=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ts=function(t){function e(e,n,r,i){var o=t.call(this)||this;return o.tolerance=e,o.maxExtent=n,o.pixelRatio=i,o.maxLineWidth=0,o.resolution=r,o.beginGeometryInstruction1_=null,o.beginGeometryInstruction2_=null,o.bufferedMaxExtent_=null,o.instructions=[],o.coordinates=[],o.tmpCoordinate_=[],o.hitDetectionInstructions=[],o.state={},o}return $o(e,t),e.prototype.applyPixelRatio=function(t){var e=this.pixelRatio;return 1==e?t:t.map((function(t){return t*e}))},e.prototype.appendFlatPointCoordinates=function(t,e){for(var n=this.getBufferedMaxExtent(),r=this.tmpCoordinate_,i=this.coordinates,o=i.length,s=0,a=t.length;sc&&(this.instructions.push([Jo.CUSTOM,c,o,t,n,or]),this.hitDetectionInstructions.push([Jo.CUSTOM,c,o,t,r||n,or]));break;case ct:i=t.getFlatCoordinates(),this.coordinates.push(i[0],i[1]),o=this.coordinates.length,this.instructions.push([Jo.CUSTOM,c,o,t,n]),this.hitDetectionInstructions.push([Jo.CUSTOM,c,o,t,r||n])}this.endGeometry(e)},e.prototype.beginGeometry=function(t,e){this.beginGeometryInstruction1_=[Jo.BEGIN_GEOMETRY,e,0,t],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[Jo.BEGIN_GEOMETRY,e,0,t],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)},e.prototype.finish=function(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}},e.prototype.reverseHitDetectionInstructions=function(){var t,e=this.hitDetectionInstructions;e.reverse();var n,r,i=e.length,o=-1;for(t=0;tthis.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=[Jo.SET_FILL_STYLE,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[Jo.SET_STROKE_STYLE,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,r=t.lineCap,i=t.lineDash,o=t.lineDashOffset,s=t.lineJoin,a=t.lineWidth,l=t.miterLimit;(t.currentStrokeStyle!=n||t.currentLineCap!=r||i!=t.currentLineDash&&!g(t.currentLineDash,i)||t.currentLineDashOffset!=o||t.currentLineJoin!=s||t.currentLineWidth!=a||t.currentMiterLimit!=l)&&(void 0!==n&&e.call(this,t),t.currentStrokeStyle=n,t.currentLineCap=r,t.currentLineDash=i,t.currentLineDashOffset=o,t.currentLineJoin=s,t.currentLineWidth=a,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=[Jo.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)},e.prototype.getBufferedMaxExtent=function(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=$t(this.maxExtent),this.maxLineWidth>0)){var t=this.resolution*(this.maxLineWidth+1)/2;Qt(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_},e}(Qo),es=ts,ns=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),rs=function(t){function e(e,n,r,i){var o=t.call(this,e,n,r,i)||this;return o.hitDetectionImage_=null,o.image_=null,o.imagePixelRatio_=void 0,o.anchorX_=void 0,o.anchorY_=void 0,o.height_=void 0,o.opacity_=void 0,o.originX_=void 0,o.originY_=void 0,o.rotateWithView_=void 0,o.rotation_=void 0,o.scale_=void 0,o.width_=void 0,o.declutterImageWithText_=void 0,o}return ns(e,t),e.prototype.drawPoint=function(t,e){if(this.image_){this.beginGeometry(t,e);var n=t.getFlatCoordinates(),r=t.getStride(),i=this.coordinates.length,o=this.appendFlatPointCoordinates(n,r);this.instructions.push([Jo.DRAW_IMAGE,i,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterImageWithText_]),this.hitDetectionInstructions.push([Jo.DRAW_IMAGE,i,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterImageWithText_]),this.endGeometry(e)}},e.prototype.drawMultiPoint=function(t,e){if(this.image_){this.beginGeometry(t,e);var n=t.getFlatCoordinates(),r=t.getStride(),i=this.coordinates.length,o=this.appendFlatPointCoordinates(n,r);this.instructions.push([Jo.DRAW_IMAGE,i,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterImageWithText_]),this.hitDetectionInstructions.push([Jo.DRAW_IMAGE,i,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterImageWithText_]),this.endGeometry(e)}},e.prototype.finish=function(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,t.prototype.finish.call(this)},e.prototype.setImageStyle=function(t,e){var n=t.getAnchor(),r=t.getSize(),i=t.getHitDetectionImage(),o=t.getImage(this.pixelRatio),s=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=n[0],this.anchorY_=n[1],this.hitDetectionImage_=i,this.image_=o,this.height_=r[1],this.opacity_=t.getOpacity(),this.originX_=s[0]*this.imagePixelRatio_,this.originY_=s[1]*this.imagePixelRatio_,this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=r[0],this.declutterImageWithText_=e},e}(es),is=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),os=function(t){function e(e,n,r,i){return t.call(this,e,n,r,i)||this}return is(e,t),e.prototype.drawFlatCoordinates_=function(t,e,n,r){var i=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,n,r,!1,!1),s=[Jo.MOVE_TO_LINE_TO,i,o];return this.instructions.push(s),this.hitDetectionInstructions.push(s),n},e.prototype.drawLineString=function(t,e){var n=this.state,r=n.strokeStyle,i=n.lineWidth;if(void 0!==r&&void 0!==i){this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([Jo.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,bi,0],Ho);var o=t.getFlatCoordinates(),s=t.getStride();this.drawFlatCoordinates_(o,0,o.length,s),this.hitDetectionInstructions.push(Zo),this.endGeometry(e)}},e.prototype.drawMultiLineString=function(t,e){var n=this.state,r=n.strokeStyle,i=n.lineWidth;if(void 0!==r&&void 0!==i){this.updateStrokeStyle(n,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([Jo.SET_STROKE_STYLE,n.strokeStyle,n.lineWidth,n.lineCap,n.lineJoin,n.miterLimit,n.lineDash,n.lineDashOffset],Ho);for(var o=t.getEnds(),s=t.getFlatCoordinates(),a=t.getStride(),l=0,u=0,h=o.length;ut&&(y>_&&(_=y,d=v,g=o),y=0,v=o-i)),s=a,h=p,c=f),l=m,u=x}return(y+=a)>_?[v,o]:[d,g]}var cs=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ps={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},fs=function(t){function e(e,n,r,i){var o=t.call(this,e,n,r,i)||this;return o.labels_=null,o.text_="",o.textOffsetX_=0,o.textOffsetY_=0,o.textRotateWithView_=void 0,o.textRotation_=0,o.textFillState_=null,o.fillStates={},o.textStrokeState_=null,o.strokeStates={},o.textState_={},o.textStates={},o.textKey_="",o.fillKey_="",o.strokeKey_="",o.declutterImageWithText_=void 0,o}return cs(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_,r=this.textStrokeState_,i=this.textState_;if(""!==this.text_&&i&&(n||r)){var o=this.coordinates,s=o.length,a=t.getType(),l=null,u=t.getStride();if(i.placement!==no||a!=pt&&a!=_t&&a!=dt&&a!=yt){var h=i.overflow?null:[];switch(a){case ct:case gt:l=t.getFlatCoordinates();break;case pt:l=t.getFlatMidpoint();break;case mt:l=t.getCenter();break;case _t:l=t.getFlatMidpoints(),u=2;break;case dt:l=t.getFlatInteriorPoint(),i.overflow||h.push(l[2]/this.resolution),u=3;break;case yt:var c=t.getFlatInteriorPoints();l=[];for(S=0,C=c.length;SP[2]}else T=x>b;var O,F=Math.PI,I=[],M=S+r===e;if(_=0,y=C,p=t[e=S],f=t[e+1],M){v(),O=Math.atan2(f-g,p-d),T&&(O+=O>0?-F:F);var L=(b+x)/2,A=(R+w)/2;return I[0]=[L,A,(E-o)/2,O,i],I}for(var D=0,k=i.length;D0?-F:F),void 0!==O){var G=j-O;if(G+=G>F?-2*F:G<-F?2*F:0,Math.abs(G)>s)return null}O=j;for(var N=D,z=0;Dt?t-l:i,x=o+u>e?e-u:o,w=f[3]+m*c[0]+f[1],S=f[0]+x*c[1]+f[2],C=y-f[3],E=v-f[0];return(d||0!==h)&&(Ms[0]=C,Ds[0]=C,Ms[1]=E,Ls[1]=E,Ls[0]=C+w,As[0]=Ls[0],As[1]=E+S,Ds[1]=As[1]),0!==h?(kt(_=Gt([1,0,0,1,0,0],n,r,1,1,h,-n,-r),Ms),kt(_,Ls),kt(_,As),kt(_,Ds),se(Math.min(Ms[0],Ls[0],As[0],Ds[0]),Math.min(Ms[1],Ls[1],As[1],Ds[1]),Math.max(Ms[0],Ls[0],As[0],Ds[0]),Math.max(Ms[1],Ls[1],As[1],Ds[1]),Is)):se(Math.min(C,C+w),Math.min(E,E+S),Math.max(C,C+w),Math.max(E,E+S),Is),p&&(y=Math.round(y),v=Math.round(v)),{drawImageX:y,drawImageY:v,drawImageW:m,drawImageH:x,originX:l,originY:u,declutterBox:{minX:Is[0],minY:Is[1],maxX:Is[2],maxY:Is[3],value:g},canvasTransform:_,scale:c}},t.prototype.replayImageOrLabel_=function(t,e,n,r,i,o,s){var a=!(!o&&!s),l=r.declutterBox,u=t.canvas,h=s?s[2]*r.scale[0]/2:0;return l.minX-h<=u.width/e&&l.maxX+h>=0&&l.minY-h<=u.height/e&&l.maxY+h>=0&&(a&&this.replayTextBackground_(t,Ms,Ls,As,Ds,o,s),Ui(t,r.canvasTransform,i,n,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0},t.prototype.fill_=function(t){if(this.alignFill_){var e=kt(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.drawLabelWithPointPlacement_=function(t,e,n,r){var i=this.textStates[e],o=this.createLabel(t,e,r,n),s=this.strokeStates[n],a=this.pixelRatio,l=Gs(t,i.textAlign||Oi),u=ps[i.textBaseline||Fi],h=s&&s.lineWidth?s.lineWidth:0;return{label:o,anchorX:l*(o.width/a-2*i.scale[0])+2*(.5-l)*h,anchorY:u*o.height/a+2*(.5-u)*h}},t.prototype.execute_=function(t,e,n,r,i,o,s,a){var l,u,h;this.pixelCoordinates_&&g(n,this.renderedTransform_)?l=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),l=kn(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),u=this.renderedTransform_,h=n,u[0]=h[0],u[1]=h[1],u[2]=h[2],u[3]=h[3],u[4]=h[4],u[5]=h[5]);for(var c,p,f,d,_,y,v,m,x,w,S,C,E,T,b,R,P=0,O=r.length,F=0,I=0,M=0,L=null,A=null,D=this.coordinateCache_,k=this.viewRotation_,j=Math.round(1e12*Math.atan2(-n[1],n[0]))/1e12,G={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:k},N=this.instructions!=r||this.overlaps?0:200;PN&&(this.fill_(t),I=0),M>N&&(t.stroke(),M=0),I||M||(t.beginPath(),d=NaN,_=NaN),++P;break;case Jo.CIRCLE:var B=l[F=z[1]],U=l[F+1],V=l[F+2]-B,X=l[F+3]-U,W=Math.sqrt(V*V+X*X);t.moveTo(B+W,U),t.arc(B,U,W,0,2*Math.PI,!0),++P;break;case Jo.CLOSE_PATH:t.closePath(),++P;break;case Jo.CUSTOM:F=z[1],c=z[2];var Y=z[3],K=z[4],Z=6==z.length?z[5]:void 0;G.geometry=Y,G.feature=E,P in D||(D[P]=[]);var H=D[P];Z?Z(l,F,c,2,H):(H[0]=l[F],H[1]=l[F+1],H.length=2),K(H,G),++P;break;case Jo.DRAW_IMAGE:F=z[1],c=z[2],m=z[3],p=z[4],f=z[5];var q=z[6],J=z[7],Q=z[8],$=z[9],tt=z[10],et=z[11],nt=z[12],rt=z[13],it=z[14];if(!m&&z.length>=19){x=z[18],w=z[19],S=z[20],C=z[21];var ot=this.drawLabelWithPointPlacement_(x,w,S,C);m=ot.label,z[3]=m;var st=z[22];p=(ot.anchorX-st)*this.pixelRatio,z[4]=p;var at=z[23];f=(ot.anchorY-at)*this.pixelRatio,z[5]=f,q=m.height,z[6]=q,rt=m.width,z[13]=rt}var lt=void 0;z.length>24&&(lt=z[24]);var ut=void 0,ht=void 0,ct=void 0;z.length>16?(ut=z[15],ht=z[16],ct=z[17]):(ut=Ii,ht=!1,ct=!1),tt&&j?et+=k:tt||j||(et-=k);for(var pt=0;Fn)break;var a=r[s];a||(a=[],r[s]=a),a.push(4*((t+i)*e+(t+o))+3),i>0&&a.push(4*((t-i)*e+(t+o))+3),o>0&&(a.push(4*((t+i)*e+(t-o))+3),i>0&&a.push(4*((t-i)*e+(t-o))+3))}for(var l=[],u=(i=0,r.length);i0){if(!o||p!==bs&&p!==Os||-1!==o.indexOf(t)){var u=(f[a]-3)/4,h=r-u%s,d=r-(u/s|0),g=i(t,e,h*h+d*d);if(g)return g}c.clearRect(0,0,s,s);break}}var g,_,y,v,m,x=Object.keys(this.executorsByZIndex_).map(Number);for(x.sort(h),g=x.length-1;g>=0;--g){var w=x[g].toString();for(y=this.executorsByZIndex_[w],_=Bs.length-1;_>=0;--_)if(void 0!==(v=y[p=Bs[_]])&&(m=v.executeHitDetection(c,a,n,d,u)))return m}},t.prototype.getClipCoords=function(t){var e=this.maxExtent_;if(!e)return null;var n=e[0],r=e[1],i=e[2],o=e[3],s=[n,r,n,o,i,o,i,r];return kn(s,0,8,2,t,s),s},t.prototype.isEmpty=function(){return S(this.executorsByZIndex_)},t.prototype.execute=function(t,e,n,r,i,o,s){var a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(h),this.maxExtent_&&(t.save(),this.clip(t,n));var l,u,c,p,f,d,g=o||Bs;for(s&&a.reverse(),l=0,u=a.length;lthis.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 r=na(t,e,n);return r in this.cache_?this.cache_[r]:null},t.prototype.set=function(t,e,n,r){var i=na(t,e,n);this.cache_[i]=r,++this.cacheSize_},t.prototype.setSize=function(t){this.maxCacheSize_=t,this.expire()},t}()),ia=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),oa=function(t){function n(e,n,r,i){var o=t.call(this)||this;return o.extent=e,o.pixelRatio_=r,o.resolution=n,o.state=i,o}return ia(n,t),n.prototype.changed=function(){this.dispatchEvent(T)},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}(E),sa=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();function aa(t,e,n){var r=t;if(r.src&&Ft){var i=r.decode(),o=!0;return i.then((function(){o&&e()})).catch((function(t){o&&("EncodingError"===t.name&&"Invalid image type."===t.message?e():n())})),function(){o=!1}}var s=[z(r,D,e),z(r,b,n)];return function(){s.forEach(B)}}var la=function(t){function e(e,n,r,i,o,s){var a=t.call(this,e,n,r,Yr)||this;return a.src_=i,a.image_=new Image,null!==o&&(a.image_.crossOrigin=o),a.unlisten_=null,a.state=Yr,a.imageLoadFunction_=s,a}return sa(e,t),e.prototype.getImage=function(){return this.image_},e.prototype.handleImageError_=function(){this.state=Hr,this.unlistenImage_(),this.changed()},e.prototype.handleImageLoad_=function(){void 0===this.resolution&&(this.resolution=Se(this.extent)/this.image_.height),this.state=Zr,this.unlistenImage_(),this.changed()},e.prototype.load=function(){this.state!=Yr&&this.state!=Hr||(this.state=Kr,this.changed(),this.imageLoadFunction_(this,this.src_),this.unlisten_=aa(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},e.prototype.setImage=function(t){this.image_=t,this.resolution=Se(this.extent)/this.image_.height},e.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},e}(oa),ua=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ha=null,ca=function(t){function e(e,n,r,i,o,s){var a=t.call(this)||this;return a.hitDetectionImage_=null,a.image_=e||new Image,null!==i&&(a.image_.crossOrigin=i),a.canvas_={},a.color_=s,a.unlisten_=null,a.imageState_=o,a.size_=r,a.src_=n,a.tainted_,a}return ua(e,t),e.prototype.isTainted_=function(){if(void 0===this.tainted_&&this.imageState_===Zr){ha||(ha=pi(1,1)),ha.drawImage(this.image_,0,0);try{ha.getImageData(0,0,1,1),this.tainted_=!1}catch(t){ha=null,this.tainted_=!0}}return!0===this.tainted_},e.prototype.dispatchChangeEvent_=function(){this.dispatchEvent(T)},e.prototype.handleImageError_=function(){this.imageState_=Hr,this.unlistenImage_(),this.dispatchChangeEvent_()},e.prototype.handleImageLoad_=function(){this.imageState_=Zr,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=pi(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_==Yr){this.imageState_=Kr;try{this.image_.src=this.src_}catch(t){this.handleImageError_()}this.unlisten_=aa(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}},e.prototype.replaceColor_=function(t){if(this.color_&&!this.canvas_[t]&&this.imageState_===Zr){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),n.globalCompositeOperation="multiply","multiply"===n.globalCompositeOperation||this.isTainted_())n.fillStyle=oi(this.color_),n.fillRect(0,0,e.width/t,e.height/t),n.globalCompositeOperation="destination-in",n.drawImage(this.image_,0,0);else{for(var r=n.getImageData(0,0,e.width,e.height),i=r.data,o=this.color_[0]/255,s=this.color_[1]/255,a=this.color_[2]/255,l=this.color_[3],u=0,h=i.length;u0,6);var p=void 0!==i.src?Yr:Zr;return n.color_=void 0!==i.color?li(i.color):null,n.iconImage_=function(t,e,n,r,i,o){var s=ra.get(e,r,o);return s||(s=new ca(t,e,n,r,i,o),ra.set(e,r,o,s)),s}(u,c,h,n.crossOrigin_,p,n.color_),n.offset_=void 0!==i.offset?i.offset:[0,0],n.offsetOrigin_=void 0!==i.offsetOrigin?i.offsetOrigin:ta,n.origin_=null,n.size_=void 0!==i.size?i.size:null,n}return pa(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_==qs||this.anchorYUnits_==qs){if(!e)return null;t=this.anchor_.slice(),this.anchorXUnits_==qs&&(t[0]*=e[0]),this.anchorYUnits_==qs&&(t[1]*=e[1])}if(this.anchorOrigin_!=ta){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),this.anchorOrigin_!=ea&&this.anchorOrigin_!=$s||(t[0]=-t[0]+e[0]),this.anchorOrigin_!=Qs&&this.anchorOrigin_!=$s||(t[1]=-t[1]+e[1])}var n=this.getDisplacement();return t[0]-=n[0],t[1]+=n[1],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.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_;if(this.offsetOrigin_!=ta){var e=this.getSize(),n=this.iconImage_.getSize();if(!e||!n)return null;t=t.slice(),this.offsetOrigin_!=ea&&this.offsetOrigin_!=$s||(t[0]=n[0]-e[0]-t[0]),this.offsetOrigin_!=Qs&&this.offsetOrigin_!=$s||(t[1]=n[1]-e[1]-t[1])}return 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(T,t)},e.prototype.load=function(){this.iconImage_.load()},e.prototype.unlistenImageChange=function(t){this.iconImage_.removeEventListener(T,t)},e}(ni),da=fa,ga=.5;function _a(t,e,n,r,i,o,s){var a=pi(t[0]*ga,t[1]*ga);a.imageSmoothingEnabled=!1;for(var l=a.canvas,u=new Hs(a,ga,i,null,s),c=n.length,p=Math.floor(16777215/c),f={},d=1;d<=c;++d){var g=n[d-1],_=g.getStyleFunction()||r;if(r){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;mf[2];)y=g*++_,u.push(this.getRenderTransform(r,i,o,ga,h,c,y).slice()),d-=g}this.hitDetectionImageData_=_a(n,u,this.renderedFeatures_,l.getStyleFunction(),a,i,o)}e(ya(t,this.renderedFeatures_,this.hitDetectionImageData_))}.bind(this))},e.prototype.forEachFeatureAtCoordinate=function(t,e,n,i,o){var s=this;if(this.replayGroup_){var a,l=e.viewState.resolution,u=e.viewState.rotation,h=this.getLayer(),c={},p=function(t,e,n){var s=r(t),a=c[s];if(a){if(!0!==a&&n=n[2])){var i=be(n),o=Math.floor((r[0]-n[0])/i)*i;t[0]-=o,t[2]-=o}return t}(m[0],u);C[0]x[0]&&C[2]>x[2]&&m.push([C[0]-w,C[1],C[2]-w,C[3]])}if(!this.dirty_&&this.renderedResolution_==h&&this.renderedRevision_==p&&this.renderedRenderOrder_==d&&ne(this.wrappedRenderedExtent_,y))return g(this.renderedExtent_,v)||(this.hitDetectionImageData_=null,this.renderedExtent_=v),this.renderedCenter_=_,this.replayGroupChanged=!1,!0;this.replayGroup_=null,this.dirty_=!1;var E,T=new gs(wa(h,c),y,h,c);this.getLayer().getDeclutter()&&(E=new gs(wa(h,c),y,h,c));for(var b=0,R=m.length;b=200&&a.status<300){var r=e.getType(),l=void 0;r==Ua||r==Va?l=a.responseText:r==Xa?(l=a.responseXML)||(l=(new DOMParser).parseFromString(a.responseText,"application/xml")):r==Ba&&(l=a.response),l?o(e.readFeatures(l,{extent:n,featureProjection:i}),e.readProjection(l)):s()}else s()},a.onerror=s,a.send()}function Ya(t,e){return function(n,r,i,o,s){var a=this;Wa(t,e,n,r,i,(function(t,e){a.addFeatures(t),void 0!==o&&o(t)}),s||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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Za=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.feature=n,i.features=r,i}return Ka(e,t),e}(a),Ha=function(t){function e(e){var n=this,r=e||{};(n=t.call(this,{attributions:r.attributions,projection:void 0,state:mo,wrapX:void 0===r.wrapX||r.wrapX})||this).on,n.once,n.un,n.loader_=v,n.format_=r.format,n.overlaps_=void 0===r.overlaps||r.overlaps,n.url_=r.url,void 0!==r.loader?n.loader_=r.loader:void 0!==n.url_&&(rt(n.format_,7),n.loader_=Ya(n.url_,n.format_)),n.strategy_=void 0!==r.strategy?r.strategy:za;var i,o,s=void 0===r.useSpatialIndex||r.useSpatialIndex;return n.featuresRtree_=s?new Oa:null,n.loadedExtentsRtree_=new Oa,n.loadingExtentsCount_=0,n.nullGeometryFeatures_={},n.idIndex_={},n.uidIndex_={},n.featureChangeKeys_={},n.featuresCollection_=null,Array.isArray(r.features)?o=r.features:r.features&&(o=(i=r.features).getArray()),s||void 0!==i||(i=new nt(o)),void 0!==o&&n.addFeaturesInternal(o),void 0!==i&&n.bindFeaturesCollection_(i),n}return Ka(e,t),e.prototype.addFeature=function(t){this.addFeatureInternal(t),this.changed()},e.prototype.addFeatureInternal=function(t){var e=r(t);if(this.addToIndex_(e,t)){this.setupChangeEvents_(e,t);var n=t.getGeometry();if(n){var i=n.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(i,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new Za(La,t))}else this.featuresCollection_&&this.featuresCollection_.remove(t)},e.prototype.setupChangeEvents_=function(t,e){this.featureChangeKeys_[t]=[N(e,T,this.handleFeatureChange_,this),N(e,l,this.handleFeatureChange_,this)]},e.prototype.addToIndex_=function(t,e){var n=!0,r=e.getId();return void 0!==r&&(r.toString()in this.idIndex_?n=!1:this.idIndex_[r.toString()]=e),n&&(rt(!(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=[],i=[],o=0,s=t.length;o0},e.prototype.refresh=function(){this.clear(!0),this.loadedExtentsRtree_.clear(),t.prototype.refresh.call(this)},e.prototype.removeLoadedExtent=function(t){var e,n=this.loadedExtentsRtree_;n.forEachInExtent(t,(function(n){if(he(n.extent,t))return e=n,!0})),e&&n.remove(e)},e.prototype.removeFeature=function(t){var e=r(t);e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t),this.removeFeatureInternal(t),this.changed()},e.prototype.removeFeatureInternal=function(t){var e=r(t);this.featureChangeKeys_[e].forEach(B),delete this.featureChangeKeys_[e];var n=t.getId();void 0!==n&&delete this.idIndex_[n.toString()],delete this.uidIndex_[e],this.dispatchEvent(new Za(ka,t))},e.prototype.removeFromIdIndex_=function(t){var e=!1;for(var n in this.idIndex_)if(this.idIndex_[n]===t){delete this.idIndex_[n],e=!0;break}return e},e.prototype.setLoader=function(t){this.loader_=t},e.prototype.setUrl=function(t){rt(this.format_,7),this.url_=t,this.setLoader(Ya(t,this.format_))},e}(Ma),qa=Ha,Ja=0,Qa=1,$a=2,tl=3,el=4;function nl(t){return Math.pow(t,3)}function rl(t){return 1-nl(1-t)}function il(t){return 3*t*t-2*t*t*t}function ol(t){return t}var sl=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),al=function(t){function n(e,n,r){var i=t.call(this)||this,o=r||{};return i.tileCoord=e,i.state=n,i.interimTile=null,i.key="",i.transition_=void 0===o.transition?250:o.transition,i.transitionStarts_={},i}return sl(n,t),n.prototype.changed=function(){this.dispatchEvent(T)},n.prototype.release=function(){},n.prototype.getKey=function(){return this.key+"/"+this.tileCoord},n.prototype.getInterimTile=function(){if(!this.interimTile)return this;var t=this.interimTile;do{if(t.getState()==$a)return this.transition_=0,t;t=t.interimTile}while(t);return this},n.prototype.refreshInterimChain=function(){if(this.interimTile){var t=this.interimTile,e=this;do{if(t.getState()==$a){t.interimTile=null;break}t.getState()==Qa?e=t:t.getState()==Ja?e.interimTile=t.interimTile:e=t,t=e.interimTile}while(t)}},n.prototype.getTileCoord=function(){return this.tileCoord},n.prototype.getState=function(){return this.state},n.prototype.setState=function(t){if(this.state!==tl&&this.state>t)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 r=e-n+1e3/60;return r>=this.transition_?1:nl(r/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}(E),ll=al,ul=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();var hl=function(t){function e(e,n,r,i,o,s){var a=t.call(this,e,n,s)||this;return a.crossOrigin_=i,a.src_=r,a.key=r,a.image_=new Image,null!==i&&(a.image_.crossOrigin=i),a.unlisten_=null,a.tileLoadFunction_=o,a}return ul(e,t),e.prototype.getImage=function(){return this.image_},e.prototype.setImage=function(t){this.image_=t,this.state=$a,this.unlistenImage_(),this.changed()},e.prototype.handleImageError_=function(){var t;this.state=tl,this.unlistenImage_(),this.image_=((t=pi(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=$a:this.state=el,this.unlistenImage_(),this.changed()},e.prototype.load=function(){this.state==tl&&(this.state=Ja,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==Ja&&(this.state=Qa,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=aa(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},e.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},e}(ll),cl=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 r=this.points_[e+2]-this.points_[n+2];if(r<1e3/60)return!1;var i=this.points_[e]-this.points_[n],o=this.points_[e+1]-this.points_[n+1];return this.angle_=Math.atan2(o,i),this.initialVelocity_=Math.sqrt(i*i+o*o)/r,this.initialVelocity_>this.minVelocity_},t.prototype.getDistance=function(){return(this.minVelocity_-this.initialVelocity_)/this.decay_},t.prototype.getAngle=function(){return this.angle_},t}(),pl=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),fl=function(t){function n(e){var n=t.call(this)||this;return n.map_=e,n}return pl(n,t),n.prototype.dispatchRenderEvent=function(t,n){e()},n.prototype.calculateMatrices2D=function(t){var e=t.viewState,n=t.coordinateToPixelTransform,r=t.pixelToCoordinateTransform;Gt(n,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),Nt(r,n)},n.prototype.forEachFeatureAtCoordinate=function(t,e,n,r,i,o,s,a){var l,u=e.viewState;function h(t,e,n,r){return i.call(o,e,t?n:null,r)}var c=u.projection,p=yn(t.slice(),c),f=[[0,0]];if(c.canWrapX()&&r){var d=be(c.getExtent());f.push([-d,0],[d,0])}for(var g=e.layerStatesArray,_=g.length,y=[],v=[],m=0;m=0;--x){var w=g[x],S=w.layer;if(S.hasRenderer()&&Co(w,u)&&s.call(a,S)){var C=S.getRenderer(),E=S.getSource();if(C&&E){var T=E.getWrapX()?p:t,b=h.bind(null,w.managed);v[0]=T[0]+f[m][0],v[1]=T[1]+f[m][1],l=C.forEachFeatureAtCoordinate(v,e,n,b,y)}if(l)return l}}if(0!==y.length){var R=1/y.length;return y.forEach((function(t,e){return t.distanceSq+=e*R})),y.sort((function(t,e){return t.distanceSq-e.distanceSq})),y.some((function(t){return l=t.callback(t.feature,t.layer,t.geometry)})),l}},n.prototype.forEachLayerAtPixel=function(t,n,r,i,o){return e()},n.prototype.hasFeatureAtCoordinate=function(t,e,n,r,i,o){return void 0!==this.forEachFeatureAtCoordinate(t,e,n,r,_,this,i,o)},n.prototype.getMap=function(){return this.map_},n.prototype.renderFrame=function(t){e()},n.prototype.scheduleExpireIconCache=function(t){ra.canExpireCache()&&t.postRenderFunctions.push(dl)},n}(u);function dl(t,e){ra.expire()}var gl=fl,_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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),yl=function(t){function e(e){var n=t.call(this,e)||this;n.fontChangeListenerKey_=N(Mi,l,e.redrawText.bind(e)),n.element_=document.createElement("div");var r=n.element_.style;r.position="absolute",r.width="100%",r.height="100%",r.zIndex="0",n.element_.className="ol-unselectable ol-layers";var i=e.getViewport();return i.insertBefore(n.element_,i.firstChild||null),n.children_=[],n.renderedVisible_=!0,n}return _l(e,t),e.prototype.dispatchRenderEvent=function(t,e){var n=this.getMap();if(n.hasListener(t)){var r=new xs(t,void 0,e);n.dispatchEvent(r)}},e.prototype.disposeInternal=function(){B(this.fontChangeListenerKey_),this.element_.parentNode.removeChild(this.element_),t.prototype.disposeInternal.call(this)},e.prototype.renderFrame=function(t){if(t){this.calculateMatrices2D(t),this.dispatchRenderEvent(Dr,t);var e=t.layerStatesArray.sort((function(t,e){return t.zIndex-e.zIndex})),n=t.viewState;this.children_.length=0;for(var r=[],i=null,o=0,s=e.length;o=0;--o)r[o].renderDeclutter(t);!function(t,e){for(var n=t.childNodes,r=0;;++r){var i=n[r],o=e[r];if(!i&&!o)break;i!==o&&(i?o?t.insertBefore(o,i):(t.removeChild(i),--r):t.appendChild(o))}}(this.element_,this.children_),this.dispatchRenderEvent(kr,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}else this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1)},e.prototype.forEachLayerAtPixel=function(t,e,n,r,i){for(var o=e.viewState,s=e.layerStatesArray,a=s.length-1;a>=0;--a){var l=s[a],u=l.layer;if(u.hasRenderer()&&Co(l,o)&&i(u)){var h=u.getRenderer().getDataAtPixel(t,e,n);if(h){var c=r(u,h);if(c)return c}}}},e}(gl),vl=yl,ml=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),xl="layers",wl=function(t){function e(e){var n=this,r=e||{},i=m({},r);delete i.layers;var o=r.layers;return(n=t.call(this,i)||this).on,n.once,n.un,n.layersListenerKeys_=[],n.listenerKeys_={},n.addChangeListener(xl,n.handleLayersChanged_),o?Array.isArray(o)?o=new nt(o.slice(),{unique:!0}):rt("function"==typeof o.getArray,43):o=new nt(void 0,{unique:!0}),n.setLayers(o),n}return ml(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,J,this.handleLayersAdd_,this),N(t,Q,this.handleLayersRemove_,this)),this.listenerKeys_)this.listenerKeys_[e].forEach(B);x(this.listenerKeys_);for(var n=t.getArray(),i=0,o=n.length;ithis.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_},e.prototype.disposeInternal=function(){this.relayedListenerKey_&&(B(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(j,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(B(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(B),this.dragListenerKeys_.length=0,this.element_=null,t.prototype.disposeInternal.call(this)},e}(E),Ml="postrender",Ll="movestart",Al="moveend",Dl="layergroup",kl="size",jl="target",Gl="view",Nl=1/0,zl=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 r=this.keyFunction_(n);return delete this.queuedElements_[r],n},t.prototype.enqueue=function(t){rt(!(this.keyFunction_(t)in this.queuedElements_),31);var e=this.priorityFunction_(t);return e!=Nl&&(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_,r=e.length,i=e[t],o=n[t],s=t;t>1;){var a=this.getLeftChildIndex_(t),l=this.getRightChildIndex_(t),u=lt;){var s=this.getParentIndex_(e);if(!(r[s]>o))break;n[e]=n[s],r[e]=r[s],e=s}n[e]=i,r[e]=o},t.prototype.reprioritize=function(){var t,e,n,r=this.priorityFunction_,i=this.elements_,o=this.priorities_,s=0,a=i.length;for(e=0;e0;)r=(n=this.dequeue()[0]).getKey(),n.getState()!==Ja||r in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[r]=!0,++this.tilesLoading_,++i,n.load())},e}(zl);var Vl="center",Xl="resolution",Wl="rotation",Yl=256;function Kl(t,e,n){return function(r,i,o,s,a){if(r){var l=e?0:o[0]*i,u=e?0:o[1]*i,h=a?a[0]:0,c=a?a[1]:0,p=t[0]+l/2+h,f=t[2]-l/2+h,d=t[1]+u/2+c,g=t[3]-u/2+c;p>f&&(f=p=(f+p)/2),d>g&&(g=d=(g+d)/2);var _=Ie(r[0],p,f),y=Ie(r[1],d,g),v=30*i;return s&&n&&(_+=-v*Math.log(1+Math.max(0,p-r[0])/v)+v*Math.log(1+Math.max(0,r[0]-f)/v),y+=-v*Math.log(1+Math.max(0,d-r[1])/v)+v*Math.log(1+Math.max(0,r[1]-g)/v)),[_,y]}}}function Zl(t){return t}function Hl(t,e,n,r){var i=be(e)/n[0],o=Se(e)/n[1];return r?Math.min(t,Math.max(i,o)):Math.min(t,Math.min(i,o))}function ql(t,e,n){var r=Math.min(t,e);return r*=Math.log(1+50*Math.max(0,t/e-1))/50+1,n&&(r=Math.max(r,n),r/=Math.log(1+50*Math.max(0,n/t-1))/50+1),Ie(r,n/2,2*e)}function Jl(t,e,n,r,i){return function(o,s,a,l){if(void 0!==o){var u=r?Hl(t,r,a,i):t;return(void 0===n||n)&&l?ql(o,u,e):Ie(o,e,u)}}}function Ql(t){return void 0!==t?0:void 0}function $l(t){return void 0!==t?t:void 0}var tu=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),eu=function(t){function e(e){var n=t.call(this)||this;n.on,n.once,n.un;var r=m({},e);return n.hints_=[0,0],n.animations_=[],n.updateAnimationKey_,n.projection_=En(r.projection,"EPSG:3857"),n.viewportSize_=[100,100],n.targetCenter_=null,n.targetResolution_,n.targetRotation_,n.nextCenter_=null,n.nextResolution_,n.nextRotation_,n.cancelAnchor_=void 0,r.center&&(r.center=Ln(r.center,n.projection_)),r.extent&&(r.extent=Dn(r.extent,n.projection_)),n.applyOptions_(r),n}return tu(e,t),e.prototype.applyOptions_=function(t){var e=function(t){var e,n,r,i=28,o=2,s=void 0!==t.minZoom?t.minZoom:0,a=void 0!==t.maxZoom?t.maxZoom:i,l=void 0!==t.zoomFactor?t.zoomFactor:o,u=void 0!==t.multiWorld&&t.multiWorld,h=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,c=void 0!==t.showFullExtent&&t.showFullExtent,f=En(t.projection,"EPSG:3857"),d=f.getExtent(),g=t.constrainOnlyCenter,_=t.extent;u||_||!f.isGlobal()||(g=!1,_=d);if(void 0!==t.resolutions){var y=t.resolutions;n=y[s],r=void 0!==y[a]?y[a]:y[y.length-1],e=t.constrainResolution?function(t,e,n,r){return function(i,o,s,a){if(void 0!==i){var l=t[0],u=t[t.length-1],h=n?Hl(l,n,s,r):l;if(a)return void 0===e||e?ql(i,h,u):Ie(i,u,h);var c=Math.min(h,i),f=Math.floor(p(t,c,o));return t[f]>h&&f1&&"function"==typeof arguments[n-1]&&(e=arguments[n-1],--n);for(var r=0;r0},e.prototype.getInteracting=function(){return this.hints_[Ys]>0},e.prototype.cancelAnimations=function(){var t;this.setHint(Ws,-this.hints_[Ws]);for(var e=0,n=this.animations_.length;e=0;--n){for(var r=this.animations_[n],i=!0,o=0,s=r.length;o0?l/a.duration:1;u>=1?(a.complete=!0,u=1):i=!1;var h=a.easing(u);if(a.sourceCenter){var c=a.sourceCenter[0],p=a.sourceCenter[1],f=a.targetCenter[0],d=a.targetCenter[1];this.nextCenter_=a.targetCenter;var g=c+h*(f-c),_=p+h*(d-p);this.targetCenter_=[g,_]}if(a.sourceResolution&&a.targetResolution){var y=1===h?a.targetResolution:a.sourceResolution+h*(a.targetResolution-a.sourceResolution);if(a.anchor){var v=this.getViewportSize_(this.getRotation()),m=this.constraints_.resolution(y,0,v,!0);this.targetCenter_=this.calculateCenterZoom(m,a.anchor)}this.nextResolution_=a.targetResolution,this.targetResolution_=y,this.applyTargetState_(!0)}if(void 0!==a.sourceRotation&&void 0!==a.targetRotation){var x=1===h?Ge(a.targetRotation+Math.PI,2*Math.PI)-Math.PI:a.sourceRotation+h*(a.targetRotation-a.sourceRotation);if(a.anchor){var w=this.constraints_.rotation(x,!0);this.targetCenter_=this.calculateCenterRotate(w,a.anchor)}this.nextRotation_=a.targetRotation,this.targetRotation_=x}if(this.applyTargetState_(!0),e=!0,!a.complete)break}}if(i){this.animations_[n]=null,this.setHint(Ws,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;var S=r[0].callback;S&&nu(S,!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,r,i,o=this.getCenterInternal();return void 0!==o&&(fn(n=[o[0]-e[0],o[1]-e[1]],t-this.getRotation()),i=e,(r=n)[0]+=+i[0],r[1]+=+i[1]),n},e.prototype.calculateCenterZoom=function(t,e){var n,r=this.getCenterInternal(),i=this.getResolution();void 0!==r&&void 0!==i&&(n=[e[0]-t*(e[0]-r[0])/i,e[1]-t*(e[1]-r[1])/i]);return n},e.prototype.getViewportSize_=function(t){var e=this.viewportSize_;if(t){var n=e[0],r=e[1];return[Math.abs(n*Math.cos(t))+Math.abs(r*Math.sin(t)),Math.abs(n*Math.sin(t))+Math.abs(r*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?Mn(t,this.getProjection()):t},e.prototype.getCenterInternal=function(){return this.get(Vl)},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 An(this.calculateExtentInternal(t),this.getProjection())},e.prototype.calculateExtentInternal=function(t){var e=t||this.getViewportSizeMinusPadding_(),n=this.getCenterInternal();rt(n,1);var r=this.getResolution();rt(void 0!==r,2);var i=this.getRotation();return rt(void 0!==i,3),we(n,r,i,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(Xl)},e.prototype.getResolutions=function(){return this.resolutions_},e.prototype.getResolutionForExtent=function(t,e){return this.getResolutionForExtentInternal(Dn(t,this.getProjection()),e)},e.prototype.getResolutionForExtentInternal=function(t,e){var n=e||this.getViewportSizeMinusPadding_(),r=be(t)/n[0],i=Se(t)/n[1];return Math.max(r,i)},e.prototype.getResolutionForValueFunction=function(t){var e=t||2,n=this.getConstrainedResolution(this.maxResolution_),r=this.minResolution_,i=Math.log(n/r)/Math.log(e);return function(t){return n/Math.pow(e,t*i)}},e.prototype.getRotation=function(){return this.get(Wl)},e.prototype.getValueForResolutionFunction=function(t){var e=Math.log(t||2),n=this.getConstrainedResolution(this.maxResolution_),r=this.minResolution_,i=Math.log(n/r)/e;return function(t){return Math.log(n/t)/e/i}},e.prototype.getViewportSizeMinusPadding_=function(t){var e=this.getViewportSize_(t),n=this.padding_;return n&&(e=[e[0]-n[1]-n[3],e[1]-n[0]-n[2]]),e},e.prototype.getState=function(){var t=this.getProjection(),e=this.getResolution(),n=this.getRotation(),r=this.getCenterInternal(),i=this.padding_;if(i){var o=this.getViewportSizeMinusPadding_();r=iu(r,this.getViewportSize_(),[o[0]/2+i[3],o[1]/2+i[0]],e,n)}return{center:r.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:n,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,r=this.minZoom_||0;if(this.resolutions_){var i=p(this.resolutions_,t,1);r=i,e=this.resolutions_[i],n=i==this.resolutions_.length-1?2:e/this.resolutions_[i+1]}else e=this.maxResolution_,n=this.zoomFactor_;return r+Math.log(e/t)/Math.log(n)},e.prototype.getResolutionForZoom=function(t){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;var e=Ie(Math.floor(t),0,this.resolutions_.length-2),n=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(n,Ie(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)},e.prototype.fit=function(t,e){var n;if(rt(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,24),Array.isArray(t))rt(!Pe(t),25),n=Ir(r=Dn(t,this.getProjection()));else if(t.getType()===mt){var r;(n=Ir(r=Dn(t.getExtent(),this.getProjection()))).rotate(this.getRotation(),me(r))}else{n=t}this.fitInternal(n,e)},e.prototype.rotatedExtentForGeometry=function(t){for(var e=this.getRotation(),n=Math.cos(e),r=Math.sin(-e),i=t.getFlatCoordinates(),o=t.getStride(),s=1/0,a=1/0,l=-1/0,u=-1/0,h=0,c=i.length;h=0;a--){var l=s[a];if(l.getMap()===this&&l.getActive()&&this.getTargetElement())if(!l.handleEvent(t)||t.propagationStopped)break}}},e.prototype.handlePostRender=function(){var t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){var n=this.maxTilesLoading_,r=n;if(t){var i=t.viewHints;if(i[Ws]||i[Ys]){var o=Date.now()-t.time>8;n=o?0:8,r=o?0:2}}e.getTilesLoading()0;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 r=0,i=e.length;r0&&e%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.duration_,easing:rl}):t.setRotation(0))}},e.prototype.render=function(t){var e=t.frameState;if(e){var n=e.viewState.rotation;if(n!=this.rotation_){var r="rotate("+n+"rad)";if(this.autoHide_){var i=this.element.classList.contains(gi);i||0!==n?i&&0!==n&&this.element.classList.remove(gi):this.element.classList.add(gi)}this.label_.style.transform=r}this.rotation_=n}},e}(hu),yu=_u,vu=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),mu=function(t){function e(e){var n=this,r=e||{};n=t.call(this,{element:document.createElement("div"),target:r.target})||this;var i=void 0!==r.className?r.className:"ol-zoom",o=void 0!==r.delta?r.delta:1,s=void 0!==r.zoomInClassName?r.zoomInClassName:i+"-in",a=void 0!==r.zoomOutClassName?r.zoomOutClassName:i+"-out",l=void 0!==r.zoomInLabel?r.zoomInLabel:"+",u=void 0!==r.zoomOutLabel?r.zoomOutLabel:"–",h=void 0!==r.zoomInTipLabel?r.zoomInTipLabel:"Zoom in",c=void 0!==r.zoomOutTipLabel?r.zoomOutTipLabel:"Zoom out",p=document.createElement("button");p.className=s,p.setAttribute("type","button"),p.title=h,p.appendChild("string"==typeof l?document.createTextNode(l):l),p.addEventListener(P,n.handleClick_.bind(n,o),!1);var f=document.createElement("button");f.className=a,f.setAttribute("type","button"),f.title=c,f.appendChild("string"==typeof u?document.createTextNode(u):u),f.addEventListener(P,n.handleClick_.bind(n,-o),!1);var d=i+" "+"ol-unselectable "+yi,g=n.element;return g.className=d,g.appendChild(p),g.appendChild(f),n.duration_=void 0!==r.duration?r.duration:250,n}return vu(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 r=e.getConstrainedZoom(n+t);this.duration_>0?(e.getAnimating()&&e.cancelAnimations(),e.animate({zoom:r,duration:this.duration_,easing:rl})):e.setZoom(r)}}},e}(hu),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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),wu="units",Su="degrees",Cu="imperial",Eu="nautical",Tu="metric",bu="us",Ru=[1,2,5],Pu=25.4/.28,Ou=function(t){function e(e){var n=this,r=e||{},i=void 0!==r.className?r.className:r.bar?"ol-scale-bar":"ol-scale-line";return(n=t.call(this,{element:document.createElement("div"),render:r.render,target:r.target})||this).on,n.once,n.un,n.innerElement_=document.createElement("div"),n.innerElement_.className=i+"-inner",n.element.className=i+" "+_i,n.element.appendChild(n.innerElement_),n.viewState_=null,n.minWidth_=void 0!==r.minWidth?r.minWidth:64,n.renderedVisible_=!1,n.renderedWidth_=void 0,n.renderedHTML_="",n.addChangeListener(wu,n.handleUnitsChanged_),n.setUnits(r.units||Tu),n.scaleBar_=r.bar||!1,n.scaleBarSteps_=r.steps||4,n.scaleBarText_=r.text||!1,n.dpi_=r.dpi||void 0,n}return xu(e,t),e.prototype.getUnits=function(){return this.get(wu)},e.prototype.handleUnitsChanged_=function(){this.updateElement_()},e.prototype.setUnits=function(t){this.set(wu,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,r=this.getUnits(),i=r==Su?St.DEGREES:St.METERS,o=Sn(n,t.resolution,e,i),s=this.minWidth_*(this.dpi_||Pu)/Pu,a=s*o,l="";if(r==Su){var u=wt[St.DEGREES];(a*=u)=s)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 r="1 : "+Math.round(this.getScaleForResolution()).toLocaleString(),i=[],o=t/this.scaleBarSteps_,s="#ffffff",a=0;a
'+this.createMarker("relative",a)+(a%2==0||2===this.scaleBarSteps_?this.createStepText(a,t,!1,e,n):"")+""),a===this.scaleBarSteps_-1&&i.push(this.createStepText(a+1,t,!0,e,n)),s="#ffffff"===s?"#000000":"#ffffff";return'
'+(this.scaleBarText_?'
'+r+"
":"")+i.join("")+"
"},e.prototype.createMarker=function(t,e){return'
'},e.prototype.createStepText=function(t,e,n,r,i){var o=(0===t?0:Math.round(r/this.scaleBarSteps_*t*100)/100)+(0===t?"":" "+i);return'
'+o+"
"},e.prototype.getScaleForResolution=function(){var t=Sn(this.viewState_.projection,this.viewState_.resolution,this.viewState_.center),e=this.dpi_||Pu,n=this.viewState_.projection.getMetersPerUnit();return parseFloat(t.toString())*n*(1e3/25.4)*e},e.prototype.render=function(t){var e=t.frameState;this.viewState_=e?e.viewState:null,this.updateElement_()},e}(hu),Fu=Ou;var Iu="active",Mu=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();function Lu(t,e,n,r){var i=t.getZoom();if(void 0!==i){var o=t.getConstrainedZoom(i+e),s=t.getResolutionForZoom(o);t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:s,anchor:n,duration:void 0!==r?r:250,easing:rl})}}var Au=function(t){function e(e){var n=t.call(this)||this;return n.on,n.once,n.un,e&&e.handleEvent&&(n.handleEvent=e.handleEvent),n.map_=null,n.setActive(!0),n}return Mu(e,t),e.prototype.getActive=function(){return this.get(Iu)},e.prototype.getMap=function(){return this.map_},e.prototype.handleEvent=function(t){return!0},e.prototype.setActive=function(t){this.set(Iu,t)},e.prototype.setMap=function(t){this.map_=t},e}(q),Du=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ku=function(t){function e(e){var n=t.call(this)||this,r=e||{};return n.delta_=r.delta?r.delta:1,n.duration_=void 0!==r.duration?r.duration:250,n}return Du(e,t),e.prototype.handleEvent=function(t){var e=!1;if(t.type==Rl.DBLCLICK){var n=t.originalEvent,r=t.map,i=t.coordinate,o=n.shiftKey?-this.delta_:this.delta_;Lu(r.getView(),o,i,this.duration_),n.preventDefault(),e=!0}return!e},e}(Au),ju=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();function Gu(t){for(var e=t.length,n=0,r=0,i=0;i0}}else if(t.type==Rl.POINTERDOWN){var r=this.handleDownEvent(t);this.handlingDownUpSequence=r,e=this.stopDown(r)}else t.type==Rl.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===Rl.POINTERDOWN||e===Rl.POINTERDRAG||e===Rl.POINTERUP}(t)){var e=t.originalEvent,n=e.pointerId.toString();t.type==Rl.POINTERUP?delete this.trackedPointers_[n]:(t.type==Rl.POINTERDOWN||n in this.trackedPointers_)&&(this.trackedPointers_[n]=e),this.targetPointers=w(this.trackedPointers_)}},e}(Au);function zu(t){var e=arguments;return function(t){for(var n=!0,r=0,i=e.length;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}(Nu),th=$u,eh=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),nh=function(t){function e(e){var n=this,r=e||{};return(n=t.call(this,{stopDown:y})||this).condition_=r.condition?r.condition:Bu,n.lastAngle_=void 0,n.duration_=void 0!==r.duration?r.duration:250,n}return eh(e,t),e.prototype.handleDragEvent=function(t){if(qu(t)){var e=t.map,n=e.getView();if(n.getConstraints().rotation!==Ql){var r=e.getSize(),i=t.pixel,o=Math.atan2(r[1]/2-i[1],i[0]-r[0]/2);if(void 0!==this.lastAngle_){var s=o-this.lastAngle_;n.adjustRotationInternal(-s)}this.lastAngle_=o}}},e.prototype.handleUpEvent=function(t){return!qu(t)||(t.map.getView().endInteraction(this.duration_),!1)},e.prototype.handleDownEvent=function(t){return!!qu(t)&&(!(!Xu(t)||!this.condition_(t))&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0))},e}(Nu),rh=nh,ih=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),oh=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 ih(e,t),e.prototype.disposeInternal=function(){this.setMap(null)},e.prototype.render_=function(){var t=this.startPixel_,e=this.endPixel_,n="px",r=this.element_.style;r.left=Math.min(t[0],e[0])+n,r.top=Math.min(t[1],e[1])+n,r.width=Math.abs(e[0]-t[0])+n,r.height=Math.abs(e[1]-t[1])+n},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 Fr([n])},e.prototype.getGeometry=function(){return this.geometry_},e}(u),sh=oh,ah=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),lh="boxstart",uh="boxdrag",hh="boxend",ch="boxcancel",ph=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.coordinate=n,i.mapBrowserEvent=r,i}return ah(e,t),e}(a),fh=function(t){function e(e){var n=t.call(this)||this;n.on,n.once,n.un;var r=e||{};return n.box_=new sh(r.className||"ol-dragbox"),n.minArea_=void 0!==r.minArea?r.minArea:64,r.onBoxEnd&&(n.onBoxEnd=r.onBoxEnd),n.startPixel_=null,n.condition_=r.condition?r.condition:Xu,n.boxEndCondition_=r.boxEndCondition?r.boxEndCondition:n.defaultBoxEndCondition,n}return ah(e,t),e.prototype.defaultBoxEndCondition=function(t,e,n){var r=n[0]-e[0],i=n[1]-e[1];return r*r+i*i>=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 ph(uh,t.coordinate,t))},e.prototype.handleUpEvent=function(t){this.box_.setMap(null);var e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new ph(e?hh:ch,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 ph(lh,t.coordinate,t)),!0)},e.prototype.onBoxEnd=function(t){},e}(Nu),dh=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),gh=function(t){function e(e){var n=this,r=e||{},i=r.condition?r.condition:Zu;return(n=t.call(this,{condition:i,className:r.className||"ol-dragzoom",minArea:r.minArea})||this).duration_=void 0!==r.duration?r.duration:200,n.out_=void 0!==r.out&&r.out,n}return dh(e,t),e.prototype.onBoxEnd=function(t){var e=this.getMap().getView(),n=this.getGeometry();if(this.out_){var r=e.rotatedExtentForGeometry(n),i=e.getResolutionForExtentInternal(r),o=e.getResolution()/i;(n=n.clone()).scale(o*o)}e.fitInternal(n,{duration:this.duration_,easing:rl})},e}(fh),_h=37,yh=38,vh=39,mh=40,xh=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),wh=function(t){function e(e){var n=t.call(this)||this,r=e||{};return n.defaultCondition_=function(t){return Ku(t)&&Hu(t)},n.condition_=void 0!==r.condition?r.condition:n.defaultCondition_,n.duration_=void 0!==r.duration?r.duration:100,n.pixelDelta_=void 0!==r.pixelDelta?r.pixelDelta:128,n}return xh(e,t),e.prototype.handleEvent=function(t){var e=!1;if(t.type==L){var n=t.originalEvent,r=n.keyCode;if(this.condition_(t)&&(r==mh||r==_h||r==vh||r==yh)){var i=t.map.getView(),o=i.getResolution()*this.pixelDelta_,s=0,a=0;r==mh?a=-o:r==_h?s=-o:r==vh?s=o:a=o;var l=[s,a];fn(l,i.getRotation()),function(t,e,n){var r=t.getCenterInternal();if(r){var i=[r[0]+e[0],r[1]+e[1]];t.animateInternal({duration:void 0!==n?n:250,easing:ol,center:t.getConstrainedCenter(i)})}}(i,l,this.duration_),n.preventDefault(),e=!0}}return!e},e}(Au),Sh=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ch=function(t){function e(e){var n=t.call(this)||this,r=e||{};return n.condition_=r.condition?r.condition:Hu,n.delta_=r.delta?r.delta:1,n.duration_=void 0!==r.duration?r.duration:100,n}return Sh(e,t),e.prototype.handleEvent=function(t){var e=!1;if(t.type==L||t.type==A){var n=t.originalEvent,r=n.charCode;if(this.condition_(t)&&(r=="+".charCodeAt(0)||r=="-".charCodeAt(0))){var i=t.map,o=r=="+".charCodeAt(0)?this.delta_:-this.delta_;Lu(i.getView(),o,void 0,this.duration_),n.preventDefault(),e=!0}}return!e},e}(Au),Eh=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Th="trackpad",bh="wheel",Rh=function(t){function e(e){var n=this,r=e||{};(n=t.call(this,r)||this).totalDelta_=0,n.lastDelta_=0,n.maxDelta_=void 0!==r.maxDelta?r.maxDelta:1,n.duration_=void 0!==r.duration?r.duration:250,n.timeout_=void 0!==r.timeout?r.timeout:80,n.useAnchor_=void 0===r.useAnchor||r.useAnchor,n.constrainResolution_=void 0!==r.constrainResolution&&r.constrainResolution;var i=r.condition?r.condition:Vu;return n.condition_=r.onFocusOnly?zu(Uu,i):i,n.lastAnchor_=null,n.startTime_=void 0,n.timeoutId_,n.mode_=void 0,n.trackpadEventGap_=400,n.trackpadTimeoutId_,n.deltaPerZoom_=300,n}return Eh(e,t),e.prototype.endInteraction_=function(){this.trackpadTimeoutId_=void 0,this.getMap().getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_)},e.prototype.handleEvent=function(t){if(!this.condition_(t))return!0;if(t.type!==G)return!0;var e,n=t.map,r=t.originalEvent;if(r.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.coordinate),t.type==G&&(e=r.deltaY,Et&&r.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(e/=Pt),r.deltaMode===WheelEvent.DOM_DELTA_LINE&&(e*=40)),0===e)return!1;this.lastDelta_=e;var i=Date.now();void 0===this.startTime_&&(this.startTime_=i),(!this.mode_||i-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(e)<4?Th:bh);var o=n.getView();if(this.mode_===Th&&!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_=i,!1;this.totalDelta_+=e;var s=Math.max(this.timeout_-(i-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,n),s),!1},e.prototype.handleWheelZoom_=function(t){var e=t.getView();e.getAnimating()&&e.cancelAnimations();var n=-Ie(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),Lu(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}(Au),Ph=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Oh=function(t){function e(e){var n=this,r=e||{},i=r;return i.stopDown||(i.stopDown=y),(n=t.call(this,i)||this).anchor_=null,n.lastAngle_=void 0,n.rotating_=!1,n.rotationDelta_=0,n.threshold_=void 0!==r.threshold?r.threshold:.3,n.duration_=void 0!==r.duration?r.duration:250,n}return Ph(e,t),e.prototype.handleDragEvent=function(t){var e=0,n=this.targetPointers[0],r=this.targetPointers[1],i=Math.atan2(r.clientY-n.clientY,r.clientX-n.clientX);if(void 0!==this.lastAngle_){var o=i-this.lastAngle_;this.rotationDelta_+=o,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=o}this.lastAngle_=i;var s=t.map,a=s.getView();if(a.getConstraints().rotation!==Ql){var l=s.getViewport().getBoundingClientRect(),u=Gu(this.targetPointers);u[0]-=l.left,u[1]-=l.top,this.anchor_=s.getCoordinateFromPixelInternal(u),this.rotating_&&(s.render(),a.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}(Nu),Fh=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ih=function(t){function e(e){var n=this,r=e||{},i=r;return i.stopDown||(i.stopDown=y),(n=t.call(this,i)||this).anchor_=null,n.duration_=void 0!==r.duration?r.duration:400,n.lastDistance_=void 0,n.lastScaleDelta_=1,n}return Fh(e,t),e.prototype.handleDragEvent=function(t){var e=1,n=this.targetPointers[0],r=this.targetPointers[1],i=n.clientX-r.clientX,o=n.clientY-r.clientY,s=Math.sqrt(i*i+o*o);void 0!==this.lastDistance_&&(e=this.lastDistance_/s),this.lastDistance_=s;var a=t.map,l=a.getView();1!=e&&(this.lastScaleDelta_=e);var u=a.getViewport().getBoundingClientRect(),h=Gu(this.targetPointers);h[0]-=u.left,h[1]-=u.top,this.anchor_=a.getCoordinateFromPixelInternal(h),a.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}(Nu),Mh=Ih,Lh=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ah="addfeatures",Dh=function(t){function e(e,n,r,i){var o=t.call(this,e)||this;return o.features=r,o.file=n,o.projection=i,o}return Lh(e,t),e}(a),kh=function(t){function e(e){var n=this,r=e||{};(n=t.call(this,{handleEvent:_})||this).on,n.once,n.un,n.readAsBuffer_=!1,n.formats_=[];for(var i=r.formatConstructors?r.formatConstructors:[],o=0,s=i.length;o0){this.source_&&(this.source_.clear(),this.source_.addFeatures(c)),this.dispatchEvent(new Dh(Ah,t,c,o));break}}},e.prototype.registerListeners_=function(){var t=this.getMap();if(t){var e=this.target?this.target:t.getViewport();this.dropListenKeys_=[N(e,M,this.handleDrop,this),N(e,F,this.handleStop,this),N(e,I,this.handleStop,this),N(e,M,this.handleStop,this)]}},e.prototype.setActive=function(e){!this.getActive()&&e&&this.registerListeners_(),this.getActive()&&!e&&this.unregisterListeners_(),t.prototype.setActive.call(this,e)},e.prototype.setMap=function(e){this.unregisterListeners_(),t.prototype.setMap.call(this,e),this.getActive()&&this.registerListeners_()},e.prototype.tryReadFeatures_=function(t,e,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,r=e.length;n1?1:-1;return e.endInteraction(this.duration_,n),this.lastScaleDelta_=0,!1},e.prototype.handleDownEvent=function(t){return!!qu(t)&&(!!this.condition_(t)&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,this.lastMagnitude_=void 0,!0))},e}(Nu),zh=Nh,Bh=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Uh=function(t){function e(e,n,r){var i=t.call(this)||this;if(void 0!==r&&void 0===n)i.setFlatCoordinates(r,e);else{var o=n||0;i.setCenterAndRadius(e,o,r)}return i}return Bh(e,t),e.prototype.clone=function(){var t=new e(this.flatCoordinates.slice(),void 0,this.layout);return t.applyProperties(this),t},e.prototype.closestPointXY=function(t,e,n,r){var i=this.flatCoordinates,o=t-i[0],s=e-i[1],a=o*o+s*s;if(a=e[0]||(t[1]<=e[1]&&t[3]>=e[1]||ge(t,this.intersectsCoordinate.bind(this)))}return!1},e.prototype.setCenter=function(t){var e=this.stride,n=this.flatCoordinates[e]-this.flatCoordinates[0],r=t.slice();r[e]=r[0]+n;for(var i=1;i=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===Rl.POINTERDRAG&&null!==this.sketchFeature_?(this.addToDrawing_(e.coordinate),r=!1):this.freehand_&&e.type===Rl.POINTERDOWN?r=!1:n&&this.getPointerCount()<2?(r=e.type===Rl.POINTERMOVE)&&this.freehand_?(this.handlePointerMove_(e),this.shouldHandle_&&e.originalEvent.preventDefault()):("mouse"===e.originalEvent.pointerType||e.type===Rl.POINTERDRAG&&void 0===this.downTimeout_)&&this.handlePointerMove_(e):e.type===Rl.DBLCLICK&&(r=!1),t.prototype.handleEvent.call(this,e)&&r},e.prototype.handleDownEvent=function(t){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=t.pixel,this.finishCoordinate_||this.startDrawing_(t.coordinate),!0):this.condition_(t)?(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout(function(){this.handlePointerMove_(new bl(Rl.POINTERMOVE,t.map,t.originalEvent,!1,t.frameState))}.bind(this),this.dragVertexDelay_),this.downPx_=t.pixel,!0):(this.lastDragTime_=void 0,!1)},e.prototype.handleUpEvent=function(t){var e=!0;if(0===this.getPointerCount())if(this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0),this.handlePointerMove_(t),this.shouldHandle_){var n=!this.finishCoordinate_;n&&this.startDrawing_(t.coordinate),!n&&this.freehand_?this.finishDrawing():this.freehand_||n&&this.mode_!==ec||(this.atFinish_(t.pixel)?this.finishCondition_(t)&&this.finishDrawing():this.addToDrawing_(t.coordinate)),e=!1}else this.freehand_&&this.abortDrawing();return!e&&this.stopClick_&&t.preventDefault(),e},e.prototype.handlePointerMove_=function(t){if(this.pointerType_=t.originalEvent.pointerType,this.downPx_&&(!this.freehand_&&this.shouldHandle_||this.freehand_&&!this.shouldHandle_)){var e=this.downPx_,n=t.pixel,r=e[0]-n[0],i=e[1]-n[1],o=r*r+i*i;if(this.shouldHandle_=this.freehand_?o>this.squaredClickTolerance_:o<=this.squaredClickTolerance_,!this.shouldHandle_)return}this.finishCoordinate_?this.modifyDrawing_(t.coordinate):this.createOrUpdateSketchPoint_(t.coordinate.slice())},e.prototype.atFinish_=function(t){var e=!1;if(this.sketchFeature_){var n=!1,r=[this.finishCoordinate_],i=this.mode_;if(i===ec)e=!0;else if(i===ic)e=2===this.sketchCoords_.length;else if(i===nc)n=this.sketchCoords_.length>this.minPoints_;else if(i===rc){var o=this.sketchCoords_;n=o[0].length>this.minPoints_,r=[o[0][0],o[0][o[0].length-2]]}if(n)for(var s=this.getMap(),a=0,l=r.length;a=this.maxPoints_&&(this.freehand_?n.pop():e=!0),n.push(t.slice()),this.geometryFunction_(n,r,i)):o===rc&&((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_,r,i)),this.createOrUpdateSketchPoint_(t.slice()),this.updateSketchFeatures_(),e&&this.finishDrawing()},e.prototype.removeLastPoint=function(){if(this.sketchFeature_){var t,e=this.sketchFeature_.getGeometry(),n=this.getMap().getView().getProjection(),r=this.mode_;if(r===nc||r===ic){if((t=this.sketchCoords_).splice(-2,1),t.length>=2){this.finishCoordinate_=t[t.length-2].slice();var i=this.finishCoordinate_.slice();t[t.length-1]=i,this.createOrUpdateSketchPoint_(i)}this.geometryFunction_(t,e,n),e.getType()===dt&&this.sketchLine_&&this.createOrUpdateCustomSketchLine_(e)}else if(r===rc){(t=this.sketchCoords_[0]).splice(-2,1);var o=this.sketchLine_.getGeometry();if(t.length>=2){i=t[t.length-2].slice();t[t.length-1]=i,this.createOrUpdateSketchPoint_(i)}o.setCoordinates(t),this.geometryFunction_(this.sketchCoords_,e,n)}1===t.length&&this.abortDrawing(),this.updateSketchFeatures_()}},e.prototype.finishDrawing=function(){var t=this.abortDrawing_();if(t){var e=this.sketchCoords_,n=t.getGeometry(),r=this.getMap().getView().getProjection();this.mode_===nc?(e.pop(),this.geometryFunction_(e,n,r)):this.mode_===rc&&(e[0].pop(),this.geometryFunction_(e,n,r),e=n.getCoordinates()),this.type_===gt?t.setGeometry(new Hh([e])):this.type_===_t?t.setGeometry(new Yh([e])):this.type_===yt&&t.setGeometry(new $h([e])),this.dispatchEvent(new lc(sc,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 lc(ac,t))},e.prototype.appendCoordinates=function(t){var e,n=this.mode_,r=!this.sketchFeature_;if(r&&this.startDrawing_(t[0]),n===nc||n===ic)e=this.sketchCoords_;else{if(n!==rc)return;e=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[]}r&&e.shift(),e.pop();for(var i=0;ic?o[1]:o[0]),s}}return null},e.prototype.handlePointerMove_=function(t){var e=t.pixel,n=t.map,r=this.snapToVertex_(e,n);r||(r=n.getCoordinateFromPixelInternal(e)),this.createOrUpdatePointerFeature_(r)},e.prototype.createOrUpdateExtentFeature_=function(t){var e=this.extentFeature_;return e?t?e.setGeometry(Ir(t)):e.setGeometry(void 0):(e=new st(t?Ir(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 st(new gr(t)),this.vertexFeature_=e,this.vertexOverlay_.getSource().addFeature(e));return e},e.prototype.handleEvent=function(e){return!e.originalEvent||!this.condition_(e)||(e.type!=Rl.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,r=this.getExtentInternal(),i=this.snapToVertex_(e,n),o=function(t){var e=null,n=null;return t[0]==r[0]?e=r[2]:t[0]==r[2]&&(e=r[0]),t[1]==r[1]?n=r[3]:t[1]==r[3]&&(n=r[1]),null!==e&&null!==n?[e,n]:null};if(i&&r){var s=i[0]==r[0]||i[0]==r[2]?i[0]:null,a=i[1]==r[1]||i[1]==r[3]?i[1]:null;null!==s&&null!==a?this.pointerHandler_=_c(o(i)):null!==s?this.pointerHandler_=yc(o([s,r[1]]),o([s,r[3]])):null!==a&&(this.pointerHandler_=yc(o([r[0],a]),o([r[2],a])))}else i=n.getCoordinateFromPixelInternal(e),this.setExtent([i[0],i[1],i[0],i[1]]),this.pointerHandler_=_c(i);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!==_e(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 An(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 fc(this.extent_))},e}(Nu),mc=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),xc=[0,0,0,0],wc=[],Sc="modifystart",Cc="modifyend",Ec=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.features=n,i.mapBrowserEvent=r,i}return mc(e,t),e}(a),Tc=function(t){function e(e){var n,r=t.call(this,e)||this;if(r.on,r.once,r.un,r.boundHandleFeatureChange_=r.handleFeatureChange_.bind(r),r.condition_=e.condition?e.condition:Ju,r.defaultDeleteCondition_=function(t){return function(t){var e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey}(t)&&Yu(t)},r.deleteCondition_=e.deleteCondition?e.deleteCondition:r.defaultDeleteCondition_,r.insertVertexCondition_=e.insertVertexCondition?e.insertVertexCondition:Vu,r.vertexFeature_=null,r.vertexSegments_=null,r.lastPixel_=[0,0],r.ignoreNextSingleClick_=!1,r.featuresBeingModified_=null,r.rBush_=new Oa,r.pixelTolerance_=void 0!==e.pixelTolerance?e.pixelTolerance:10,r.snappedToVertex_=!1,r.changingFeature_=!1,r.dragSegments_=[],r.overlay_=new Pa({source:new qa({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.style?e.style:Oc(),updateWhileAnimating:!0,updateWhileInteracting:!0}),r.SEGMENT_WRITERS_={Point:r.writePointGeometry_.bind(r),LineString:r.writeLineStringGeometry_.bind(r),LinearRing:r.writeLineStringGeometry_.bind(r),Polygon:r.writePolygonGeometry_.bind(r),MultiPoint:r.writeMultiPointGeometry_.bind(r),MultiLineString:r.writeMultiLineStringGeometry_.bind(r),MultiPolygon:r.writeMultiPolygonGeometry_.bind(r),Circle:r.writeCircleGeometry_.bind(r),GeometryCollection:r.writeGeometryCollectionGeometry_.bind(r)},r.source_=null,r.hitDetection_=null,e.features?n=e.features:e.source&&(r.source_=e.source,n=new nt(r.source_.getFeatures()),r.source_.addEventListener(La,r.handleSourceAdd_.bind(r)),r.source_.addEventListener(ka,r.handleSourceRemove_.bind(r))),!n)throw new Error("The modify interaction requires features, a source or a layer");return e.hitDetection&&(r.hitDetection_=e.hitDetection),r.features_=n,r.features_.forEach(r.addFeature_.bind(r)),r.features_.addEventListener(J,r.handleFeatureAdd_.bind(r)),r.features_.addEventListener(Q,r.handleFeatureRemove_.bind(r)),r.lastPointerEvent_=null,r.delta_=[0,0],r.snapToPointer_=void 0===e.snapToPointer?!r.hitDetection_:e.snapToPointer,r}return mc(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 r=this.getMap();r&&r.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,r),t.addEventListener(T,this.boundHandleFeatureChange_)},e.prototype.willModifyFeatures_=function(t,e){if(!this.featuresBeingModified_){this.featuresBeingModified_=new nt;for(var n=this.featuresBeingModified_.getArray(),r=0,i=e.length;r=0;--r){for(var i=n[r],o=this.dragSegments_.length-1;o>=0;--o)this.dragSegments_[o][0]===i&&this.dragSegments_.splice(o,1);e.remove(i)}},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(),r={feature:t,geometry:e,segment:[n,n]};this.rBush_.insert(e.getExtent(),r)},e.prototype.writeMultiPointGeometry_=function(t,e){for(var n=e.getCoordinates(),r=0,i=n.length;r=0;--_)this.insertVertex_(o[_],s)}return!!this.vertexFeature_},e.prototype.handleUpEvent=function(t){for(var e=this.dragSegments_.length-1;e>=0;--e){var n=this.dragSegments_[e][0],r=n.geometry;if(r.getType()===mt){var i=r.getCenter(),o=n.featureSegments[0],s=n.featureSegments[1];o.segment[0]=i,o.segment[1]=i,s.segment[0]=i,s.segment[1]=i,this.rBush_.update(le(i),o);var a=r;this.rBush_.update(a.getExtent(),s)}else this.rBush_.update(Jt(n.segment),n)}return this.featuresBeingModified_&&(this.dispatchEvent(new Ec(Cc,this.featuresBeingModified_,t)),this.featuresBeingModified_=null),!1},e.prototype.handlePointerMove_=function(t){this.lastPixel_=t.pixel,this.handlePointerAtPixel_(t.pixel,t.map,t.coordinate)},e.prototype.handlePointerAtPixel_=function(t,e,n){var i,o,s=this,a=n||e.getCoordinateFromPixel(t),l=e.getView().getProjection();if(this.hitDetection_){var u="object"==typeof this.hitDetection_?function(t){return t===s.hitDetection_}:void 0;e.forEachFeatureAtPixel(t,(function(t,e,n){if((n=n||t.getGeometry()).getType()===ct&&c(s.features_.getArray(),t)){o=n;var r=n.getFlatCoordinates().slice(0,2);i=[{feature:t,geometry:n,segment:[r,r]}]}return!0}),{layerFilter:u})}if(!i){var h=An(Qt(Dn(le(a,xc)),e.getView().getResolution()*this.pixelTolerance_,xc));i=this.rBush_.getInExtent(h)}if(i&&i.length>0){var p=i.sort((function(t,e){return Rc(a,t,l)-Rc(a,e,l)}))[0],f=p.segment,d=Pc(a,p,l),g=e.getPixelFromCoordinate(d),_=gn(t,g);if(o||_<=this.pixelTolerance_){var y={};if(y[r(f)]=!0,this.snapToPointer_||(this.delta_[0]=d[0]-a[0],this.delta_[1]=d[1]-a[1]),p.geometry.getType()===mt&&1===p.index)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(d,[p.feature],[p.geometry]);else{var v=e.getPixelFromCoordinate(f[0]),m=e.getPixelFromCoordinate(f[1]),x=dn(g,v),w=dn(g,m);_=Math.sqrt(Math.min(x,w)),this.snappedToVertex_=_<=this.pixelTolerance_,this.snappedToVertex_&&(d=x>w?f[1]:f[0]),this.createOrUpdateVertexFeature_(d,[p.feature],[p.geometry]);var S={};S[r(p.geometry)]=!0;for(var C=1,E=i.length;C=0;--o)c=r((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,a=f[c].left,(l=(s=f[c].index)-1)<0&&(l=0),t=e=(i=(h=void 0!==a?a:u).geometry).getCoordinates(),d=!1,i.getType()){case _t:e[h.depth[0]].length>2&&(e[h.depth[0]].splice(s,1),d=!0);break;case pt:e.length>2&&(e.splice(s,1),d=!0);break;case yt:t=t[h.depth[1]];case dt:(t=t[h.depth[0]]).length>4&&(s==t.length-1&&(s=0),t.splice(s,1),d=!0,0===s&&(t.pop(),t.push(t[0]),l=t.length-1))}if(d){this.setGeometryCoordinates_(i,e);var g=[];if(void 0!==a&&(this.rBush_.remove(a),g.push(a.segment[0])),void 0!==u&&(this.rBush_.remove(u),g.push(u.segment[1])),void 0!==a&&void 0!==u){var _={depth:h.depth,feature:h.feature,geometry:h.geometry,index:l,segment:g};this.rBush_.insert(Jt(_.segment),_)}this.updateSegmentIndices_(i,s,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,r){this.rBush_.forEachInExtent(t.getExtent(),(function(i){i.geometry===t&&(void 0===n||void 0===i.depth||g(i.depth,n))&&i.index>e&&(i.index+=r)}))},e}(Nu);function bc(t,e){return t.index-e.index}function Rc(t,e,n){var r=e.geometry;if(r.getType()===mt){var i=r;if(1===e.index){null;var o=dn(i.getCenter(),Ln(t)),s=Math.sqrt(o)-i.getRadius();return s*s}}var a=Ln(t);return wc[0]=Ln(e.segment[0]),wc[1]=Ln(e.segment[1]),_n(a,wc)}function Pc(t,e,n){var r=e.geometry;if(r.getType()===mt&&1===e.index){var i=r;return Mn(i.getClosestPoint(Ln(t)))}var o=Ln(t);return wc[0]=Ln(e.segment[0]),wc[1]=Ln(e.segment[1]),Mn(cn(o,wc))}function Oc(){var t=Qi();return function(e,n){return t[ct]}}var Fc=Tc,Ic=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Mc="select",Lc=function(t){function e(e,n,r,i){var o=t.call(this,e)||this;return o.selected=n,o.deselected=r,o.mapBrowserEvent=i,o}return Ic(e,t),e}(a),Ac={},Dc=function(t){function e(e){var n=t.call(this)||this;n.on,n.once,n.un;var r,i,o=e||{};if(n.boundAddFeature_=n.addFeature_.bind(n),n.boundRemoveFeature_=n.removeFeature_.bind(n),n.condition_=o.condition?o.condition:Yu,n.addCondition_=o.addCondition?o.addCondition:Wu,n.removeCondition_=o.removeCondition?o.removeCondition:Wu,n.toggleCondition_=o.toggleCondition?o.toggleCondition:Zu,n.multi_=!!o.multi&&o.multi,n.filter_=o.filter?o.filter:_,n.hitTolerance_=o.hitTolerance?o.hitTolerance:0,n.style_=void 0!==o.style?o.style:(d((r=Qi())[dt],r[pt]),d(r[vt],r[pt]),function(t){return t.getGeometry()?r[t.getGeometry().getType()]:null}),n.features_=o.features||new nt,o.layers)if("function"==typeof o.layers)i=o.layers;else{var s=o.layers;i=function(t){return c(s,t)}}else i=_;return n.layerFilter_=i,n.featureLayerAssociation_={},n}return Ic(e,t),e.prototype.addFeatureLayerAssociation_=function(t,e){this.featureLayerAssociation_[r(t)]=e},e.prototype.getFeatures=function(){return this.features_},e.prototype.getHitTolerance=function(){return this.hitTolerance_},e.prototype.getLayer=function(t){return this.featureLayerAssociation_[r(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(J,this.boundAddFeature_),this.features_.addEventListener(Q,this.boundRemoveFeature_),this.style_&&this.features_.forEach(this.applySelectedStyle_.bind(this))):(this.features_.removeEventListener(J,this.boundAddFeature_),this.features_.removeEventListener(Q,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=r(t);e in Ac||(Ac[e]=t.getStyle()),t.setStyle(this.style_)},e.prototype.restorePreviousStyle_=function(t){for(var n=this.getMap().getInteractions().getArray(),i=n.length-1;i>=0;--i){var o=n[i];if(o!==this&&o instanceof e&&o.getStyle()&&-1!==o.getFeatures().getArray().lastIndexOf(t))return void t.setStyle(o.getStyle())}var s=r(t);t.setStyle(Ac[s]),delete Ac[s]},e.prototype.removeFeatureLayerAssociation_=function(t){delete this.featureLayerAssociation_[r(t)]},e.prototype.handleEvent=function(t){if(!this.condition_(t))return!0;var e=this.addCondition_(t),n=this.removeCondition_(t),r=this.toggleCondition_(t),i=!e&&!n&&!r,o=t.map,s=this.getFeatures(),a=[],l=[];if(i){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=s.getLength()-1;u>=0;--u){var h=s.item(u),p=l.indexOf(h);p>-1?l.splice(p,1):(s.remove(h),a.push(h))}0!==l.length&&s.extend(l)}else{o.forEachFeatureAtPixel(t.pixel,function(t,i){if(this.filter_(t,i))return!e&&!r||c(s.getArray(),t)?(n||r)&&c(s.getArray(),t)&&(a.push(t),this.removeFeatureLayerAssociation_(t)):(l.push(t),this.addFeatureLayerAssociation_(t,i)),!this.multi_}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(var f=a.length-1;f>=0;--f)s.remove(a[f]);s.extend(l)}return(l.length>0||a.length>0)&&this.dispatchEvent(new Lc(Mc,l,a,t)),!0},e}(Au);var kc=Dc,jc=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();function Gc(t){return t.feature?t.feature:t.element?t.element:void 0}var Nc=[],zc=function(t){function e(e){var n=this,r=e||{},i=r;return i.handleDownEvent||(i.handleDownEvent=_),i.stopDown||(i.stopDown=y),(n=t.call(this,i)||this).source_=r.source?r.source:null,n.vertex_=void 0===r.vertex||r.vertex,n.edge_=void 0===r.edge||r.edge,n.features_=r.features?r.features:null,n.featuresListenerKeys_=[],n.featureChangeListenerKeys_={},n.indexedFeaturesExtents_={},n.pendingFeatures_={},n.pixelTolerance_=void 0!==r.pixelTolerance?r.pixelTolerance:10,n.rBush_=new Oa,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 jc(e,t),e.prototype.addFeature=function(t,e){var n=void 0===e||e,i=r(t),o=t.getGeometry();if(o){var s=this.SEGMENT_WRITERS_[o.getType()];s&&(this.indexedFeaturesExtents_[i]=o.getExtent([1/0,1/0,-1/0,-1/0]),s(t,o))}n&&(this.featureChangeListenerKeys_[i]=N(t,T,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=Gc(t);this.addFeature(e)},e.prototype.handleFeatureRemove_=function(t){var e=Gc(t);this.removeFeature(e)},e.prototype.handleFeatureChange_=function(t){var e=t.target;if(this.handlingDownUpSequence){var n=r(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,i=r(t),o=this.indexedFeaturesExtents_[i];if(o){var s=this.rBush_,a=[];s.forEachInExtent(o,(function(e){t===e.feature&&a.push(e)}));for(var l=a.length-1;l>=0;--l)s.remove(a[l])}n&&(B(this.featureChangeListenerKeys_[i]),delete this.featureChangeListenerKeys_[i])},e.prototype.setMap=function(e){var n=this.getMap(),r=this.featuresListenerKeys_,i=this.getFeatures_();n&&(r.forEach(B),r.length=0,i.forEach(this.forEachFeatureRemove_.bind(this))),t.prototype.setMap.call(this,e),e&&(this.features_?r.push(N(this.features_,J,this.handleFeatureAdd_,this),N(this.features_,Q,this.handleFeatureRemove_,this)):this.source_&&r.push(N(this.source_,La,this.handleFeatureAdd_,this),N(this.source_,ka,this.handleFeatureRemove_,this)),i.forEach(this.forEachFeatureAdd_.bind(this)))},e.prototype.snapTo=function(t,e,n){var r=Jt([n.getCoordinateFromPixel([t[0]-this.pixelTolerance_,t[1]+this.pixelTolerance_]),n.getCoordinateFromPixel([t[0]+this.pixelTolerance_,t[1]-this.pixelTolerance_])]),i=this.rBush_.getInExtent(r);this.vertex_&&!this.edge_&&(i=i.filter((function(t){return t.feature.getGeometry().getType()!==mt})));var o=!1,s=null,a=null;if(0===i.length)return{snapped:o,vertex:s,vertexPixel:a};n.getView().getProjection();for(var l,u=Ln(e),h=1/0,c=0;cv?d[1]:d[0],a=n.getPixelFromCoordinate(s))}else if(this.edge_){var m=l.feature.getGeometry().getType()===mt;if(m){var x=l.feature.getGeometry();null,s=Mn(function(t,e){var n=e.getRadius(),r=e.getCenter(),i=r[0],o=r[1],s=t[0]-i,a=t[1]-o;0===s&&0===a&&(s=1);var l=Math.sqrt(s*s+a*a);return[i+n*s/l,o+n*a/l]}(u,x))}else Nc[0]=Ln(d[0]),Nc[1]=Ln(d[1]),s=Mn(cn(u,Nc));if(gn(t,a=n.getPixelFromCoordinate(s))<=this.pixelTolerance_&&(o=!0,this.vertex_&&!m)){g=n.getPixelFromCoordinate(d[0]),_=n.getPixelFromCoordinate(d[1]),y=dn(a,g),v=dn(a,_);Math.sqrt(Math.min(y,v))<=this.pixelTolerance_&&(s=y>v?d[1]:d[0],a=n.getPixelFromCoordinate(s))}}return o&&(a=[Math.round(a[0]),Math.round(a[1])]),{snapped:o,vertex:s,vertexPixel:a}},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=Mr(e).getCoordinates()[0],r=0,i=n.length-1;r0&&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 rt(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 rt(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){rt(!(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 tp(t,e,n,r){return void 0!==r?(r[0]=t,r[1]=e,r[2]=n,r):[t,e,n]}function ep(t,e,n){return t+"/"+e+"/"+n}function np(t){return ep(t[0],t[1],t[2])}function rp(t){return t.split("/").map(Number)}function ip(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 up(t,e,n,r,i){return void 0!==i?(i.minX=t,i.maxX=e,i.minY=n,i.maxY=r,i):new lp(t,e,n,r)}var hp=lp,cp=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),pp=[],fp=function(t){function e(e,n,r,i){var o=t.call(this,e,n,{transition:0})||this;return o.context_={},o.executorGroups={},o.declutterExecutorGroups={},o.loadingSourceTiles=0,o.hitDetectionImageData={},o.replayState_={},o.sourceTiles=[],o.errorTileKeys={},o.wantedResolution,o.getSourceTiles=i.bind(void 0,o),o.wrappedTileCoord=r,o}return cp(e,t),e.prototype.getContext=function(t){var e=r(t);return e in this.context_||(this.context_[e]=pi(1,1,pp)),this.context_[e]},e.prototype.hasContext=function(t){return r(t)in this.context_},e.prototype.getImage=function(t){return this.hasContext(t)?this.getContext(t).canvas:null},e.prototype.getReplayState=function(t){var e=r(t);return e in this.replayState_||(this.replayState_[e]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedTileZ:-1}),this.replayState_[e]},e.prototype.load=function(){this.getSourceTiles()},e.prototype.release=function(){for(var e in this.context_)pp.push(this.context_[e].canvas),delete this.context_[e];t.prototype.release.call(this)},e}(ll),dp=fp,gp=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),_p=function(t){function e(e,n,r,i,o,s){var a=t.call(this,e,n,s)||this;return a.extent=null,a.format_=i,a.features_=null,a.loader_,a.projection=null,a.resolution,a.tileLoadFunction_=o,a.url_=r,a.key=r,a}return gp(e,t),e.prototype.getFormat=function(){return this.format_},e.prototype.getFeatures=function(){return this.features_},e.prototype.load=function(){this.state==Ja&&(this.setState(Qa),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))},e.prototype.onLoad=function(t,e){this.setFeatures(t)},e.prototype.onError=function(){this.setState(tl)},e.prototype.setFeatures=function(t){this.features_=t,this.setState($a)},e.prototype.setLoader=function(t){this.loader_=t},e}(ll),yp=_p;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function vp(t){if(t.__esModule)return t;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(t).forEach((function(n){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})})),e}var mp={exports:{}},xp=vp(cu),wp=vp(Y),Sp=vp(Sl);!function(t,e){t.exports=function(t,e,n){t="default"in t?t.default:t,n="default"in n?n.default:n;var r=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},i=function(){function t(t,e){for(var n=0;ne.getMaxResolution()||y=0?t:"children"}}]),u}(t);return window.ol&&window.ol.control&&(window.ol.control.LayerSwitcher=u),u}(xp,wp,Sp)}(mp);var Cp=mp.exports,Ep=function(){function t(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.supportedMediaTypes=null}return t.prototype.getReadOptions=function(t,e){var n;if(e){var r=e.dataProjection?wn(e.dataProjection):this.readProjection(t);e.extent&&r&&r.getUnits()===St.TILE_PIXELS&&(r=wn(r)).setWorldExtent(e.extent),n={dataProjection:r,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}(),Tp=Ep;function bp(t,e,n){var r,i=n?wn(n.featureProjection):null,o=n?wn(n.dataProjection):null;if(r=i&&o&&!Tn(i,o)?(e?t.clone():t).transform(e?i:o,e?o:i):t,e&&n&&void 0!==n.decimals){var s=Math.pow(10,n.decimals);r===t&&(r=t.clone()),r.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=Vp(t);return this.readFeaturesFromDocument(n,e)}return Up(t)?this.readFeaturesFromDocument(t,e):this.readFeaturesFromNode(t,e)}return[]},n.prototype.readFeaturesFromDocument=function(t,e){for(var n=[],r=t.firstChild;r;r=r.nextSibling)r.nodeType==Node.ELEMENT_NODE&&d(n,this.readFeaturesFromNode(r,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=Vp(t);return this.readGeometryFromDocument(n,e)}return Up(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=Vp(t);return this.readProjectionFromDocument(e)}return Up(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}(Tp),lf=af;function uf(t){var e,n=zp(t,!1);return(e=/^\s*(true|1)|(false|0)\s*$/.exec(n))?void 0!==e[1]||!1:void 0}function hf(t){var e,n=zp(t,!1);return(e=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*$/i.exec(n))?parseFloat(e[1]):void 0}function cf(t){return zp(t,!1).trim()}function pf(t,e){df(t,e?"1":"0")}function ff(t,e){var n=e.toPrecision();t.appendChild(of().createTextNode(n))}function df(t,e){t.appendChild(of().createTextNode(e))}var gf,_f,yf,vf,mf,xf,wf,Sf,Cf,Ef=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Tf=["http://www.google.com/kml/ext/2.2"],bf=[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"],Rf={fraction:qs,pixels:Js,insetPixels:Js},Pf=Qp(bf,{ExtendedData:Sd,Region:Cd,MultiGeometry:Kp(fd,"geometry"),LineString:Kp(hd,"geometry"),LinearRing:Kp(cd,"geometry"),Point:Kp(dd,"geometry"),Polygon:Kp(_d,"geometry"),Style:Kp(vd),StyleMap:function(t,e){var n=qf.call(this,t,e);if(!n)return;var r=e[e.length-1];Array.isArray(n)?r.Style=n:"string"==typeof n?r.styleUrl=n:rt(!1,38)},address:Kp(cf),description:Kp(cf),name:Kp(cf),open:Kp(uf),phoneNumber:Kp(cf),styleUrl:Kp(Kf),visibility:Kp(uf)},Qp(Tf,{MultiTrack:Kp((function(t,e){var n=tf([],rd,t,e);if(!n)return;return new Yh(n)}),"geometry"),Track:Kp(od,"geometry")})),Of=Qp(bf,{ExtendedData:Sd,Region:Cd,Link:function(t,e){$p(Ff,t,e)},address:Kp(cf),description:Kp(cf),name:Kp(cf),open:Kp(uf),phoneNumber:Kp(cf),visibility:Kp(uf)}),Ff=Qp(bf,{href:Kp(Yf)}),If=Qp(bf,{LatLonAltBox:function(t,e){var n=tf({},bd,t,e);if(!n)return;var r=e[e.length-1],i=[parseFloat(n.west),parseFloat(n.south),parseFloat(n.east),parseFloat(n.north)];r.extent=i,r.altitudeMode=n.altitudeMode,r.minAltitude=parseFloat(n.minAltitude),r.maxAltitude=parseFloat(n.maxAltitude)},Lod:function(t,e){var n=tf({},Rd,t,e);if(!n)return;var r=e[e.length-1];r.minLodPixels=parseFloat(n.minLodPixels),r.maxLodPixels=parseFloat(n.maxLodPixels),r.minFadeExtent=parseFloat(n.minFadeExtent),r.maxFadeExtent=parseFloat(n.maxFadeExtent)}}),Mf=Qp(bf,["Document","Placemark"]),Lf=Qp(bf,{Document:Zp((function(t,e,n){ef({node:t},Md,Ld,e,n,void 0,this)})),Placemark:Zp(rg)}),Af=null,Df=null,kf=null,jf=null,Gf=null,Nf=null;function zf(t){return 32/Math.min(t[0],t[1])}function Bf(t){return t}var Uf=function(t){function e(e){var n=t.call(this)||this,r=e||{};return Nf||(Af=new Gr({color:gf=[255,255,255,1]}),xf="https://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png",Df=new da({anchor:_f=[20,2],anchorOrigin:Qs,anchorXUnits:yf=Js,anchorYUnits:vf=Js,crossOrigin:"anonymous",rotation:0,scale:zf(mf=[64,64]),size:mf,src:xf}),wf="NO_IMAGE",kf=new Wr({color:gf,width:1}),Sf=new Wr({color:[51,51,51,1],width:2}),jf=new io({font:"bold 16px Helvetica",fill:Af,stroke:Sf,scale:.8}),Gf=new to({fill:Af,image:Df,text:jf,stroke:kf,zIndex:0}),Nf=[Gf]),n.dataProjection=wn("EPSG:4326"),n.defaultStyle_=r.defaultStyle?r.defaultStyle:Nf,n.extractStyles_=void 0===r.extractStyles||r.extractStyles,n.writeStyles_=void 0===r.writeStyles||r.writeStyles,n.sharedStyles_={},n.showPointNames_=void 0===r.showPointNames||r.showPointNames,n.crossOrigin_=void 0!==r.crossOrigin?r.crossOrigin:"anonymous",n.iconUrlFunction_=r.iconUrlFunction?r.iconUrlFunction:Bf,n.supportedMediaTypes=["application/vnd.google-earth.kml+xml"],n}return Ef(e,t),e.prototype.readDocumentOrFolder_=function(t,e){var n=tf([],Qp(bf,{Document:Xp(this.readDocumentOrFolder_,this),Folder:Xp(this.readDocumentOrFolder_,this),Placemark:Wp(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=tf({geometry:null},Pf,t,e,this);if(n){var r=new st,i=t.getAttribute("id");null!==i&&r.setId(i);var o=e[0],s=n.geometry;if(s&&bp(s,!1,o),r.setGeometry(s),delete n.geometry,this.extractStyles_){var a=function(t,e,n,r,i){return function(o,s){var a=i,l="",u=[];if(a){var h=o.getGeometry();if(h){var c=h.getType();c===vt?(u=h.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return e===ct||e===gt})),a=u.length>0):a=c===ct||c===gt}}a&&(l=o.get("name"),(a=a&&!!l)&&l.search(/&[^&]+;/)>-1&&(Cf||(Cf=document.createElement("textarea")),Cf.innerHTML=l,l=Cf.value));var p=n;if(t?p=t:e&&(p=Vf(e,n,r)),a){var f=function(t,e){var n=[0,0],r="start",i=t.getImage();if(i){var o=i.getSize();if(o&&2==o.length){var s=i.getScaleArray(),a=i.getAnchor();n[0]=s[0]*(o[0]-a[0]),n[1]=s[1]*(o[1]/2-a[1]),r="left"}}var l=t.getText();l?((l=l.clone()).setFont(l.getFont()||jf.getFont()),l.setScale(l.getScale()||jf.getScale()),l.setFill(l.getFill()||jf.getFill()),l.setStroke(l.getStroke()||Sf)):l=jf.clone();return l.setText(e),l.setOffsetX(n[0]),l.setOffsetY(n[1]),l.setTextAlign(r),new to({image:i,text:l})}(p[0],l);return u.length>0?(f.setGeometry(new Lp(u)),[f,new to({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_);r.setStyle(a)}return delete n.Style,r.setProperties(n,!0),r}},e.prototype.readSharedStyle_=function(t,e){var n=t.getAttribute("id");if(null!==n){var r=vd.call(this,t,e);if(r){var i=void 0,o=t.baseURI;if(o&&"about:blank"!=o||(o=window.location.href),o)i=new URL("#"+n,o).href;else i="#"+n;this.sharedStyles_[i]=r}}},e.prototype.readSharedStyleMap_=function(t,e){var n=t.getAttribute("id");if(null!==n){var r=qf.call(this,t,e);if(r){var i,o=t.baseURI;if(o&&"about:blank"!=o||(o=window.location.href),o)i=new URL("#"+n,o).href;else i="#"+n;this.sharedStyles_[i]=r}}},e.prototype.readFeatureFromNode=function(t,e){if(!c(bf,t.namespaceURI))return null;var n=this.readPlacemark_(t,[this.getReadOptions(t,e)]);return n||null},e.prototype.readFeaturesFromNode=function(t,e){if(!c(bf,t.namespaceURI))return[];var n,r=t.localName;if("Document"==r||"Folder"==r)return(n=this.readDocumentOrFolder_(t,[this.getReadOptions(t,e)]))||[];if("Placemark"==r){var i=this.readPlacemark_(t,[this.getReadOptions(t,e)]);return i?[i]:[]}if("kml"==r){n=[];for(var o=t.firstElementChild;o;o=o.nextElementSibling){var s=this.readFeaturesFromNode(o,e);s&&d(n,s)}return n}return[]},e.prototype.readName=function(t){if(t){if("string"==typeof t){var e=Vp(t);return this.readNameFromDocument(e)}return Up(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(bf,e.namespaceURI)&&"name"==e.localName)return cf(e);for(e=t.firstElementChild;e;e=e.nextElementSibling){var n=e.localName;if(c(bf,e.namespaceURI)&&("Document"==n||"Folder"==n||"Placemark"==n||"kml"==n)){var r=this.readNameFromNode(e);if(r)return r}}},e.prototype.readNetworkLinks=function(t){var e=[];if("string"==typeof t){var n=Vp(t);d(e,this.readNetworkLinksFromDocument(n))}else Up(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(bf,n.namespaceURI)&&"NetworkLink"==n.localName){var r=tf({},Of,n,[]);e.push(r)}for(n=t.firstElementChild;n;n=n.nextElementSibling){var i=n.localName;!c(bf,n.namespaceURI)||"Document"!=i&&"Folder"!=i&&"kml"!=i||d(e,this.readNetworkLinksFromNode(n))}return e},e.prototype.readRegion=function(t){var e=[];if("string"==typeof t){var n=Vp(t);d(e,this.readRegionFromDocument(n))}else Up(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(bf,n.namespaceURI)&&"Region"==n.localName){var r=tf({},If,n,[]);e.push(r)}for(n=t.firstElementChild;n;n=n.nextElementSibling){var i=n.localName;!c(bf,n.namespaceURI)||"Document"!=i&&"Folder"!=i&&"kml"!=i||d(e,this.readRegionFromNode(n))}return e},e.prototype.writeFeaturesNode=function(t,e){e=this.adaptOptions(e);var n=Np(bf[4],"kml"),r="http://www.w3.org/2000/xmlns/";n.setAttributeNS(r,"xmlns:gx",Tf[0]),n.setAttributeNS(r,"xmlns:xsi",Gp),n.setAttributeNS(Gp,"xsi:schemaLocation","http://www.opengis.net/kml/2.2 https://developers.google.com/kml/schema/kml22gx.xsd");var i={node:n},o={};t.length>1?o.Document=t:1==t.length&&(o.Placemark=t[0]);var s=Mf[n.namespaceURI],a=Jp(o,s);return ef(i,Lf,qp,a,[e],s,this),n},e}(lf);function Vf(t,e,n){return Array.isArray(t)?t:"string"==typeof t?Vf(n[t],e,n):e}function Xf(t){var e=zp(t,!1),n=/^\s*#?\s*([0-9A-Fa-f]{8})\s*$/.exec(e);if(n){var r=n[1];return[parseInt(r.substr(6,2),16),parseInt(r.substr(4,2),16),parseInt(r.substr(2,2),16),parseInt(r.substr(0,2),16)/255]}}function Wf(t){var e=zp(t,!1),n=[];e=e.replace(/\s*,\s*/g,",");for(var r,i=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?),([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s+|,|$)(?:([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s+|$))?\s*/i;r=i.exec(e);){var o=parseFloat(r[1]),s=parseFloat(r[2]),a=r[3]?parseFloat(r[3]):0;n.push(o,s,a),e=e.substr(r[0].length)}if(""===e)return n}function Yf(t){var e=zp(t,!1).trim(),n=t.baseURI;return n&&"about:blank"!=n||(n=window.location.href),n?new URL(e,n).href:e}function Kf(t){var e=zp(t,!1).trim().replace(/^(?!.*#)/,"#"),n=t.baseURI;return n&&"about:blank"!=n||(n=window.location.href),n?new URL(e,n).href:e}function Zf(t){return hf(t)}var Hf=Qp(bf,{Pair:function(t,e){var n=tf({},Ed,t,e,this);if(!n)return;var r=n.key;if(r&&"normal"==r){var i=n.styleUrl;i&&(e[e.length-1]=i);var o=n.Style;o&&(e[e.length-1]=o)}}});function qf(t,e){return tf(void 0,Hf,t,e,this)}var Jf=Qp(bf,{Icon:Kp((function(t,e){var n=tf({},sd,t,e);return n||null})),color:Kp(Xf),heading:Kp(hf),hotSpot:Kp((function(t){var e,n=t.getAttribute("xunits"),r=t.getAttribute("yunits");return e="insetPixels"!==n?"insetPixels"!==r?Qs:ta:"insetPixels"!==r?$s:ea,{x:parseFloat(t.getAttribute("x")),xunits:Rf[n],y:parseFloat(t.getAttribute("y")),yunits:Rf[r],origin:e}})),scale:Kp(Zf)});var Qf=Qp(bf,{color:Kp(Xf),scale:Kp(Zf)});var $f=Qp(bf,{color:Kp(Xf),width:Kp(hf)});var td=Qp(bf,{color:Kp(Xf),fill:Kp(uf),outline:Kp(uf)});var ed=Qp(bf,{coordinates:Yp(Wf)});function nd(t,e){return tf(null,ed,t,e)}var rd=Qp(Tf,{Track:Wp(od)});var id=Qp(bf,{when:function(t,e){var n=e[e.length-1].whens,r=zp(t,!1),i=Date.parse(r);n.push(isNaN(i)?0:i)}},Qp(Tf,{coord:function(t,e){var n=e[e.length-1].coordinates,r=zp(t,!1),i=/^\s*([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s*$/i.exec(r);if(i){var o=parseFloat(i[1]),s=parseFloat(i[2]),a=parseFloat(i[3]);n.push([o,s,a])}else n.push([])}}));function od(t,e){var n=tf({coordinates:[],whens:[]},id,t,e);if(n){for(var r=[],i=n.coordinates,o=n.whens,s=0,a=Math.min(i.length,o.length);s0){var r=e[e.length-1];r.push.apply(r,n)}},outerBoundaryIs:function(t,e){var n=tf(void 0,Od,t,e);if(n){e[e.length-1][0]=n}}});function _d(t,e){var n=tf({},ud,t,e),r=tf([null],gd,t,e);if(r&&r[0]){for(var i=r[0],o=[i.length],s=1,a=r.length;s0,h=l.href;h?r=h:u&&(r=xf);var c,p=Qs,f=n.hotSpot;f?(i=[f.x,f.y],o=f.xunits,s=f.yunits,p=f.origin):/^http:\/\/maps\.(?:google|gstatic)\.com\//.test(r)&&(/pushpin/.test(r)?(i=_f,o=yf,s=vf):/arrow-reverse/.test(r)?(i=[54,42],o=yf,s=vf):/paddle/.test(r)&&(i=[32,1],o=yf,s=vf));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=je(x));var w=n.scale,S=n.color;if(u){r==xf&&(d=mf);var C=new da({anchor:i,anchorOrigin:p,anchorXUnits:o,anchorYUnits:s,crossOrigin:this.crossOrigin_,offset:c,offsetOrigin:Qs,rotation:y,scale:w,size:d,src:this.iconUrlFunction_(r),color:S}),E=C.getScaleArray()[0],T=C.getSize();if(null===T){var b=C.getImageState();if(b===Yr||b===Kr){var R=function(){var t=C.getImageState();if(t!==Yr&&t!==Kr){var e=C.getSize();if(e&&2==e.length){var n=zf(e);C.setScale(E*n)}C.unlistenImageChange(R)}};C.listenImageChange(R),b===Yr&&C.load()}}else if(2==T.length){var P=zf(T);C.setScale(E*P)}a.imageStyle=C}else a.imageStyle=wf}},LabelStyle:function(t,e){var n=tf({},Qf,t,e);if(n){var r=e[e.length-1],i=new io({fill:new Gr({color:"color"in n?n.color:gf}),scale:n.scale});r.textStyle=i}},LineStyle:function(t,e){var n=tf({},$f,t,e);if(n){var r=e[e.length-1],i=new Wr({color:"color"in n?n.color:gf,width:"width"in n?n.width:1});r.strokeStyle=i}},PolyStyle:function(t,e){var n=tf({},td,t,e);if(n){var r=e[e.length-1],i=new Gr({color:"color"in n?n.color:gf});r.fillStyle=i;var o=n.fill;void 0!==o&&(r.fill=o);var s=n.outline;void 0!==s&&(r.outline=s)}}});function vd(t,e){var n=tf({},yd,t,e,this);if(!n)return null;var r,i="fillStyle"in n?n.fillStyle:Af,o=n.fill;void 0===o||o||(i=null),"imageStyle"in n?n.imageStyle!=wf&&(r=n.imageStyle):r=Df;var s="textStyle"in n?n.textStyle:jf,a="strokeStyle"in n?n.strokeStyle:kf,l=n.outline;return void 0===l||l?[new to({fill:i,image:r,stroke:a,text:s,zIndex:void 0})]:[new to({geometry:function(t){var e=t.getGeometry(),n=e.getType();return n===vt?new Lp(e.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return e!==dt&&e!==yt}))):n!==dt&&n!==yt?e:void 0},fill:i,image:r,stroke:a,text:s,zIndex:void 0}),new to({geometry:function(t){var e=t.getGeometry(),n=e.getType();return n===vt?new Lp(e.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return e===dt||e===yt}))):n===dt||n===yt?e:void 0},fill:i,stroke:null,zIndex:void 0})]}function md(t,e){var n,r,i,o=e.length,s=new Array(e.length),a=new Array(e.length),l=new Array(e.length);n=!1,r=!1,i=!1;for(var u=0;u0){var y=Jp(i,s);ef(r,tg,ng,[{names:s,values:y}],n)}var v=n[0],m=e.getGeometry();m&&(m=bp(m,!0,v)),ef(r,tg,Wd,[m],n)}var ig=Qp(bf,["extrude","tessellate","altitudeMode","coordinates"]),og=Qp(bf,{extrude:Zp(pf),tessellate:Zp(pf),altitudeMode:Zp(df),coordinates:Zp((function(t,e,n){var r,i=n[n.length-1],o=i.layout,s=i.stride;o==at||o==ut?r=2:o==lt||o==ht?r=3:rt(!1,34);var a=e.length,l="";if(a>0){l+=e[0];for(var u=1;u */ read:function(t,e,n,r,i){var o,s,a=8*i-r-1,l=(1<>1,h=-7,c=n?i-1:0,p=n?-1:1,f=t[e+c];for(c+=p,o=f&(1<<-h)-1,f>>=-h,h+=a;h>0;o=256*o+t[e+c],c+=p,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=r;h>0;s=256*s+t[e+c],c+=p,h-=8);if(0===o)o=1-u;else{if(o===l)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,r),o-=u}return(f?-1:1)*s*Math.pow(2,o-r)},write:function(t,e,n,r,i,o){var s,a,l,u=8*o-i-1,h=(1<>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,d=r?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),(e+=s+c>=1?p/l:p*Math.pow(2,1-c))*l>=2&&(s++,l/=2),s+c>=h?(a=0,s=h):s+c>=1?(a=(e*l-1)*Math.pow(2,i),s+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,i),s=0));i>=8;t[n+f]=255&a,f+=d,a/=256,i-=8);for(s=s<0;t[n+f]=255&s,f+=d,s/=256,u-=8);t[n+f-d]|=128*g}},vg=xg,mg=yg;function xg(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}xg.Varint=0,xg.Fixed64=1,xg.Bytes=2,xg.Fixed32=5;var wg=4294967296,Sg=1/wg,Cg="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function Eg(t){return t.type===xg.Bytes?t.readVarint()+t.pos:t.pos+1}function Tg(t,e,n){return n?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function bg(t,e,n){var r=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));n.realloc(r);for(var i=n.pos-1;i>=t;i--)n.buf[i+r]=n.buf[i]}function Rg(t,e){for(var n=0;n>>8,t[n+2]=e>>>16,t[n+3]=e>>>24}function Gg(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}xg.prototype={destroy:function(){this.buf=null},readFields:function(t,e,n){for(n=n||this.length;this.pos>3,o=this.pos;this.type=7&r,t(i,e,this),this.pos===o&&this.skip(r)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=kg(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Gg(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=kg(this.buf,this.pos)+kg(this.buf,this.pos+4)*wg;return this.pos+=8,t},readSFixed64:function(){var t=kg(this.buf,this.pos)+Gg(this.buf,this.pos+4)*wg;return this.pos+=8,t},readFloat:function(){var t=mg.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=mg.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,n,r=this.buf;return e=127&(n=r[this.pos++]),n<128?e:(e|=(127&(n=r[this.pos++]))<<7,n<128?e:(e|=(127&(n=r[this.pos++]))<<14,n<128?e:(e|=(127&(n=r[this.pos++]))<<21,n<128?e:function(t,e,n){var r,i,o=n.buf;if(i=o[n.pos++],r=(112&i)>>4,i<128)return Tg(t,r,e);if(i=o[n.pos++],r|=(127&i)<<3,i<128)return Tg(t,r,e);if(i=o[n.pos++],r|=(127&i)<<10,i<128)return Tg(t,r,e);if(i=o[n.pos++],r|=(127&i)<<17,i<128)return Tg(t,r,e);if(i=o[n.pos++],r|=(127&i)<<24,i<128)return Tg(t,r,e);if(i=o[n.pos++],r|=(1&i)<<31,i<128)return Tg(t,r,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(n=r[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Cg?function(t,e,n){return Cg.decode(t.subarray(e,n))}(this.buf,e,t):function(t,e,n){var r="",i=e;for(;i239?4:l>223?3:l>191?2:1;if(i+h>n)break;1===h?l<128&&(u=l):2===h?128==(192&(o=t[i+1]))&&(u=(31&l)<<6|63&o)<=127&&(u=null):3===h?(o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&((u=(15&l)<<12|(63&o)<<6|63&s)<=2047||u>=55296&&u<=57343)&&(u=null)):4===h&&(o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&((u=(15&l)<<18|(63&o)<<12|(63&s)<<6|63&a)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,h=1):u>65535&&(u-=65536,r+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),r+=String.fromCharCode(u),i+=h}return r}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==xg.Bytes)return t.push(this.readVarint(e));var n=Eg(this);for(t=t||[];this.pos127;);else if(e===xg.Bytes)this.pos=this.readVarint()+this.pos;else if(e===xg.Fixed32)this.pos+=4;else{if(e!==xg.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455||t<0?function(t,e){var n,r;t>=0?(n=t%4294967296|0,r=t/4294967296|0):(r=~(-t/4294967296),4294967295^(n=~(-t%4294967296))?n=n+1|0:(n=0,r=r+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,n){n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos]=127&t}(n,0,e),function(t,e){var n=(7&t)<<4;if(e.buf[e.pos++]|=n|((t>>>=3)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;e.buf[e.pos++]=127&t}(r,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,n){for(var r,i,o=0;o55295&&r<57344){if(!i){r>56319||o+1===e.length?(t[n++]=239,t[n++]=191,t[n++]=189):i=r;continue}if(r<56320){t[n++]=239,t[n++]=191,t[n++]=189,i=r;continue}r=i-55296<<10|r-56320|65536,i=null}else i&&(t[n++]=239,t[n++]=191,t[n++]=189,i=null);r<128?t[n++]=r:(r<2048?t[n++]=r>>6|192:(r<65536?t[n++]=r>>12|224:(t[n++]=r>>18|240,t[n++]=r>>12&63|128),t[n++]=r>>6&63|128),t[n++]=63&r|128)}return n}(this.buf,t,this.pos);var n=this.pos-e;n>=128&&bg(e,n,this),this.pos=e-1,this.writeVarint(n),this.pos+=n},writeFloat:function(t){this.realloc(4),mg.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),mg.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var n=0;n=128&&bg(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(t,e,n){this.writeTag(t,xg.Bytes),this.writeRawMessage(e,n)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,Rg,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,Pg,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,Ig,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Og,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Fg,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,Mg,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Lg,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,Ag,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Dg,e)},writeBytesField:function(t,e){this.writeTag(t,xg.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,xg.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,xg.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,xg.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,xg.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,xg.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,xg.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,xg.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,xg.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,xg.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var Ng=[1,0,0,1,0,0],zg=function(){function t(t,e,n,r,i){this.extent_,this.id_=i,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=n,this.properties_=r}return t.prototype.get=function(t){return this.properties_[t]},t.prototype.getExtent=function(){return this.extent_||(this.extent_=this.type_===ct?le(this.flatCoordinates_):ue(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_},t.prototype.getFlatInteriorPoint=function(){if(!this.flatInteriorPoints_){var t=me(this.getExtent());this.flatInteriorPoints_=mr(this.flatCoordinates_,0,this.ends_,2,t,0)}return this.flatInteriorPoints_},t.prototype.getFlatInteriorPoints=function(){if(!this.flatInteriorPoints_){var t=qh(this.flatCoordinates_,0,this.ends_,2);this.flatInteriorPoints_=xr(this.flatCoordinates_,0,this.ends_,2,t)}return this.flatInteriorPoints_},t.prototype.getFlatMidpoint=function(){return this.flatMidpoints_||(this.flatMidpoints_=Nr(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_},t.prototype.getFlatMidpoints=function(){if(!this.flatMidpoints_){this.flatMidpoints_=[];for(var t=this.flatCoordinates_,e=0,n=this.ends_,r=0,i=n.length;r>3}s--,1===o||2===o?(a+=t.readSVarint(),l+=t.readSVarint(),1===o&&u>h&&(r.push(u),h=u),n.push(a,l),u+=2):7===o?u>h&&(n.push(n[h],n[h+1]),u+=2):rt(!1,59)}u>h&&(r.push(u),h=u)},e.prototype.createFeature_=function(t,e,n){var r,i=e.type;if(0===i)return null;var o,s=e.properties;this.idProperty_?(o=s[this.idProperty_],delete s[this.idProperty_]):o=e.id,s[this.layerName_]=e.layer.name;var a=[],l=[];this.readRawGeometry_(t,e,a,l);var u=function(t,e){var n;1===t?n=1===e?ct:gt:2===t?n=1===e?pt:_t:3===t&&(n=dt);return n}(i,l.length);if(this.featureClass_===Bg)(r=new this.featureClass_(u,a,l,s,o)).transform(n.dataProjection);else{var h=void 0;if(u==dt){for(var c=[],p=0,f=0,d=0,g=l.length;d1?new $h(a,at,c):new Fr(a,at,l)}else h=u===ct?new gr(a,at):u===pt?new Xr(a,at):u===dt?new Fr(a,at,l):u===gt?new Hh(a,at):u===_t?new Yh(a,at,l):null;r=new(0,this.featureClass_),this.geometryName_&&r.setGeometryName(this.geometryName_);var y=bp(h,!1,n);r.setGeometry(y),r.setId(o),r.setProperties(s,!0)}return r},e.prototype.getType=function(){return Ba},e.prototype.readFeatures=function(t,e){var n=this.layers_,r=this.adaptOptions(e),i=wn(r.dataProjection);i.setWorldExtent(r.extent),r.dataProjection=i;var o=new vg(t),s=o.readFields(Xg,{}),a=[];for(var l in s)if(!n||-1!=n.indexOf(l)){var u=s[l],h=u?[0,0,u.extent,u.extent]:null;i.setExtent(h);for(var c=0,p=u.length;c>3)?n.readString():2===t?n.readFloat():3===t?n.readDouble():4===t?n.readVarint64():5===t?n.readVarint():6===t?n.readSVarint():7===t?n.readBoolean():null;e.values.push(r)}}function Yg(t,e,n){if(1==t)e.id=n.readVarint();else if(2==t)for(var r=n.readVarint()+n.pos;n.pos=0;s--)this.postProcessPasses_[s].init(t);n.bindTexture(n.TEXTURE_2D,null),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.enable(n.BLEND),n.blendFunc(n.ONE,e?n.ZERO:n.ONE_MINUS_SRC_ALPHA),n.useProgram(this.currentProgram_),this.applyFrameState(t),this.applyUniforms(t)},e.prototype.prepareDrawToRenderTarget=function(t,e,n){var r=this.getGL(),i=e.getSize();r.bindFramebuffer(r.FRAMEBUFFER,e.getFramebuffer()),r.viewport(0,0,i[0],i[1]),r.bindTexture(r.TEXTURE_2D,e.getTexture()),r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT),r.enable(r.BLEND),r.blendFunc(r.ONE,n?r.ZERO:r.ONE_MINUS_SRC_ALPHA),r.useProgram(this.currentProgram_),this.applyFrameState(t),this.applyUniforms(t)},e.prototype.drawElements=function(t,e){var n=this.getGL();this.getExtension("OES_element_index_uint");var r=n.UNSIGNED_INT,i=e-t,o=4*t;n.drawElements(n.TRIANGLES,i,r,o)},e.prototype.finalizeDraw=function(t){for(var e=0;ethis.size_[0]||e>=this.size_[1])return C_[0]=0,C_[1]=0,C_[2]=0,C_[3]=0,C_;this.readAll();var n=Math.floor(t)+(this.size_[1]-Math.floor(e)-1)*this.size_[0];return C_[0]=this.data_[4*n],C_[1]=this.data_[4*n+1],C_[2]=this.data_[4*n+2],C_[3]=this.data_[4*n+3],C_},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}(),T_=new Blob(['var e="function"==typeof Object.assign?Object.assign:function(e,n){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),r=1,o=arguments.length;r=.5&&R>=.5){var P=T[4],O=T[5],F=s.opacity,I=void 0;1!==F&&(I=v.globalAlpha,v.globalAlpha=F),v.drawImage(E,0,0,+E.width,+E.height,Math.round(P),Math.round(O),Math.round(b),Math.round(R)),1!==F&&(v.globalAlpha=I)}return this.postRender(v,t),w&&v.restore(),y!==x.style.transform&&(x.style.transform=y),this.container},e}(Cs),z_=N_,B_=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),U_=function(t){function e(e){return t.call(this,e)||this}return B_(e,t),e.prototype.createRenderer=function(){return new z_(this)},e}(j_),V_=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),X_=function(t){function e(e){var n=t.call(this,e)||this;return n.extentChanged=!0,n.renderedExtent_=null,n.renderedPixelRatio,n.renderedProjection=null,n.renderedRevision,n.renderedTiles=[],n.newTiles_=!1,n.tmpExtent=[1/0,1/0,-1/0,-1/0],n.tmpTileRange_=new hp(0,0,0,0),n}return V_(e,t),e.prototype.isDrawableTile=function(t){var e=this.getLayer(),n=t.getState(),r=e.getUseInterimTilesOnError();return n==$a||n==el||n==tl&&!r},e.prototype.getTile=function(t,e,n,r){var i=r.pixelRatio,o=r.viewState.projection,s=this.getLayer(),a=s.getSource().getTile(t,e,n,i,o);return a.getState()==tl&&(s.getUseInterimTilesOnError()?s.getPreload()>0&&(this.newTiles_=!0):a.setState($a)),this.isDrawableTile(a)||(a=a.getInterimTile()),a},e.prototype.loadedTileCallback=function(e,n,r){return!!this.isDrawableTile(r)&&t.prototype.loadedTileCallback.call(this,e,n,r)},e.prototype.prepareFrame=function(t){return!!this.getLayer().getSource()},e.prototype.renderFrame=function(t,e){var n=t.layerStatesArray[t.layerIndex],i=t.viewState,o=i.projection,s=i.resolution,a=i.center,l=i.rotation,u=t.pixelRatio,c=this.getLayer(),p=c.getSource(),f=p.getRevision(),d=p.getTileGridForProjection(o),g=d.getZForResolution(s,p.zDirection),_=d.getResolution(g),y=t.extent,v=n.extent&&Dn(n.extent);v&&(y=Ce(y,Dn(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 E=_*w/2/x,T=_*S/2/x,b=[a[0]-E,a[1]-T,a[0]+E,a[1]+T],R=d.getTileRangeForExtentAndZ(y,g),P={};P[g]={};var O=this.createLoadedTileFinder(p,o,P),F=this.tmpExtent,I=this.tmpTileRange_;this.newTiles_=!1;for(var M=R.minX;M<=R.maxX;++M)for(var L=R.minY;L<=R.maxY;++L){var A=this.getTile(g,M,L,t);if(this.isDrawableTile(A)){var D=r(this);if(A.getState()==$a){P[g][A.tileCoord.toString()]=A;var k=A.inTransition(D);this.newTiles_||!k&&-1!==this.renderedTiles.indexOf(A)||(this.newTiles_=!0)}if(1===A.getAlpha(D,t.time))continue}var j=d.getTileCoordChildTileRange(A.tileCoord,I,F),G=!1;j&&(G=O(g+1,j)),G||d.forEachTileCoordParentTileRange(A.tileCoord,O,I,F)}var N=_/s;Gt(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/x,1/x,l,-w/2,-S/2);var z=zt(this.pixelTransform);this.useContainer(e,z,n.opacity);var B=this.context,U=B.canvas;Nt(this.inversePixelTransform,this.pixelTransform),Gt(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 V,X,W,Y=Object.keys(P).map(Number);Y.sort(h),1!==n.opacity||this.containerReused&&!p.getOpaque(t.viewState.projection)?(V=[],X=[]):Y=Y.reverse();for(var K=Y.length-1;K>=0;--K){var Z=Y[K],H=p.getTilePixelSize(Z,u,o),q=d.getResolution(Z)/_,J=H[0]*q*N,Q=H[1]*q*N,$=d.getTileCoordForCoordAndZ(Ee(b),Z),tt=d.getTileCoordExtent($),et=kt(this.tempTransform,[x*(tt[0]-b[0])/_,x*(b[3]-tt[3])/_]),nt=x*p.getGutterForProjection(o),rt=P[Z];for(var it in rt){var ot=(A=rt[it]).tileCoord,st=$[1]-ot[1],at=Math.round(et[0]-(st-1)*J),lt=$[2]-ot[2],ut=Math.round(et[1]-(lt-1)*Q),ht=at-(M=Math.round(et[0]-st*J)),ct=ut-(L=Math.round(et[1]-lt*Q)),pt=g===Z;if(!(k=pt&&1!==A.getAlpha(r(this),t.time)))if(V){B.save(),W=[M,L,M+ht,L,M+ht,L+ct,M,L+ct];for(var ft=0,dt=V.length;ft0)e([]);else{var y=Ee(c.getTileCoordExtent(i.wrappedTileCoord)),v=[(p[0]-y[0])/h,(y[1]-p[1])/h],m=i.getSourceTiles().reduce((function(t,e){return t.concat(e.getFeatures())}),[]),x=i.hitDetectionImageData[s];if(!x&&!this.animatingOrInteracting_){var w=ti(c.getTileSize(c.getZForResolution(h))),S=this.renderedRotation_;x=_a(w,[this.getRenderTransform(c.getTileCoordCenter(i.wrappedTileCoord),h,0,ga,w[0]*ga,w[1]*ga,0)],m,o.getStyleFunction(),c.getTileCoordExtent(i.wrappedTileCoord),i.getReplayState(o).renderedResolution,S),i.hitDetectionImageData[s]=x}e(ya(v,m,x))}}.bind(this))},e.prototype.handleFontsChanged=function(){var t=this.getLayer();t.getVisible()&&void 0!==this.renderedLayerRevision_&&t.changed()},e.prototype.handleStyleImageChange_=function(t){this.renderIfReadyAndVisible()},e.prototype.renderDeclutter=function(t){var e=this.context,n=e.globalAlpha;e.globalAlpha=this.getLayer().getOpacity();for(var i=t.viewHints,o=!(i[Ws]||i[Ys]),s=this.renderedTiles,a=0,l=s.length;a=0;--c)h[c].execute(this.context,1,this.getTileRenderTransform(u,t),t.viewState.rotation,o,void 0,t.declutterTree)}e.globalAlpha=n},e.prototype.getTileRenderTransform=function(t,e){var n=e.pixelRatio,r=e.viewState,i=r.center,o=r.resolution,s=r.rotation,a=e.size,l=Math.round(a[0]*n),u=Math.round(a[1]*n),h=this.getLayer().getSource().getTileGridForProjection(e.viewState.projection),c=t.tileCoord,p=h.getTileCoordExtent(t.wrappedTileCoord),f=h.getTileCoordExtent(c,this.tmpExtent)[0]-p[0];return At(jt(this.inversePixelTransform.slice(),1/n,1/n),this.getRenderTransform(i,o,s,n,l,u,f))},e.prototype.renderFrame=function(e,n){var i=e.viewHints,o=!(i[Ws]||i[Ys]);t.prototype.renderFrame.call(this,e,n),this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice(),this.renderedRotation_=e.viewState.rotation;var s=this.getLayer(),a=s.getRenderMode(),l=this.context,u=l.globalAlpha;l.globalAlpha=s.getOpacity();for(var h=J_[a],c=e.viewState.rotation,p=this.renderedTiles,f=[],d=[],g=p.length-1;g>=0;--g)for(var _=p[g],y=this.getTileRenderTransform(_,e),v=_.executorGroups[r(s)],m=!1,x=0,w=v.length;x0||n&&0===o)}))),17),!t.origins)for(var o=0,s=this.resolutions_.length-1;o=this.minZoom;){if(e(a,2===this.zoomFactor_?up(i=Math.floor(i/2),i,o=Math.floor(o/2),o,n):this.getTileRangeForExtentAndZ(s,a,n)))return!0;--a}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]this.maxZoom||e0?r:Math.max(s/a[0],o/a[1]),u=i+1,h=new Array(u),c=0;cn||n>e.getMaxZoom())return!1;var o=e.getFullTileRange(n);return!o||o.containsXY(r,i)}(t,r)?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,r){},n}(Ma),yy=function(t){function e(e,n){var r=t.call(this,e)||this;return r.tile=n,r}return gy(e,t),e}(a),vy=_y;function my(t,e){var n=/\{z\}/g,r=/\{x\}/g,i=/\{y\}/g,o=/\{-y\}/g;return function(s,a,l){return s?t.replace(n,s[0].toString()).replace(r,s[1].toString()).replace(i,s[2].toString()).replace(o,(function(){var t=s[0],n=e.getFullTileRange(t);return rt(n,55),(n.getHeight()-s[2]-1).toString()})):void 0}}function xy(t){return 1===t.length?t[0]:function(e,n,r){if(e){var i=Ge(ip(e),t.length);return t[i](e,n,r)}}}var wy=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Sy=function(t){function e(n){var r=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 r.generateTileUrlFunction_=r.tileUrlFunction===e.prototype.tileUrlFunction,r.tileLoadFunction=n.tileLoadFunction,n.tileUrlFunction&&(r.tileUrlFunction=n.tileUrlFunction),r.urls=null,n.urls?r.setUrls(n.urls):n.url&&r.setUrl(n.url),r.tileLoadingKeys_={},r}return wy(e,t),e.prototype.getTileLoadFunction=function(){return this.tileLoadFunction},e.prototype.getTileUrlFunction=function(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction},e.prototype.getUrls=function(){return this.urls},e.prototype.handleTileChange=function(t){var e,n=t.target,i=r(n),o=n.getState();o==Qa?(this.tileLoadingKeys_[i]=!0,e=iy):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],e=o==tl?sy:o==$a?oy:void 0),null!=e&&this.dispatchEvent(new yy(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 r=n[1].charCodeAt(0),i=n[2].charCodeAt(0),o=void 0;for(o=r;o<=i;++o)e.push(t.replace(n[0],String.fromCharCode(o)));return e}if(n=/\{(\d+)-(\d+)\}/.exec(t)){for(var s=parseInt(n[2],10),a=parseInt(n[1],10);a<=s;a++)e.push(t.replace(n[0],a.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,r=new Array(n),i=0;ithis.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=be(Jt([t,e,n,r]))/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]))||Re(u,this.maxSourceExtent_)){var d=0;if(!(f||isFinite(i[0])&&isFinite(i[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(s[0])&&isFinite(s[1])&&isFinite(a[0])&&isFinite(a[1])))if(l>0)f=!0;else if(1!=(d=(isFinite(i[0])&&isFinite(i[1])?0:8)+(isFinite(o[0])&&isFinite(o[1])?0:4)+(isFinite(s[0])&&isFinite(s[1])?0:2)+(isFinite(a[0])&&isFinite(a[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=(Ge(i[0],c)+Ge(s[0],c))/2-Ge(_[0],c);else y=(i[0]+s[0])/2-_[0];var v=(i[1]+s[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=[(r[0]+t[0])/2,(r[1]+t[1])/2],S=this.transformInv_(w);this.addQuad_(t,e,m,w,i,o,x,S,l-1),this.addQuad_(w,m,n,r,S,x,s,a,l-1)}else{var C=[(t[0]+e[0])/2,(t[1]+e[1])/2],E=this.transformInv_(C),T=[(n[0]+r[0])/2,(n[1]+r[1])/2],b=this.transformInv_(T);this.addQuad_(t,C,T,r,i,E,b,a,l-1),this.addQuad_(C,e,n,T,E,o,s,b,l-1)}return}}if(p){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}0==(11&d)&&this.addTriangle_(t,n,r,i,s,a),0==(14&d)&&this.addTriangle_(t,n,e,i,s,o),d&&(0==(13&d)&&this.addTriangle_(e,r,t,o,a,i),0==(7&d)&&this.addTriangle_(e,r,n,o,a,s))}},t.prototype.calculateSourceExtent=function(){var t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach((function(e,n,r){var i=e.source;pe(t,i[0]),pe(t,i[1]),pe(t,i[2])})),t},t.prototype.getTriangles=function(){return this.triangles_},t}(),Fy="1.3.0",Iy={imageSmoothingEnabled:!1,msImageSmoothingEnabled:!1};function My(t,e,n,r,i){t.beginPath(),t.moveTo(0,0),t.lineTo(e,n),t.lineTo(r,i),t.closePath(),t.save(),t.clip(),t.fillRect(0,0,Math.max(e,r)+1,Math.max(n,i)),t.restore()}function Ly(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function Ay(t,e,n,r){var i=Pn(n,e,t),o=Sn(e,r,n),s=e.getMetersPerUnit();void 0!==s&&(o*=s);var a=t.getMetersPerUnit();void 0!==a&&(o/=a);var l=t.getExtent();if(!l||ee(l,i)){var u=Sn(t,o,i)/o;isFinite(u)&&u>0&&(o/=u)}return o}function Dy(t,e,n,r,i,o,s,a,l,u,h,c){var p=pi(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){ce(d,t.extent)}));var g=be(d),_=Se(d),y=pi(Math.round(n*g/r),Math.round(n*_/r));m(y,c);var v=n/r;l.forEach((function(t,e,n){var r=t.extent[0]-d[0],i=-(t.extent[3]-d[3]),o=be(t.extent),s=Se(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,r*v,i*v,o*v,s*v)}));var x=Ee(s);return a.getTriangles().forEach((function(t,e,i){var s=t.source,a=t.target,l=s[0][0],u=s[0][1],h=s[1][0],g=s[1][1],_=s[2][0],v=s[2][1],m=f((a[0][0]-x[0])/o),w=f(-(a[0][1]-x[1])/o),S=f((a[1][0]-x[0])/o),C=f(-(a[1][1]-x[1])/o),E=f((a[2][0]-x[0])/o),T=f(-(a[2][1]-x[1])/o),b=l,R=u;l=0,u=0;var P=function(t){for(var e=t.length,n=0;ni&&(i=s,r=o)}if(0===i)return null;var a=t[r];t[r]=t[n],t[n]=a;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-=b,g-=R,0,0,S-m],[_-=b,v-=R,0,0,E-m],[0,0,h,g,C-w],[0,0,_,v,T-w]]);if(P){if(p.save(),p.beginPath(),function(){if(void 0===Py){var t=document.createElement("canvas").getContext("2d");t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",My(t,4,5,4,0),My(t,4,5,0,5);var e=t.getImageData(0,0,3,3).data;Py=Ly(e,0)||Ly(e,4)||Ly(e,8)}return Py}()||c===Iy){p.moveTo(S,C);for(var O=m-S,F=w-C,I=0;I<4;I++)p.lineTo(S+f((I+1)*O/4),C+f(I*F/3)),3!=I&&p.lineTo(S+f((I+1)*O/4),C+f((I+1)*F/3));p.lineTo(E,T)}else p.moveTo(S,C),p.lineTo(m,w),p.lineTo(E,T);p.clip(),p.transform(P[0],P[2],P[1],P[3],m,w),p.translate(d[0]-b,d[3]-R),p.scale(r/n,-r/n),p.drawImage(y.canvas,0,0),p.restore()}})),h&&(p.save(),p.globalCompositeOperation="source-over",p.strokeStyle="black",p.lineWidth=1,a.getTriangles().forEach((function(t,e,n){var r=t.target,i=(r[0][0]-x[0])/o,s=-(r[0][1]-x[1])/o,a=(r[1][0]-x[0])/o,l=-(r[1][1]-x[1])/o,u=(r[2][0]-x[0])/o,h=-(r[2][1]-x[1])/o;p.beginPath(),p.moveTo(a,l),p.lineTo(i,s),p.lineTo(u,h),p.closePath(),p.stroke()})),p.restore()),p.canvas}var ky=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),jy=function(t){function e(e,n,r,i,o,s,a,l,u,h,c,p){var f=t.call(this,o,Ja)||this;f.renderEdges_=void 0!==c&&c,f.contextOptions_=p,f.pixelRatio_=a,f.gutter_=l,f.canvas_=null,f.sourceTileGrid_=n,f.targetTileGrid_=i,f.wrappedTileCoord_=s||o,f.sourceTiles_=[],f.sourcesListenerKeys_=null,f.sourceZ_=0;var d=i.getTileCoordExtent(f.wrappedTileCoord_),g=f.targetTileGrid_.getExtent(),_=f.sourceTileGrid_.getExtent(),y=g?Ce(d,g):d;if(0===_e(y))return f.state=el,f;var v=e.getExtent();v&&(_=_?Ce(_,v):v);var m=i.getResolution(f.wrappedTileCoord_[0]),x=function(t,e,n,r){var i=me(n),o=Ay(t,e,i,r);return(!isFinite(o)||o<=0)&&ge(n,(function(n){return o=Ay(t,e,n,r),isFinite(o)&&o>0})),o}(e,r,y,m);if(!isFinite(x)||x<=0)return f.state=el,f;var w=void 0!==h?h:.5;if(f.triangulation_=new Oy(e,r,y,_,x*w,m),0===f.triangulation_.getTriangles().length)return f.state=el,f;f.sourceZ_=n.getZForResolution(x);var S=f.triangulation_.calculateSourceExtent();if(_&&(e.canWrapX()?(S[1]=Ie(S[1],_[1],_[3]),S[3]=Ie(S[3],_[1],_[3])):S=Ce(S,_)),_e(S)){for(var C=n.getTileRangeForExtentAndZ(S,f.sourceZ_),E=C.minX;E<=C.maxX;E++)for(var T=C.minY;T<=C.maxY;T++){var b=u(f.sourceZ_,E,T,a);b&&f.sourceTiles_.push(b)}0===f.sourceTiles_.length&&(f.state=el)}else f.state=el;return f}return ky(e,t),e.prototype.getImage=function(){return this.canvas_},e.prototype.reproject_=function(){var t=[];if(this.sourceTiles_.forEach(function(e,n,r){e&&e.getState()==$a&&t.push({extent:this.sourceTileGrid_.getTileCoordExtent(e.tileCoord),image:e.getImage()})}.bind(this)),this.sourceTiles_.length=0,0===t.length)this.state=tl;else{var e=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(e),r="number"==typeof n?n:n[0],i="number"==typeof n?n:n[1],o=this.targetTileGrid_.getResolution(e),s=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Dy(r,i,this.pixelRatio_,s,this.sourceTileGrid_.getExtent(),o,a,this.triangulation_,t,this.gutter_,this.renderEdges_,this.contextOptions_),this.state=$a}this.changed()},e.prototype.load=function(){if(this.state==Ja){this.state=Qa,this.changed();var t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(function(e,n,r){var i=e.getState();if(i==Ja||i==Qa){t++;var o=N(e,T,(function(n){var r=e.getState();r!=$a&&r!=tl&&r!=el||(B(o),0===--t&&(this.unlistenSources_(),this.reproject_()))}),this);this.sourcesListenerKeys_.push(o)}}.bind(this)),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach((function(t,e,n){t.getState()==Ja&&t.load()}))}},e.prototype.unlistenSources_=function(){this.sourcesListenerKeys_.forEach(B),this.sourcesListenerKeys_=null},e}(ll),Gy=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ny=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:zy,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:hl,n.tileCacheForProjection={},n.tileGridForProjection={},n.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,n.contextOptions_=!1===e.imageSmoothing?Iy:void 0,n.renderReprojectionEdges_=!1,n}return Gy(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 r in this.tileCache.expireCache(this.tileCache==n?e:{}),this.tileCacheForProjection){var i=this.tileCacheForProjection[r];i.expireCache(i==n?e:{})}},e.prototype.getContextOptions=function(){return this.contextOptions_},e.prototype.getGutterForProjection=function(t){return this.getProjection()&&t&&!Tn(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&&!Tn(this.getProjection(),e))&&t.prototype.getOpaque.call(this,e)},e.prototype.getTileGridForProjection=function(t){var e=this.getProjection();if(!this.tileGrid||e&&!Tn(e,t)){var n=r(t);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=hy(t)),this.tileGridForProjection[n]}return this.tileGrid},e.prototype.getTileCacheForProjection=function(t){var e=this.getProjection();if(!e||Tn(e,t))return this.tileCache;var n=r(t);return n in this.tileCacheForProjection||(this.tileCacheForProjection[n]=new ap(this.tileCache.highWaterMark)),this.tileCacheForProjection[n]},e.prototype.createTile_=function(t,e,n,r,i,o){var s=[t,e,n],a=this.getTileCoordForTileUrlFunction(s,i),l=a?this.tileUrlFunction(a,r,i):void 0,u=new this.tileClass(s,void 0!==l?Ja:el,void 0!==l?l:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return u.key=o,u.addEventListener(T,this.handleTileChange.bind(this)),u},e.prototype.getTile=function(t,e,n,r,i){var o=this.getProjection();if(o&&i&&!Tn(o,i)){var s=this.getTileCacheForProjection(i),a=[t,e,n],l=void 0,u=np(a);s.containsKey(u)&&(l=s.get(u));var h=this.getKey();if(l&&l.key==h)return l;var c=this.getTileGridForProjection(o),p=this.getTileGridForProjection(i),f=this.getTileCoordForTileUrlFunction(a,i),d=new jy(o,c,i,p,a,f,this.getTilePixelRatio(r),this.getGutter(),function(t,e,n,r){return this.getTileInternal(t,e,n,r,o)}.bind(this),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.contextOptions_);return d.key=h,l?(d.interimTile=l,d.refreshInterimChain(),s.replace(u,d)):s.set(u,d),d}return this.getTileInternal(t,e,n,r,o||i)},e.prototype.getTileInternal=function(t,e,n,r,i){var o=null,s=ep(t,e,n),a=this.getKey();if(this.tileCache.containsKey(s)){if((o=this.tileCache.get(s)).key!=a){var l=o;o=this.createTile_(t,e,n,r,i,a),l.getState()==Ja?o.interimTile=l.interimTile:o.interimTile=l,o.refreshInterimChain(),this.tileCache.replace(s,o)}}else o=this.createTile_(t,e,n,r,i,a),this.tileCache.set(s,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=wn(t);if(n){var i=r(n);i in this.tileGridForProjection||(this.tileGridForProjection[i]=e)}},e}(Cy);function zy(t,e){t.getImage().src=e}var By=Ny,Uy=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();!function(t){function e(e){var n=this,r="Unexpected response status: "+e.status;return(n=t.call(this,r)||this).name="ResponseError",n.response=e,n}Uy(e,t)}(Error),function(t){function e(e){var n=t.call(this,"Failed to issue request")||this;return n.name="ClientError",n.client=e,n}Uy(e,t)}(Error);var Vy=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Xy=function(t){function e(e){var n=this,r=e||{},i=m({},r);return delete i.preload,delete i.useInterimTilesOnError,(n=t.call(this,i)||this).on,n.once,n.un,n.setPreload(void 0!==r.preload?r.preload:0),n.setUseInterimTilesOnError(void 0===r.useInterimTilesOnError||r.useInterimTilesOnError),n}return Vy(e,t),e.prototype.getPreload=function(){return this.get(ty)},e.prototype.setPreload=function(t){this.set(ty,t)},e.prototype.getUseInterimTilesOnError=function(){return this.get(ey)},e.prototype.setUseInterimTilesOnError=function(t){this.set(ey,t)},e}(Eo),Wy=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Yy=function(t){function e(e){return t.call(this,e)||this}return Wy(e,t),e.prototype.createRenderer=function(){return new W_(this)},e}(Xy),Ky=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();function Zy(t,e){t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR)}function Hy(t,e,n,r,i){var o,s,a=t.getGL();switch(Zy(a,e),i){case 1:o=a.LUMINANCE;break;case 2:o=a.LUMINANCE_ALPHA;break;case 3:o=a.RGB;break;case 4:o=a.RGBA;break;default:throw new Error("Unsupported number of bands: "+i)}n instanceof Float32Array?(s=a.FLOAT,t.getExtension("OES_texture_float"),t.getExtension("OES_texture_float_linear")):s=a.UNSIGNED_BYTE,a.texImage2D(a.TEXTURE_2D,0,o,r[0],r[1],0,o,s,n)}var qy=function(t){function e(e,n,r){var i=t.call(this)||this;i.tile,i.textures=[],i.handleTileChange_=i.handleTileChange_.bind(i),i.size=ti(n.getTileSize(e.tileCoord[0])),i.bandCount=NaN,i.helper_=r;var o=new r_(Hg,Jg);return o.fromArray([0,1,1,1,1,0,0,0]),r.flushBufferData(o),i.coords=o,i.setTile(e),i}return Ky(e,t),e.prototype.setTile=function(t){t!==this.tile&&(this.tile&&this.tile.removeEventListener(T,this.handleTileChange_),this.tile=t,this.textures.length=0,this.loaded=t.getState()===$a,this.loaded?this.uploadTile_():t.addEventListener(T,this.handleTileChange_))},e.prototype.uploadTile_=function(){var t=this.helper_,e=t.getGL(),n=this.tile;if(n instanceof hl){var r=e.createTexture();return this.textures.push(r),this.bandCount=4,void function(t,e,n){Zy(t,e),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,n)}(e,r,n.getImage())}var i=n.getData(),o=i instanceof Float32Array,s=this.size[0]*this.size[1];this.bandCount=i.byteLength/(o?4:1)/s;var a=Math.ceil(this.bandCount/4);if(1===a){r=e.createTexture();return this.textures.push(r),void Hy(t,r,i,this.size,this.bandCount)}for(var l=o?Float32Array:Uint8Array,u=new Array(a),h=0;h=s.minZoom;--x){if(this.findAltTiles_(s,m,x,l))break}}this.helper.useProgram(this.program_),this.helper.prepareDraw(t,!g);for(var w=Object.keys(l).map(Number).sort(h),S=this.helper.getGL(),C=e.center[0],E=e.center[1],T=0,b=w.length;T4)throw new Error("`formatArray` can only output `vec2`, `vec3` or `vec4` arrays.");return"vec"+t.length+"("+t.map(wv).join(", ")+")"}function Cv(t,e){return void 0===t.stringLiteralsMap[e]&&(t.stringLiteralsMap[e]=Object.keys(t.stringLiteralsMap).length),t.stringLiteralsMap[e]}function Ev(t,e,n){if(Array.isArray(e)&&"string"==typeof e[0]){var r=mv[e[0]];if(void 0===r)throw new Error("Unrecognized expression operator: "+JSON.stringify(e));return r.toGlsl(t,e.slice(1),n)}var i,o=xv(e);if((o&pv)>0)return wv(e);if((o&gv)>0)return e.toString();if((o&fv)>0&&(void 0===n||n==fv))return function(t,e){return wv(Cv(t,e))}(t,e.toString());if((o&dv)>0&&(void 0===n||n==dv))return(i=li(e).slice()).length<4&&i.push(1),Sv(i.map((function(t,e){return e<3?t/255:t})));if((o&_v)>0)return Sv(e);throw new Error("Unexpected expression "+e+" (expected type "+n+")")}function Tv(t){if(!(xv(t)&pv))throw new Error("A numeric value was expected, got "+JSON.stringify(t)+" instead")}function bv(t){for(var e=0;ee)throw new Error("At most "+e+" arguments were expected, got "+t.length+" instead")}function Mv(t){if(t.length%2!=0)throw new Error("An even amount of arguments was expected, got "+t+" instead")}function Lv(t,e){if(Le(e)%1!=0)throw new Error("Could not infer only one type from the following expression: "+JSON.stringify(t))}function Av(t){return"u_var_"+t}function Dv(t){return{getReturnType:function(t){return gv},toGlsl:function(e,n){Ov(n,2);for(var r=yv,i=0;i"]={getReturnType:function(t){return gv},toGlsl:function(t,e){return Ov(e,2),bv(e),"("+Ev(t,e[0])+" > "+Ev(t,e[1])+")"}},mv[">="]={getReturnType:function(t){return gv},toGlsl:function(t,e){return Ov(e,2),bv(e),"("+Ev(t,e[0])+" >= "+Ev(t,e[1])+")"}},mv["<"]={getReturnType:function(t){return gv},toGlsl:function(t,e){return Ov(e,2),bv(e),"("+Ev(t,e[0])+" < "+Ev(t,e[1])+")"}},mv["<="]={getReturnType:function(t){return gv},toGlsl:function(t,e){return Ov(e,2),bv(e),"("+Ev(t,e[0])+" <= "+Ev(t,e[1])+")"}},mv["=="]=Dv("=="),mv["!="]=Dv("!="),mv["!"]={getReturnType:function(t){return gv},toGlsl:function(t,e){return Ov(e,1),Pv(e[0]),"(!"+Ev(t,e[0])+")"}},mv.all=kv("&&"),mv.any=kv("||"),mv.between={getReturnType:function(t){return gv},toGlsl:function(t,e){Ov(e,3),bv(e);var n=Ev(t,e[1]),r=Ev(t,e[2]),i=Ev(t,e[0]);return"("+i+" >= "+n+" && "+i+" <= "+r+")"}},mv.array={getReturnType:function(t){return _v},toGlsl:function(t,e){Fv(e,2),Iv(e,4),bv(e);var n=e.map((function(e){return Ev(t,e,pv)}));return"vec"+e.length+"("+n.join(", ")+")"}},mv.color={getReturnType:function(t){return dv},toGlsl:function(t,e){Fv(e,3),Iv(e,4),bv(e);var n=e;3===e.length&&n.push(1);var r=e.map((function(e,n){return Ev(t,e,pv)+(n<3?" / 255.0":"")}));return"vec"+e.length+"("+r.join(", ")+")"}},mv.interpolate={getReturnType:function(t){for(var e=dv|pv,n=3;n=1;l-=2){a="("+o+" == "+Ev(t,e[l])+" ? "+Ev(t,e[l+1],i)+" : "+(a||s)+")"}return a}},mv.case={getReturnType:function(t){for(var e=yv,n=1;n=0;o-=2){a="("+Ev(t,e[o])+" ? "+Ev(t,e[o+1],i)+" : "+(a||s)+")"}return a}};var jv=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,r=this.varyings;return t&&(n=n.concat("vec4 a_hitColor"),r=r.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"+r.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"+r.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 Gv=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Nv=function(t){function e(e){var n=this,r=m({},e);return(n=t.call(this,r)||this).parseResult_=function(t){var e=t.symbol,n=void 0!==e.size?e.size:1,r=e.color||"white",i=e.textureCoord||[0,0,1,1],o=e.offset||[0,0],s=void 0!==e.opacity?e.opacity:1,a=void 0!==e.rotation?e.rotation:0,l={inFragmentShader:!1,variables:[],attributes:[],stringLiteralsMap:{}},u=Ev(l,n,_v|pv),h=Ev(l,o,_v),c=Ev(l,i,_v),p=Ev(l,a,pv),f={inFragmentShader:!0,variables:l.variables,attributes:[],stringLiteralsMap:l.stringLiteralsMap},d=Ev(f,r,dv),g=Ev(f,s,pv),_="1.0",y="vec2("+Ev(f,n,_v|pv)+").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 jv).setSizeExpression("vec2("+u+")").setRotationExpression(p).setSymbolOffsetExpression(h).setTextureCoordinateExpression(c).setSymbolRotateWithView(!!e.rotateWithView).setColorExpression("vec4("+d+".rgb, "+d+".a * "+g+" * "+_+")");if(t.filter){var w=Ev(f,t.filter,gv);x.setFragmentDiscardExpression("!"+w)}var S={};if(f.variables.forEach((function(e){var n=Av(e);x.addUniform("float "+n),S[n]=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=Cv(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 r=n[t];return"string"==typeof r&&(r=Cv(l,r)),void 0!==r?r:-9999999}}})),uniforms:S}}(e.style),n.hitDetectionDisabled_=!!e.disableHitDetection,n}return Gv(e,t),e.prototype.createRenderer=function(){return new O_(this,{className:this.getClassName(),vertexShader:this.parseResult_.builder.getSymbolVertexShader(),fragmentShader:this.parseResult_.builder.getSymbolFragmentShader(),hitVertexShader:!this.hitDetectionDisabled_&&this.parseResult_.builder.getSymbolVertexShader(!0),hitFragmentShader:!this.hitDetectionDisabled_&&this.parseResult_.builder.getSymbolFragmentShader(!0),uniforms:this.parseResult_.uniforms,attributes:this.parseResult_.attributes})},e}(Eo),zv=Nv,Bv=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();var Uv=function(t){function e(e){var n=this,i=void 0!==e.hidpi&&e.hidpi;return(n=t.call(this,{cacheSize:e.cacheSize,crossOrigin:"anonymous",imageSmoothing:e.imageSmoothing,opaque:!0,projection:wn("EPSG:3857"),reprojectionErrorThreshold:e.reprojectionErrorThreshold,state:vo,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:i?2:1,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition,zDirection:e.zDirection})||this).hidpi_=i,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,i){var o=document.createElement("script"),s="olc_"+r(e);function a(){delete window[s],o.parentNode.removeChild(o)}o.async=!0,o.src=t+(-1==t.indexOf("?")?"?":"&")+(i||"callback")+"="+s;var l=setTimeout((function(){a(),n&&n()}),1e4);window[s]=function(t){clearTimeout(l),a(),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 Bv(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_,r=dy(this.getProjection()),i=this.hidpi_?2:1,o=e.imageWidth==e.imageHeight?e.imageWidth/i:[e.imageWidth/i,e.imageHeight/i],s=cy({extent:r,minZoom:e.zoomMin,maxZoom:n,tileSize:o});this.tileGrid=s;var a=this.culture_,l=this.hidpi_;if(this.tileUrlFunction=xy(e.imageUrlSubdomains.map((function(t){var n=[0,0,0],r=e.imageUrl.replace("{subdomain}",t).replace("{culture}",a);return function(t,e,i){if(t){tp(t[0],t[1],t[2],n);var o=r;return l&&(o+="&dpi=d1&device=mobile"),o.replace("{quadkey}",function(t){var e,n,r=t[0],i=new Array(r),o=1<>=1;return i.join("")}(n))}}}))),e.imageryProviders){var u=bn(wn("EPSG:4326"),this.getProjection());this.setAttributions(function(t){var n=[],r=t.viewState,i=this.getTileGrid(),o=i.getZForResolution(r.resolution,this.zDirection),s=i.getTileCoordForCoordAndZ(r.center,o)[0];return e.imageryProviders.map((function(e){for(var r=!1,i=e.coverageAreas,o=0,a=i.length;o=l.zoomMin&&s<=l.zoomMax){var h=l.bbox;if(Re(Oe([h[1],h[0],h[3],h[2]],u),t.extent)){r=!0;break}}}r&&n.push(e.attribution)})),n.push('Terms of Use'),n}.bind(this))}this.setState(mo)}else this.setState(xo)},e}(By),Vv=Uv,Xv=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Wv=function(t){function e(e){var n=e||{},r=void 0!==n.projection?n.projection:"EPSG:3857",i=void 0!==n.tileGrid?n.tileGrid:cy({extent:dy(r),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:r,reprojectionErrorThreshold:n.reprojectionErrorThreshold,tileGrid:i,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 Xv(e,t),e}(By),Yv=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Kv=function(t){function e(e,n,r,i,o,s,a){var l=this,u=e.getExtent(),h=n.getExtent(),c=h?Ce(r,h):r,p=Ay(e,n,me(c),i),f=new Oy(e,n,c,u,.5*p,i),d=s(f.calculateSourceExtent(),p,o),g=d?Yr:qr,_=d?d.getPixelRatio():1;return(l=t.call(this,r,i,_,g)||this).targetProj_=n,l.maxSourceExtent_=u,l.triangulation_=f,l.targetResolution_=i,l.targetExtent_=r,l.sourceImage_=d,l.sourcePixelRatio_=_,l.contextOptions_=a,l.canvas_=null,l.sourceListenerKey_=null,l}return Yv(e,t),e.prototype.disposeInternal=function(){this.state==Kr&&this.unlistenSource_(),t.prototype.disposeInternal.call(this)},e.prototype.getImage=function(){return this.canvas_},e.prototype.getProjection=function(){return this.targetProj_},e.prototype.reproject_=function(){var t=this.sourceImage_.getState();if(t==Zr){var e=be(this.targetExtent_)/this.targetResolution_,n=Se(this.targetExtent_)/this.targetResolution_;this.canvas_=Dy(e,n,this.sourcePixelRatio_,this.sourceImage_.getResolution(),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0,void 0,this.contextOptions_)}this.state=t,this.changed()},e.prototype.load=function(){if(this.state==Yr){this.state=Kr,this.changed();var t=this.sourceImage_.getState();t==Zr||t==Hr?this.reproject_():(this.sourceListenerKey_=N(this.sourceImage_,T,(function(t){var e=this.sourceImage_.getState();e!=Zr&&e!=Hr||(this.unlistenSource_(),this.reproject_())}),this),this.sourceImage_.load())}},e.prototype.unlistenSource_=function(){B(this.sourceListenerKey_),this.sourceListenerKey_=null},e}(oa),Zv=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Hv="imageloadstart",qv="imageloadend",Jv="imageloaderror",Qv=function(t){function e(e,n){var r=t.call(this,e)||this;return r.image=n,r}return Zv(e,t),e}(a);function $v(t,e){t.getImage().src=e}var tm=function(t){function n(e){var n=t.call(this,{attributions:e.attributions,projection:e.projection,state:e.state})||this;return n.on,n.once,n.un,n.resolutions_=void 0!==e.resolutions?e.resolutions:null,n.reprojectedImage_=null,n.reprojectedRevision_=0,n.contextOptions_=!1===e.imageSmoothing?Iy:void 0,n}return Zv(n,t),n.prototype.getResolutions=function(){return this.resolutions_},n.prototype.getContextOptions=function(){return this.contextOptions_},n.prototype.findNearestResolution=function(t){if(this.resolutions_){var e=p(this.resolutions_,t,0);t=this.resolutions_[e]}return t},n.prototype.getImage=function(t,e,n,r){var i=this.getProjection();if(i&&r&&!Tn(i,r)){if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&Tn(this.reprojectedImage_.getProjection(),r)&&this.reprojectedImage_.getResolution()==e&&he(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new Kv(i,r,t,e,n,function(t,e,n){return this.getImageInternal(t,e,n,i)}.bind(this),this.contextOptions_),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}return i&&(r=i),this.getImageInternal(t,e,n,r)},n.prototype.getImageInternal=function(t,n,r,i){return e()},n.prototype.handleImageChange=function(t){var e=t.target;switch(e.getState()){case Kr:this.loading=!0,this.dispatchEvent(new Qv(Hv,e));break;case Zr:this.loading=!1,this.dispatchEvent(new Qv(qv,e));break;case Hr:this.loading=!1,this.dispatchEvent(new Qv(Jv,e))}},n}(Ma);function em(t,e){var n=[];Object.keys(e).forEach((function(t){null!==e[t]&&void 0!==e[t]&&n.push(t+"="+encodeURIComponent(e[t]))}));var r=n.join("&");return(t=-1===(t=t.replace(/[?&]$/,"")).indexOf("?")?t+"?":t+"&")+r}var nm="carmentaserver",rm="geoserver",im="mapserver",om="qgis",sm=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),am=[101,101],lm=function(t){function e(e){var n=this,r=e||{};return(n=t.call(this,{attributions:r.attributions,imageSmoothing:r.imageSmoothing,projection:r.projection,resolutions:r.resolutions})||this).crossOrigin_=void 0!==r.crossOrigin?r.crossOrigin:null,n.url_=r.url,n.imageLoadFunction_=void 0!==r.imageLoadFunction?r.imageLoadFunction:$v,n.params_=r.params||{},n.v13_=!0,n.updateV13_(),n.serverType_=r.serverType,n.hidpi_=void 0===r.hidpi||r.hidpi,n.image_=null,n.imageSize_=[0,0],n.renderedRevision_=0,n.ratio_=void 0!==r.ratio?r.ratio:1.5,n}return sm(e,t),e.prototype.getFeatureInfoUrl=function(t,e,n,r){if(void 0!==this.url_){var i=wn(n),o=this.getProjection();o&&o!==i&&(e=Ay(o,i,t,e),t=Pn(t,i,o));var s=we(t,e,0,am),a={SERVICE:"WMS",VERSION:Fy,REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.params_.LAYERS};m(a,this.params_,r);var l=Math.floor((t[0]-s[0])/e),u=Math.floor((s[3]-t[1])/e);return a[this.v13_?"I":"X"]=l,a[this.v13_?"J":"Y"]=u,this.getRequestUrl_(s,am,1,o||i,a)}},e.prototype.getLegendUrl=function(t,e){if(void 0!==this.url_){var n={SERVICE:"WMS",VERSION:Fy,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){var r=this.params_.LAYERS;if(!(!Array.isArray(r)||1===r.length))return;n.LAYER=r}if(void 0!==t){var i=this.getProjection()?this.getProjection().getMetersPerUnit():1;n.SCALE=t*i/28e-5}return m(n,e),em(this.url_,n)}},e.prototype.getParams=function(){return this.params_},e.prototype.getImageInternal=function(t,e,n,r){if(void 0===this.url_)return null;e=this.findNearestResolution(e),1==n||this.hidpi_&&void 0!==this.serverType_||(n=1);var i=e/n,o=me(t),s=we(o,i,0,[Math.ceil(be(t)/i),Math.ceil(Se(t)/i)]),a=we(o,i,0,[Math.ceil(this.ratio_*be(t)/i),Math.ceil(this.ratio_*Se(t)/i)]),l=this.image_;if(l&&this.renderedRevision_==this.getRevision()&&l.getResolution()==e&&l.getPixelRatio()==n&&ne(l.getExtent(),s))return l;var u={SERVICE:"WMS",VERSION:Fy,REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};m(u,this.params_),this.imageSize_[0]=Math.round(be(a)/i),this.imageSize_[1]=Math.round(Se(a)/i);var h=this.getRequestUrl_(a,this.imageSize_,n,r,u);return this.image_=new la(a,e,n,h,this.crossOrigin_,this.imageLoadFunction_),this.renderedRevision_=this.getRevision(),this.image_.addEventListener(T,this.handleImageChange.bind(this)),this.image_},e.prototype.getImageLoadFunction=function(){return this.imageLoadFunction_},e.prototype.getRequestUrl_=function(t,e,n,r,i){if(rt(void 0!==this.url_,9),i[this.v13_?"CRS":"SRS"]=r.getCode(),"STYLES"in this.params_||(i.STYLES=""),1!=n)switch(this.serverType_){case rm:var o=90*n+.5|0;"FORMAT_OPTIONS"in i?i.FORMAT_OPTIONS+=";dpi:"+o:i.FORMAT_OPTIONS="dpi:"+o;break;case im:i.MAP_RESOLUTION=90*n;break;case nm:case om:i.DPI=90*n;break;default:rt(!1,8)}i.WIDTH=e[0],i.HEIGHT=e[1];var s,a=r.getAxisOrientation();return s=this.v13_&&"ne"==a.substr(0,2)?[t[1],t[0],t[3],t[2]]:t,i.BBOX=s.join(","),em(this.url_,i)},e.prototype.getUrl=function(){return this.url_},e.prototype.setImageLoadFunction=function(t){this.image_=null,this.imageLoadFunction_=t,this.changed()},e.prototype.setUrl=function(t){t!=this.url_&&(this.url_=t,this.image_=null,this.changed())},e.prototype.updateParams=function(t){m(this.params_,t),this.updateV13_(),this.image_=null,this.changed()},e.prototype.updateV13_=function(){var t=this.params_.VERSION||Fy;this.v13_=hn(t,"1.3")>=0},e}(tm),um=lm,hm=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),cm=function(t){function e(e){var n,r=e||{};n=void 0!==r.attributions?r.attributions:['© OpenStreetMap contributors.'];var i=void 0!==r.crossOrigin?r.crossOrigin:"anonymous",o=void 0!==r.url?r.url:"https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png";return t.call(this,{attributions:n,attributionsCollapsible:!1,cacheSize:r.cacheSize,crossOrigin:i,imageSmoothing:r.imageSmoothing,maxZoom:void 0!==r.maxZoom?r.maxZoom:19,opaque:void 0===r.opaque||r.opaque,reprojectionErrorThreshold:r.reprojectionErrorThreshold,tileLoadFunction:r.tileLoadFunction,transition:r.transition,url:o,wrapX:r.wrapX,zDirection:r.zDirection})||this}return hm(e,t),e}(Wv),pm=cm,fm=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),dm=function(t){function e(e){var n=this,r=e||{},i=r.params||{},o=!("TRANSPARENT"in i)||i.TRANSPARENT;return(n=t.call(this,{attributions:r.attributions,attributionsCollapsible:r.attributionsCollapsible,cacheSize:r.cacheSize,crossOrigin:r.crossOrigin,imageSmoothing:r.imageSmoothing,opaque:!o,projection:r.projection,reprojectionErrorThreshold:r.reprojectionErrorThreshold,tileClass:r.tileClass,tileGrid:r.tileGrid,tileLoadFunction:r.tileLoadFunction,url:r.url,urls:r.urls,wrapX:void 0===r.wrapX||r.wrapX,transition:r.transition,zDirection:r.zDirection})||this).gutter_=void 0!==r.gutter?r.gutter:0,n.params_=i,n.v13_=!0,n.serverType_=r.serverType,n.hidpi_=void 0===r.hidpi||r.hidpi,n.tmpExtent_=[1/0,1/0,-1/0,-1/0],n.updateV13_(),n.setKey(n.getKeyForParams_()),n}return fm(e,t),e.prototype.getFeatureInfoUrl=function(t,e,n,r){var i=wn(n),o=this.getProjection(),s=this.getTileGrid();s||(s=this.getTileGridForProjection(i));var a=s.getZForResolution(e,this.zDirection),l=s.getTileCoordForCoordAndZ(t,a);if(!(s.getResolutions().length<=l[0])){var u=s.getResolution(l[0]),h=s.getTileCoordExtent(l,this.tmpExtent_),c=ti(s.getTileSize(l[0]),this.tmpSize),p=this.gutter_;0!==p&&(c=Jr(c,p,this.tmpSize),h=Qt(h,u*p,h)),o&&o!==i&&(u=Ay(o,i,t,u),h=function(t,e,n,r){return Oe(t,Rn(e,n),void 0,r)}(h,i,o),t=Pn(t,i,o));var f={SERVICE:"WMS",VERSION:Fy,REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.params_.LAYERS};m(f,this.params_,r);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||i,f)}},e.prototype.getLegendUrl=function(t,e){if(void 0!==this.urls[0]){var n={SERVICE:"WMS",VERSION:Fy,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){var r=this.params_.LAYERS;if(!(!Array.isArray(r)||1===r.length))return;n.LAYER=r}if(void 0!==t){var i=this.getProjection()?this.getProjection().getMetersPerUnit():1;n.SCALE=t*i/28e-5}return m(n,e),em(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,r,i,o){var s=this.urls;if(s){if(o.WIDTH=e[0],o.HEIGHT=e[1],o[this.v13_?"CRS":"SRS"]=i.getCode(),"STYLES"in this.params_||(o.STYLES=""),1!=r)switch(this.serverType_){case rm:var a=90*r+.5|0;"FORMAT_OPTIONS"in o?o.FORMAT_OPTIONS+=";dpi:"+a:o.FORMAT_OPTIONS="dpi:"+a;break;case im:o.MAP_RESOLUTION=90*r;break;case nm:case om:o.DPI=90*r;break;default:rt(!1,52)}var l,u=i.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==s.length)l=s[0];else l=s[Ge(ip(t),s.length)];return em(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||Fy;this.v13_=hn(t,"1.3")>=0},e.prototype.tileUrlFunction=function(t,e,n){var r=this.getTileGrid();if(r||(r=this.getTileGridForProjection(n)),!(r.getResolutions().length<=t[0])){1==e||this.hidpi_&&void 0!==this.serverType_||(e=1);var i=r.getResolution(t[0]),o=r.getTileCoordExtent(t,this.tmpExtent_),s=ti(r.getTileSize(t[0]),this.tmpSize),a=this.gutter_;0!==a&&(s=Jr(s,a,this.tmpSize),o=Qt(o,i*a,o)),1!=e&&(s=$r(s,e,this.tmpSize));var l={SERVICE:"WMS",VERSION:Fy,REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};return m(l,this.params_),this.getRequestUrl_(t,s,o,e,n,l)}},e}(By),gm=dm;W.unByKey=X;let _m={Control:hu,Zoom:mu,Attribution:du,ScaleLine:Fu,LayerSwitcher:Cp},ym={GeoJSON:jp,KML:_g,MVT:Zg},vm={Group:wl,Tile:Yy,Vector:Pa,VectorTile:ry,WebGLPoints:zv,Heatmap:D_,Image:U_},mm={toLonLat:function(t,e){var n=Pn(t,void 0!==e?e:"EPSG:3857","EPSG:4326"),r=n[0];return(r<-180||r>180)&&(n[0]=Ge(r+180,360)-180),n},fromLonLat:function(t,e){return Pn(t,"EPSG:4326",void 0!==e?e:"EPSG:3857")}},xm={LineString:Xr,Point:gr,MultiPoint:Hh},wm={Icon:da,Style:to,Text:io,Stroke:Wr,Fill:Gr,Circle:Zi},Sm={OSM:pm,XYZ:Wv,TileWMS:gm,BingMaps:Vv,Vector:qa,VectorTile:by,ImageWMS:um};t.Collection=nt,t.Feature=st,t.Map=Qc,t.Observable=W,t.View=ou,t.control=_m,t.format=ym,t.geom=xm,t.interaction=qc,t.layer=vm,t.proj=mm,t.source=Sm,t.sphere=un,t.style=wm,Object.defineProperty(t,"__esModule",{value:!0})})); //# sourceMappingURL=ol-custom.js.map