!function(){"use strict";var e=0;function Ct(t){return t.ol_uid||(t.ol_uid=++e)}var n=function(i){function t(t){var e="Assertion failed. See https://openlayers.org/en/"+"5.2.0".split("-")[0]+"/doc/errors/#"+t+" for details.";i.call(this,e),this.code=t,this.name="AssertionError",this.message=e}return i&&(t.__proto__=i),(t.prototype=Object.create(i&&i.prototype)).constructor=t}(Error),h="add",l="remove",a="propertychange",E="function"==typeof Object.assign?Object.assign:function(t,e){var i=arguments;if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var r=Object(t),n=1,o=arguments.length;nt[2]&&(t[2]=e[2]),e[1]t[3]&&(t[3]=e[3]),t}function q(t,e){e[0]t[2]&&(t[2]=e[0]),e[1]t[3]&&(t[3]=e[1])}function J(t,e,i,r,n){for(;ie[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 pt(t){return t[2]this.highWaterMark},t.prototype.clear=function(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null,this.dispatchEvent(w.CLEAR)},t.prototype.containsKey=function(t){return this.entries_.hasOwnProperty(t)},t.prototype.forEach=function(t,e){for(var i=this.oldest_;i;)t.call(e,i.value_,i.key_,this),i=i.newer},t.prototype.get=function(t){var e=this.entries_[t];return Z(void 0!==e,15),e===this.newest_?e.value_:(e===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(e.newer.older=e.older,e.older.newer=e.newer),e.newer=null,e.older=this.newest_,this.newest_.newer=e,(this.newest_=e).value_)},t.prototype.remove=function(t){var e=this.entries_[t];return Z(void 0!==e,15),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_},t.prototype.getCount=function(){return this.count_},t.prototype.getKeys=function(){var t,e=new Array(this.count_),i=0;for(t=this.newest_;t;t=t.older)e[i++]=t.key_;return e},t.prototype.getValues=function(){var t,e=new Array(this.count_),i=0;for(t=this.newest_;t;t=t.older)e[i++]=t.value_;return e},t.prototype.peekLast=function(){return this.oldest_.value_},t.prototype.peekLastKey=function(){return this.oldest_.key_},t.prototype.peekFirstKey=function(){return this.newest_.key_},t.prototype.pop=function(){var t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_},t.prototype.replace=function(t,e){this.get(t),this.entries_[t].value_=e},t.prototype.set=function(t,e){Z(!(t in this.entries_),16);var i={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[t]=i,++this.count_},t.prototype.setSize=function(t){this.highWaterMark=t},t.prototype.prune=function(){for(;this.canExpireCache();)this.pop()},t}(i),xi="10px sans-serif",Si=[0,0,0,1],Ei="round",Ci=[],Ti="round",wi=[0,0,0,1],Ri="center",Ii=[0,0,0,0],Li=new mi,bi={},Fi=null,Pi={},Mi=function(){var o,h,s=60,a=bi,l="32px ",u=["monospace","serif"],c=u.length,p="wmytzilWMYTZIL@#/&?$%10";function d(t){for(var e=Oi(),i=100;i<=700;i+=300){for(var r=i+" ",n=!0,o=0;o>>0,n=0;n=n[0]&&o[2]<=n[2]||(o[1]>=n[1]&&o[3]<=n[3]||zr(t,e,i,r,function(t,e){return function(t,e,i){var r=!1,n=Y(t,e),o=Y(t,i);if(n===N.INTERSECTING||o===N.INTERSECTING)r=!0;else{var s,a,h=t[0],l=t[1],u=t[2],c=t[3],p=e[0],d=e[1],f=i[0],_=i[1],g=(_-d)/(f-p);o&N.ABOVE&&!(n&N.ABOVE)&&(r=h<=(s=f-(_-c)/g)&&s<=u),r||!(o&N.RIGHT)||n&N.RIGHT||(r=l<=(a=_-(f-u)*g)&&a<=c),r||!(o&N.BELOW)||n&N.BELOW||(r=h<=(s=f-(_-l)/g)&&s<=u),r||!(o&N.LEFT)||n&N.LEFT||(r=l<=(a=_-(f-h)*g)&&a<=c)}return r}(n,t,e)}))))}function Wr(t,e,i,r,n){if(o=t,s=e,a=i[0],!(Vr(o,s,a,h=r,l=n)||Ur(o,s,a,h,l[0],l[1])||Ur(o,s,a,h,l[0],l[3])||Ur(o,s,a,h,l[2],l[1])||Ur(o,s,a,h,l[2],l[3])))return!1;var o,s,a,h,l;if(1===i.length)return!0;for(var u=1,c=i.length;u>1)],e))<0?s=r+1:(a=r,h=!n);return h?s:~s}(p,g);if(y<0){var v=(g-p[-y-2])/(p[-y-1]-p[-y-2]),m=e+(-y-2)*r;s=It(t[m],t[m+r],v),a=It(t[m+1],t[m+r+1],v)}else s=t[e+y*r],a=t[e+y*r+1]}return o?(o[0]=s,o[1]=a,o):[s,a]}function mn(t,e,i,r,n,o){if(i==e)return null;var s;if(n>1;n=this.transition_?1:Yn(r/this.transition_)},t.prototype.inTransition=function(t){return!!this.transition_&&-1!==this.transitionStarts_[t]},t.prototype.endTransition=function(t){this.transition_&&(this.transitionStarts_[t]=-1)},t}(i),Wn=function(s){function t(t,e,i,r,n,o){s.call(this,t,e,o),this.crossOrigin_=r,this.src_=i,this.image_=new Image,null!==r&&(this.image_.crossOrigin=r),this.imageListenerKeys_=null,this.tileLoadFunction_=n}return s&&(t.__proto__=s),((t.prototype=Object.create(s&&s.prototype)).constructor=t).prototype.disposeInternal=function(){this.state==Gn&&(this.unlistenImage_(),this.image_=Kn()),this.interimTile&&this.interimTile.dispose(),this.state=Un,this.changed(),s.prototype.disposeInternal.call(this)},t.prototype.getImage=function(){return this.image_},t.prototype.getKey=function(){return this.src_},t.prototype.handleImageError_=function(){this.state=Dn,this.unlistenImage_(),this.image_=Kn(),this.changed()},t.prototype.handleImageLoad_=function(){this.image_.naturalWidth&&this.image_.naturalHeight?this.state=kn:this.state=jn,this.unlistenImage_(),this.changed()},t.prototype.load=function(){this.state==Dn&&(this.state=An,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==An&&(this.state=Gn,this.changed(),this.imageListenerKeys_=[o(this.image_,w.ERROR,this.handleImageError_,this),o(this.image_,w.LOAD,this.handleImageLoad_,this)],this.tileLoadFunction_(this,this.src_))},t.prototype.unlistenImage_=function(){this.imageListenerKeys_.forEach(g),this.imageListenerKeys_=null},t}(Vn);function Kn(){var t=De(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas}var Hn=function(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0};Hn.prototype.begin=function(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0},Hn.prototype.update=function(t,e){this.points_.push(t,e,Date.now())},Hn.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]t;)i-=3;var r=this.points_[e+2]-this.points_[i+2];if(r<1e3/60)return!1;var n=this.points_[e]-this.points_[i],o=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(o,n),this.initialVelocity_=Math.sqrt(n*n+o*o)/r,this.initialVelocity_>this.minVelocity_},Hn.prototype.getDistance=function(){return(this.minVelocity_-this.initialVelocity_)/this.decay_},Hn.prototype.getAngle=function(){return this.angle_};var Zn=function(r){function t(t,e,i){r.call(this,t),this.map=e,this.frameState=void 0!==i?i:null}return r&&(t.__proto__=r),(t.prototype=Object.create(r&&r.prototype)).constructor=t}(m),qn=function(o){function t(t,e,i,r,n){o.call(this,t,e,n),this.originalEvent=i,this.pixel=e.getEventPixel(i),this.coordinate=e.getCoordinateFromPixel(this.pixel),this.dragging=void 0!==r&&r}return o&&(t.__proto__=o),((t.prototype=Object.create(o&&o.prototype)).constructor=t).prototype.preventDefault=function(){o.prototype.preventDefault.call(this),this.originalEvent.preventDefault()},t.prototype.stopPropagation=function(){o.prototype.stopPropagation.call(this),this.originalEvent.stopPropagation()},t}(Zn),Jn={SINGLECLICK:"singleclick",CLICK:w.CLICK,DBLCLICK:w.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},Qn=function(o){function t(t,e,i,r,n){o.call(this,t,e,i.originalEvent,r,n),this.pointerEvent=i}return o&&(t.__proto__=o),(t.prototype=Object.create(o&&o.prototype)).constructor=t}(qn),$n="pointermove",to="pointerdown",eo="pointerup",io="pointerover",ro="pointerout",no="pointerenter",oo="pointerleave",so="pointercancel",ao=function(t,e){this.dispatcher=t,this.mapping_=e};ao.prototype.getEvents=function(){return Object.keys(this.mapping_)},ao.prototype.getHandlerForEvent=function(t){return this.mapping_[t]};var ho=1,lo="mouse";function uo(t){if(!this.isEventSimulatedFromTouch_(t)){ho.toString()in this.pointerMap&&this.cancel(t);var e=yo(t,this.dispatcher);this.pointerMap[ho.toString()]=t,this.dispatcher.down(e,t)}}function co(t){if(!this.isEventSimulatedFromTouch_(t)){var e=yo(t,this.dispatcher);this.dispatcher.move(e,t)}}function po(t){if(!this.isEventSimulatedFromTouch_(t)){var e=this.pointerMap[ho.toString()];if(e&&e.button===t.button){var i=yo(t,this.dispatcher);this.dispatcher.up(i,t),this.cleanupMouse()}}}function fo(t){if(!this.isEventSimulatedFromTouch_(t)){var e=yo(t,this.dispatcher);this.dispatcher.enterOver(e,t)}}function _o(t){if(!this.isEventSimulatedFromTouch_(t)){var e=yo(t,this.dispatcher);this.dispatcher.leaveOut(e,t)}}var go=function(i){function t(t){var e={mousedown:uo,mousemove:co,mouseup:po,mouseover:fo,mouseout:_o};i.call(this,t,e),this.pointerMap=t.pointerMap,this.lastTouches=[]}return i&&(t.__proto__=i),((t.prototype=Object.create(i&&i.prototype)).constructor=t).prototype.isEventSimulatedFromTouch_=function(t){for(var e=this.lastTouches,i=t.clientX,r=t.clientY,n=0,o=e.length,s=void 0;n=e.length){for(var n=[],o=0;othis.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_},t.prototype.disposeInternal=function(){this.relayedListenerKey_&&(g(this.relayedListenerKey_),this.relayedListenerKey_=null),this.pointerdownListenerKey_&&(g(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(g),this.dragListenerKeys_.length=0,this.documentPointerEventHandler_&&(this.documentPointerEventHandler_.dispose(),this.documentPointerEventHandler_=null),this.pointerEventHandler_&&(this.pointerEventHandler_.dispose(),this.pointerEventHandler_=null),r.prototype.disposeInternal.call(this)},t}(i),Ko={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend"},Ho={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},Zo=function(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}};Zo.prototype.clear=function(){this.elements_.length=0,this.priorities_.length=0,_(this.queuedElements_)},Zo.prototype.dequeue=function(){var t=this.elements_,e=this.priorities_,i=t[0];1==t.length?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));var r=this.keyFunction_(i);return delete this.queuedElements_[r],i},Zo.prototype.enqueue=function(t){Z(!(this.keyFunction_(t)in this.queuedElements_),31);var e=this.priorityFunction_(t);return e!=1/0&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)},Zo.prototype.getCount=function(){return this.elements_.length},Zo.prototype.getLeftChildIndex_=function(t){return 2*t+1},Zo.prototype.getRightChildIndex_=function(t){return 2*t+2},Zo.prototype.getParentIndex_=function(t){return t-1>>1},Zo.prototype.heapify_=function(){var t;for(t=(this.elements_.length>>1)-1;0<=t;t--)this.siftUp_(t)},Zo.prototype.isEmpty=function(){return 0===this.elements_.length},Zo.prototype.isKeyQueued=function(t){return t in this.queuedElements_},Zo.prototype.isQueued=function(t){return this.isKeyQueued(this.keyFunction_(t))},Zo.prototype.siftUp_=function(t){for(var e=this.elements_,i=this.priorities_,r=e.length,n=e[t],o=i[t],s=t;t>1;){var a=this.getLeftChildIndex_(t),h=this.getRightChildIndex_(t),l=ho))break;i[e]=i[s],r[e]=r[s],e=s}i[e]=n,r[e]=o},Zo.prototype.reprioritize=function(){var t,e,i,r=this.priorityFunction_,n=this.elements_,o=this.priorities_,s=0,a=n.length;for(e=0;e=t.minResolution&&e=this.minArea_}function wa(t){ia(t)&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new Ea(Sa.BOXDRAG,t.coordinate,t)))}function Ra(t){return!ia(t)||(this.box_.setMap(null),this.boxEndCondition_(t,this.startPixel_,t.pixel)&&(this.onBoxEnd_(t),this.dispatchEvent(new Ea(Sa.BOXEND,t.coordinate,t))),!1)}function Ia(t){return!!ia(t)&&(!(!Zs(t)||!this.condition_(t))&&(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new Ea(Sa.BOXSTART,t.coordinate,t)),!0))}var La=function(r){function t(t){var e=t||{},i=e.condition?e.condition:ta;r.call(this,{condition:i,className:e.className||"ol-dragzoom",onBoxEnd:ba}),this.duration_=void 0!==e.duration?e.duration:200,this.out_=void 0!==e.out&&e.out}return r&&(t.__proto__=r),(t.prototype=Object.create(r&&r.prototype)).constructor=t}(Ca);function ba(){var t=this.getMap(),e=t.getView(),i=t.getSize(),r=this.getGeometry().getExtent();if(this.out_){var n=e.calculateExtent(i),o=W([t.getPixelFromCoordinate(rt(r)),t.getPixelFromCoordinate(ut(r))]);dt(n,1/e.getResolutionForExtent(o,i)),r=n}var s=e.constrainResolution(e.getResolutionForExtent(r,i)),a=ot(r);a=e.constrainCenter(a),e.animate({resolution:s,center:a,duration:this.duration_,easing:Bn})}var Fa={LEFT:37,UP:38,RIGHT:39,DOWN:40},Pa=function(i){function t(t){i.call(this,{handleEvent:Ma});var e=t||{};this.defaultCondition_=function(t){return $s(t)&&ea(t)},this.condition_=void 0!==e.condition?e.condition:this.defaultCondition_,this.duration_=void 0!==e.duration?e.duration:100,this.pixelDelta_=void 0!==e.pixelDelta?e.pixelDelta:128}return i&&(t.__proto__=i),(t.prototype=Object.create(i&&i.prototype)).constructor=t}(ks);function Ma(t){var e=!1;if(t.type==w.KEYDOWN){var i=t.originalEvent.keyCode;if(this.condition_(t)&&(i==Fa.DOWN||i==Fa.LEFT||i==Fa.RIGHT||i==Fa.UP)){var r=t.map.getView(),n=r.getResolution()*this.pixelDelta_,o=0,s=0;i==Fa.DOWN?s=-n:i==Fa.LEFT?o=-n:i==Fa.RIGHT?o=n:s=n;var a=[o,s];pn(a,r.getRotation()),function(t,e,i){var r=t.getCenter();if(r){var n=t.constrainCenter([r[0]+e[0],r[1]+e[1]]);i?t.animate({duration:i,easing:zn,center:n}):t.setCenter(n)}}(r,a,this.duration_),t.preventDefault(),e=!0}}return!e}var Oa=function(i){function t(t){i.call(this,{handleEvent:Na});var e=t||{};this.condition_=e.condition?e.condition:ea,this.delta_=e.delta?e.delta:1,this.duration_=void 0!==e.duration?e.duration:100}return i&&(t.__proto__=i),(t.prototype=Object.create(i&&i.prototype)).constructor=t}(ks);function Na(t){var e=!1;if(t.type==w.KEYDOWN||t.type==w.KEYPRESS){var i=t.originalEvent.charCode;if(this.condition_(t)&&(i=="+".charCodeAt(0)||i=="-".charCodeAt(0))){var r=t.map,n=i=="+".charCodeAt(0)?this.delta_:-this.delta_;Ys(r.getView(),n,void 0,this.duration_),t.preventDefault(),e=!0}}return!e}var Aa={TRACKPAD:"trackpad",WHEEL:"wheel"},Ga=function(i){function t(t){i.call(this,{handleEvent:ka});var e=t||{};this.delta_=0,this.duration_=void 0!==e.duration?e.duration:250,this.timeout_=void 0!==e.timeout?e.timeout:80,this.useAnchor_=void 0===e.useAnchor||e.useAnchor,this.constrainResolution_=e.constrainResolution||!1,this.condition_=e.condition?e.condition:Hs,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_=void 0,this.trackpadDeltaPerZoom_=300,this.trackpadZoomBuffer_=1.5}return i&&(t.__proto__=i),((t.prototype=Object.create(i&&i.prototype)).constructor=t).prototype.decrementInteractingHint_=function(){this.trackpadTimeoutId_=void 0,this.getMap().getView().setHint(is.INTERACTING,-1)},t.prototype.handleWheelZoom_=function(t){var e=t.getView();e.getAnimating()&&e.cancelAnimations();Ys(e,-gt(this.delta_,-1,1),this.lastAnchor_,this.duration_),this.mode_=void 0,this.delta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0},t.prototype.setMouseAnchor=function(t){(this.useAnchor_=t)||(this.lastAnchor_=null)},t}(ks);function ka(t){if(!this.condition_(t))return!0;var e=t.type;if(e!==w.WHEEL&&e!==w.MOUSEWHEEL)return!0;t.preventDefault();var i,r=t.map,n=t.originalEvent;if(this.useAnchor_&&(this.lastAnchor_=t.coordinate),t.type==w.WHEEL?(i=n.deltaY,ri&&n.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(i/=ai),n.deltaMode===WheelEvent.DOM_DELTA_LINE&&(i*=40)):t.type==w.MOUSEWHEEL&&(i=-n.wheelDeltaY,ni&&(i/=3)),0===i)return!1;var o=Date.now();if(void 0===this.startTime_&&(this.startTime_=o),(!this.mode_||o-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(i)<4?Aa.TRACKPAD:Aa.WHEEL),this.mode_===Aa.TRACKPAD){var s=r.getView();this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):s.setHint(is.INTERACTING,1),this.trackpadTimeoutId_=setTimeout(this.decrementInteractingHint_.bind(this),this.trackpadEventGap_);var a=s.getResolution()*Math.pow(2,i/this.trackpadDeltaPerZoom_),h=s.getMinResolution(),l=s.getMaxResolution(),u=0;if(athis.threshold_&&(this.rotating_=!0),e=o}this.lastAngle_=n;var s=t.map,a=s.getView();if(a.getConstraints().rotation!==ts){var h=s.getViewport().getBoundingClientRect(),l=la(this.targetPointers);if(l[0]-=h.left,l[1]-=h.top,this.anchor_=s.getCoordinateFromPixel(l),this.rotating_){var u=a.getRotation();s.render(),js(a,u+e,this.anchor_)}}}function Ua(t){if(this.targetPointers.length<2){var e=t.map.getView();if(e.setHint(is.INTERACTING,-1),this.rotating_)Ds(e,e.getRotation(),this.anchor_,this.duration_);return!1}return!0}function Ya(t){if(2<=this.targetPointers.length){var e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().setHint(is.INTERACTING,1),!0}return!1}var Ba=function(i){function t(t){i.call(this,{handleDownEvent:Va,handleDragEvent:Xa,handleUpEvent:za,stopDown:v});var e=t||{};this.constrainResolution_=e.constrainResolution||!1,this.anchor_=null,this.duration_=void 0!==e.duration?e.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}return i&&(t.__proto__=i),(t.prototype=Object.create(i&&i.prototype)).constructor=t}(ha);function Xa(t){var e=1,i=this.targetPointers[0],r=this.targetPointers[1],n=i.clientX-r.clientX,o=i.clientY-r.clientY,s=Math.sqrt(n*n+o*o);void 0!==this.lastDistance_&&(e=this.lastDistance_/s),this.lastDistance_=s;var a=t.map,h=a.getView(),l=h.getResolution(),u=h.getMaxResolution(),c=h.getMinResolution(),p=l*e;ue.getMaxResolution()){var r=this.lastScaleDelta_-1;Us(e,i,this.anchor_,this.duration_,r)}return!1}return!0}function Va(t){if(2<=this.targetPointers.length){var e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().setHint(is.INTERACTING,1),!0}return!1}var Wa="addfeatures",Ka=function(n){function t(t,e,i,r){n.call(this,t),this.features=i,this.file=e,this.projection=r}return n&&(t.__proto__=n),(t.prototype=Object.create(n&&n.prototype)).constructor=t}(m),Ha=function(i){function t(t){var e=t||{};i.call(this,{handleEvent:y}),this.formatConstructors_=e.formatConstructors?e.formatConstructors:[],this.projection_=e.projection?ne(e.projection):null,this.dropListenKeys_=null,this.source_=e.source||null,this.target=e.target?e.target:null}return i&&(t.__proto__=i),((t.prototype=Object.create(i&&i.prototype)).constructor=t).prototype.handleResult_=function(t,e){var i=e.target.result,r=this.getMap(),n=this.projection_;n||(n=r.getView().getProjection());for(var o=this.formatConstructors_,s=[],a=0,h=o.length;a=e[0]||(t[1]<=e[1]&&t[3]>=e[1]||et(t,this.intersectsCoordinate,this))}return!1},t.prototype.setCenter=function(t){var e=this.stride,i=this.flatCoordinates[e]-this.flatCoordinates[0],r=t.slice();r[e]=r[0]+i;for(var n=1;n=t.minX&&e.maxY>=t.minY}function Ah(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Gh(t,e,i,r,n){for(var o,s=[e,i];s.length;)(i=s.pop())-(e=s.pop())<=r||(o=e+Math.ceil((i-e)/r/2)*r,Sh(t,o,e,i,n),s.push(e,o,o,i))}Th.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,i=[],r=this.toBBox;if(!Nh(t,e))return i;for(var n,o,s,a,h=[];e;){for(n=0,o=e.children.length;nthis._maxEntries;)this._split(o,e),e--;this._adjustParentBBoxes(n,o,e)},_split:function(t,e){var i=t[e],r=i.children.length,n=this._minEntries;this._chooseSplitAxis(i,n,r);var o=this._chooseSplitIndex(i,n,r),s=Ah(i.children.splice(o,i.children.length-o));s.height=i.height,s.leaf=i.leaf,Rh(i,this.toBBox),Rh(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(i,s)},_splitRoot:function(t,e){this.data=Ah([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Rh(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,i){var r,n,o,s,a,h,l,u,c,p,d,f,_,g;for(h=l=1/0,r=e;r<=i-e;r++)n=Ih(t,0,r,this.toBBox),o=Ih(t,r,i,this.toBBox),c=n,p=o,void 0,d=Math.max(c.minX,p.minX),f=Math.max(c.minY,p.minY),_=Math.min(c.maxX,p.maxX),g=Math.min(c.maxY,p.maxY),s=Math.max(0,_-d)*Math.max(0,g-f),a=Ph(n)+Ph(o),sthis.squaredClickTolerance_:o<=this.squaredClickTolerance_,!this.shouldHandle_)return!0}return this.finishCoordinate_?this.modifyDrawing_(t):this.createOrUpdateSketchPoint_(t),!0},t.prototype.atFinish_=function(t){var e=!1;if(this.sketchFeature_){var i=!1,r=[this.finishCoordinate_];if(this.mode_===Uh.LINE_STRING?i=this.sketchCoords_.length>this.minPoints_:this.mode_===Uh.POLYGON&&(i=this.sketchCoords_[0].length>this.minPoints_,r=[this.sketchCoords_[0][0],this.sketchCoords_[0][this.sketchCoords_[0].length-2]]),i)for(var n=t.map,o=0,s=r.length;o=this.maxPoints_&&(this.freehand_?i.pop():e=!0),i.push(r.slice()),this.geometryFunction_(i,n)):this.mode_===Uh.POLYGON&&((i=this.sketchCoords_[0]).length>=this.maxPoints_&&(this.freehand_?i.pop():e=!0),i.push(r.slice()),e&&(this.finishCoordinate_=i[0]),this.geometryFunction_(this.sketchCoords_,n)),this.updateSketchFeatures_(),e&&this.finishDrawing()},t.prototype.removeLastPoint=function(){if(this.sketchFeature_){var t,e=this.sketchFeature_.getGeometry();this.mode_===Uh.LINE_STRING?((t=this.sketchCoords_).splice(-2,1),this.geometryFunction_(t,e),2<=t.length&&(this.finishCoordinate_=t[t.length-2].slice())):this.mode_===Uh.POLYGON&&((t=this.sketchCoords_[0]).splice(-2,1),this.sketchLine_.getGeometry().setCoordinates(t),this.geometryFunction_(this.sketchCoords_,e)),0===t.length&&(this.finishCoordinate_=null),this.updateSketchFeatures_()}},t.prototype.finishDrawing=function(){var t=this.abortDrawing_();if(t){var e=this.sketchCoords_,i=t.getGeometry();this.mode_===Uh.LINE_STRING?(e.pop(),this.geometryFunction_(e,i)):this.mode_===Uh.POLYGON&&(e[0].pop(),this.geometryFunction_(e,i),e=i.getCoordinates()),this.type_===Lt.MULTI_POINT?t.setGeometry(new rh([e])):this.type_===Lt.MULTI_LINE_STRING?t.setGeometry(new ih([e])):this.type_===Lt.MULTI_POLYGON&&t.setGeometry(new oh([e])),this.dispatchEvent(new Xh(Bh,t)),this.features_&&this.features_.push(t),this.source_&&this.source_.addFeature(t)}},t.prototype.abortDrawing_=function(){this.finishCoordinate_=null;var t=this.sketchFeature_;return t&&(this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0)),t},t.prototype.extend=function(t){var e=t.getGeometry();this.sketchFeature_=t,this.sketchCoords_=e.getCoordinates();var i=this.sketchCoords_[this.sketchCoords_.length-1];this.finishCoordinate_=i.slice(),this.sketchCoords_.push(i.slice()),this.updateSketchFeatures_(),this.dispatchEvent(new Xh(Yh,this.sketchFeature_))},t.prototype.updateSketchFeatures_=function(){var t=[];this.sketchFeature_&&t.push(this.sketchFeature_),this.sketchLine_&&t.push(this.sketchLine_),this.sketchPoint_&&t.push(this.sketchPoint_);var e=this.overlay_.getSource();e.clear(!0),e.addFeatures(t)},t.prototype.updateState_=function(){var t=this.getMap(),e=this.getActive();t&&e||this.abortDrawing_(),this.overlay_.setMap(e?t:null)},t}(ha);function Vh(t){t.originalEvent.type===w.CONTEXTMENU&&t.preventDefault(),this.freehand_=this.mode_!==Uh.POINT&&this.freehandCondition_(t);var e=t.type===Jn.POINTERMOVE,i=!0;this.lastDragTime_&&t.type===Jn.POINTERDRAG&&(Date.now()-this.lastDragTime_>=this.dragVertexDelay_?(this.downPx_=t.pixel,this.shouldHandle_=!this.freehand_,e=!0):this.lastDragTime_=void 0,this.shouldHandle_&&this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0));return this.freehand_&&t.type===Jn.POINTERDRAG&&null!==this.sketchFeature_?(this.addToDrawing_(t),i=!1):this.freehand_&&t.type===Jn.POINTERDOWN?i=!1:e?(i=t.type===Jn.POINTERMOVE)&&this.freehand_?i=this.handlePointerMove_(t):(t.pointerEvent.pointerType==lo||t.type===Jn.POINTERDRAG&&!this.downTimeout_)&&this.handlePointerMove_(t):t.type===Jn.DBLCLICK&&(i=!1),ua.call(this,t)&&i}function Wh(t){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=t.pixel,this.finishCoordinate_||this.startDrawing_(t),!0):!!this.condition_(t)&&(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout(function(){this.handlePointerMove_(new Qn(Jn.POINTERMOVE,t.map,t.pointerEvent,t.frameState))}.bind(this),this.dragVertexDelay_),this.downPx_=t.pixel,!0)}function Kh(t){var e=!0;this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0),this.handlePointerMove_(t);var i=this.mode_===Uh.CIRCLE;return this.shouldHandle_?(this.finishCoordinate_?this.freehand_||i?this.finishDrawing():this.atFinish_(t)?this.finishCondition_(t)&&this.finishDrawing():this.addToDrawing_(t):(this.startDrawing_(t),this.mode_===Uh.POINT&&this.finishDrawing()),e=!1):this.freehand_&&(this.finishCoordinate_=null,this.abortDrawing_()),!e&&this.stopClick_&&t.stopPropagation(),e}var Hh="extentchanged",Zh=function(e){function t(t){e.call(this,Hh),this.extent=t}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t}(m),qh=function(n){function t(t){n.call(this,{handleDownEvent:Qh,handleDragEvent:$h,handleEvent:Jh,handleUpEvent:tl});var i,r,e=t||{};this.extent_=null,this.pointerHandler_=null,this.pixelTolerance_=void 0!==e.pixelTolerance?e.pixelTolerance:10,this.snappedToVertex_=!1,this.extentFeature_=null,this.vertexFeature_=null,t||(t={}),this.extentOverlay_=new uh({source:new jh({useSpatialIndex:!1,wrapX:!!t.wrapX}),style:t.boxStyle?t.boxStyle:(i=Zi(),function(t,e){return i[Lt.POLYGON]}),updateWhileAnimating:!0,updateWhileInteracting:!0}),this.vertexOverlay_=new uh({source:new jh({useSpatialIndex:!1,wrapX:!!t.wrapX}),style:t.pointerStyle?t.pointerStyle:(r=Zi(),function(t,e){return r[Lt.POINT]}),updateWhileAnimating:!0,updateWhileInteracting:!0}),t.extent&&this.setExtent(t.extent)}return n&&(t.__proto__=n),((t.prototype=Object.create(n&&n.prototype)).constructor=t).prototype.snapToVertex_=function(t,e){var i,r=e.getCoordinateFromPixel(t),n=this.getExtent();if(n){var o=[[[(i=n)[0],i[1]],[i[0],i[3]]],[[i[0],i[3]],[i[2],i[3]]],[[i[2],i[3]],[i[2],i[1]]],[[i[2],i[1]],[i[0],i[1]]]];o.sort(function(t,e){return gn(r,t)-gn(r,e)});var s=o[0],a=hn(r,s),h=e.getPixelFromCoordinate(a);if(_n(t,h)<=this.pixelTolerance_){var l=e.getPixelFromCoordinate(s[0]),u=e.getPixelFromCoordinate(s[1]),c=fn(h,l),p=fn(h,u),d=Math.sqrt(Math.min(c,p));return this.snappedToVertex_=d<=this.pixelTolerance_,this.snappedToVertex_&&(a=pi&&(t.index+=n)})},t}(ha);function hl(t,e){return t.index-e.index}function ll(t){if(!this.condition_(t))return!1;this.handlePointerAtPixel_(t.pixel,t.map);var e=t.map.getCoordinateFromPixel(t.pixel);this.dragSegments_.length=0,this.modified_=!1;var i=this.vertexFeature_;if(i){var r=[],n=i.getGeometry().getCoordinates(),o=A([n]),s=this.rBush_.getInExtent(o),a={};s.sort(hl);for(var h=0,l=s.length;hthis.maxCacheSize_){var t=0;for(var e in this.cache_){var i=this.cache_[e];0!=(3&t++)||i.hasListener()||(delete this.cache_[e],--this.cacheSize_)}}},Nl.prototype.get=function(t,e,i){var r=Al(t,e,i);return r in this.cache_?this.cache_[r]:null},Nl.prototype.set=function(t,e,i,r){var n=Al(t,e,i);this.cache_[n]=r,++this.cacheSize_},Nl.prototype.setSize=function(t){this.maxCacheSize_=t,this.expire()};var Gl=new Nl,kl=function(e){function t(t){e.call(this),this.map_=t,this.layerRenderers_={},this.layerRendererListeners_={},this.layerRendererConstructors_=[]}return e&&(t.__proto__=e),((t.prototype=Object.create(e&&e.prototype)).constructor=t).prototype.registerLayerRenderers=function(t){this.layerRendererConstructors_.push.apply(this.layerRendererConstructors_,t)},t.prototype.getLayerRendererConstructors=function(){return this.layerRendererConstructors_},t.prototype.calculateMatrices2D=function(t){var e=t.viewState,i=t.coordinateToPixelTransform,r=t.pixelToCoordinateTransform;Te(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),we(me(r,i))},t.prototype.removeLayerRenderers=function(){for(var t in this.layerRenderers_)this.removeLayerRendererByKey_(t).dispose()},t.prototype.forEachFeatureAtCoordinate=function(t,n,e,o,s,i,r){var a,h=n.viewState,l=h.resolution;function u(t,e){var i=Ct(t).toString(),r=n.layerStates[Ct(e)].managed;if(!(i in n.skippedFeatureUids)||r)return o.call(s,t,r?e:null)}var c=h.projection,p=t;if(c.canWrapX()){var d=c.getExtent(),f=ct(d),_=t[0];if(_d[2])p=[_+f*Math.ceil((d[0]-_)/f),t[1]]}var g,y=n.layerStatesArray;for(g=y.length-1;0<=g;--g){var v=y[g],m=v.layer;if(bs(v,l)&&i.call(r,m)){var x=this.getLayerRenderer(m);if(m.getSource()&&(a=x.forEachFeatureAtCoordinate(m.getSource().getWrapX()?p:t,n,e,u,s)),a)return a}}},t.prototype.forEachLayerAtPixel=function(t,e,i,r,n,o,s){},t.prototype.hasFeatureAtCoordinate=function(t,e,i,r,n){return void 0!==this.forEachFeatureAtCoordinate(t,e,i,y,this,r,n)},t.prototype.getLayerRenderer=function(t){var e=Ct(t).toString();if(e in this.layerRenderers_)return this.layerRenderers_[e];for(var i,r=0,n=this.layerRendererConstructors_.length;rthis.maxX&&(this.maxX=t.maxX),t.minYthis.maxY&&(this.maxY=t.maxY)},Wl.prototype.getHeight=function(){return this.maxY-this.minY+1},Wl.prototype.getSize=function(){return[this.getWidth(),this.getHeight()]},Wl.prototype.getWidth=function(){return this.maxX-this.minX+1},Wl.prototype.intersects=function(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY};var Hl=function(i){function t(t,e){i.call(this,t),this.context=e?null:De(),this.oversampling_,this.renderedExtent_=null,this.renderedRevision,this.renderedTiles=[],this.newTiles_=!1,this.tmpExtent=[1/0,1/0,-1/0,-1/0],this.tmpTileRange_=new Wl(0,0,0,0),this.imageTransform_=[1,0,0,1,0,0],this.zDirection=0}return i&&(t.__proto__=i),((t.prototype=Object.create(i&&i.prototype)).constructor=t).prototype.isDrawableTile_=function(t){var e=t.getState(),i=this.getLayer().getUseInterimTilesOnError();return e==kn||e==jn||e==Dn&&!i},t.prototype.getTile=function(t,e,i,r,n){var o=this.getLayer(),s=o.getSource().getTile(t,e,i,r,n);return s.getState()==Dn&&(o.getUseInterimTilesOnError()?0t[i-r],d=n.length,f=t[e],_=t[e+1],g=t[e+=r],y=t[e+1],v=0,m=Math.sqrt(Math.pow(g-f,2)+Math.pow(y-_,2)),x="",S=0,E=0;EMath.PI?-2*Math.PI:L<-Math.PI?2*Math.PI:0,Math.abs(L)>a)return null}var b=R/m,F=It(f,g,b),P=It(_,y,b);u==I?(p&&(h[0]=F,h[1]=P,h[2]=T/2),h[4]=x):(h=[F,P,(S=T)/2,I,x=C],p?c.unshift(h):c.push(h),u=I),s+=T}return c}var Ql=0,$l=1,tu=2,eu=3,iu=4,ru=5,nu=6,ou=7,su=8,au=9,hu=10,lu=11,uu=12,cu=[su],pu=[uu],du=[$l],fu=[eu],_u=[ql.POLYGON,ql.CIRCLE,ql.LINE_STRING,ql.IMAGE,ql.TEXT,ql.DEFAULT],gu={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},yu=[1/0,1/0,-1/0,-1/0],vu=[1,0,0,1,0,0],mu=function(s){function t(t,e,i,r,n,o){s.call(this),this.declutterTree=o,this.tolerance=t,this.maxExtent=e,this.overlaps=n,this.pixelRatio=r,this.maxLineWidth=0,this.resolution=i,this.alignFill_,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.coordinateCache_={},this.renderedTransform_=[1,0,0,1,0,0],this.hitDetectionInstructions=[],this.pixelCoordinates_=null,this.state={},this.viewRotation_=0}return s&&(t.__proto__=s),((t.prototype=Object.create(s&&s.prototype)).constructor=t).prototype.replayTextBackground_=function(t,e,i,r,n,o,s){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,r),t.lineTo.apply(t,n),t.lineTo.apply(t,e),o&&(this.alignFill_=o[2],this.fill_(t)),s&&(this.setStrokeStyle_(t,s),t.stroke())},t.prototype.replayImage_=function(t,e,i,r,n,o,s,a,h,l,u,c,p,d,f,_,g,y){var v=g||y;e-=n*=p,i-=o*=p;var m,x,S,E,C=f+l>r.width?r.width-l:f,T=a+u>r.height?r.height-u:a,w=_[3]+C*p+_[1],R=_[0]+T*p+_[2],I=e-_[3],L=i-_[0];(v||0!==c)&&(m=[I,L],x=[I+w,L],S=[I+w,L+R],E=[I,L+R]);var b=null;if(0!==c){var F=e+n,P=i+o;b=Te(vu,F,P,1,1,c,-F,-P),z(yu),q(yu,xe(vu,m)),q(yu,xe(vu,x)),q(yu,xe(vu,S)),q(yu,xe(vu,E))}else X(I,L,I+w,L+R,yu);var M=t.canvas,O=y?y[2]*p/2:0,N=yu[0]-O<=M.width&&0<=yu[2]+O&&yu[1]-O<=M.height&&0<=yu[3]+O;if(d&&(e=Math.round(e),i=Math.round(i)),s){if(!N&&1==s[4])return;H(s,yu);var A=N?[t,b?b.slice(0):null,h,r,l,u,C,T,e,i,p]:null;A&&v&&A.push(g,y,m,x,S,E),s.push(A)}else N&&(v&&this.replayTextBackground_(t,m,x,S,E,g,y),Ui(t,b,h,r,l,u,C,T,e,i,p))},t.prototype.applyPixelRatio=function(t){var e=this.pixelRatio;return 1==e?t:t.map(function(t){return t*e})},t.prototype.appendFlatCoordinates=function(t,e,i,r,n,o){var s=this.coordinates.length,a=this.getBufferedMaxExtent();o&&(e+=r);var h,l,u,c=[t[e],t[e+1]],p=[NaN,NaN],d=!0;for(h=e+r;hthis.maxLineWidth&&(this.maxLineWidth=i.lineWidth,this.bufferedMaxExtent_=null)}else i.strokeStyle=void 0,i.lineCap=void 0,i.lineDash=null,i.lineDashOffset=void 0,i.lineJoin=void 0,i.lineWidth=void 0,i.miterLimit=void 0},t.prototype.createFill=function(t,e){var i=t.fillStyle,r=[hu,i];return"string"!=typeof i&&r.push(!0),r},t.prototype.applyStroke=function(t){this.instructions.push(this.createStroke(t))},t.prototype.createStroke=function(t){return[lu,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]},t.prototype.updateFillStyle=function(t,e,i){var r=t.fillStyle;"string"==typeof r&&t.currentFillStyle==r||(void 0!==r&&this.instructions.push(e.call(this,t,i)),t.currentFillStyle=r)},t.prototype.updateStrokeStyle=function(t,e){var i=t.strokeStyle,r=t.lineCap,n=t.lineDash,o=t.lineDashOffset,s=t.lineJoin,a=t.lineWidth,h=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=r||n!=t.currentLineDash&&!fr(t.currentLineDash,n)||t.currentLineDashOffset!=o||t.currentLineJoin!=s||t.currentLineWidth!=a||t.currentMiterLimit!=h)&&(void 0!==i&&e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=r,t.currentLineDash=n,t.currentLineDashOffset=o,t.currentLineJoin=s,t.currentLineWidth=a,t.currentMiterLimit=h)},t.prototype.endGeometry=function(t,e){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;var i=[ou,e];this.instructions.push(i),this.hitDetectionInstructions.push(i)},t.prototype.getBufferedMaxExtent=function(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=k(this.maxExtent),0=S)&&l.push(E[o],E[o+1]);if(0==(u=l.length))return}u=this.appendFlatCoordinates(l,0,u,c,!1,!1),(n.backgroundFill||n.backgroundStroke)&&(this.setFillStrokeStyle(n.backgroundFill,n.backgroundStroke),n.backgroundFill&&(this.updateFillStyle(this.state,this.createFill,t),this.hitDetectionInstructions.push(this.createFill(this.state,t))),n.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(t,e),this.drawTextImage_(x,a,u),this.endGeometry(t,e)}}},t.prototype.getImage=function(t,e,i,r){var n,o=r+e+t+i+this.pixelRatio;if(!Li.containsKey(o)){var s=r?this.strokeStates[r]||this.textStrokeState_:null,a=i?this.fillStates[i]||this.textFillState_:null,h=this.textStates[e]||this.textState_,l=this.pixelRatio,u=h.scale*l,c=gu[h.textAlign||Ri],p=r&&s.lineWidth?s.lineWidth:0,d=t.split("\n"),f=d.length,_=[],g=function(t,e,i){for(var r=e.length,n=0,o=0;ol[2];)b=P*++M,c=this.getTransform(e,b),f.replay(_,c,h,o,R),F-=P}if(Di(_,h,I/2,L/2),x&&this.dispatchRenderEvent(_,e,c),_!=t){if(m){var O=t.globalAlpha;t.globalAlpha=i.opacity,t.drawImage(_.canvas,-y,-v),t.globalAlpha=O}else t.drawImage(_.canvas,-y,-v);_.translate(-y,-v)}m||(_.globalAlpha=T)}d&&t.restore()},t.prototype.composeFrame=function(t,e,i){var r=this.getTransform(t,0);this.preCompose(i,t,r),this.compose(i,t,e),this.postCompose(i,t,e,r)},t.prototype.forEachFeatureAtCoordinate=function(t,e,i,r,n){if(this.replayGroup_){var o=e.viewState.resolution,s=e.viewState.rotation,a=this.getLayer(),h={};return this.replayGroup_.forEachFeatureAtCoordinate(t,o,s,i,{},function(t){var e=Ct(t).toString();if(!(e in h))return h[e]=!0,r.call(n,t,a)},null)}},t.prototype.handleFontsChanged_=function(t){var e=this.getLayer();e.getVisible()&&this.replayGroup_&&e.changed()},t.prototype.handleStyleImageChange_=function(t){this.renderIfReadyAndVisible()},t.prototype.prepareFrame=function(t,e){var n=this.getLayer(),i=n.getSource(),r=t.viewHints[is.ANIMATING],o=t.viewHints[is.INTERACTING],s=n.getUpdateWhileAnimating(),a=n.getUpdateWhileInteracting();if(!this.dirty_&&!s&&r||!a&&o)return!0;var h=t.extent,l=t.viewState,u=l.projection,c=l.resolution,p=t.pixelRatio,d=n.getRevision(),f=n.getRenderBuffer(),_=n.getRenderOrder();void 0===_&&(_=Fu);var g=G(h,f*c),y=l.projection.getExtent();if(i.getWrapX()&&l.projection.canWrapX()&&!Q(y,t.extent)){var v=ct(y),m=Math.max(ct(g)/2,v);g[0]=y[0]-m,g[2]=y[2]+m}if(!this.dirty_&&this.renderedResolution_==c&&this.renderedRevision_==d&&this.renderedRenderOrder_==_&&Q(this.renderedExtent_,g))return!(this.replayGroupChanged=!1);this.replayGroup_=null,this.dirty_=!1;var x=new wu(Mu(c,p),g,c,p,i.getOverlaps(),this.declutterTree_,n.getRenderBuffer());i.loadFeatures(g,c,u);var S=function(t){var e,i=t.getStyleFunction()||n.getStyleFunction();if(i&&(e=i(t,c)),e){var r=this.renderFeature(t,c,p,e,x);this.dirty_=this.dirty_||r}}.bind(this);if(_){var E=[];i.forEachFeatureInExtent(g,function(t){E.push(t)},this),E.sort(_);for(var C=0,T=E.length;C=this.minWidth_)break;++c}var p=l+" "+a;this.renderedHTML_!=p&&(this.innerElement_.innerHTML=p,this.renderedHTML_=p),this.renderedWidth_!=u&&(this.innerElement_.style.width=u+"px",this.renderedWidth_=u),this.renderedVisible_||(this.element.style.display="",this.renderedVisible_=!0)}else this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1)},t}(Is);function Sc(t){var e=t.frameState;this.viewState_=e?e.viewState:null,this.updateElement_()}var Ec=0,Cc=1,Tc=function(o){function t(t){var e=t||{};o.call(this,{element:document.createElement("div"),render:e.render||wc}),this.currentResolution_=void 0,this.direction_=Ec,this.dragging_,this.heightLimit_=0,this.widthLimit_=0,this.previousX_,this.previousY_,this.thumbSize_=null,this.sliderInitialized_=!1,this.duration_=void 0!==e.duration?e.duration:200;var i=void 0!==e.className?e.className:"ol-zoomslider",r=document.createElement("button");r.setAttribute("type","button"),r.className=i+"-thumb "+_i;var n=this.element;n.className=i+" "+_i+" "+gi,n.appendChild(r),this.dragger_=new Vo(n),C(this.dragger_,to,this.handleDraggerStart_,this),C(this.dragger_,$n,this.handleDraggerDrag_,this),C(this.dragger_,eo,this.handleDraggerEnd_,this),C(n,w.CLICK,this.handleContainerClick_,this),C(r,w.CLICK,x)}return o&&(t.__proto__=o),((t.prototype=Object.create(o&&o.prototype)).constructor=t).prototype.disposeInternal=function(){this.dragger_.dispose(),o.prototype.disposeInternal.call(this)},t.prototype.setMap=function(t){o.prototype.setMap.call(this,t),t&&t.render()},t.prototype.initSlider_=function(){var t=this.element,e=t.offsetWidth,i=t.offsetHeight,r=t.firstElementChild,n=getComputedStyle(r),o=r.offsetWidth+parseFloat(n.marginRight)+parseFloat(n.marginLeft),s=r.offsetHeight+parseFloat(n.marginTop)+parseFloat(n.marginBottom);this.thumbSize_=[o,s],i radius + v_halfWidth) {\n if (u_strokeColor.a == 0.0) {\n gl_FragColor = u_fillColor;\n } else {\n gl_FragColor = u_strokeColor;\n }\n gl_FragColor.a = gl_FragColor.a - (dist - (radius + v_halfWidth));\n } else if (u_fillColor.a == 0.0) {\n // Hooray, no fill, just stroke. We can use real antialiasing.\n gl_FragColor = u_strokeColor;\n if (dist < radius - v_halfWidth) {\n gl_FragColor.a = gl_FragColor.a - (radius - v_halfWidth - dist);\n }\n } else {\n gl_FragColor = u_fillColor;\n float strokeDist = radius - v_halfWidth;\n float antialias = 2.0 * v_pixelRatio;\n if (dist > strokeDist) {\n gl_FragColor = u_strokeColor;\n } else if (dist >= strokeDist - antialias) {\n float step = smoothstep(strokeDist - antialias, strokeDist, dist);\n gl_FragColor = mix(u_fillColor, u_strokeColor, step);\n }\n }\n gl_FragColor.a = gl_FragColor.a * u_opacity;\n if (gl_FragColor.a <= 0.0) {\n discard;\n }\n}\n"),Pc=new bc("varying vec2 v_center;\nvarying vec2 v_offset;\nvarying float v_halfWidth;\nvarying float v_pixelRatio;\n\n\nattribute vec2 a_position;\nattribute float a_instruction;\nattribute float a_radius;\n\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_offsetScaleMatrix;\nuniform mat4 u_offsetRotateMatrix;\nuniform float u_lineWidth;\nuniform float u_pixelRatio;\n\nvoid main(void) {\n mat4 offsetMatrix = u_offsetScaleMatrix * u_offsetRotateMatrix;\n v_center = vec4(u_projectionMatrix * vec4(a_position, 0.0, 1.0)).xy;\n v_pixelRatio = u_pixelRatio;\n float lineWidth = u_lineWidth * u_pixelRatio;\n v_halfWidth = lineWidth / 2.0;\n if (lineWidth == 0.0) {\n lineWidth = 2.0 * u_pixelRatio;\n }\n vec2 offset;\n // Radius with anitaliasing (roughly).\n float radius = a_radius + 3.0 * u_pixelRatio;\n // Until we get gl_VertexID in WebGL, we store an instruction.\n if (a_instruction == 0.0) {\n // Offsetting the edges of the triangle by lineWidth / 2 is necessary, however\n // we should also leave some space for the antialiasing, thus we offset by lineWidth.\n offset = vec2(-1.0, 1.0);\n } else if (a_instruction == 1.0) {\n offset = vec2(-1.0, -1.0);\n } else if (a_instruction == 2.0) {\n offset = vec2(1.0, -1.0);\n } else {\n offset = vec2(1.0, 1.0);\n }\n\n gl_Position = u_projectionMatrix * vec4(a_position + offset * radius, 0.0, 1.0) +\n offsetMatrix * vec4(offset * lineWidth, 0.0, 0.0);\n v_offset = vec4(u_projectionMatrix * vec4(a_position.x + a_radius, a_position.y,\n 0.0, 1.0)).xy;\n\n if (distance(v_center, v_offset) > 20000.0) {\n gl_Position = vec4(v_center, 0.0, 1.0);\n }\n}\n\n\n"),Mc=function(t,e){this.u_projectionMatrix=t.getUniformLocation(e,"u_projectionMatrix"),this.u_offsetScaleMatrix=t.getUniformLocation(e,"u_offsetScaleMatrix"),this.u_offsetRotateMatrix=t.getUniformLocation(e,"u_offsetRotateMatrix"),this.u_lineWidth=t.getUniformLocation(e,"u_lineWidth"),this.u_pixelRatio=t.getUniformLocation(e,"u_pixelRatio"),this.u_opacity=t.getUniformLocation(e,"u_opacity"),this.u_fillColor=t.getUniformLocation(e,"u_fillColor"),this.u_strokeColor=t.getUniformLocation(e,"u_strokeColor"),this.u_size=t.getUniformLocation(e,"u_size"),this.a_position=t.getAttribLocation(e,"a_position"),this.a_instruction=t.getAttribLocation(e,"a_instruction"),this.a_radius=t.getAttribLocation(e,"a_radius")};function Oc(t,e){return t[0]=e[0],t[1]=e[1],t[4]=e[2],t[5]=e[3],t[12]=e[4],t[13]=e[5],t}var Nc=function(i){function t(t,e){i.call(this),this.tolerance=t,this.maxExtent=e,this.origin=ot(e),this.projectionMatrix_=[1,0,0,1,0,0],this.offsetRotateMatrix_=[1,0,0,1,0,0],this.offsetScaleMatrix_=[1,0,0,1,0,0],this.tmpMat4_=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],this.indices=[],this.indicesBuffer=null,this.startIndices=[],this.startIndicesFeature=[],this.vertices=[],this.verticesBuffer=null,this.lineStringReplay=void 0}return i&&(t.__proto__=i),((t.prototype=Object.create(i&&i.prototype)).constructor=t).prototype.getDeleteResourcesFunction=function(t){},t.prototype.finish=function(t){},t.prototype.setUpProgram=function(t,e,i,r){},t.prototype.shutDownProgram=function(t,e){},t.prototype.drawReplay=function(t,e,i,r){},t.prototype.drawHitDetectionReplayOneByOne=function(t,e,i,r,n){},t.prototype.drawHitDetectionReplay=function(t,e,i,r,n,o){return n?this.drawHitDetectionReplayOneByOne(t,e,i,r,o):this.drawHitDetectionReplayAll(t,e,i,r)},t.prototype.drawHitDetectionReplayAll=function(t,e,i,r){t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),this.drawReplay(t,e,i,!0);var n=r(null);return n||void 0},t.prototype.replay=function(t,e,i,r,n,o,s,a,h,l,u){var c,p,d,f,_,g,y,v,m=t.getGL();this.lineStringReplay&&(c=m.isEnabled(m.STENCIL_TEST),p=m.getParameter(m.STENCIL_FUNC),d=m.getParameter(m.STENCIL_VALUE_MASK),f=m.getParameter(m.STENCIL_REF),_=m.getParameter(m.STENCIL_WRITEMASK),g=m.getParameter(m.STENCIL_FAIL),y=m.getParameter(m.STENCIL_PASS_DEPTH_PASS),v=m.getParameter(m.STENCIL_PASS_DEPTH_FAIL),m.enable(m.STENCIL_TEST),m.clear(m.STENCIL_BUFFER_BIT),m.stencilMask(255),m.stencilFunc(m.ALWAYS,1,255),m.stencilOp(m.KEEP,m.KEEP,m.REPLACE),this.lineStringReplay.replay(t,e,i,r,n,o,s,a,h,l,u),m.stencilMask(0),m.stencilFunc(m.NOTEQUAL,1,255)),t.bindBuffer(ze,this.verticesBuffer),t.bindBuffer(34963,this.indicesBuffer);var x=this.setUpProgram(m,t,n,o),S=ge(this.projectionMatrix_);Ee(S,2/(i*n[0]),2/(i*n[1])),Se(S,-r),Ce(S,-(e[0]-this.origin[0]),-(e[1]-this.origin[1]));var E=ge(this.offsetScaleMatrix_);Ee(E,2/n[0],2/n[1]);var C,T=ge(this.offsetRotateMatrix_);return 0!==r&&Se(T,-r),m.uniformMatrix4fv(x.u_projectionMatrix,!1,Oc(this.tmpMat4_,S)),m.uniformMatrix4fv(x.u_offsetScaleMatrix,!1,Oc(this.tmpMat4_,E)),m.uniformMatrix4fv(x.u_offsetRotateMatrix,!1,Oc(this.tmpMat4_,T)),m.uniform1f(x.u_opacity,s),void 0===h?this.drawReplay(m,t,a,!1):C=this.drawHitDetectionReplay(m,t,a,h,l,u),this.shutDownProgram(m,x),this.lineStringReplay&&(c||m.disable(m.STENCIL_TEST),m.clear(m.STENCIL_BUFFER_BIT),m.stencilFunc(p,f,d),m.stencilMask(_),m.stencilOp(g,v,y)),C},t.prototype.drawElements=function(t,e,i,r){var n=e.hasOESElementIndexUint?5125:5123,o=r-i,s=i*(e.hasOESElementIndexUint?4:2);t.drawElements(4,o,n,s)},t}(Ml),Ac=[0,0,0,1],Gc=[],kc=[0,0,0,1],Dc=Number.EPSILON||2220446049250313e-31,jc=function(t,e,i,r,n,o){var s=(i-t)*(o-e)-(n-t)*(r-e);return s<=Dc&&-Dc<=s?void 0:0=l;){if(s=this.startIndices[c],void 0===i[Ct(u=this.startIndicesFeature[c]).toString()]&&u.getGeometry()&&(void 0===n||wt(n,u.getGeometry().getExtent()))){t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),this.drawElements(t,e,s,a);var p=r(u);if(p)return p}c--,a=s}},t.prototype.drawReplaySkipping_=function(t,e,i){var r,n,o,s,a,h,l;for(h=this.startIndices.length-2,o=n=this.startIndices[h+1],r=this.styleIndices_.length-1;0<=r;--r){for(s=this.styles_[r],this.setFillStyle_(t,s[0]),this.setStrokeStyle_(t,s[1],s[2]),a=this.styleIndices_[r];0<=h&&this.startIndices[h]>=a;)l=this.startIndices[h],i[Ct(this.startIndicesFeature[h]).toString()]&&(n!==o&&this.drawElements(t,e,n,o),o=l),h--,n=l;n!==o&&this.drawElements(t,e,n,o),n=o=a}},t.prototype.setFillStyle_=function(t,e){t.uniform4fv(this.defaultLocations_.u_fillColor,e)},t.prototype.setStrokeStyle_=function(t,e,i){t.uniform4fv(this.defaultLocations_.u_strokeColor,e),t.uniform1f(this.defaultLocations_.u_lineWidth,i)},t.prototype.setFillStrokeStyle=function(t,e){var i,r;if(e){var n=e.getLineDash();this.state_.lineDash=n||Gc;var o=e.getLineDashOffset();this.state_.lineDashOffset=o||0,i=(i=e.getColor())instanceof CanvasGradient||i instanceof CanvasPattern?kc:Ne(i).map(function(t,e){return 3!=e?t/255:t})||kc,r=void 0!==(r=e.getWidth())?r:1}else i=[0,0,0,0],r=0;var s=t?t.getColor():[0,0,0,0];s=s instanceof CanvasGradient||s instanceof CanvasPattern?Ac:Ne(s).map(function(t,e){return 3!=e?t/255:t})||Ac,this.state_.strokeColor&&fr(this.state_.strokeColor,i)&&this.state_.fillColor&&fr(this.state_.fillColor,s)&&this.state_.lineWidth===r||(this.state_.changed=!0,this.state_.fillColor=s,this.state_.strokeColor=i,this.state_.lineWidth=r,this.styles_.push([s,i,r]))},t}(Nc),Xc=new Lc("precision mediump float;\nvarying vec2 v_texCoord;\nvarying float v_opacity;\n\nuniform float u_opacity;\nuniform sampler2D u_image;\n\nvoid main(void) {\n vec4 texColor = texture2D(u_image, v_texCoord);\n gl_FragColor.rgb = texColor.rgb;\n float alpha = texColor.a * v_opacity * u_opacity;\n if (alpha == 0.0) {\n discard;\n }\n gl_FragColor.a = alpha;\n}\n"),zc=new bc("varying vec2 v_texCoord;\nvarying float v_opacity;\n\nattribute vec2 a_position;\nattribute vec2 a_texCoord;\nattribute vec2 a_offsets;\nattribute float a_opacity;\nattribute float a_rotateWithView;\n\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_offsetScaleMatrix;\nuniform mat4 u_offsetRotateMatrix;\n\nvoid main(void) {\n mat4 offsetMatrix = u_offsetScaleMatrix;\n if (a_rotateWithView == 1.0) {\n offsetMatrix = u_offsetScaleMatrix * u_offsetRotateMatrix;\n }\n vec4 offsets = offsetMatrix * vec4(a_offsets, 0.0, 0.0);\n gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0) + offsets;\n v_texCoord = a_texCoord;\n v_opacity = a_opacity;\n}\n\n\n"),Vc=function(t,e){this.u_projectionMatrix=t.getUniformLocation(e,"u_projectionMatrix"),this.u_offsetScaleMatrix=t.getUniformLocation(e,"u_offsetScaleMatrix"),this.u_offsetRotateMatrix=t.getUniformLocation(e,"u_offsetRotateMatrix"),this.u_opacity=t.getUniformLocation(e,"u_opacity"),this.u_image=t.getUniformLocation(e,"u_image"),this.a_position=t.getAttribLocation(e,"a_position"),this.a_texCoord=t.getAttribLocation(e,"a_texCoord"),this.a_offsets=t.getAttribLocation(e,"a_offsets"),this.a_opacity=t.getAttribLocation(e,"a_opacity"),this.a_rotateWithView=t.getAttribLocation(e,"a_rotateWithView")},Wc="webglcontextlost",Kc="webglcontextrestored",Hc=function(i){function t(t,e){i.call(this),this.canvas_=t,this.gl_=e,this.bufferCache_={},this.shaderCache_={},this.programCache_={},this.currentProgram_=null,this.hitDetectionFramebuffer_=null,this.hitDetectionTexture_=null,this.hitDetectionRenderbuffer_=null,this.hasOESElementIndexUint=lr(Xe,"OES_element_index_uint"),this.hasOESElementIndexUint&&e.getExtension("OES_element_index_uint"),C(this.canvas_,Wc,this.handleWebGLContextLost,this),C(this.canvas_,Kc,this.handleWebGLContextRestored,this)}return i&&(t.__proto__=i),((t.prototype=Object.create(i&&i.prototype)).constructor=t).prototype.bindBuffer=function(t,e){var i=this.getGL(),r=e.getArray(),n=String(Ct(e));if(n in this.bufferCache_){var o=this.bufferCache_[n];i.bindBuffer(t,o.buffer)}else{var s,a=i.createBuffer();i.bindBuffer(t,a),t==ze?s=new Float32Array(r):34963==t&&(s=this.hasOESElementIndexUint?new Uint32Array(r):new Uint16Array(r)),i.bufferData(t,s,e.getUsage()),this.bufferCache_[n]={buf:e,buffer:a}}},t.prototype.deleteBuffer=function(t){var e=this.getGL(),i=String(Ct(t)),r=this.bufferCache_[i];e.isContextLost()||e.deleteBuffer(r.buffer),delete this.bufferCache_[i]},t.prototype.disposeInternal=function(){f(this.canvas_);var t=this.getGL();if(!t.isContextLost()){for(var e in this.bufferCache_)t.deleteBuffer(this.bufferCache_[e].buffer);for(var i in this.programCache_)t.deleteProgram(this.programCache_[i]);for(var r in this.shaderCache_)t.deleteShader(this.shaderCache_[r]);t.deleteFramebuffer(this.hitDetectionFramebuffer_),t.deleteRenderbuffer(this.hitDetectionRenderbuffer_),t.deleteTexture(this.hitDetectionTexture_)}},t.prototype.getCanvas=function(){return this.canvas_},t.prototype.getGL=function(){return this.gl_},t.prototype.getHitDetectionFramebuffer=function(){return this.hitDetectionFramebuffer_||this.initHitDetectionFramebuffer_(),this.hitDetectionFramebuffer_},t.prototype.getShader=function(t){var e=String(Ct(t));if(e in this.shaderCache_)return this.shaderCache_[e];var i=this.getGL(),r=i.createShader(t.getType());return i.shaderSource(r,t.getSource()),i.compileShader(r),this.shaderCache_[e]=r},t.prototype.getProgram=function(t,e){var i=Ct(t)+"/"+Ct(e);if(i in this.programCache_)return this.programCache_[i];var r=this.getGL(),n=r.createProgram();return r.attachShader(n,this.getShader(t)),r.attachShader(n,this.getShader(e)),r.linkProgram(n),this.programCache_[i]=n},t.prototype.handleWebGLContextLost=function(){_(this.bufferCache_),_(this.shaderCache_),_(this.programCache_),this.currentProgram_=null,this.hitDetectionFramebuffer_=null,this.hitDetectionTexture_=null,this.hitDetectionRenderbuffer_=null},t.prototype.handleWebGLContextRestored=function(){},t.prototype.initHitDetectionFramebuffer_=function(){var t=this.gl_,e=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,e);var i=qc(t,1,1),r=t.createRenderbuffer();t.bindRenderbuffer(t.RENDERBUFFER,r),t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,1,1),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,r),t.bindTexture(t.TEXTURE_2D,null),t.bindRenderbuffer(t.RENDERBUFFER,null),t.bindFramebuffer(t.FRAMEBUFFER,null),this.hitDetectionFramebuffer_=e,this.hitDetectionTexture_=i,this.hitDetectionRenderbuffer_=r},t.prototype.useProgram=function(t){return t!=this.currentProgram_&&(this.getGL().useProgram(t),this.currentProgram_=t,!0)},t}(t);function Zc(t,e,i){var r=t.createTexture();return t.bindTexture(t.TEXTURE_2D,r),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),void 0!==e&&t.texParameteri(He,We,e),void 0!==i&&t.texParameteri(He,Ke,i),r}function qc(t,e,i,r,n){var o=Zc(t,r,n);return t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e,i,0,t.RGBA,t.UNSIGNED_BYTE,null),o}function Jc(t,e,i,r){var n=Zc(t,i,r);return t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e),n}var Qc=function(i){function t(t,e){i.call(this,t,e),this.anchorX=void 0,this.anchorY=void 0,this.groupIndices=[],this.hitDetectionGroupIndices=[],this.height=void 0,this.imageHeight=void 0,this.imageWidth=void 0,this.defaultLocations=null,this.opacity=void 0,this.originX=void 0,this.originY=void 0,this.rotateWithView=void 0,this.rotation=void 0,this.scale=void 0,this.width=void 0}return i&&(t.__proto__=i),((t.prototype=Object.create(i&&i.prototype)).constructor=t).prototype.getDeleteResourcesFunction=function(i){var r=this.verticesBuffer,n=this.indicesBuffer,o=this.getTextures(!0),s=i.getGL();return function(){var t,e;if(!s.isContextLost())for(t=0,e=o.length;t=s;){if(a=this.startIndices[u],void 0===i[Ct(l=this.startIndicesFeature[u]).toString()]&&l.getGeometry()&&(void 0===n||wt(n,l.getGeometry().getExtent()))){t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),this.drawElements(t,e,a,h);var p=r(l);if(p)return p}h=a,u--}},t.prototype.finish=function(t){this.anchorX=void 0,this.anchorY=void 0,this.height=void 0,this.imageHeight=void 0,this.imageWidth=void 0,this.indices=null,this.opacity=void 0,this.originX=void 0,this.originY=void 0,this.rotateWithView=void 0,this.rotation=void 0,this.scale=void 0,this.vertices=null,this.width=void 0},t.prototype.getTextures=function(t){},t.prototype.getHitDetectionTextures=function(){},t}(Nc),$c=function(n){function t(t,e){n.call(this,t,e),this.images_=[],this.hitDetectionImages_=[],this.textures_=[],this.hitDetectionTextures_=[]}return n&&(t.__proto__=n),((t.prototype=Object.create(n&&n.prototype)).constructor=t).prototype.drawMultiPoint=function(t,e){this.startIndices.push(this.indices.length),this.startIndicesFeature.push(e);var i=t.getFlatCoordinates(),r=t.getStride();this.drawCoordinates(i,0,i.length,r)},t.prototype.drawPoint=function(t,e){this.startIndices.push(this.indices.length),this.startIndicesFeature.push(e);var i=t.getFlatCoordinates(),r=t.getStride();this.drawCoordinates(i,0,i.length,r)},t.prototype.finish=function(t){var e=t.getGL();this.groupIndices.push(this.indices.length),this.hitDetectionGroupIndices.push(this.indices.length),this.verticesBuffer=new Yc(this.vertices);var i=this.indices;this.indicesBuffer=new Yc(i);var r={};this.createTextures(this.textures_,this.images_,r,e),this.createTextures(this.hitDetectionTextures_,this.hitDetectionImages_,r,e),this.images_=null,this.hitDetectionImages_=null,n.prototype.finish.call(this,t)},t.prototype.setImageStyle=function(t){var e=t.getAnchor(),i=t.getImage(1),r=t.getImageSize(),n=t.getHitDetectionImage(1),o=t.getOpacity(),s=t.getOrigin(),a=t.getRotateWithView(),h=t.getRotation(),l=t.getSize(),u=t.getScale();0===this.images_.length?this.images_.push(i):Ct(this.images_[this.images_.length-1])!=Ct(i)&&(this.groupIndices.push(this.indices.length),this.images_.push(i)),0===this.hitDetectionImages_.length?this.hitDetectionImages_.push(n):Ct(this.hitDetectionImages_[this.hitDetectionImages_.length-1])!=Ct(n)&&(this.hitDetectionGroupIndices.push(this.indices.length),this.hitDetectionImages_.push(n)),this.anchorX=e[0],this.anchorY=e[1],this.height=l[1],this.imageHeight=r[1],this.imageWidth=r[0],this.opacity=o,this.originX=s[0],this.originY=s[1],this.rotation=h,this.rotateWithView=a,this.scale=u,this.width=l[0]},t.prototype.getTextures=function(t){return t?this.textures_.concat(this.hitDetectionTextures_):this.textures_},t.prototype.getHitDetectionTextures=function(){return this.hitDetectionTextures_},t}(Qc);function tp(t,e,i,r){var n=i-r;return t[e]===t[n]&&t[e+1]===t[n+1]&&3<(i-e)/r&&!!xr(t,e,i,r)}var ep=new Lc("precision mediump float;\nvarying float v_round;\nvarying vec2 v_roundVertex;\nvarying float v_halfWidth;\n\n\n\nuniform float u_opacity;\nuniform vec4 u_color;\nuniform vec2 u_size;\nuniform float u_pixelRatio;\n\nvoid main(void) {\n if (v_round > 0.0) {\n vec2 windowCoords = vec2((v_roundVertex.x + 1.0) / 2.0 * u_size.x * u_pixelRatio,\n (v_roundVertex.y + 1.0) / 2.0 * u_size.y * u_pixelRatio);\n if (length(windowCoords - gl_FragCoord.xy) > v_halfWidth * u_pixelRatio) {\n discard;\n }\n }\n gl_FragColor = u_color;\n float alpha = u_color.a * u_opacity;\n if (alpha == 0.0) {\n discard;\n }\n gl_FragColor.a = alpha;\n}\n"),ip=new bc("varying float v_round;\nvarying vec2 v_roundVertex;\nvarying float v_halfWidth;\n\n\nattribute vec2 a_lastPos;\nattribute vec2 a_position;\nattribute vec2 a_nextPos;\nattribute float a_direction;\n\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_offsetScaleMatrix;\nuniform mat4 u_offsetRotateMatrix;\nuniform float u_lineWidth;\nuniform float u_miterLimit;\n\nbool nearlyEquals(in float value, in float ref) {\n float epsilon = 0.000000000001;\n return value >= ref - epsilon && value <= ref + epsilon;\n}\n\nvoid alongNormal(out vec2 offset, in vec2 nextP, in float turnDir, in float direction) {\n vec2 dirVect = nextP - a_position;\n vec2 normal = normalize(vec2(-turnDir * dirVect.y, turnDir * dirVect.x));\n offset = u_lineWidth / 2.0 * normal * direction;\n}\n\nvoid miterUp(out vec2 offset, out float round, in bool isRound, in float direction) {\n float halfWidth = u_lineWidth / 2.0;\n vec2 tangent = normalize(normalize(a_nextPos - a_position) + normalize(a_position - a_lastPos));\n vec2 normal = vec2(-tangent.y, tangent.x);\n vec2 dirVect = a_nextPos - a_position;\n vec2 tmpNormal = normalize(vec2(-dirVect.y, dirVect.x));\n float miterLength = abs(halfWidth / dot(normal, tmpNormal));\n offset = normal * direction * miterLength;\n round = 0.0;\n if (isRound) {\n round = 1.0;\n } else if (miterLength > u_miterLimit + u_lineWidth) {\n offset = halfWidth * tmpNormal * direction;\n }\n}\n\nbool miterDown(out vec2 offset, in vec4 projPos, in mat4 offsetMatrix, in float direction) {\n bool degenerate = false;\n vec2 tangent = normalize(normalize(a_nextPos - a_position) + normalize(a_position - a_lastPos));\n vec2 normal = vec2(-tangent.y, tangent.x);\n vec2 dirVect = a_lastPos - a_position;\n vec2 tmpNormal = normalize(vec2(-dirVect.y, dirVect.x));\n vec2 longOffset, shortOffset, longVertex;\n vec4 shortProjVertex;\n float halfWidth = u_lineWidth / 2.0;\n if (length(a_nextPos - a_position) > length(a_lastPos - a_position)) {\n longOffset = tmpNormal * direction * halfWidth;\n shortOffset = normalize(vec2(dirVect.y, -dirVect.x)) * direction * halfWidth;\n longVertex = a_nextPos;\n shortProjVertex = u_projectionMatrix * vec4(a_lastPos, 0.0, 1.0);\n } else {\n shortOffset = tmpNormal * direction * halfWidth;\n longOffset = normalize(vec2(dirVect.y, -dirVect.x)) * direction * halfWidth;\n longVertex = a_lastPos;\n shortProjVertex = u_projectionMatrix * vec4(a_nextPos, 0.0, 1.0);\n }\n //Intersection algorithm based on theory by Paul Bourke (http://paulbourke.net/geometry/pointlineplane/).\n vec4 p1 = u_projectionMatrix * vec4(longVertex, 0.0, 1.0) + offsetMatrix * vec4(longOffset, 0.0, 0.0);\n vec4 p2 = projPos + offsetMatrix * vec4(longOffset, 0.0, 0.0);\n vec4 p3 = shortProjVertex + offsetMatrix * vec4(-shortOffset, 0.0, 0.0);\n vec4 p4 = shortProjVertex + offsetMatrix * vec4(shortOffset, 0.0, 0.0);\n float denom = (p4.y - p3.y) * (p2.x - p1.x) - (p4.x - p3.x) * (p2.y - p1.y);\n float firstU = ((p4.x - p3.x) * (p1.y - p3.y) - (p4.y - p3.y) * (p1.x - p3.x)) / denom;\n float secondU = ((p2.x - p1.x) * (p1.y - p3.y) - (p2.y - p1.y) * (p1.x - p3.x)) / denom;\n float epsilon = 0.000000000001;\n if (firstU > epsilon && firstU < 1.0 - epsilon && secondU > epsilon && secondU < 1.0 - epsilon) {\n shortProjVertex.x = p1.x + firstU * (p2.x - p1.x);\n shortProjVertex.y = p1.y + firstU * (p2.y - p1.y);\n offset = shortProjVertex.xy;\n degenerate = true;\n } else {\n float miterLength = abs(halfWidth / dot(normal, tmpNormal));\n offset = normal * direction * miterLength;\n }\n return degenerate;\n}\n\nvoid squareCap(out vec2 offset, out float round, in bool isRound, in vec2 nextP,\n in float turnDir, in float direction) {\n round = 0.0;\n vec2 dirVect = a_position - nextP;\n vec2 firstNormal = normalize(dirVect);\n vec2 secondNormal = vec2(turnDir * firstNormal.y * direction, -turnDir * firstNormal.x * direction);\n vec2 hypotenuse = normalize(firstNormal - secondNormal);\n vec2 normal = vec2(turnDir * hypotenuse.y * direction, -turnDir * hypotenuse.x * direction);\n float length = sqrt(v_halfWidth * v_halfWidth * 2.0);\n offset = normal * length;\n if (isRound) {\n round = 1.0;\n }\n}\n\nvoid main(void) {\n bool degenerate = false;\n float direction = float(sign(a_direction));\n mat4 offsetMatrix = u_offsetScaleMatrix * u_offsetRotateMatrix;\n vec2 offset;\n vec4 projPos = u_projectionMatrix * vec4(a_position, 0.0, 1.0);\n bool round = nearlyEquals(mod(a_direction, 2.0), 0.0);\n\n v_round = 0.0;\n v_halfWidth = u_lineWidth / 2.0;\n v_roundVertex = projPos.xy;\n\n if (nearlyEquals(mod(a_direction, 3.0), 0.0) || nearlyEquals(mod(a_direction, 17.0), 0.0)) {\n alongNormal(offset, a_nextPos, 1.0, direction);\n } else if (nearlyEquals(mod(a_direction, 5.0), 0.0) || nearlyEquals(mod(a_direction, 13.0), 0.0)) {\n alongNormal(offset, a_lastPos, -1.0, direction);\n } else if (nearlyEquals(mod(a_direction, 23.0), 0.0)) {\n miterUp(offset, v_round, round, direction);\n } else if (nearlyEquals(mod(a_direction, 19.0), 0.0)) {\n degenerate = miterDown(offset, projPos, offsetMatrix, direction);\n } else if (nearlyEquals(mod(a_direction, 7.0), 0.0)) {\n squareCap(offset, v_round, round, a_nextPos, 1.0, direction);\n } else if (nearlyEquals(mod(a_direction, 11.0), 0.0)) {\n squareCap(offset, v_round, round, a_lastPos, -1.0, direction);\n }\n if (!degenerate) {\n vec4 offsets = offsetMatrix * vec4(offset, 0.0, 0.0);\n gl_Position = projPos + offsets;\n } else {\n gl_Position = vec4(offset, 0.0, 1.0);\n }\n}\n\n\n"),rp=function(t,e){this.u_projectionMatrix=t.getUniformLocation(e,"u_projectionMatrix"),this.u_offsetScaleMatrix=t.getUniformLocation(e,"u_offsetScaleMatrix"),this.u_offsetRotateMatrix=t.getUniformLocation(e,"u_offsetRotateMatrix"),this.u_lineWidth=t.getUniformLocation(e,"u_lineWidth"),this.u_miterLimit=t.getUniformLocation(e,"u_miterLimit"),this.u_opacity=t.getUniformLocation(e,"u_opacity"),this.u_color=t.getUniformLocation(e,"u_color"),this.u_size=t.getUniformLocation(e,"u_size"),this.u_pixelRatio=t.getUniformLocation(e,"u_pixelRatio"),this.a_lastPos=t.getAttribLocation(e,"a_lastPos"),this.a_position=t.getAttribLocation(e,"a_position"),this.a_nextPos=t.getAttribLocation(e,"a_nextPos"),this.a_direction=t.getAttribLocation(e,"a_direction")},np=3,op=5,sp=7,ap=11,hp=13,lp=17,up=19,cp=23,pp=function(i){function t(t,e){i.call(this,t,e),this.defaultLocations_=null,this.styles_=[],this.styleIndices_=[],this.state_={strokeColor:null,lineCap:void 0,lineDash:null,lineDashOffset:void 0,lineJoin:void 0,lineWidth:void 0,miterLimit:void 0,changed:!1}}return i&&(t.__proto__=i),((t.prototype=Object.create(i&&i.prototype)).constructor=t).prototype.drawCoordinates_=function(t,e,i,r){var n,o,s,a,h,l,u,c,p=this,d=this.vertices.length,f=this.indices.length,_="bevel"===this.state_.lineJoin?0:"miter"===this.state_.lineJoin?1:2,g="butt"===this.state_.lineCap?0:"square"===this.state_.lineCap?1:2,y=tp(t,e,i,r),v=f,m=1;for(n=e,o=i;ni&&(this.startIndices.push(i),this.startIndicesFeature.push(e),this.state_.changed&&(this.styleIndices_.push(i),this.state_.changed=!1))},t.prototype.drawPolygonCoordinates=function(t,e,i){var r,n;if(tp(t,0,t.length,i)||(t.push(t[0]),t.push(t[1])),this.drawCoordinates_(t,0,t.length,i),e.length)for(r=0,n=e.length;r=a;)l=this.startIndices[h],i[Ct(this.startIndicesFeature[h]).toString()]&&(n!==o&&(this.drawElements(t,e,n,o),t.clear(t.DEPTH_BUFFER_BIT)),o=l),h--,n=l;n!==o&&(this.drawElements(t,e,n,o),t.clear(t.DEPTH_BUFFER_BIT)),n=o=a}},t.prototype.drawHitDetectionReplayOneByOne=function(t,e,i,r,n){var o,s,a,h,l,u,c;for(c=this.startIndices.length-2,a=this.startIndices[c+1],o=this.styleIndices_.length-1;0<=o;--o)for(h=this.styles_[o],this.setStrokeStyle_(t,h[0],h[1],h[2]),l=this.styleIndices_[o];0<=c&&this.startIndices[c]>=l;){if(s=this.startIndices[c],void 0===i[Ct(u=this.startIndicesFeature[c]).toString()]&&u.getGeometry()&&(void 0===n||wt(n,u.getGeometry().getExtent()))){t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),this.drawElements(t,e,s,a);var p=r(u);if(p)return p}c--,a=s}},t.prototype.setStrokeStyle_=function(t,e,i,r){t.uniform4fv(this.defaultLocations_.u_color,e),t.uniform1f(this.defaultLocations_.u_lineWidth,i),t.uniform1f(this.defaultLocations_.u_miterLimit,r)},t.prototype.setFillStrokeStyle=function(t,e){var i=e.getLineCap();this.state_.lineCap=void 0!==i?i:"round";var r=e.getLineDash();this.state_.lineDash=r||Gc;var n=e.getLineDashOffset();this.state_.lineDashOffset=n||0;var o=e.getLineJoin();this.state_.lineJoin=void 0!==o?o:"round";var s=e.getColor();s=s instanceof CanvasGradient||s instanceof CanvasPattern?kc:Ne(s).map(function(t,e){return 3!=e?t/255:t})||kc;var a=e.getWidth();a=void 0!==a?a:1;var h=e.getMiterLimit();h=void 0!==h?h:10,this.state_.strokeColor&&fr(this.state_.strokeColor,s)&&this.state_.lineWidth===a&&this.state_.miterLimit===h||(this.state_.changed=!0,this.state_.strokeColor=s,this.state_.lineWidth=a,this.state_.miterLimit=h,this.styles_.push([s,a,h]))},t}(Nc),dp=new Lc("precision mediump float;\n\n\n\nuniform vec4 u_color;\nuniform float u_opacity;\n\nvoid main(void) {\n gl_FragColor = u_color;\n float alpha = u_color.a * u_opacity;\n if (alpha == 0.0) {\n discard;\n }\n gl_FragColor.a = alpha;\n}\n"),fp=new bc("\n\nattribute vec2 a_position;\n\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_offsetScaleMatrix;\nuniform mat4 u_offsetRotateMatrix;\n\nvoid main(void) {\n gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0);\n}\n\n\n"),_p=function(t,e){this.u_projectionMatrix=t.getUniformLocation(e,"u_projectionMatrix"),this.u_offsetScaleMatrix=t.getUniformLocation(e,"u_offsetScaleMatrix"),this.u_offsetRotateMatrix=t.getUniformLocation(e,"u_offsetRotateMatrix"),this.u_color=t.getUniformLocation(e,"u_color"),this.u_opacity=t.getUniformLocation(e,"u_opacity"),this.a_position=t.getAttribLocation(e,"a_position")},gp=function(t){this.first_,this.last_,this.head_,this.circular_=void 0===t||t,this.length_=0};gp.prototype.insertItem=function(t){var e={prev:void 0,next:void 0,data:t},i=this.head_;if(i){var r=i.next;e.prev=i,e.next=r,i.next=e,r&&(r.prev=e),i===this.last_&&(this.last_=e)}else this.first_=e,this.last_=e,this.circular_&&((e.next=e).prev=e);this.head_=e,this.length_++},gp.prototype.removeItem=function(){var t=this.head_;if(t){var e=t.next,i=t.prev;e&&(e.prev=i),i&&(i.next=e),this.head_=e||i,this.first_===this.last_?(this.head_=void 0,this.first_=void 0,this.last_=void 0):this.first_===t?this.first_=this.head_:this.last_===t&&(this.last_=i?this.head_.prev:this.head_),this.length_--}},gp.prototype.firstItem=function(){if(this.head_=this.first_,this.head_)return this.head_.data},gp.prototype.lastItem=function(){if(this.head_=this.last_,this.head_)return this.head_.data},gp.prototype.nextItem=function(){if(this.head_&&this.head_.next)return this.head_=this.head_.next,this.head_.data},gp.prototype.getNextItem=function(){if(this.head_&&this.head_.next)return this.head_.next.data},gp.prototype.prevItem=function(){if(this.head_&&this.head_.prev)return this.head_=this.head_.prev,this.head_.data},gp.prototype.getPrevItem=function(){if(this.head_&&this.head_.prev)return this.head_.prev.data},gp.prototype.getCurrItem=function(){if(this.head_)return this.head_.data},gp.prototype.setFirstItem=function(){this.circular_&&this.head_&&(this.first_=this.head_,this.last_=this.head_.prev)},gp.prototype.concat=function(t){if(t.head_){if(this.head_){var e=this.head_.next;this.head_.next=t.first_,t.first_.prev=this.head_,e.prev=t.last_,t.last_.next=e,this.length_+=t.length_}else this.head_=t.head_,this.first_=t.first_,this.last_=t.last_,this.length_=t.length_;t.head_=void 0,t.first_=void 0,t.last_=void 0,t.length_=0}},gp.prototype.getLength=function(){return this.length_};var yp=function(i){function t(t,e){i.call(this,t,e),this.lineStringReplay=new pp(t,e),this.defaultLocations_=null,this.styles_=[],this.styleIndices_=[],this.state_={fillColor:null,changed:!1}}return i&&(t.__proto__=i),((t.prototype=Object.create(i&&i.prototype)).constructor=t).prototype.drawCoordinates_=function(t,e,i){var r=new gp,n=new kh;this.processFlatCoordinates_(t,i,r,n,!0);var o=this.getMaxCoords_(r);if(e.length){var s,a,h=[];for(s=0,a=e.length;sr[0]&&(r=[i.p0.x,i.p0.y]),i!==e;);return r},t.prototype.classifyPoints_=function(t,e,i){var r=t.firstItem(),n=r,o=t.nextItem(),s=!1;do{var a=i?jc(o.p1.x,o.p1.y,n.p1.x,n.p1.y,n.p0.x,n.p0.y):jc(n.p0.x,n.p0.y,n.p1.x,n.p1.y,o.p1.x,o.p1.y);void 0===a?(this.removeItem_(n,o,t,e),s=!0,o===r&&(r=t.getNextItem()),o=n,t.prevItem()):n.p1.reflex!==a&&(n.p1.reflex=a,s=!0),n=o,o=t.nextItem()}while(n!==r);return s},t.prototype.bridgeHole_=function(t,e,i,r,n){for(var o=t.firstItem();o.p1.x!==e;)o=t.nextItem();var s,a,h,l,u=o.p1,c={x:r,y:u.y,i:-1},p=1/0,d=this.getIntersections_({p0:u,p1:c},n,!0);for(s=0,a=d.length;s(i.y-r.y)*(e.x-r.x),s=(n.x-r.x)*(e.y-r.y)<(n.y-r.y)*(e.x-r.x),a=(t.x-e.x)*(r.y-e.y)>(t.y-e.y)*(r.x-e.x),h=(i.x-e.x)*(r.y-e.y)<(i.y-e.y)*(r.x-e.x),l=r.reflex?s||o:s&&o,u=e.reflex?h||a:h&&a;return l&&u},t.prototype.drawMultiPolygon=function(t,e){var i,r,n,o,s=t.getEndss(),a=t.getStride(),h=this.indices.length,l=this.lineStringReplay.getCurrentIndex(),u=t.getFlatCoordinates(),c=0;for(i=0,r=s.length;ih&&(this.startIndices.push(h),this.startIndicesFeature.push(e),this.state_.changed&&(this.styleIndices_.push(h),this.state_.changed=!1)),this.lineStringReplay.getCurrentIndex()>l&&this.lineStringReplay.setPolygonStyle(e,l)},t.prototype.drawPolygon=function(t,e){var i=t.getEnds(),r=t.getStride();if(0=l;){if(s=this.startIndices[c],void 0===i[Ct(u=this.startIndicesFeature[c]).toString()]&&u.getGeometry()&&(void 0===n||wt(n,u.getGeometry().getExtent()))){t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT),this.drawElements(t,e,s,a);var p=r(u);if(p)return p}c--,a=s}},t.prototype.drawReplaySkipping_=function(t,e,i){var r,n,o,s,a,h,l;for(h=this.startIndices.length-2,o=n=this.startIndices[h+1],r=this.styleIndices_.length-1;0<=r;--r){for(s=this.styles_[r],this.setFillStyle_(t,s),a=this.styleIndices_[r];0<=h&&this.startIndices[h]>=a;)l=this.startIndices[h],i[Ct(this.startIndicesFeature[h]).toString()]&&(n!==o&&(this.drawElements(t,e,n,o),t.clear(t.DEPTH_BUFFER_BIT)),o=l),h--,n=l;n!==o&&(this.drawElements(t,e,n,o),t.clear(t.DEPTH_BUFFER_BIT)),n=o=a}},t.prototype.setFillStyle_=function(t,e){t.uniform4fv(this.defaultLocations_.u_color,e)},t.prototype.setFillStrokeStyle=function(t,e){var i=t?t.getColor():[0,0,0,0];if(i=i instanceof CanvasGradient||i instanceof CanvasPattern?Ac:Ne(i).map(function(t,e){return 3!=e?t/255:t})||Ac,this.state_.fillColor&&fr(i,this.state_.fillColor)||(this.state_.fillColor=i,this.state_.changed=!0,this.styles_.push(i)),e)this.lineStringReplay.setFillStrokeStyle(null,e);else{var r=new Vi({color:[0,0,0,0],lineWidth:0});this.lineStringReplay.setFillStrokeStyle(null,r)}},t}(Nc),vp=function(t,e){this.space_=e,this.emptyBlocks_=[{x:0,y:0,width:t,height:t}],this.entries_={},this.context_=De(t,t),this.canvas_=this.context_.canvas};vp.prototype.get=function(t){return this.entries_[t]||null},vp.prototype.add=function(t,e,i,r,n){for(var o=this,s=0,a=this.emptyBlocks_.length;s=e+o.space_&&h.height>=i+o.space_){var l={offsetX:h.x+o.space_,offsetY:h.y+o.space_,image:o.canvas_};return o.entries_[t]=l,r.call(n,o.context_,h.x+o.space_,h.y+o.space_),o.split_(s,h,e+o.space_,i+o.space_),l}}return null},vp.prototype.split_=function(t,e,i,r){var n,o,s=e.width-i;e.height-rthis.maxSize_||i+this.space_>this.maxSize_)return null;var s=this.add_(!1,t,e,i,r,o);if(!s)return null;var a=void 0!==n?n:L,h=this.add_(!0,t,e,i,a,o);return this.mergeInfos_(s,h)},mp.prototype.add_=function(t,e,i,r,n,o){var s,a,h,l,u=t?this.hitAtlases_:this.atlases_;for(h=0,l=u.length;ho[0]||s[1]<0||s[1]>o[1])){this.hitCanvasContext_||(this.hitCanvasContext_=De(1,1)),this.hitCanvasContext_.clearRect(0,0,1,1),this.hitCanvasContext_.drawImage(this.image_.getImage(),s[0],s[1],1,1,0,0,1,1);var a=this.hitCanvasContext_.getImageData(0,0,1,1).data;return 0>1,u=-7,c=i?n-1:0,p=i?-1:1,d=t[e+c];for(c+=p,o=d&(1<<-u)-1,d>>=-u,u+=a;0>=-u,u+=r;0>1,p=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,f=r?1:-1,_=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=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-s))<1&&(s--,h*=2),2<=(e+=1<=s+c?p/h:p*Math.pow(2,1-c))*h&&(s++,h/=2),u<=s+c?(a=0,s=u):1<=s+c?(a=(e*h-1)*Math.pow(2,n),s+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,n),s=0));8<=n;t[i+d]=255&a,d+=f,a/=256,n-=8);for(s=s<>>0):4294967296*(e>>>0)+(t>>>0)}function qg(t,e,i){var r=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.ceil(Math.log(e)/(7*Math.LN2));i.realloc(r);for(var n=i.pos-1;t<=n;n--)i.buf[n+r]=i.buf[n]}function Jg(t,e){for(var i=0;i>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function hy(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}Vg.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos>3,o=this.pos;this.type=7&r,t(n,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=sy(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=hy(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=sy(this.buf,this.pos)+sy(this.buf,this.pos+4)*Wg;return this.pos+=8,t},readSFixed64:function(){var t=sy(this.buf,this.pos)+hy(this.buf,this.pos+4)*Wg;return this.pos+=8,t},readFloat:function(){var t=Bg(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Bg(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,i,r=this.buf;return e=127&(i=r[this.pos++]),i<128?e:(e|=(127&(i=r[this.pos++]))<<7,i<128?e:(e|=(127&(i=r[this.pos++]))<<14,i<128?e:(e|=(127&(i=r[this.pos++]))<<21,i<128?e:function(t,e,i){var r,n,o=i.buf;if(n=o[i.pos++],r=(112&n)>>4,n<128)return Zg(t,r,e);if(n=o[i.pos++],r|=(127&n)<<3,n<128)return Zg(t,r,e);if(n=o[i.pos++],r|=(127&n)<<10,n<128)return Zg(t,r,e);if(n=o[i.pos++],r|=(127&n)<<17,n<128)return Zg(t,r,e);if(n=o[i.pos++],r|=(127&n)<<24,n<128)return Zg(t,r,e);if(n=o[i.pos++],r|=(1&n)<<31,n<128)return Zg(t,r,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(i=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=function(t,e,i){var r="",n=e;for(;n>>10&1023|55296),l=56320|1023&l),r+=String.fromCharCode(l),n+=u}return r}(this.buf,this.pos,t);return this.pos=t,e},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){var i=Hg(this);for(t=t||[];this.pos>>=7,o.buf[o.pos++]=127&n|128,n>>>=7,o.buf[o.pos++]=127&n|128,n>>>=7,o.buf[o.pos++]=127&n|128,n>>>=7,o.buf[o.pos]=127&n,function(t,e){var i=(7&t)<<4;if(e.buf[e.pos++]|=i|((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);var n,o}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(127>>=7)|(127>>=7)|(127>>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,i){for(var r,n,o=0;o>6|192:(r<65536?t[i++]=r>>12|224:(t[i++]=r>>18|240,t[i++]=r>>12&63|128),t[i++]=r>>6&63|128),t[i++]=63&r|128)}return i}(this.buf,t,this.pos);var i=this.pos-e;128<=i&&qg(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),Xg(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Xg(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 i=0;i>3}s--,1===o||2===o?(a+=t.readSVarint(),h+=t.readSVarint(),1===o&&u>3)?i.readString():2===t?i.readFloat():3===t?i.readDouble():4===t?i.readVarint64():5===t?i.readVarint():6===t?i.readSVarint():7===t?i.readBoolean():null;e.values.push(r)}}function fy(t,e,i){if(1==t)e.id=i.readVarint();else if(2==t)for(var r=i.readVarint()+i.pos;i.pos>1):n>>1}return e}(t),n=0,o=r.length;n>=5;return e=t+63,i+=String.fromCharCode(e)}var by=function(i){function t(t){i.call(this);var e=t||{};this.layerName_=e.layerName,this.layers_=e.layers?e.layers:null,this.dataProjection=ne(e.dataProjection?e.dataProjection:"EPSG:4326")}return i&&(t.__proto__=i),((t.prototype=Object.create(i&&i.prototype)).constructor=t).prototype.readFeaturesFromObject=function(t,e){if("Topology"==t.type){var i,r=t,n=null,o=null;r.transform&&(n=(i=r.transform).scale,o=i.translate);var s=r.arcs;i&&function(t,e,i){for(var r=0,n=t.length;rthis.sourceWorldWidth_/2){var e=[[t.source[0][0],t.source[0][1]],[t.source[1][0],t.source[1][1]],[t.source[2][0],t.source[2][1]]];e[0][0]-_>this.sourceWorldWidth_/2&&(e[0][0]-=this.sourceWorldWidth_),e[1][0]-_>this.sourceWorldWidth_/2&&(e[1][0]-=this.sourceWorldWidth_),e[2][0]-_>this.sourceWorldWidth_/2&&(e[2][0]-=this.sourceWorldWidth_);var i=Math.min(e[0][0],e[1][0],e[2][0]);Math.max(e[0][0],e[1][0],e[2][0])-ithis.errorThresholdSquared_}if(d){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){var v=[(e[0]+i[0])/2,(e[1]+i[1])/2],m=this.transformInv_(v),x=[(r[0]+t[0])/2,(r[1]+t[1])/2],S=this.transformInv_(x);this.addQuad_(t,e,v,x,n,o,m,S,h-1),this.addQuad_(x,v,i,r,S,m,s,a,h-1)}else{var E=[(t[0]+e[0])/2,(t[1]+e[1])/2],C=this.transformInv_(E),T=[(i[0]+r[0])/2,(i[1]+r[1])/2],w=this.transformInv_(T);this.addQuad_(t,E,T,r,n,C,w,a,h-1),this.addQuad_(E,e,i,T,C,o,s,w,h-1)}return}}if(p){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}this.addTriangle_(t,i,r,n,s,a),this.addTriangle_(t,e,i,n,o,s)}},Cx.prototype.calculateSourceExtent=function(){var n=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach(function(t,e,i){var r=t.source;q(n,r[0]),q(n,r[1]),q(n,r[2])}),n},Cx.prototype.getTriangles=function(){return this.triangles_};var Tx=function(T){function t(t,e,i,r,n,o,s,a,h,l,u){T.call(this,n,An),this.renderEdges_=void 0!==u&&u,this.pixelRatio_=s,this.gutter_=a,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=r,this.wrappedTileCoord_=o||n,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;var c=r.getTileCoordExtent(this.wrappedTileCoord_),p=this.targetTileGrid_.getExtent(),d=this.sourceTileGrid_.getExtent(),f=p?ht(c,p):c;if(0!==it(f)){var _=t.getExtent();_&&(d=d?ht(d,_):_);var g=r.getResolution(this.wrappedTileCoord_[0]),y=xx(t,i,ot(f),g);if(!isFinite(y)||y<=0)this.state=jn;else{var v=void 0!==l?l:.5;if(this.triangulation_=new Cx(t,i,f,d,y*v),0!==this.triangulation_.getTriangles().length){this.sourceZ_=e.getZForResolution(y);var m=this.triangulation_.calculateSourceExtent();if(d&&(t.canWrapX()?(m[1]=gt(m[1],d[1],d[3]),m[3]=gt(m[3],d[1],d[3])):m=ht(m,d)),it(m)){for(var x=e.getTileRangeForExtentAndZ(m,this.sourceZ_),S=x.minX;S<=x.maxX;S++)for(var E=x.minY;E<=x.maxY;E++){var C=h(this.sourceZ_,S,E,s);C&&this.sourceTiles_.push(C)}0===this.sourceTiles_.length&&(this.state=jn)}else this.state=jn}else this.state=jn}}else this.state=jn}return T&&(t.__proto__=T),((t.prototype=Object.create(T&&T.prototype)).constructor=t).prototype.disposeInternal=function(){this.state==Gn&&this.unlistenSources_(),T.prototype.disposeInternal.call(this)},t.prototype.getImage=function(){return this.canvas_},t.prototype.reproject_=function(){var r=[];if(this.sourceTiles_.forEach(function(t,e,i){t&&t.getState()==kn&&r.push({extent:this.sourceTileGrid_.getTileCoordExtent(t.tileCoord),image:t.getImage()})}.bind(this)),(this.sourceTiles_.length=0)===r.length)this.state=Dn;else{var t=this.wrappedTileCoord_[0],e=this.targetTileGrid_.getTileSize(t),i="number"==typeof e?e:e[0],n="number"==typeof e?e:e[1],o=this.targetTileGrid_.getResolution(t),s=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Ex(i,n,this.pixelRatio_,s,this.sourceTileGrid_.getExtent(),o,a,this.triangulation_,r,this.gutter_,this.renderEdges_),this.state=kn}this.changed()},t.prototype.load=function(){if(this.state==An){this.state=Gn,this.changed();var o=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(function(i,t,e){var r=i.getState();if(r==An||r==Gn){o++;var n=C(i,w.CHANGE,function(t){var e=i.getState();e!=kn&&e!=Dn&&e!=jn||(g(n),0===--o&&(this.unlistenSources_(),this.reproject_()))},this);this.sourcesListenerKeys_.push(n)}}.bind(this)),this.sourceTiles_.forEach(function(t,e,i){t.getState()==An&&t.load()}),0===o&&setTimeout(this.reproject_.bind(this),0)}},t.prototype.unlistenSources_=function(){this.sourcesListenerKeys_.forEach(g),this.sourcesListenerKeys_=null},t}(Vn),wx=[0,0,0],Rx=function(t){var r,n,o,e;if(this.minZoom=void 0!==t.minZoom?t.minZoom:0,this.resolutions_=t.resolutions,Z((r=this.resolutions_,n=!0,o=function(t,e){return e-t}||hr,r.every(function(t,e){if(0===e)return!0;var i=o(r[e-1],t);return!(0=this.minZoom;){if(o=2===this.zoomFactor_?Kl(s=Math.floor(s/2),s,a=Math.floor(a/2),a,r):this.getTileRangeForExtentAndZ(h,l,r),e.call(i,l,o))return!0;--l}return!1},Rx.prototype.getExtent=function(){return this.extent_},Rx.prototype.getMaxZoom=function(){return this.maxZoom},Rx.prototype.getMinZoom=function(){return this.minZoom},Rx.prototype.getOrigin=function(t){return this.origin_?this.origin_:this.origins_[t]},Rx.prototype.getResolution=function(t){return this.resolutions_[t]},Rx.prototype.getResolutions=function(){return this.resolutions_},Rx.prototype.getTileCoordChildTileRange=function(t,e,i){if(t[0]i||i>e.getMaxZoom())return!1;var o,s=e.getExtent();return!(o=s?e.getTileRangeForExtentAndZ(s,i):e.getFullTileRange(i))||o.containsXY(r,n)}(t,r)?t:null},t.prototype.refresh=function(){this.tileCache.clear(),this.changed()},t}(_h);Ox.prototype.useTile=L;var Nx=function(i){function t(t,e){i.call(this,t),this.tile=e}return i&&(t.__proto__=i),(t.prototype=Object.create(i&&i.prototype)).constructor=t}(m),Ax="tileloadstart",Gx="tileloadend",kx="tileloaderror",Dx=function(e){function t(t){e.call(this,{attributions:t.attributions,cacheSize:t.cacheSize,extent:t.extent,opaque:t.opaque,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition}),this.tileLoadFunction=t.tileLoadFunction,this.tileUrlFunction=this.fixedTileUrlFunction?this.fixedTileUrlFunction.bind(this):gx,this.urls=null,t.urls?this.setUrls(t.urls):t.url&&this.setUrl(t.url),t.tileUrlFunction&&this.setTileUrlFunction(t.tileUrlFunction),this.tileLoadingKeys_={}}return e&&(t.__proto__=e),((t.prototype=Object.create(e&&e.prototype)).constructor=t).prototype.getTileLoadFunction=function(){return this.tileLoadFunction},t.prototype.getTileUrlFunction=function(){return this.tileUrlFunction},t.prototype.getUrls=function(){return this.urls},t.prototype.handleTileChange=function(t){var e,i=t.target,r=Ct(i),n=i.getState();n==Gn?(this.tileLoadingKeys_[r]=!0,e=Ax):r in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[r],e=n==Dn?kx:n==kn||n==Un?Gx:void 0),null!=e&&this.dispatchEvent(new Nx(e,i))},t.prototype.setTileLoadFunction=function(t){this.tileCache.clear(),this.tileLoadFunction=t,this.changed()},t.prototype.setTileUrlFunction=function(t,e){this.tileUrlFunction=t,this.tileCache.pruneExceptNewestZ(),void 0!==e?this.setKey(e):this.changed()},t.prototype.setUrl=function(t){var e=this.urls=yx(t);this.setTileUrlFunction(this.fixedTileUrlFunction?this.fixedTileUrlFunction.bind(this):fx(e,this.tileGrid),t)},t.prototype.setUrls=function(t){var e=(this.urls=t).join("\n");this.setTileUrlFunction(this.fixedTileUrlFunction?this.fixedTileUrlFunction.bind(this):fx(t,this.tileGrid),e)},t.prototype.useTile=function(t,e,i){var r=ux(t,e,i);this.tileCache.containsKey(r)&&this.tileCache.get(r)},t}(Ox);Dx.prototype.fixedTileUrlFunction;var jx=function(e){function t(t){e.call(this,{attributions:t.attributions,cacheSize:t.cacheSize,extent:t.extent,opaque:t.opaque,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:Ux,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition}),this.crossOrigin=void 0!==t.crossOrigin?t.crossOrigin:null,this.tileClass=void 0!==t.tileClass?t.tileClass:Wn,this.tileCacheForProjection={},this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}return e&&(t.__proto__=e),((t.prototype=Object.create(e&&e.prototype)).constructor=t).prototype.canExpireCache=function(){if(this.tileCache.canExpireCache())return!0;for(var t in this.tileCacheForProjection)if(this.tileCacheForProjection[t].canExpireCache())return!0;return!1},t.prototype.expireCache=function(t,e){var i=this.getTileCacheForProjection(t);for(var r in this.tileCache.expireCache(this.tileCache==i?e:{}),this.tileCacheForProjection){var n=this.tileCacheForProjection[r];n.expireCache(n==i?e:{})}},t.prototype.getGutterForProjection=function(t){return this.getProjection()&&t&&!ue(this.getProjection(),t)?0:this.getGutter()},t.prototype.getGutter=function(){return 0},t.prototype.getOpaque=function(t){return!(this.getProjection()&&t&&!ue(this.getProjection(),t))&&e.prototype.getOpaque.call(this,t)},t.prototype.getTileGridForProjection=function(t){var e=this.getProjection();if(!this.tileGrid||e&&!ue(e,t)){var i=Ct(t).toString();return i in this.tileGridForProjection||(this.tileGridForProjection[i]=Ix(t)),this.tileGridForProjection[i]}return this.tileGrid},t.prototype.getTileCacheForProjection=function(t){var e=this.getProjection();if(!e||ue(e,t))return this.tileCache;var i=Ct(t).toString();return i in this.tileCacheForProjection||(this.tileCacheForProjection[i]=new mx(this.tileCache.highWaterMark)),this.tileCacheForProjection[i]},t.prototype.createTile_=function(t,e,i,r,n,o){var s=[t,e,i],a=this.getTileCoordForTileUrlFunction(s,n),h=a?this.tileUrlFunction(a,r,n):void 0,l=new this.tileClass(s,void 0!==h?An:jn,void 0!==h?h:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return l.key=o,C(l,w.CHANGE,this.handleTileChange,this),l},t.prototype.getTile=function(t,e,i,r,n){var o=this.getProjection();if(o&&n&&!ue(o,n)){var s,a=this.getTileCacheForProjection(n),h=[t,e,i],l=cx(h);a.containsKey(l)&&(s=a.get(l));var u=this.getKey();if(s&&s.key==u)return s;var c=this.getTileGridForProjection(o),p=this.getTileGridForProjection(n),d=this.getTileCoordForTileUrlFunction(h,n),f=new Tx(o,c,n,p,h,d,this.getTilePixelRatio(r),this.getGutter(),function(t,e,i,r){return this.getTileInternal(t,e,i,r,o)}.bind(this),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_);return f.key=u,s?(f.interimTile=s,f.refreshInterimChain(),a.replace(l,f)):a.set(l,f),f}return this.getTileInternal(t,e,i,r,o||n)},t.prototype.getTileInternal=function(t,e,i,r,n){var o=null,s=ux(t,e,i),a=this.getKey();if(this.tileCache.containsKey(s)){if((o=this.tileCache.get(s)).key!=a){var h=o;o=this.createTile_(t,e,i,r,n,a),h.getState()==An?o.interimTile=h.interimTile:o.interimTile=h,o.refreshInterimChain(),this.tileCache.replace(s,o)}}else o=this.createTile_(t,e,i,r,n,a),this.tileCache.set(s,o);return o},t.prototype.setRenderReprojectionEdges=function(t){if(this.renderReprojectionEdges_!=t){for(var e in this.renderReprojectionEdges_=t,this.tileCacheForProjection)this.tileCacheForProjection[e].clear();this.changed()}},t.prototype.setTileGridForProjection=function(t,e){var i=ne(t);if(i){var r=Ct(i).toString();r in this.tileGridForProjection||(this.tileGridForProjection[r]=e)}},t}(Dx);function Ux(t,e){t.getImage().src=e}var Yx=function(i){function t(t){var e=void 0!==t.hidpi&&t.hidpi;i.call(this,{cacheSize:t.cacheSize,crossOrigin:"anonymous",opaque:!0,projection:ne("EPSG:3857"),reprojectionErrorThreshold:t.reprojectionErrorThreshold,state:vs,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:e?2:1,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition}),this.hidpi_=e,this.culture_=void 0!==t.culture?t.culture:"en-us",this.maxZoom_=void 0!==t.maxZoom?t.maxZoom:-1,this.apiKey_=t.key,this.imagerySet_=t.imagerySet,vx("https://dev.virtualearth.net/REST/v1/Imagery/Metadata/"+this.imagerySet_+"?uriScheme=https&include=ImageryProviders&key="+this.apiKey_+"&c="+this.culture_,this.handleImageryMetadataResponse.bind(this),void 0,"jsonp")}return i&&(t.__proto__=i),((t.prototype=Object.create(i&&i.prototype)).constructor=t).prototype.getApiKey=function(){return this.apiKey_},t.prototype.getImagerySet=function(){return this.imagerySet_},t.prototype.handleImageryMetadataResponse=function(t){if(200==t.statusCode&&"OK"==t.statusDescription&&"ValidCredentials"==t.authenticationResultCode&&1==t.resourceSets.length&&1==t.resourceSets[0].resources.length){var e=t.resourceSets[0].resources[0],i=-1==this.maxZoom_?e.zoomMax:this.maxZoom_,r=Mx(this.getProjection()),n=e.imageWidth==e.imageHeight?e.imageWidth:[e.imageWidth,e.imageHeight],o=bx({extent:r,minZoom:e.zoomMin,maxZoom:i,tileSize:n/(this.hidpi_?2:1)});this.tileGrid=o;var s=this.culture_,a=this.hidpi_;if(this.tileUrlFunction=_x(e.imageUrlSubdomains.map(function(t){var n=[0,0,0],o=e.imageUrl.replace("{subdomain}",t).replace("{culture}",s);return function(t,e,i){if(t){lx(t[0],t[1],-t[2]-1,n);var r=o;return a&&(r+="&dpi=d1&device=mobile"),r.replace("{quadkey}",function(t){var e,i,r=t[0],n=new Array(r),o=1<>=1;return n.join("")}(n))}}})),e.imageryProviders){var u=ce(ne("EPSG:4326"),this.getProjection());this.setAttributions(function(a){var h=[],l=a.viewState.zoom;return e.imageryProviders.map(function(t){for(var e=!1,i=t.coverageAreas,r=0,n=i.length;r=o.zoomMin&&l<=o.zoomMax){var s=o.bbox;if(wt(ft([s[1],s[0],s[3],s[2]],u),a.extent)){e=!0;break}}}e&&h.push(t.attribution)}),h.push('Terms of Use'),h})}this.setState(ms)}else this.setState(xs)},t}(jx),Bx=function(n){function t(t){var e=t||{},i=void 0!==e.projection?e.projection:"EPSG:3857",r=void 0!==e.tileGrid?e.tileGrid:bx({extent:Mx(i),maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize});n.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,opaque:e.opaque,projection:i,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileGrid:r,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition})}return n&&(t.__proto__=n),(t.prototype=Object.create(n&&n.prototype)).constructor=t}(jx),Xx=function(e){function t(t){e.call(this,{attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,maxZoom:void 0!==t.maxZoom?t.maxZoom:18,minZoom:t.minZoom,projection:t.projection,state:vs,wrapX:t.wrapX}),this.account_=t.account,this.mapId_=t.map||"",this.config_=t.config||{},this.templateCache_={},this.initializeMap_()}return e&&(t.__proto__=e),((t.prototype=Object.create(e&&e.prototype)).constructor=t).prototype.getConfig=function(){return this.config_},t.prototype.updateConfig=function(t){E(this.config_,t),this.initializeMap_()},t.prototype.setConfig=function(t){this.config_=t||{},this.initializeMap_()},t.prototype.initializeMap_=function(){var t=JSON.stringify(this.config_);if(this.templateCache_[t])this.applyTemplate_(this.templateCache_[t]);else{var e="https://"+this.account_+".carto.com/api/v1/map";this.mapId_&&(e+="/named/"+this.mapId_);var i=new XMLHttpRequest;i.addEventListener("load",this.handleInitResponse_.bind(this,t)),i.addEventListener("error",this.handleInitError_.bind(this)),i.open("POST",e),i.setRequestHeader("Content-type","application/json"),i.send(JSON.stringify(this.config_))}},t.prototype.handleInitResponse_=function(t,e){var i=e.target;if(!i.status||200<=i.status&&i.status<300){var r;try{r=JSON.parse(i.responseText)}catch(t){return void this.setState(xs)}this.applyTemplate_(r),this.templateCache_[t]=r,this.setState(ms)}else this.setState(xs)},t.prototype.handleInitError_=function(t){this.setState(xs)},t.prototype.applyTemplate_=function(t){var e="https://"+t.cdn_url.https+"/"+this.account_+"/api/v1/map/"+t.layergroupid+"/{z}/{x}/{y}.png";this.setUrl(e)},t}(Bx),zx=function(e){function t(t){e.call(this,{attributions:t.attributions,extent:t.extent,projection:t.projection,wrapX:t.wrapX}),this.resolution=void 0,this.distance=void 0!==t.distance?t.distance:20,this.features=[],this.geometryFunction=t.geometryFunction||function(t){var e=t.getGeometry();return Z(e instanceof Dr,10),e},this.source=t.source,C(this.source,w.CHANGE,this.refresh,this)}return e&&(t.__proto__=e),((t.prototype=Object.create(e&&e.prototype)).constructor=t).prototype.getDistance=function(){return this.distance},t.prototype.getSource=function(){return this.source},t.prototype.loadFeatures=function(t,e,i){this.source.loadFeatures(t,e,i),e!==this.resolution&&(this.clear(),this.resolution=e,this.cluster(),this.addFeatures(this.features))},t.prototype.setDistance=function(t){this.distance=t,this.refresh()},t.prototype.refresh=function(){this.clear(),this.cluster(),this.addFeatures(this.features),e.prototype.refresh.call(this)},t.prototype.cluster=function(){if(void 0!==this.resolution)for(var t=[1/(this.features.length=0),1/0,-1/0,-1/0],e=this.distance*this.resolution,i=this.source.getFeatures(),r={},n=0,o=i.length;nOpenStreetMap contributors.',cS=function(o){function t(t){var e,i=t||{};e=void 0!==i.attributions?i.attributions:[uS];var r=void 0!==i.crossOrigin?i.crossOrigin:"anonymous",n=void 0!==i.url?i.url:"https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png";o.call(this,{attributions:e,cacheSize:i.cacheSize,crossOrigin:r,opaque:void 0===i.opaque||i.opaque,maxZoom:void 0!==i.maxZoom?i.maxZoom:19,reprojectionErrorThreshold:i.reprojectionErrorThreshold,tileLoadFunction:i.tileLoadFunction,url:n,wrapX:i.wrapX})}return o&&(t.__proto__=o),(t.prototype=Object.create(o&&o.prototype)).constructor=t}(Bx),pS=!0;try{new ImageData(10,10)}catch(t){pS=!1}var dS=document.createElement("canvas").getContext("2d");var fS={newImageData:function(t,e,i){if(pS)return new ImageData(t,e,i);var r=dS.createImageData(e,i);return r.data.set(t),r}}.newImageData;function _S(x){var S=!0;try{new ImageData(10,10)}catch(t){S=!1}return function(t){var e,i,r,n,o,s=t.buffers,a=t.meta,h=t.imageOps,l=t.width,u=t.height,c=s.length,p=s[0].byteLength;if(h){var d=new Array(c);for(i=0;ithis._maxQueueLength;)this._queue.shift().callback(null,null)},yS.prototype._dispatch=function(){if(0===this._running&&0Stamen Design, under CC BY 3.0.',uS],bS={terrain:{extension:"jpg",opaque:!0},"terrain-background":{extension:"jpg",opaque:!0},"terrain-labels":{extension:"png",opaque:!1},"terrain-lines":{extension:"png",opaque:!1},"toner-background":{extension:"png",opaque:!0},toner:{extension:"png",opaque:!0},"toner-hybrid":{extension:"png",opaque:!1},"toner-labels":{extension:"png",opaque:!1},"toner-lines":{extension:"png",opaque:!1},"toner-lite":{extension:"png",opaque:!0},watercolor:{extension:"jpg",opaque:!0}},FS={terrain:{minZoom:4,maxZoom:18},toner:{minZoom:0,maxZoom:20},watercolor:{minZoom:1,maxZoom:16}},PS=function(s){function t(t){var e=t.layer.indexOf("-"),i=-1==e?t.layer:t.layer.slice(0,e),r=FS[i],n=bS[t.layer],o=void 0!==t.url?t.url:"https://stamen-tiles-{a-d}.a.ssl.fastly.net/"+t.layer+"/{z}/{x}/{y}."+n.extension;s.call(this,{attributions:LS,cacheSize:t.cacheSize,crossOrigin:"anonymous",maxZoom:null!=t.maxZoom?t.maxZoom:r.maxZoom,minZoom:null!=t.minZoom?t.minZoom:r.minZoom,opaque:n.opaque,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileLoadFunction:t.tileLoadFunction,url:o,wrapX:t.wrapX})}return s&&(t.__proto__=s),(t.prototype=Object.create(s&&s.prototype)).constructor=t}(Bx),MS=function(i){function t(t){var e=t||{};i.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,projection:e.projection,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction,url:e.url,urls:e.urls,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition}),this.params_=e.params||{},this.tmpExtent_=[1/0,1/0,-1/0,-1/0],this.setKey(this.getKeyForParams_())}return i&&(t.__proto__=i),((t.prototype=Object.create(i&&i.prototype)).constructor=t).prototype.getKeyForParams_=function(){var t=0,e=[];for(var i in this.params_)e[t++]=i+"-"+this.params_[i];return e.join("/")},t.prototype.getParams=function(){return this.params_},t.prototype.getRequestUrl_=function(t,e,i,r,n,o){var s=this.urls;if(s){var a,h=n.getCode().split(":").pop();if(o.SIZE=e[0]+","+e[1],o.BBOX=i.join(","),o.BBOXSR=h,o.IMAGESR=h,o.DPI=Math.round(o.DPI?o.DPI*r:90*r),1==s.length)a=s[0];else a=s[Et(px(t),s.length)];return Qx(a.replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage"),o)}},t.prototype.getTilePixelRatio=function(t){return t},t.prototype.fixedTileUrlFunction=function(t,e,i){var r=this.getTileGrid();if(r||(r=this.getTileGridForProjection(i)),!(r.getResolutions().length<=t[0])){var n=r.getTileCoordExtent(t,this.tmpExtent_),o=ws(r.getTileSize(t[0]),this.tmpSize);1!=e&&(o=Ts(o,e,this.tmpSize));var s={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};return E(s,this.params_),this.getRequestUrl_(t,o,n,e,i,s)}},t.prototype.updateParams=function(t){E(this.params_,t),this.setKey(this.getKeyForParams_())},t}(jx),OS=function(r){function t(t,e,i){r.call(this,t,kn),this.tileSize_=e,this.text_=i,this.canvas_=null}return r&&(t.__proto__=r),((t.prototype=Object.create(r&&r.prototype)).constructor=t).prototype.getImage=function(){if(this.canvas_)return this.canvas_;var t=this.tileSize_,e=De(t[0],t[1]);return e.strokeStyle="black",e.strokeRect(.5,.5,t[0]+.5,t[1]+.5),e.fillStyle="black",e.textAlign="center",e.textBaseline="middle",e.font="24px sans-serif",e.fillText(this.text_,t[0]/2,t[1]/2),this.canvas_=e.canvas,e.canvas},t.prototype.load=function(){},t}(Vn),NS=function(e){function t(t){e.call(this,{opaque:!1,projection:t.projection,tileGrid:t.tileGrid,wrapX:void 0===t.wrapX||t.wrapX})}return e&&(t.__proto__=e),((t.prototype=Object.create(e&&e.prototype)).constructor=t).prototype.getTile=function(t,e,i){var r=ux(t,e,i);if(this.tileCache.containsKey(r))return this.tileCache.get(r);var n=ws(this.tileGrid.getTileSize(t)),o=[t,e,i],s=this.getTileCoordForTileUrlFunction(o),a=s?this.getTileCoordForTileUrlFunction(s).toString():"",h=new OS(o,n,a);return this.tileCache.set(r,h),h},t}(Ox),AS=function(i){function t(t){if(i.call(this,{attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,projection:ne("EPSG:3857"),reprojectionErrorThreshold:t.reprojectionErrorThreshold,state:vs,tileLoadFunction:t.tileLoadFunction,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition}),this.tileJSON_=null,t.url)if(t.jsonp)vx(t.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{var e=new XMLHttpRequest;e.addEventListener("load",this.onXHRLoad_.bind(this)),e.addEventListener("error",this.onXHRError_.bind(this)),e.open("GET",t.url),e.send()}else t.tileJSON?this.handleTileJSONResponse(t.tileJSON):Z(!1,51)}return i&&(t.__proto__=i),((t.prototype=Object.create(i&&i.prototype)).constructor=t).prototype.onXHRLoad_=function(t){var e=t.target;if(!e.status||200<=e.status&&e.status<300){var i;try{i=JSON.parse(e.responseText)}catch(t){return void this.handleTileJSONError()}this.handleTileJSONResponse(i)}else this.handleTileJSONError()},t.prototype.onXHRError_=function(t){this.handleTileJSONError()},t.prototype.getTileJSON=function(){return this.tileJSON_},t.prototype.handleTileJSONResponse=function(e){var t,i=ne("EPSG:4326"),r=this.getProjection();if(void 0!==e.bounds){var n=ce(i,r);t=ft(e.bounds,n)}var o=e.minzoom||0,s=e.maxzoom||22,a=bx({extent:Mx(r),maxZoom:s,minZoom:o});if(this.tileGrid=a,this.tileUrlFunction=fx(e.tiles,a),void 0!==e.attribution&&!this.getAttributions()){var h=void 0!==t?t:i.getExtent();this.setAttributions(function(t){return wt(h,t.extent)?[e.attribution]:null})}this.tileJSON_=e,this.setState(ms)},t.prototype.handleTileJSONError=function(){this.setState(xs)},t}(jx),GS=function(n){function t(t){var e=t||{},i=e.params||{},r=!("TRANSPARENT"in i)||i.TRANSPARENT;n.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,opaque:!r,projection:e.projection,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileClass:e.tileClass,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction,url:e.url,urls:e.urls,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition}),this.gutter_=void 0!==e.gutter?e.gutter:0,this.params_=i,this.v13_=!0,this.serverType_=e.serverType,this.hidpi_=void 0===e.hidpi||e.hidpi,this.tmpExtent_=[1/0,1/0,-1/0,-1/0],this.updateV13_(),this.setKey(this.getKeyForParams_())}return n&&(t.__proto__=n),((t.prototype=Object.create(n&&n.prototype)).constructor=t).prototype.getGetFeatureInfoUrl=function(t,e,i,r){var n=ne(i),o=this.getProjection(),s=this.getTileGrid();s||(s=this.getTileGridForProjection(n));var a=s.getTileCoordForCoordAndResolution(t,e);if(!(s.getResolutions().length<=a[0])){var h=s.getResolution(a[0]),l=s.getTileCoordExtent(a,this.tmpExtent_),u=ws(s.getTileSize(a[0]),this.tmpSize),c=this.gutter_;0!==c&&(u=Cs(u,c,this.tmpSize),l=G(l,h*c,l)),o&&o!==n&&(h=xx(o,n,t,h),l=fe(l,n,o),t=de(t,n,o));var p={SERVICE:"WMS",VERSION:rS,REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.params_.LAYERS};E(p,this.params_,r);var d=Math.floor((t[0]-l[0])/h),f=Math.floor((l[3]-t[1])/h);return p[this.v13_?"I":"X"]=d,p[this.v13_?"J":"Y"]=f,this.getRequestUrl_(a,u,l,1,o||n,p)}},t.prototype.getGutter=function(){return this.gutter_},t.prototype.getParams=function(){return this.params_},t.prototype.getRequestUrl_=function(t,e,i,r,n,o){var s=this.urls;if(s){if(o.WIDTH=e[0],o.HEIGHT=e[1],o[this.v13_?"CRS":"SRS"]=n.getCode(),"STYLES"in this.params_||(o.STYLES=""),1!=r)switch(this.serverType_){case oS:var a=90*r+.5|0;"FORMAT_OPTIONS"in o?o.FORMAT_OPTIONS+=";dpi:"+a:o.FORMAT_OPTIONS="dpi:"+a;break;case sS:o.MAP_RESOLUTION=90*r;break;case nS:case aS:o.DPI=90*r;break;default:Z(!1,52)}var h,l,u=n.getAxisOrientation(),c=i;if(this.v13_&&"ne"==u.substr(0,2))h=i[0],c[0]=i[1],c[1]=h,h=i[2],c[2]=i[3],c[3]=h;if(o.BBOX=c.join(","),1==s.length)l=s[0];else l=s[Et(px(t),s.length)];return Qx(l,o)}},t.prototype.getTilePixelRatio=function(t){return this.hidpi_&&void 0!==this.serverType_?t:1},t.prototype.getKeyForParams_=function(){var t=0,e=[];for(var i in this.params_)e[t++]=i+"-"+this.params_[i];return e.join("/")},t.prototype.fixedTileUrlFunction=function(t,e,i){var r=this.getTileGrid();if(r||(r=this.getTileGridForProjection(i)),!(r.getResolutions().length<=t[0])){1==e||this.hidpi_&&void 0!==this.serverType_||(e=1);var n=r.getResolution(t[0]),o=r.getTileCoordExtent(t,this.tmpExtent_),s=ws(r.getTileSize(t[0]),this.tmpSize),a=this.gutter_;0!==a&&(s=Cs(s,a,this.tmpSize),o=G(o,n*a,o)),1!=e&&(s=Ts(s,e,this.tmpSize));var h={SERVICE:"WMS",VERSION:rS,REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};return E(h,this.params_),this.getRequestUrl_(t,s,o,e,i,h)}},t.prototype.updateParams=function(t){E(this.params_,t),this.updateV13_(),this.setKey(this.getKeyForParams_())},t.prototype.updateV13_=function(){var t=this.params_.VERSION||rS;this.v13_=0<=sn(t,"1.3")},t}(jx),kS=function(s){function t(t,e,i,r,n,o){s.call(this,t,e),this.src_=i,this.extent_=r,this.preemptive_=n,this.grid_=null,this.keys_=null,this.data_=null,this.jsonp_=o}return s&&(t.__proto__=s),((t.prototype=Object.create(s&&s.prototype)).constructor=t).prototype.getImage=function(){return null},t.prototype.getData=function(t){if(!this.grid_||!this.keys_)return null;var e=(t[0]-this.extent_[0])/(this.extent_[2]-this.extent_[0]),i=(t[1]-this.extent_[1])/(this.extent_[3]-this.extent_[1]),r=this.grid_[Math.floor((1-i)*this.grid_.length)];if("string"!=typeof r)return null;var n=r.charCodeAt(Math.floor(e*r.length));93<=n&&n--,35<=n&&n--;var o=null;if((n-=32)in this.keys_){var s=this.keys_[n];o=this.data_&&s in this.data_?this.data_[s]:s}return o},t.prototype.forDataAtCoordinate=function(e,i,r,t){this.state==An&&!0===t?(o(this,w.CHANGE,function(t){i.call(r,this.getData(e))},this),this.loadInternal_()):!0===t?setTimeout(function(){i.call(r,this.getData(e))}.bind(this),0):i.call(r,this.getData(e))},t.prototype.getKey=function(){return this.src_},t.prototype.handleError_=function(){this.state=Dn,this.changed()},t.prototype.handleLoad_=function(t){this.grid_=t.grid,this.keys_=t.keys,this.data_=t.data,this.state=jn,this.changed()},t.prototype.loadInternal_=function(){if(this.state==An)if(this.state=Gn,this.jsonp_)vx(this.src_,this.handleLoad_.bind(this),this.handleError_.bind(this));else{var t=new XMLHttpRequest;t.addEventListener("load",this.onXHRLoad_.bind(this)),t.addEventListener("error",this.onXHRError_.bind(this)),t.open("GET",this.src_),t.send()}},t.prototype.onXHRLoad_=function(t){var e=t.target;if(!e.status||200<=e.status&&e.status<300){var i;try{i=JSON.parse(e.responseText)}catch(t){return void this.handleError_()}this.handleLoad_(i)}else this.handleError_()},t.prototype.onXHRError_=function(t){this.handleError_()},t.prototype.load=function(){this.preemptive_&&this.loadInternal_()},t}(Vn),DS=function(i){function t(t){if(i.call(this,{projection:ne("EPSG:3857"),state:vs}),this.preemptive_=void 0===t.preemptive||t.preemptive,this.tileUrlFunction_=gx,this.template_=void 0,this.jsonp_=t.jsonp||!1,t.url)if(this.jsonp_)vx(t.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{var e=new XMLHttpRequest;e.addEventListener("load",this.onXHRLoad_.bind(this)),e.addEventListener("error",this.onXHRError_.bind(this)),e.open("GET",t.url),e.send()}else t.tileJSON?this.handleTileJSONResponse(t.tileJSON):Z(!1,51)}return i&&(t.__proto__=i),((t.prototype=Object.create(i&&i.prototype)).constructor=t).prototype.onXHRLoad_=function(t){var e=t.target;if(!e.status||200<=e.status&&e.status<300){var i;try{i=JSON.parse(e.responseText)}catch(t){return void this.handleTileJSONError()}this.handleTileJSONResponse(i)}else this.handleTileJSONError()},t.prototype.onXHRError_=function(t){this.handleTileJSONError()},t.prototype.getTemplate=function(){return this.template_},t.prototype.forDataAtCoordinateAndResolution=function(t,e,i,r){if(this.tileGrid){var n=this.tileGrid.getTileCoordForCoordAndResolution(t,e);this.getTile(n[0],n[1],n[2],1,this.getProjection()).forDataAtCoordinate(t,i,null,r)}else!0===r?setTimeout(function(){i(null)},0):i(null)},t.prototype.handleTileJSONError=function(){this.setState(xs)},t.prototype.handleTileJSONResponse=function(e){var t,i=ne("EPSG:4326"),r=this.getProjection();if(void 0!==e.bounds){var n=ce(i,r);t=ft(e.bounds,n)}var o=e.minzoom||0,s=e.maxzoom||22,a=bx({extent:Mx(r),maxZoom:s,minZoom:o});this.tileGrid=a,this.template_=e.template;var h=e.grids;if(h){if(this.tileUrlFunction_=fx(h,a),void 0!==e.attribution){var l=void 0!==t?t:i.getExtent();this.setAttributions(function(t){return wt(l,t.extent)?[e.attribution]:null})}this.setState(ms)}else this.setState(xs)},t.prototype.getTile=function(t,e,i,r,n){var o=ux(t,e,i);if(this.tileCache.containsKey(o))return this.tileCache.get(o);var s=[t,e,i],a=this.getTileCoordForTileUrlFunction(s,n),h=this.tileUrlFunction_(a,r,n),l=new kS(s,void 0!==h?An:jn,void 0!==h?h:"",this.tileGrid.getTileCoordExtent(s),this.preemptive_,this.jsonp_);return this.tileCache.set(o,l),l},t.prototype.useTile=function(t,e,i){var r=ux(t,e,i);this.tileCache.containsKey(r)&&this.tileCache.get(r)},t}(Ox),jS=function(S){function E(t,e,i,s,a,r,h,l,n,u,c,p,d,f,o){if(S.call(this,t,e,{transition:0}),this.context_={},this.loader_,this.replayState_={},this.sourceTiles_=u,this.tileKeys=[],this.extent=null,this.sourceRevision_=i,this.wrappedTileCoord=r,this.loadListenerKeys_=[],this.sourceTileListenerKeys_=[],r){var _=this.extent=n.getTileCoordExtent(r),g=n.getResolution(o),y=l.getZForResolution(g),v=o!=t[0],m=0;if(l.forEachTileCoord(_,y,function(t){var e=ht(_,l.getTileCoordExtent(t)),i=l.getExtent();if(i&&(e=ht(e,i,e)),.5<=ct(e)/g&&.5<=at(e)/g){++m;var r=t.toString(),n=u[r];if(!n&&!v){var o=h(t,c,p);n=u[r]=new d(t,null==o?jn:An,null==o?"":o,s,a),this.sourceTileListenerKeys_.push(C(n,w.CHANGE,f))}!n||v&&n.getState()!=kn||(n.consumers++,this.tileKeys.push(r))}}.bind(this)),v&&m==this.tileKeys.length&&this.finishLoading_(),o<=t[0]&&this.state!=kn)for(;o>n.getMinZoom();){var x=new E(t,e,i,s,a,r,h,l,n,u,c,p,d,L,--o);if(x.state==kn){this.interimTile=x;break}}}}return S&&(E.__proto__=S),((E.prototype=Object.create(S&&S.prototype)).constructor=E).prototype.disposeInternal=function(){this.state=Un,this.changed(),this.interimTile&&this.interimTile.dispose();for(var t=0,e=this.tileKeys.length;t>=1,c>>=1;break;default:Z(!1,53)}u.push([1,1]),u.reverse();for(var p=[1],d=[0],f=1,_=u.length;f<_;f++)p.push(1<