diff --git a/src/index.html b/src/index.html index 70dc1da..19c1b9d 100644 --- a/src/index.html +++ b/src/index.html @@ -1,62 +1,72 @@ + - + 360 Pano Image Viewer - - - - - - - - + + + + + + + + - -
-
- -
-
- - - -
- + } + + if ('function' === typeof onLoadFunc) { + onLoadFunc(window, ViewerWindow.viewerAsync) + } + + + + + +
+ +
+
+
+ + +
- +
+ + \ No newline at end of file diff --git a/src/js/viewer/EventLayer.js b/src/js/viewer/EventLayer.js index fbfb0b4..086f529 100644 --- a/src/js/viewer/EventLayer.js +++ b/src/js/viewer/EventLayer.js @@ -1,29 +1,32 @@ "use strict"; - -// Event position in viewer - -export class EventPosition { - constructor() { - - this.x; // Number // y coordinate of this image on the floor - - this.y; // Number // y coordinate of this image on the floor - } - -} - +import { ViewerContextItem } from "./ViewerContextItem.js"; export class EventLayer { constructor() { - this.viewer_contex; + this.viewer_contex; } - - vwr_oncontext (xy, location){ + + vwr_oncontext(xy, location) { //Parameters: //xy EventPosition: Pointer position //location THREE.Vector3 : Local coordinates for pointer position+ - viewer_contex = new ViewerContextItem(); - return viewer_contex; + + //Showing pointer location and viewing direction in the terminal: + console.log("xy: ", xy); + console.log("Viewing Direction: ", location); + + //Creating callback function for context menu item: + let callback = function (key, options) { + var msg = 'clicked: ' + key; + (window.console && console.log(msg)) || alert(msg); + }; + + //Creating item objects + let itemEdit = new ViewerContextItem(callback, "edit", null, "Edit"); + let itemCut = new ViewerContextItem(callback, "cut", null, "Cut"); + + //Creating list of item objects. + return [itemEdit, itemCut]; } } \ No newline at end of file diff --git a/src/js/viewer/EventPosition.js b/src/js/viewer/EventPosition.js new file mode 100644 index 0000000..0059ea3 --- /dev/null +++ b/src/js/viewer/EventPosition.js @@ -0,0 +1,11 @@ +"use strict"; + +//Event position in viewer +export class EventPosition { + constructor(event) { + + this.x = event.clientX; + this.y = event.clientY; + + } +} \ No newline at end of file diff --git a/src/js/viewer/ViewerAPI.js b/src/js/viewer/ViewerAPI.js index 54a71ba..0c29672 100644 --- a/src/js/viewer/ViewerAPI.js +++ b/src/js/viewer/ViewerAPI.js @@ -63,7 +63,7 @@ export class ViewerAPI { animate() { window.requestAnimationFrame(() => this.animate()); - this.pano.viewInternal(); + this.pano.view(this.pano.viewerViewState.lonov, this.pano.viewerViewState.latov, this.pano.viewerViewState.fov); this.renderer.clear(); this.renderer.render(this.pano.scene, this.pano.camera); this.renderer.clearDepth(); @@ -79,14 +79,13 @@ export class ViewerAPI { this.floor.currentFloor.viewerImages.forEach(element => { const currLocalPos = this.toLocal(element.pos); - const currDistances = [localPos.x - currLocalPos.x, localPos.y - currLocalPos.y]; - const currDistance = Math.sqrt(currDistances[0] * currDistances[0] + currDistances[1] * currDistances[1]); + const [dx, dz] = [localPos.x - currLocalPos.x, localPos.z - currLocalPos.z]; + const currDistance = Math.sqrt(dx * dx + dz * dz); if (currDistance < minDistance) { minDistance = currDistance; bestImg = element; } - }); // avoid duplication @@ -142,25 +141,25 @@ export class ViewerAPI { // localCoords : THREE.Vector3 // Local coordinates used by the viewer const globalX = this.floor.origin[0] - (localCoords.x / 71.5); const globalY = this.floor.origin[1] - (localCoords.y / 111.3); - const globalZ = this.floor.currentFloor.z + localCoords.z; + const globalZ = localCoords.z - this.floor.currentFloor.z; - return [globalX, globalY, globalZ]; + // the three js scene sees the y axis as the up-down axis so we have to swap with z + return [globalX, globalZ, globalY]; // Returns: [Number] : WGS 84 coordinates [longitude, latitude, z] (z value is floorZ + panoZ, where localCoords is just the panoZ) } // Convert WGS 84 coordinates (globalCoords : [longitude, latitude, z]) to the local metric three.js coordinates used by the viewer. - // z value should be the panoZ + floorZ or image + // z value should be the panoZ + floorZ of image toLocal(globalCoords) { // Distance calculation math taken from here https://www.mkompf.com/gps/distcalc.html + // The more accurate calculation breaks the pixel offset on the pre-created maps const dx = 71.5 * (this.floor.origin[0] - globalCoords[0]); const dy = 111.3 * (this.floor.origin[1] - globalCoords[1]); - - // The more accurate calculation breaks the pixel offset on the precreated maps - //const avgLat = (lat1 + lat2) / 2 * 0.01745; - //dx = 111.3 * Math.cos(THREE.MathUtils.degToRad(avgLat)) * (lon1 - lon2); - return new this.THREE.Vector3(dx * 1000, dy * 1000, globalCoords[2] - this.floor.currentFloor.z); - // Returns: THREE.Vector3 : Local coordinates + return new this.THREE.Vector3( + dx * 1000, + globalCoords[2] + this.floor.currentFloor.z, + dy * 1000); } // TODO: swap() and big(wanted) diff --git a/src/js/viewer/ViewerContextItem.js b/src/js/viewer/ViewerContextItem.js new file mode 100644 index 0000000..d658ed2 --- /dev/null +++ b/src/js/viewer/ViewerContextItem.js @@ -0,0 +1,16 @@ +"use strict"; + +export class ViewerContextItem { + + constructor(callback, icon, items, name) { + + //Callback to execute for this context menu item + this.callback = callback; + //Icon class for this context menu item + this.icon = icon; + //Sub items below this context menu item + this.items = items; + //Human readable name of this item in the displayed context menu + this.name = name; + } +} diff --git a/src/js/viewer/ViewerPanoAPI.js b/src/js/viewer/ViewerPanoAPI.js index b26429b..71b7160 100644 --- a/src/js/viewer/ViewerPanoAPI.js +++ b/src/js/viewer/ViewerPanoAPI.js @@ -2,6 +2,8 @@ import { ViewerViewState } from "./ViewerViewState.js"; import { DEFAULT_FOV, MAX_FOV, MIN_FOV, ZOOM_SPEED, PAN_SPEED } from "./ViewerConfig.js"; +import { EventLayer } from "./EventLayer.js"; +import { EventPosition } from "./EventPosition.js"; export class ViewerPanoAPI { @@ -10,12 +12,18 @@ export class ViewerPanoAPI { this.camera = new THREE.PerspectiveCamera(DEFAULT_FOV, window.innerWidth / window.innerHeight, 1, 1100); this.viewerImageAPI = viewerAPI.image; this.viewerAPI = viewerAPI; - this.sphereRadius = 500; + this.sphereRadius = 10; this.viewerViewState = new ViewerViewState(DEFAULT_FOV, 0, 0); this.lastViewState; this.lastMousePos; + //initialize the eventLayer + this.eventLayer = new EventLayer(); + + // property needed for display method + this.loadedMesh = null; + // Two new event listeneres are called to handle *how far* the user drags this.oPM = (event) => this.onPointerMove(event); this.oPU = () => this.onPointerUp(); @@ -23,6 +31,7 @@ export class ViewerPanoAPI { document.addEventListener('wheel', (event) => this.onDocumentMouseWheel(event)); document.addEventListener('pointerdown', (event) => this.onPointerDown(event)); document.addEventListener('dblclick', (event) => this.onDoubleClick(event)); + $('#pano-viewer').mousedown((event) => this.onRightClick(event)); this.display(this.viewerImageAPI.currentImageId); } @@ -31,7 +40,7 @@ export class ViewerPanoAPI { display(imageNum) { this.viewerImageAPI.currentImageId = imageNum; - // Create a Sphere for the image texture to be displayed on + // create sphere const sphere = new THREE.SphereGeometry(this.sphereRadius, 60, 40); // invert the geometry on the x-axis so that we look out from the middle of the sphere sphere.scale(-1, 1, 1); @@ -39,23 +48,32 @@ export class ViewerPanoAPI { // load the 360-panorama image data (highest resolution hardcoded for now) const texturePano = this.viewerAPI.textureLoader.load( this.viewerAPI.baseURL + - Math.trunc(this.viewerImageAPI.currentImageId / 100) + + Math.trunc(imageNum / 100) + '/' + - this.viewerImageAPI.currentImageId + + imageNum + 'r3.jpg'); texturePano.mapping = THREE.EquirectangularReflectionMapping; // not sure if this line matters - + // put the texture on the spehere and add it to the scene - const material = new THREE.MeshBasicMaterial({ map: texturePano }); - const mesh = new THREE.Mesh(sphere, material); - - const orientation = this.viewerImageAPI.currentImage.orientation; + const mesh = new THREE.Mesh(sphere, new THREE.MeshBasicMaterial({ map: texturePano })); - mesh.applyQuaternion(orientation); - - this.scene.clear(); + // adjust for orientation offset + mesh.applyQuaternion(this.viewerImageAPI.currentImage.orientation); + // put in the correct position in the scene + const localCoord = this.viewerAPI.toLocal(this.viewerImageAPI.currentImage.pos); + mesh.position.set(localCoord.x, localCoord.y, localCoord.z); + + // check if other panorama was previously already loaded + if (this.loadedMesh != null) { + this.scene.remove(this.loadedMesh); + } + this.scene.add(mesh); + this.loadedMesh = mesh; + + // put camera inside sphere mesh + this.camera.position.set(localCoord.x, localCoord.y, localCoord.z); } camera() { @@ -64,99 +82,102 @@ export class ViewerPanoAPI { // Set the panorama view characteristics. view(lonov, latov, fov) { - let phi = THREE.MathUtils.degToRad(90 - latov); let theta = THREE.MathUtils.degToRad(lonov); - + const x = this.sphereRadius * Math.sin(phi) * Math.cos(theta); const y = this.sphereRadius * Math.cos(phi); const z = this.sphereRadius * Math.sin(phi) * Math.sin(theta); - this.camera.lookAt(x, y, z); + // adjust looking direction for offset of current mesh in scene + const localCoord = this.viewerAPI.toLocal(this.viewerImageAPI.currentImage.pos); + + this.camera.lookAt(x + localCoord.x, y + localCoord.y, z + localCoord.z); this.camera.fov = THREE.MathUtils.clamp(fov, MIN_FOV, MAX_FOV); this.camera.updateProjectionMatrix(); - } - viewInternal() { - this.view(this.viewerViewState.lonov, this.viewerViewState.latov, this.viewerViewState.fov); - } - // ----- Event handling functions for panning, zooming and moving ----- onPointerDown(event) { this.lastMousePos = [event.clientX, event.clientY]; - + this.lastViewState = [this.viewerViewState.lonov, this.viewerViewState.latov]; - + document.addEventListener('pointermove', this.oPM); document.addEventListener('pointerup', this.oPU); } - + // handles continues update of the distance mouse moved onPointerMove(event) { let scalingFactor = this.camera.fov / MAX_FOV; - this.viewerViewState.lonov = (this.lastMousePos[0] - event.clientX) * PAN_SPEED * scalingFactor + this.lastViewState[0]; - this.viewerViewState.latov = (event.clientY - this.lastMousePos[1]) * PAN_SPEED * scalingFactor + this.lastViewState[1]; - - // keep viewerviewstate.latov within bounds because it loops back around at top and bottom - this.viewerViewState.latov = Math.max(-85, Math.min(85, this.viewerViewState.latov)); - - // keep lonov between 0 and 360 - this.viewerViewState.lonov = (this.viewerViewState.lonov + 360) % 360; + this.viewerViewState.setLonov((this.lastMousePos[0] - event.clientX) * PAN_SPEED * scalingFactor + this.lastViewState[0]); + this.viewerViewState.setLatov((event.clientY - this.lastMousePos[1]) * PAN_SPEED * scalingFactor + this.lastViewState[1]); } - + // this event listener is called when the user *ends* moving the picture onPointerUp() { document.removeEventListener('pointermove', this.oPM); document.removeEventListener('pointerup', this.oPU); - + this.viewerAPI.propagateEvent("viewed", this.viewerViewState, true); } - + onDocumentMouseWheel(event) { - // the 0.05 constant determines how quick scrolling in and out feels for the user this.viewerViewState.fov = this.camera.fov + event.deltaY * ZOOM_SPEED; - this.viewInternal(); - + this.view(this.viewerViewState.lonov, this.viewerViewState.latov, this.viewerViewState.fov); this.camera.updateProjectionMatrix(); - + this.viewerAPI.propagateEvent("viewed", this.viewerViewState, true); } onDoubleClick(event) { const halfWidth = window.innerWidth / 2; const halfHeight = window.innerHeight / 2; - - const horizontalAngle = (this.viewerViewState.lonov > 270) ? 450 - this.viewerViewState.lonov : -(this.viewerViewState.lonov - 90); - const horizontalOffset = (event.x - halfWidth) / halfWidth; // scaled between [-1,1] depending how left-right the click is - const adjustedHorizontalAngle = horizontalAngle - (horizontalOffset * this.viewerViewState.fov / 2); // line from current position towards where the mouse double clicked (2D birds eye view angle) - - const verticalAngle = -this.viewerViewState.latov + 90 // between [0,180]Deg depending on how far up/down the user looks - const verticalOffset = (event.y - halfHeight) / halfHeight; // between [-1,1] depending how up-down the mouse click is on the screen - const adjustedVerticalAngle = verticalAngle + (verticalOffset * this.viewerViewState.fov / 2); - const realVerticalOffset = (adjustedVerticalAngle - 90) / 90; // between [-1,1] depending how far up/down user looks and clicks + + const horizontalOffset = (event.x - halfWidth) / halfWidth; // scaled between [-1,1] depending how left-right the mouse click is on the screen + const verticalOffset = (event.y - halfHeight) / halfHeight; // scaled between [-1,1] depending how up-down the mouse click is on the screen + const adjustedLonov = ((this.viewerViewState.lonov + (horizontalOffset * this.viewerViewState.fov)) + 360) % 360; + const adjustedLatov = Math.max(-85, Math.min(85, this.viewerViewState.latov - (verticalOffset * this.viewerViewState.fov / 2))); + const MEDIAN_WALKING_DISTANCE = 5; // in meter // distance to be walked along adjustedHorizontalAngle from current location - const distance = MEDIAN_WALKING_DISTANCE - (realVerticalOffset * MEDIAN_WALKING_DISTANCE); + const distance = MEDIAN_WALKING_DISTANCE + ((adjustedLatov / 85) * MEDIAN_WALKING_DISTANCE); + + // convertedAngle converted to represent directions like specified in newLocationFromPointAngle + const convertedAngle = (adjustedLonov < 180) ? -adjustedLonov : 360 - adjustedLonov; - // adjustedHorizontalAngle converted to represent directions like specified in newLocationFromPointAngle - let convertedAngle = (adjustedHorizontalAngle > -90) ? adjustedHorizontalAngle - 90 : adjustedHorizontalAngle + 270; - convertedAngle = THREE.Math.degToRad(convertedAngle); const currentPos = this.viewerImageAPI.currentImage.pos; - const newPos = newLocationFromPointAngle(currentPos[0], currentPos[1], convertedAngle, distance); - + const newPos = newLocationFromPointAngle(currentPos[0], currentPos[1], THREE.Math.degToRad(convertedAngle), distance); this.viewerAPI.move(newPos[0], newPos[1], currentPos[2]); - + this.viewerAPI.propagateEvent("moved", this.viewerImageAPI.currentImage.id, true); } + onRightClick(event) { + //if right mouse is clicked: + if (event.which == 3) { + + //get the current pointer position: + const xy = new EventPosition(event); + + //get the viewing direction: + const location = this.camera.getWorldDirection(); + + //Set up the context menu: + $.contextMenu({ + selector: '#pano-viewer', + items: this.eventLayer.vwr_oncontext(xy, location), + }); + } + } + } // takes in a location (in lot/lat), a direction (as a *angle*[rad, in birds eye view), and a distance (in meters) to move in the direction diff --git a/src/js/viewer/ViewerViewState.js b/src/js/viewer/ViewerViewState.js index 1fe8c8f..6adadcf 100644 --- a/src/js/viewer/ViewerViewState.js +++ b/src/js/viewer/ViewerViewState.js @@ -1,6 +1,6 @@ "use strict"; -export class ViewerViewState{ +export class ViewerViewState { constructor(fov, latov, lonov) { this.fov = fov; // : Number // Field of view (in degrees) @@ -9,5 +9,15 @@ export class ViewerViewState{ this.lonov = lonov; // : Number // View longitude (in degrees) } + + setLatov(newVal) { + // keep viewerviewstate.latov within bounds because it loops back around at top and bottom + this.latov = Math.max(-85, Math.min(85, newVal)); + } + setLonov(newVal) { + // keep lonov between 0 and 360 + this.lonov = (newVal + 360) % 360; + } + } \ No newline at end of file diff --git a/src/libs/contextMenu.min.js b/src/libs/contextMenu.min.js new file mode 100644 index 0000000..f113c0d --- /dev/null +++ b/src/libs/contextMenu.min.js @@ -0,0 +1 @@ +!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?e(require("jquery")):e(jQuery)}(function(m){"use strict";var a;m.support.htmlMenuitem="HTMLMenuItemElement"in window,m.support.htmlCommand="HTMLCommandElement"in window,m.support.eventSelectstart="onselectstart"in document.documentElement,m.ui&&m.widget||(m.cleanData=(a=m.cleanData,function(e){var t,n,o;for(o=0;null!=e[o];o++){n=e[o];try{(t=m._data(n,"events"))&&t.remove&&m(n).triggerHandler("remove")}catch(e){}}a(e)}));var c=null,d=!1,p=m(window),f=0,h={},x={},v={},g={selector:null,appendTo:null,trigger:"right",autoHide:!1,delay:200,reposition:!0,hideOnSecondTrigger:!1,selectableSubMenu:!1,classNames:{hover:"context-menu-hover",disabled:"context-menu-disabled",visible:"context-menu-visible",notSelectable:"context-menu-not-selectable",icon:"context-menu-icon",iconEdit:"context-menu-icon-edit",iconCut:"context-menu-icon-cut",iconCopy:"context-menu-icon-copy",iconPaste:"context-menu-icon-paste",iconDelete:"context-menu-icon-delete",iconAdd:"context-menu-icon-add",iconQuit:"context-menu-icon-quit",iconLoadingClass:"context-menu-icon-loading"},determinePosition:function(e){if(m.ui&&m.ui.position)e.css("display","block").position({my:"center top",at:"center bottom",of:this,offset:"0 5",collision:"fit"}).css("display","none");else{var t=this.offset();t.top+=this.outerHeight(),t.left+=this.outerWidth()/2-e.outerWidth()/2,e.css(t)}},position:function(e,t,n){var o;if(t||n){if("maintain"===t&&"maintain"===n)o=e.$menu.position();else{var a=e.$menu.offsetParent().offset();o={top:n-a.top,left:t-a.left}}var s=p.scrollTop()+p.height(),i=p.scrollLeft()+p.width(),c=e.$menu.outerHeight(),l=e.$menu.outerWidth();o.top+c>s&&(o.top-=c),o.top<0&&(o.top=0),o.left+l>i&&(o.left-=l),o.left<0&&(o.left=0),e.$menu.css(o)}else e.determinePosition.call(this,e.$menu)},positionSubmenu:function(e){if(void 0!==e)if(m.ui&&m.ui.position)e.css("display","block").position({my:"left top-5",at:"right top",of:this,collision:"flipfit fit"}).css("display","");else{var t={top:-9,left:this.outerWidth()-5};e.css(t)}},zIndex:1,animation:{duration:50,show:"slideDown",hide:"slideUp"},events:{show:m.noop,hide:m.noop,activated:m.noop},callback:null,items:{}},s={timer:null,pageX:null,pageY:null},b={abortevent:function(e){e.preventDefault(),e.stopImmediatePropagation()},contextmenu:function(e){var t=m(this);if("right"===e.data.trigger&&(e.preventDefault(),e.stopImmediatePropagation()),!("right"!==e.data.trigger&&"demand"!==e.data.trigger&&e.originalEvent||!(void 0===e.mouseButton||!e.data||"left"===e.data.trigger&&0===e.mouseButton||"right"===e.data.trigger&&2===e.mouseButton)||t.hasClass("context-menu-active")||t.hasClass("context-menu-disabled"))){if(c=t,e.data.build){var n=e.data.build(c,e);if(!1===n)return;if(e.data=m.extend(!0,{},g,e.data,n||{}),!e.data.items||m.isEmptyObject(e.data.items))throw window.console&&(console.error||console.log).call(console,"No items specified to show in contextMenu"),new Error("No Items specified");e.data.$trigger=c,$.create(e.data)}$.show.call(t,e.data,e.pageX,e.pageY)}},click:function(e){e.preventDefault(),e.stopImmediatePropagation(),m(this).trigger(m.Event("contextmenu",{data:e.data,pageX:e.pageX,pageY:e.pageY}))},mousedown:function(e){var t=m(this);c&&c.length&&!c.is(t)&&c.data("contextMenu").$menu.trigger("contextmenu:hide"),2===e.button&&(c=t.data("contextMenuActive",!0))},mouseup:function(e){var t=m(this);t.data("contextMenuActive")&&c&&c.length&&c.is(t)&&!t.hasClass("context-menu-disabled")&&(e.preventDefault(),e.stopImmediatePropagation(),(c=t).trigger(m.Event("contextmenu",{data:e.data,pageX:e.pageX,pageY:e.pageY}))),t.removeData("contextMenuActive")},mouseenter:function(e){var t=m(this),n=m(e.relatedTarget),o=m(document);n.is(".context-menu-list")||n.closest(".context-menu-list").length||c&&c.length||(s.pageX=e.pageX,s.pageY=e.pageY,s.data=e.data,o.on("mousemove.contextMenuShow",b.mousemove),s.timer=setTimeout(function(){s.timer=null,o.off("mousemove.contextMenuShow"),(c=t).trigger(m.Event("contextmenu",{data:s.data,pageX:s.pageX,pageY:s.pageY}))},e.data.delay))},mousemove:function(e){s.pageX=e.pageX,s.pageY=e.pageY},mouseleave:function(e){var t=m(e.relatedTarget);if(!t.is(".context-menu-list")&&!t.closest(".context-menu-list").length){try{clearTimeout(s.timer)}catch(e){}s.timer=null}},layerClick:function(a){var s,i,c=m(this).data("contextMenuRoot"),l=a.button,r=a.pageX,u=a.pageY,d=void 0===r;a.preventDefault(),setTimeout(function(){if(d)null!=c&&null!==c.$menu&&void 0!==c.$menu&&c.$menu.trigger("contextmenu:hide");else{var e,t="left"===c.trigger&&0===l||"right"===c.trigger&&2===l;if(document.elementFromPoint&&c.$layer){if(c.$layer.hide(),(s=document.elementFromPoint(r-p.scrollLeft(),u-p.scrollTop())).isContentEditable){var n=document.createRange(),o=window.getSelection();n.selectNode(s),n.collapse(!0),o.removeAllRanges(),o.addRange(n)}m(s).trigger(a),c.$layer.show()}if(c.hideOnSecondTrigger&&t&&null!==c.$menu&&void 0!==c.$menu)c.$menu.trigger("contextmenu:hide");else{if(c.reposition&&t)if(document.elementFromPoint){if(c.$trigger.is(s))return void c.position.call(c.$trigger,c,r,u)}else if(i=c.$trigger.offset(),e=m(window),i.top+=e.scrollTop(),i.top<=a.pageY&&(i.left+=e.scrollLeft(),i.left<=a.pageX&&(i.bottom=i.top+c.$trigger.outerHeight(),i.bottom>=a.pageY&&(i.right=i.left+c.$trigger.outerWidth(),i.right>=a.pageX))))return void c.position.call(c.$trigger,c,r,u);s&&t&&c.$trigger.one("contextmenu:hidden",function(){m(s).contextMenu({x:r,y:u,button:l})}),null!=c&&null!==c.$menu&&void 0!==c.$menu&&c.$menu.trigger("contextmenu:hide")}}},50)},keyStop:function(e,t){t.isInput||e.preventDefault(),e.stopPropagation()},key:function(e){var t={};c&&(t=c.data("contextMenu")||{}),void 0===t.zIndex&&(t.zIndex=0);var n=0,o=function(e){""!==e.style.zIndex?n=e.style.zIndex:null!==e.offsetParent&&void 0!==e.offsetParent?o(e.offsetParent):null!==e.parentElement&&void 0!==e.parentElement&&o(e.parentElement)};if(o(e.target),!(t.$menu&&parseInt(n,10)>parseInt(t.$menu.css("zIndex"),10))){switch(e.keyCode){case 9:case 38:if(b.keyStop(e,t),t.isInput){if(9===e.keyCode&&e.shiftKey)return e.preventDefault(),t.$selected&&t.$selected.find("input, textarea, select").blur(),void(null!==t.$menu&&void 0!==t.$menu&&t.$menu.trigger("prevcommand"));if(38===e.keyCode&&"checkbox"===t.$selected.find("input, textarea, select").prop("type"))return void e.preventDefault()}else if(9!==e.keyCode||e.shiftKey)return void(null!==t.$menu&&void 0!==t.$menu&&t.$menu.trigger("prevcommand"));break;case 40:if(b.keyStop(e,t),!t.isInput)return void(null!==t.$menu&&void 0!==t.$menu&&t.$menu.trigger("nextcommand"));if(9===e.keyCode)return e.preventDefault(),t.$selected&&t.$selected.find("input, textarea, select").blur(),void(null!==t.$menu&&void 0!==t.$menu&&t.$menu.trigger("nextcommand"));if(40===e.keyCode&&"checkbox"===t.$selected.find("input, textarea, select").prop("type"))return void e.preventDefault();break;case 37:if(b.keyStop(e,t),t.isInput||!t.$selected||!t.$selected.length)break;if(!t.$selected.parent().hasClass("context-menu-root")){var a=t.$selected.parent().parent();return t.$selected.trigger("contextmenu:blur"),void(t.$selected=a)}break;case 39:if(b.keyStop(e,t),t.isInput||!t.$selected||!t.$selected.length)break;var s=t.$selected.data("contextMenu")||{};if(s.$menu&&t.$selected.hasClass("context-menu-submenu"))return t.$selected=null,s.$selected=null,void s.$menu.trigger("nextcommand");break;case 35:case 36:return t.$selected&&t.$selected.find("input, textarea, select").length?void 0:((t.$selected&&t.$selected.parent()||t.$menu).children(":not(."+t.classNames.disabled+", ."+t.classNames.notSelectable+")")[36===e.keyCode?"first":"last"]().trigger("contextmenu:focus"),void e.preventDefault());case 13:if(b.keyStop(e,t),t.isInput){if(t.$selected&&!t.$selected.is("textarea, select"))return void e.preventDefault();break}return void(void 0!==t.$selected&&null!==t.$selected&&t.$selected.trigger("mouseup"));case 32:case 33:case 34:return void b.keyStop(e,t);case 27:return b.keyStop(e,t),void(null!==t.$menu&&void 0!==t.$menu&&t.$menu.trigger("contextmenu:hide"));default:var i=String.fromCharCode(e.keyCode).toUpperCase();if(t.accesskeys&&t.accesskeys[i])return void t.accesskeys[i].$node.trigger(t.accesskeys[i].$menu?"contextmenu:focus":"mouseup")}e.stopPropagation(),void 0!==t.$selected&&null!==t.$selected&&t.$selected.trigger(e)}},prevItem:function(e){e.stopPropagation();var t=m(this).data("contextMenu")||{},n=m(this).data("contextMenuRoot")||{};if(t.$selected){var o=t.$selected;(t=t.$selected.parent().data("contextMenu")||{}).$selected=o}for(var a=t.$menu.children(),s=t.$selected&&t.$selected.prev().length?t.$selected.prev():a.last(),i=s;s.hasClass(n.classNames.disabled)||s.hasClass(n.classNames.notSelectable)||s.is(":hidden");)if((s=s.prev().length?s.prev():a.last()).is(i))return;t.$selected&&b.itemMouseleave.call(t.$selected.get(0),e),b.itemMouseenter.call(s.get(0),e);var c=s.find("input, textarea, select");c.length&&c.focus()},nextItem:function(e){e.stopPropagation();var t=m(this).data("contextMenu")||{},n=m(this).data("contextMenuRoot")||{};if(t.$selected){var o=t.$selected;(t=t.$selected.parent().data("contextMenu")||{}).$selected=o}for(var a=t.$menu.children(),s=t.$selected&&t.$selected.next().length?t.$selected.next():a.first(),i=s;s.hasClass(n.classNames.disabled)||s.hasClass(n.classNames.notSelectable)||s.is(":hidden");)if((s=s.next().length?s.next():a.first()).is(i))return;t.$selected&&b.itemMouseleave.call(t.$selected.get(0),e),b.itemMouseenter.call(s.get(0),e);var c=s.find("input, textarea, select");c.length&&c.focus()},focusInput:function(){var e=m(this).closest(".context-menu-item"),t=e.data(),n=t.contextMenu,o=t.contextMenuRoot;o.$selected=n.$selected=e,o.isInput=n.isInput=!0},blurInput:function(){var e=m(this).closest(".context-menu-item").data(),t=e.contextMenu;e.contextMenuRoot.isInput=t.isInput=!1},menuMouseenter:function(){m(this).data().contextMenuRoot.hovering=!0},menuMouseleave:function(e){var t=m(this).data().contextMenuRoot;t.$layer&&t.$layer.is(e.relatedTarget)&&(t.hovering=!1)},itemMouseenter:function(e){var t=m(this),n=t.data(),o=n.contextMenu,a=n.contextMenuRoot;a.hovering=!0,e&&a.$layer&&a.$layer.is(e.relatedTarget)&&(e.preventDefault(),e.stopImmediatePropagation()),(o.$menu?o:a).$menu.children("."+a.classNames.hover).trigger("contextmenu:blur").children(".hover").trigger("contextmenu:blur"),t.hasClass(a.classNames.disabled)||t.hasClass(a.classNames.notSelectable)?o.$selected=null:t.trigger("contextmenu:focus")},itemMouseleave:function(e){var t=m(this),n=t.data(),o=n.contextMenu,a=n.contextMenuRoot;if(a!==o&&a.$layer&&a.$layer.is(e.relatedTarget))return void 0!==a.$selected&&null!==a.$selected&&a.$selected.trigger("contextmenu:blur"),e.preventDefault(),e.stopImmediatePropagation(),void(a.$selected=o.$selected=o.$node);o&&o.$menu&&o.$menu.hasClass("context-menu-visible")||t.trigger("contextmenu:blur")},itemClick:function(e){var t,n=m(this),o=n.data(),a=o.contextMenu,s=o.contextMenuRoot,i=o.contextMenuKey;if(!(!a.items[i]||n.is("."+s.classNames.disabled+", .context-menu-separator, ."+s.classNames.notSelectable)||n.is(".context-menu-submenu")&&!1===s.selectableSubMenu)){if(e.preventDefault(),e.stopImmediatePropagation(),m.isFunction(a.callbacks[i])&&Object.prototype.hasOwnProperty.call(a.callbacks,i))t=a.callbacks[i];else{if(!m.isFunction(s.callback))return;t=s.callback}!1!==t.call(s.$trigger,i,s,e)?s.$menu.trigger("contextmenu:hide"):s.$menu.parent().length&&$.update.call(s.$trigger,s)}},inputClick:function(e){e.stopImmediatePropagation()},hideMenu:function(e,t){var n=m(this).data("contextMenuRoot");$.hide.call(n.$trigger,n,t&&t.force)},focusItem:function(e){e.stopPropagation();var t=m(this),n=t.data(),o=n.contextMenu,a=n.contextMenuRoot;t.hasClass(a.classNames.disabled)||t.hasClass(a.classNames.notSelectable)||(t.addClass([a.classNames.hover,a.classNames.visible].join(" ")).parent().find(".context-menu-item").not(t).removeClass(a.classNames.visible).filter("."+a.classNames.hover).trigger("contextmenu:blur"),o.$selected=a.$selected=t,o&&o.$node&&o.$node.hasClass("context-menu-submenu")&&o.$node.addClass(a.classNames.hover),o.$node&&a.positionSubmenu.call(o.$node,o.$menu))},blurItem:function(e){e.stopPropagation();var t=m(this),n=t.data(),o=n.contextMenu,a=n.contextMenuRoot;o.autoHide&&t.removeClass(a.classNames.visible),t.removeClass(a.classNames.hover),o.$selected=null}},$={show:function(n,e,t){var o=m(this),a={};if(m("#context-menu-layer").trigger("mousedown"),n.$trigger=o,!1!==n.events.show.call(o,n))if(!1!==$.update.call(o,n)){if(n.position.call(o,n,e,t),n.zIndex){var s=n.zIndex;"function"==typeof n.zIndex&&(s=n.zIndex.call(o,n)),a.zIndex=function(e){for(var t=0,n=e;t=Math.max(t,parseInt(n.css("z-index"),10)||0),(n=n.parent())&&n.length&&!(-1<"html body".indexOf(n.prop("nodeName").toLowerCase())););return t}(o)+s}$.layer.call(n.$menu,n,a.zIndex),n.$menu.find("ul").css("zIndex",a.zIndex+1),n.$menu.css(a)[n.animation.show](n.animation.duration,function(){o.trigger("contextmenu:visible"),$.activated(n),n.events.activated(n)}),o.data("contextMenu",n).addClass("context-menu-active"),m(document).off("keydown.contextMenu").on("keydown.contextMenu",b.key),n.autoHide&&m(document).on("mousemove.contextMenuAutoHide",function(e){var t=o.offset();t.right=t.left+o.outerWidth(),t.bottom=t.top+o.outerHeight(),!n.$layer||n.hovering||e.pageX>=t.left&&e.pageX<=t.right&&e.pageY>=t.top&&e.pageY<=t.bottom||setTimeout(function(){n.hovering||null===n.$menu||void 0===n.$menu||n.$menu.trigger("contextmenu:hide")},50)})}else c=null;else c=null},hide:function(t,e){var n=m(this);if(t||(t=n.data("contextMenu")||{}),e||!t.events||!1!==t.events.hide.call(n,t)){if(n.removeData("contextMenu").removeClass("context-menu-active"),t.$layer){setTimeout((o=t.$layer,function(){o.remove()}),10);try{delete t.$layer}catch(e){t.$layer=null}}var o;c=null,t.$menu.find("."+t.classNames.hover).trigger("contextmenu:blur"),t.$selected=null,t.$menu.find("."+t.classNames.visible).removeClass(t.classNames.visible),m(document).off(".contextMenuAutoHide").off("keydown.contextMenu"),t.$menu&&t.$menu[t.animation.hide](t.animation.duration,function(){t.build&&(t.$menu.remove(),m.each(t,function(e){switch(e){case"ns":case"selector":case"build":case"trigger":return!0;default:t[e]=void 0;try{delete t[e]}catch(e){}return!0}})),setTimeout(function(){n.trigger("contextmenu:hidden")},10)})}},create:function(r,u){function d(e){var t=m("");if(e._accesskey)e._beforeAccesskey&&t.append(document.createTextNode(e._beforeAccesskey)),m("").addClass("context-menu-accesskey").text(e._accesskey).appendTo(t),e._afterAccesskey&&t.append(document.createTextNode(e._afterAccesskey));else if(e.isHtmlName){if(void 0!==e.accesskey)throw new Error("accesskeys are not compatible with HTML names and cannot be used together in the same item");t.html(e.name)}else t.text(e.name);return t}void 0===u&&(u=r),r.$menu=m('').addClass(r.className||"").data({contextMenu:r,contextMenuRoot:u}),m.each(["callbacks","commands","inputs"],function(e,t){r[t]={},u[t]||(u[t]={})}),u.accesskeys||(u.accesskeys={}),m.each(r.items,function(n,o){var e=m('
  • ').addClass(o.className||""),t=null,a=null;if(e.on("click",m.noop),"string"!=typeof o&&"cm_separator"!==o.type||(o={type:"cm_seperator"}),o.$node=e.data({contextMenu:r,contextMenuRoot:u,contextMenuKey:n}),void 0!==o.accesskey)for(var s,i=function(e){for(var t,n=e.split(/\s+/),o=[],a=0;t=n[a];a++)t=t.charAt(0).toUpperCase(),o.push(t);return o}(o.accesskey),c=0;s=i[c];c++)if(!u.accesskeys[s]){var l=(u.accesskeys[s]=o).name.match(new RegExp("^(.*?)("+s+")(.*)$","i"));l&&(o._beforeAccesskey=l[1],o._accesskey=l[2],o._afterAccesskey=l[3]);break}if(o.type&&v[o.type])v[o.type].call(e,o,r,u),m.each([r,u],function(e,t){t.commands[n]=o,!m.isFunction(o.callback)||void 0!==t.callbacks[n]&&void 0!==r.type||(t.callbacks[n]=o.callback)});else{switch("cm_seperator"===o.type?e.addClass("context-menu-separator "+u.classNames.notSelectable):"html"===o.type?e.addClass("context-menu-html "+u.classNames.notSelectable):"sub"!==o.type&&o.type?(t=m("").appendTo(e),d(o).appendTo(t),e.addClass("context-menu-input"),r.hasTypes=!0,m.each([r,u],function(e,t){t.commands[n]=o,t.inputs[n]=o})):o.items&&(o.type="sub"),o.type){case"cm_seperator":break;case"text":a=m('').attr("name","context-menu-input-"+n).val(o.value||"").appendTo(t);break;case"textarea":a=m('').attr("name","context-menu-input-"+n).val(o.value||"").appendTo(t),o.height&&a.height(o.height);break;case"checkbox":a=m('').attr("name","context-menu-input-"+n).val(o.value||"").prop("checked",!!o.selected).prependTo(t);break;case"radio":a=m('').attr("name","context-menu-input-"+o.radio).val(o.value||"").prop("checked",!!o.selected).prependTo(t);break;case"select":a=m('').attr("name","context-menu-input-"+n).appendTo(t),o.options&&(m.each(o.options,function(e,t){m("").val(e).text(t).appendTo(a)}),a.val(o.selected));break;case"sub":d(o).appendTo(e),o.appendTo=o.$node,e.data("contextMenu",o).addClass("context-menu-submenu"),o.callback=null,"function"==typeof o.items.then?$.processPromises(o,u,o.items):$.create(o,u);break;case"html":m(o.html).appendTo(e);break;default:m.each([r,u],function(e,t){t.commands[n]=o,!m.isFunction(o.callback)||void 0!==t.callbacks[n]&&void 0!==r.type||(t.callbacks[n]=o.callback)}),d(o).appendTo(e)}o.type&&"sub"!==o.type&&"html"!==o.type&&"cm_seperator"!==o.type&&(a.on("focus",b.focusInput).on("blur",b.blurInput),o.events&&a.on(o.events,r)),o.icon&&(m.isFunction(o.icon)?o._icon=o.icon.call(this,this,e,n,o):"string"!=typeof o.icon||"fab "!==o.icon.substring(0,4)&&"fas "!==o.icon.substring(0,4)&&"far "!==o.icon.substring(0,4)&&"fal "!==o.icon.substring(0,4)?"string"==typeof o.icon&&"fa-"===o.icon.substring(0,3)?o._icon=u.classNames.icon+" "+u.classNames.icon+"--fa fa "+o.icon:o._icon=u.classNames.icon+" "+u.classNames.icon+"-"+o.icon:(e.addClass(u.classNames.icon+" "+u.classNames.icon+"--fa5"),o._icon=m('')),"string"==typeof o._icon?e.addClass(o._icon):e.prepend(o._icon))}o.$input=a,o.$label=t,e.appendTo(r.$menu),!r.hasTypes&&m.support.eventSelectstart&&e.on("selectstart.disableTextSelect",b.abortevent)}),r.$node||r.$menu.css("display","none").addClass("context-menu-root"),r.$menu.appendTo(r.appendTo||document.body)},resize:function(e,t){var n;e.css({position:"absolute",display:"block"}),e.data("width",(n=e.get(0)).getBoundingClientRect?Math.ceil(n.getBoundingClientRect().width):e.outerWidth()+1),e.css({position:"static",minWidth:"0px",maxWidth:"100000px"}),e.find("> li > ul").each(function(){$.resize(m(this),!0)}),t||e.find("ul").addBack().css({position:"",display:"",minWidth:"",maxWidth:""}).outerWidth(function(){return m(this).data("width")})},update:function(i,c){var l=this;void 0===c&&(c=i,$.resize(i.$menu));var r=!1;return i.$menu.children().each(function(){var e,t=m(this),n=t.data("contextMenuKey"),o=i.items[n],a=m.isFunction(o.disabled)&&o.disabled.call(l,n,c)||!0===o.disabled;if((e=m.isFunction(o.visible)?o.visible.call(l,n,c):void 0===o.visible||!0===o.visible)&&(r=!0),t[e?"show":"hide"](),t[a?"addClass":"removeClass"](c.classNames.disabled),m.isFunction(o.icon)){t.removeClass(o._icon);var s=o.icon.call(this,l,t,n,o);"string"==typeof s?t.addClass(s):t.prepend(s)}if(o.type)switch(t.find("input, select, textarea").prop("disabled",a),o.type){case"text":case"textarea":o.$input.val(o.value||"");break;case"checkbox":case"radio":o.$input.val(o.value||"").prop("checked",!!o.selected);break;case"select":o.$input.val((0===o.selected?"0":o.selected)||"")}o.$menu&&($.update.call(l,o,c)&&(r=!0))}),r},layer:function(e,t){var n=e.$layer=m('
    ').css({height:p.height(),width:p.width(),display:"block",position:"fixed","z-index":t,top:0,left:0,opacity:0,filter:"alpha(opacity=0)","background-color":"#000"}).data("contextMenuRoot",e).insertBefore(this).on("contextmenu",b.abortevent).on("mousedown",b.layerClick);return void 0===document.body.style.maxWidth&&n.css({position:"absolute",height:m(document).height()}),n},processPromises:function(e,t,n){function o(e,t,n){void 0===n?(n={error:{name:"No items and no error item",icon:"context-menu-icon context-menu-icon-quit"}},window.console&&(console.error||console.log).call(console,'When you reject a promise, provide an "items" object, equal to normal sub-menu items')):"string"==typeof n&&(n={error:{name:n}}),a(e,t,n)}function a(e,t,n){void 0!==t.$menu&&t.$menu.is(":visible")&&(e.$node.removeClass(t.classNames.iconLoadingClass),e.items=n,$.create(e,t,!0),$.update(e,t),t.positionSubmenu.call(e.$node,e.$menu))}e.$node.addClass(t.classNames.iconLoadingClass),n.then(function(e,t,n){void 0===n&&o(void 0),a(e,t,n)}.bind(this,e,t),o.bind(this,e,t))},activated:function(e){var t=e.$menu,n=t.offset(),o=m(window).height(),a=m(window).scrollTop(),s=t.height();oa+o)&&t.css({top:a+"px"})}};function l(e){return e.id&&m('label[for="'+e.id+'"]').val()||e.name}m.fn.contextMenu=function(e){var t=this,n=e;if(0 * @license MIT */ -var n=r(8),i=r(3),o=r(9);function a(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,e){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|t}function d(t,e){if(l.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return z(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return U(t).length;default:if(n)return z(t).length;e=(""+e).toLowerCase(),n=!0}}function g(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return R(this,e,r);case"utf8":case"utf-8":return C(this,e,r);case"ascii":return O(this,e,r);case"latin1":case"binary":return P(this,e,r);case"base64":return T(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function y(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function m(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=l.from(e,n)),l.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,i);if("number"==typeof e)return e&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,i){var o,a=1,s=t.length,l=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,s/=2,l/=2,r/=2}function u(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var c=-1;for(o=r;os&&(r=s-l),o=r;o>=0;o--){for(var h=!0,p=0;pi&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function T(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function C(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:u>223?3:u>191?2:1;if(i+h<=r)switch(h){case 1:u<128&&(c=u);break;case 2:128==(192&(o=t[i+1]))&&(l=(31&u)<<6|63&o)>127&&(c=l);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(l=(15&u)<<12|(63&o)<<6|63&a)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(l=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&l<1114112&&(c=l)}null===c?(c=65533,h=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=h}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),""},l.prototype.compare=function(t,e,r,n,i){if(!l.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0),s=Math.min(o,a),u=this.slice(n,i),c=t.slice(e,r),h=0;hi)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return _(this,t,e,r);case"utf8":case"utf-8":return b(this,t,e,r);case"ascii":return x(this,t,e,r);case"latin1":case"binary":return w(this,t,e,r);case"base64":return S(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function O(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;in)&&(r=n);for(var i="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function M(t,e,r,n,i,o){if(!l.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function F(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i>>8*(n?i:1-i)}function A(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i>>8*(n?i:3-i)&255}function k(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function j(t,e,r,n,o){return o||k(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function N(t,e,r,n,o){return o||k(t,0,r,8),i.write(t,e,r,n,52,8),r+8}l.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e0&&(i*=256);)n+=this[t+--e]*i;return n},l.prototype.readUInt8=function(t,e){return e||L(t,1,this.length),this[t]},l.prototype.readUInt16LE=function(t,e){return e||L(t,2,this.length),this[t]|this[t+1]<<8},l.prototype.readUInt16BE=function(t,e){return e||L(t,2,this.length),this[t]<<8|this[t+1]},l.prototype.readUInt32LE=function(t,e){return e||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},l.prototype.readUInt32BE=function(t,e){return e||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},l.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||L(t,e,this.length);for(var n=this[t],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*e)),n},l.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||L(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},l.prototype.readInt8=function(t,e){return e||L(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},l.prototype.readInt16LE=function(t,e){e||L(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt16BE=function(t,e){e||L(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt32LE=function(t,e){return e||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},l.prototype.readInt32BE=function(t,e){return e||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},l.prototype.readFloatLE=function(t,e){return e||L(t,4,this.length),i.read(this,t,!0,23,4)},l.prototype.readFloatBE=function(t,e){return e||L(t,4,this.length),i.read(this,t,!1,23,4)},l.prototype.readDoubleLE=function(t,e){return e||L(t,8,this.length),i.read(this,t,!0,52,8)},l.prototype.readDoubleBE=function(t,e){return e||L(t,8,this.length),i.read(this,t,!1,52,8)},l.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||M(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+i]=t/o&255;return e+r},l.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,1,255,0),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},l.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):F(this,t,e,!0),e+2},l.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):F(this,t,e,!1),e+2},l.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):A(this,t,e,!0),e+4},l.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):A(this,t,e,!1),e+4},l.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);M(this,t,e,r,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o>0)-s&255;return e+r},l.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);M(this,t,e,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},l.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,1,127,-128),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},l.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):F(this,t,e,!0),e+2},l.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):F(this,t,e,!1),e+2},l.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):A(this,t,e,!0),e+4},l.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):A(this,t,e,!1),e+4},l.prototype.writeFloatLE=function(t,e,r){return j(this,t,e,!0,r)},l.prototype.writeFloatBE=function(t,e,r){return j(this,t,e,!1,r)},l.prototype.writeDoubleLE=function(t,e,r){return N(this,t,e,!0,r)},l.prototype.writeDoubleBE=function(t,e,r){return N(this,t,e,!1,r)},l.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--i)t[i+e]=this[i+r];else if(o<1e3||!l.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function U(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(D,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function B(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}}).call(this,r(4))},function(t,e,r){"use strict";e.byteLength=function(t){var e=u(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,n=u(t),a=n[0],s=n[1],l=new o(function(t,e,r){return 3*(e+r)/4-r}(0,a,s)),c=0,h=s>0?a-4:a;for(r=0;r>16&255,l[c++]=e>>8&255,l[c++]=255&e;2===s&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,l[c++]=255&e);1===s&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,l[c++]=e>>8&255,l[c++]=255&e);return l},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],a=0,s=r-i;as?s:a+16383));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,l=a.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function c(t,e,r){for(var i,o,a=[],s=e;s>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){"use strict";function n(){return function(){throw new Error("Unimplemented abstract method.")}()}r.r(e);var i=0;function o(t){return t.ol_uid||(t.ol_uid=String(++i))}var a,s=(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),l=function(t){function e(e){var r=this,n="Assertion failed. See https://openlayers.org/en/"+("v"+"6.5.0".split("-")[0])+"/doc/errors/#"+e+" for details.";return(r=t.call(this,n)||this).code=e,r.name="AssertionError",r.message=n,r}return s(e,t),e}(Error);function u(t){t.stopPropagation()}var c=function(){function t(t){this.propagationStopped,this.type=t,this.target=null}return t.prototype.preventDefault=function(){this.propagationStopped=!0},t.prototype.stopPropagation=function(){this.propagationStopped=!0},t}(),h="propertychange",p=function(){function t(){this.disposed=!1}return t.prototype.dispose=function(){this.disposed||(this.disposed=!0,this.disposeInternal())},t.prototype.disposeInternal=function(){},t}();function f(t,e,r){for(var n,i,o=r||d,a=0,s=t.length,l=!1;a>1)],e))<0?a=n+1:(s=n,l=!i);return l?a:~a}function d(t,e){return t>e?1:t=0}function y(t,e,r){var n=t.length;if(t[0]<=e)return 0;if(e<=t[n-1])return n-1;var i=void 0;if(r>0){for(i=1;i>>0,i=0;i0||r&&0===o)}))}function S(){return!0}function E(){return!1}function T(){}function C(t){var e,r,n,i=!1;return function(){var o=Array.prototype.slice.call(arguments);return i&&this===n&&b(o,r)||(i=!0,n=this,r=o,e=t.apply(this,arguments)),e}}var O="function"==typeof Object.assign?Object.assign:function(t,e){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var r=Object(t),n=1,i=arguments.length;n0)},e.prototype.removeEventListener=function(t,e){var r=this.listeners_&&this.listeners_[t];if(r){var n=r.indexOf(e);-1!==n&&(this.pendingRemovals_&&t in this.pendingRemovals_?(r[n]=T,++this.pendingRemovals_[t]):(r.splice(n,1),0===r.length&&delete this.listeners_[t]))}},e}(p),F="change",A="error",k="clear",j="contextmenu",N="click",D="dblclick",G="dragenter",z="dragover",U="drop",B="keydown",V="keypress",Y="load",W="resize",q="touchmove",X="wheel";function Z(t,e,r,n,i){if(n&&n!==t&&(r=r.bind(n)),i){var o=r;r=function(){t.removeEventListener(e,r),o.apply(this,arguments)}}var a={target:t,type:e,listener:r};return t.addEventListener(e,r),a}function K(t,e,r,n){return Z(t,e,r,n,!0)}function H(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),P(t))}var $=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function J(t){if(Array.isArray(t))for(var e=0,r=t.length;e0;)this.pop()},e.prototype.extend=function(t){for(var e=0,r=t.length;ei&&(l|=qt),so&&(l|=Wt),l===Vt&&(l=Yt),l}function ne(){return[1/0,1/0,-1/0,-1/0]}function ie(t,e,r,n,i){return i?(i[0]=t,i[1]=e,i[2]=r,i[3]=n,i):[t,e,r,n]}function oe(t){return ie(1/0,1/0,-1/0,-1/0,t)}function ae(t,e){var r=t[0],n=t[1];return ie(r,n,r,n,e)}function se(t,e){return fe(oe(e),t)}function le(t,e,r,n,i){return de(oe(i),t,e,r,n)}function ue(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function ce(t,e,r){return Math.abs(t[0]-e[0])t[2]&&(t[2]=e[2]),e[1]t[3]&&(t[3]=e[3]),t}function pe(t,e){e[0]t[2]&&(t[2]=e[0]),e[1]t[3]&&(t[3]=e[1])}function fe(t,e){for(var r=0,n=e.length;re[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function Ie(t){return t[2]=a&&g<=l),n||!(o&qt)||i&qt||(n=(y=f-(p-l)*d)>=s&&y<=u),n||!(o&Xt)||i&Xt||(n=(g=p-(f-s)/d)>=a&&g<=l),n||!(o&Zt)||i&Zt||(n=(y=f-(p-a)*d)>=s&&y<=u)}return n}function Ae(t,e,r,n){var i=[];if(n>1)for(var o=t[2]-t[0],a=t[3]-t[1],s=0;s=r[2])){var i=Pe(r),o=Math.floor((n[0]-r[0])/i)*i;t[0]-=o,t[2]-=o}return t}var je=function(){function t(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}return t.prototype.canWrapX=function(){return this.canWrapX_},t.prototype.getCode=function(){return this.code_},t.prototype.getExtent=function(){return this.extent_},t.prototype.getUnits=function(){return this.units_},t.prototype.getMetersPerUnit=function(){return this.metersPerUnit_||wt[this.units_]},t.prototype.getWorldExtent=function(){return this.worldExtent_},t.prototype.getAxisOrientation=function(){return this.axisOrientation_},t.prototype.isGlobal=function(){return this.global_},t.prototype.setGlobal=function(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)},t.prototype.getDefaultTileGrid=function(){return this.defaultTileGrid_},t.prototype.setDefaultTileGrid=function(t){this.defaultTileGrid_=t},t.prototype.setExtent=function(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)},t.prototype.setWorldExtent=function(t){this.worldExtent_=t},t.prototype.setGetPointResolution=function(t){this.getPointResolutionFunc_=t},t.prototype.getPointResolutionFunc=function(){return this.getPointResolutionFunc_},t}();function Ne(t,e,r){return Math.min(Math.max(t,e),r)}var De="cosh"in Math?Math.cosh:function(t){var e=Math.exp(t);return(e+1/e)/2},Ge="log2"in Math?Math.log2:function(t){return Math.log(t)*Math.LOG2E};function ze(t,e,r,n,i,o){var a=i-r,s=o-n;if(0!==a||0!==s){var l=((t-r)*a+(e-n)*s)/(a*a+s*s);l>1?(r=i,n=o):l>0&&(r+=a*l,n+=s*l)}return Ue(t,e,r,n)}function Ue(t,e,r,n){var i=r-t,o=n-e;return i*i+o*o}function Be(t){for(var e=t.length,r=0;ri&&(i=a,n=o)}if(0===i)return null;var s=t[n];t[n]=t[r],t[r]=s;for(var l=r+1;l=0;p--){h[p]=t[p][e]/t[p][p];for(var f=p-1;f>=0;f--)t[f][e]-=t[f][p]*h[p]}return h}function Ve(t){return 180*t/Math.PI}function Ye(t){return t*Math.PI/180}function We(t,e){var r=t%e;return r*e<0?r+e:r}function qe(t,e,r){return t+r*(e-t)}var Xe=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ze=6378137*Math.PI,Ke=[-Ze,-Ze,Ze,Ze],He=[-180,-85,180,85],$e=6378137*Math.log(Math.tan(Math.PI/2)),Je=function(t){function e(e){return t.call(this,{code:e,units:St.METERS,extent:Ke,global:!0,worldExtent:He,getPointResolution:function(t,e){return t/De(e[1]/6378137)}})||this}return Xe(e,t),e}(je),Qe=[new Je("EPSG:3857"),new Je("EPSG:102100"),new Je("EPSG:102113"),new Je("EPSG:900913"),new Je("http://www.opengis.net/gml/srs/epsg.xml#3857")];function tr(t,e,r){var n=t.length,i=r>1?r:2,o=e;void 0===o&&(o=i>2?t.slice():new Array(n));for(var a=0;a$e?s=$e:s<-$e&&(s=-$e),o[a+1]=s}return o}function er(t,e,r){var n=t.length,i=r>1?r:2,o=e;void 0===o&&(o=i>2?t.slice():new Array(n));for(var a=0;ae?n:new Array(1+e-i).join("0")+n}function br(t,e){for(var r=(""+t).split("."),n=(""+e).split("."),i=0;ia)return 1;if(a>o)return-1}return 0}function xr(t,e){return t[0]+=+e[0],t[1]+=+e[1],t}function wr(t,e){var r=e.getRadius(),n=e.getCenter(),i=n[0],o=n[1],a=t[0]-i,s=t[1]-o;0===a&&0===s&&(a=1);var l=Math.sqrt(a*a+s*s);return[i+r*a/l,o+r*s/l]}function Sr(t,e){var r,n,i=t[0],o=t[1],a=e[0],s=e[1],l=a[0],u=a[1],c=s[0],h=s[1],p=c-l,f=h-u,d=0===p&&0===f?0:(p*(i-l)+f*(o-u))/(p*p+f*f||0);return d<=0?(r=l,n=u):d>=1?(r=c,n=h):(r=l+d*p,n=u+d*f),[r,n]}function Er(t,e,r){var n=We(e+180,360)-180,i=Math.abs(3600*n),o=r||0,a=Math.pow(10,o),s=Math.floor(i/3600),l=Math.floor((i-3600*s)/60),u=i-3600*s-60*l;return(u=Math.ceil(u*a)/a)>=60&&(u=0,l+=1),l>=60&&(l=0,s+=1),s+"° "+_r(l,2)+"′ "+_r(u,2,o)+"″"+(0==n?"":" "+t.charAt(n<0?1:0))}function Tr(t,e,r){return t?e.replace("{x}",t[0].toFixed(r)).replace("{y}",t[1].toFixed(r)):""}function Cr(t,e){for(var r=!0,n=t.length-1;n>=0;--n)if(t[n]!=e[n]){r=!1;break}return r}function Or(t,e){var r=Math.cos(e),n=Math.sin(e),i=t[0]*r-t[1]*n,o=t[1]*r+t[0]*n;return t[0]=i,t[1]=o,t}function Pr(t,e){return t[0]*=e,t[1]*=e,t}function Rr(t,e){var r=t[0]-e[0],n=t[1]-e[1];return r*r+n*n}function Ir(t,e){return Math.sqrt(Rr(t,e))}function Lr(t,e){return Rr(t,Sr(t,e))}function Mr(t,e){return Tr(t,"{x}, {y}",e)}function Fr(t,e){if(e.canWrapX()){var r=Pe(e.getExtent()),n=Ar(t,e,r);n&&(t[0]-=n*r)}return t}function Ar(t,e,r){var n=e.getExtent(),i=0;if(e.canWrapX()&&(t[0]n[2])){var o=r||Pe(n);i=Math.floor((t[0]-n[0])/o)}return i}function kr(t,e,r){var n;if(void 0!==e){for(var i=0,o=t.length;i=2;--u)a[s+u]=e[s+u]}return a}}function Wr(t,e,r,n){var i=Gr(t),o=Gr(e);fr(i,o,Yr(r)),fr(o,i,Yr(n))}function qr(t,e){return Hr(t,"EPSG:4326",void 0!==e?e:"EPSG:3857")}function Xr(t,e){if(t===e)return!0;var r=t.getUnits()===e.getUnits();return(t.getCode()===e.getCode()||Zr(t,e)===kr)&&r}function Zr(t,e){var r=dr(t.getCode(),e.getCode());return r||(r=jr),r}function Kr(t,e){return Zr(Gr(t),Gr(e))}function Hr(t,e,r){return Kr(e,r)(t,void 0,t.length)}function $r(t,e,r,n){return Ae(t,Kr(e,r),void 0,n)}var Jr=null;function Qr(t){Jr=Gr(t)}function tn(){return Jr}function en(t,e){return Jr?Hr(t,e,Jr):t}function rn(t,e){return Jr?Hr(t,Jr,e):t}function nn(t,e){return Jr?$r(t,e,Jr):t}function on(t,e){return Jr?$r(t,Jr,e):t}function an(t,e,r){return function(n){var i,o,a=n[0],s=n[1];if(t.canWrapX()){var l=t.getExtent(),u=Pe(l);(o=Ar(n,t,u))&&(a-=o*u),a=Ne(a,l[0],l[2]),s=Ne(s,l[1],l[3]),i=r([a,s])}else i=r(n);return o&&e.canWrapX()&&(i[0]+=o*Pe(e.getExtent())),i}}function sn(){Ur(Qe),Ur(ar),Br(ar,Qe,tr,er)}function ln(t,e,r,n,i,o){for(var a=o||[],s=0,l=e;l1)s=r;else{if(p>0){for(var f=0;fi&&(i=u),o=s,a=l}return i}function xn(t,e,r,n,i){for(var o=0,a=r.length;o0;){for(var h=u.pop(),p=u.pop(),f=0,d=t[p],g=t[p+1],y=t[h],m=t[h+1],v=p+n;vf&&(c=v,f=_)}f>i&&(l[(c-e)/n]=1,p+ni&&(o[a++]=u,o[a++]=c,s=u,l=c);return u==s&&c==l||(o[a++]=u,o[a++]=c),a}function Fn(t,e){return e*Math.round(t/e)}function An(t,e,r,n,i,o,a){if(e==r)return a;var s,l,u=Fn(t[e],i),c=Fn(t[e+1],i);e+=n,o[a++]=u,o[a++]=c;do{if(s=Fn(t[e],i),l=Fn(t[e+1],i),(e+=n)==r)return o[a++]=s,o[a++]=l,a}while(s==u&&l==c);for(;e0&&g>f)&&(d<0&&y0&&y>d)?(s=h,l=p):(o[a++]=s,o[a++]=l,u=s,c=l,s=h,l=p)}}return o[a++]=s,o[a++]=l,a}function kn(t,e,r,n,i,o,a,s){for(var l=0,u=r.length;lo&&(u-s)*(o-l)-(i-s)*(c-l)>0&&a++:c<=o&&(u-s)*(o-l)-(i-s)*(c-l)<0&&a--,s=u,l=c}return 0!==a}function Kn(t,e,r,n,i,o){if(0===r.length)return!1;if(!Zn(t,e,r[0],n,i,o))return!1;for(var a=1,s=r.length;ax&&Kn(t,e,r,n,u=(c+h)/2,g)&&(b=u,x=w),c=h}return isNaN(b)&&(b=i[o]),a?(a.push(b,g,x),a):[b,g,x]}function Jn(t,e,r,n,i){for(var o=[],a=0,s=r.length;a=i[0]&&o[2]<=i[2]||(o[1]>=i[1]&&o[3]<=i[3]||Qn(t,e,r,n,(function(t,e){return Fe(i,t,e)})))))}function ei(t,e,r,n,i){for(var o=0,a=r.length;o0}function si(t,e,r,n,i){for(var o=void 0!==i&&i,a=0,s=r.length;at)throw new Error("Tile load sequence violation");this.state=t,this.changed()},e.prototype.load=function(){n()},e.prototype.getAlpha=function(t,e){if(!this.transition_)return 1;var r=this.transitionStarts_[t];if(r){if(-1===r)return 1}else r=e,this.transitionStarts_[t]=r;var n=e-r+1e3/60;return n>=this.transition_?1:no(n/this.transition_)},e.prototype.inTransition=function(t){return!!this.transition_&&-1!==this.transitionStarts_[t]},e.prototype.endTransition=function(t){this.transition_&&(this.transitionStarts_[t]=-1)},e}(M);function uo(t,e,r){var n=r&&r.length?r.shift():Yi?new OffscreenCanvas(t||300,e||300):document.createElement("canvas");return t&&(n.width=t),e&&(n.height=e),n.getContext("2d")}function co(t){var e=t.offsetWidth,r=getComputedStyle(t);return e+=parseInt(r.marginLeft,10)+parseInt(r.marginRight,10)}function ho(t){var e=t.offsetHeight,r=getComputedStyle(t);return e+=parseInt(r.marginTop,10)+parseInt(r.marginBottom,10)}function po(t,e){var r=e.parentNode;r&&r.replaceChild(t,e)}function fo(t){return t&&t.parentNode?t.parentNode.removeChild(t):null}function go(t){for(;t.lastChild;)t.removeChild(t.lastChild)}function yo(t,e){for(var r=t.childNodes,n=0;;++n){var i=r[n],o=e[n];if(!i&&!o)break;i!==o&&(i?o?t.insertBefore(o,i):(t.removeChild(i),--n):t.appendChild(o))}}var mo=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();var vo=function(t){function e(e,r,n,i,o,a){var s=t.call(this,e,r,a)||this;return s.crossOrigin_=i,s.src_=n,s.key=n,s.image_=new Image,null!==i&&(s.image_.crossOrigin=i),s.unlisten_=null,s.tileLoadFunction_=o,s}return mo(e,t),e.prototype.getImage=function(){return this.image_},e.prototype.handleImageError_=function(){var t;this.state=eo,this.unlistenImage_(),this.image_=((t=uo(1,1)).fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas),this.changed()},e.prototype.handleImageLoad_=function(){var t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=to:this.state=ro,this.unlistenImage_(),this.changed()},e.prototype.load=function(){this.state==eo&&(this.state=Ji,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==Ji&&(this.state=Qi,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=Zi(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},e.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},e}(lo),_o=function(){function t(t,e,r){this.decay_=t,this.minVelocity_=e,this.delay_=r,this.points_=[],this.angle_=0,this.initialVelocity_=0}return t.prototype.begin=function(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0},t.prototype.update=function(t,e){this.points_.push(t,e,Date.now())},t.prototype.end=function(){if(this.points_.length<6)return!1;var t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]0&&this.points_[r+2]>t;)r-=3;var n=this.points_[e+2]-this.points_[r+2];if(n<1e3/60)return!1;var i=this.points_[e]-this.points_[r],o=this.points_[e+1]-this.points_[r+1];return this.angle_=Math.atan2(o,i),this.initialVelocity_=Math.sqrt(i*i+o*o)/n,this.initialVelocity_>this.minVelocity_},t.prototype.getDistance=function(){return(this.minVelocity_-this.initialVelocity_)/this.decay_},t.prototype.getAngle=function(){return this.angle_},t}(),bo=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,xo=/^([a-z]*)$|^hsla?\(.*\)$/i;function wo(t){return"string"==typeof t?t:Ro(t)}function So(t){var e=document.createElement("div");if(e.style.color=t,""!==e.style.color){document.body.appendChild(e);var r=getComputedStyle(e).color;return document.body.removeChild(e),r}return""}var Eo,To,Co=(Eo={},To=0,function(t){var e;if(Eo.hasOwnProperty(t))e=Eo[t];else{if(To>=1024){var r=0;for(var n in Eo)0==(3&r++)&&(delete Eo[n],--To)}e=function(t){var e,r,n,i,o;if(xo.exec(t)&&(t=So(t)),bo.exec(t)){var a=t.length-1,s=void 0;s=a<=4?1:2;var l=4===a||8===a;e=parseInt(t.substr(1+0*s,s),16),r=parseInt(t.substr(1+1*s,s),16),n=parseInt(t.substr(1+2*s,s),16),i=l?parseInt(t.substr(1+3*s,s),16):255,1==s&&(e=(e<<4)+e,r=(r<<4)+r,n=(n<<4)+n,l&&(i=(i<<4)+i)),o=[e,r,n,i/255]}else 0==t.indexOf("rgba(")?Po(o=t.slice(5,-1).split(",").map(Number)):0==t.indexOf("rgb(")?((o=t.slice(4,-1).split(",").map(Number)).push(1),Po(o)):pt(!1,14);return o}(t),Eo[t]=e,++To}return e});function Oo(t){return Array.isArray(t)?t:Co(t)}function Po(t){return t[0]=Ne(t[0]+.5|0,0,255),t[1]=Ne(t[1]+.5|0,0,255),t[2]=Ne(t[2]+.5|0,0,255),t[3]=Ne(t[3],0,1),t}function Ro(t){var e=t[0];e!=(0|e)&&(e=e+.5|0);var r=t[1];r!=(0|r)&&(r=r+.5|0);var n=t[2];return n!=(0|n)&&(n=n+.5|0),"rgba("+e+","+r+","+n+","+(void 0===t[3]?1:t[3])+")"}function Io(t){return xo.test(t)&&(t=So(t)),bo.test(t)||0===t.indexOf("rgba(")||0===t.indexOf("rgb(")}var Lo=function(){function t(){this.cache_={},this.cacheSize_=0,this.maxCacheSize_=32}return t.prototype.clear=function(){this.cache_={},this.cacheSize_=0},t.prototype.canExpireCache=function(){return this.cacheSize_>this.maxCacheSize_},t.prototype.expire=function(){if(this.canExpireCache()){var t=0;for(var e in this.cache_){var r=this.cache_[e];0!=(3&t++)||r.hasListener()||(delete this.cache_[e],--this.cacheSize_)}}},t.prototype.get=function(t,e,r){var n=Mo(t,e,r);return n in this.cache_?this.cache_[n]:null},t.prototype.set=function(t,e,r,n){var i=Mo(t,e,r);this.cache_[i]=n,++this.cacheSize_},t.prototype.setSize=function(t){this.maxCacheSize_=t,this.expire()},t}();function Mo(t,e,r){return e+":"+t+":"+(r?wo(r):"null")}var Fo=Lo,Ao=new Lo,ko="opacity",jo="visible",No="extent",Do="zIndex",Go="maxResolution",zo="minResolution",Uo="maxZoom",Bo="minZoom",Vo="source",Yo=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Wo=function(t){function e(e){var r=t.call(this)||this,n=O({},e);return n[ko]=void 0!==e.opacity?e.opacity:1,pt("number"==typeof n[ko],64),n[jo]=void 0===e.visible||e.visible,n[Do]=e.zIndex,n[Go]=void 0!==e.maxResolution?e.maxResolution:1/0,n[zo]=void 0!==e.minResolution?e.minResolution:0,n[Bo]=void 0!==e.minZoom?e.minZoom:-1/0,n[Uo]=void 0!==e.maxZoom?e.maxZoom:1/0,r.className_=void 0!==n.className?e.className:"ol-layer",delete n.className,r.setProperties(n),r.state_=null,r}return Yo(e,t),e.prototype.getClassName=function(){return this.className_},e.prototype.getLayerState=function(t){var e=this.state_||{layer:this,managed:void 0===t||t},r=this.getZIndex();return e.opacity=Ne(Math.round(100*this.getOpacity())/100,0,1),e.sourceState=this.getSourceState(),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=void 0!==r?r:!1===e.managed?1/0:0,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e},e.prototype.getLayersArray=function(t){return n()},e.prototype.getLayerStatesArray=function(t){return n()},e.prototype.getExtent=function(){return this.get(No)},e.prototype.getMaxResolution=function(){return this.get(Go)},e.prototype.getMinResolution=function(){return this.get(zo)},e.prototype.getMinZoom=function(){return this.get(Bo)},e.prototype.getMaxZoom=function(){return this.get(Uo)},e.prototype.getOpacity=function(){return this.get(ko)},e.prototype.getSourceState=function(){return n()},e.prototype.getVisible=function(){return this.get(jo)},e.prototype.getZIndex=function(){return this.get(Do)},e.prototype.setExtent=function(t){this.set(No,t)},e.prototype.setMaxResolution=function(t){this.set(Go,t)},e.prototype.setMinResolution=function(t){this.set(zo,t)},e.prototype.setMaxZoom=function(t){this.set(Uo,t)},e.prototype.setMinZoom=function(t){this.set(Bo,t)},e.prototype.setOpacity=function(t){pt("number"==typeof t,64),this.set(ko,t)},e.prototype.setVisible=function(t){this.set(jo,t)},e.prototype.setZIndex=function(t){this.set(Do,t)},e.prototype.disposeInternal=function(){this.state_&&(this.state_.layer=null,this.state_=null),t.prototype.disposeInternal.call(this)},e}(ot),qo="prerender",Xo="postrender",Zo="precompose",Ko="postcompose",Ho="rendercomplete",$o="undefined",Jo="loading",Qo="ready",ta="error",ea=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function ra(t,e){if(!t.visible)return!1;var r=e.resolution;if(r=t.maxResolution)return!1;var n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}var na=function(t){function e(e){var r=this,n=O({},e);delete n.source,(r=t.call(this,n)||this).mapPrecomposeKey_=null,r.mapRenderKey_=null,r.sourceChangeKey_=null,r.renderer_=null,e.render&&(r.render=e.render),e.map&&r.setMap(e.map),r.addEventListener(it(Vo),r.handleSourcePropertyChange_);var i=e.source?e.source:null;return r.setSource(i),r}return ea(e,t),e.prototype.getLayersArray=function(t){var e=t||[];return e.push(this),e},e.prototype.getLayerStatesArray=function(t){var e=t||[];return e.push(this.getLayerState()),e},e.prototype.getSource=function(){return this.get(Vo)||null},e.prototype.getSourceState=function(){var t=this.getSource();return t?t.getState():$o},e.prototype.handleSourceChange_=function(){this.changed()},e.prototype.handleSourcePropertyChange_=function(){this.sourceChangeKey_&&(H(this.sourceChangeKey_),this.sourceChangeKey_=null);var t=this.getSource();t&&(this.sourceChangeKey_=Z(t,F,this.handleSourceChange_,this)),this.changed()},e.prototype.getFeatures=function(t){return this.renderer_.getFeatures(t)},e.prototype.render=function(t,e){var r=this.getRenderer();if(r.prepareFrame(t))return r.renderFrame(t,e)},e.prototype.setMap=function(t){this.mapPrecomposeKey_&&(H(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(H(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=Z(t,Zo,(function(t){var e=t.frameState.layerStatesArray,r=this.getLayerState(!1);pt(!e.some((function(t){return t.layer===r.layer})),67),e.push(r)}),this),this.mapRenderKey_=Z(this,F,t.render,t),this.changed())},e.prototype.setSource=function(t){this.set(Vo,t)},e.prototype.getRenderer=function(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_},e.prototype.hasRenderer=function(){return!!this.renderer_},e.prototype.createRenderer=function(){return null},e.prototype.disposeInternal=function(){this.setSource(null),t.prototype.disposeInternal.call(this)},e}(Wo),ia=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function oa(t,e){Ao.expire()}var aa=function(t){function e(e){var r=t.call(this)||this;return r.map_=e,r}return ia(e,t),e.prototype.dispatchRenderEvent=function(t,e){n()},e.prototype.calculateMatrices2D=function(t){var e=t.viewState,r=t.coordinateToPixelTransform,n=t.pixelToCoordinateTransform;kt(r,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),jt(n,r)},e.prototype.forEachFeatureAtCoordinate=function(t,e,r,n,i,o,a,s){var l,u=e.viewState;function c(t,e,r,n){return i.call(o,e,t?r:null,n)}var h=u.projection,p=Fr(t.slice(),h),f=[[0,0]];if(h.canWrapX()&&n){var d=Pe(h.getExtent());f.push([-d,0],[d,0])}for(var g=e.layerStatesArray,y=g.length,m=[],v=[],_=0;_=0;--b){var x=g[b],w=x.layer;if(w.hasRenderer()&&ra(x,u)&&a.call(s,w)){var S=w.getRenderer(),E=w.getSource();if(S&&E){var T=E.getWrapX()?p:t,C=c.bind(null,x.managed);v[0]=T[0]+f[_][0],v[1]=T[1]+f[_][1],l=S.forEachFeatureAtCoordinate(v,e,r,C,m)}if(l)return l}}if(0!==m.length){var O=1/m.length;return m.forEach((function(t,e){return t.distanceSq+=e*O})),m.sort((function(t,e){return t.distanceSq-e.distanceSq})),m.some((function(t){return l=t.callback(t.feature,t.layer,t.geometry)})),l}},e.prototype.forEachLayerAtPixel=function(t,e,r,i,o){return n()},e.prototype.hasFeatureAtCoordinate=function(t,e,r,n,i,o){return void 0!==this.forEachFeatureAtCoordinate(t,e,r,n,S,this,i,o)},e.prototype.getMap=function(){return this.map_},e.prototype.renderFrame=function(t){n()},e.prototype.scheduleExpireIconCache=function(t){Ao.canExpireCache()&&t.postRenderFunctions.push(oa)},e}(p),sa=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),la=function(t){function e(e,r,n,i){var o=t.call(this,e)||this;return o.inversePixelTransform=r,o.frameState=n,o.context=i,o}return sa(e,t),e}(c),ua=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))","?\\s*([-,\\\"\\'\\sa-z]+?)\\s*$"].join(""),"i"),ca=["style","variant","weight","size","lineHeight","family"],ha=function(t){var e=t.match(ua);if(!e)return null;for(var r={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"},n=0,i=ca.length;n=0;--o)n[o].renderDeclutter(t);yo(this.element_,this.children_),this.dispatchRenderEvent(Ko,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}else this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1)},e.prototype.forEachLayerAtPixel=function(t,e,r,n,i){for(var o=e.viewState,a=e.layerStatesArray,s=a.length-1;s>=0;--s){var l=a[s],u=l.layer;if(u.hasRenderer()&&ra(l,o)&&i(u)){var c=u.getRenderer().getDataAtPixel(t,e,r);if(c){var h=n(u,c);if(h)return h}}}},e}(aa),Ma=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Fa="layers",Aa=function(t){function e(e){var r=this,n=e||{},i=O({},n);delete i.layers;var o=n.layers;return(r=t.call(this,i)||this).layersListenerKeys_=[],r.listenerKeys_={},r.addEventListener(it(Fa),r.handleLayersChanged_),o?Array.isArray(o)?o=new ht(o.slice(),{unique:!0}):pt("function"==typeof o.getArray,43):o=new ht(void 0,{unique:!0}),r.setLayers(o),r}return Ma(e,t),e.prototype.handleLayerChange_=function(){this.changed()},e.prototype.handleLayersChanged_=function(){this.layersListenerKeys_.forEach(H),this.layersListenerKeys_.length=0;var t=this.getLayers();for(var e in this.layersListenerKeys_.push(Z(t,at,this.handleLayersAdd_,this),Z(t,st,this.handleLayersRemove_,this)),this.listenerKeys_)this.listenerKeys_[e].forEach(H);P(this.listenerKeys_);for(var r=t.getArray(),n=0,i=r.length;nthis.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_},e.prototype.disposeInternal=function(){this.relayedListenerKey_&&(H(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(q,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(H(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(H),this.dragListenerKeys_.length=0,this.element_=null,t.prototype.disposeInternal.call(this)},e}(M),qa="postrender",Xa="movestart",Za="moveend",Ka="layergroup",Ha="size",$a="target",Ja="view",Qa=function(){function t(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}return t.prototype.clear=function(){this.elements_.length=0,this.priorities_.length=0,P(this.queuedElements_)},t.prototype.dequeue=function(){var t=this.elements_,e=this.priorities_,r=t[0];1==t.length?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));var n=this.keyFunction_(r);return delete this.queuedElements_[n],r},t.prototype.enqueue=function(t){pt(!(this.keyFunction_(t)in this.queuedElements_),31);var e=this.priorityFunction_(t);return e!=1/0&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)},t.prototype.getCount=function(){return this.elements_.length},t.prototype.getLeftChildIndex_=function(t){return 2*t+1},t.prototype.getRightChildIndex_=function(t){return 2*t+2},t.prototype.getParentIndex_=function(t){return t-1>>1},t.prototype.heapify_=function(){var t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)},t.prototype.isEmpty=function(){return 0===this.elements_.length},t.prototype.isKeyQueued=function(t){return t in this.queuedElements_},t.prototype.isQueued=function(t){return this.isKeyQueued(this.keyFunction_(t))},t.prototype.siftUp_=function(t){for(var e=this.elements_,r=this.priorities_,n=e.length,i=e[t],o=r[t],a=t;t>1;){var s=this.getLeftChildIndex_(t),l=this.getRightChildIndex_(t),u=lt;){var a=this.getParentIndex_(e);if(!(n[a]>o))break;r[e]=r[a],n[e]=n[a],e=a}r[e]=i,n[e]=o},t.prototype.reprioritize=function(){var t,e,r,n=this.priorityFunction_,i=this.elements_,o=this.priorities_,a=0,s=i.length;for(e=0;e0;)n=(r=this.dequeue()[0]).getKey(),r.getState()!==Ji||n in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[n]=!0,++this.tilesLoading_,++i,r.load())},e}(Qa);function rs(t,e,r,n,i){if(!t||!(r in t.wantedTiles))return 1/0;if(!t.wantedTiles[r][e.getKey()])return 1/0;var o=t.viewState.center,a=n[0]-o[0],s=n[1]-o[1];return 65536*Math.log(i)+Math.sqrt(a*a+s*s)/i}var ns=0,is=1,os="center",as="resolution",ss="rotation";function ls(t,e,r){return function(n,i,o,a,s){if(n){var l=e?0:o[0]*i,u=e?0:o[1]*i,c=s?s[0]:0,h=s?s[1]:0,p=t[0]+l/2+c,f=t[2]-l/2+c,d=t[1]+u/2+h,g=t[3]-u/2+h;p>f&&(f=p=(f+p)/2),d>g&&(g=d=(g+d)/2);var y=Ne(n[0],p,f),m=Ne(n[1],d,g),v=30*i;return a&&r&&(y+=-v*Math.log(1+Math.max(0,p-n[0])/v)+v*Math.log(1+Math.max(0,n[0]-f)/v),m+=-v*Math.log(1+Math.max(0,d-n[1])/v)+v*Math.log(1+Math.max(0,n[1]-g)/v)),[y,m]}}}function us(t){return t}function cs(t,e,r,n){var i=Pe(e)/r[0],o=Ee(e)/r[1];return n?Math.min(t,Math.max(i,o)):Math.min(t,Math.min(i,o))}function hs(t,e,r){var n=Math.min(t,e);return n*=Math.log(1+50*Math.max(0,t/e-1))/50+1,r&&(n=Math.max(n,r),n/=Math.log(1+50*Math.max(0,r/t-1))/50+1),Ne(n,r/2,2*e)}function ps(t,e,r,n){return function(i,o,a,s){if(void 0!==i){var l=t[0],u=t[t.length-1],c=r?cs(l,r,a,n):l;if(s)return void 0===e||e?hs(i,c,u):Ne(i,u,c);var h=Math.min(c,i),p=Math.floor(y(t,h,o));return t[p]>c&&p1&&"function"==typeof arguments[r-1]&&(e=arguments[r-1],--r),!this.isDef()){var n=arguments[r-1];return n.center&&this.setCenterInternal(n.center),void 0!==n.zoom&&this.setZoom(n.zoom),void 0!==n.rotation&&this.setRotation(n.rotation),void(e&&bs(e,!0))}for(var i=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,s=this.targetRotation_,l=[],u=0;u0},e.prototype.getInteracting=function(){return this.hints_[is]>0},e.prototype.cancelAnimations=function(){var t;this.setHint(ns,-this.hints_[ns]);for(var e=0,r=this.animations_.length;e=0;--r){for(var n=this.animations_[r],i=!0,o=0,a=n.length;o0?l/s.duration:1;u>=1?(s.complete=!0,u=1):i=!1;var c=s.easing(u);if(s.sourceCenter){var h=s.sourceCenter[0],p=s.sourceCenter[1],f=h+c*(s.targetCenter[0]-h),d=p+c*(s.targetCenter[1]-p);this.targetCenter_=[f,d]}if(s.sourceResolution&&s.targetResolution){var g=1===c?s.targetResolution:s.sourceResolution+c*(s.targetResolution-s.sourceResolution);if(s.anchor){var y=this.getViewportSize_(this.getRotation()),m=this.constraints_.resolution(g,0,y,!0);this.targetCenter_=this.calculateCenterZoom(m,s.anchor)}this.targetResolution_=g,this.applyTargetState_(!0)}if(void 0!==s.sourceRotation&&void 0!==s.targetRotation){var v=1===c?We(s.targetRotation+Math.PI,2*Math.PI)-Math.PI:s.sourceRotation+c*(s.targetRotation-s.sourceRotation);if(s.anchor){var _=this.constraints_.rotation(v,!0);this.targetCenter_=this.calculateCenterRotate(_,s.anchor)}this.targetRotation_=v}if(this.applyTargetState_(!0),e=!0,!s.complete)break}}if(i){this.animations_[r]=null,this.setHint(ns,-1);var b=n[0].callback;b&&bs(b,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}},e.prototype.calculateCenterRotate=function(t,e){var r,n=this.getCenterInternal();return void 0!==n&&(Or(r=[n[0]-e[0],n[1]-e[1]],t-this.getRotation()),xr(r,e)),r},e.prototype.calculateCenterZoom=function(t,e){var r,n=this.getCenterInternal(),i=this.getResolution();void 0!==n&&void 0!==i&&(r=[e[0]-t*(e[0]-n[0])/i,e[1]-t*(e[1]-n[1])/i]);return r},e.prototype.getViewportSize_=function(t){var e=this.viewportSize_;if(t){var r=e[0],n=e[1];return[Math.abs(r*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(r*Math.sin(t))+Math.abs(n*Math.cos(t))]}return e},e.prototype.setViewportSize=function(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)},e.prototype.getCenter=function(){var t=this.getCenterInternal();return t?en(t,this.getProjection()):t},e.prototype.getCenterInternal=function(){return this.get(os)},e.prototype.getConstraints=function(){return this.constraints_},e.prototype.getConstrainResolution=function(){return this.options_.constrainResolution},e.prototype.getHints=function(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()},e.prototype.calculateExtent=function(t){return nn(this.calculateExtentInternal(t),this.getProjection())},e.prototype.calculateExtentInternal=function(t){var e=t||this.getViewportSize_(),r=this.getCenterInternal();pt(r,1);var n=this.getResolution();pt(void 0!==n,2);var i=this.getRotation();return pt(void 0!==i,3),Se(r,n,i,e)},e.prototype.getMaxResolution=function(){return this.maxResolution_},e.prototype.getMinResolution=function(){return this.minResolution_},e.prototype.getMaxZoom=function(){return this.getZoomForResolution(this.minResolution_)},e.prototype.setMaxZoom=function(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))},e.prototype.getMinZoom=function(){return this.getZoomForResolution(this.maxResolution_)},e.prototype.setMinZoom=function(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))},e.prototype.setConstrainResolution=function(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))},e.prototype.getProjection=function(){return this.projection_},e.prototype.getResolution=function(){return this.get(as)},e.prototype.getResolutions=function(){return this.resolutions_},e.prototype.getResolutionForExtent=function(t,e){return this.getResolutionForExtentInternal(on(t,this.getProjection()),e)},e.prototype.getResolutionForExtentInternal=function(t,e){var r=e||this.getViewportSize_(),n=Pe(t)/r[0],i=Ee(t)/r[1];return Math.max(n,i)},e.prototype.getResolutionForValueFunction=function(t){var e=t||2,r=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,i=Math.log(r/n)/Math.log(e);return function(t){return r/Math.pow(e,t*i)}},e.prototype.getRotation=function(){return this.get(ss)},e.prototype.getValueForResolutionFunction=function(t){var e=Math.log(t||2),r=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,i=Math.log(r/n)/e;return function(t){return Math.log(r/t)/e/i}},e.prototype.getViewportSizeMinusPadding_=function(t){var e=this.getViewportSize_(t),r=this.padding;return r&&(e=[e[0]-r[1]-r[3],e[1]-r[0]-r[2]]),e},e.prototype.getState=function(){var t=this.getProjection(),e=this.getResolution(),r=this.getRotation(),n=this.getCenterInternal(),i=this.padding;if(i){var o=this.getViewportSizeMinusPadding_();n=Ts(n,this.getViewportSize_(),[o[0]/2+i[3],o[1]/2+i[0]],e,r)}return{center:n.slice(0),projection:void 0!==t?t:null,resolution:e,rotation:r,zoom:this.getZoom()}},e.prototype.getZoom=function(){var t,e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t},e.prototype.getZoomForResolution=function(t){var e,r,n=this.minZoom_||0;if(this.resolutions_){var i=y(this.resolutions_,t,1);n=i,e=this.resolutions_[i],r=i==this.resolutions_.length-1?2:e/this.resolutions_[i+1]}else e=this.maxResolution_,r=this.zoomFactor_;return n+Math.log(e/t)/Math.log(r)},e.prototype.getResolutionForZoom=function(t){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;var e=Ne(Math.floor(t),0,this.resolutions_.length-2),r=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(r,Ne(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)},e.prototype.fit=function(t,e){var r;if(pt(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,24),Array.isArray(t))pt(!Ie(t),25),r=gi(n=on(t,this.getProjection()));else if(t.getType()===bt.CIRCLE){var n;(r=gi(n=on(t.getExtent(),this.getProjection()))).rotate(this.getRotation(),xe(n))}else{var i=tn();r=i?t.clone().transform(i,this.getProjection()):t}this.fitInternal(r,e)},e.prototype.fitInternal=function(t,e){var r=e||{},n=r.size;n||(n=this.getViewportSizeMinusPadding_());var i,o=void 0!==r.padding?r.padding:[0,0,0,0],a=void 0!==r.nearest&&r.nearest;i=void 0!==r.minResolution?r.minResolution:void 0!==r.maxZoom?this.getResolutionForZoom(r.maxZoom):0;for(var s=t.getFlatCoordinates(),l=this.getRotation(),u=Math.cos(-l),c=Math.sin(-l),h=1/0,p=1/0,f=-1/0,d=-1/0,g=t.getStride(),y=0,m=s.length;y0&&t[1]>0}function Rs(t,e,r){return void 0===r&&(r=[0,0]),r[0]=t[0]*e+.5|0,r[1]=t[1]*e+.5|0,r}function Is(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}var Ls=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();var Ms=function(t){function e(e){var r=t.call(this)||this,n=function(t){var e=null;void 0!==t.keyboardEventTarget&&(e="string"==typeof t.keyboardEventTarget?document.getElementById(t.keyboardEventTarget):t.keyboardEventTarget);var r,n,i,o={},a=t.layers&&"function"==typeof t.layers.getLayers?t.layers:new Aa({layers:t.layers});o[Ka]=a,o[$a]=t.target,o[Ja]=void 0!==t.view?t.view:new Cs,void 0!==t.controls&&(Array.isArray(t.controls)?r=new ht(t.controls.slice()):(pt("function"==typeof t.controls.getArray,47),r=t.controls));void 0!==t.interactions&&(Array.isArray(t.interactions)?n=new ht(t.interactions.slice()):(pt("function"==typeof t.interactions.getArray,48),n=t.interactions));void 0!==t.overlays?Array.isArray(t.overlays)?i=new ht(t.overlays.slice()):(pt("function"==typeof t.overlays.getArray,49),i=t.overlays):i=new ht;return{controls:r,interactions:n,keyboardEventTarget:e,overlays:i,values:o}}(e);return r.boundHandleBrowserEvent_=r.handleBrowserEvent.bind(r),r.maxTilesLoading_=void 0!==e.maxTilesLoading?e.maxTilesLoading:16,r.pixelRatio_=void 0!==e.pixelRatio?e.pixelRatio:Vi,r.postRenderTimeoutHandle_,r.animationDelayKey_,r.animationDelay_=function(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}.bind(r),r.coordinateToPixelTransform_=[1,0,0,1,0,0],r.pixelToCoordinateTransform_=[1,0,0,1,0,0],r.frameIndex_=0,r.frameState_=null,r.previousExtent_=null,r.viewPropertyListenerKey_=null,r.viewChangeListenerKey_=null,r.layerGroupPropertyListenerKeys_=null,r.viewport_=document.createElement("div"),r.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),r.viewport_.style.position="relative",r.viewport_.style.overflow="hidden",r.viewport_.style.width="100%",r.viewport_.style.height="100%",r.overlayContainer_=document.createElement("div"),r.overlayContainer_.style.position="absolute",r.overlayContainer_.style.zIndex="0",r.overlayContainer_.style.width="100%",r.overlayContainer_.style.height="100%",r.overlayContainer_.style.pointerEvents="none",r.overlayContainer_.className="ol-overlaycontainer",r.viewport_.appendChild(r.overlayContainer_),r.overlayContainerStopEvent_=document.createElement("div"),r.overlayContainerStopEvent_.style.position="absolute",r.overlayContainerStopEvent_.style.zIndex="0",r.overlayContainerStopEvent_.style.width="100%",r.overlayContainerStopEvent_.style.height="100%",r.overlayContainerStopEvent_.style.pointerEvents="none",r.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",r.viewport_.appendChild(r.overlayContainerStopEvent_),r.mapBrowserEventHandler_=null,r.moveTolerance_=e.moveTolerance,r.keyboardEventTarget_=n.keyboardEventTarget,r.keyHandlerKeys_=null,r.controls=n.controls||new ht,r.interactions=n.interactions||new ht,r.overlays_=n.overlays,r.overlayIdIndex_={},r.renderer_=null,r.handleResize_,r.postRenderFunctions_=[],r.tileQueue_=new es(r.getTilePriority.bind(r),r.handleTileChange_.bind(r)),r.addEventListener(it(Ka),r.handleLayerGroupChanged_),r.addEventListener(it(Ja),r.handleViewChanged_),r.addEventListener(it(Ha),r.handleSizeChanged_),r.addEventListener(it($a),r.handleTargetChanged_),r.setProperties(n.values),r.controls.forEach(function(t){t.setMap(this)}.bind(r)),r.controls.addEventListener(at,function(t){t.element.setMap(this)}.bind(r)),r.controls.addEventListener(st,function(t){t.element.setMap(null)}.bind(r)),r.interactions.forEach(function(t){t.setMap(this)}.bind(r)),r.interactions.addEventListener(at,function(t){t.element.setMap(this)}.bind(r)),r.interactions.addEventListener(st,function(t){t.element.setMap(null)}.bind(r)),r.overlays_.forEach(r.addOverlayInternal_.bind(r)),r.overlays_.addEventListener(at,function(t){this.addOverlayInternal_(t.element)}.bind(r)),r.overlays_.addEventListener(st,function(t){var e=t.element.getId();void 0!==e&&delete this.overlayIdIndex_[e.toString()],t.element.setMap(null)}.bind(r)),r}return Ls(e,t),e.prototype.createRenderer=function(){throw new Error("Use a map type that has a createRenderer method")},e.prototype.addControl=function(t){this.getControls().push(t)},e.prototype.addInteraction=function(t){this.getInteractions().push(t)},e.prototype.addLayer=function(t){this.getLayerGroup().getLayers().push(t)},e.prototype.addOverlay=function(t){this.getOverlays().push(t)},e.prototype.addOverlayInternal_=function(t){var e=t.getId();void 0!==e&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)},e.prototype.disposeInternal=function(){this.setTarget(null),t.prototype.disposeInternal.call(this)},e.prototype.forEachFeatureAtPixel=function(t,e,r){if(this.frameState_){var n=this.getCoordinateFromPixelInternal(t),i=void 0!==(r=void 0!==r?r:{}).hitTolerance?r.hitTolerance:0,o=void 0!==r.layerFilter?r.layerFilter:S,a=!1!==r.checkWrapped;return this.renderer_.forEachFeatureAtCoordinate(n,this.frameState_,i,a,e,null,o,null)}},e.prototype.getFeaturesAtPixel=function(t,e){var r=[];return this.forEachFeatureAtPixel(t,(function(t){r.push(t)}),e),r},e.prototype.forEachLayerAtPixel=function(t,e,r){if(this.frameState_){var n=r||{},i=void 0!==n.hitTolerance?n.hitTolerance:0,o=n.layerFilter||S;return this.renderer_.forEachLayerAtPixel(t,this.frameState_,i,e,o)}},e.prototype.hasFeatureAtPixel=function(t,e){if(!this.frameState_)return!1;var r=this.getCoordinateFromPixelInternal(t),n=void 0!==(e=void 0!==e?e:{}).layerFilter?e.layerFilter:S,i=void 0!==e.hitTolerance?e.hitTolerance:0,o=!1!==e.checkWrapped;return this.renderer_.hasFeatureAtCoordinate(r,this.frameState_,i,o,n,null)},e.prototype.getEventCoordinate=function(t){return this.getCoordinateFromPixel(this.getEventPixel(t))},e.prototype.getEventCoordinateInternal=function(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))},e.prototype.getEventPixel=function(t){var e=this.viewport_.getBoundingClientRect(),r="changedTouches"in t?t.changedTouches[0]:t;return[r.clientX-e.left,r.clientY-e.top]},e.prototype.getTarget=function(){return this.get($a)},e.prototype.getTargetElement=function(){var t=this.getTarget();return void 0!==t?"string"==typeof t?document.getElementById(t):t:null},e.prototype.getCoordinateFromPixel=function(t){return en(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())},e.prototype.getCoordinateFromPixelInternal=function(t){var e=this.frameState_;return e?It(e.pixelToCoordinateTransform,t.slice()):null},e.prototype.getControls=function(){return this.controls},e.prototype.getOverlays=function(){return this.overlays_},e.prototype.getOverlayById=function(t){var e=this.overlayIdIndex_[t.toString()];return void 0!==e?e:null},e.prototype.getInteractions=function(){return this.interactions},e.prototype.getLayerGroup=function(){return this.get(Ka)},e.prototype.getLayers=function(){return this.getLayerGroup().getLayers()},e.prototype.getLoading=function(){for(var t=this.getLayerGroup().getLayerStatesArray(),e=0,r=t.length;e=0;s--){var l=a[s];if(l.getMap()===this&&l.getActive()&&this.getTargetElement())if(!l.handleEvent(t)||t.propagationStopped)break}}},e.prototype.handlePostRender=function(){var t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){var r=this.maxTilesLoading_,n=r;if(t){var i=t.viewHints;if(i[ns]||i[is]){var o=!Wi&&Date.now()-t.time>8;r=o?0:8,n=o?0:2}}e.getTilesLoading()0;if(this.renderedVisible_!=r&&(this.element.style.display=r?"":"none",this.renderedVisible_=r),!b(e,this.renderedAttributions_)){go(this.ulElement_);for(var n=0,i=e.length;n0&&e%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.duration_,easing:io}):t.setRotation(0))}},e.prototype.render=function(t){var e=t.frameState;if(e){var r=e.viewState.rotation;if(r!=this.rotation_){var n="rotate("+r+"rad)";if(this.autoHide_){var i=this.element.classList.contains("ol-hidden");i||0!==r?i&&0!==r&&this.element.classList.remove("ol-hidden"):this.element.classList.add("ol-hidden")}this.label_.style.transform=n}this.rotation_=r}},e}(As),Gs=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),zs=function(t){function e(e){var r=this,n=e||{};r=t.call(this,{element:document.createElement("div"),target:n.target})||this;var i=void 0!==n.className?n.className:"ol-zoom",o=void 0!==n.delta?n.delta:1,a=void 0!==n.zoomInClassName?n.zoomInClassName:i+"-in",s=void 0!==n.zoomOutClassName?n.zoomOutClassName:i+"-out",l=void 0!==n.zoomInLabel?n.zoomInLabel:"+",u=void 0!==n.zoomOutLabel?n.zoomOutLabel:"−",c=void 0!==n.zoomInTipLabel?n.zoomInTipLabel:"Zoom in",h=void 0!==n.zoomOutTipLabel?n.zoomOutTipLabel:"Zoom out",p=document.createElement("button");p.className=a,p.setAttribute("type","button"),p.title=c,p.appendChild("string"==typeof l?document.createTextNode(l):l),p.addEventListener(N,r.handleClick_.bind(r,o),!1);var f=document.createElement("button");f.className=s,f.setAttribute("type","button"),f.title=h,f.appendChild("string"==typeof u?document.createTextNode(u):u),f.addEventListener(N,r.handleClick_.bind(r,-o),!1);var d=i+" ol-unselectable ol-control",g=r.element;return g.className=d,g.appendChild(p),g.appendChild(f),r.duration_=void 0!==n.duration?n.duration:250,r}return Gs(e,t),e.prototype.handleClick_=function(t,e){e.preventDefault(),this.zoomByDelta_(t)},e.prototype.zoomByDelta_=function(t){var e=this.getMap().getView();if(e){var r=e.getZoom();if(void 0!==r){var n=e.getConstrainedZoom(r+t);this.duration_>0?(e.getAnimating()&&e.cancelAnimations(),e.animate({zoom:n,duration:this.duration_,easing:io})):e.setZoom(n)}}},e}(As);function Us(t){var e=t||{},r=new ht;return(void 0===e.zoom||e.zoom)&&r.push(new zs(e.zoomOptions)),(void 0===e.rotate||e.rotate)&&r.push(new Ds(e.rotateOptions)),(void 0===e.attribution||e.attribution)&&r.push(new js(e.attributionOptions)),r}var Bs="active",Vs=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Ys(t,e,r){var n=t.getCenterInternal();if(n){var i=[n[0]+e[0],n[1]+e[1]];t.animateInternal({duration:void 0!==r?r:250,easing:ao,center:t.getConstrainedCenter(i)})}}function Ws(t,e,r,n){var i=t.getZoom();if(void 0!==i){var o=t.getConstrainedZoom(i+e),a=t.getResolutionForZoom(o);t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:a,anchor:r,duration:void 0!==n?n:250,easing:io})}}var qs=function(t){function e(e){var r=t.call(this)||this;return e&&e.handleEvent&&(r.handleEvent=e.handleEvent),r.map_=null,r.setActive(!0),r}return Vs(e,t),e.prototype.getActive=function(){return this.get(Bs)},e.prototype.getMap=function(){return this.map_},e.prototype.handleEvent=function(t){return!0},e.prototype.setActive=function(t){this.set(Bs,t)},e.prototype.setMap=function(t){this.map_=t},e}(ot),Xs=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Zs=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.delta_=n.delta?n.delta:1,r.duration_=void 0!==n.duration?n.duration:250,r}return Xs(e,t),e.prototype.handleEvent=function(t){var e=!1;if(t.type==Ga.DBLCLICK){var r=t.originalEvent,n=t.map,i=t.coordinate,o=r.shiftKey?-this.delta_:this.delta_;Ws(n.getView(),o,i,this.duration_),r.preventDefault(),e=!0}return!e},e}(qs),Ks=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Hs(t){for(var e=t.length,r=0,n=0,i=0;i0}}else if(t.type==Ga.POINTERDOWN){var n=this.handleDownEvent(t);this.handlingDownUpSequence=n,e=this.stopDown(n)}else t.type==Ga.POINTERMOVE&&this.handleMoveEvent(t);return!e},e.prototype.handleMoveEvent=function(t){},e.prototype.handleUpEvent=function(t){return!1},e.prototype.stopDown=function(t){return t},e.prototype.updateTrackedPointers_=function(t){if(function(t){var e=t.type;return e===Ga.POINTERDOWN||e===Ga.POINTERDRAG||e===Ga.POINTERUP}(t)){var e=t.originalEvent,r=e.pointerId.toString();t.type==Ga.POINTERUP?delete this.trackedPointers_[r]:(t.type==Ga.POINTERDOWN||r in this.trackedPointers_)&&(this.trackedPointers_[r]=e),this.targetPointers=R(this.trackedPointers_)}},e}(qs);function Js(t){var e=arguments;return function(t){for(var r=!0,n=0,i=e.length;n0&&this.condition_(t)){var e=t.map.getView();return this.lastCentroid=null,e.getAnimating()&&e.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1},e}($s),dl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),gl=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,{stopDown:E})||this).condition_=n.condition?n.condition:tl,r.lastAngle_=void 0,r.duration_=void 0!==n.duration?n.duration:250,r}return dl(e,t),e.prototype.handleDragEvent=function(t){if(cl(t)){var e=t.map,r=e.getView();if(r.getConstraints().rotation!==gs){var n=e.getSize(),i=t.pixel,o=Math.atan2(n[1]/2-i[1],i[0]-n[0]/2);if(void 0!==this.lastAngle_){var a=o-this.lastAngle_;r.adjustRotationInternal(-a)}this.lastAngle_=o}}},e.prototype.handleUpEvent=function(t){return!cl(t)||(t.map.getView().endInteraction(this.duration_),!1)},e.prototype.handleDownEvent=function(t){return!!cl(t)&&(!(!il(t)||!this.condition_(t))&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0))},e}($s),yl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ml=function(t){function e(e){var r=t.call(this)||this;return r.geometry_=null,r.element_=document.createElement("div"),r.element_.style.position="absolute",r.element_.style.pointerEvents="auto",r.element_.className="ol-box "+e,r.map_=null,r.startPixel_=null,r.endPixel_=null,r}return yl(e,t),e.prototype.disposeInternal=function(){this.setMap(null)},e.prototype.render_=function(){var t=this.startPixel_,e=this.endPixel_,r=this.element_.style;r.left=Math.min(t[0],e[0])+"px",r.top=Math.min(t[1],e[1])+"px",r.width=Math.abs(e[0]-t[0])+"px",r.height=Math.abs(e[1]-t[1])+"px"},e.prototype.setMap=function(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);var e=this.element_.style;e.left="inherit",e.top="inherit",e.width="inherit",e.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)},e.prototype.setPixels=function(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()},e.prototype.createOrUpdateGeometry=function(){var t=this.startPixel_,e=this.endPixel_,r=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);r[4]=r[0].slice(),this.geometry_?this.geometry_.setCoordinates([r]):this.geometry_=new fi([r])},e.prototype.getGeometry=function(){return this.geometry_},e}(p),vl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),_l="boxstart",bl="boxdrag",xl="boxend",wl="boxcancel",Sl=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.coordinate=r,i.mapBrowserEvent=n,i}return vl(e,t),e}(c),El=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.box_=new ml(n.className||"ol-dragbox"),r.minArea_=void 0!==n.minArea?n.minArea:64,n.onBoxEnd&&(r.onBoxEnd=n.onBoxEnd),r.startPixel_=null,r.condition_=n.condition?n.condition:il,r.boxEndCondition_=n.boxEndCondition?n.boxEndCondition:r.defaultBoxEndCondition,r}return vl(e,t),e.prototype.defaultBoxEndCondition=function(t,e,r){var n=r[0]-e[0],i=r[1]-e[1];return n*n+i*i>=this.minArea_},e.prototype.getGeometry=function(){return this.box_.getGeometry()},e.prototype.handleDragEvent=function(t){this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new Sl(bl,t.coordinate,t))},e.prototype.handleUpEvent=function(t){this.box_.setMap(null);var e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new Sl(e?xl:wl,t.coordinate,t)),!1},e.prototype.handleDownEvent=function(t){return!!this.condition_(t)&&(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new Sl(_l,t.coordinate,t)),!0)},e.prototype.onBoxEnd=function(t){},e}($s),Tl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Cl=function(t){function e(e){var r=this,n=e||{},i=n.condition?n.condition:ll;return(r=t.call(this,{condition:i,className:n.className||"ol-dragzoom",minArea:n.minArea})||this).duration_=void 0!==n.duration?n.duration:200,r.out_=void 0!==n.out&&n.out,r}return Tl(e,t),e.prototype.onBoxEnd=function(t){var e=this.getMap(),r=e.getView(),n=e.getSize(),i=this.getGeometry().getExtent();if(this.out_){var o=r.calculateExtentInternal(n),a=se([e.getPixelFromCoordinateInternal(_e(i)),e.getPixelFromCoordinateInternal(Oe(i))]);Me(o,1/r.getResolutionForExtentInternal(a,n)),i=o}var s=r.getConstrainedResolution(r.getResolutionForExtentInternal(i,n)),l=r.getConstrainedCenter(xe(i),s);r.animateInternal({resolution:s,center:l,duration:this.duration_,easing:io})},e}(El),Ol=37,Pl=38,Rl=39,Il=40,Ll=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ml=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.defaultCondition_=function(t){return sl(t)&&ul(t)},r.condition_=void 0!==n.condition?n.condition:r.defaultCondition_,r.duration_=void 0!==n.duration?n.duration:100,r.pixelDelta_=void 0!==n.pixelDelta?n.pixelDelta:128,r}return Ll(e,t),e.prototype.handleEvent=function(t){var e=!1;if(t.type==B){var r=t.originalEvent,n=r.keyCode;if(this.condition_(t)&&(n==Il||n==Ol||n==Rl||n==Pl)){var i=t.map.getView(),o=i.getResolution()*this.pixelDelta_,a=0,s=0;n==Il?s=-o:n==Ol?a=-o:n==Rl?a=o:s=o;var l=[a,s];Or(l,i.getRotation()),Ys(i,l,this.duration_),r.preventDefault(),e=!0}}return!e},e}(qs),Fl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Al=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.condition_=n.condition?n.condition:ul,r.delta_=n.delta?n.delta:1,r.duration_=void 0!==n.duration?n.duration:100,r}return Fl(e,t),e.prototype.handleEvent=function(t){var e=!1;if(t.type==B||t.type==V){var r=t.originalEvent,n=r.charCode;if(this.condition_(t)&&(n=="+".charCodeAt(0)||n=="-".charCodeAt(0))){var i=t.map,o=n=="+".charCodeAt(0)?this.delta_:-this.delta_;Ws(i.getView(),o,void 0,this.duration_),r.preventDefault(),e=!0}}return!e},e}(qs),kl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),jl="trackpad",Nl="wheel",Dl=function(t){function e(e){var r=this,n=e||{};(r=t.call(this,n)||this).totalDelta_=0,r.lastDelta_=0,r.maxDelta_=void 0!==n.maxDelta?n.maxDelta:1,r.duration_=void 0!==n.duration?n.duration:250,r.timeout_=void 0!==n.timeout?n.timeout:80,r.useAnchor_=void 0===n.useAnchor||n.useAnchor,r.constrainResolution_=void 0!==n.constrainResolution&&n.constrainResolution;var i=n.condition?n.condition:nl;return r.condition_=n.onFocusOnly?Js(rl,i):i,r.lastAnchor_=null,r.startTime_=void 0,r.timeoutId_,r.mode_=void 0,r.trackpadEventGap_=400,r.trackpadTimeoutId_,r.deltaPerZoom_=300,r}return kl(e,t),e.prototype.endInteraction_=function(){this.trackpadTimeoutId_=void 0,this.getMap().getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_)},e.prototype.handleEvent=function(t){if(!this.condition_(t))return!0;if(t.type!==X)return!0;var e,r=t.map,n=t.originalEvent;if(n.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.coordinate),t.type==X&&(e=n.deltaY,Gi&&n.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(e/=Vi),n.deltaMode===WheelEvent.DOM_DELTA_LINE&&(e*=40)),0===e)return!1;this.lastDelta_=e;var i=Date.now();void 0===this.startTime_&&(this.startTime_=i),(!this.mode_||i-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(e)<4?jl:Nl);var o=r.getView();if(this.mode_===jl&&!o.getConstrainResolution()&&!this.constrainResolution_)return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(o.getAnimating()&&o.cancelAnimations(),o.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),o.adjustZoom(-e/this.deltaPerZoom_,this.lastAnchor_),this.startTime_=i,!1;this.totalDelta_+=e;var a=Math.max(this.timeout_-(i-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,r),a),!1},e.prototype.handleWheelZoom_=function(t){var e=t.getView();e.getAnimating()&&e.cancelAnimations();var r=-Ne(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(r=r?r>0?1:-1:0),Ws(e,r,this.lastAnchor_,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0},e.prototype.setMouseAnchor=function(t){this.useAnchor_=t,t||(this.lastAnchor_=null)},e}(qs),Gl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),zl=function(t){function e(e){var r=this,n=e||{},i=n;return i.stopDown||(i.stopDown=E),(r=t.call(this,i)||this).anchor_=null,r.lastAngle_=void 0,r.rotating_=!1,r.rotationDelta_=0,r.threshold_=void 0!==n.threshold?n.threshold:.3,r.duration_=void 0!==n.duration?n.duration:250,r}return Gl(e,t),e.prototype.handleDragEvent=function(t){var e=0,r=this.targetPointers[0],n=this.targetPointers[1],i=Math.atan2(n.clientY-r.clientY,n.clientX-r.clientX);if(void 0!==this.lastAngle_){var o=i-this.lastAngle_;this.rotationDelta_+=o,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=o}this.lastAngle_=i;var a=t.map,s=a.getView();if(s.getConstraints().rotation!==gs){var l=a.getViewport().getBoundingClientRect(),u=Hs(this.targetPointers);u[0]-=l.left,u[1]-=l.top,this.anchor_=a.getCoordinateFromPixelInternal(u),this.rotating_&&(a.render(),s.adjustRotationInternal(e,this.anchor_))}},e.prototype.handleUpEvent=function(t){return!(this.targetPointers.length<2)||(t.map.getView().endInteraction(this.duration_),!1)},e.prototype.handleDownEvent=function(t){if(this.targetPointers.length>=2){var e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1},e}($s),Ul=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Bl=function(t){function e(e){var r=this,n=e||{},i=n;return i.stopDown||(i.stopDown=E),(r=t.call(this,i)||this).anchor_=null,r.duration_=void 0!==n.duration?n.duration:400,r.lastDistance_=void 0,r.lastScaleDelta_=1,r}return Ul(e,t),e.prototype.handleDragEvent=function(t){var e=1,r=this.targetPointers[0],n=this.targetPointers[1],i=r.clientX-n.clientX,o=r.clientY-n.clientY,a=Math.sqrt(i*i+o*o);void 0!==this.lastDistance_&&(e=this.lastDistance_/a),this.lastDistance_=a;var s=t.map,l=s.getView();1!=e&&(this.lastScaleDelta_=e);var u=s.getViewport().getBoundingClientRect(),c=Hs(this.targetPointers);c[0]-=u.left,c[1]-=u.top,this.anchor_=s.getCoordinateFromPixelInternal(c),s.render(),l.adjustResolutionInternal(e,this.anchor_)},e.prototype.handleUpEvent=function(t){if(this.targetPointers.length<2){var e=t.map.getView(),r=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,r),!1}return!0},e.prototype.handleDownEvent=function(t){if(this.targetPointers.length>=2){var e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1},e}($s);function Vl(t){var e=t||{},r=new ht,n=new _o(-.005,.05,100);return(void 0===e.altShiftDragRotate||e.altShiftDragRotate)&&r.push(new gl),(void 0===e.doubleClickZoom||e.doubleClickZoom)&&r.push(new Zs({delta:e.zoomDelta,duration:e.zoomDuration})),(void 0===e.dragPan||e.dragPan)&&r.push(new fl({onFocusOnly:e.onFocusOnly,kinetic:n})),(void 0===e.pinchRotate||e.pinchRotate)&&r.push(new zl),(void 0===e.pinchZoom||e.pinchZoom)&&r.push(new Bl({duration:e.zoomDuration})),(void 0===e.keyboard||e.keyboard)&&(r.push(new Ml),r.push(new Al({delta:e.zoomDelta,duration:e.zoomDuration}))),(void 0===e.mouseWheelZoom||e.mouseWheelZoom)&&r.push(new Dl({onFocusOnly:e.onFocusOnly,duration:e.zoomDuration})),(void 0===e.shiftDragZoom||e.shiftDragZoom)&&r.push(new Cl({duration:e.zoomDuration})),r}var Yl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Wl=function(t){function e(e){return(e=O({},e)).controls||(e.controls=Us()),e.interactions||(e.interactions=Vl({onFocusOnly:!0})),t.call(this,e)||this}return Yl(e,t),e.prototype.createRenderer=function(){return new La(this)},e}(Ms),ql="bottom-left",Xl="bottom-center",Zl="bottom-right",Kl="center-left",Hl="center-center",$l="center-right",Jl="top-left",Ql="top-center",tu="top-right",eu=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ru="element",nu="map",iu="offset",ou="position",au="positioning",su=function(t){function e(e){var r=t.call(this)||this;r.options=e,r.id=e.id,r.insertFirst=void 0===e.insertFirst||e.insertFirst,r.stopEvent=void 0===e.stopEvent||e.stopEvent,r.element=document.createElement("div"),r.element.className=void 0!==e.className?e.className:"ol-overlay-container ol-selectable",r.element.style.position="absolute",r.element.style.pointerEvents="auto";var n=e.autoPan;return n&&"object"!=typeof n&&(n={animation:e.autoPanAnimation,margin:e.autoPanMargin}),r.autoPan=n||!1,r.rendered={transform_:"",visible:!0},r.mapPostrenderListenerKey=null,r.addEventListener(it(ru),r.handleElementChanged),r.addEventListener(it(nu),r.handleMapChanged),r.addEventListener(it(iu),r.handleOffsetChanged),r.addEventListener(it(ou),r.handlePositionChanged),r.addEventListener(it(au),r.handlePositioningChanged),void 0!==e.element&&r.setElement(e.element),r.setOffset(void 0!==e.offset?e.offset:[0,0]),r.setPositioning(void 0!==e.positioning?e.positioning:Jl),void 0!==e.position&&r.setPosition(e.position),r}return eu(e,t),e.prototype.getElement=function(){return this.get(ru)},e.prototype.getId=function(){return this.id},e.prototype.getMap=function(){return this.get(nu)},e.prototype.getOffset=function(){return this.get(iu)},e.prototype.getPosition=function(){return this.get(ou)},e.prototype.getPositioning=function(){return this.get(au)},e.prototype.handleElementChanged=function(){go(this.element);var t=this.getElement();t&&this.element.appendChild(t)},e.prototype.handleMapChanged=function(){this.mapPostrenderListenerKey&&(fo(this.element),H(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);var t=this.getMap();if(t){this.mapPostrenderListenerKey=Z(t,qa,this.render,this),this.updatePixelPosition();var e=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();this.insertFirst?e.insertBefore(this.element,e.childNodes[0]||null):e.appendChild(this.element),this.performAutoPan()}},e.prototype.render=function(){this.updatePixelPosition()},e.prototype.handleOffsetChanged=function(){this.updatePixelPosition()},e.prototype.handlePositionChanged=function(){this.updatePixelPosition(),this.performAutoPan()},e.prototype.handlePositioningChanged=function(){this.updatePixelPosition()},e.prototype.setElement=function(t){this.set(ru,t)},e.prototype.setMap=function(t){this.set(nu,t)},e.prototype.setOffset=function(t){this.set(iu,t)},e.prototype.setPosition=function(t){this.set(ou,t)},e.prototype.performAutoPan=function(){this.autoPan&&this.panIntoView(this.autoPan)},e.prototype.panIntoView=function(t){var e=this.getMap();if(e&&e.getTargetElement()&&this.get(ou)){var r=this.getRect(e.getTargetElement(),e.getSize()),n=this.getElement(),i=this.getRect(n,[co(n),ho(n)]),o=t||{},a=void 0===o.margin?20:o.margin;if(!te(r,i)){var s=i[0]-r[0],l=r[2]-i[2],u=i[1]-r[1],c=r[3]-i[3],h=[0,0];if(s<0?h[0]=s-a:l<0&&(h[0]=Math.abs(l)+a),u<0?h[1]=u-a:c<0&&(h[1]=Math.abs(c)+a),0!==h[0]||0!==h[1]){var p=e.getView().getCenterInternal(),f=e.getPixelFromCoordinateInternal(p);if(!f)return;var d=[f[0]+h[0],f[1]+h[1]],g=o.animation||{};e.getView().animateInternal({center:e.getCoordinateFromPixelInternal(d),duration:g.duration,easing:g.easing})}}}},e.prototype.getRect=function(t,e){var r=t.getBoundingClientRect(),n=r.left+window.pageXOffset,i=r.top+window.pageYOffset;return[n,i,n+e[0],i+e[1]]},e.prototype.setPositioning=function(t){this.set(au,t)},e.prototype.setVisible=function(t){this.rendered.visible!==t&&(this.element.style.display=t?"":"none",this.rendered.visible=t)},e.prototype.updatePixelPosition=function(){var t=this.getMap(),e=this.getPosition();if(t&&t.isRendered()&&e){var r=t.getPixelFromCoordinate(e),n=t.getSize();this.updateRenderedPosition(r,n)}else this.setVisible(!1)},e.prototype.updateRenderedPosition=function(t,e){var r=this.element.style,n=this.getOffset(),i=this.getPositioning();this.setVisible(!0);var o=Math.round(t[0]+n[0])+"px",a=Math.round(t[1]+n[1])+"px",s="0%",l="0%";i==Zl||i==$l||i==tu?s="-100%":i!=Xl&&i!=Hl&&i!=Ql||(s="-50%"),i==ql||i==Xl||i==Zl?l="-100%":i!=Kl&&i!=Hl&&i!=$l||(l="-50%");var u="translate("+s+", "+l+") translate("+o+", "+a+")";this.rendered.transform_!=u&&(this.rendered.transform_=u,r.transform=u,r.msTransform=u)},e.prototype.getOptions=function(){return this.options},e}(ot),lu=function(){function t(t){this.highWaterMark=void 0!==t?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}return t.prototype.canExpireCache=function(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark},t.prototype.clear=function(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null},t.prototype.containsKey=function(t){return this.entries_.hasOwnProperty(t)},t.prototype.forEach=function(t){for(var e=this.oldest_;e;)t(e.value_,e.key_,this),e=e.newer},t.prototype.get=function(t,e){var r=this.entries_[t];return pt(void 0!==r,15),r===this.newest_||(r===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(r.newer.older=r.older,r.older.newer=r.newer),r.newer=null,r.older=this.newest_,this.newest_.newer=r,this.newest_=r),r.value_},t.prototype.remove=function(t){var e=this.entries_[t];return pt(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_),r=0;for(t=this.newest_;t;t=t.older)e[r++]=t.key_;return e},t.prototype.getValues=function(){var t,e=new Array(this.count_),r=0;for(t=this.newest_;t;t=t.older)e[r++]=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){pt(!(t in this.entries_),16);var r={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=r:this.oldest_=r,this.newest_=r,this.entries_[t]=r,++this.count_},t.prototype.setSize=function(t){this.highWaterMark=t},t}();function uu(t,e,r,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=r,n):[t,e,r]}function cu(t,e,r){return t+"/"+e+"/"+r}function hu(t){return cu(t[0],t[1],t[2])}function pu(t){return t.split("/").map(Number)}function fu(t){return(t[1]<r||r>e.getMaxZoom())return!1;var o=e.getFullTileRange(r);return!o||o.containsXY(n,i)}var gu=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),yu=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return gu(e,t),e.prototype.expireCache=function(t){for(;this.canExpireCache();){if(this.peekLast().getKey()in t)break;this.pop().release()}},e.prototype.pruneExceptNewestZ=function(){if(0!==this.getCount()){var t=pu(this.peekFirstKey())[0];this.forEach(function(e){e.tileCoord[0]!==t&&(this.remove(hu(e.tileCoord)),e.release())}.bind(this))}},e}(lu),mu=function(){function t(t,e,r,n){this.minX=t,this.maxX=e,this.minY=r,this.maxY=n}return t.prototype.contains=function(t){return this.containsXY(t[1],t[2])},t.prototype.containsTileRange=function(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY},t.prototype.containsXY=function(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY},t.prototype.equals=function(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY},t.prototype.extend=function(t){t.minXthis.maxX&&(this.maxX=t.maxX),t.minYthis.maxY&&(this.maxY=t.maxY)},t.prototype.getHeight=function(){return this.maxY-this.minY+1},t.prototype.getSize=function(){return[this.getWidth(),this.getHeight()]},t.prototype.getWidth=function(){return this.maxX-this.minX+1},t.prototype.intersects=function(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY},t}();function vu(t,e,r,n,i){return void 0!==i?(i.minX=t,i.maxX=e,i.minY=r,i.maxY=n,i):new mu(t,e,r,n)}var _u=mu,bu=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),xu=[],wu=function(t){function e(e,r,n,i){var o=t.call(this,e,r,{transition:0})||this;return o.context_={},o.executorGroups={},o.declutterExecutorGroups={},o.loadingSourceTiles=0,o.errorSourceTileKeys={},o.hitDetectionImageData={},o.replayState_={},o.sourceTiles=null,o.wantedResolution,o.getSourceTiles=i.bind(void 0,o),o.sourceZ=-1,o.hifi=!1,o.wrappedTileCoord=n,o}return bu(e,t),e.prototype.getContext=function(t){var e=o(t);return e in this.context_||(this.context_[e]=uo(1,1,xu)),this.context_[e]},e.prototype.hasContext=function(t){return o(t)in this.context_},e.prototype.getImage=function(t){return this.hasContext(t)?this.getContext(t).canvas:null},e.prototype.getReplayState=function(t){var e=o(t);return e in this.replayState_||(this.replayState_[e]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedZ:-1,renderedTileZ:-1}),this.replayState_[e]},e.prototype.load=function(){this.getSourceTiles()},e.prototype.release=function(){for(var e in this.context_)xu.push(this.context_[e].canvas),delete this.context_[e];t.prototype.release.call(this)},e}(lo),Su=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Eu=function(t){function e(e,r,n,i,o,a){var s=t.call(this,e,r,a)||this;return s.extent=null,s.format_=i,s.features_=null,s.loader_,s.projection=null,s.resolution,s.tileLoadFunction_=o,s.url_=n,s.key=n,s}return Su(e,t),e.prototype.getFormat=function(){return this.format_},e.prototype.getFeatures=function(){return this.features_},e.prototype.load=function(){this.state==Ji&&(this.setState(Qi),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))},e.prototype.onLoad=function(t,e){this.setFeatures(t)},e.prototype.onError=function(){this.setState(eo)},e.prototype.setFeatures=function(t){this.features_=t,this.setState(to)},e.prototype.setLoader=function(t){this.loader_=t},e}(lo);function Tu(t){return Array.isArray(t)?Ro(t):t}var Cu="arraybuffer",Ou="json",Pu="text",Ru="xml",Iu=!1;function Lu(t,e,r,n,i,o,a){var s=new XMLHttpRequest;s.open("GET","function"==typeof t?t(r,n,i):t,!0),e.getType()==Cu&&(s.responseType="arraybuffer"),s.withCredentials=Iu,s.onload=function(t){if(!s.status||s.status>=200&&s.status<300){var n=e.getType(),l=void 0;n==Ou||n==Pu?l=s.responseText:n==Ru?(l=s.responseXML)||(l=(new DOMParser).parseFromString(s.responseText,"application/xml")):n==Cu&&(l=s.response),l?o(e.readFeatures(l,{extent:r,featureProjection:i}),e.readProjection(l)):a()}else a()},s.onerror=a,s.send()}function Mu(t,e){return function(r,n,i,o,a){var s=this;Lu(t,e,r,n,i,(function(t,e){void 0!==o&&o(t),s.addFeatures(t)}),a||T)}}function Fu(t,e){return[[-1/0,-1/0,1/0,1/0]]}function Au(t,e,r,n){var i=document.createElement("script"),a="olc_"+o(e);function s(){delete window[a],i.parentNode.removeChild(i)}i.async=!0,i.src=t+(-1==t.indexOf("?")?"?":"&")+(n||"callback")+"="+a;var l=setTimeout((function(){s(),r&&r()}),1e4);window[a]=function(t){clearTimeout(l),s(),e(t)},document.getElementsByTagName("head")[0].appendChild(i)}var ku=function(){function t(){}return t.prototype.drawCustom=function(t,e,r){},t.prototype.drawGeometry=function(t){},t.prototype.setStyle=function(t){},t.prototype.drawCircle=function(t,e){},t.prototype.drawFeature=function(t,e){},t.prototype.drawGeometryCollection=function(t,e){},t.prototype.drawLineString=function(t,e){},t.prototype.drawMultiLineString=function(t,e){},t.prototype.drawMultiPoint=function(t,e){},t.prototype.drawMultiPolygon=function(t,e){},t.prototype.drawPoint=function(t,e){},t.prototype.drawPolygon=function(t,e){},t.prototype.drawText=function(t,e){},t.prototype.setFillStrokeStyle=function(t,e){},t.prototype.setImageStyle=function(t,e){},t.prototype.setTextStyle=function(t,e){},t}(),ju=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Nu=function(t){function e(e,r,n,i,o,a,s){var l=t.call(this)||this;return l.context_=e,l.pixelRatio_=r,l.extent_=n,l.transform_=i,l.viewRotation_=o,l.squaredTolerance_=a,l.userTransform_=s,l.contextFillState_=null,l.contextStrokeState_=null,l.contextTextState_=null,l.fillState_=null,l.strokeState_=null,l.image_=null,l.imageAnchorX_=0,l.imageAnchorY_=0,l.imageHeight_=0,l.imageOpacity_=0,l.imageOriginX_=0,l.imageOriginY_=0,l.imageRotateWithView_=!1,l.imageRotation_=0,l.imageScale_=[0,0],l.imageWidth_=0,l.text_="",l.textOffsetX_=0,l.textOffsetY_=0,l.textRotateWithView_=!1,l.textRotation_=0,l.textScale_=[0,0],l.textFillState_=null,l.textStrokeState_=null,l.textState_=null,l.pixelCoordinates_=[],l.tmpLocalTransform_=[1,0,0,1,0,0],l}return ju(e,t),e.prototype.drawImages_=function(t,e,r,n){if(this.image_){var i=ln(t,e,r,2,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.tmpLocalTransform_,s=o.globalAlpha;1!=this.imageOpacity_&&(o.globalAlpha=s*this.imageOpacity_);var l=this.imageRotation_;this.imageRotateWithView_&&(l+=this.viewRotation_);for(var u=0,c=i.length;u2||Math.abs(t[4*e+3]-191.25)>2}function tc(t,e,r,n){var i=Hr(r,e,t),o=zr(e,n,r),a=e.getMetersPerUnit();void 0!==a&&(o*=a);var s=t.getMetersPerUnit();void 0!==s&&(o/=s);var l=t.getExtent();if(!l||Qt(l,i)){var u=zr(t,o,i)/o;isFinite(u)&&u>0&&(o/=u)}return o}function ec(t,e,r,n){var i=xe(r),o=tc(t,e,i,n);return(!isFinite(o)||o<=0)&&me(r,(function(r){return o=tc(t,e,r,n),isFinite(o)&&o>0})),o}function rc(t,e,r,n,i,o,a,s,l,u,c,h){var p=uo(Math.round(r*t),Math.round(r*e));if(O(p,h),0===l.length)return p.canvas;function f(t){return Math.round(t*r)/r}p.scale(r,r),p.globalCompositeOperation="lighter";var d=[1/0,1/0,-1/0,-1/0];l.forEach((function(t,e,r){he(d,t.extent)}));var g=Pe(d),y=Ee(d),m=uo(Math.round(r*g/n),Math.round(r*y/n));O(m,h);var v=r/n;l.forEach((function(t,e,r){var n=t.extent[0]-d[0],i=-(t.extent[3]-d[3]),o=Pe(t.extent),a=Ee(t.extent);t.image.width>0&&t.image.height>0&&m.drawImage(t.image,u,u,t.image.width-2*u,t.image.height-2*u,n*v,i*v,o*v,a*v)}));var _=Ce(a);return s.getTriangles().forEach((function(t,e,i){var a=t.source,s=t.target,l=a[0][0],u=a[0][1],c=a[1][0],g=a[1][1],y=a[2][0],v=a[2][1],b=f((s[0][0]-_[0])/o),x=f(-(s[0][1]-_[1])/o),w=f((s[1][0]-_[0])/o),S=f(-(s[1][1]-_[1])/o),E=f((s[2][0]-_[0])/o),T=f(-(s[2][1]-_[1])/o),C=l,O=u;l=0,u=0;var P=Be([[c-=C,g-=O,0,0,w-b],[y-=C,v-=O,0,0,E-b],[0,0,c,g,S-x],[0,0,y,v,T-x]]);if(P){if(p.save(),p.beginPath(),function(){if(void 0===Hu){var t=document.createElement("canvas").getContext("2d");t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",Ju(t,4,5,4,0),Ju(t,4,5,0,5);var e=t.getImageData(0,0,3,3).data;Hu=Qu(e,0)||Qu(e,4)||Qu(e,8)}return Hu}()||h===$u){p.moveTo(w,S);for(var R=b-w,I=x-S,L=0;L<4;L++)p.lineTo(w+f((L+1)*R/4),S+f(L*I/3)),3!=L&&p.lineTo(w+f((L+1)*R/4),S+f((L+1)*I/3));p.lineTo(E,T)}else p.moveTo(w,S),p.lineTo(b,x),p.lineTo(E,T);p.clip(),p.transform(P[0],P[2],P[1],P[3],b,x),p.translate(d[0]-C,d[3]-O),p.scale(n/r,-n/r),p.drawImage(m.canvas,0,0),p.restore()}})),c&&(p.save(),p.globalCompositeOperation="source-over",p.strokeStyle="black",p.lineWidth=1,s.getTriangles().forEach((function(t,e,r){var n=t.target,i=(n[0][0]-_[0])/o,a=-(n[0][1]-_[1])/o,s=(n[1][0]-_[0])/o,l=-(n[1][1]-_[1])/o,u=(n[2][0]-_[0])/o,c=-(n[2][1]-_[1])/o;p.beginPath(),p.moveTo(s,l),p.lineTo(i,a),p.lineTo(u,c),p.closePath(),p.stroke()})),p.restore()),p.canvas}var nc=[0,0,0],ic=function(){function t(t){var e;if(this.minZoom=void 0!==t.minZoom?t.minZoom:0,this.resolutions_=t.resolutions,pt(w(this.resolutions_,(function(t,e){return e-t}),!0),17),!t.origins)for(var r=0,n=this.resolutions_.length-1;r=this.minZoom;){if(e(s,2===this.zoomFactor_?vu(i=Math.floor(i/2),i,o=Math.floor(o/2),o,r):this.getTileRangeForExtentAndZ(a,s,r)))return!0;--s}return!1},t.prototype.getExtent=function(){return this.extent_},t.prototype.getMaxZoom=function(){return this.maxZoom},t.prototype.getMinZoom=function(){return this.minZoom},t.prototype.getOrigin=function(t){return this.origin_?this.origin_:this.origins_[t]},t.prototype.getResolution=function(t){return this.resolutions_[t]},t.prototype.getResolutions=function(){return this.resolutions_},t.prototype.getTileCoordChildTileRange=function(t,e,r){if(t[0]0?n:Math.max(a/s[0],o/s[1]),u=i+1,c=new Array(u),h=0;h=0;o--)this.postProcessPasses_[o].init(t);e.bindTexture(e.TEXTURE_2D,null),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.enable(e.BLEND),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA),e.useProgram(this.currentProgram_),this.applyFrameState(t),this.applyUniforms(t)},e.prototype.prepareDrawToRenderTarget=function(t,e,r){var n=this.getGL(),i=e.getSize();n.bindFramebuffer(n.FRAMEBUFFER,e.getFramebuffer()),n.viewport(0,0,i[0],i[1]),n.bindTexture(n.TEXTURE_2D,e.getTexture()),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.enable(n.BLEND),n.blendFunc(n.ONE,r?n.ZERO:n.ONE_MINUS_SRC_ALPHA),n.useProgram(this.currentProgram_),this.applyFrameState(t),this.applyUniforms(t)},e.prototype.drawElements=function(t,e){var r=this.getGL(),n=r.UNSIGNED_INT,i=e-t,o=4*t;r.drawElements(r.TRIANGLES,i,n,o)},e.prototype.finalizeDraw=function(t){for(var e=0;ethis.size_[0]||e>=this.size_[1])return yh[0]=0,yh[1]=0,yh[2]=0,yh[3]=0,yh;this.readAll();var r=Math.floor(t)+(this.size_[1]-Math.floor(e)-1)*this.size_[0];return yh[0]=this.data_[4*r],yh[1]=this.data_[4*r+1],yh[2]=this.data_[4*r+2],yh[3]=this.data_[4*r+3],yh},t.prototype.getTexture=function(){return this.texture_},t.prototype.getFramebuffer=function(){return this.framebuffer_},t.prototype.updateSize_=function(){var t=this.size_,e=this.helper_.getGL();this.texture_=this.helper_.createTexture(t,null,this.texture_),e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer_),e.viewport(0,0,t[0],t[1]),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this.texture_,0),this.data_=new Uint8Array(t[0]*t[1]*4)},t}(),vh=1,_h=2,bh=4,xh=8,wh=16,Sh=31,Eh={};function Th(t){if("number"==typeof t)return vh;if("boolean"==typeof t)return xh;if("string"==typeof t)return Io(t)?bh|_h:_h;if(!Array.isArray(t))throw new Error("Unhandled value type: "+JSON.stringify(t));var e=t;if(e.every((function(t){return"number"==typeof t})))return 3===e.length||4===e.length?bh|wh:wh;if("string"!=typeof e[0])throw new Error("Expected an expression operator but received: "+JSON.stringify(e));var r=Eh[e[0]];if(void 0===r)throw new Error("Unrecognized expression operator: "+JSON.stringify(e));return r.getReturnType(e.slice(1))}function Ch(t){return Math.log2(t)%1==0}function Oh(t){var e=t.toString();return-1===e.indexOf(".")?e+".0":e}function Ph(t){if(t.length<2||t.length>4)throw new Error("`formatArray` can only output `vec2`, `vec3` or `vec4` arrays.");return"vec"+t.length+"("+t.map(Oh).join(", ")+")"}function Rh(t){var e=Oo(t).slice();return e.length<4&&e.push(1),Ph(e.map((function(t,e){return e<3?t/255:t})))}function Ih(t,e){return void 0===t.stringLiteralsMap[e]&&(t.stringLiteralsMap[e]=Object.keys(t.stringLiteralsMap).length),t.stringLiteralsMap[e]}function Lh(t,e){return Oh(Ih(t,e))}function Mh(t,e,r){if(Array.isArray(e)&&"string"==typeof e[0]){var n=Eh[e[0]];if(void 0===n)throw new Error("Unrecognized expression operator: "+JSON.stringify(e));return n.toGlsl(t,e.slice(1),r)}var i=Th(e);return(i&vh)>0?Oh(e):(i&xh)>0?e.toString():(i&_h)>0&&(void 0===r||r==_h)?Lh(t,e.toString()):(i&bh)>0&&(void 0===r||r==bh)?Rh(e):(i&wh)>0?Ph(e):void 0}function Fh(t){if(!(Th(t)&vh))throw new Error("A numeric value was expected, got "+JSON.stringify(t)+" instead")}function Ah(t){for(var e=0;ee)throw new Error("At most "+e+" arguments were expected, got "+t.length+" instead")}function zh(t){if(t.length%2!=0)throw new Error("An even amount of arguments was expected, got "+t+" instead")}function Uh(t,e){if(!Ch(e))throw new Error("Could not infer only one type from the following expression: "+JSON.stringify(t))}function Bh(t){return{getReturnType:function(t){return xh},toGlsl:function(e,r){Nh(r,2);for(var n=Sh,i=0;i"]={getReturnType:function(t){return xh},toGlsl:function(t,e){return Nh(e,2),Ah(e),"("+Mh(t,e[0])+" > "+Mh(t,e[1])+")"}},Eh[">="]={getReturnType:function(t){return xh},toGlsl:function(t,e){return Nh(e,2),Ah(e),"("+Mh(t,e[0])+" >= "+Mh(t,e[1])+")"}},Eh["<"]={getReturnType:function(t){return xh},toGlsl:function(t,e){return Nh(e,2),Ah(e),"("+Mh(t,e[0])+" < "+Mh(t,e[1])+")"}},Eh["<="]={getReturnType:function(t){return xh},toGlsl:function(t,e){return Nh(e,2),Ah(e),"("+Mh(t,e[0])+" <= "+Mh(t,e[1])+")"}},Eh["=="]=Bh("=="),Eh["!="]=Bh("!="),Eh["!"]={getReturnType:function(t){return xh},toGlsl:function(t,e){return Nh(e,1),jh(e[0]),"(!"+Mh(t,e[0])+")"}},Eh.all=Vh("&&"),Eh.any=Vh("||"),Eh.between={getReturnType:function(t){return xh},toGlsl:function(t,e){Nh(e,3),Ah(e);var r=Mh(t,e[1]),n=Mh(t,e[2]),i=Mh(t,e[0]);return"("+i+" >= "+r+" && "+i+" <= "+n+")"}},Eh.array={getReturnType:function(t){return wh},toGlsl:function(t,e){Dh(e,2),Gh(e,4),Ah(e);var r=e.map((function(e){return Mh(t,e,vh)}));return"vec"+e.length+"("+r.join(", ")+")"}},Eh.color={getReturnType:function(t){return bh},toGlsl:function(t,e){Dh(e,3),Gh(e,4),Ah(e);var r=e;3===e.length&&r.push(1);var n=e.map((function(e,r){return Mh(t,e,vh)+(r<3?" / 255.0":"")}));return"vec"+e.length+"("+n.join(", ")+")"}},Eh.interpolate={getReturnType:function(t){for(var e=bh|vh,r=3;r=1;l-=2){s="("+o+" == "+Mh(t,e[l])+" ? "+Mh(t,e[l+1],i)+" : "+(s||a)+")"}return s}},Eh.case={getReturnType:function(t){for(var e=Sh,r=1;r=0;o-=2){s="("+Mh(t,e[o])+" ? "+Mh(t,e[o+1],i)+" : "+(s||a)+")"}return s}};var Yh=function(){function t(){this.uniforms=[],this.attributes=[],this.varyings=[],this.sizeExpression="vec2(1.0)",this.rotationExpression="0.0",this.offsetExpression="vec2(0.0)",this.colorExpression="vec4(1.0)",this.texCoordExpression="vec4(0.0, 0.0, 1.0, 1.0)",this.discardExpression="false",this.rotateWithView=!1}return t.prototype.addUniform=function(t){return this.uniforms.push(t),this},t.prototype.addAttribute=function(t){return this.attributes.push(t),this},t.prototype.addVarying=function(t,e,r){return this.varyings.push({name:t,type:e,expression:r}),this},t.prototype.setSizeExpression=function(t){return this.sizeExpression=t,this},t.prototype.setRotationExpression=function(t){return this.rotationExpression=t,this},t.prototype.setSymbolOffsetExpression=function(t){return this.offsetExpression=t,this},t.prototype.setColorExpression=function(t){return this.colorExpression=t,this},t.prototype.setTextureCoordinateExpression=function(t){return this.texCoordExpression=t,this},t.prototype.setFragmentDiscardExpression=function(t){return this.discardExpression=t,this},t.prototype.setSymbolRotateWithView=function(t){return this.rotateWithView=t,this},t.prototype.getSizeExpression=function(){return this.sizeExpression},t.prototype.getOffsetExpression=function(){return this.offsetExpression},t.prototype.getColorExpression=function(){return this.colorExpression},t.prototype.getTextureCoordinateExpression=function(){return this.texCoordExpression},t.prototype.getFragmentDiscardExpression=function(){return this.discardExpression},t.prototype.getSymbolVertexShader=function(t){var e=this.rotateWithView?"u_offsetScaleMatrix * u_offsetRotateMatrix":"u_offsetScaleMatrix",r=this.attributes,n=this.varyings;return t&&(r=r.concat("vec4 a_hitColor"),n=n.concat({name:"v_hitColor",type:"vec4",expression:"a_hitColor"})),"precision mediump float;\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_offsetScaleMatrix;\nuniform mat4 u_offsetRotateMatrix;\nuniform float u_time;\nuniform float u_zoom;\nuniform float u_resolution;\n"+this.uniforms.map((function(t){return"uniform "+t+";"})).join("\n")+"\nattribute vec2 a_position;\nattribute float a_index;\n"+r.map((function(t){return"attribute "+t+";"})).join("\n")+"\nvarying vec2 v_texCoord;\nvarying vec2 v_quadCoord;\n"+n.map((function(t){return"varying "+t.type+" "+t.name+";"})).join("\n")+"\nvoid main(void) {\n mat4 offsetMatrix = "+e+";\n vec2 halfSize = "+this.sizeExpression+" * 0.5;\n vec2 offset = "+this.offsetExpression+";\n float angle = "+this.rotationExpression+";\n float offsetX;\n float offsetY;\n if (a_index == 0.0) {\n offsetX = (offset.x - halfSize.x) * cos(angle) + (offset.y - halfSize.y) * sin(angle);\n offsetY = (offset.y - halfSize.y) * cos(angle) - (offset.x - halfSize.x) * sin(angle);\n } else if (a_index == 1.0) {\n offsetX = (offset.x + halfSize.x) * cos(angle) + (offset.y - halfSize.y) * sin(angle);\n offsetY = (offset.y - halfSize.y) * cos(angle) - (offset.x + halfSize.x) * sin(angle);\n } else if (a_index == 2.0) {\n offsetX = (offset.x + halfSize.x) * cos(angle) + (offset.y + halfSize.y) * sin(angle);\n offsetY = (offset.y + halfSize.y) * cos(angle) - (offset.x + halfSize.x) * sin(angle);\n } else {\n offsetX = (offset.x - halfSize.x) * cos(angle) + (offset.y + halfSize.y) * sin(angle);\n offsetY = (offset.y + halfSize.y) * cos(angle) - (offset.x - halfSize.x) * sin(angle);\n }\n vec4 offsets = offsetMatrix * vec4(offsetX, offsetY, 0.0, 0.0);\n gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0) + offsets;\n vec4 texCoord = "+this.texCoordExpression+";\n float u = a_index == 0.0 || a_index == 3.0 ? texCoord.s : texCoord.p;\n float v = a_index == 2.0 || a_index == 3.0 ? texCoord.t : texCoord.q;\n v_texCoord = vec2(u, v);\n u = a_index == 0.0 || a_index == 3.0 ? 0.0 : 1.0;\n v = a_index == 2.0 || a_index == 3.0 ? 0.0 : 1.0;\n v_quadCoord = vec2(u, v);\n"+n.map((function(t){return" "+t.name+" = "+t.expression+";"})).join("\n")+"\n}"},t.prototype.getSymbolFragmentShader=function(t){var e=t?" if (gl_FragColor.a < 0.1) { discard; } gl_FragColor = v_hitColor;":"",r=this.varyings;return t&&(r=r.concat({name:"v_hitColor",type:"vec4",expression:"a_hitColor"})),"precision mediump float;\nuniform float u_time;\nuniform float u_zoom;\nuniform float u_resolution;\n"+this.uniforms.map((function(t){return"uniform "+t+";"})).join("\n")+"\nvarying vec2 v_texCoord;\nvarying vec2 v_quadCoord;\n"+r.map((function(t){return"varying "+t.type+" "+t.name+";"})).join("\n")+"\nvoid main(void) {\n if ("+this.discardExpression+") { discard; }\n gl_FragColor = "+this.colorExpression+";\n gl_FragColor.rgb *= gl_FragColor.a;\n"+e+"\n}"},t}();function Wh(t){var e=t.symbol,r=void 0!==e.size?e.size:1,n=e.color||"white",i=e.textureCoord||[0,0,1,1],o=e.offset||[0,0],a=void 0!==e.opacity?e.opacity:1,s=void 0!==e.rotation?e.rotation:0,l={inFragmentShader:!1,variables:[],attributes:[],stringLiteralsMap:{}},u=Mh(l,r,wh|vh),c=Mh(l,o,wh),h=Mh(l,i,wh),p=Mh(l,s,vh),f={inFragmentShader:!0,variables:l.variables,attributes:[],stringLiteralsMap:l.stringLiteralsMap},d=Mh(f,n,bh),g=Mh(f,a,vh),y="1.0",m="vec2("+Mh(f,r,wh|vh)+").x";switch(e.symbolType){case"square":case"image":break;case"circle":y="(1.0-smoothstep(1.-4./"+m+",1.,dot(v_quadCoord-.5,v_quadCoord-.5)*4.))";break;case"triangle":var v="(v_quadCoord*2.-1.)",_="(atan("+v+".x,"+v+".y))";y="(1.0-smoothstep(.5-3./"+m+",.5,cos(floor(.5+"+_+"/2.094395102)*2.094395102-"+_+")*length("+v+")))";break;default:throw new Error("Unexpected symbol type: "+e.symbolType)}var b=(new Yh).setSizeExpression("vec2("+u+")").setRotationExpression(p).setSymbolOffsetExpression(c).setTextureCoordinateExpression(h).setSymbolRotateWithView(!!e.rotateWithView).setColorExpression("vec4("+d+".rgb, "+d+".a * "+g+" * "+y+")");if(t.filter){var x=Mh(f,t.filter,xh);b.setFragmentDiscardExpression("!"+x)}var w={};if(f.variables.forEach((function(e){b.addUniform("float u_"+e),w["u_"+e]=function(){if(!t.variables||void 0===t.variables[e])throw new Error("The following variable is missing from the style: "+e);var r=t.variables[e];return"string"==typeof r&&(r=Ih(l,r)),void 0!==r?r:-9999999}})),"image"===e.symbolType&&e.src){var S=new Image;S.src=e.src,b.addUniform("sampler2D u_texture").setColorExpression(b.getColorExpression()+" * texture2D(u_texture, v_texCoord)"),w.u_texture=S}return f.attributes.forEach((function(t){-1===l.attributes.indexOf(t)&&l.attributes.push(t),b.addVarying("v_"+t,"float","a_"+t)})),l.attributes.forEach((function(t){b.addAttribute("float a_"+t)})),{builder:b,attributes:l.attributes.map((function(t){return{name:t,callback:function(e,r){var n=r[t];return"string"==typeof n&&(n=Ih(l,n)),void 0!==n?n:-9999999}}})),uniforms:w}}var qh=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Xh=function(t){function e(e){var r=t.call(this,{extent:e.extent,origin:e.origin,origins:e.origins,resolutions:e.resolutions,tileSize:e.tileSize,tileSizes:e.tileSizes,sizes:e.sizes})||this;return r.matrixIds_=e.matrixIds,r}return qh(e,t),e.prototype.getMatrixId=function(t){return this.matrixIds_[t]},e.prototype.getMatrixIds=function(){return this.matrixIds_},e}(ic),Zh=Xh;function Kh(t,e,r){var n=[],i=[],o=[],a=[],s=[],l=void 0!==r?r:[],u=Gr(t.SupportedCRS),c=u.getMetersPerUnit(),h="ne"==u.getAxisOrientation().substr(0,2);return t.TileMatrix.sort((function(t,e){return e.ScaleDenominator-t.ScaleDenominator})),t.TileMatrix.forEach((function(e){if(!(l.length>0)||_(l,(function(r){return e.Identifier==r.TileMatrix||-1===e.Identifier.indexOf(":")&&t.Identifier+":"+e.Identifier===r.TileMatrix}))){i.push(e.Identifier);var r=28e-5*e.ScaleDenominator/c,u=e.TileWidth,p=e.TileHeight;h?o.push([e.TopLeftCorner[1],e.TopLeftCorner[0]]):o.push(e.TopLeftCorner),n.push(r),a.push(u==p?u:[u,p]),s.push([e.MatrixWidth,e.MatrixHeight])}})),new Xh({extent:e,origins:o,resolutions:n,matrixIds:i,tileSizes:a,sizes:s})}var Hh=function(){function t(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=Is(t.scale),this.displacement_=t.displacement}return t.prototype.clone=function(){var e=this.getScale();return new t({opacity:this.getOpacity(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice()})},t.prototype.getOpacity=function(){return this.opacity_},t.prototype.getRotateWithView=function(){return this.rotateWithView_},t.prototype.getRotation=function(){return this.rotation_},t.prototype.getScale=function(){return this.scale_},t.prototype.getScaleArray=function(){return this.scaleArray_},t.prototype.getDisplacement=function(){return this.displacement_},t.prototype.getAnchor=function(){return n()},t.prototype.getImage=function(t){return n()},t.prototype.getHitDetectionImage=function(){return n()},t.prototype.getPixelRatio=function(t){return 1},t.prototype.getImageState=function(){return n()},t.prototype.getImageSize=function(){return n()},t.prototype.getHitDetectionImageSize=function(){return n()},t.prototype.getOrigin=function(){return n()},t.prototype.getSize=function(){return n()},t.prototype.setOpacity=function(t){this.opacity_=t},t.prototype.setRotateWithView=function(t){this.rotateWithView_=t},t.prototype.setRotation=function(t){this.rotation_=t},t.prototype.setScale=function(t){this.scale_=t,this.scaleArray_=Is(t)},t.prototype.listenImageChange=function(t){n()},t.prototype.load=function(){n()},t.prototype.unlistenImageChange=function(t){n()},t}(),$h=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Jh=function(t){function e(e){var r=this,n=void 0!==e.rotateWithView&&e.rotateWithView;return(r=t.call(this,{opacity:1,rotateWithView:n,rotation:void 0!==e.rotation?e.rotation:0,scale:void 0!==e.scale?e.scale:1,displacement:void 0!==e.displacement?e.displacement:[0,0]})||this).canvas_={},r.hitDetectionCanvas_=null,r.fill_=void 0!==e.fill?e.fill:null,r.origin_=[0,0],r.points_=e.points,r.radius_=void 0!==e.radius?e.radius:e.radius1,r.radius2_=e.radius2,r.angle_=void 0!==e.angle?e.angle:0,r.stroke_=void 0!==e.stroke?e.stroke:null,r.anchor_=null,r.size_=null,r.imageSize_=null,r.hitDetectionImageSize_=null,r.render(),r}return $h(e,t),e.prototype.clone=function(){var t=this.getScale(),r=new e({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice()});return r.setOpacity(this.getOpacity()),r},e.prototype.getAnchor=function(){return this.anchor_},e.prototype.getAngle=function(){return this.angle_},e.prototype.getFill=function(){return this.fill_},e.prototype.getHitDetectionImage=function(){if(!this.hitDetectionCanvas_){var t=this.createRenderOptions();this.createHitDetectionCanvas_(t)}return this.hitDetectionCanvas_},e.prototype.getImage=function(t){if(!this.canvas_[t||1]){var e=this.createRenderOptions(),r=uo(e.size*t||1,e.size*t||1);this.draw_(e,r,0,0,t||1),this.canvas_[t||1]=r.canvas}return this.canvas_[t||1]},e.prototype.getPixelRatio=function(t){return t},e.prototype.getImageSize=function(){return this.imageSize_},e.prototype.getHitDetectionImageSize=function(){return this.hitDetectionImageSize_},e.prototype.getImageState=function(){return ki},e.prototype.getOrigin=function(){return this.origin_},e.prototype.getPoints=function(){return this.points_},e.prototype.getRadius=function(){return this.radius_},e.prototype.getRadius2=function(){return this.radius2_},e.prototype.getSize=function(){return this.size_},e.prototype.getStroke=function(){return this.stroke_},e.prototype.listenImageChange=function(t){},e.prototype.load=function(){},e.prototype.unlistenImageChange=function(t){},e.prototype.createRenderOptions=function(){var t,e="round",r="round",n=0,i=null,o=0,a=0;return this.stroke_&&(null===(t=this.stroke_.getColor())&&(t="#000"),t=Tu(t),void 0===(a=this.stroke_.getWidth())&&(a=1),i=this.stroke_.getLineDash(),o=this.stroke_.getLineDashOffset(),void 0===(r=this.stroke_.getLineJoin())&&(r="round"),void 0===(e=this.stroke_.getLineCap())&&(e="round"),void 0===(n=this.stroke_.getMiterLimit())&&(n=10)),{strokeStyle:t,strokeWidth:a,size:2*(this.radius_+a)+1,lineCap:e,lineDash:i,lineDashOffset:o,lineJoin:r,miterLimit:n}},e.prototype.render=function(){var t=this.createRenderOptions(),e=uo(t.size,t.size);this.draw_(t,e,0,0,1),this.canvas_={},this.canvas_[1]=e.canvas;var r=e.canvas.width,n=r,i=this.getDisplacement();this.hitDetectionImageSize_=[t.size,t.size],this.createHitDetectionCanvas_(t),this.anchor_=[r/2-i[0],r/2+i[1]],this.size_=[r,r],this.imageSize_=[n,n]},e.prototype.draw_=function(t,e,r,n,i){var o,a,s;e.setTransform(i,0,0,i,0,0),e.translate(r,n),e.beginPath();var l=this.points_;if(l===1/0)e.arc(t.size/2,t.size/2,this.radius_,0,2*Math.PI,!0);else{var u=void 0!==this.radius2_?this.radius2_:this.radius_;for(u!==this.radius_&&(l*=2),o=0;o<=l;o++)a=2*o*Math.PI/l-Math.PI/2+this.angle_,s=o%2==0?this.radius_:u,e.lineTo(t.size/2+s*Math.cos(a),t.size/2+s*Math.sin(a))}if(this.fill_){var c=this.fill_.getColor();null===c&&(c="#000"),e.fillStyle=Tu(c),e.fill()}this.stroke_&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,e.setLineDash&&t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke()),e.closePath()},e.prototype.createHitDetectionCanvas_=function(t){if(this.hitDetectionCanvas_=this.getImage(1),this.fill_){var e=this.fill_.getColor(),r=0;if("string"==typeof e&&(e=Oo(e)),null===e?r=1:Array.isArray(e)&&(r=4===e.length?e[3]:1),0===r){var n=uo(t.size,t.size);this.hitDetectionCanvas_=n.canvas,this.drawHitDetectionCanvas_(t,n,0,0)}}},e.prototype.drawHitDetectionCanvas_=function(t,e,r,n){e.translate(r,n),e.beginPath();var i=this.points_;if(i===1/0)e.arc(t.size/2,t.size/2,this.radius_,0,2*Math.PI,!0);else{var o=void 0!==this.radius2_?this.radius2_:this.radius_;o!==this.radius_&&(i*=2);var a=void 0,s=void 0,l=void 0;for(a=0;a<=i;a++)l=2*a*Math.PI/i-Math.PI/2+this.angle_,s=a%2==0?this.radius_:o,e.lineTo(t.size/2+s*Math.cos(l),t.size/2+s*Math.sin(l))}e.fillStyle="#000",e.fill(),this.stroke_&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.stroke()),e.closePath()},e}(Hh),Qh=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),tp=function(t){function e(e){var r=e||{};return t.call(this,{points:1/0,fill:r.fill,radius:r.radius,stroke:r.stroke,scale:void 0!==r.scale?r.scale:1,rotation:void 0!==r.rotation?r.rotation:0,rotateWithView:void 0!==r.rotateWithView&&r.rotateWithView,displacement:void 0!==r.displacement?r.displacement:[0,0]})||this}return Qh(e,t),e.prototype.clone=function(){var t=this.getScale(),r=new e({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice()});return r.setOpacity(this.getOpacity()),r},e.prototype.setRadius=function(t){this.radius_=t,this.render()},e}(Jh),ep=function(){function t(t){var e=t||{};this.color_=void 0!==e.color?e.color:null}return t.prototype.clone=function(){var e=this.getColor();return new t({color:Array.isArray(e)?e.slice():e||void 0})},t.prototype.getColor=function(){return this.color_},t.prototype.setColor=function(t){this.color_=t},t}(),rp="fraction",np="pixels",ip="bottom-left",op="bottom-right",ap="top-left",sp="top-right",lp=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),up=null,cp=function(t){function e(e,r,n,i,o,a){var s=t.call(this)||this;return s.hitDetectionImage_=null,s.image_=e||new Image,null!==i&&(s.image_.crossOrigin=i),s.canvas_={},s.color_=a,s.unlisten_=null,s.imageState_=o,s.size_=n,s.src_=r,s.tainted_,s}return lp(e,t),e.prototype.isTainted_=function(){if(void 0===this.tainted_&&this.imageState_===ki){up||(up=uo(1,1)),up.drawImage(this.image_,0,0);try{up.getImageData(0,0,1,1),this.tainted_=!1}catch(t){up=null,this.tainted_=!0}}return!0===this.tainted_},e.prototype.dispatchChangeEvent_=function(){this.dispatchEvent(F)},e.prototype.handleImageError_=function(){this.imageState_=ji,this.unlistenImage_(),this.dispatchChangeEvent_()},e.prototype.handleImageLoad_=function(){this.imageState_=ki,this.size_?(this.image_.width=this.size_[0],this.image_.height=this.size_[1]):this.size_=[this.image_.width,this.image_.height],this.unlistenImage_(),this.dispatchChangeEvent_()},e.prototype.getImage=function(t){return this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_},e.prototype.getPixelRatio=function(t){return this.replaceColor_(t),this.canvas_[t]?t:1},e.prototype.getImageState=function(){return this.imageState_},e.prototype.getHitDetectionImage=function(){if(!this.hitDetectionImage_)if(this.isTainted_()){var t=this.size_[0],e=this.size_[1],r=uo(t,e);r.fillRect(0,0,t,e),this.hitDetectionImage_=r.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_},e.prototype.getSize=function(){return this.size_},e.prototype.getSrc=function(){return this.src_},e.prototype.load=function(){if(this.imageState_==Fi){this.imageState_=Ai;try{this.image_.src=this.src_}catch(t){this.handleImageError_()}this.unlisten_=Zi(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}},e.prototype.replaceColor_=function(t){if(this.color_&&!this.canvas_[t]){var e=document.createElement("canvas");this.canvas_[t]=e,e.width=Math.ceil(this.image_.width*t),e.height=Math.ceil(this.image_.height*t);var r=e.getContext("2d");if(r.scale(t,t),r.drawImage(this.image_,0,0),r.globalCompositeOperation="multiply","multiply"===r.globalCompositeOperation||this.isTainted_())r.fillStyle=wo(this.color_),r.fillRect(0,0,e.width,e.height),r.globalCompositeOperation="destination-in",r.drawImage(this.image_,0,0);else{for(var n=r.getImageData(0,0,e.width,e.height),i=n.data,o=this.color_[0]/255,a=this.color_[1]/255,s=this.color_[2]/255,l=this.color_[3],u=0,c=i.length;u0,6);var p=void 0!==n.src?Fi:ki;return r.color_=void 0!==n.color?Oo(n.color):null,r.iconImage_=hp(u,h,c,r.crossOrigin_,p,r.color_),r.offset_=void 0!==n.offset?n.offset:[0,0],r.offsetOrigin_=void 0!==n.offsetOrigin?n.offsetOrigin:ap,r.origin_=null,r.size_=void 0!==n.size?n.size:null,r}return fp(e,t),e.prototype.clone=function(){var t=this.getScale();return new e({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,crossOrigin:this.crossOrigin_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,src:this.getSrc(),offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,size:null!==this.size_?this.size_.slice():void 0,opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView()})},e.prototype.getAnchor=function(){if(this.normalizedAnchor_)return this.normalizedAnchor_;var t=this.anchor_,e=this.getSize();if(this.anchorXUnits_==rp||this.anchorYUnits_==rp){if(!e)return null;t=this.anchor_.slice(),this.anchorXUnits_==rp&&(t[0]*=e[0]),this.anchorYUnits_==rp&&(t[1]*=e[1])}if(this.anchorOrigin_!=ap){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),this.anchorOrigin_!=sp&&this.anchorOrigin_!=op||(t[0]=-t[0]+e[0]),this.anchorOrigin_!=ip&&this.anchorOrigin_!=op||(t[1]=-t[1]+e[1])}return this.normalizedAnchor_=t,this.normalizedAnchor_},e.prototype.setAnchor=function(t){this.anchor_=t,this.normalizedAnchor_=null},e.prototype.getColor=function(){return this.color_},e.prototype.getImage=function(t){return this.iconImage_.getImage(t)},e.prototype.getPixelRatio=function(t){return this.iconImage_.getPixelRatio(t)},e.prototype.getImageSize=function(){return this.iconImage_.getSize()},e.prototype.getHitDetectionImageSize=function(){return this.getImageSize()},e.prototype.getImageState=function(){return this.iconImage_.getImageState()},e.prototype.getHitDetectionImage=function(){return this.iconImage_.getHitDetectionImage()},e.prototype.getOrigin=function(){if(this.origin_)return this.origin_;var t=this.offset_,e=this.getDisplacement();if(this.offsetOrigin_!=ap){var r=this.getSize(),n=this.iconImage_.getSize();if(!r||!n)return null;t=t.slice(),this.offsetOrigin_!=sp&&this.offsetOrigin_!=op||(t[0]=n[0]-r[0]-t[0]),this.offsetOrigin_!=ip&&this.offsetOrigin_!=op||(t[1]=n[1]-r[1]-t[1])}return t[0]+=e[0],t[1]+=e[1],this.origin_=t,this.origin_},e.prototype.getSrc=function(){return this.iconImage_.getSrc()},e.prototype.getSize=function(){return this.size_?this.size_:this.iconImage_.getSize()},e.prototype.listenImageChange=function(t){this.iconImage_.addEventListener(F,t)},e.prototype.load=function(){this.iconImage_.load()},e.prototype.unlistenImageChange=function(t){this.iconImage_.removeEventListener(F,t)},e}(Hh),gp=function(){function t(t){var e=t||{};this.color_=void 0!==e.color?e.color:null,this.lineCap_=e.lineCap,this.lineDash_=void 0!==e.lineDash?e.lineDash:null,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.width_=e.width}return t.prototype.clone=function(){var e=this.getColor();return new t({color:Array.isArray(e)?e.slice():e||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})},t.prototype.getColor=function(){return this.color_},t.prototype.getLineCap=function(){return this.lineCap_},t.prototype.getLineDash=function(){return this.lineDash_},t.prototype.getLineDashOffset=function(){return this.lineDashOffset_},t.prototype.getLineJoin=function(){return this.lineJoin_},t.prototype.getMiterLimit=function(){return this.miterLimit_},t.prototype.getWidth=function(){return this.width_},t.prototype.setColor=function(t){this.color_=t},t.prototype.setLineCap=function(t){this.lineCap_=t},t.prototype.setLineDash=function(t){this.lineDash_=t},t.prototype.setLineDashOffset=function(t){this.lineDashOffset_=t},t.prototype.setLineJoin=function(t){this.lineJoin_=t},t.prototype.setMiterLimit=function(t){this.miterLimit_=t},t.prototype.setWidth=function(t){this.width_=t},t}(),yp=function(){function t(t){var e=t||{};this.geometry_=null,this.geometryFunction_=xp,void 0!==e.geometry&&this.setGeometry(e.geometry),this.fill_=void 0!==e.fill?e.fill:null,this.image_=void 0!==e.image?e.image:null,this.renderer_=void 0!==e.renderer?e.renderer:null,this.stroke_=void 0!==e.stroke?e.stroke:null,this.text_=void 0!==e.text?e.text:null,this.zIndex_=e.zIndex}return t.prototype.clone=function(){var e=this.getGeometry();return e&&"object"==typeof e&&(e=e.clone()),new t({geometry:e,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})},t.prototype.getRenderer=function(){return this.renderer_},t.prototype.setRenderer=function(t){this.renderer_=t},t.prototype.getGeometry=function(){return this.geometry_},t.prototype.getGeometryFunction=function(){return this.geometryFunction_},t.prototype.getFill=function(){return this.fill_},t.prototype.setFill=function(t){this.fill_=t},t.prototype.getImage=function(){return this.image_},t.prototype.setImage=function(t){this.image_=t},t.prototype.getStroke=function(){return this.stroke_},t.prototype.setStroke=function(t){this.stroke_=t},t.prototype.getText=function(){return this.text_},t.prototype.setText=function(t){this.text_=t},t.prototype.getZIndex=function(){return this.zIndex_},t.prototype.setGeometry=function(t){"function"==typeof t?this.geometryFunction_=t:"string"==typeof t?this.geometryFunction_=function(e){return e.get(t)}:t?void 0!==t&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=xp,this.geometry_=t},t.prototype.setZIndex=function(t){this.zIndex_=t},t}();function mp(t){var e;if("function"==typeof t)e=t;else{var r;if(Array.isArray(t))r=t;else pt("function"==typeof t.getZIndex,41),r=[t];e=function(){return r}}return e}var vp=null;function _p(t,e){if(!vp){var r=new ep({color:"rgba(255,255,255,0.4)"}),n=new gp({color:"#3399CC",width:1.25});vp=[new yp({image:new tp({fill:r,stroke:n,radius:5}),fill:r,stroke:n})]}return vp}function bp(){var t={},e=[255,255,255,1],r=[0,153,255,1];return t[bt.POLYGON]=[new yp({fill:new ep({color:[255,255,255,.5]})})],t[bt.MULTI_POLYGON]=t[bt.POLYGON],t[bt.LINE_STRING]=[new yp({stroke:new gp({color:e,width:5})}),new yp({stroke:new gp({color:r,width:3})})],t[bt.MULTI_LINE_STRING]=t[bt.LINE_STRING],t[bt.CIRCLE]=t[bt.POLYGON].concat(t[bt.LINE_STRING]),t[bt.POINT]=[new yp({image:new tp({radius:6,fill:new ep({color:r}),stroke:new gp({color:e,width:1.5})}),zIndex:1/0})],t[bt.MULTI_POINT]=t[bt.POINT],t[bt.GEOMETRY_COLLECTION]=t[bt.POLYGON].concat(t[bt.LINE_STRING],t[bt.POINT]),t}function xp(t){return t.getGeometry()}var wp=yp,Sp="point",Ep="line",Tp=function(){function t(t){var e=t||{};this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.scale_=e.scale,this.scaleArray_=Is(void 0!==e.scale?e.scale:1),this.text_=e.text,this.textAlign_=e.textAlign,this.textBaseline_=e.textBaseline,this.fill_=void 0!==e.fill?e.fill:new ep({color:"#333"}),this.maxAngle_=void 0!==e.maxAngle?e.maxAngle:Math.PI/4,this.placement_=void 0!==e.placement?e.placement:Sp,this.overflow_=!!e.overflow,this.stroke_=void 0!==e.stroke?e.stroke:null,this.offsetX_=void 0!==e.offsetX?e.offsetX:0,this.offsetY_=void 0!==e.offsetY?e.offsetY:0,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=void 0===e.padding?null:e.padding}return t.prototype.clone=function(){var e=this.getScale();return new t({font:this.getFont(),placement:this.getPlacement(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(e)?e.slice():e,text:this.getText(),textAlign:this.getTextAlign(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()})},t.prototype.getOverflow=function(){return this.overflow_},t.prototype.getFont=function(){return this.font_},t.prototype.getMaxAngle=function(){return this.maxAngle_},t.prototype.getPlacement=function(){return this.placement_},t.prototype.getOffsetX=function(){return this.offsetX_},t.prototype.getOffsetY=function(){return this.offsetY_},t.prototype.getFill=function(){return this.fill_},t.prototype.getRotateWithView=function(){return this.rotateWithView_},t.prototype.getRotation=function(){return this.rotation_},t.prototype.getScale=function(){return this.scale_},t.prototype.getScaleArray=function(){return this.scaleArray_},t.prototype.getStroke=function(){return this.stroke_},t.prototype.getText=function(){return this.text_},t.prototype.getTextAlign=function(){return this.textAlign_},t.prototype.getTextBaseline=function(){return this.textBaseline_},t.prototype.getBackgroundFill=function(){return this.backgroundFill_},t.prototype.getBackgroundStroke=function(){return this.backgroundStroke_},t.prototype.getPadding=function(){return this.padding_},t.prototype.setOverflow=function(t){this.overflow_=t},t.prototype.setFont=function(t){this.font_=t},t.prototype.setMaxAngle=function(t){this.maxAngle_=t},t.prototype.setOffsetX=function(t){this.offsetX_=t},t.prototype.setOffsetY=function(t){this.offsetY_=t},t.prototype.setPlacement=function(t){this.placement_=t},t.prototype.setRotateWithView=function(t){this.rotateWithView_=t},t.prototype.setFill=function(t){this.fill_=t},t.prototype.setRotation=function(t){this.rotation_=t},t.prototype.setScale=function(t){this.scale_=t,this.scaleArray_=Is(void 0!==t?t:1)},t.prototype.setStroke=function(t){this.stroke_=t},t.prototype.setText=function(t){this.text_=t},t.prototype.setTextAlign=function(t){this.textAlign_=t},t.prototype.setTextBaseline=function(t){this.textBaseline_=t},t.prototype.setBackgroundFill=function(t){this.backgroundFill_=t},t.prototype.setBackgroundStroke=function(t){this.backgroundStroke_=t},t.prototype.setPadding=function(t){this.padding_=t},t}(),Cp=function(){function t(t){this.first_,this.last_,this.head_,this.circular_=void 0===t||t,this.length_=0}return t.prototype.insertItem=function(t){var e={prev:void 0,next:void 0,data:t},r=this.head_;if(r){var n=r.next;e.prev=r,e.next=n,r.next=e,n&&(n.prev=e),r===this.last_&&(this.last_=e)}else this.first_=e,this.last_=e,this.circular_&&(e.next=e,e.prev=e);this.head_=e,this.length_++},t.prototype.removeItem=function(){var t=this.head_;if(t){var e=t.next,r=t.prev;e&&(e.prev=r),r&&(r.next=e),this.head_=e||r,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_=r?this.head_.prev:this.head_),this.length_--}},t.prototype.firstItem=function(){if(this.head_=this.first_,this.head_)return this.head_.data},t.prototype.lastItem=function(){if(this.head_=this.last_,this.head_)return this.head_.data},t.prototype.nextItem=function(){if(this.head_&&this.head_.next)return this.head_=this.head_.next,this.head_.data},t.prototype.getNextItem=function(){if(this.head_&&this.head_.next)return this.head_.next.data},t.prototype.prevItem=function(){if(this.head_&&this.head_.prev)return this.head_=this.head_.prev,this.head_.data},t.prototype.getPrevItem=function(){if(this.head_&&this.head_.prev)return this.head_.prev.data},t.prototype.getCurrItem=function(){if(this.head_)return this.head_.data},t.prototype.setFirstItem=function(){this.circular_&&this.head_&&(this.first_=this.head_,this.last_=this.head_.prev)},t.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}},t.prototype.getLength=function(){return this.length_},t}(),Op=r(1),Pp=r.n(Op),Rp=function(){function t(t){this.rbush_=new Pp.a(t),this.items_={}}return t.prototype.insert=function(t,e){var r={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(r),this.items_[o(e)]=r},t.prototype.load=function(t,e){for(var r=new Array(e.length),n=0,i=e.length;nthis.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]-m>this.sourceWorldWidth_/2&&(e[0][0]-=this.sourceWorldWidth_),e[1][0]-m>this.sourceWorldWidth_/2&&(e[1][0]-=this.sourceWorldWidth_),e[2][0]-m>this.sourceWorldWidth_/2&&(e[2][0]-=this.sourceWorldWidth_);var r=Math.min(e[0][0],e[1][0],e[2][0]);Math.max(e[0][0],e[1][0],e[2][0])-r.5&&c<1,f=!1;if(l>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_)f=Pe(Kt([t,e,r,n]))/this.targetWorldWidth_>.25||f;!p&&this.sourceProj_.isGlobal()&&c&&(f=c>.25||f)}if(!(!f&&this.maxSourceExtent_&&isFinite(u[0])&&isFinite(u[1])&&isFinite(u[2])&&isFinite(u[3]))||Re(u,this.maxSourceExtent_)){var d=0;if(!(f||isFinite(i[0])&&isFinite(i[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(a[0])&&isFinite(a[1])&&isFinite(s[0])&&isFinite(s[1])))if(l>0)f=!0;else if(1!=(d=(isFinite(i[0])&&isFinite(i[1])?0:8)+(isFinite(o[0])&&isFinite(o[1])?0:4)+(isFinite(a[0])&&isFinite(a[1])?0:2)+(isFinite(s[0])&&isFinite(s[1])?0:1))&&2!=d&&4!=d&&8!=d)return;if(l>0){if(!f){var g=[(t[0]+r[0])/2,(t[1]+r[1])/2],y=this.transformInv_(g),m=void 0;if(p)m=(We(i[0],h)+We(a[0],h))/2-We(y[0],h);else m=(i[0]+a[0])/2-y[0];var v=(i[1]+a[1])/2-y[1];f=m*m+v*v>this.errorThresholdSquared_}if(f){if(Math.abs(t[0]-r[0])<=Math.abs(t[1]-r[1])){var _=[(e[0]+r[0])/2,(e[1]+r[1])/2],b=this.transformInv_(_),x=[(n[0]+t[0])/2,(n[1]+t[1])/2],w=this.transformInv_(x);this.addQuad_(t,e,_,x,i,o,b,w,l-1),this.addQuad_(x,_,r,n,w,b,a,s,l-1)}else{var S=[(t[0]+e[0])/2,(t[1]+e[1])/2],E=this.transformInv_(S),T=[(r[0]+n[0])/2,(r[1]+n[1])/2],C=this.transformInv_(T);this.addQuad_(t,S,T,n,i,E,C,s,l-1),this.addQuad_(S,e,r,T,E,o,a,C,l-1)}return}}if(p){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}0==(11&d)&&this.addTriangle_(t,r,n,i,a,s),0==(14&d)&&this.addTriangle_(t,r,e,i,a,o),d&&(0==(13&d)&&this.addTriangle_(e,n,t,o,s,i),0==(7&d)&&this.addTriangle_(e,n,r,o,s,a))}},t.prototype.calculateSourceExtent=function(){var t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach((function(e,r,n){var i=e.source;pe(t,i[0]),pe(t,i[1]),pe(t,i[2])})),t},t.prototype.getTriangles=function(){return this.triangles_},t}(),Lp=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Mp=function(t){function e(e,r,n,i,o,a,s,l,u,c,h,p){var f=t.call(this,o,Ji)||this;f.renderEdges_=void 0!==h&&h,f.contextOptions_=p,f.pixelRatio_=s,f.gutter_=l,f.canvas_=null,f.sourceTileGrid_=r,f.targetTileGrid_=i,f.wrappedTileCoord_=a||o,f.sourceTiles_=[],f.sourcesListenerKeys_=null,f.sourceZ_=0;var d=i.getTileCoordExtent(f.wrappedTileCoord_),g=f.targetTileGrid_.getExtent(),y=f.sourceTileGrid_.getExtent(),m=g?Te(d,g):d;if(0===ve(m))return f.state=ro,f;var v=e.getExtent();v&&(y=y?Te(y,v):v);var _=i.getResolution(f.wrappedTileCoord_[0]),b=ec(e,n,m,_);if(!isFinite(b)||b<=0)return f.state=ro,f;var x=void 0!==c?c:.5;if(f.triangulation_=new Ip(e,n,m,y,b*x,_),0===f.triangulation_.getTriangles().length)return f.state=ro,f;f.sourceZ_=r.getZForResolution(b);var w=f.triangulation_.calculateSourceExtent();if(y&&(e.canWrapX()?(w[1]=Ne(w[1],y[1],y[3]),w[3]=Ne(w[3],y[1],y[3])):w=Te(w,y)),ve(w)){for(var S=r.getTileRangeForExtentAndZ(w,f.sourceZ_),E=S.minX;E<=S.maxX;E++)for(var T=S.minY;T<=S.maxY;T++){var C=u(f.sourceZ_,E,T,s);C&&f.sourceTiles_.push(C)}0===f.sourceTiles_.length&&(f.state=ro)}else f.state=ro;return f}return Lp(e,t),e.prototype.getImage=function(){return this.canvas_},e.prototype.reproject_=function(){var t=[];if(this.sourceTiles_.forEach(function(e,r,n){e&&e.getState()==to&&t.push({extent:this.sourceTileGrid_.getTileCoordExtent(e.tileCoord),image:e.getImage()})}.bind(this)),this.sourceTiles_.length=0,0===t.length)this.state=eo;else{var e=this.wrappedTileCoord_[0],r=this.targetTileGrid_.getTileSize(e),n="number"==typeof r?r:r[0],i="number"==typeof r?r:r[1],o=this.targetTileGrid_.getResolution(e),a=this.sourceTileGrid_.getResolution(this.sourceZ_),s=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=rc(n,i,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,s,this.triangulation_,t,this.gutter_,this.renderEdges_,this.contextOptions_),this.state=to}this.changed()},e.prototype.load=function(){if(this.state==Ji){this.state=Qi,this.changed();var t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(function(e,r,n){var i=e.getState();if(i==Ji||i==Qi){t++;var o=Z(e,F,(function(r){var n=e.getState();n!=to&&n!=eo&&n!=ro||(H(o),0===--t&&(this.unlistenSources_(),this.reproject_()))}),this);this.sourcesListenerKeys_.push(o)}}.bind(this)),this.sourceTiles_.forEach((function(t,e,r){t.getState()==Ji&&t.load()})),0===t&&setTimeout(this.reproject_.bind(this),0)}},e.prototype.unlistenSources_=function(){this.sourcesListenerKeys_.forEach(H),this.sourcesListenerKeys_=null},e}(lo),Fp="tileloadstart",Ap="tileloadend",kp="tileloaderror",jp=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Np(t){return t?Array.isArray(t)?function(e){return t}:"function"==typeof t?t:function(e){return[t]}:null}var Dp=function(t){function e(e){var r=t.call(this)||this;return r.projection_=Gr(e.projection),r.attributions_=Np(e.attributions),r.attributionsCollapsible_=void 0===e.attributionsCollapsible||e.attributionsCollapsible,r.loading=!1,r.state_=void 0!==e.state?e.state:Qo,r.wrapX_=void 0!==e.wrapX&&e.wrapX,r}return jp(e,t),e.prototype.getAttributions=function(){return this.attributions_},e.prototype.getAttributionsCollapsible=function(){return this.attributionsCollapsible_},e.prototype.getProjection=function(){return this.projection_},e.prototype.getResolutions=function(){return n()},e.prototype.getState=function(){return this.state_},e.prototype.getWrapX=function(){return this.wrapX_},e.prototype.getContextOptions=function(){},e.prototype.refresh=function(){this.changed()},e.prototype.setAttributions=function(t){this.attributions_=Np(t),this.changed()},e.prototype.setState=function(t){this.state_=t,this.changed()},e}(ot),Gp=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),zp=function(t){function e(e){var r=t.call(this,{attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:e.projection,state:e.state,wrapX:e.wrapX})||this;r.opaque_=void 0!==e.opaque&&e.opaque,r.tilePixelRatio_=void 0!==e.tilePixelRatio?e.tilePixelRatio:1,r.tileGrid=void 0!==e.tileGrid?e.tileGrid:null;var n=e.tileGrid;return n&&Is(n.getTileSize(n.getMinZoom()),[256,256]),r.tileCache=new yu(e.cacheSize||0),r.tmpSize=[0,0],r.key_=e.key||"",r.tileOptions={transition:e.transition},r.zDirection=e.zDirection?e.zDirection:0,r}return Gp(e,t),e.prototype.canExpireCache=function(){return this.tileCache.canExpireCache()},e.prototype.expireCache=function(t,e){var r=this.getTileCacheForProjection(t);r&&r.expireCache(e)},e.prototype.forEachLoadedTile=function(t,e,r,n){var i=this.getTileCacheForProjection(t);if(!i)return!1;for(var o,a,s,l=!0,u=r.minX;u<=r.maxX;++u)for(var c=r.minY;c<=r.maxY;++c)a=cu(e,u,c),s=!1,i.containsKey(a)&&(s=(o=i.get(a)).getState()===to)&&(s=!1!==n(o)),s||(l=!1);return l},e.prototype.getGutterForProjection=function(t){return 0},e.prototype.getKey=function(){return this.key_},e.prototype.setKey=function(t){this.key_!==t&&(this.key_=t,this.changed())},e.prototype.getOpaque=function(t){return this.opaque_},e.prototype.getResolutions=function(){return this.tileGrid.getResolutions()},e.prototype.getTile=function(t,e,r,i,o){return n()},e.prototype.getTileGrid=function(){return this.tileGrid},e.prototype.getTileGridForProjection=function(t){return this.tileGrid?this.tileGrid:oc(t)},e.prototype.getTileCacheForProjection=function(t){return pt(Xr(this.getProjection(),t),68),this.tileCache},e.prototype.getTilePixelRatio=function(t){return this.tilePixelRatio_},e.prototype.getTilePixelSize=function(t,e,r){var n=this.getTileGridForProjection(r),i=this.getTilePixelRatio(e),o=Is(n.getTileSize(t),this.tmpSize);return 1==i?o:Rs(o,i,this.tmpSize)},e.prototype.getTileCoordForTileUrlFunction=function(t,e){var r=void 0!==e?e:this.getProjection(),n=this.getTileGridForProjection(r);return this.getWrapX()&&r.isGlobal()&&(t=ac(n,t,r)),du(t,n)?t:null},e.prototype.clear=function(){this.tileCache.clear()},e.prototype.refresh=function(){this.clear(),t.prototype.refresh.call(this)},e.prototype.updateCacheSize=function(t,e){var r=this.getTileCacheForProjection(e);t>r.highWaterMark&&(r.highWaterMark=t)},e.prototype.useTile=function(t,e,r,n){},e}(Dp),Up=function(t){function e(e,r){var n=t.call(this,e)||this;return n.tile=r,n}return Gp(e,t),e}(c),Bp=zp,Vp=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Yp=function(t){function e(r){var n=t.call(this,{attributions:r.attributions,cacheSize:r.cacheSize,opaque:r.opaque,projection:r.projection,state:r.state,tileGrid:r.tileGrid,tilePixelRatio:r.tilePixelRatio,wrapX:r.wrapX,transition:r.transition,key:r.key,attributionsCollapsible:r.attributionsCollapsible,zDirection:r.zDirection})||this;return n.generateTileUrlFunction_=n.tileUrlFunction===e.prototype.tileUrlFunction,n.tileLoadFunction=r.tileLoadFunction,r.tileUrlFunction&&(n.tileUrlFunction=r.tileUrlFunction),n.urls=null,r.urls?n.setUrls(r.urls):r.url&&n.setUrl(r.url),n.tileLoadingKeys_={},n}return Vp(e,t),e.prototype.getTileLoadFunction=function(){return this.tileLoadFunction},e.prototype.getTileUrlFunction=function(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction},e.prototype.getUrls=function(){return this.urls},e.prototype.handleTileChange=function(t){var e,r=t.target,n=o(r),i=r.getState();i==Qi?(this.tileLoadingKeys_[n]=!0,e=Fp):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],e=i==eo?kp:i==to?Ap:void 0),null!=e&&this.dispatchEvent(new Up(e,r))},e.prototype.setTileLoadFunction=function(t){this.tileCache.clear(),this.tileLoadFunction=t,this.changed()},e.prototype.setTileUrlFunction=function(t,e){this.tileUrlFunction=t,this.tileCache.pruneExceptNewestZ(),void 0!==e?this.setKey(e):this.changed()},e.prototype.setUrl=function(t){var e=yc(t);this.urls=e,this.setUrls(e)},e.prototype.setUrls=function(t){this.urls=t;var e=t.join("\n");this.generateTileUrlFunction_?this.setTileUrlFunction(fc(t,this.tileGrid),e):this.setKey(e)},e.prototype.tileUrlFunction=function(t,e,r){},e.prototype.useTile=function(t,e,r){var n=cu(t,e,r);this.tileCache.containsKey(n)&&this.tileCache.get(n)},e}(Bp),Wp=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function qp(t,e){t.getImage().src=e}var Xp=function(t){function e(e){var r=t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,opaque:e.opaque,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:qp,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection})||this;return r.crossOrigin=void 0!==e.crossOrigin?e.crossOrigin:null,r.tileClass=void 0!==e.tileClass?e.tileClass:vo,r.tileCacheForProjection={},r.tileGridForProjection={},r.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,r.contextOptions_=!1===e.imageSmoothing?$u:void 0,r.renderReprojectionEdges_=!1,r}return Wp(e,t),e.prototype.canExpireCache=function(){if(this.tileCache.canExpireCache())return!0;for(var t in this.tileCacheForProjection)if(this.tileCacheForProjection[t].canExpireCache())return!0;return!1},e.prototype.expireCache=function(t,e){var r=this.getTileCacheForProjection(t);for(var n in this.tileCache.expireCache(this.tileCache==r?e:{}),this.tileCacheForProjection){var i=this.tileCacheForProjection[n];i.expireCache(i==r?e:{})}},e.prototype.getContextOptions=function(){return this.contextOptions_},e.prototype.getGutterForProjection=function(t){return this.getProjection()&&t&&!Xr(this.getProjection(),t)?0:this.getGutter()},e.prototype.getGutter=function(){return 0},e.prototype.getKey=function(){return t.prototype.getKey.call(this)+(this.contextOptions_?"\n"+JSON.stringify(this.contextOptions_):"")},e.prototype.getOpaque=function(e){return!(this.getProjection()&&e&&!Xr(this.getProjection(),e))&&t.prototype.getOpaque.call(this,e)},e.prototype.getTileGridForProjection=function(t){var e=this.getProjection();if(!this.tileGrid||e&&!Xr(e,t)){var r=o(t);return r in this.tileGridForProjection||(this.tileGridForProjection[r]=oc(t)),this.tileGridForProjection[r]}return this.tileGrid},e.prototype.getTileCacheForProjection=function(t){var e=this.getProjection();if(!e||Xr(e,t))return this.tileCache;var r=o(t);return r in this.tileCacheForProjection||(this.tileCacheForProjection[r]=new yu(this.tileCache.highWaterMark)),this.tileCacheForProjection[r]},e.prototype.createTile_=function(t,e,r,n,i,o){var a=[t,e,r],s=this.getTileCoordForTileUrlFunction(a,i),l=s?this.tileUrlFunction(s,n,i):void 0,u=new this.tileClass(a,void 0!==l?Ji:ro,void 0!==l?l:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return u.key=o,u.addEventListener(F,this.handleTileChange.bind(this)),u},e.prototype.getTile=function(t,e,r,n,i){var o=this.getProjection();if(o&&i&&!Xr(o,i)){var a=this.getTileCacheForProjection(i),s=[t,e,r],l=void 0,u=hu(s);a.containsKey(u)&&(l=a.get(u));var c=this.getKey();if(l&&l.key==c)return l;var h=this.getTileGridForProjection(o),p=this.getTileGridForProjection(i),f=this.getTileCoordForTileUrlFunction(s,i),d=new Mp(o,h,i,p,s,f,this.getTilePixelRatio(n),this.getGutter(),function(t,e,r,n){return this.getTileInternal(t,e,r,n,o)}.bind(this),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.contextOptions_);return d.key=c,l?(d.interimTile=l,d.refreshInterimChain(),a.replace(u,d)):a.set(u,d),d}return this.getTileInternal(t,e,r,n,o||i)},e.prototype.getTileInternal=function(t,e,r,n,i){var o=null,a=cu(t,e,r),s=this.getKey();if(this.tileCache.containsKey(a)){if((o=this.tileCache.get(a)).key!=s){var l=o;o=this.createTile_(t,e,r,n,i,s),l.getState()==Ji?o.interimTile=l.interimTile:o.interimTile=l,o.refreshInterimChain(),this.tileCache.replace(a,o)}}else o=this.createTile_(t,e,r,n,i,s),this.tileCache.set(a,o);return o},e.prototype.setRenderReprojectionEdges=function(t){if(this.renderReprojectionEdges_!=t){for(var e in this.renderReprojectionEdges_=t,this.tileCacheForProjection)this.tileCacheForProjection[e].clear();this.changed()}},e.prototype.setTileGridForProjection=function(t,e){var r=Gr(t);if(r){var n=o(r);n in this.tileGridForProjection||(this.tileGridForProjection[n]=e)}},e}(Yp),Zp=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Kp(t){var e,r,n=t[0],i=new Array(n),o=1<>=1;return i.join("")}var Hp=function(t){function e(e){var r=this,n=void 0!==e.hidpi&&e.hidpi;return(r=t.call(this,{cacheSize:e.cacheSize,crossOrigin:"anonymous",imageSmoothing:e.imageSmoothing,opaque:!0,projection:Gr("EPSG:3857"),reprojectionErrorThreshold:e.reprojectionErrorThreshold,state:Jo,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:n?2:1,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition})||this).hidpi_=n,r.culture_=void 0!==e.culture?e.culture:"en-us",r.maxZoom_=void 0!==e.maxZoom?e.maxZoom:-1,r.apiKey_=e.key,r.imagerySet_=e.imagerySet,Au("https://dev.virtualearth.net/REST/v1/Imagery/Metadata/"+r.imagerySet_+"?uriScheme=https&include=ImageryProviders&key="+r.apiKey_+"&c="+r.culture_,r.handleImageryMetadataResponse.bind(r),void 0,"jsonp"),r}return Zp(e,t),e.prototype.getApiKey=function(){return this.apiKey_},e.prototype.getImagerySet=function(){return this.imagerySet_},e.prototype.handleImageryMetadataResponse=function(t){if(200==t.statusCode&&"OK"==t.statusDescription&&"ValidCredentials"==t.authenticationResultCode&&1==t.resourceSets.length&&1==t.resourceSets[0].resources.length){var e=t.resourceSets[0].resources[0],r=-1==this.maxZoom_?e.zoomMax:this.maxZoom_,n=hc(this.getProjection()),i=this.hidpi_?2:1,o=e.imageWidth==e.imageHeight?e.imageWidth/i:[e.imageWidth/i,e.imageHeight/i],a=lc({extent:n,minZoom:e.zoomMin,maxZoom:r,tileSize:o});this.tileGrid=a;var s=this.culture_,l=this.hidpi_;if(this.tileUrlFunction=dc(e.imageUrlSubdomains.map((function(t){var r=[0,0,0],n=e.imageUrl.replace("{subdomain}",t).replace("{culture}",s);return function(t,e,i){if(t){uu(t[0],t[1],t[2],r);var o=n;return l&&(o+="&dpi=d1&device=mobile"),o.replace("{quadkey}",Kp(r))}}}))),e.imageryProviders){var u=Zr(Gr("EPSG:4326"),this.getProjection());this.setAttributions(function(t){var r=[],n=t.viewState,i=this.getTileGrid(),o=i.getZForResolution(n.resolution,this.zDirection),a=i.getTileCoordForCoordAndZ(n.center,o)[0];return e.imageryProviders.map((function(e){for(var n=!1,i=e.coverageAreas,o=0,s=i.length;o=l.zoomMin&&a<=l.zoomMax){var c=l.bbox;if(Re(Ae([c[1],c[0],c[3],c[2]],u),t.extent)){n=!0;break}}}n&&r.push(e.attribution)})),r.push('Terms of Use'),r}.bind(this))}this.setState(Qo)}else this.setState(ta)},e}(Xp),$p=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Jp=function(t){function e(e){var r=e||{},n=void 0!==r.projection?r.projection:"EPSG:3857",i=void 0!==r.tileGrid?r.tileGrid:lc({extent:hc(n),maxResolution:r.maxResolution,maxZoom:r.maxZoom,minZoom:r.minZoom,tileSize:r.tileSize});return t.call(this,{attributions:r.attributions,cacheSize:r.cacheSize,crossOrigin:r.crossOrigin,imageSmoothing:r.imageSmoothing,opaque:r.opaque,projection:n,reprojectionErrorThreshold:r.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:r.tileLoadFunction,tilePixelRatio:r.tilePixelRatio,tileUrlFunction:r.tileUrlFunction,url:r.url,urls:r.urls,wrapX:void 0===r.wrapX||r.wrapX,transition:r.transition,attributionsCollapsible:r.attributionsCollapsible,zDirection:r.zDirection})||this}return $p(e,t),e}(Xp),Qp=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),tf=function(t){function e(e){var r=t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,maxZoom:void 0!==e.maxZoom?e.maxZoom:18,minZoom:e.minZoom,projection:e.projection,transition:e.transition,wrapX:e.wrapX})||this;return r.account_=e.account,r.mapId_=e.map||"",r.config_=e.config||{},r.templateCache_={},r.initializeMap_(),r}return Qp(e,t),e.prototype.getConfig=function(){return this.config_},e.prototype.updateConfig=function(t){O(this.config_,t),this.initializeMap_()},e.prototype.setConfig=function(t){this.config_=t||{},this.initializeMap_()},e.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 r=new XMLHttpRequest;r.addEventListener("load",this.handleInitResponse_.bind(this,t)),r.addEventListener("error",this.handleInitError_.bind(this)),r.open("POST",e),r.setRequestHeader("Content-type","application/json"),r.send(JSON.stringify(this.config_))}},e.prototype.handleInitResponse_=function(t,e){var r=e.target;if(!r.status||r.status>=200&&r.status<300){var n=void 0;try{n=JSON.parse(r.responseText)}catch(t){return void this.setState(ta)}this.applyTemplate_(n),this.templateCache_[t]=n,this.setState(Qo)}else this.setState(ta)},e.prototype.handleInitError_=function(t){this.setState(ta)},e.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)},e}(Jp),ef="addfeature",rf="changefeature",nf="clear",of="removefeature",af="featuresloadstart",sf="featuresloadend",lf="featuresloaderror",uf=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),cf=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.feature=r,i.features=n,i}return uf(e,t),e}(c),hf=function(t){function e(e){var r=this,n=e||{};(r=t.call(this,{attributions:n.attributions,projection:void 0,state:Qo,wrapX:void 0===n.wrapX||n.wrapX})||this).loader_=T,r.format_=n.format,r.overlaps_=void 0===n.overlaps||n.overlaps,r.url_=n.url,void 0!==n.loader?r.loader_=n.loader:void 0!==r.url_&&(pt(r.format_,7),r.loader_=Mu(r.url_,r.format_)),r.strategy_=void 0!==n.strategy?n.strategy:Fu;var i,o,a=void 0===n.useSpatialIndex||n.useSpatialIndex;return r.featuresRtree_=a?new Rp:null,r.loadedExtentsRtree_=new Rp,r.nullGeometryFeatures_={},r.idIndex_={},r.uidIndex_={},r.featureChangeKeys_={},r.featuresCollection_=null,Array.isArray(n.features)?o=n.features:n.features&&(o=(i=n.features).getArray()),a||void 0!==i||(i=new ht(o)),void 0!==o&&r.addFeaturesInternal(o),void 0!==i&&r.bindFeaturesCollection_(i),r}return uf(e,t),e.prototype.addFeature=function(t){this.addFeatureInternal(t),this.changed()},e.prototype.addFeatureInternal=function(t){var e=o(t);if(this.addToIndex_(e,t)){this.setupChangeEvents_(e,t);var r=t.getGeometry();if(r){var n=r.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(n,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new cf(ef,t))}else this.featuresCollection_&&this.featuresCollection_.remove(t)},e.prototype.setupChangeEvents_=function(t,e){this.featureChangeKeys_[t]=[Z(e,F,this.handleFeatureChange_,this),Z(e,h,this.handleFeatureChange_,this)]},e.prototype.addToIndex_=function(t,e){var r=!0,n=e.getId();return void 0!==n&&(n.toString()in this.idIndex_?r=!1:this.idIndex_[n.toString()]=e),r&&(pt(!(t in this.uidIndex_),30),this.uidIndex_[t]=e),r},e.prototype.addFeatures=function(t){this.addFeaturesInternal(t),this.changed()},e.prototype.addFeaturesInternal=function(t){for(var e=[],r=[],n=[],i=0,a=t.length;i=0;--r){var n=this.geometryFunction(t[r]);n?xr(e,n.getCoordinates()):t.splice(r,1)}Pr(e,1/t.length);var i=new gt(new qn(e));return i.set("features",t),i},e}(hf),df=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),gf="default",yf="truncated",mf=function(t){function e(e,r,n,i,o,a,s){var l=t.call(this,r,n,i,o,a,s)||this;return l.zoomifyImage_=null,l.tileSize_=e,l}return df(e,t),e.prototype.getImage=function(){if(this.zoomifyImage_)return this.zoomifyImage_;var e=t.prototype.getImage.call(this);if(this.state==to){var r=this.tileSize_;if(e.width==r[0]&&e.height==r[1])return this.zoomifyImage_=e,e;var n=uo(r[0],r[1]);return n.drawImage(e,0,0),this.zoomifyImage_=n.canvas,n.canvas}return e},e}(vo),vf=function(t){function e(e){var r=this,n=e,i=n.size,o=void 0!==n.tierSizeCalculation?n.tierSizeCalculation:gf,a=n.tilePixelRatio||1,s=i[0],l=i[1],u=[],c=n.tileSize||256,h=c*a;switch(o){case gf:for(;s>h||l>h;)u.push([Math.ceil(s/h),Math.ceil(l/h)]),h+=h;break;case yf:for(var p=s,f=l;p>h||f>h;)u.push([Math.ceil(p/h),Math.ceil(f/h)]),p>>=1,f>>=1;break;default:pt(!1,53)}u.push([1,1]),u.reverse();for(var d=[a],g=[0],y=1,m=u.length;y1,n=r&&t.imageInfo.profile[1].supports?t.imageInfo.profile[1].supports:[],i=r&&t.imageInfo.profile[1].formats?t.imageInfo.profile[1].formats:[],o=r&&t.imageInfo.profile[1].qualities?t.imageInfo.profile[1].qualities:[];return{url:t.imageInfo["@id"].replace(/\/?(?:info\.json)?$/g,""),sizes:void 0===t.imageInfo.sizes?void 0:t.imageInfo.sizes.map((function(t){return[t.width,t.height]})),tileSize:void 0===t.imageInfo.tiles?void 0:[t.imageInfo.tiles.map((function(t){return t.width}))[0],t.imageInfo.tiles.map((function(t){return void 0===t.height?t.width:t.height}))[0]],resolutions:void 0===t.imageInfo.tiles?void 0:t.imageInfo.tiles.map((function(t){return t.scaleFactors}))[0],supports:_f(e.supports,n),formats:_f(e.formats,i),qualities:_f(e.qualities,o)}},Of[wf]=function(t){var e=t.getComplianceLevelSupportedFeatures(),r=void 0===t.imageInfo.extraFormats?e.formats:_f(e.formats,t.imageInfo.extraFormats),n=void 0!==t.imageInfo.preferredFormats&&Array.isArray(t.imageInfo.preferredFormats)&&t.imageInfo.preferredFormats.length>0?t.imageInfo.preferredFormats.filter((function(t){return["jpg","png","gif"].includes(t)})).reduce((function(t,e){return void 0===t&&r.includes(e)?e:t}),void 0):void 0;return{url:t.imageInfo.id,sizes:void 0===t.imageInfo.sizes?void 0:t.imageInfo.sizes.map((function(t){return[t.width,t.height]})),tileSize:void 0===t.imageInfo.tiles?void 0:[t.imageInfo.tiles.map((function(t){return t.width}))[0],t.imageInfo.tiles.map((function(t){return t.height}))[0]],resolutions:void 0===t.imageInfo.tiles?void 0:t.imageInfo.tiles.map((function(t){return t.scaleFactors}))[0],supports:void 0===t.imageInfo.extraFeatures?e.supports:_f(e.supports,t.imageInfo.extraFeatures),formats:r,qualities:void 0===t.imageInfo.extraQualities?e.qualities:_f(e.qualities,t.imageInfo.extraQualities),preferredFormat:n}};var Pf=function(){function t(t){this.setImageInfo(t)}return t.prototype.setImageInfo=function(t){this.imageInfo="string"==typeof t?JSON.parse(t):t},t.prototype.getImageApiVersion=function(){if(void 0!==this.imageInfo){var t=this.imageInfo["@context"]||"ol-no-context";"string"==typeof t&&(t=[t]);for(var e=0;e0&&"string"==typeof this.imageInfo.profile[0]&&Tf.test(this.imageInfo.profile[0]))return this.imageInfo.profile[0]}},t.prototype.getComplianceLevelFromProfile=function(t){var e=this.getComplianceLevelEntryFromProfile(t);if(void 0!==e){var r=e.match(/level[0-2](?:\.json)?$/g);return Array.isArray(r)?r[0].replace(".json",""):void 0}},t.prototype.getComplianceLevelSupportedFeatures=function(){if(void 0!==this.imageInfo){var t=this.getImageApiVersion(),e=this.getComplianceLevelFromProfile(t);return void 0===e?Sf.none.none:Sf[t][e]}},t.prototype.getTileSourceOptions=function(t){var e=t||{},r=this.getImageApiVersion();if(void 0!==r){var n=void 0===r?void 0:Of[r](this);if(void 0!==n)return{url:n.url,version:r,size:[this.imageInfo.width,this.imageInfo.height],sizes:n.sizes,format:void 0!==e.format&&n.formats.includes(e.format)?e.format:void 0!==n.preferredFormat?n.preferredFormat:"jpg",supports:n.supports,quality:e.quality&&n.qualities.includes(e.quality)?e.quality:n.qualities.includes("native")?"native":"default",resolutions:Array.isArray(n.resolutions)?n.resolutions.sort((function(t,e){return e-t})):void 0,tileSize:n.tileSize}}},t}(),Rf=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function If(t){return t.toLocaleString("en",{maximumFractionDigits:10})}var Lf=function(t){function e(e){var r=this,n=e||{},i=n.url||"";i+=i.lastIndexOf("/")===i.length-1||""===i?"":"/";var o=n.version||xf,a=n.sizes||[],s=n.size;pt(null!=s&&Array.isArray(s)&&2==s.length&&!isNaN(s[0])&&s[0]>0&&!isNaN(s[1])&&s[1]>0,60);var l,u,c,h=s[0],p=s[1],f=n.tileSize,d=n.tilePixelRatio||1,g=n.format||"jpg",y=n.quality||(n.version==bf?"native":"default"),m=n.resolutions||[],v=n.supports||[],_=n.extent||[0,-p,h,0],b=null!=a&&Array.isArray(a)&&a.length>0,x=void 0!==f&&("number"==typeof f&&Number.isInteger(f)&&f>0||Array.isArray(f)&&f.length>0),w=null!=v&&Array.isArray(v)&&(v.includes("regionByPx")||v.includes("regionByPct"))&&(v.includes("sizeByWh")||v.includes("sizeByH")||v.includes("sizeByW")||v.includes("sizeByPct"));if(m.sort((function(t,e){return e-t})),x||w)if(null!=f&&("number"==typeof f&&Number.isInteger(f)&&f>0?(l=f,u=f):Array.isArray(f)&&f.length>0&&((1==f.length||null==f[1]&&Number.isInteger(f[0]))&&(l=f[0],u=f[0]),2==f.length&&(Number.isInteger(f[0])&&Number.isInteger(f[1])?(l=f[0],u=f[1]):null==f[0]&&Number.isInteger(f[1])&&(l=f[1],u=f[1])))),void 0!==l&&void 0!==u||(l=256,u=256),0==m.length)for(var S=c=Math.max(Math.ceil(Math.log(h/l)/Math.LN2),Math.ceil(Math.log(p/u)/Math.LN2));S>=0;S--)m.push(Math.pow(2,S));else{var E=Math.max.apply(Math,m);c=Math.round(Math.log(E)/Math.LN2)}else if(l=h,u=p,m=[],b){a.sort((function(t,e){return t[0]-e[0]})),c=-1;var T=[];for(S=0;S0&&m[m.length-1]==C?T.push(S):(m.push(C),c++)}if(T.length>0)for(S=0;Sc)){var d=t[1],_=t[2],S=m[f];if(!(void 0===d||void 0===_||void 0===S||d<0||Math.ceil(h/S/l)<=d||_<0||Math.ceil(p/S/u)<=_)){if(w||x){var E=d*l*S,T=_*u*S,C=l*S,O=u*S,P=l,R=u;if(E+C>h&&(C=h-E),T+O>p&&(O=p-T),E+l*S>h&&(P=Math.floor((h-E+S-1)/S)),T+u*S>p&&(R=Math.floor((p-T+S-1)/S)),0==E&&C==h&&0==T&&O==p)n="full";else if(!w||v.includes("regionByPx"))n=E+","+T+","+C+","+O;else if(v.includes("regionByPct")){n="pct:"+If(E/h*100)+","+If(T/p*100)+","+If(C/h*100)+","+If(O/p*100)}o!=wf||w&&!v.includes("sizeByWh")?!w||v.includes("sizeByW")?s=P+",":v.includes("sizeByH")?s=","+R:v.includes("sizeByWh")?s=P+","+R:v.includes("sizeByPct")&&(s="pct:"+If(100/S)):s=P+","+R}else if(n="full",b){var I=a[f][0],L=a[f][1];s=o==wf?I==h&&L==p?"max":I+","+L:I==h?"full":I+","}else s=o==wf?"max":"full";return i+n+"/"+s+"/0/"+y+"."+g}}},transition:n.transition})||this).zDirection=n.zDirection,r}return Rf(e,t),e}(Xp),Mf=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ff=function(t){function e(e,r,n,i,o,a,s){var l=this,u=e.getExtent(),c=r.getExtent(),h=c?Te(n,c):n,p=tc(e,r,xe(h),i),f=new Ip(e,r,h,u,.5*p,i),d=a(f.calculateSourceExtent(),p,o),g=d?Fi:Ni,y=d?d.getPixelRatio():1;return(l=t.call(this,n,i,y,g)||this).targetProj_=r,l.maxSourceExtent_=u,l.triangulation_=f,l.targetResolution_=i,l.targetExtent_=n,l.sourceImage_=d,l.sourcePixelRatio_=y,l.contextOptions_=s,l.canvas_=null,l.sourceListenerKey_=null,l}return Mf(e,t),e.prototype.disposeInternal=function(){this.state==Ai&&this.unlistenSource_(),t.prototype.disposeInternal.call(this)},e.prototype.getImage=function(){return this.canvas_},e.prototype.getProjection=function(){return this.targetProj_},e.prototype.reproject_=function(){var t=this.sourceImage_.getState();if(t==ki){var e=Pe(this.targetExtent_)/this.targetResolution_,r=Ee(this.targetExtent_)/this.targetResolution_;this.canvas_=rc(e,r,this.sourcePixelRatio_,this.sourceImage_.getResolution(),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0,void 0,this.contextOptions_)}this.state=t,this.changed()},e.prototype.load=function(){if(this.state==Fi){this.state=Ai,this.changed();var t=this.sourceImage_.getState();t==ki||t==ji?this.reproject_():(this.sourceListenerKey_=Z(this.sourceImage_,F,(function(t){var e=this.sourceImage_.getState();e!=ki&&e!=ji||(this.unlistenSource_(),this.reproject_())}),this),this.sourceImage_.load())}},e.prototype.unlistenSource_=function(){H(this.sourceListenerKey_),this.sourceListenerKey_=null},e}(Mi),Af=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),kf="imageloadstart",jf="imageloadend",Nf="imageloaderror",Df=function(t){function e(e,r){var n=t.call(this,e)||this;return n.image=r,n}return Af(e,t),e}(c);function Gf(t,e){t.getImage().src=e}var zf=function(t){function e(e){var r=t.call(this,{attributions:e.attributions,projection:e.projection,state:e.state})||this;return r.resolutions_=void 0!==e.resolutions?e.resolutions:null,r.reprojectedImage_=null,r.reprojectedRevision_=0,r.contextOptions_=!1===e.imageSmoothing?$u:void 0,r}return Af(e,t),e.prototype.getResolutions=function(){return this.resolutions_},e.prototype.getContextOptions=function(){return this.contextOptions_},e.prototype.findNearestResolution=function(t){if(this.resolutions_){var e=y(this.resolutions_,t,0);t=this.resolutions_[e]}return t},e.prototype.getImage=function(t,e,r,n){var i=this.getProjection();if(i&&n&&!Xr(i,n)){if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&Xr(this.reprojectedImage_.getProjection(),n)&&this.reprojectedImage_.getResolution()==e&&ue(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new Ff(i,n,t,e,r,function(t,e,r){return this.getImageInternal(t,e,r,i)}.bind(this),this.contextOptions_),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}return i&&(n=i),this.getImageInternal(t,e,r,n)},e.prototype.getImageInternal=function(t,e,r,i){return n()},e.prototype.handleImageChange=function(t){var e=t.target;switch(e.getState()){case Ai:this.loading=!0,this.dispatchEvent(new Df(kf,e));break;case ki:this.loading=!1,this.dispatchEvent(new Df(jf,e));break;case ji:this.loading=!1,this.dispatchEvent(new Df(Nf,e))}},e}(Dp),Uf=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Bf=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,{attributions:n.attributions,imageSmoothing:n.imageSmoothing,projection:n.projection,resolutions:n.resolutions})||this).crossOrigin_=void 0!==n.crossOrigin?n.crossOrigin:null,r.hidpi_=void 0===n.hidpi||n.hidpi,r.url_=n.url,r.imageLoadFunction_=void 0!==n.imageLoadFunction?n.imageLoadFunction:Gf,r.params_=n.params||{},r.image_=null,r.imageSize_=[0,0],r.renderedRevision_=0,r.ratio_=void 0!==n.ratio?n.ratio:1.5,r}return Uf(e,t),e.prototype.getParams=function(){return this.params_},e.prototype.getImageInternal=function(t,e,r,n){if(void 0===this.url_)return null;e=this.findNearestResolution(e),r=this.hidpi_?r:1;var i=this.image_;if(i&&this.renderedRevision_==this.getRevision()&&i.getResolution()==e&&i.getPixelRatio()==r&&te(i.getExtent(),t))return i;var o={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};O(o,this.params_);var a=((t=t.slice())[0]+t[2])/2,s=(t[1]+t[3])/2;if(1!=this.ratio_){var l=this.ratio_*Pe(t)/2,u=this.ratio_*Ee(t)/2;t[0]=a-l,t[1]=s-u,t[2]=a+l,t[3]=s+u}var c=e/r,h=Math.ceil(Pe(t)/c),p=Math.ceil(Ee(t)/c);t[0]=a-c*h/2,t[2]=a+c*h/2,t[1]=s-c*p/2,t[3]=s+c*p/2,this.imageSize_[0]=h,this.imageSize_[1]=p;var f=this.getRequestUrl_(t,this.imageSize_,r,n,o);return this.image_=new Ki(t,e,r,f,this.crossOrigin_,this.imageLoadFunction_),this.renderedRevision_=this.getRevision(),this.image_.addEventListener(F,this.handleImageChange.bind(this)),this.image_},e.prototype.getImageLoadFunction=function(){return this.imageLoadFunction_},e.prototype.getRequestUrl_=function(t,e,r,n,i){var o=n.getCode().split(":").pop();i.SIZE=e[0]+","+e[1],i.BBOX=t.join(","),i.BBOXSR=o,i.IMAGESR=o,i.DPI=Math.round(90*r);var a=this.url_,s=a.replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage");return s==a&&pt(!1,50),mc(s,i)},e.prototype.getUrl=function(){return this.url_},e.prototype.setImageLoadFunction=function(t){this.image_=null,this.imageLoadFunction_=t,this.changed()},e.prototype.setUrl=function(t){t!=this.url_&&(this.url_=t,this.image_=null,this.changed())},e.prototype.updateParams=function(t){O(this.params_,t),this.image_=null,this.changed()},e}(zf),Vf=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Yf=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,{attributions:n.attributions,imageSmoothing:n.imageSmoothing,projection:n.projection,resolutions:n.resolutions,state:n.state})||this).canvasFunction_=n.canvasFunction,r.canvas_=null,r.renderedRevision_=0,r.ratio_=void 0!==n.ratio?n.ratio:1.5,r}return Vf(e,t),e.prototype.getImageInternal=function(t,e,r,n){e=this.findNearestResolution(e);var i=this.canvas_;if(i&&this.renderedRevision_==this.getRevision()&&i.getResolution()==e&&i.getPixelRatio()==r&&te(i.getExtent(),t))return i;Me(t=t.slice(),this.ratio_);var o=[Pe(t)/e*r,Ee(t)/e*r],a=this.canvasFunction_.call(this,t,e,r,o,n);return a&&(i=new $i(t,e,r,a)),this.canvas_=i,this.renderedRevision_=this.getRevision(),i},e}(zf),Wf=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();var qf=function(t){function e(e){var r=t.call(this,{imageSmoothing:e.imageSmoothing,projection:e.projection,resolutions:e.resolutions})||this;return r.crossOrigin_=void 0!==e.crossOrigin?e.crossOrigin:null,r.displayDpi_=void 0!==e.displayDpi?e.displayDpi:96,r.params_=e.params||{},r.url_=e.url,r.imageLoadFunction_=void 0!==e.imageLoadFunction?e.imageLoadFunction:Gf,r.hidpi_=void 0===e.hidpi||e.hidpi,r.metersPerUnit_=void 0!==e.metersPerUnit?e.metersPerUnit:1,r.ratio_=void 0!==e.ratio?e.ratio:1,r.useOverlay_=void 0!==e.useOverlay&&e.useOverlay,r.image_=null,r.renderedRevision_=0,r}return Wf(e,t),e.prototype.getParams=function(){return this.params_},e.prototype.getImageInternal=function(t,e,r,n){e=this.findNearestResolution(e),r=this.hidpi_?r:1;var i=this.image_;if(i&&this.renderedRevision_==this.getRevision()&&i.getResolution()==e&&i.getPixelRatio()==r&&te(i.getExtent(),t))return i;1!=this.ratio_&&Me(t=t.slice(),this.ratio_);var o=[Pe(t)/e*r,Ee(t)/e*r];if(void 0!==this.url_){var a=this.getUrl(this.url_,this.params_,t,o,n);(i=new Ki(t,e,r,a,this.crossOrigin_,this.imageLoadFunction_)).addEventListener(F,this.handleImageChange.bind(this))}else i=null;return this.image_=i,this.renderedRevision_=this.getRevision(),i},e.prototype.getImageLoadFunction=function(){return this.imageLoadFunction_},e.prototype.updateParams=function(t){O(this.params_,t),this.changed()},e.prototype.getUrl=function(t,e,r,n,i){var o=function(t,e,r,n){var i=Pe(t),o=Ee(t),a=e[0],s=e[1],l=.0254/n;return s*i>a*o?i*r/(a*l):o*r/(s*l)}(r,n,this.metersPerUnit_,this.displayDpi_),a=xe(r),s={OPERATION:this.useOverlay_?"GETDYNAMICMAPOVERLAYIMAGE":"GETMAPIMAGE",VERSION:"2.0.0",LOCALE:"en",CLIENTAGENT:"ol/source/ImageMapGuide source",CLIP:"1",SETDISPLAYDPI:this.displayDpi_,SETDISPLAYWIDTH:Math.round(n[0]),SETDISPLAYHEIGHT:Math.round(n[1]),SETVIEWSCALE:o,SETVIEWCENTERX:a[0],SETVIEWCENTERY:a[1]};return O(s,e),mc(t,s)},e.prototype.setImageLoadFunction=function(t){this.image_=null,this.imageLoadFunction_=t,this.changed()},e}(zf),Xf=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Zf=function(t){function e(e){var r=this,n=void 0!==e.crossOrigin?e.crossOrigin:null,i=void 0!==e.imageLoadFunction?e.imageLoadFunction:Gf;return(r=t.call(this,{attributions:e.attributions,imageSmoothing:e.imageSmoothing,projection:Gr(e.projection)})||this).url_=e.url,r.imageExtent_=e.imageExtent,r.image_=new Ki(r.imageExtent_,void 0,1,r.url_,n,i),r.imageSize_=e.imageSize?e.imageSize:null,r.image_.addEventListener(F,r.handleImageChange.bind(r)),r}return Xf(e,t),e.prototype.getImageExtent=function(){return this.imageExtent_},e.prototype.getImageInternal=function(t,e,r,n){return Re(t,this.image_.getExtent())?this.image_:null},e.prototype.getUrl=function(){return this.url_},e.prototype.handleImageChange=function(e){if(this.image_.getState()==ki){var r=this.image_.getExtent(),n=this.image_.getImage(),i=void 0,o=void 0;this.imageSize_?(i=this.imageSize_[0],o=this.imageSize_[1]):(i=n.width,o=n.height);var a=Ee(r)/o,s=Math.ceil(Pe(r)/a);if(s!=i){var l=uo(s,o);O(l,this.getContextOptions());var u=l.canvas;l.drawImage(n,0,0,i,o,0,0,u.width,u.height),this.image_.setImage(u)}}t.prototype.handleImageChange.call(this,e)},e}(zf),Kf="carmentaserver",Hf="geoserver",$f="mapserver",Jf="qgis",Qf=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),td=[101,101],ed=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,{attributions:n.attributions,imageSmoothing:n.imageSmoothing,projection:n.projection,resolutions:n.resolutions})||this).crossOrigin_=void 0!==n.crossOrigin?n.crossOrigin:null,r.url_=n.url,r.imageLoadFunction_=void 0!==n.imageLoadFunction?n.imageLoadFunction:Gf,r.params_=n.params||{},r.v13_=!0,r.updateV13_(),r.serverType_=n.serverType,r.hidpi_=void 0===n.hidpi||n.hidpi,r.image_=null,r.imageSize_=[0,0],r.renderedRevision_=0,r.ratio_=void 0!==n.ratio?n.ratio:1.5,r}return Qf(e,t),e.prototype.getFeatureInfoUrl=function(t,e,r,n){if(void 0!==this.url_){var i=Gr(r),o=this.getProjection();o&&o!==i&&(e=tc(o,i,t,e),t=Hr(t,i,o));var a=Se(t,e,0,td),s={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.params_.LAYERS};O(s,this.params_,n);var l=Math.floor((t[0]-a[0])/e),u=Math.floor((a[3]-t[1])/e);return s[this.v13_?"I":"X"]=l,s[this.v13_?"J":"Y"]=u,this.getRequestUrl_(a,td,1,o||i,s)}},e.prototype.getLegendUrl=function(t,e){if(void 0!==this.url_){var r={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){var n=this.params_.LAYERS;if(!(!Array.isArray(n)||1===n.length))return;r.LAYER=n}if(void 0!==t){var i=this.getProjection()?this.getProjection().getMetersPerUnit():1;r.SCALE=t*i/28e-5}return O(r,e),mc(this.url_,r)}},e.prototype.getParams=function(){return this.params_},e.prototype.getImageInternal=function(t,e,r,n){if(void 0===this.url_)return null;e=this.findNearestResolution(e),1==r||this.hidpi_&&void 0!==this.serverType_||(r=1);var i=e/r,o=xe(t),a=Se(o,i,0,[Math.ceil(Pe(t)/i),Math.ceil(Ee(t)/i)]),s=Se(o,i,0,[Math.ceil(this.ratio_*Pe(t)/i),Math.ceil(this.ratio_*Ee(t)/i)]),l=this.image_;if(l&&this.renderedRevision_==this.getRevision()&&l.getResolution()==e&&l.getPixelRatio()==r&&te(l.getExtent(),a))return l;var u={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};O(u,this.params_),this.imageSize_[0]=Math.round(Pe(s)/i),this.imageSize_[1]=Math.round(Ee(s)/i);var c=this.getRequestUrl_(s,this.imageSize_,r,n,u);return this.image_=new Ki(s,e,r,c,this.crossOrigin_,this.imageLoadFunction_),this.renderedRevision_=this.getRevision(),this.image_.addEventListener(F,this.handleImageChange.bind(this)),this.image_},e.prototype.getImageLoadFunction=function(){return this.imageLoadFunction_},e.prototype.getRequestUrl_=function(t,e,r,n,i){if(pt(void 0!==this.url_,9),i[this.v13_?"CRS":"SRS"]=n.getCode(),"STYLES"in this.params_||(i.STYLES=""),1!=r)switch(this.serverType_){case Hf:var o=90*r+.5|0;"FORMAT_OPTIONS"in i?i.FORMAT_OPTIONS+=";dpi:"+o:i.FORMAT_OPTIONS="dpi:"+o;break;case $f:i.MAP_RESOLUTION=90*r;break;case Kf:case Jf:i.DPI=90*r;break;default:pt(!1,8)}i.WIDTH=e[0],i.HEIGHT=e[1];var a,s=n.getAxisOrientation();return a=this.v13_&&"ne"==s.substr(0,2)?[t[1],t[0],t[3],t[2]]:t,i.BBOX=a.join(","),mc(this.url_,i)},e.prototype.getUrl=function(){return this.url_},e.prototype.setImageLoadFunction=function(t){this.image_=null,this.imageLoadFunction_=t,this.changed()},e.prototype.setUrl=function(t){t!=this.url_&&(this.url_=t,this.image_=null,this.changed())},e.prototype.updateParams=function(t){O(this.params_,t),this.updateV13_(),this.image_=null,this.changed()},e.prototype.updateV13_=function(){var t=this.params_.VERSION||"1.3.0";this.v13_=br(t,"1.3")>=0},e}(zf),rd=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),nd='© OpenStreetMap contributors.',id=function(t){function e(e){var r,n=e||{};r=void 0!==n.attributions?n.attributions:[nd];var i=void 0!==n.crossOrigin?n.crossOrigin:"anonymous",o=void 0!==n.url?n.url:"https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png";return t.call(this,{attributions:r,attributionsCollapsible:!1,cacheSize:n.cacheSize,crossOrigin:i,imageSmoothing:n.imageSmoothing,maxZoom:void 0!==n.maxZoom?n.maxZoom:19,opaque:void 0===n.opaque||n.opaque,reprojectionErrorThreshold:n.reprojectionErrorThreshold,tileLoadFunction:n.tileLoadFunction,transition:n.transition,url:o,wrapX:n.wrapX})||this}return rd(e,t),e}(Jp),od=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ad=function(t){function e(e){var r=e||{};return t.call(this,r)||this}return od(e,t),e}(na),sd=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ld=function(t){function e(e){var r=t.call(this)||this;return r.boundHandleImageChange_=r.handleImageChange_.bind(r),r.layer_=e,r.declutterExecutorGroup=null,r}return sd(e,t),e.prototype.getFeatures=function(t){return n()},e.prototype.prepareFrame=function(t){return n()},e.prototype.renderFrame=function(t,e){return n()},e.prototype.loadedTileCallback=function(t,e,r){t[e]||(t[e]={}),t[e][r.tileCoord.toString()]=r},e.prototype.createLoadedTileFinder=function(t,e,r){return function(n,i){var o=this.loadedTileCallback.bind(this,r,n);return t.forEachLoadedTile(e,n,i,o)}.bind(this)},e.prototype.forEachFeatureAtCoordinate=function(t,e,r,n,i){},e.prototype.getDataAtPixel=function(t,e,r){return n()},e.prototype.getLayer=function(){return this.layer_},e.prototype.handleFontsChanged=function(){},e.prototype.handleImageChange_=function(t){t.target.getState()===ki&&this.renderIfReadyAndVisible()},e.prototype.loadImage=function(t){var e=t.getState();return e!=ki&&e!=ji&&t.addEventListener(F,this.boundHandleImageChange_),e==Fi&&(t.load(),e=t.getState()),e==ki},e.prototype.renderIfReadyAndVisible=function(){var t=this.getLayer();t.getVisible()&&t.getSourceState()==Qo&&t.changed()},e}(Q),ud=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),cd=function(t){function e(e){var r=t.call(this,e)||this;return r.container=null,r.renderedResolution,r.tempTransform=[1,0,0,1,0,0],r.pixelTransform=[1,0,0,1,0,0],r.inversePixelTransform=[1,0,0,1,0,0],r.context=null,r.containerReused=!1,r}return ud(e,t),e.prototype.useContainer=function(t,e,r){var n,i,o=this.getLayer().getClassName();t&&""===t.style.opacity&&t.className===o&&((s=t.firstElementChild)instanceof HTMLCanvasElement&&(i=s.getContext("2d")));if(!i||0!==i.canvas.width&&i.canvas.style.transform!==e?this.containerReused&&(this.container=null,this.context=null,this.containerReused=!1):(this.container=t,this.context=i,this.containerReused=!0),!this.container){(n=document.createElement("div")).className=o;var a=n.style;a.position="absolute",a.width="100%",a.height="100%";var s=(i=uo()).canvas;n.appendChild(s),(a=s.style).position="absolute",a.left="0",a.transformOrigin="top left",this.container=n,this.context=i}},e.prototype.clip=function(t,e,r){var n=e.pixelRatio,i=e.size[0]*n/2,o=e.size[1]*n/2,a=e.viewState.rotation,s=Ce(r),l=Oe(r),u=be(r),c=_e(r);It(e.coordinateToPixelTransform,s),It(e.coordinateToPixelTransform,l),It(e.coordinateToPixelTransform,u),It(e.coordinateToPixelTransform,c),t.save(),Ca(t,-a,i,o),t.beginPath(),t.moveTo(s[0]*n,s[1]*n),t.lineTo(l[0]*n,l[1]*n),t.lineTo(u[0]*n,u[1]*n),t.lineTo(c[0]*n,c[1]*n),t.clip(),Ca(t,a,i,o)},e.prototype.clipUnrotated=function(t,e,r){var n=Ce(r),i=Oe(r),o=be(r),a=_e(r);It(e.coordinateToPixelTransform,n),It(e.coordinateToPixelTransform,i),It(e.coordinateToPixelTransform,o),It(e.coordinateToPixelTransform,a);var s=this.inversePixelTransform;It(s,n),It(s,i),It(s,o),It(s,a),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(i[0]),Math.round(i[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.lineTo(Math.round(a[0]),Math.round(a[1])),t.clip()},e.prototype.dispatchRenderEvent_=function(t,e,r){var n=this.getLayer();if(n.hasListener(t)){var i=new la(t,this.inversePixelTransform,r,e);n.dispatchEvent(i)}},e.prototype.preRender=function(t,e){this.dispatchRenderEvent_(qo,t,e)},e.prototype.postRender=function(t,e){this.dispatchRenderEvent_(Xo,t,e)},e.prototype.getRenderTransform=function(t,e,r,n,i,o,a){var s=i/2,l=o/2,u=n/e,c=-u,h=-t[0]+a,p=-t[1];return kt(this.tempTransform,s,l,u,c,-r,h,p)},e.prototype.getDataAtPixel=function(t,e,r){var n,i=It(this.inversePixelTransform,t.slice()),o=this.context,a=this.getLayer().getExtent();if(a&&!Qt(a,It(e.pixelToCoordinateTransform,t.slice())))return null;try{var s=Math.round(i[0]),l=Math.round(i[1]),u=document.createElement("canvas"),c=u.getContext("2d");u.width=1,u.height=1,c.clearRect(0,0,1,1),c.drawImage(o.canvas,s,l,1,1,0,0,1,1),n=c.getImageData(0,0,1,1).data}catch(t){return"SecurityError"===t.name?new Uint8Array:n}return 0===n[3]?null:n},e}(ld),hd=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),pd=function(t){function e(e){var r=t.call(this,e)||this;return r.image_=null,r}return hd(e,t),e.prototype.getImage=function(){return this.image_?this.image_.getImage():null},e.prototype.prepareFrame=function(t){var e=t.layerStatesArray[t.layerIndex],r=t.pixelRatio,n=t.viewState,i=n.resolution,o=this.getLayer().getSource(),a=t.viewHints,s=t.extent;if(void 0!==e.extent&&(s=Te(s,on(e.extent,n.projection))),!a[ns]&&!a[is]&&!Ie(s))if(o){var l=n.projection,u=o.getImage(s,i,r,l);u&&this.loadImage(u)&&(this.image_=u)}else this.image_=null;return!!this.image_},e.prototype.renderFrame=function(t,e){var r=this.image_,n=r.getExtent(),i=r.getResolution(),o=r.getPixelRatio(),a=t.layerStatesArray[t.layerIndex],s=t.pixelRatio,l=t.viewState,u=l.center,c=l.resolution,h=t.size,p=s*i/(c*o),f=Math.round(h[0]*s),d=Math.round(h[1]*s),g=l.rotation;if(g){var y=Math.round(Math.sqrt(f*f+d*d));f=y,d=y}kt(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/s,1/s,g,-f/2,-d/2),jt(this.inversePixelTransform,this.pixelTransform);var m=Ra(this.pixelTransform);this.useContainer(e,m,a.opacity);var v=this.context,_=v.canvas;_.width!=f||_.height!=d?(_.width=f,_.height=d):this.containerReused||v.clearRect(0,0,f,d);var b=!1;if(a.extent){var x=on(a.extent,l.projection);(b=!te(x,t.extent)&&Re(x,t.extent))&&this.clipUnrotated(v,t,x)}var w=r.getImage(),S=kt(this.tempTransform,f/2,d/2,p,p,0,o*(n[0]-u[0])/i,o*(u[1]-n[3])/i);this.renderedResolution=i*s/o;var E=S[4],T=S[5],C=w.width*S[0],P=w.height*S[3];if(O(v,this.getLayer().getSource().getContextOptions()),this.preRender(v,t),C>=.5&&P>=.5){var R=a.opacity,I=void 0;1!==R&&(I=this.context.globalAlpha,this.context.globalAlpha=R),this.context.drawImage(w,0,0,+w.width,+w.height,Math.round(E),Math.round(T),Math.round(C),Math.round(P)),1!==R&&(this.context.globalAlpha=I)}return this.postRender(v,t),b&&v.restore(),m!==_.style.transform&&(_.style.transform=m),this.container},e}(cd),fd=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),dd=function(t){function e(e){return t.call(this,e)||this}return fd(e,t),e.prototype.createRenderer=function(){return new pd(this)},e}(ad),gd="preload",yd="useInterimTilesOnError",md=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),vd=function(t){function e(e){var r=this,n=e||{},i=O({},n);return delete i.preload,delete i.useInterimTilesOnError,(r=t.call(this,i)||this).setPreload(void 0!==n.preload?n.preload:0),r.setUseInterimTilesOnError(void 0===n.useInterimTilesOnError||n.useInterimTilesOnError),r}return md(e,t),e.prototype.getPreload=function(){return this.get(gd)},e.prototype.setPreload=function(t){this.set(gd,t)},e.prototype.getUseInterimTilesOnError=function(){return this.get(yd)},e.prototype.setUseInterimTilesOnError=function(t){this.set(yd,t)},e}(na),_d=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),bd=function(t){function e(e){var r=t.call(this,e)||this;return r.extentChanged=!0,r.renderedExtent_=null,r.renderedPixelRatio,r.renderedProjection=null,r.renderedRevision,r.renderedTiles=[],r.newTiles_=!1,r.tmpExtent=[1/0,1/0,-1/0,-1/0],r.tmpTileRange_=new _u(0,0,0,0),r}return _d(e,t),e.prototype.isDrawableTile=function(t){var e=this.getLayer(),r=t.getState(),n=e.getUseInterimTilesOnError();return r==to||r==ro||r==eo&&!n},e.prototype.getTile=function(t,e,r,n){var i=n.pixelRatio,o=n.viewState.projection,a=this.getLayer(),s=a.getSource().getTile(t,e,r,i,o);return s.getState()==eo&&(a.getUseInterimTilesOnError()?a.getPreload()>0&&(this.newTiles_=!0):s.setState(to)),this.isDrawableTile(s)||(s=s.getInterimTile()),s},e.prototype.loadedTileCallback=function(e,r,n){return!!this.isDrawableTile(n)&&t.prototype.loadedTileCallback.call(this,e,r,n)},e.prototype.prepareFrame=function(t){return!!this.getLayer().getSource()},e.prototype.renderFrame=function(t,e){var r=t.layerStatesArray[t.layerIndex],n=t.viewState,i=n.projection,a=n.resolution,s=n.center,l=n.rotation,u=t.pixelRatio,c=this.getLayer(),h=c.getSource(),p=h.getRevision(),f=h.getTileGridForProjection(i),g=f.getZForResolution(a,h.zDirection),y=f.getResolution(g),m=t.extent,v=r.extent&&on(r.extent,i);v&&(m=Te(m,on(r.extent,i)));var _=h.getTilePixelRatio(u),b=Math.round(t.size[0]*_),x=Math.round(t.size[1]*_);if(l){var w=Math.round(Math.sqrt(b*b+x*x));b=w,x=w}var S=y*b/2/_,E=y*x/2/_,T=[s[0]-S,s[1]-E,s[0]+S,s[1]+E],C=f.getTileRangeForExtentAndZ(m,g),P={};P[g]={};var R=this.createLoadedTileFinder(h,i,P),I=this.tmpExtent,L=this.tmpTileRange_;this.newTiles_=!1;for(var M=C.minX;M<=C.maxX;++M)for(var F=C.minY;F<=C.maxY;++F){var A=this.getTile(g,M,F,t);if(this.isDrawableTile(A)){var k=o(this);if(A.getState()==to){P[g][A.tileCoord.toString()]=A;var j=A.inTransition(k);this.newTiles_||!j&&-1!==this.renderedTiles.indexOf(A)||(this.newTiles_=!0)}if(1===A.getAlpha(k,t.time))continue}var N=f.getTileCoordChildTileRange(A.tileCoord,L,I),D=!1;N&&(D=R(g+1,N)),D||f.forEachTileCoordParentTileRange(A.tileCoord,R,L,I)}var G=y/a;kt(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/_,1/_,l,-b/2,-x/2);var z=Ra(this.pixelTransform);this.useContainer(e,z,r.opacity);var U=this.context,B=U.canvas;jt(this.inversePixelTransform,this.pixelTransform),kt(this.tempTransform,b/2,x/2,G,G,0,-b/2,-x/2),B.width!=b||B.height!=x?(B.width=b,B.height=x):this.containerReused||U.clearRect(0,0,b,x),v&&this.clipUnrotated(U,t,v),O(U,h.getContextOptions()),this.preRender(U,t),this.renderedTiles.length=0;var V,Y,W,q=Object.keys(P).map(Number);q.sort(d),1!==r.opacity||this.containerReused&&!h.getOpaque(t.viewState.projection)?(V=[],Y=[]):q=q.reverse();for(var X=q.length-1;X>=0;--X){var Z=q[X],K=h.getTilePixelSize(Z,u,i),H=f.getResolution(Z)/y,$=K[0]*H*G,J=K[1]*H*G,Q=f.getTileCoordForCoordAndZ(Ce(T),Z),tt=f.getTileCoordExtent(Q),et=It(this.tempTransform,[_*(tt[0]-T[0])/y,_*(T[3]-tt[3])/y]),rt=_*h.getGutterForProjection(i),nt=P[Z];for(var it in nt){var ot=(A=nt[it]).tileCoord,at=et[0]-(Q[1]-ot[1])*$,st=Math.round(at+$),lt=et[1]-(Q[2]-ot[2])*J,ut=Math.round(lt+J),ct=st-(M=Math.round(at)),ht=ut-(F=Math.round(lt)),pt=g===Z;if(!(j=pt&&1!==A.getAlpha(o(this),t.time)))if(V){U.save(),W=[M,F,M+ct,F,M+ct,F+ht,M,F+ht];for(var ft=0,dt=V.length;ftthis._maxQueueLength;)this._queue.shift().callback(null,null)},e.prototype._dispatch=function(){if(0===this._running&&this._queue.length>0){var t=this._queue.shift();this._job=t;var e=t.inputs[0].width,r=t.inputs[0].height,n=t.inputs.map((function(t){return t.data.buffer})),i=this._workers.length;if(this._running=i,1===i)this._workers[0].postMessage({buffers:n,meta:t.meta,imageOps:this._imageOps,width:e,height:r},n);else for(var o=t.inputs[0].data.length,a=4*Math.ceil(o/4/i),s=0;sStamen Design, under CC BY 3.0.',nd],Vd={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}},Yd={terrain:{minZoom:0,maxZoom:18},toner:{minZoom:0,maxZoom:20},watercolor:{minZoom:0,maxZoom:18}},Wd=function(t){function e(e){var r=e.layer.indexOf("-"),n=-1==r?e.layer:e.layer.slice(0,r),i=Yd[n],o=Vd[e.layer],a=void 0!==e.url?e.url:"https://stamen-tiles-{a-d}.a.ssl.fastly.net/"+e.layer+"/{z}/{x}/{y}."+o.extension;return t.call(this,{attributions:Bd,cacheSize:e.cacheSize,crossOrigin:"anonymous",imageSmoothing:e.imageSmoothing,maxZoom:null!=e.maxZoom?e.maxZoom:i.maxZoom,minZoom:null!=e.minZoom?e.minZoom:i.minZoom,opaque:o.opaque,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileLoadFunction:e.tileLoadFunction,transition:e.transition,url:a,wrapX:e.wrapX})||this}return Ud(e,t),e}(Jp),qd=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Xd=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,{attributions:n.attributions,cacheSize:n.cacheSize,crossOrigin:n.crossOrigin,imageSmoothing:n.imageSmoothing,projection:n.projection,reprojectionErrorThreshold:n.reprojectionErrorThreshold,tileGrid:n.tileGrid,tileLoadFunction:n.tileLoadFunction,url:n.url,urls:n.urls,wrapX:void 0===n.wrapX||n.wrapX,transition:n.transition})||this).params_=n.params||{},r.hidpi_=void 0===n.hidpi||n.hidpi,r.tmpExtent_=[1/0,1/0,-1/0,-1/0],r.setKey(r.getKeyForParams_()),r}return qd(e,t),e.prototype.getKeyForParams_=function(){var t=0,e=[];for(var r in this.params_)e[t++]=r+"-"+this.params_[r];return e.join("/")},e.prototype.getParams=function(){return this.params_},e.prototype.getRequestUrl_=function(t,e,r,n,i,o){var a=this.urls;if(a){var s,l=i.getCode().split(":").pop();if(o.SIZE=e[0]+","+e[1],o.BBOX=r.join(","),o.BBOXSR=l,o.IMAGESR=l,o.DPI=Math.round(o.DPI?o.DPI*n:90*n),1==a.length)s=a[0];else s=a[We(fu(t),a.length)];return mc(s.replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage"),o)}},e.prototype.getTilePixelRatio=function(t){return this.hidpi_?t:1},e.prototype.updateParams=function(t){O(this.params_,t),this.setKey(this.getKeyForParams_())},e.prototype.tileUrlFunction=function(t,e,r){var n=this.getTileGrid();if(n||(n=this.getTileGridForProjection(r)),!(n.getResolutions().length<=t[0])){1==e||this.hidpi_||(e=1);var i=n.getTileCoordExtent(t,this.tmpExtent_),o=Is(n.getTileSize(t[0]),this.tmpSize);1!=e&&(o=Rs(o,e,this.tmpSize));var a={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};return O(a,this.params_),this.getRequestUrl_(t,o,i,e,r,a)}},e}(Xp),Zd=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Kd=function(t){function e(e,r,n){var i=t.call(this,e,to)||this;return i.tileSize_=r,i.text_=n,i.canvas_=null,i}return Zd(e,t),e.prototype.getImage=function(){if(this.canvas_)return this.canvas_;var t=this.tileSize_,e=uo(t[0],t[1]);return e.strokeStyle="grey",e.strokeRect(.5,.5,t[0]+.5,t[1]+.5),e.fillStyle="grey",e.strokeStyle="white",e.textAlign="center",e.textBaseline="middle",e.font="24px sans-serif",e.lineWidth=4,e.strokeText(this.text_,t[0]/2,t[1]/2,t[0]),e.fillText(this.text_,t[0]/2,t[1]/2,t[0]),this.canvas_=e.canvas,e.canvas},e.prototype.load=function(){},e}(lo),Hd=function(t){function e(e){var r=e||{};return t.call(this,{opaque:!1,projection:r.projection,tileGrid:r.tileGrid,wrapX:void 0===r.wrapX||r.wrapX,zDirection:r.zDirection})||this}return Zd(e,t),e.prototype.getTile=function(t,e,r){var n=cu(t,e,r);if(this.tileCache.containsKey(n))return this.tileCache.get(n);var i=Is(this.tileGrid.getTileSize(t)),o=[t,e,r],a=this.getTileCoordForTileUrlFunction(o),s=void 0;s=a?"z:"+a[0]+" x:"+a[1]+" y:"+a[2]:"none";var l=new Kd(o,i,s);return this.tileCache.set(n,l),l},e}(Jp),$d=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Jd=function(t){function e(e){var r=t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,imageSmoothing:e.imageSmoothing,projection:Gr("EPSG:3857"),reprojectionErrorThreshold:e.reprojectionErrorThreshold,state:Jo,tileLoadFunction:e.tileLoadFunction,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition})||this;if(r.tileJSON_=null,r.tileSize_=e.tileSize,e.url)if(e.jsonp)Au(e.url,r.handleTileJSONResponse.bind(r),r.handleTileJSONError.bind(r));else{var n=new XMLHttpRequest;n.addEventListener("load",r.onXHRLoad_.bind(r)),n.addEventListener("error",r.onXHRError_.bind(r)),n.open("GET",e.url),n.send()}else e.tileJSON?r.handleTileJSONResponse(e.tileJSON):pt(!1,51);return r}return $d(e,t),e.prototype.onXHRLoad_=function(t){var e=t.target;if(!e.status||e.status>=200&&e.status<300){var r=void 0;try{r=JSON.parse(e.responseText)}catch(t){return void this.handleTileJSONError()}this.handleTileJSONResponse(r)}else this.handleTileJSONError()},e.prototype.onXHRError_=function(t){this.handleTileJSONError()},e.prototype.getTileJSON=function(){return this.tileJSON_},e.prototype.handleTileJSONResponse=function(t){var e,r=Gr("EPSG:4326"),n=this.getProjection();if(void 0!==t.bounds){var i=Zr(r,n);e=Ae(t.bounds,i)}var o=t.minzoom||0,a=t.maxzoom||22,s=lc({extent:hc(n),maxZoom:a,minZoom:o,tileSize:this.tileSize_});if(this.tileGrid=s,this.tileUrlFunction=fc(t.tiles,s),void 0!==t.attribution&&!this.getAttributions()){var l=void 0!==e?e:r.getExtent();this.setAttributions((function(e){return Re(l,e.extent)?[t.attribution]:null}))}this.tileJSON_=t,this.setState(Qo)},e.prototype.handleTileJSONError=function(){this.setState(ta)},e}(Xp),Qd=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),tg=function(t){function e(e){var r=this,n=e||{},i=n.params||{},o=!("TRANSPARENT"in i)||i.TRANSPARENT;return(r=t.call(this,{attributions:n.attributions,cacheSize:n.cacheSize,crossOrigin:n.crossOrigin,imageSmoothing:n.imageSmoothing,opaque:!o,projection:n.projection,reprojectionErrorThreshold:n.reprojectionErrorThreshold,tileClass:n.tileClass,tileGrid:n.tileGrid,tileLoadFunction:n.tileLoadFunction,url:n.url,urls:n.urls,wrapX:void 0===n.wrapX||n.wrapX,transition:n.transition})||this).gutter_=void 0!==n.gutter?n.gutter:0,r.params_=i,r.v13_=!0,r.serverType_=n.serverType,r.hidpi_=void 0===n.hidpi||n.hidpi,r.tmpExtent_=[1/0,1/0,-1/0,-1/0],r.updateV13_(),r.setKey(r.getKeyForParams_()),r}return Qd(e,t),e.prototype.getFeatureInfoUrl=function(t,e,r,n){var i=Gr(r),o=this.getProjection(),a=this.getTileGrid();a||(a=this.getTileGridForProjection(i));var s=a.getZForResolution(e,this.zDirection),l=a.getTileCoordForCoordAndZ(t,s);if(!(a.getResolutions().length<=l[0])){var u=a.getResolution(l[0]),c=a.getTileCoordExtent(l,this.tmpExtent_),h=Is(a.getTileSize(l[0]),this.tmpSize),p=this.gutter_;0!==p&&(h=Os(h,p,this.tmpSize),c=Ht(c,u*p,c)),o&&o!==i&&(u=tc(o,i,t,u),c=$r(c,i,o),t=Hr(t,i,o));var f={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.params_.LAYERS};O(f,this.params_,n);var d=Math.floor((t[0]-c[0])/u),g=Math.floor((c[3]-t[1])/u);return f[this.v13_?"I":"X"]=d,f[this.v13_?"J":"Y"]=g,this.getRequestUrl_(l,h,c,1,o||i,f)}},e.prototype.getLegendUrl=function(t,e){if(void 0!==this.urls[0]){var r={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){var n=this.params_.LAYERS;if(!(!Array.isArray(n)||1===n.length))return;r.LAYER=n}if(void 0!==t){var i=this.getProjection()?this.getProjection().getMetersPerUnit():1;r.SCALE=t*i/28e-5}return O(r,e),mc(this.urls[0],r)}},e.prototype.getGutter=function(){return this.gutter_},e.prototype.getParams=function(){return this.params_},e.prototype.getRequestUrl_=function(t,e,r,n,i,o){var a=this.urls;if(a){if(o.WIDTH=e[0],o.HEIGHT=e[1],o[this.v13_?"CRS":"SRS"]=i.getCode(),"STYLES"in this.params_||(o.STYLES=""),1!=n)switch(this.serverType_){case Hf:var s=90*n+.5|0;"FORMAT_OPTIONS"in o?o.FORMAT_OPTIONS+=";dpi:"+s:o.FORMAT_OPTIONS="dpi:"+s;break;case $f:o.MAP_RESOLUTION=90*n;break;case Kf:case Jf:o.DPI=90*n;break;default:pt(!1,52)}var l,u=i.getAxisOrientation(),c=r;if(this.v13_&&"ne"==u.substr(0,2)){var h=void 0;h=r[0],c[0]=r[1],c[1]=h,h=r[2],c[2]=r[3],c[3]=h}if(o.BBOX=c.join(","),1==a.length)l=a[0];else l=a[We(fu(t),a.length)];return mc(l,o)}},e.prototype.getTilePixelRatio=function(t){return this.hidpi_&&void 0!==this.serverType_?t:1},e.prototype.getKeyForParams_=function(){var t=0,e=[];for(var r in this.params_)e[t++]=r+"-"+this.params_[r];return e.join("/")},e.prototype.updateParams=function(t){O(this.params_,t),this.updateV13_(),this.setKey(this.getKeyForParams_())},e.prototype.updateV13_=function(){var t=this.params_.VERSION||"1.3.0";this.v13_=br(t,"1.3")>=0},e.prototype.tileUrlFunction=function(t,e,r){var n=this.getTileGrid();if(n||(n=this.getTileGridForProjection(r)),!(n.getResolutions().length<=t[0])){1==e||this.hidpi_&&void 0!==this.serverType_||(e=1);var i=n.getResolution(t[0]),o=n.getTileCoordExtent(t,this.tmpExtent_),a=Is(n.getTileSize(t[0]),this.tmpSize),s=this.gutter_;0!==s&&(a=Os(a,s,this.tmpSize),o=Ht(o,i*s,o)),1!=e&&(a=Rs(a,e,this.tmpSize));var l={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};return O(l,this.params_),this.getRequestUrl_(t,a,o,e,r,l)}},e}(Xp),eg=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),rg=function(t){function e(e,r,n,i,o,a){var s=t.call(this,e,r)||this;return s.src_=n,s.extent_=i,s.preemptive_=o,s.grid_=null,s.keys_=null,s.data_=null,s.jsonp_=a,s}return eg(e,t),e.prototype.getImage=function(){return null},e.prototype.getData=function(t){if(!this.grid_||!this.keys_)return null;var e=(t[0]-this.extent_[0])/(this.extent_[2]-this.extent_[0]),r=(t[1]-this.extent_[1])/(this.extent_[3]-this.extent_[1]),n=this.grid_[Math.floor((1-r)*this.grid_.length)];if("string"!=typeof n)return null;var i=n.charCodeAt(Math.floor(e*n.length));i>=93&&i--,i>=35&&i--;var o=null;if((i-=32)in this.keys_){var a=this.keys_[i];o=this.data_&&a in this.data_?this.data_[a]:a}return o},e.prototype.forDataAtCoordinate=function(t,e,r){this.state==ro&&!0===r?(this.state=Ji,K(this,F,(function(r){e(this.getData(t))}),this),this.loadInternal_()):!0===r?setTimeout(function(){e(this.getData(t))}.bind(this),0):e(this.getData(t))},e.prototype.getKey=function(){return this.src_},e.prototype.handleError_=function(){this.state=eo,this.changed()},e.prototype.handleLoad_=function(t){this.grid_=t.grid,this.keys_=t.keys,this.data_=t.data,this.state=to,this.changed()},e.prototype.loadInternal_=function(){if(this.state==Ji)if(this.state=Qi,this.jsonp_)Au(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()}},e.prototype.onXHRLoad_=function(t){var e=t.target;if(!e.status||e.status>=200&&e.status<300){var r=void 0;try{r=JSON.parse(e.responseText)}catch(t){return void this.handleError_()}this.handleLoad_(r)}else this.handleError_()},e.prototype.onXHRError_=function(t){this.handleError_()},e.prototype.load=function(){this.preemptive_?this.loadInternal_():this.setState(ro)},e}(lo),ng=function(t){function e(e){var r=t.call(this,{projection:Gr("EPSG:3857"),state:Jo})||this;if(r.preemptive_=void 0===e.preemptive||e.preemptive,r.tileUrlFunction_=gc,r.template_=void 0,r.jsonp_=e.jsonp||!1,e.url)if(r.jsonp_)Au(e.url,r.handleTileJSONResponse.bind(r),r.handleTileJSONError.bind(r));else{var n=new XMLHttpRequest;n.addEventListener("load",r.onXHRLoad_.bind(r)),n.addEventListener("error",r.onXHRError_.bind(r)),n.open("GET",e.url),n.send()}else e.tileJSON?r.handleTileJSONResponse(e.tileJSON):pt(!1,51);return r}return eg(e,t),e.prototype.onXHRLoad_=function(t){var e=t.target;if(!e.status||e.status>=200&&e.status<300){var r=void 0;try{r=JSON.parse(e.responseText)}catch(t){return void this.handleTileJSONError()}this.handleTileJSONResponse(r)}else this.handleTileJSONError()},e.prototype.onXHRError_=function(t){this.handleTileJSONError()},e.prototype.getTemplate=function(){return this.template_},e.prototype.forDataAtCoordinateAndResolution=function(t,e,r,n){if(this.tileGrid){var i=this.tileGrid.getZForResolution(e,this.zDirection),o=this.tileGrid.getTileCoordForCoordAndZ(t,i);this.getTile(o[0],o[1],o[2],1,this.getProjection()).forDataAtCoordinate(t,r,n)}else!0===n?setTimeout((function(){r(null)}),0):r(null)},e.prototype.handleTileJSONError=function(){this.setState(ta)},e.prototype.handleTileJSONResponse=function(t){var e,r=Gr("EPSG:4326"),n=this.getProjection();if(void 0!==t.bounds){var i=Zr(r,n);e=Ae(t.bounds,i)}var o=t.minzoom||0,a=t.maxzoom||22,s=lc({extent:hc(n),maxZoom:a,minZoom:o});this.tileGrid=s,this.template_=t.template;var l=t.grids;if(l){if(this.tileUrlFunction_=fc(l,s),void 0!==t.attribution){var u=void 0!==e?e:r.getExtent();this.setAttributions((function(e){return Re(u,e.extent)?[t.attribution]:null}))}this.setState(Qo)}else this.setState(ta)},e.prototype.getTile=function(t,e,r,n,i){var o=cu(t,e,r);if(this.tileCache.containsKey(o))return this.tileCache.get(o);var a=[t,e,r],s=this.getTileCoordForTileUrlFunction(a,i),l=this.tileUrlFunction_(s,n,i),u=new rg(a,void 0!==l?Ji:ro,void 0!==l?l:"",this.tileGrid.getTileCoordExtent(a),this.preemptive_,this.jsonp_);return this.tileCache.set(o,u),u},e.prototype.useTile=function(t,e,r){var n=cu(t,e,r);this.tileCache.containsKey(n)&&this.tileCache.get(n)},e}(Bp),ig=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),og=function(t){function e(e){var r=this,n=e.projection||"EPSG:3857",i=e.extent||hc(n),o=e.tileGrid||lc({extent:i,maxResolution:e.maxResolution,maxZoom:void 0!==e.maxZoom?e.maxZoom:22,minZoom:e.minZoom,tileSize:e.tileSize||512});return(r=t.call(this,{attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,cacheSize:e.cacheSize,opaque:!1,projection:n,state:e.state,tileGrid:o,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:ag,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition,zDirection:void 0===e.zDirection?1:e.zDirection})||this).format_=e.format?e.format:null,r.loadingTiles_={},r.sourceTileCache=new yu(r.tileCache.highWaterMark),r.overlaps_=null==e.overlaps||e.overlaps,r.tileClass=e.tileClass?e.tileClass:Eu,r.tileGrids_={},r}return ig(e,t),e.prototype.getFeaturesInExtent=function(t){var e=[],r=this.tileCache;if(0===r.getCount())return e;var n=pu(r.peekFirstKey())[0],i=this.tileGrid;return r.forEach((function(r){if(r.tileCoord[0]===n&&r.getState()===to)for(var o=r.getSourceTiles(),a=0,s=o.length;a0&&g[0].tileCoord[0]===f)c=g,h=!0,p=f;else{c=[],p=f+1;do{--p,h=!0,l.forEachTileCoord(o,p,function(n){var i,o=this.tileUrlFunction(n,t,e);if(void 0!==o)if(this.sourceTileCache.containsKey(o)){var a=(i=this.sourceTileCache.get(o)).getState();if(a===to||a===eo||a===ro)return void c.push(i)}else p===f&&((i=new this.tileClass(n,Ji,o,this.format_,this.tileLoadFunction)).extent=l.getTileCoordExtent(n),i.projection=e,i.resolution=l.getResolution(n[0]),this.sourceTileCache.set(o,i),i.addEventListener(F,this.handleTileChange.bind(this)),i.load());h=h&&i&&i.getState()===to,i&&i.getState()!==ro&&r.getState()===Ji&&(r.loadingSourceTiles++,i.addEventListener(F,(function t(){var e=i.getState(),n=i.getKey();if(e===to||e===eo){e===to?(i.removeEventListener(F,t),r.loadingSourceTiles--,delete r.errorSourceTileKeys[n]):e===eo&&(r.errorSourceTileKeys[n]=!0);var o=Object.keys(r.errorSourceTileKeys).length;r.loadingSourceTiles-o==0&&(r.hifi=0===o,r.sourceZ=f,r.setState(to))}})))}.bind(this)),h||(c.length=0)}while(!h&&p>d)}return r.getState()===Ji&&r.setState(Qi),h&&(r.hifi=f===p,r.sourceZ=p,r.getState()0&&(r.tileUrlFunction=dc(o.map(r.createFromWMTSTemplate.bind(r)))),r}return ug(e,t),e.prototype.setUrls=function(t){this.urls=t;var e=t.join("\n");this.setTileUrlFunction(dc(t.map(this.createFromWMTSTemplate.bind(this))),e)},e.prototype.getDimensions=function(){return this.dimensions_},e.prototype.getFormat=function(){return this.format_},e.prototype.getLayer=function(){return this.layer_},e.prototype.getMatrixSet=function(){return this.matrixSet_},e.prototype.getRequestEncoding=function(){return this.requestEncoding_},e.prototype.getStyle=function(){return this.style_},e.prototype.getVersion=function(){return this.version_},e.prototype.getKeyForDimensions_=function(){var t=0,e=[];for(var r in this.dimensions_)e[t++]=r+"-"+this.dimensions_[r];return e.join("/")},e.prototype.updateDimensions=function(t){O(this.dimensions_,t),this.setKey(this.getKeyForDimensions_())},e.prototype.createFromWMTSTemplate=function(t){var e=this.requestEncoding_,r={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};e==sg&&O(r,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_}),t=e==sg?mc(t,r):t.replace(/\{(\w+?)\}/g,(function(t,e){return e.toLowerCase()in r?r[e.toLowerCase()]:t}));var n=this.tileGrid,i=this.dimensions_;return function(r,o,a){if(r){var s={TileMatrix:n.getMatrixId(r[0]),TileCol:r[1],TileRow:r[2]};O(s,i);var l=t;return l=e==sg?mc(l,s):l.replace(/\{(\w+?)\}/g,(function(t,e){return s[e]}))}}},e}(Xp);var hg=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),pg="GENERATE_BUFFERS",fg=function(t){function e(e,r){var n=t.call(this,e)||this,i=r||{};return n.helper=new gh({postProcesses:i.postProcesses,uniforms:i.uniforms}),void 0!==i.className&&(n.helper.getCanvas().className=i.className),n}return hg(e,t),e.prototype.disposeInternal=function(){this.helper.dispose(),t.prototype.disposeInternal.call(this)},e.prototype.getShaderCompileErrors=function(){return this.helper.getShaderCompileErrors()},e.prototype.dispatchRenderEvent_=function(t,e){var r=this.getLayer();if(r.hasListener(t)){var n=new la(t,null,e,null);r.dispatchEvent(n)}},e.prototype.preRender=function(t){this.dispatchRenderEvent_(qo,t)},e.prototype.postRender=function(t){this.dispatchRenderEvent_(Xo,t)},e}(ld),dg=[],gg={vertexPosition:0,indexPosition:0};function yg(t,e,r,n,i){t[e+0]=r,t[e+1]=n,t[e+2]=i}function mg(t,e){var r=e||[];return r[0]=Math.floor(t/256/256/256)/255,r[1]=Math.floor(t/256/256)%256/255,r[2]=Math.floor(t/256)%256/255,r[3]=t%256/255,r}function vg(t){var e=0;return e+=Math.round(256*t[0]*256*256*255),e+=Math.round(256*t[1]*256*255),e+=Math.round(256*t[2]*255),e+=Math.round(255*t[3])}var _g=fg,bg=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),xg="renderOrder",wg=function(t){function e(e){var r=this,n=e||{},i=O({},n);return delete i.style,delete i.renderBuffer,delete i.updateWhileAnimating,delete i.updateWhileInteracting,(r=t.call(this,i)||this).declutter_=void 0!==n.declutter&&n.declutter,r.renderBuffer_=void 0!==n.renderBuffer?n.renderBuffer:100,r.style_=null,r.styleFunction_=void 0,r.setStyle(n.style),r.updateWhileAnimating_=void 0!==n.updateWhileAnimating&&n.updateWhileAnimating,r.updateWhileInteracting_=void 0!==n.updateWhileInteracting&&n.updateWhileInteracting,r}return bg(e,t),e.prototype.getDeclutter=function(){return this.declutter_},e.prototype.getFeatures=function(e){return t.prototype.getFeatures.call(this,e)},e.prototype.getRenderBuffer=function(){return this.renderBuffer_},e.prototype.getRenderOrder=function(){return this.get(xg)},e.prototype.getStyle=function(){return this.style_},e.prototype.getStyleFunction=function(){return this.styleFunction_},e.prototype.getUpdateWhileAnimating=function(){return this.updateWhileAnimating_},e.prototype.getUpdateWhileInteracting=function(){return this.updateWhileInteracting_},e.prototype.renderDeclutter=function(t){t.declutterTree||(t.declutterTree=new Pp.a(9)),this.getRenderer().renderDeclutter(t)},e.prototype.setRenderOrder=function(t){this.set(xg,t)},e.prototype.setStyle=function(t){this.style_=void 0!==t?t:_p,this.styleFunction_=null===t?void 0:mp(this.style_),this.changed()},e}(na),Sg=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Eg=function(t){function e(e,r){var n=this,i=r.uniforms||{},a=[1,0,0,1,0,0];i[ah]=a,(n=t.call(this,e,{className:r.className,uniforms:i,postProcesses:r.postProcesses})||this).sourceRevision_=-1,n.verticesBuffer_=new Qc(34962,35048),n.hitVerticesBuffer_=new Qc(34962,35048),n.indicesBuffer_=new Qc(34963,35048),n.program_=n.helper.getProgram(r.fragmentShader,r.vertexShader),n.hitDetectionEnabled_=!(!r.hitFragmentShader||!r.hitVertexShader),n.hitProgram_=n.hitDetectionEnabled_&&n.helper.getProgram(r.hitFragmentShader,r.hitVertexShader);var s=r.attributes?r.attributes.map((function(t){return{name:"a_"+t.name,size:1,type:ph.FLOAT}})):[];n.attributes=[{name:"a_position",size:2,type:ph.FLOAT},{name:"a_index",size:1,type:ph.FLOAT}].concat(s),n.hitDetectionAttributes=[{name:"a_position",size:2,type:ph.FLOAT},{name:"a_index",size:1,type:ph.FLOAT},{name:"a_hitColor",size:4,type:ph.FLOAT},{name:"a_featureUid",size:1,type:ph.FLOAT}].concat(s),n.customAttributes=r.attributes?r.attributes:[],n.previousExtent_=[1/0,1/0,-1/0,-1/0],n.currentTransform_=a,n.renderTransform_=[1,0,0,1,0,0],n.invertRenderTransform_=[1,0,0,1,0,0],n.renderInstructions_=new Float32Array(0),n.hitRenderInstructions_=new Float32Array(0),n.hitRenderTarget_=n.hitDetectionEnabled_&&new mh(n.helper),n.worker_=new Worker(Hc),n.worker_.addEventListener("message",function(t){var e=t.data;if(e.type===pg){var r=e.projectionTransform;e.hitDetection?(this.hitVerticesBuffer_.fromArrayBuffer(e.vertexBuffer),this.helper.flushBufferData(this.hitVerticesBuffer_)):(this.verticesBuffer_.fromArrayBuffer(e.vertexBuffer),this.helper.flushBufferData(this.verticesBuffer_)),this.indicesBuffer_.fromArrayBuffer(e.indexBuffer),this.helper.flushBufferData(this.indicesBuffer_),this.renderTransform_=r,jt(this.invertRenderTransform_,this.renderTransform_),e.hitDetection?this.hitRenderInstructions_=new Float32Array(t.data.renderInstructions):this.renderInstructions_=new Float32Array(t.data.renderInstructions),this.getLayer().changed()}}.bind(n)),n.featureCache_={},n.featureCount_=0;var l=n.getLayer().getSource();return n.sourceListenKeys_=[Z(l,ef,n.handleSourceFeatureAdded_,n),Z(l,rf,n.handleSourceFeatureChanged_,n),Z(l,of,n.handleSourceFeatureDelete_,n),Z(l,nf,n.handleSourceFeatureClear_,n)],l.forEachFeature(function(t){this.featureCache_[o(t)]={feature:t,properties:t.getProperties(),geometry:t.getGeometry()},this.featureCount_++}.bind(n)),n}return Sg(e,t),e.prototype.handleSourceFeatureAdded_=function(t){var e=t.feature;this.featureCache_[o(e)]={feature:e,properties:e.getProperties(),geometry:e.getGeometry()},this.featureCount_++},e.prototype.handleSourceFeatureChanged_=function(t){var e=t.feature;this.featureCache_[o(e)]={feature:e,properties:e.getProperties(),geometry:e.getGeometry()}},e.prototype.handleSourceFeatureDelete_=function(t){var e=t.feature;delete this.featureCache_[o(e)],this.featureCount_--},e.prototype.handleSourceFeatureClear_=function(){this.featureCache_={},this.featureCount_=0},e.prototype.renderFrame=function(t){this.preRender(t);var e=this.indicesBuffer_.getSize();this.helper.drawElements(0,e),this.helper.finalizeDraw(t);var r=this.helper.getCanvas(),n=t.layerStatesArray[t.layerIndex].opacity;return n!==parseFloat(r.style.opacity)&&(r.style.opacity=String(n)),this.hitDetectionEnabled_&&(this.renderHitDetection(t),this.hitRenderTarget_.clearCachedData()),this.postRender(t),r},e.prototype.prepareFrame=function(t){var e=this.getLayer(),r=e.getSource(),n=t.viewState,i=!t.viewHints[ns]&&!t.viewHints[is],o=!ue(this.previousExtent_,t.extent),a=this.sourceRevision_c&&this.instructions.push([Ig.CUSTOM,c,i,t,r,Nn])):l==bt.POINT&&(n=t.getFlatCoordinates(),this.coordinates.push(n[0],n[1]),i=this.coordinates.length,this.instructions.push([Ig.CUSTOM,c,i,t,r]));this.endGeometry(e)},e.prototype.beginGeometry=function(t,e){this.beginGeometryInstruction1_=[Ig.BEGIN_GEOMETRY,e,0,t],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[Ig.BEGIN_GEOMETRY,e,0,t],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)},e.prototype.finish=function(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}},e.prototype.reverseHitDetectionInstructions=function(){var t,e=this.hitDetectionInstructions;e.reverse();var r,n,i=e.length,o=-1;for(t=0;tthis.maxLineWidth&&(this.maxLineWidth=r.lineWidth,this.bufferedMaxExtent_=null)}else r.strokeStyle=void 0,r.lineCap=void 0,r.lineDash=null,r.lineDashOffset=void 0,r.lineJoin=void 0,r.lineWidth=void 0,r.miterLimit=void 0},e.prototype.createFill=function(t){var e=t.fillStyle,r=[Ig.SET_FILL_STYLE,e];return"string"!=typeof e&&r.push(!0),r},e.prototype.applyStroke=function(t){this.instructions.push(this.createStroke(t))},e.prototype.createStroke=function(t){return[Ig.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]},e.prototype.updateFillStyle=function(t,e){var r=t.fillStyle;"string"==typeof r&&t.currentFillStyle==r||(void 0!==r&&this.instructions.push(e.call(this,t)),t.currentFillStyle=r)},e.prototype.updateStrokeStyle=function(t,e){var r=t.strokeStyle,n=t.lineCap,i=t.lineDash,o=t.lineDashOffset,a=t.lineJoin,s=t.lineWidth,l=t.miterLimit;(t.currentStrokeStyle!=r||t.currentLineCap!=n||i!=t.currentLineDash&&!b(t.currentLineDash,i)||t.currentLineDashOffset!=o||t.currentLineJoin!=a||t.currentLineWidth!=s||t.currentMiterLimit!=l)&&(void 0!==r&&e.call(this,t),t.currentStrokeStyle=r,t.currentLineCap=n,t.currentLineDash=i,t.currentLineDashOffset=o,t.currentLineJoin=a,t.currentLineWidth=s,t.currentMiterLimit=l)},e.prototype.endGeometry=function(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;var e=[Ig.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)},e.prototype.getBufferedMaxExtent=function(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=$t(this.maxExtent),this.maxLineWidth>0)){var t=this.resolution*(this.maxLineWidth+1)/2;Ht(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_},e}(ku),Fg=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ag=function(t){function e(e,r,n,i){var o=t.call(this,e,r,n,i)||this;return o.hitDetectionImage_=null,o.image_=null,o.imagePixelRatio_=void 0,o.anchorX_=void 0,o.anchorY_=void 0,o.height_=void 0,o.opacity_=void 0,o.originX_=void 0,o.originY_=void 0,o.rotateWithView_=void 0,o.rotation_=void 0,o.scale_=void 0,o.width_=void 0,o.declutterImageWithText_=void 0,o}return Fg(e,t),e.prototype.drawPoint=function(t,e){if(this.image_){this.beginGeometry(t,e);var r=t.getFlatCoordinates(),n=t.getStride(),i=this.coordinates.length,o=this.appendFlatPointCoordinates(r,n);this.instructions.push([Ig.DRAW_IMAGE,i,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterImageWithText_]),this.hitDetectionInstructions.push([Ig.DRAW_IMAGE,i,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterImageWithText_]),this.endGeometry(e)}},e.prototype.drawMultiPoint=function(t,e){if(this.image_){this.beginGeometry(t,e);var r=t.getFlatCoordinates(),n=t.getStride(),i=this.coordinates.length,o=this.appendFlatPointCoordinates(r,n);this.instructions.push([Ig.DRAW_IMAGE,i,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterImageWithText_]),this.hitDetectionInstructions.push([Ig.DRAW_IMAGE,i,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterImageWithText_]),this.endGeometry(e)}},e.prototype.finish=function(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,t.prototype.finish.call(this)},e.prototype.setImageStyle=function(t,e){var r=t.getAnchor(),n=t.getSize(),i=t.getHitDetectionImage(),o=t.getImage(this.pixelRatio),a=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=r[0],this.anchorY_=r[1],this.hitDetectionImage_=i,this.image_=o,this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=a[0],this.originY_=a[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=n[0],this.declutterImageWithText_=e},e}(Mg),kg=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),jg=function(t){function e(e,r,n,i){return t.call(this,e,r,n,i)||this}return kg(e,t),e.prototype.drawFlatCoordinates_=function(t,e,r,n){var i=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,r,n,!1,!1),a=[Ig.MOVE_TO_LINE_TO,i,o];return this.instructions.push(a),this.hitDetectionInstructions.push(a),r},e.prototype.drawLineString=function(t,e){var r=this.state,n=r.strokeStyle,i=r.lineWidth;if(void 0!==n&&void 0!==i){this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([Ig.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset],Pg);var o=t.getFlatCoordinates(),a=t.getStride();this.drawFlatCoordinates_(o,0,o.length,a),this.hitDetectionInstructions.push(Og),this.endGeometry(e)}},e.prototype.drawMultiLineString=function(t,e){var r=this.state,n=r.strokeStyle,i=r.lineWidth;if(void 0!==n&&void 0!==i){this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([Ig.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset],Pg);for(var o=t.getEnds(),a=t.getFlatCoordinates(),s=t.getStride(),l=0,u=0,c=o.length;ut&&(m>y&&(y=m,d=v,g=o),m=0,v=o-i)),a=s,c=p,h=f),l=_,u=b}return(m+=s)>y?[v,o]:[d,g]}var zg=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ug={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},Bg=function(t){function e(e,r,n,i){var o=t.call(this,e,r,n,i)||this;return o.labels_=null,o.text_="",o.textOffsetX_=0,o.textOffsetY_=0,o.textRotateWithView_=void 0,o.textRotation_=0,o.textFillState_=null,o.fillStates={},o.textStrokeState_=null,o.strokeStates={},o.textState_={},o.textStates={},o.textKey_="",o.fillKey_="",o.strokeKey_="",o.declutterImageWithText_=void 0,o}return zg(e,t),e.prototype.finish=function(){var e=t.prototype.finish.call(this);return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e},e.prototype.drawText=function(t,e){var r=this.textFillState_,n=this.textStrokeState_,i=this.textState_;if(""!==this.text_&&i&&(r||n)){var o=this.coordinates,a=o.length,s=t.getType(),l=null,u=t.getStride();if(i.placement!==Ep||s!=bt.LINE_STRING&&s!=bt.MULTI_LINE_STRING&&s!=bt.POLYGON&&s!=bt.MULTI_POLYGON){var c=i.overflow?null:[];switch(s){case bt.POINT:case bt.MULTI_POINT:l=t.getFlatCoordinates();break;case bt.LINE_STRING:l=t.getFlatMidpoint();break;case bt.CIRCLE:l=t.getCenter();break;case bt.MULTI_LINE_STRING:l=t.getFlatMidpoints(),u=2;break;case bt.POLYGON:l=t.getFlatInteriorPoint(),i.overflow||c.push(l[2]/this.resolution),u=3;break;case bt.MULTI_POLYGON:var h=t.getFlatInteriorPoints();l=[];for(x=0,w=h.length;xP[2]}else T=b>C;var R,I=Math.PI,L=[],M=w+n===e;if(y=0,m=S,p=t[e=w],f=t[e+1],M){v();var F=Math.atan2(f-g,p-d);T&&(F+=F>0?-I:I);var A=(C+b)/2,k=(O+x)/2;return L[0]=[A,k,(E-o)/2,F,i],L}for(var j=0,N=i.length;j0?-I:I),void 0!==R){var G=D-R;if(G+=G>I?-2*I:G<-I?2*I:0,Math.abs(G)>a)return null}R=D;for(var z=j,U=0;jt?t-l:i,b=o+u>e?e-u:o,x=f[3]+_*h[0]+f[1],w=f[0]+b*h[1]+f[2],S=m-f[3],E=v-f[0];return(d||0!==c)&&(Zg[0]=S,$g[0]=S,Zg[1]=E,Kg[1]=E,Kg[0]=S+x,Hg[0]=Kg[0],Hg[1]=E+w,$g[1]=Hg[1]),0!==c?(It(y=kt([1,0,0,1,0,0],r,n,1,1,c,-r,-n),Zg),It(y,Kg),It(y,Hg),It(y,$g),ie(Math.min(Zg[0],Kg[0],Hg[0],$g[0]),Math.min(Zg[1],Kg[1],Hg[1],$g[1]),Math.max(Zg[0],Kg[0],Hg[0],$g[0]),Math.max(Zg[1],Kg[1],Hg[1],$g[1]),Xg)):ie(Math.min(S,S+x),Math.min(E,E+w),Math.max(S,S+x),Math.max(E,E+w),Xg),p&&(m=Math.round(m),v=Math.round(v)),{drawImageX:m,drawImageY:v,drawImageW:_,drawImageH:b,originX:l,originY:u,declutterBox:{minX:Xg[0],minY:Xg[1],maxX:Xg[2],maxY:Xg[3],value:g},canvasTransform:y,scale:h}},t.prototype.replayImageOrLabel_=function(t,e,r,n,i,o,a){var s=!(!o&&!a),l=n.declutterBox,u=t.canvas,c=a?a[2]*n.scale[0]/2:0;return l.minX-c<=u.width/e&&l.maxX+c>=0&&l.minY-c<=u.height/e&&l.maxY+c>=0&&(s&&this.replayTextBackground_(t,Zg,Kg,Hg,$g,o,a),Oa(t,n.canvasTransform,i,r,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0},t.prototype.fill_=function(t){if(this.alignFill_){var e=It(this.renderedTransform_,[0,0]),r=512*this.pixelRatio;t.save(),t.translate(e[0]%r,e[1]%r),t.rotate(this.viewRotation_)}t.fill(),this.alignFill_&&t.restore()},t.prototype.setStrokeStyle_=function(t,e){t.strokeStyle=e[1],t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.setLineDash&&(t.lineDashOffset=e[7],t.setLineDash(e[6]))},t.prototype.drawLabelWithPointPlacement_=function(t,e,r,n){var i=this.textStates[e],o=this.createLabel(t,e,n,r),a=this.strokeStates[r],s=this.pixelRatio,l=ty(t,i.textAlign||"center"),u=Ug[i.textBaseline||"middle"],c=a&&a.lineWidth?a.lineWidth:0;return{label:o,anchorX:l*(o.width/s-2*i.scale[0])+2*(.5-l)*c,anchorY:u*o.height/s+2*(.5-u)*c}},t.prototype.execute_=function(t,e,r,n,i,o,a,s){var l;this.pixelCoordinates_&&b(r,this.renderedTransform_)?l=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),l=ln(this.coordinates,0,this.coordinates.length,2,r,this.pixelCoordinates_),Rt(this.renderedTransform_,r));for(var u,c,h,p,f,d,g,y,m,v,_,x,w,S,E,T,C=0,O=n.length,P=0,R=0,I=0,L=null,M=null,F=this.coordinateCache_,A=this.viewRotation_,k=Math.round(1e12*Math.atan2(-r[1],r[0]))/1e12,j={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:A},N=this.instructions!=n||this.overlaps?0:200;CN&&(this.fill_(t),R=0),I>N&&(t.stroke(),I=0),R||I||(t.beginPath(),p=NaN,f=NaN),++C;break;case Ig.CIRCLE:var G=l[P=D[1]],z=l[P+1],U=l[P+2]-G,B=l[P+3]-z,V=Math.sqrt(U*U+B*B);t.moveTo(G+V,z),t.arc(G,z,V,0,2*Math.PI,!0),++C;break;case Ig.CLOSE_PATH:t.closePath(),++C;break;case Ig.CUSTOM:P=D[1],u=D[2];var Y=D[3],W=D[4],q=6==D.length?D[5]:void 0;j.geometry=Y,j.feature=w,C in F||(F[C]=[]);var X=F[C];q?q(l,P,u,2,X):(X[0]=l[P],X[1]=l[P+1],X.length=2),W(X,j),++C;break;case Ig.DRAW_IMAGE:P=D[1],u=D[2],y=D[3],c=D[4],h=D[5];var Z=D[6],K=D[7],H=D[8],$=D[9],J=D[10],Q=D[11],tt=D[12],et=D[13],rt=D[14];if(!y&&D.length>=19){m=D[18],v=D[19],_=D[20],x=D[21];var nt=this.drawLabelWithPointPlacement_(m,v,_,x);y=nt.label,D[3]=y;var it=D[22];c=(nt.anchorX-it)*this.pixelRatio,D[4]=c;var ot=D[23];h=(nt.anchorY-ot)*this.pixelRatio,D[5]=h,Z=y.height,D[6]=Z,et=y.width,D[13]=et}var at=void 0;D.length>24&&(at=D[24]);var st=void 0,lt=void 0,ut=void 0;D.length>16?(st=D[15],lt=D[16],ut=D[17]):(st=fa,lt=!1,ut=!1),J&&k?Q+=A:J||k||(Q-=A);for(var ct=0;P0){if(!o||h!==zu&&h!==Vu||-1!==o.indexOf(t)){var u=(p[s]-3)/4,f=n-u%a,d=n-(u/a|0),g=i(t,e,f*f+d*d);if(g)return g}c.clearRect(0,0,a,a);break}}var g,y,m,v,_,b=Object.keys(this.executorsByZIndex_).map(Number);for(b.sort(d),g=b.length-1;g>=0;--g){var x=b[g].toString();for(m=this.executorsByZIndex_[x],y=ry.length-1;y>=0;--y)if(void 0!==(v=m[h=ry[y]])&&(_=v.executeHitDetection(c,s,r,f,u)))return _}},t.prototype.getClipCoords=function(t){var e=this.maxExtent_;if(!e)return null;var r=e[0],n=e[1],i=e[2],o=e[3],a=[r,n,r,o,i,o,i,n];return ln(a,0,8,2,t,a),a},t.prototype.isEmpty=function(){return I(this.executorsByZIndex_)},t.prototype.execute=function(t,e,r,n,i,o,a){var s=Object.keys(this.executorsByZIndex_).map(Number);s.sort(d),this.maxExtent_&&(t.save(),this.clip(t,r));var l,u,c,h,p,f,g=o||ry;for(a&&s.reverse(),l=0,u=s.length;lr)break;var s=n[a];s||(s=[],n[a]=s),s.push(4*((t+i)*e+(t+o))+3),i>0&&s.push(4*((t-i)*e+(t+o))+3),o>0&&(s.push(4*((t+i)*e+(t-o))+3),i>0&&s.push(4*((t-i)*e+(t-o))+3))}for(var l=[],u=(i=0,n.length);i0&&(a.width=0),this.container;var u=Math.round(t.size[0]*r),c=Math.round(t.size[1]*r);a.width!=u||a.height!=c?(a.width=u,a.height=c,a.style.transform!==i&&(a.style.transform=i)):this.containerReused||o.clearRect(0,0,u,c),this.preRender(o,t);var h=t.viewState,p=h.projection,f=!1;if(n.extent&&this.clipping){var d=on(n.extent,p);(f=!te(d,t.extent)&&Re(d,t.extent))&&this.clipUnrotated(o,t,d)}this.renderWorlds(s,t),f&&o.restore(),this.postRender(o,t);var g=n.opacity,y=this.container;return g!==parseFloat(y.style.opacity)&&(y.style.opacity=1===g?"":String(g)),this.renderedRotation_!==h.rotation&&(this.renderedRotation_=h.rotation,this.hitDetectionImageData_=null),this.container},e.prototype.getFeatures=function(t){return new Promise(function(e){if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){var r=[this.context.canvas.width,this.context.canvas.height];It(this.pixelTransform,r);var n=this.renderedCenter_,i=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,s=this.renderedExtent_,l=this.getLayer(),u=[],c=r[0]/2,h=r[1]/2;u.push(this.getRenderTransform(n,i,o,.5,c,h,0).slice());var p=l.getSource(),f=a.getExtent();if(p.getWrapX()&&a.canWrapX()&&!te(f,s)){for(var d=s[0],g=Pe(f),y=0,m=void 0;df[2];)m=g*++y,u.push(this.getRenderTransform(n,i,o,.5,c,h,m).slice()),d-=g}this.hitDetectionImageData_=sy(r,u,this.renderedFeatures_,l.getStyleFunction(),s,i,o)}e(ly(t,this.renderedFeatures_,this.hitDetectionImageData_))}.bind(this))},e.prototype.forEachFeatureAtCoordinate=function(t,e,r,n,i){var a=this;if(this.replayGroup_){var s,l=e.viewState.resolution,u=e.viewState.rotation,c=this.getLayer(),h={},p=function(t,e,r){var a=o(t),s=h[a];if(s){if(!0!==s&&rv[0]&&x[2]>v[2]&&m.push([x[0]-_,x[1],x[2]-_,x[3]])}if(!this.dirty_&&this.renderedResolution_==c&&this.renderedRevision_==p&&this.renderedRenderOrder_==d&&te(this.renderedExtent_,y))return this.replayGroupChanged=!1,!0;this.replayGroup_=null,this.dirty_=!1;var w,S=new Yg(Xu(c,h),y,c,h);this.getLayer().getDeclutter()&&(w=new Yg(Xu(c,h),y,c,h));var E,T=tn();if(T){for(var C=0,O=m.length;C0)e([]);else{var m=Ce(h.getTileCoordExtent(n.wrappedTileCoord)),v=[(p[0]-m[0])/c,(m[1]-p[1])/c],_=n.getSourceTiles().reduce((function(t,e){return t.concat(e.getFeatures())}),[]),b=n.hitDetectionImageData[a];if(!b&&!this.animatingOrInteracting_){var x=Is(h.getTileSize(h.getZForResolution(c))),w=[x[0]/2,x[1]/2],S=this.renderedRotation_;b=sy(x,[this.getRenderTransform(h.getTileCoordCenter(n.wrappedTileCoord),c,0,.5,w[0],w[1],0)],_,i.getStyleFunction(),h.getTileCoordExtent(n.wrappedTileCoord),n.getReplayState(i).renderedResolution,S),n.hitDetectionImageData[a]=b}e(ly(v,_,b))}}.bind(this))},e.prototype.handleFontsChanged=function(){P(this.renderTileImageQueue_);var t=this.getLayer();t.getVisible()&&void 0!==this.renderedLayerRevision_&&t.changed()},e.prototype.handleStyleImageChange_=function(t){this.renderIfReadyAndVisible()},e.prototype.renderDeclutter=function(t){for(var e=t.viewHints,r=!(e[ns]||e[is]),n=this.renderedTiles,i=0,a=n.length;i=0;--u)l[u].execute(this.context,1,this.getTileRenderTransform(s,t),t.viewState.rotation,r,void 0,t.declutterTree)}},e.prototype.getTileRenderTransform=function(t,e){var r=e.pixelRatio,n=e.viewState,i=n.center,o=n.resolution,a=n.rotation,s=e.size,l=Math.round(s[0]*r),u=Math.round(s[1]*r),c=this.getLayer().getSource().getTileGridForProjection(e.viewState.projection),h=t.tileCoord,p=c.getTileCoordExtent(t.wrappedTileCoord),f=c.getTileCoordExtent(h,this.tmpExtent)[0]-p[0];return Ot(Mt(this.inversePixelTransform.slice(),1/r,1/r),this.getRenderTransform(i,o,a,r,l,u,f))},e.prototype.renderFrame=function(e,r){var n=e.viewHints,i=!(n[ns]||n[is]);this.renderQueuedTileImages_(i,e),t.prototype.renderFrame.call(this,e,r),this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice(),this.renderedRotation_=e.viewState.rotation;var a=this.getLayer(),s=a.getRenderMode();if(s===fy)return this.container;var l=a.getSource(),u=e.usedTiles[o(l)];for(var c in this.renderTileImageQueue_)u&&c in u||delete this.renderTileImageQueue_[c];for(var h=this.context,p=vy[s],f=e.viewState.rotation,d=this.renderedTiles,g=[],y=[],m=d.length-1;m>=0;--m)for(var v=d[m],_=this.getTileRenderTransform(v,e),b=v.executorGroups[o(a)],x=!1,w=0,S=b.length;w8){e.animate=!0;break}var n=this.renderTileImageQueue_[r];delete this.renderTileImageQueue_[r],this.renderTileImage_(n,e)}},e.prototype.renderFeature=function(t,e,r,n,i){if(!r)return!1;var o=!1;if(Array.isArray(r))for(var a=0,s=r.length;a1?a:2,x=o||new Array(b);for(g=0;g>1;i0&&y.length>0;)o=y.pop(),c=d.pop(),p=g.pop(),(l=o.toString())in m||(u.push(p[0],p[1]),m[l]=!0),a=y.pop(),h=d.pop(),f=g.pop(),ze((i=e(n=t(s=(o+a)/2)))[0],i[1],p[0],p[1],f[0],f[1])this.featurePool_.length;)s=new gt,this.featurePool_.push(s);var u=n.getFeaturesCollection();u.clear();var c,h,p=0;for(c=0,h=this.meridians_.length;cMath.PI/2);for(var y=Ku(t),m=h;m<=p;++m){var v=this.meridians_.length+this.parallels_.length,_=void 0,b=void 0,x=void 0,w=void 0;if(this.meridiansLabels_)for(b=0,x=this.meridiansLabels_.length;b=s?(t[0]=a[0],t[2]=a[2]):o=!0);var l=[Ne(e[0],this.minX_,this.maxX_),Ne(e[1],this.minY_,this.maxY_)],u=this.toLonLatTransform_(l);isNaN(u[1])&&(u[1]=Math.abs(this.maxLat_)>=Math.abs(this.minLat_)?this.maxLat_:this.minLat_);var c,h,p,f,d=Ne(u[0],this.minLon_,this.maxLon_),g=Ne(u[1],this.minLat_,this.maxLat_),y=this.maxLines_,m=t;o||(m=[Ne(t[0],this.minX_,this.maxX_),Ne(t[1],this.minY_,this.maxY_),Ne(t[2],this.minX_,this.maxX_),Ne(t[3],this.minY_,this.maxY_)]);var v=Ae(m,this.toLonLatTransform_,void 0,8),_=v[3],b=v[2],x=v[1],w=v[0];if(o||(Qt(m,this.bottomLeft_)&&(w=this.minLon_,x=this.minLat_),Qt(m,this.bottomRight_)&&(b=this.maxLon_,x=this.minLat_),Qt(m,this.topLeft_)&&(w=this.minLon_,_=this.maxLat_),Qt(m,this.topRight_)&&(b=this.maxLon_,_=this.maxLat_),_=Ne(_,g,this.maxLat_),b=Ne(b,d,this.maxLon_),x=Ne(x,this.minLat_,g),w=Ne(w,this.minLon_,d)),f=Ne(d=Math.floor(d/i)*i,this.minLon_,this.maxLon_),h=this.addMeridian_(f,x,_,n,t,0),c=0,o)for(;(f-=i)>=w&&c++n[o]&&(i=o,o=1);var a=Math.max(e[1],n[i]),s=Math.min(e[3],n[o]),l=Ne(e[1]+Math.abs(e[1]-e[3])*this.lonLabelPosition_,a,s),u=[n[i-1]+(n[o-1]-n[i-1])*(l-n[i])/(n[o]-n[i]),l],c=this.meridiansLabels_[r].geom;return c.setCoordinates(u),c},e.prototype.getMeridians=function(){return this.meridians_},e.prototype.getParallel_=function(t,e,r,n,i){var o=Fy(t,e,r,this.projection_,n),a=this.parallels_[i];return a?(a.setFlatCoordinates(yt,o),a.changed()):a=new Py(o,yt),a},e.prototype.getParallelPoint_=function(t,e,r){var n=t.getFlatCoordinates(),i=0,o=n.length-2;n[i]>n[o]&&(i=o,o=0);var a=Math.max(e[0],n[i]),s=Math.min(e[2],n[o]),l=Ne(e[0]+Math.abs(e[0]-e[2])*this.latLabelPosition_,a,s),u=[l,n[i+1]+(n[o+1]-n[i+1])*(l-n[i])/(n[o]-n[i])],c=this.parallelsLabels_[r].geom;return c.setCoordinates(u),c},e.prototype.getParallels=function(){return this.parallels_},e.prototype.updateProjectionInfo_=function(t){var e=Gr("EPSG:4326"),r=t.getWorldExtent();this.maxLat_=r[3],this.maxLon_=r[2],this.minLat_=r[1],this.minLon_=r[0];var n=Kr(t,e);if(this.minLon_=Math.abs(this.minLat_)?this.maxLat_:this.minLat_),this.projection_=t},e}(Iy),Dy=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Gy="blur",zy="gradient",Uy="radius",By=["#00f","#0ff","#0f0","#ff0","#f00"];var Vy=function(t){function e(e){var r=this,n=e||{},i=O({},n);delete i.gradient,delete i.radius,delete i.blur,delete i.weight,(r=t.call(this,i)||this).gradient_=null,r.addEventListener(it(zy),r.handleGradientChanged_),r.setGradient(n.gradient?n.gradient:By),r.setBlur(void 0!==n.blur?n.blur:15),r.setRadius(void 0!==n.radius?n.radius:8);var o=n.weight?n.weight:"weight";return r.weightFunction_="string"==typeof o?function(t){return t.get(o)}:o,r.setRenderOrder(null),r}return Dy(e,t),e.prototype.getBlur=function(){return this.get(Gy)},e.prototype.getGradient=function(){return this.get(zy)},e.prototype.getRadius=function(){return this.get(Uy)},e.prototype.handleGradientChanged_=function(){this.gradient_=function(t){for(var e=uo(1,256),r=e.createLinearGradient(0,0,1,256),n=1/(t.length-1),i=0,o=t.length;i>3)?r.readString():2===t?r.readFloat():3===t?r.readDouble():4===t?r.readVarint64():5===t?r.readVarint():6===t?r.readSVarint():7===t?r.readBoolean():null;e.values.push(n)}}function im(t,e,r){if(1==t)e.id=r.readVarint();else if(2==t)for(var n=r.readVarint()+r.pos;r.pos>3}a--,1===o||2===o?(s+=t.readSVarint(),l+=t.readSVarint(),1===o&&u>c&&(n.push(u),c=u),r.push(s,l),u+=2):7===o?u>c&&(r.push(r[c],r[c+1]),u+=2):pt(!1,59)}u>c&&(n.push(u),c=u)},e.prototype.createFeature_=function(t,e,r){var n,i=e.type;if(0===i)return null;var o,a=e.properties;this.idProperty_?(o=a[this.idProperty_],delete a[this.idProperty_]):o=e.id,a[this.layerName_]=e.layer.name;var s=[],l=[];this.readRawGeometry_(t,e,s,l);var u=function(t,e){var r;1===t?r=1===e?bt.POINT:bt.MULTI_POINT:2===t?r=1===e?bt.LINE_STRING:bt.MULTI_LINE_STRING:3===t&&(r=bt.POLYGON);return r}(i,l.length);if(this.featureClass_===Cy)(n=new this.featureClass_(u,s,l,a,o)).transform(r.dataProjection);else{var c=void 0;if(u==bt.POLYGON){for(var h=[],p=0,f=0,d=0,g=l.length;d1?new Jy(s,yt,h):new fi(s,yt,l)}else c=u===bt.POINT?new qn(s,yt):u===bt.LINE_STRING?new Py(s,yt):u===bt.POLYGON?new fi(s,yt,l):u===bt.MULTI_POINT?new Hy(s,yt):u===bt.MULTI_LINE_STRING?new Zy(s,yt,l):null;n=new(0,this.featureClass_),this.geometryName_&&n.setGeometryName(this.geometryName_);var m=Wy(c,!1,r);n.setGeometry(m),n.setId(o),n.setProperties(a,!0)}return n},e.prototype.getType=function(){return Cu},e.prototype.readFeatures=function(t,e){var r=this.layers_,n=this.adaptOptions(e),i=Gr(n.dataProjection);i.setWorldExtent(n.extent),n.dataProjection=i;var o=new tm.a(t),a=o.readFields(rm,{}),s=[];for(var l in a)if(!r||-1!=r.indexOf(l)){var u=a[l],c=u?[0,0,u.extent,u.extent]:null;i.setExtent(c);for(var h=0,p=u.length;h=.05){for(var r="",n=t.split("\n"),i=ym.slice(0,Math.round(e/.1)),o=0,a=n.length;o0&&(r+="\n"),r+=n[o].split("").join(i);return r}return t}function vm(){return gm||(gm=dm(1,1).getContext("2d")),gm}function _m(t,e){return vm().measureText(t).width+(t.length-1)*e}var bm={};ga&&Z(ga,k,(function(){bm={}}));var xm,wm,Sm=hm.e.isFunction,Em=hm.e.convertFunction,Tm=hm.c.isExpression,Cm=hm.c.createPropertyExpression,Om={Point:1,MultiPoint:1,LineString:2,MultiLineString:2,Polygon:3,MultiPolygon:3},Pm={center:[.5,.5],left:[0,.5],right:[1,.5],top:[.5,0],bottom:[.5,1],"top-left":[0,0],"top-right":[1,0],"bottom-left":[0,1],"bottom-right":[1,1]},Rm={},Im={zoom:0},Lm={};function Mm(t,e,r,n,i){var o=t.id;Lm[o]||(Lm[o]={});var a=Lm[o];if(!a[r]){var s=(t[e]||Rm)[r],l=hm.f[e+"_"+t.type][r];void 0===s&&(s=l.default);var u=Tm(s);if(!u&&Sm(s)&&(s=Em(s,l),u=!0),u){var c=function(t,e){var r=Cm(t,e);if("error"===r.result)throw new Error(r.value.map((function(t){return t.key+": "+t.message})).join(", "));return r.value}(s,l);a[r]=c.evaluate.bind(c)}else"color"==l.type&&(s=hm.a.parse(s)),a[r]=function(){return s}}return Im.zoom=n,a[r](Im,i)}var Fm={};function Am(t,e){if(t){if(0===t.a||0===e)return;var r=t.a;return e=void 0===e?1:e,"rgba("+Math.round(255*t.r/r)+","+Math.round(255*t.g/r)+","+Math.round(255*t.b/r)+","+r*e+")"}return t}var km=/^([^]*)\{(.*)\}([^]*)$/;function jm(t,e){var r;do{if(r=t.match(km)){var n=e[r[2]]||"";t=r[1]+n+r[3]}}while(r);return t}var Nm=!1;var Dm=function(t,e,r,n,i,o,a){if(void 0===n&&(n=fm),"string"==typeof e&&(e=JSON.parse(e)),8!=e.version)throw new Error("glStyle version 8 required.");var s,l;if(o)if("undefined"!=typeof Image){var u=new Image;u.crossOrigin="anonymous",u.onload=function(){s=u,l=[u.width,u.height],t.changed(),u.onload=null},u.src=o}else if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope){var c=self;c.postMessage({action:"loadImage",src:o}),c.addEventListener("message",(function(t){"imageLoaded"===t.data.action&&t.data.src===o&&(s=t.data.image,l=[s.width,s.height])}))}for(var h,p=Object(hm.b)(e.layers),f={},d=[],g=0,y=p.length;g=y.maxzoom)return"continue";var b=y.filter;if(!b||function(t,e,r,n){return t in Fm||(Fm[t]=Object(hm.d)(e).filter),Im.zoom=n,Fm[t](Im,r)}(m,b,p,u)){c=y;var x=void 0,w=void 0,P=void 0,R=void 0,I=void 0,L=void 0,M=g.index;if(3==h&&("fill"==y.type||"fill-extrusion"==y.type))if(w=Mm(y,"paint",y.type+"-opacity",u,p),y.type+"-pattern"in _){var F=Mm(y,"paint",y.type+"-pattern",u,p);if(F){var A="string"==typeof F?jm(F,r):F.toString();if(s&&i&&i[A]){++d,(L=O[d])&&L.getFill()&&!L.getStroke()&&!L.getText()||(L=O[d]=new wp({fill:new ep})),P=L.getFill(),L.setZIndex(M);var k=C[ut=A+"."+w];if(!k)(pt=(ht=dm((ct=i[A]).width,ct.height)).getContext("2d")).globalAlpha=w,pt.drawImage(s,ct.x,ct.y,ct.width,ct.height,0,0,ct.width,ct.height),k=pt.createPattern(ht,"repeat"),C[ut]=k;P.setColor(k)}}}else(x=Am(Mm(y,"paint",y.type+"-color",u,p),w))&&(y.type+"-outline-color"in _&&(I=Am(Mm(y,"paint",y.type+"-outline-color",u,p),w)),I||(I=x),++d,(L=O[d])&&L.getFill()&&L.getStroke()&&!L.getText()||(L=O[d]=new wp({fill:new ep,stroke:new gp})),(P=L.getFill()).setColor(x),(R=L.getStroke()).setColor(I),R.setWidth(1),L.setZIndex(M));if(1!=h&&"line"==y.type){x=!("line-pattern"in _)&&"line-color"in _?Am(Mm(y,"paint","line-color",u,p),Mm(y,"paint","line-opacity",u,p)):void 0;var j=Mm(y,"paint","line-width",u,p);x&&j>0&&(++d,(L=O[d])&&L.getStroke()&&!L.getFill()&&!L.getText()||(L=O[d]=new wp({stroke:new gp})),(R=L.getStroke()).setLineCap(Mm(y,"layout","line-cap",u,p)),R.setLineJoin(Mm(y,"layout","line-join",u,p)),R.setMiterLimit(Mm(y,"layout","line-miter-limit",u,p)),R.setColor(x),R.setWidth(j),R.setLineDash(_["line-dasharray"]?Mm(y,"paint","line-dasharray",u,p).map((function(t){return t*j})):null),L.setZIndex(M))}var N=!1,D=null,G=0,z=void 0,U=void 0,B=void 0;if((1==h||2==h)&&"icon-image"in v){var V=Mm(y,"layout","icon-image",u,p);if(V){z="string"==typeof V?jm(V,r):V.toString();var Y=void 0;if(s&&i&&i[z]){var W=Mm(y,"layout","icon-rotation-alignment",u,p);if(2==h){var q=t.getGeometry();if(q.getFlatMidpoint||q.getFlatMidpoints){var X=q.getExtent();if(Math.sqrt(Math.max(Math.pow((X[2]-X[0])/e,2),Math.pow((X[3]-X[1])/e,2)))>150){var Z="MultiLineString"===q.getType()?q.getFlatMidpoints():q.getFlatMidpoint();if(wm||(wm=new Cy("Point",xm=[NaN,NaN],[],{},null)),Y=wm,xm[0]=Z[0],xm[1]=Z[1],"line"===(Mt=Mm(y,"layout","symbol-placement",u,p))&&"map"===W)for(var K=q.getStride(),H=q.getFlatCoordinates(),$=0,J=H.length-K;$=nt&&Z[0]<=ot&&Z[1]>=it&&Z[1]<=at){G=Math.atan2(tt-rt,et-Q);break}}}}}if(2!==h||Y){++d,(L=O[d])&&L.getImage()&&!L.getFill()&&!L.getStroke()||(L=O[d]=new wp),L.setGeometry(Y);var st=Mm(y,"layout","icon-size",u,p),lt=void 0!==_["icon-color"]?Mm(y,"paint","icon-color",u,p):null,ut=z+"."+st;if(null!==lt&&(ut+="."+lt),!(U=T[ut])){var ct=i[z];if(null!==lt){var ht,pt;(pt=(ht=dm(ct.width,ct.height)).getContext("2d")).drawImage(s,ct.x,ct.y,ct.width,ct.height,0,0,ct.width,ct.height);for(var ft=pt.getImageData(0,0,ht.width,ht.height),dt=0,gt=ft.data.length;dt0?new gp({width:bt,color:vt}):void 0,fill:_t?new ep({color:_t}):void 0})),L.setImage(U),D=L.getText(),L.setText(void 0),L.setGeometry(void 0),L.setZIndex(M),N=!0}var wt=void 0;if("text-field"in v)wt=jm(Mm(y,"layout","text-field",u,p).toString(),r).trim(),w=Mm(y,"paint","text-opacity",u,p);if(wt&&w&&!B){N||(++d,(L=O[d])&&L.getText()&&!L.getFill()&&!L.getStroke()||(L=O[d]=new wp),L.setImage(void 0),L.setGeometry(void 0)),L.getText()||L.setText(D||new Tp({padding:[2,2,2,2]})),D=L.getText();var St=Math.round(Mm(y,"layout","text-size",u,p)),Et=Mm(y,"layout","text-font",u,p),Tt=Mm(y,"layout","text-line-height",u,p),Ct=cm()(a?a(Et):Et,St,Tt),Ot=v["text-transform"];"uppercase"==Ot?wt=wt.toUpperCase():"lowercase"==Ot&&(wt=wt.toLowerCase());var Pt=Mm(y,"layout","text-max-width",u,p),Rt=Mm(y,"layout","text-letter-spacing",u,p),It=2==h?mm(wt,Rt):function t(e,r,n,i){if(-1!==e.indexOf("\n")){for(var o=e.split("\n"),a=[],s=0,l=o.length;s1){var p=vm();p.font=r;var f=p.measureText("M").width*n,d="";for(a=[],s=0,l=h.length;s1;++s){var m=a[s];if(_m(m,i)<.35*f){var v=s>0?_m(a[s-1],i):1/0,_=s.7*f&&_m(x,i)<.6*f){var w=b.split(" "),S=w.pop();_m(S,i)<.2*f&&(a[s]=w.join(" "),a[s+1]=S+" "+x),l-=1}}c=a.join("\n")}else c=e;c=mm(c,i),bm[u]=c}return c}(wt,Ct,Pt,Rt);D.setText(It),D.setFont(Ct),D.setRotation(pm(Mm(y,"layout","text-rotate",u,p)));var Lt=Mm(y,"layout","text-anchor",u,p),Mt=N||1==h?"point":Mm(y,"layout","symbol-placement",u,p);D.setPlacement(Mt);var Ft=Mm(y,"paint","text-halo-width",u,p),At=Mm(y,"layout","text-offset",u,p),kt=Mm(y,"paint","text-translate",u,p),jt=0,Nt=0;if("point"==Mt){var Dt="center";-1!==Lt.indexOf("left")?(Dt="left",Nt=Ft):-1!==Lt.indexOf("right")&&(Dt="right",Nt=-Ft),D.setTextAlign(Dt);var Gt=Mm(y,"layout","text-rotation-alignment",u,p);D.setRotateWithView("map"==Gt)}else D.setMaxAngle(pm(Mm(y,"layout","text-max-angle",u,p))*wt.length/It.length),D.setTextAlign(),D.setRotateWithView(!1);var zt="middle";0==Lt.indexOf("bottom")?(zt="bottom",jt=-Ft-.5*(Tt-1)*St):0==Lt.indexOf("top")&&(zt="top",jt=Ft+.5*(Tt-1)*St),D.setTextBaseline(zt),D.setOffsetX(At[0]*St+Nt+kt[0]),D.setOffsetY(At[1]*St+jt+kt[1]),E.setColor(Am(Mm(y,"paint","text-color",u,p),w)),D.setFill(E);var Ut=Am(Mm(y,"paint","text-halo-color",u,p),w);if(Ut){S.setColor(Ut),Ft*=2;var Bt=.5*St;S.setWidth(Ft<=Bt?Ft:Bt),D.setStroke(S)}else D.setStroke(void 0);var Vt=Mm(y,"layout","text-padding",u,p),Yt=D.getPadding();Vt!==Yt[0]&&(Yt[0]=Yt[1]=Yt[2]=Yt[3]=Vt),L.setZIndex(M)}}},y=0,m=o.length;y-1?(O.length=d+1,Nm&&("function"==typeof t.set?t.set("mapbox-layer",c):t.getProperties()["mapbox-layer"]=c),O):void 0}};return t.setStyle(P),t.set("mapbox-source",h),t.set("mapbox-layers",d),P},Gm=r(6),zm=r.n(Gm),Um=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Bm(t){for(var e=[],r=0,n=t.length;r2?n[2]:""):t+r}function sv(t,e,r,n,i){return new Promise((function(o,a){if("object"!=typeof e&&(e=JSON.parse(e)),8!=e.version)return a(new Error("glStyle version 8 required."));if(!(t instanceof Iy||t instanceof lm))return a(new Error("Can only apply to VectorLayer or VectorTileLayer"));var s,l,u;function c(){u||e.sprite&&!s?u?(t.setStyle(u),o()):a(new Error("Something went wrong trying to apply style.")):(u=Dm(t,e,r,i,s,l,nv),t.getStyle()?o():a(new Error("Nothing to show for source ["+r+"]")))}if(e.sprite){var h=.5==(window.devicePixelRatio>=1.5?.5:1)?"@2x":"",p=av(e.sprite,n,h+".json");fetch(p,{credentials:"same-origin"}).then((function(t){return t.ok||""===h?t:(p=av(e.sprite,n,".json"),fetch(p,{credentials:"same-origin"}))})).then((function(t){if(t.ok)return t.json();a(new Error("Problem fetching sprite from "+p+": "+t.statusText))})).then((function(t){if(void 0===t)return a(new Error("No sprites found."));s=t,l=av(e.sprite,n,h+".png"),c()})).catch((function(t){a(new Error("Sprites cannot be loaded: "+p+": "+t.message))}))}else c()}))}new $m;var lv=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function uv(t){return 0!==t.indexOf("mapbox://")?"":t.slice("mapbox://".length)}function cv(t,e){var r=uv(t);if(!r)return t;if(0!==r.indexOf("sprites/"))throw new Error("unexpected sprites url: "+t);return"https://api.mapbox.com/styles/v1/"+r.slice("sprites/".length)+"/sprite?access_token="+e}function hv(t,e){var r=uv(t);if(!r)return t;if(0!==r.indexOf("fonts/"))throw new Error("unexpected fonts url: "+t);return"https://api.mapbox.com/fonts/v1/"+r.slice("fonts/".length)+"/0-255.pbf?access_token="+e}function pv(t,e){var r=uv(t);if(!r)return t;if(0!==r.indexOf("styles/"))throw new Error("unexpected style url: "+t);return"https://api.mapbox.com/styles/v1/"+r.slice("styles/".length)+"?&access_token="+e}function fv(t,e){var r=uv(t);return r?"https://{a-d}.tiles.mapbox.com/v4/"+r+"/{z}/{x}/{y}.vector.pbf?access_token="+e:t}var dv=function(t){function e(e){var r=t.call(this,A)||this;return r.error=e,r}return lv(e,t),e}(c),gv="vector",yv=function(t){function e(e){var r=this,n=!("declutter"in e)||e.declutter,i=new og({state:Jo,format:new am});return(r=t.call(this,{source:i,declutter:n,className:e.className,opacity:e.opacity,visible:e.visible,zIndex:e.zIndex,minResolution:e.minResolution,maxResolution:e.maxResolution,minZoom:e.minZoom,maxZoom:e.maxZoom,renderOrder:e.renderOrder,renderBuffer:e.renderBuffer,renderMode:e.renderMode,map:e.map,updateWhileAnimating:e.updateWhileAnimating,updateWhileInteracting:e.updateWhileInteracting,preload:e.preload,useInterimTilesOnError:e.useInterimTilesOnError})||this).sourceId=e.source,r.layers=e.layers,r.accessToken=e.accessToken,r.fetchStyle(e.styleUrl),r}return lv(e,t),e.prototype.fetchStyle=function(t){var e=this,r=pv(t,this.accessToken);fetch(r).then((function(t){if(!t.ok)throw new Error("unexpected response when fetching style: "+t.status);return t.json()})).then((function(t){e.onStyleLoad(t)})).catch((function(t){e.handleError(t)}))},e.prototype.onStyleLoad=function(t){var e,r,n=this;if(this.layers){for(var i={},o=0;o0){this.source_&&(this.source_.clear(),this.source_.addFeatures(h)),this.dispatchEvent(new Sv(wv,t,h,o));break}}},e.prototype.registerListeners_=function(){var t=this.getMap();if(t){var e=this.target?this.target:t.getViewport();this.dropListenKeys_=[Z(e,U,this.handleDrop,this),Z(e,G,this.handleStop,this),Z(e,z,this.handleStop,this),Z(e,U,this.handleStop,this)]}},e.prototype.setActive=function(e){!this.getActive()&&e&&this.registerListeners_(),this.getActive()&&!e&&this.unregisterListeners_(),t.prototype.setActive.call(this,e)},e.prototype.setMap=function(e){this.unregisterListeners_(),t.prototype.setMap.call(this,e),this.getActive()&&this.registerListeners_()},e.prototype.tryReadFeatures_=function(t,e,r){try{return t.readFeatures(e,r)}catch(t){return null}},e.prototype.unregisterListeners_=function(){this.dropListenKeys_&&(this.dropListenKeys_.forEach(H),this.dropListenKeys_=null)},e.prototype.handleDrop=function(t){for(var e=t.dataTransfer.files,r=0,n=e.length;r1?1:-1;return e.endInteraction(this.duration_,r),this.lastScaleDelta_=0,!1},e.prototype.handleDownEvent=function(t){return!!cl(t)&&(!!this.condition_(t)&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,this.lastMagnitude_=void 0,!0))},e}($s),Ov=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Pv=function(t){function e(e,r,n){var i=t.call(this)||this;if(void 0!==n&&void 0===r)i.setFlatCoordinates(n,e);else{var o=r||0;i.setCenterAndRadius(e,o,n)}return i}return Ov(e,t),e.prototype.clone=function(){var t=new e(this.flatCoordinates.slice(),void 0,this.layout);return t.applyProperties(this),t},e.prototype.closestPointXY=function(t,e,r,n){var i=this.flatCoordinates,o=t-i[0],a=e-i[1],s=o*o+a*a;if(s=e[0]||(t[1]<=e[1]&&t[3]>=e[1]||me(t,this.intersectsCoordinate.bind(this)))}return!1},e.prototype.setCenter=function(t){var e=this.stride,r=this.flatCoordinates[e]-this.flatCoordinates[0],n=t.slice();n[e]=n[0]+r;for(var i=1;i=this.dragVertexDelay_?(this.downPx_=e.pixel,this.shouldHandle_=!this.freehand_,r=!0):this.lastDragTime_=void 0,this.shouldHandle_&&void 0!==this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0));return this.freehand_&&e.type===Ga.POINTERDRAG&&null!==this.sketchFeature_?(this.addToDrawing_(e.coordinate),n=!1):this.freehand_&&e.type===Ga.POINTERDOWN?n=!1:r&&this.getPointerCount()<2?(n=e.type===Ga.POINTERMOVE)&&this.freehand_?(this.handlePointerMove_(e),this.shouldHandle_&&e.originalEvent.preventDefault()):("mouse"===e.originalEvent.pointerType||e.type===Ga.POINTERDRAG&&void 0===this.downTimeout_)&&this.handlePointerMove_(e):e.type===Ga.DBLCLICK&&(n=!1),t.prototype.handleEvent.call(this,e)&&n},e.prototype.handleDownEvent=function(t){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=t.pixel,this.finishCoordinate_||this.startDrawing_(t.coordinate),!0):this.condition_(t)?(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout(function(){this.handlePointerMove_(new Da(Ga.POINTERMOVE,t.map,t.originalEvent,!1,t.frameState))}.bind(this),this.dragVertexDelay_),this.downPx_=t.pixel,!0):(this.lastDragTime_=void 0,!1)},e.prototype.handleUpEvent=function(t){var e=!0;if(0===this.getPointerCount())if(this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0),this.handlePointerMove_(t),this.shouldHandle_){switch(!0){case!this.finishCoordinate_:if(this.startDrawing_(t.coordinate),this.mode_!==Lv)break;case this.freehand_||this.atFinish_(t.pixel)&&this.finishCondition_(t):this.finishDrawing();break;case!this.freehand_:this.addToDrawing_(t.coordinate)}e=!1}else this.freehand_&&this.abortDrawing();return!e&&this.stopClick_&&t.originalEvent.stopPropagation(),e},e.prototype.handlePointerMove_=function(t){if(this.pointerType_=t.originalEvent.pointerType,this.downPx_&&(!this.freehand_&&this.shouldHandle_||this.freehand_&&!this.shouldHandle_)){var e=this.downPx_,r=t.pixel,n=e[0]-r[0],i=e[1]-r[1],o=n*n+i*i;if(this.shouldHandle_=this.freehand_?o>this.squaredClickTolerance_:o<=this.squaredClickTolerance_,!this.shouldHandle_)return}this.finishCoordinate_?this.modifyDrawing_(t.coordinate):this.createOrUpdateSketchPoint_(t)},e.prototype.atFinish_=function(t){var e=!1;if(this.sketchFeature_){var r=!1,n=[this.finishCoordinate_],i=this.mode_;if(i===Lv)e=!0;else if(i===Av)e=2===this.sketchCoords_.length;else if(i===Mv)r=this.sketchCoords_.length>this.minPoints_;else if(i===Fv){var o=this.sketchCoords_;r=o[0].length>this.minPoints_,n=[o[0][0],o[0][o[0].length-2]]}if(r)for(var a=this.getMap(),s=0,l=n.length;s=this.maxPoints_&&(this.freehand_?r.pop():e=!0),r.push(t.slice()),this.geometryFunction_(r,n,i)):o===Fv&&((r=this.sketchCoords_[0]).length>=this.maxPoints_&&(this.freehand_?r.pop():e=!0),r.push(t.slice()),e&&(this.finishCoordinate_=r[0]),this.geometryFunction_(this.sketchCoords_,n,i)),this.updateSketchFeatures_(),e&&this.finishDrawing()},e.prototype.removeLastPoint=function(){if(this.sketchFeature_){var t,e=this.sketchFeature_.getGeometry(),r=this.getMap().getView().getProjection(),n=this.mode_;if(n===Mv||n===Av){if((t=this.sketchCoords_).splice(-2,1),t.length>=2){this.finishCoordinate_=t[t.length-2].slice();var i=this.finishCoordinate_.slice();t[t.length-1]=i,this.sketchPoint_.setGeometry(new qn(i))}this.geometryFunction_(t,e,r),e.getType()===bt.POLYGON&&this.sketchLine_&&this.createOrUpdateCustomSketchLine_(e)}else if(n===Fv){(t=this.sketchCoords_[0]).splice(-2,1);var o=this.sketchLine_.getGeometry();if(t.length>=2){i=t[t.length-2].slice();t[t.length-1]=i,this.sketchPoint_.setGeometry(new qn(i))}o.setCoordinates(t),this.geometryFunction_(this.sketchCoords_,e,r)}1===t.length&&this.abortDrawing(),this.updateSketchFeatures_()}},e.prototype.finishDrawing=function(){var t=this.abortDrawing_();if(t){var e=this.sketchCoords_,r=t.getGeometry(),n=this.getMap().getView().getProjection();this.mode_===Mv?(e.pop(),this.geometryFunction_(e,r,n)):this.mode_===Fv&&(e[0].pop(),this.geometryFunction_(e,r,n),e=r.getCoordinates()),this.type_===bt.MULTI_POINT?t.setGeometry(new Hy([e])):this.type_===bt.MULTI_LINE_STRING?t.setGeometry(new Zy([e])):this.type_===bt.MULTI_POLYGON&&t.setGeometry(new Jy([e])),this.dispatchEvent(new Dv(jv,t)),this.features_&&this.features_.push(t),this.source_&&this.source_.addFeature(t)}},e.prototype.abortDrawing_=function(){this.finishCoordinate_=null;var t=this.sketchFeature_;return this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0),t},e.prototype.abortDrawing=function(){var t=this.abortDrawing_();t&&this.dispatchEvent(new Dv(Nv,t))},e.prototype.appendCoordinates=function(t){var e,r=this.mode_,n=!this.sketchFeature_;if(n&&this.startDrawing_(t[0]),r===Mv||r===Av)e=this.sketchCoords_;else{if(r!==Fv)return;e=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[]}n&&e.shift(),e.pop();for(var i=0;ih?o[1]:o[0]),a}}return null},e.prototype.handlePointerMove_=function(t){var e=t.pixel,r=t.map,n=this.snapToVertex_(e,r);n||(n=r.getCoordinateFromPixelInternal(e)),this.createOrUpdatePointerFeature_(n)},e.prototype.createOrUpdateExtentFeature_=function(t){var e=this.extentFeature_;return e?t?e.setGeometry(gi(t)):e.setGeometry(void 0):(e=new gt(t?gi(t):{}),this.extentFeature_=e,this.extentOverlay_.getSource().addFeature(e)),e},e.prototype.createOrUpdatePointerFeature_=function(t){var e=this.vertexFeature_;e?e.getGeometry().setCoordinates(t):(e=new gt(new qn(t)),this.vertexFeature_=e,this.vertexOverlay_.getSource().addFeature(e));return e},e.prototype.handleEvent=function(e){return!e.originalEvent||!this.condition_(e)||(e.type!=Ga.POINTERMOVE||this.handlingDownUpSequence||this.handlePointerMove_(e),t.prototype.handleEvent.call(this,e),!1)},e.prototype.handleDownEvent=function(t){var e=t.pixel,r=t.map,n=this.getExtentInternal(),i=this.snapToVertex_(e,r),o=function(t){var e=null,r=null;return t[0]==n[0]?e=n[2]:t[0]==n[2]&&(e=n[0]),t[1]==n[1]?r=n[3]:t[1]==n[3]&&(r=n[1]),null!==e&&null!==r?[e,r]:null};if(i&&n){var a=i[0]==n[0]||i[0]==n[2]?i[0]:null,s=i[1]==n[1]||i[1]==n[3]?i[1]:null;null!==a&&null!==s?this.pointerHandler_=Yv(o(i)):null!==a?this.pointerHandler_=Wv(o([a,n[1]]),o([a,n[3]])):null!==s&&(this.pointerHandler_=Wv(o([n[0],s]),o([n[2],s])))}else i=r.getCoordinateFromPixelInternal(e),this.setExtent([i[0],i[1],i[0],i[1]]),this.pointerHandler_=Yv(i);return!0},e.prototype.handleDragEvent=function(t){if(this.pointerHandler_){var e=t.coordinate;this.setExtent(this.pointerHandler_(e)),this.createOrUpdatePointerFeature_(e)}},e.prototype.handleUpEvent=function(t){this.pointerHandler_=null;var e=this.getExtentInternal();return e&&0!==ve(e)||this.setExtent(null),!1},e.prototype.setMap=function(e){this.extentOverlay_.setMap(e),this.vertexOverlay_.setMap(e),t.prototype.setMap.call(this,e)},e.prototype.getExtent=function(){return nn(this.getExtentInternal(),this.getMap().getView().getProjection())},e.prototype.getExtentInternal=function(){return this.extent_},e.prototype.setExtent=function(t){this.extent_=t||null,this.createOrUpdateExtentFeature_(t),this.dispatchEvent(new Bv(this.extent_))},e}($s),Xv=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Zv=[0,0,0,0],Kv=[],Hv="modifystart",$v="modifyend",Jv=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.features=r,i.mapBrowserEvent=n,i}return Xv(e,t),e}(c);function Qv(t,e){return t.index-e.index}function t_(t,e,r){var n=e.geometry;if(n.getType()===bt.CIRCLE){var i=n;if(1===e.index){var o=tn();o&&(i=i.clone().transform(o,r));var a=Rr(i.getCenter(),rn(t,r)),s=Math.sqrt(a)-i.getRadius();return s*s}}var l=rn(t,r);return Kv[0]=rn(e.segment[0],r),Kv[1]=rn(e.segment[1],r),Lr(l,Kv)}function e_(t,e,r){var n=e.geometry;if(n.getType()===bt.CIRCLE&&1===e.index){var i=n,o=tn();return o&&(i=i.clone().transform(o,r)),en(i.getClosestPoint(rn(t,r)),r)}var a=rn(t,r);return Kv[0]=rn(e.segment[0],r),Kv[1]=rn(e.segment[1],r),en(Sr(a,Kv),r)}var r_=function(t){function e(e){var r,n,i=t.call(this,e)||this;if(i.boundHandleFeatureChange_=i.handleFeatureChange_.bind(i),i.condition_=e.condition?e.condition:hl,i.defaultDeleteCondition_=function(t){return Qs(t)&&al(t)},i.deleteCondition_=e.deleteCondition?e.deleteCondition:i.defaultDeleteCondition_,i.insertVertexCondition_=e.insertVertexCondition?e.insertVertexCondition:nl,i.vertexFeature_=null,i.vertexSegments_=null,i.lastPixel_=[0,0],i.ignoreNextSingleClick_=!1,i.featuresBeingModified_=null,i.rBush_=new Rp,i.pixelTolerance_=void 0!==e.pixelTolerance?e.pixelTolerance:10,i.snappedToVertex_=!1,i.changingFeature_=!1,i.dragSegments_=[],i.overlay_=new Iy({source:new hf({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.style?e.style:(r=bp(),function(t,e){return r[bt.POINT]}),updateWhileAnimating:!0,updateWhileInteracting:!0}),i.SEGMENT_WRITERS_={Point:i.writePointGeometry_.bind(i),LineString:i.writeLineStringGeometry_.bind(i),LinearRing:i.writeLineStringGeometry_.bind(i),Polygon:i.writePolygonGeometry_.bind(i),MultiPoint:i.writeMultiPointGeometry_.bind(i),MultiLineString:i.writeMultiLineStringGeometry_.bind(i),MultiPolygon:i.writeMultiPolygonGeometry_.bind(i),Circle:i.writeCircleGeometry_.bind(i),GeometryCollection:i.writeGeometryCollectionGeometry_.bind(i)},i.source_=null,i.hitDetection_=null,e.features?n=e.features:e.source&&(i.source_=e.source,n=new ht(i.source_.getFeatures()),i.source_.addEventListener(ef,i.handleSourceAdd_.bind(i)),i.source_.addEventListener(of,i.handleSourceRemove_.bind(i))),!n)throw new Error("The modify interaction requires features, a source or a layer");return e.hitDetection&&(i.hitDetection_=e.hitDetection),i.features_=n,i.features_.forEach(i.addFeature_.bind(i)),i.features_.addEventListener(at,i.handleFeatureAdd_.bind(i)),i.features_.addEventListener(st,i.handleFeatureRemove_.bind(i)),i.lastPointerEvent_=null,i.delta_=[0,0],i}return Xv(e,t),e.prototype.addFeature_=function(t){var e=t.getGeometry();if(e){var r=this.SEGMENT_WRITERS_[e.getType()];r&&r(t,e)}var n=this.getMap();n&&n.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,n),t.addEventListener(F,this.boundHandleFeatureChange_)},e.prototype.willModifyFeatures_=function(t,e){if(!this.featuresBeingModified_){this.featuresBeingModified_=new ht;for(var r=this.featuresBeingModified_.getArray(),n=0,i=e.length;n=0;--n){for(var i=r[n],o=this.dragSegments_.length-1;o>=0;--o)this.dragSegments_[o][0]===i&&this.dragSegments_.splice(o,1);e.remove(i)}},e.prototype.setActive=function(e){this.vertexFeature_&&!e&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.prototype.setActive.call(this,e)},e.prototype.setMap=function(e){this.overlay_.setMap(e),t.prototype.setMap.call(this,e)},e.prototype.getOverlay=function(){return this.overlay_},e.prototype.handleSourceAdd_=function(t){t.feature&&this.features_.push(t.feature)},e.prototype.handleSourceRemove_=function(t){t.feature&&this.features_.remove(t.feature)},e.prototype.handleFeatureAdd_=function(t){this.addFeature_(t.element)},e.prototype.handleFeatureChange_=function(t){if(!this.changingFeature_){var e=t.target;this.removeFeature_(e),this.addFeature_(e)}},e.prototype.handleFeatureRemove_=function(t){var e=t.element;this.removeFeature_(e)},e.prototype.writePointGeometry_=function(t,e){var r=e.getCoordinates(),n={feature:t,geometry:e,segment:[r,r]};this.rBush_.insert(e.getExtent(),n)},e.prototype.writeMultiPointGeometry_=function(t,e){for(var r=e.getCoordinates(),n=0,i=r.length;n=0;--y)this.insertVertex_(i[y],a)}return!!this.vertexFeature_},e.prototype.handleUpEvent=function(t){for(var e=this.dragSegments_.length-1;e>=0;--e){var r=this.dragSegments_[e][0],n=r.geometry;if(n.getType()===bt.CIRCLE){var i=n.getCenter(),o=r.featureSegments[0],a=r.featureSegments[1];o.segment[0]=i,o.segment[1]=i,a.segment[0]=i,a.segment[1]=i,this.rBush_.update(ae(i),o);var s=n,l=tn();if(l){var u=t.map.getView().getProjection();s=yi(s=s.clone().transform(l,u)).transform(u,l)}this.rBush_.update(s.getExtent(),a)}else this.rBush_.update(Kt(r.segment),r)}return this.featuresBeingModified_&&(this.dispatchEvent(new Jv($v,this.featuresBeingModified_,t)),this.featuresBeingModified_=null),!1},e.prototype.handlePointerMove_=function(t){this.lastPixel_=t.pixel,this.handlePointerAtPixel_(t.pixel,t.map,t.coordinate)},e.prototype.handlePointerAtPixel_=function(t,e,r){var n,i,a=this,s=r||e.getCoordinateFromPixel(t),l=e.getView().getProjection();if(this.hitDetection_){var u="object"==typeof this.hitDetection_?function(t){return t===a.hitDetection_}:void 0;e.forEachFeatureAtPixel(t,(function(t,e,r){if((r=r||t.getGeometry()).getType()===bt.POINT){i=r;var o=r.getCoordinates();n=[{feature:t,geometry:r,segment:[o,o]}]}return!0}),{layerFilter:u})}if(!n){var c=nn(Ht(on(ae(s,Zv),l),e.getView().getResolution()*this.pixelTolerance_,Zv),l);n=this.rBush_.getInExtent(c)}if(n&&n.length>0){var h=n.sort((function(t,e){return t_(s,t,l)-t_(s,e,l)}))[0],p=h.segment,f=e_(s,h,l),d=e.getPixelFromCoordinate(f),g=Ir(t,d);if(i||g<=this.pixelTolerance_){var y={};if(y[o(p)]=!0,this.delta_[0]=f[0]-s[0],this.delta_[1]=f[1]-s[1],h.geometry.getType()===bt.CIRCLE&&1===h.index)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(f,[h.feature],[h.geometry]);else{var m=e.getPixelFromCoordinate(p[0]),v=e.getPixelFromCoordinate(p[1]),_=Rr(d,m),b=Rr(d,v);g=Math.sqrt(Math.min(_,b)),this.snappedToVertex_=g<=this.pixelTolerance_,this.snappedToVertex_&&(f=_>b?p[1]:p[0]),this.createOrUpdateVertexFeature_(f,[h.feature],[h.geometry]);var x={};x[o(h.geometry)]=!0;for(var w=1,S=n.length;w=0;--i)h=o((c=(r=p[i])[0]).feature),c.depth&&(h+="-"+c.depth.join("-")),h in f||(f[h]={}),0===r[1]?(f[h].right=c,f[h].index=c.index):1==r[1]&&(f[h].left=c,f[h].index=c.index+1);for(h in f){switch(u=f[h].right,s=f[h].left,(l=(a=f[h].index)-1)<0&&(l=0),t=e=(n=(c=void 0!==s?s:u).geometry).getCoordinates(),d=!1,n.getType()){case bt.MULTI_LINE_STRING:e[c.depth[0]].length>2&&(e[c.depth[0]].splice(a,1),d=!0);break;case bt.LINE_STRING:e.length>2&&(e.splice(a,1),d=!0);break;case bt.MULTI_POLYGON:t=t[c.depth[1]];case bt.POLYGON:(t=t[c.depth[0]]).length>4&&(a==t.length-1&&(a=0),t.splice(a,1),d=!0,0===a&&(t.pop(),t.push(t[0]),l=t.length-1))}if(d){this.setGeometryCoordinates_(n,e);var g=[];if(void 0!==s&&(this.rBush_.remove(s),g.push(s.segment[0])),void 0!==u&&(this.rBush_.remove(u),g.push(u.segment[1])),void 0!==s&&void 0!==u){var y={depth:c.depth,feature:c.feature,geometry:c.geometry,index:l,segment:g};this.rBush_.insert(Kt(y.segment),y)}this.updateSegmentIndices_(n,a,c.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),p.length=0}}return d},e.prototype.setGeometryCoordinates_=function(t,e){this.changingFeature_=!0,t.setCoordinates(e),this.changingFeature_=!1},e.prototype.updateSegmentIndices_=function(t,e,r,n){this.rBush_.forEachInExtent(t.getExtent(),(function(i){i.geometry===t&&(void 0===r||void 0===i.depth||b(i.depth,r))&&i.index>e&&(i.index+=n)}))},e}($s),n_=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),i_="select",o_=function(t){function e(e,r,n,i){var o=t.call(this,e)||this;return o.selected=r,o.deselected=n,o.mapBrowserEvent=i,o}return n_(e,t),e}(c),a_={};var s_=function(t){function e(e){var r,n,i=t.call(this)||this,o=e||{};if(i.boundAddFeature_=i.addFeature_.bind(i),i.boundRemoveFeature_=i.removeFeature_.bind(i),i.condition_=o.condition?o.condition:al,i.addCondition_=o.addCondition?o.addCondition:ol,i.removeCondition_=o.removeCondition?o.removeCondition:ol,i.toggleCondition_=o.toggleCondition?o.toggleCondition:ll,i.multi_=!!o.multi&&o.multi,i.filter_=o.filter?o.filter:S,i.hitTolerance_=o.hitTolerance?o.hitTolerance:0,i.style_=void 0!==o.style?o.style:(v((r=bp())[bt.POLYGON],r[bt.LINE_STRING]),v(r[bt.GEOMETRY_COLLECTION],r[bt.LINE_STRING]),function(t){return t.getGeometry()?r[t.getGeometry().getType()]:null}),i.features_=o.features||new ht,o.layers)if("function"==typeof o.layers)n=o.layers;else{var a=o.layers;n=function(t){return g(a,t)}}else n=S;return i.layerFilter_=n,i.featureLayerAssociation_={},i}return n_(e,t),e.prototype.addFeatureLayerAssociation_=function(t,e){this.featureLayerAssociation_[o(t)]=e},e.prototype.getFeatures=function(){return this.features_},e.prototype.getHitTolerance=function(){return this.hitTolerance_},e.prototype.getLayer=function(t){return this.featureLayerAssociation_[o(t)]},e.prototype.setHitTolerance=function(t){this.hitTolerance_=t},e.prototype.setMap=function(e){this.getMap()&&this.style_&&this.features_.forEach(this.restorePreviousStyle_.bind(this)),t.prototype.setMap.call(this,e),e?(this.features_.addEventListener(at,this.boundAddFeature_),this.features_.addEventListener(st,this.boundRemoveFeature_),this.style_&&this.features_.forEach(this.applySelectedStyle_.bind(this))):(this.features_.removeEventListener(at,this.boundAddFeature_),this.features_.removeEventListener(st,this.boundRemoveFeature_))},e.prototype.addFeature_=function(t){var e=t.element;this.style_&&this.applySelectedStyle_(e)},e.prototype.removeFeature_=function(t){var e=t.element;this.style_&&this.restorePreviousStyle_(e)},e.prototype.getStyle=function(){return this.style_},e.prototype.applySelectedStyle_=function(t){var e=o(t);e in a_||(a_[e]=t.getStyle()),t.setStyle(this.style_)},e.prototype.restorePreviousStyle_=function(t){for(var r=this.getMap().getInteractions().getArray(),n=r.length-1;n>=0;--n){var i=r[n];if(i!==this&&i instanceof e&&i.getStyle()&&-1!==i.getFeatures().getArray().lastIndexOf(t))return void t.setStyle(i.getStyle())}var a=o(t);t.setStyle(a_[a]),delete a_[a]},e.prototype.removeFeatureLayerAssociation_=function(t){delete this.featureLayerAssociation_[o(t)]},e.prototype.handleEvent=function(t){if(!this.condition_(t))return!0;var e=this.addCondition_(t),r=this.removeCondition_(t),n=this.toggleCondition_(t),i=!e&&!r&&!n,o=t.map,a=this.getFeatures(),s=[],l=[];if(i){P(this.featureLayerAssociation_),o.forEachFeatureAtPixel(t.pixel,function(t,e){if(this.filter_(t,e))return l.push(t),this.addFeatureLayerAssociation_(t,e),!this.multi_}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(var u=a.getLength()-1;u>=0;--u){var c=a.item(u),h=l.indexOf(c);h>-1?l.splice(h,1):(a.remove(c),s.push(c))}0!==l.length&&a.extend(l)}else{o.forEachFeatureAtPixel(t.pixel,function(t,i){if(this.filter_(t,i))return!e&&!n||g(a.getArray(),t)?(r||n)&&g(a.getArray(),t)&&(s.push(t),this.removeFeatureLayerAssociation_(t)):(l.push(t),this.addFeatureLayerAssociation_(t,i)),!this.multi_}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(var p=s.length-1;p>=0;--p)a.remove(s[p]);a.extend(l)}return(l.length>0||s.length>0)&&this.dispatchEvent(new o_(i_,l,s,t)),!0},e}(qs),l_=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function u_(t){return t.feature?t.feature:t.element?t.element:void 0}var c_=[],h_=function(t){function e(e){var r=this,n=e||{},i=n;return i.handleDownEvent||(i.handleDownEvent=S),i.stopDown||(i.stopDown=E),(r=t.call(this,i)||this).source_=n.source?n.source:null,r.vertex_=void 0===n.vertex||n.vertex,r.edge_=void 0===n.edge||n.edge,r.features_=n.features?n.features:null,r.featuresListenerKeys_=[],r.featureChangeListenerKeys_={},r.indexedFeaturesExtents_={},r.pendingFeatures_={},r.pixelTolerance_=void 0!==n.pixelTolerance?n.pixelTolerance:10,r.rBush_=new Rp,r.SEGMENT_WRITERS_={Point:r.writePointGeometry_.bind(r),LineString:r.writeLineStringGeometry_.bind(r),LinearRing:r.writeLineStringGeometry_.bind(r),Polygon:r.writePolygonGeometry_.bind(r),MultiPoint:r.writeMultiPointGeometry_.bind(r),MultiLineString:r.writeMultiLineStringGeometry_.bind(r),MultiPolygon:r.writeMultiPolygonGeometry_.bind(r),GeometryCollection:r.writeGeometryCollectionGeometry_.bind(r),Circle:r.writeCircleGeometry_.bind(r)},r}return l_(e,t),e.prototype.addFeature=function(t,e){var r=void 0===e||e,n=o(t),i=t.getGeometry();if(i){var a=this.SEGMENT_WRITERS_[i.getType()];a&&(this.indexedFeaturesExtents_[n]=i.getExtent([1/0,1/0,-1/0,-1/0]),a(t,i))}r&&(this.featureChangeListenerKeys_[n]=Z(t,F,this.handleFeatureChange_,this))},e.prototype.forEachFeatureAdd_=function(t){this.addFeature(t)},e.prototype.forEachFeatureRemove_=function(t){this.removeFeature(t)},e.prototype.getFeatures_=function(){var t;return this.features_?t=this.features_:this.source_&&(t=this.source_.getFeatures()),t},e.prototype.handleEvent=function(e){var r=this.snapTo(e.pixel,e.coordinate,e.map);return r.snapped&&(e.coordinate=r.vertex.slice(0,2),e.pixel=r.vertexPixel),t.prototype.handleEvent.call(this,e)},e.prototype.handleFeatureAdd_=function(t){var e=u_(t);this.addFeature(e)},e.prototype.handleFeatureRemove_=function(t){var e=u_(t);this.removeFeature(e)},e.prototype.handleFeatureChange_=function(t){var e=t.target;if(this.handlingDownUpSequence){var r=o(e);r in this.pendingFeatures_||(this.pendingFeatures_[r]=e)}else this.updateFeature_(e)},e.prototype.handleUpEvent=function(t){var e=R(this.pendingFeatures_);return e.length&&(e.forEach(this.updateFeature_.bind(this)),this.pendingFeatures_={}),!1},e.prototype.removeFeature=function(t,e){var r=void 0===e||e,n=o(t),i=this.indexedFeaturesExtents_[n];if(i){var a=this.rBush_,s=[];a.forEachInExtent(i,(function(e){t===e.feature&&s.push(e)}));for(var l=s.length-1;l>=0;--l)a.remove(s[l])}r&&(H(this.featureChangeListenerKeys_[n]),delete this.featureChangeListenerKeys_[n])},e.prototype.setMap=function(e){var r=this.getMap(),n=this.featuresListenerKeys_,i=this.getFeatures_();r&&(n.forEach(H),n.length=0,i.forEach(this.forEachFeatureRemove_.bind(this))),t.prototype.setMap.call(this,e),e&&(this.features_?n.push(Z(this.features_,at,this.handleFeatureAdd_,this),Z(this.features_,st,this.handleFeatureRemove_,this)):this.source_&&n.push(Z(this.source_,ef,this.handleFeatureAdd_,this),Z(this.source_,of,this.handleFeatureRemove_,this)),i.forEach(this.forEachFeatureAdd_.bind(this)))},e.prototype.snapTo=function(t,e,r){var n=Kt([r.getCoordinateFromPixel([t[0]-this.pixelTolerance_,t[1]+this.pixelTolerance_]),r.getCoordinateFromPixel([t[0]+this.pixelTolerance_,t[1]-this.pixelTolerance_])]),i=this.rBush_.getInExtent(n);this.vertex_&&!this.edge_&&(i=i.filter((function(t){return t.feature.getGeometry().getType()!==bt.CIRCLE})));var o=!1,a=null,s=null;if(0===i.length)return{snapped:o,vertex:a,vertexPixel:s};for(var l,u=r.getView().getProjection(),c=rn(e,u),h=1/0,p=0;p_?g[1]:g[0],s=r.getPixelFromCoordinate(a))}else if(this.edge_){var b=l.feature.getGeometry().getType()===bt.CIRCLE;if(b){var x=l.feature.getGeometry(),w=tn();w&&(x=x.clone().transform(w,u)),a=en(wr(c,x),u)}else c_[0]=rn(g[0],u),c_[1]=rn(g[1],u),a=en(Sr(c,c_),u);if(Ir(t,s=r.getPixelFromCoordinate(a))<=this.pixelTolerance_&&(o=!0,this.vertex_&&!b)){y=r.getPixelFromCoordinate(g[0]),m=r.getPixelFromCoordinate(g[1]),v=Rr(s,y),_=Rr(s,m);Math.sqrt(Math.min(v,_))<=this.pixelTolerance_&&(a=v>_?g[1]:g[0],s=r.getPixelFromCoordinate(a))}}return o&&(s=[Math.round(s[0]),Math.round(s[1])]),{snapped:o,vertex:a,vertexPixel:s}},e.prototype.updateFeature_=function(t){this.removeFeature(t,!1),this.addFeature(t,!1)},e.prototype.writeCircleGeometry_=function(t,e){var r=this.getMap().getView().getProjection(),n=e,i=tn();i&&(n=n.clone().transform(i,r));var o=yi(n);i&&o.transform(r,i);for(var a=o.getCoordinates()[0],s=0,l=a.length-1;s=0;r--){var u=o[r][0];if(te(new Yn(u).getExtent(),new Yn(s).getExtent())){o[r].push(s),l=!0;break}}l||o.push([s.reverse()])}return o}(o.rings,a);1===s.length?(i=bt.POLYGON,t=O({},t,((r={}).rings=s[0],r))):(i=bt.MULTI_POLYGON,t=O({},t,((n={}).rings=s,n)))}return Wy((0,b_[i])(t),!1,e)}function S_(t){var e=yt;return!0===t.hasZ&&!0===t.hasM?e=_t:!0===t.hasZ?e=mt:!0===t.hasM&&(e=vt),e}function E_(t){var e=t.getLayout();return{hasZ:e===mt||e===_t,hasM:e===vt||e===_t}}function T_(t,e){return(0,x_[t.getType()])(Wy(t,!0,e),e)}x_[bt.POINT]=function(t,e){var r,n=t.getCoordinates(),i=t.getLayout();i===mt?r={x:n[0],y:n[1],z:n[2]}:i===vt?r={x:n[0],y:n[1],m:n[2]}:i===_t?r={x:n[0],y:n[1],z:n[2],m:n[3]}:i===yt?r={x:n[0],y:n[1]}:pt(!1,34);return r},x_[bt.LINE_STRING]=function(t,e){var r=E_(t);return{hasZ:r.hasZ,hasM:r.hasM,paths:[t.getCoordinates()]}},x_[bt.POLYGON]=function(t,e){var r=E_(t);return{hasZ:r.hasZ,hasM:r.hasM,rings:t.getCoordinates(!1)}},x_[bt.MULTI_POINT]=function(t,e){var r=E_(t);return{hasZ:r.hasZ,hasM:r.hasM,points:t.getCoordinates()}},x_[bt.MULTI_LINE_STRING]=function(t,e){var r=E_(t);return{hasZ:r.hasZ,hasM:r.hasM,paths:t.getCoordinates()}},x_[bt.MULTI_POLYGON]=function(t,e){for(var r=E_(t),n=t.getCoordinates(!1),i=[],o=0;o=0;a--)i.push(n[o][a]);return{hasZ:r.hasZ,hasM:r.hasM,rings:i}};var C_=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this)||this).geometryName_=n.geometryName,r}return __(e,t),e.prototype.readFeatureFromObject=function(t,e,r){var n=t,i=w_(n.geometry,e),o=new gt;if(this.geometryName_&&o.setGeometryName(this.geometryName_),o.setGeometry(i),n.attributes){o.setProperties(n.attributes,!0);var a=n.attributes[r];void 0!==a&&o.setId(a)}return o},e.prototype.readFeaturesFromObject=function(t,e){var r=e||{};if(t.features){for(var n=[],i=t.features,o=0,a=i.length;o0?r[0]:null},e.prototype.readFeatureFromNode=function(t,e){return null},e.prototype.readFeatures=function(t,e){if(t){if("string"==typeof t){var r=Pc(t);return this.readFeaturesFromDocument(r,e)}return Cc(t)?this.readFeaturesFromDocument(t,e):this.readFeaturesFromNode(t,e)}return[]},e.prototype.readFeaturesFromDocument=function(t,e){for(var r=[],n=t.firstChild;n;n=n.nextSibling)n.nodeType==Node.ELEMENT_NODE&&v(r,this.readFeaturesFromNode(n,e));return r},e.prototype.readFeaturesFromNode=function(t,e){return n()},e.prototype.readGeometry=function(t,e){if(t){if("string"==typeof t){var r=Pc(t);return this.readGeometryFromDocument(r,e)}return Cc(t)?this.readGeometryFromDocument(t,e):this.readGeometryFromNode(t,e)}return null},e.prototype.readGeometryFromDocument=function(t,e){return null},e.prototype.readGeometryFromNode=function(t,e){return null},e.prototype.readProjection=function(t){if(t){if("string"==typeof t){var e=Pc(t);return this.readProjectionFromDocument(e)}return Cc(t)?this.readProjectionFromDocument(t):this.readProjectionFromNode(t)}return null},e.prototype.readProjectionFromDocument=function(t){return this.dataProjection},e.prototype.readProjectionFromNode=function(t){return this.dataProjection},e.prototype.writeFeature=function(t,e){var r=this.writeFeatureNode(t,e);return this.xmlSerializer_.serializeToString(r)},e.prototype.writeFeatureNode=function(t,e){return null},e.prototype.writeFeatures=function(t,e){var r=this.writeFeaturesNode(t,e);return this.xmlSerializer_.serializeToString(r)},e.prototype.writeFeaturesNode=function(t,e){return null},e.prototype.writeGeometry=function(t,e){var r=this.writeGeometryNode(t,e);return this.xmlSerializer_.serializeToString(r)},e.prototype.writeGeometryNode=function(t,e){return null},e}(Yy),R_=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),I_="http://www.opengis.net/gml",L_=/^[\s\xa0]*$/,M_=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.featureType=n.featureType,r.featureNS=n.featureNS,r.srsName=n.srsName,r.schemaLocation="",r.FEATURE_COLLECTION_PARSERS={},r.FEATURE_COLLECTION_PARSERS[r.namespace]={featureMember:Ic(r.readFeaturesInternal),featureMembers:Lc(r.readFeaturesInternal)},r}return R_(e,t),e.prototype.readFeaturesInternal=function(t,e){var r=t.localName,n=null;if("FeatureCollection"==r)n=Uc([],this.FEATURE_COLLECTION_PARSERS,t,e,this);else if("featureMembers"==r||"featureMember"==r||"member"==r){var i=e[0],o=i.featureType,a=i.featureNS;if(!o&&t.childNodes){o=[],a={};for(var s=0,l=t.childNodes.length;s0){i[s]={_content_:i[s]};for(var u=0;u0:h===bt.POINT||h===bt.MULTI_POINT}}s&&(l=o.get("name"),(s=s&&!!l)&&l.search(/&[^&]+;/)>-1&&(Tx||(Tx=document.createElement("textarea")),Tx.innerHTML=l,l=Tx.value));var p=r;if(t?p=t:e&&(p=function t(e,r,n){return Array.isArray(e)?e:"string"==typeof e?t(n[e],r,n):r}(e,r,n)),s){var f=function(t,e){var r=[0,0],n="start",i=t.getImage();if(i){var o=i.getImageSize();if(null===o&&(o=Kb),2==o.length){var a=i.getScaleArray();r[0]=a[0]*o[0]/2,r[1]=-a[1]*o[1]/2,n="left"}}var s=t.getText();s?((s=s.clone()).setFont(s.getFont()||Sx.getFont()),s.setScale(s.getScale()||Sx.getScale()),s.setFill(s.getFill()||Sx.getFill()),s.setStroke(s.getStroke()||xx)):s=Sx.clone();return s.setText(e),s.setOffsetX(r[0]),s.setOffsetY(r[1]),s.setTextAlign(n),new wp({image:i,text:s})}(p[0],l);return u.length>0?(f.setGeometry(new Vm(u)),[f,new wp({geometry:p[0].getGeometry(),image:null,fill:p[0].getFill(),stroke:p[0].getStroke(),text:null})].concat(p.slice(1))):f}return p}}(r.Style,r.styleUrl,this.defaultStyle_,this.sharedStyles_,this.showPointNames_);n.setStyle(s)}return delete r.Style,n.setProperties(r,!0),n}},e.prototype.readSharedStyle_=function(t,e){var r=t.getAttribute("id");if(null!==r){var n=nw.call(this,t,e);if(n){var i=void 0,o=t.baseURI;if(o&&"about:blank"!=o||(o=window.location.href),o)i=new URL("#"+r,o).href;else i="#"+r;this.sharedStyles_[i]=n}}},e.prototype.readSharedStyleMap_=function(t,e){var r=t.getAttribute("id");if(null!==r){var n=kx.call(this,t,e);if(n){var i,o=t.baseURI;if(o&&"about:blank"!=o||(o=window.location.href),o)i=new URL("#"+r,o).href;else i="#"+r;this.sharedStyles_[i]=n}}},e.prototype.readFeatureFromNode=function(t,e){if(!g(cx,t.namespaceURI))return null;var r=this.readPlacemark_(t,[this.getReadOptions(t,e)]);return r||null},e.prototype.readFeaturesFromNode=function(t,e){if(!g(cx,t.namespaceURI))return[];var r,n=t.localName;if("Document"==n||"Folder"==n)return(r=this.readDocumentOrFolder_(t,[this.getReadOptions(t,e)]))||[];if("Placemark"==n){var i=this.readPlacemark_(t,[this.getReadOptions(t,e)]);return i?[i]:[]}if("kml"==n){r=[];for(var o=t.firstElementChild;o;o=o.nextElementSibling){var a=this.readFeaturesFromNode(o,e);a&&v(r,a)}return r}return[]},e.prototype.readName=function(t){if(t){if("string"==typeof t){var e=Pc(t);return this.readNameFromDocument(e)}return Cc(t)?this.readNameFromDocument(t):this.readNameFromNode(t)}},e.prototype.readNameFromDocument=function(t){for(var e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE){var r=this.readNameFromNode(e);if(r)return r}},e.prototype.readNameFromNode=function(t){for(var e=t.firstElementChild;e;e=e.nextElementSibling)if(g(cx,e.namespaceURI)&&"name"==e.localName)return U_(e);for(e=t.firstElementChild;e;e=e.nextElementSibling){var r=e.localName;if(g(cx,e.namespaceURI)&&("Document"==r||"Folder"==r||"Placemark"==r||"kml"==r)){var n=this.readNameFromNode(e);if(n)return n}}},e.prototype.readNetworkLinks=function(t){var e=[];if("string"==typeof t){var r=Pc(t);v(e,this.readNetworkLinksFromDocument(r))}else Cc(t)?v(e,this.readNetworkLinksFromDocument(t)):v(e,this.readNetworkLinksFromNode(t));return e},e.prototype.readNetworkLinksFromDocument=function(t){for(var e=[],r=t.firstChild;r;r=r.nextSibling)r.nodeType==Node.ELEMENT_NODE&&v(e,this.readNetworkLinksFromNode(r));return e},e.prototype.readNetworkLinksFromNode=function(t){for(var e=[],r=t.firstElementChild;r;r=r.nextElementSibling)if(g(cx,r.namespaceURI)&&"NetworkLink"==r.localName){var n=Uc({},fx,r,[]);e.push(n)}for(r=t.firstElementChild;r;r=r.nextElementSibling){var i=r.localName;!g(cx,r.namespaceURI)||"Document"!=i&&"Folder"!=i&&"kml"!=i||v(e,this.readNetworkLinksFromNode(r))}return e},e.prototype.readRegion=function(t){var e=[];if("string"==typeof t){var r=Pc(t);v(e,this.readRegionFromDocument(r))}else Cc(t)?v(e,this.readRegionFromDocument(t)):v(e,this.readRegionFromNode(t));return e},e.prototype.readRegionFromDocument=function(t){for(var e=[],r=t.firstChild;r;r=r.nextSibling)r.nodeType==Node.ELEMENT_NODE&&v(e,this.readRegionFromNode(r));return e},e.prototype.readRegionFromNode=function(t){for(var e=[],r=t.firstElementChild;r;r=r.nextElementSibling)if(g(cx,r.namespaceURI)&&"Region"==r.localName){var n=Uc({},gx,r,[]);e.push(n)}for(r=t.firstElementChild;r;r=r.nextElementSibling){var i=r.localName;!g(cx,r.namespaceURI)||"Document"!=i&&"Folder"!=i&&"kml"!=i||v(e,this.readRegionFromNode(r))}return e},e.prototype.writeFeaturesNode=function(t,e){e=this.adaptOptions(e);var r=Sc(cx[4],"kml"),n="http://www.w3.org/2000/xmlns/";r.setAttributeNS(n,"xmlns:gx",ux[0]),r.setAttributeNS(n,"xmlns:xsi",wc),r.setAttributeNS(wc,"xsi:schemaLocation","http://www.opengis.net/kml/2.2 https://developers.google.com/kml/schema/kml22gx.xsd");var i={node:r},o={};t.length>1?o.Document=t:1==t.length&&(o.Placemark=t[0]);var a=yx[r.namespaceURI],s=Dc(o,a);return Vc(i,mx,Nc,s,[e],a,this),r},e}(P_);function Rx(t){var e=Ec(t,!1),r=/^\s*#?\s*([0-9A-Fa-f]{8})\s*$/.exec(e);if(r){var n=r[1];return[parseInt(n.substr(6,2),16),parseInt(n.substr(4,2),16),parseInt(n.substr(2,2),16),parseInt(n.substr(0,2),16)/255]}}function Ix(t){var e=Ec(t,!1),r=[];e=e.replace(/\s*,\s*/g,",");for(var n,i=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?),([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s+|,|$)(?:([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s+|$))?\s*/i;n=i.exec(e);){var o=parseFloat(n[1]),a=parseFloat(n[2]),s=n[3]?parseFloat(n[3]):0;r.push(o,a,s),e=e.substr(n[0].length)}if(""===e)return r}function Lx(t){var e=Ec(t,!1).trim(),r=t.baseURI;return r&&"about:blank"!=r||(r=window.location.href),r?new URL(e,r).href:e}function Mx(t){var e=Ec(t,!1).trim().replace(/^(?!.*#)/,"#"),r=t.baseURI;return r&&"about:blank"!=r||(r=window.location.href),r?new URL(e,r).href:e}function Fx(t){return N_(t)}var Ax=Gc(cx,{Pair:function(t,e){var r=Uc({},uw,t,e,this);if(!r)return;var n=r.key;if(n&&"normal"==n){var i=r.styleUrl;i&&(e[e.length-1]=i);var o=r.Style;o&&(e[e.length-1]=o)}}});function kx(t,e){return Uc(void 0,Ax,t,e,this)}var jx=Gc(cx,{Icon:Fc((function(t,e){var r=Uc({},Wx,t,e);return r||null})),color:Fc(Rx),heading:Fc(N_),hotSpot:Fc((function(t){var e,r=t.getAttribute("xunits"),n=t.getAttribute("yunits");return e="insetPixels"!==r?"insetPixels"!==n?ip:ap:"insetPixels"!==n?op:sp,{x:parseFloat(t.getAttribute("x")),xunits:hx[r],y:parseFloat(t.getAttribute("y")),yunits:hx[n],origin:e}})),scale:Fc(Fx)});var Nx=Gc(cx,{color:Fc(Rx),scale:Fc(Fx)});var Dx=Gc(cx,{color:Fc(Rx),width:Fc(N_)});var Gx=Gc(cx,{color:Fc(Rx),fill:Fc(A_),outline:Fc(A_)});var zx=Gc(cx,{coordinates:Lc(Ix)});function Ux(t,e){return Uc(null,zx,t,e)}var Bx=Gc(ux,{Track:Ic(Yx)});var Vx=Gc(cx,{when:function(t,e){var r=e[e.length-1].whens,n=Ec(t,!1),i=Date.parse(n);r.push(isNaN(i)?0:i)}},Gc(ux,{coord:function(t,e){var r=e[e.length-1].flatCoordinates,n=Ec(t,!1),i=/^\s*([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s*$/i.exec(n);if(i){var o=parseFloat(i[1]),a=parseFloat(i[2]),s=parseFloat(i[3]);r.push(o,a,s,0)}else r.push(0,0,0,0)}}));function Yx(t,e){var r=Uc({flatCoordinates:[],whens:[]},Vx,t,e);if(r){for(var n=r.flatCoordinates,i=r.whens,o=0,a=Math.min(n.length,i.length);o0,c=l.href;c?n=c:u&&(n=Hb);var h,p=ip,f=r.hotSpot;f?(i=[f.x,f.y],o=f.xunits,a=f.yunits,p=f.origin):n===Hb?(i=qb,o=Xb,a=Zb):/^http:\/\/maps\.(?:google|gstatic)\.com\//.test(n)&&(i=[.5,0],o=rp,a=rp);var d,g=l.x,y=l.y;void 0!==g&&void 0!==y&&(h=[g,y]);var m,v=l.w,_=l.h;void 0!==v&&void 0!==_&&(d=[v,_]);var b=r.heading;void 0!==b&&(m=Ye(b));var x=r.scale,w=r.color;if(u){n==Hb&&(d=Kb,void 0===x&&(x=$b));var S=new dp({anchor:i,anchorOrigin:p,anchorXUnits:o,anchorYUnits:a,crossOrigin:this.crossOrigin_,offset:h,offsetOrigin:ip,rotation:m,scale:x,size:d,src:this.iconUrlFunction_(n),color:w});s.imageStyle=S}else s.imageStyle=_x}},LabelStyle:function(t,e){var r=Uc({},Nx,t,e);if(r){var n=e[e.length-1],i=new Tp({fill:new ep({color:"color"in r?r.color:Wb}),scale:r.scale});n.textStyle=i}},LineStyle:function(t,e){var r=Uc({},Dx,t,e);if(r){var n=e[e.length-1],i=new gp({color:"color"in r?r.color:Wb,width:"width"in r?r.width:1});n.strokeStyle=i}},PolyStyle:function(t,e){var r=Uc({},Gx,t,e);if(r){var n=e[e.length-1],i=new ep({color:"color"in r?r.color:Wb});n.fillStyle=i;var o=r.fill;void 0!==o&&(n.fill=o);var a=r.outline;void 0!==a&&(n.outline=a)}}});function nw(t,e){var r=Uc({},rw,t,e,this);if(!r)return null;var n,i="fillStyle"in r?r.fillStyle:vx,o=r.fill;void 0===o||o||(i=null),"imageStyle"in r?r.imageStyle!=_x&&(n=r.imageStyle):n=bx;var a="textStyle"in r?r.textStyle:Sx,s="strokeStyle"in r?r.strokeStyle:wx,l=r.outline;return void 0===l||l?[new wp({fill:i,image:n,stroke:s,text:a,zIndex:void 0})]:[new wp({geometry:function(t){var e=t.getGeometry(),r=e.getType();return r===bt.GEOMETRY_COLLECTION?new Vm(e.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return e!==bt.POLYGON&&e!==bt.MULTI_POLYGON}))):r!==bt.POLYGON&&r!==bt.MULTI_POLYGON?e:void 0},fill:i,image:n,stroke:s,text:a,zIndex:void 0}),new wp({geometry:function(t){var e=t.getGeometry(),r=e.getType();return r===bt.GEOMETRY_COLLECTION?new Vm(e.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return e===bt.POLYGON||e===bt.MULTI_POLYGON}))):r===bt.POLYGON||r===bt.MULTI_POLYGON?e:void 0},fill:i,stroke:null,zIndex:void 0})]}function iw(t,e){var r,n,i,o=e.length,a=new Array(e.length),s=new Array(e.length),l=new Array(e.length);r=!1,n=!1,i=!1;for(var u=0;u0){var m=Dc(i,a);Vc(n,Gw,Uw,[{names:a,values:m}],r)}var v=r[0],_=e.getGeometry();_&&(_=Wy(_,!0,v)),Vc(n,Gw,Iw,[_],r)}var Vw=Gc(cx,["extrude","tessellate","altitudeMode","coordinates"]),Yw=Gc(cx,{extrude:Ac(B_),tessellate:Ac(B_),altitudeMode:Ac(X_),coordinates:Ac((function(t,e,r){var n,i=r[r.length-1],o=i.layout,a=i.stride;o==yt||o==vt?n=2:o==mt||o==_t?n=3:pt(!1,34);var s=e.length,l="";if(s>0){l+=e[0];for(var u=1;u>1):i>>1}return e}function NS(t){for(var e="",r=0,n=t.length;r=32;)e=63+(32|31&t),r+=String.fromCharCode(e),t>>=5;return e=t+63,r+=String.fromCharCode(e)}var zS=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.dataProjection=Gr("EPSG:4326"),r.factor_=n.factor?n.factor:1e5,r.geometryLayout_=n.geometryLayout?n.geometryLayout:yt,r}return IS(e,t),e.prototype.readFeatureFromText=function(t,e){var r=this.readGeometryFromText(t,e);return new gt(r)},e.prototype.readFeaturesFromText=function(t,e){return[this.readFeatureFromText(t,e)]},e.prototype.readGeometryFromText=function(t,e){var r=yn(this.geometryLayout_),n=MS(t,r,this.factor_);v_(n,0,n.length,r,n);var i=Nn(n,0,n.length,r);return Wy(new Py(i,this.geometryLayout_),!1,this.adaptOptions(e))},e.prototype.writeFeatureText=function(t,e){var r=t.getGeometry();return r?this.writeGeometryText(r,e):(pt(!1,40),"")},e.prototype.writeFeaturesText=function(t,e){return this.writeFeatureText(t[0],e)},e.prototype.writeGeometryText=function(t,e){var r=(t=Wy(t,!0,this.adaptOptions(e))).getFlatCoordinates(),n=t.getStride();return v_(r,0,r.length,n,r),LS(r,n,this.factor_)},e}(Jb),US=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),BS=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.layerName_=n.layerName,r.layers_=n.layers?n.layers:null,r.dataProjection=Gr(n.dataProjection?n.dataProjection:"EPSG:4326"),r}return US(e,t),e.prototype.readFeaturesFromObject=function(t,e){if("Topology"==t.type){var r=t,n=void 0,i=null,o=null;r.transform&&(i=(n=r.transform).scale,o=n.translate);var a=r.arcs;n&&function(t,e,r){for(var n=0,i=t.length;n0&&i.pop(),n=r>=0?e[r]:e[~r].slice().reverse(),i.push.apply(i,n);for(var s=0,l=i.length;s=2,57),n}return $S(e,t),e}(HS),QS=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),tE=function(t){function e(e){return t.call(this,"And",Array.prototype.slice.call(arguments))||this}return QS(e,t),e}(JS),eE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),rE=function(t){function e(e,r,n){var i=t.call(this,"BBOX")||this;if(i.geometryName=e,i.extent=r,4!==r.length)throw new Error("Expected an extent with four values ([minX, minY, maxX, maxY])");return i.srsName=n,i}return eE(e,t),e}(HS),nE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),iE=function(t){function e(e,r,n,i){var o=t.call(this,e)||this;return o.geometryName=r||"the_geom",o.geometry=n,o.srsName=i,o}return nE(e,t),e}(HS),oE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),aE=function(t){function e(e,r,n){return t.call(this,"Contains",e,r,n)||this}return oE(e,t),e}(iE),sE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),lE=function(t){function e(e,r,n,i,o){var a=t.call(this,"DWithin",e,r,o)||this;return a.distance=n,a.unit=i,a}return sE(e,t),e}(iE),uE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),cE=function(t){function e(e,r,n){return t.call(this,"Disjoint",e,r,n)||this}return uE(e,t),e}(iE),hE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),pE=function(t){function e(e,r){var n=t.call(this,e)||this;return n.propertyName=r,n}return hE(e,t),e}(HS),fE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),dE=function(t){function e(e,r,n){var i=t.call(this,"During",e)||this;return i.begin=r,i.end=n,i}return fE(e,t),e}(pE),gE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),yE=function(t){function e(e,r,n,i){var o=t.call(this,e,r)||this;return o.expression=n,o.matchCase=i,o}return gE(e,t),e}(pE),mE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),vE=function(t){function e(e,r,n){return t.call(this,"PropertyIsEqualTo",e,r,n)||this}return mE(e,t),e}(yE),_E=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),bE=function(t){function e(e,r){return t.call(this,"PropertyIsGreaterThan",e,r)||this}return _E(e,t),e}(yE),xE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),wE=function(t){function e(e,r){return t.call(this,"PropertyIsGreaterThanOrEqualTo",e,r)||this}return xE(e,t),e}(yE),SE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),EE=function(t){function e(e,r,n){return t.call(this,"Intersects",e,r,n)||this}return SE(e,t),e}(iE),TE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),CE=function(t){function e(e,r,n){var i=t.call(this,"PropertyIsBetween",e)||this;return i.lowerBoundary=r,i.upperBoundary=n,i}return TE(e,t),e}(pE),OE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),PE=function(t){function e(e,r,n,i,o,a){var s=t.call(this,"PropertyIsLike",e)||this;return s.pattern=r,s.wildCard=void 0!==n?n:"*",s.singleChar=void 0!==i?i:".",s.escapeChar=void 0!==o?o:"!",s.matchCase=a,s}return OE(e,t),e}(pE),RE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),IE=function(t){function e(e){return t.call(this,"PropertyIsNull",e)||this}return RE(e,t),e}(pE),LE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ME=function(t){function e(e,r){return t.call(this,"PropertyIsLessThan",e,r)||this}return LE(e,t),e}(yE),FE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),AE=function(t){function e(e,r){return t.call(this,"PropertyIsLessThanOrEqualTo",e,r)||this}return FE(e,t),e}(yE),kE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),jE=function(t){function e(e){var r=t.call(this,"Not")||this;return r.condition=e,r}return kE(e,t),e}(HS),NE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),DE=function(t){function e(e,r,n){return t.call(this,"PropertyIsNotEqualTo",e,r,n)||this}return NE(e,t),e}(yE),GE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),zE=function(t){function e(e){return t.call(this,"Or",Array.prototype.slice.call(arguments))||this}return GE(e,t),e}(JS),UE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),BE=function(t){function e(e){var r=t.call(this,"ResourceId")||this;return r.rid=e,r}return UE(e,t),e}(HS),VE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),YE=function(t){function e(e,r,n){return t.call(this,"Within",e,r,n)||this}return VE(e,t),e}(iE);function WE(t){var e=[null].concat(Array.prototype.slice.call(arguments));return new(Function.prototype.bind.apply(tE,e))}function qE(t,e,r){return new rE(t,e,r)}var XE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ZE={"http://www.opengis.net/gml":{boundedBy:Fc(F_.prototype.readGeometryElement,"bounds")},"http://www.opengis.net/wfs/2.0":{member:Ic(F_.prototype.readFeaturesInternal)}},KE={"http://www.opengis.net/wfs":{totalInserted:Fc(G_),totalUpdated:Fc(G_),totalDeleted:Fc(G_)},"http://www.opengis.net/wfs/2.0":{totalInserted:Fc(G_),totalUpdated:Fc(G_),totalDeleted:Fc(G_)}},HE={"http://www.opengis.net/wfs":{TransactionSummary:Fc(sT,"transactionSummary"),InsertResults:Fc(hT,"insertIds")},"http://www.opengis.net/wfs/2.0":{TransactionSummary:Fc(sT,"transactionSummary"),InsertResults:Fc(hT,"insertIds")}},$E={"http://www.opengis.net/wfs":{PropertyName:Ac(X_)},"http://www.opengis.net/wfs/2.0":{PropertyName:Ac(X_)}},JE={"http://www.opengis.net/wfs":{Insert:Ac(pT),Update:Ac(yT),Delete:Ac(gT),Property:Ac(mT),Native:Ac(vT)},"http://www.opengis.net/wfs/2.0":{Insert:Ac(pT),Update:Ac(yT),Delete:Ac(gT),Property:Ac(mT),Native:Ac(vT)}},QE="http://www.w3.org/2000/xmlns/",tT={"2.0.0":"http://www.opengis.net/ogc/1.1","1.1.0":"http://www.opengis.net/ogc","1.0.0":"http://www.opengis.net/ogc"},eT={"2.0.0":"http://www.opengis.net/wfs/2.0","1.1.0":"http://www.opengis.net/wfs","1.0.0":"http://www.opengis.net/wfs"},rT={"2.0.0":"http://www.opengis.net/fes/2.0","1.1.0":"http://www.opengis.net/fes","1.0.0":"http://www.opengis.net/fes"},nT={"2.0.0":"http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd","1.1.0":"http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd","1.0.0":"http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/wfs.xsd"},iT={"2.0.0":ab,"1.1.0":eb,"1.0.0":$_},oT=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.version_=n.version?n.version:"1.1.0",r.featureType_=n.featureType,r.featureNS_=n.featureNS,r.gmlFormat_=n.gmlFormat?n.gmlFormat:new iT[r.version_],r.schemaLocation_=n.schemaLocation?n.schemaLocation:nT[r.version_],r}return XE(e,t),e.prototype.getFeatureType=function(){return this.featureType_},e.prototype.setFeatureType=function(t){this.featureType_=t},e.prototype.readFeaturesFromNode=function(t,e){var r={node:t};O(r,{featureType:this.featureType_,featureNS:this.featureNS_}),O(r,this.getReadOptions(t,e||{}));var n=[r],i=Uc([],"2.0.0"===this.version_?ZE:this.gmlFormat_.FEATURE_COLLECTION_PARSERS,t,n,this.gmlFormat_);return i||(i=[]),i},e.prototype.readTransactionResponse=function(t){if(t){if("string"==typeof t){var e=Pc(t);return this.readTransactionResponseFromDocument(e)}return Cc(t)?this.readTransactionResponseFromDocument(t):this.readTransactionResponseFromNode(t)}},e.prototype.readFeatureCollectionMetadata=function(t){if(t){if("string"==typeof t){var e=Pc(t);return this.readFeatureCollectionMetadataFromDocument(e)}return Cc(t)?this.readFeatureCollectionMetadataFromDocument(t):this.readFeatureCollectionMetadataFromNode(t)}},e.prototype.readFeatureCollectionMetadataFromDocument=function(t){for(var e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readFeatureCollectionMetadataFromNode(e)},e.prototype.readFeatureCollectionMetadataFromNode=function(t){var e={},r=z_(t.getAttribute("numberOfFeatures"));return e.numberOfFeatures=r,Uc(e,ZE,t,[],this.gmlFormat_)},e.prototype.readTransactionResponseFromDocument=function(t){for(var e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readTransactionResponseFromNode(e)},e.prototype.readTransactionResponseFromNode=function(t){return Uc({},HE,t,[])},e.prototype.writeGetFeature=function(t){var e=this,r=Sc(eT[this.version_],"GetFeature");r.setAttribute("service","WFS"),r.setAttribute("version",this.version_),t.handle&&r.setAttribute("handle",t.handle),t.outputFormat&&r.setAttribute("outputFormat",t.outputFormat),void 0!==t.maxFeatures&&r.setAttribute("maxFeatures",String(t.maxFeatures)),t.resultType&&r.setAttribute("resultType",t.resultType),void 0!==t.startIndex&&r.setAttribute("startIndex",String(t.startIndex)),void 0!==t.count&&r.setAttribute("count",String(t.count)),void 0!==t.viewParams&&r.setAttribute("viewParams",t.viewParams),r.setAttributeNS(wc,"xsi:schemaLocation",this.schemaLocation_);var n={node:r};if(O(n,{version:this.version_,srsName:t.srsName,featureNS:t.featureNS?t.featureNS:this.featureNS_,featurePrefix:t.featurePrefix,propertyNames:t.propertyNames?t.propertyNames:[]}),pt(Array.isArray(t.featureTypes),11),"string"==typeof t.featureTypes[0]){var i=t.filter;t.bbox&&(pt(t.geometryName,12),i=this.combineBboxAndFilter(t.geometryName,t.bbox,t.srsName,i)),O(n,{geometryName:t.geometryName,filter:i}),jT(r,t.featureTypes,[n])}else t.featureTypes.forEach((function(i){var o=e.combineBboxAndFilter(i.geometryName,i.bbox,t.srsName,t.filter);O(n,{geometryName:i.geometryName,filter:o}),jT(r,[i.name],[n])}));return r},e.prototype.combineBboxAndFilter=function(t,e,r,n){var i=qE(t,e,r);return n?WE(n,i):i},e.prototype.writeTransaction=function(t,e,r,n){var i,o=[],a=n.version?n.version:this.version_,s=Sc(eT[a],"Transaction");s.setAttribute("service","WFS"),s.setAttribute("version",a),n&&(i=n.gmlOptions?n.gmlOptions:{},n.handle&&s.setAttribute("handle",n.handle)),s.setAttributeNS(wc,"xsi:schemaLocation",nT[a]);var l=function(t,e,r,n){var i,o=n.featurePrefix?n.featurePrefix:"feature";"1.0.0"===r?i=2:"1.1.0"===r?i=3:"2.0.0"===r&&(i=3.2);return O({node:t},{version:r,featureNS:n.featureNS,featureType:n.featureType,featurePrefix:o,gmlVersion:i,hasZ:n.hasZ,srsName:n.srsName},e)}(s,i,a,n);return t&&aT("Insert",t,o,l),e&&aT("Update",e,o,l),r&&aT("Delete",r,o,l),n.nativeElements&&aT("Native",n.nativeElements,o,l),s},e.prototype.readProjectionFromDocument=function(t){for(var e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readProjectionFromNode(e);return null},e.prototype.readProjectionFromNode=function(t){if(t.firstElementChild&&t.firstElementChild.firstElementChild)for(var e=(t=t.firstElementChild.firstElementChild).firstElementChild;e;e=e.nextElementSibling)if(0!==e.childNodes.length&&(1!==e.childNodes.length||3!==e.firstChild.nodeType)){var r=[{}];return this.gmlFormat_.readGeometryElement(e,r),Gr(r.pop().srsName)}return null},e}(P_);function aT(t,e,r,n){Vc(n,JE,jc(t),e,r)}function sT(t,e){return Uc({},KE,t,e)}var lT={"http://www.opengis.net/ogc":{FeatureId:Ic((function(t,e){return t.getAttribute("fid")}))},"http://www.opengis.net/ogc/1.1":{FeatureId:Ic((function(t,e){return t.getAttribute("fid")}))}};function uT(t,e){zc(lT,t,e)}var cT={"http://www.opengis.net/wfs":{Feature:uT},"http://www.opengis.net/wfs/2.0":{Feature:uT}};function hT(t,e){return Uc([],cT,t,e)}function pT(t,e,r){var n=r[r.length-1],i=n.featureType,o=n.featureNS,a=n.gmlVersion,s=Sc(o,i);t.appendChild(s),2===a?$_.prototype.writeFeatureElement(s,e,r):3===a?eb.prototype.writeFeatureElement(s,e,r):ab.prototype.writeFeatureElement(s,e,r)}function fT(t,e,r){var n=r[r.length-1].version,i=tT[n],o=Sc(i,"Filter"),a=Sc(i,"FeatureId");o.appendChild(a),a.setAttribute("fid",e),t.appendChild(o)}function dT(t,e){var r=(t=t||"feature")+":";return 0===e.indexOf(r)?e:r+e}function gT(t,e,r){var n=r[r.length-1];pt(void 0!==e.getId(),26);var i=n.featureType,o=n.featurePrefix,a=n.featureNS,s=dT(o,i);t.setAttribute("typeName",s),t.setAttributeNS(QE,"xmlns:"+o,a);var l=e.getId();void 0!==l&&fT(t,l,r)}function yT(t,e,r){var n=r[r.length-1];pt(void 0!==e.getId(),27);var i=n.version,o=n.featureType,a=n.featurePrefix,s=n.featureNS,l=dT(a,o),u=e.getGeometryName();t.setAttribute("typeName",l),t.setAttributeNS(QE,"xmlns:"+a,s);var c=e.getId();if(void 0!==c){for(var h=e.getKeys(),p=[],f=0,d=h.length;f="a"&&t<="z"||t>="A"&&t<="Z"},t.prototype.isNumeric_=function(t,e){return t>="0"&&t<="9"||"."==t&&!(void 0!==e&&e)},t.prototype.isWhiteSpace_=function(t){return" "==t||"\t"==t||"\r"==t||"\n"==t},t.prototype.nextChar_=function(){return this.wkt.charAt(++this.index_)},t.prototype.nextToken=function(){var t,e=this.nextChar_(),r=this.index_,n=e;if("("==e)t=BT;else if(","==e)t=WT;else if(")"==e)t=VT;else if(this.isNumeric_(e)||"-"==e)t=YT,n=this.readNumber_();else if(this.isAlpha_(e))t=UT,n=this.readText_();else{if(this.isWhiteSpace_(e))return this.nextToken();if(""!==e)throw new Error("Unexpected character: "+e);t=qT}return{position:r,value:n,type:t}},t.prototype.readNumber_=function(){var t,e=this.index_,r=!1,n=!1;do{"."==t?r=!0:"e"!=t&&"E"!=t||(n=!0),t=this.nextChar_()}while(this.isNumeric_(t,r)||!n&&("e"==t||"E"==t)||n&&("-"==t||"+"==t));return parseFloat(this.wkt.substring(e,this.index_--))},t.prototype.readText_=function(){var t,e=this.index_;do{t=this.nextChar_()}while(this.isAlpha_(t));return this.wkt.substring(e,this.index_--).toUpperCase()},t}(),HT=function(){function t(t){this.lexer_=t,this.token_,this.layout_=yt}return t.prototype.consume_=function(){this.token_=this.lexer_.nextToken()},t.prototype.isTokenType=function(t){return this.token_.type==t},t.prototype.match=function(t){var e=this.isTokenType(t);return e&&this.consume_(),e},t.prototype.parse=function(){return this.consume_(),this.parseGeometry_()},t.prototype.parseGeometryLayout_=function(){var t=yt,e=this.token_;if(this.isTokenType(UT)){var r=e.value;"Z"===r?t=mt:"M"===r?t=vt:"ZM"===r&&(t=_t),t!==yt&&this.consume_()}return t},t.prototype.parseGeometryCollectionText_=function(){if(this.match(BT)){var t=[];do{t.push(this.parseGeometry_())}while(this.match(WT));if(this.match(VT))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parsePointText_=function(){if(this.match(BT)){var t=this.parsePoint_();if(this.match(VT))return t}else if(this.isEmptyGeometry_())return null;throw new Error(this.formatErrorMessage_())},t.prototype.parseLineStringText_=function(){if(this.match(BT)){var t=this.parsePointList_();if(this.match(VT))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parsePolygonText_=function(){if(this.match(BT)){var t=this.parseLineStringTextList_();if(this.match(VT))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parseMultiPointText_=function(){if(this.match(BT)){var t=void 0;if(t=this.token_.type==BT?this.parsePointTextList_():this.parsePointList_(),this.match(VT))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parseMultiLineStringText_=function(){if(this.match(BT)){var t=this.parseLineStringTextList_();if(this.match(VT))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parseMultiPolygonText_=function(){if(this.match(BT)){var t=this.parsePolygonTextList_();if(this.match(VT))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parsePoint_=function(){for(var t=[],e=this.layout_.length,r=0;r0&&(e+=" "+n)}return 0===r.length?e+" EMPTY":e+"("+r+")"}var nC=$T,iC=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),oC=[null,"http://www.opengis.net/wms"],aC=Gc(oC,{Service:Fc((function(t,e){return Uc({},uC,t,e)})),Capability:Fc((function(t,e){return Uc({},sC,t,e)}))}),sC=Gc(oC,{Request:Fc((function(t,e){return Uc({},mC,t,e)})),Exception:Fc((function(t,e){return Uc([],fC,t,e)})),Layer:Fc((function(t,e){var r=Uc({},dC,t,e);if(void 0===r.Layer)return Object.assign(r,EC(t,e));return r}))}),lC=function(t){function e(){var e=t.call(this)||this;return e.version=void 0,e}return iC(e,t),e.prototype.readFromNode=function(t){this.version=t.getAttribute("version").trim();var e=Uc({version:this.version},aC,t,[]);return e||null},e}(cS),uC=Gc(oC,{Name:Fc(U_),Title:Fc(U_),Abstract:Fc(U_),KeywordList:Fc(PC),OnlineResource:Fc(hS),ContactInformation:Fc((function(t,e){return Uc({},cC,t,e)})),Fees:Fc(U_),AccessConstraints:Fc(U_),LayerLimit:Fc(G_),MaxWidth:Fc(G_),MaxHeight:Fc(G_)}),cC=Gc(oC,{ContactPersonPrimary:Fc((function(t,e){return Uc({},hC,t,e)})),ContactPosition:Fc(U_),ContactAddress:Fc((function(t,e){return Uc({},pC,t,e)})),ContactVoiceTelephone:Fc(U_),ContactFacsimileTelephone:Fc(U_),ContactElectronicMailAddress:Fc(U_)}),hC=Gc(oC,{ContactPerson:Fc(U_),ContactOrganization:Fc(U_)}),pC=Gc(oC,{AddressType:Fc(U_),Address:Fc(U_),City:Fc(U_),StateOrProvince:Fc(U_),PostCode:Fc(U_),Country:Fc(U_)}),fC=Gc(oC,{Format:Ic(U_)}),dC=Gc(oC,{Name:Fc(U_),Title:Fc(U_),Abstract:Fc(U_),KeywordList:Fc(PC),CRS:Mc(U_),EX_GeographicBoundingBox:Fc((function(t,e){var r=Uc({},yC,t,e);if(!r)return;var n=r.westBoundLongitude,i=r.southBoundLatitude,o=r.eastBoundLongitude,a=r.northBoundLatitude;if(void 0===n||void 0===i||void 0===o||void 0===a)return;return[n,i,o,a]})),BoundingBox:Mc((function(t,e){var r=[D_(t.getAttribute("minx")),D_(t.getAttribute("miny")),D_(t.getAttribute("maxx")),D_(t.getAttribute("maxy"))],n=[D_(t.getAttribute("resx")),D_(t.getAttribute("resy"))];return{crs:t.getAttribute("CRS"),extent:r,res:n}})),Dimension:Mc((function(t,e){return{name:t.getAttribute("name"),units:t.getAttribute("units"),unitSymbol:t.getAttribute("unitSymbol"),default:t.getAttribute("default"),multipleValues:k_(t.getAttribute("multipleValues")),nearestValue:k_(t.getAttribute("nearestValue")),current:k_(t.getAttribute("current")),values:U_(t)}})),Attribution:Fc((function(t,e){return Uc({},gC,t,e)})),AuthorityURL:Mc((function(t,e){var r=TC(t,e);if(r)return r.name=t.getAttribute("name"),r;return})),Identifier:Mc(U_),MetadataURL:Mc((function(t,e){var r=TC(t,e);if(r)return r.type=t.getAttribute("type"),r;return})),DataURL:Mc(TC),FeatureListURL:Mc(TC),Style:Mc((function(t,e){return Uc({},xC,t,e)})),MinScaleDenominator:Fc(N_),MaxScaleDenominator:Fc(N_),Layer:Mc(EC)}),gC=Gc(oC,{Title:Fc(U_),OnlineResource:Fc(hS),LogoURL:Fc(OC)}),yC=Gc(oC,{westBoundLongitude:Fc(N_),eastBoundLongitude:Fc(N_),southBoundLatitude:Fc(N_),northBoundLatitude:Fc(N_)}),mC=Gc(oC,{GetCapabilities:Fc(CC),GetMap:Fc(CC),GetFeatureInfo:Fc(CC)}),vC=Gc(oC,{Format:Mc(U_),DCPType:Mc((function(t,e){return Uc({},_C,t,e)}))}),_C=Gc(oC,{HTTP:Fc((function(t,e){return Uc({},bC,t,e)}))}),bC=Gc(oC,{Get:Fc(TC),Post:Fc(TC)}),xC=Gc(oC,{Name:Fc(U_),Title:Fc(U_),Abstract:Fc(U_),LegendURL:Mc(OC),StyleSheetURL:Fc(TC),StyleURL:Fc(TC)}),wC=Gc(oC,{Format:Fc(U_),OnlineResource:Fc(hS)}),SC=Gc(oC,{Keyword:Ic(U_)});function EC(t,e){var r=e[e.length-1],n=Uc({},dC,t,e);if(n){var i=k_(t.getAttribute("queryable"));void 0===i&&(i=r.queryable),n.queryable=void 0!==i&&i;var o=z_(t.getAttribute("cascaded"));void 0===o&&(o=r.cascaded),n.cascaded=o;var a=k_(t.getAttribute("opaque"));void 0===a&&(a=r.opaque),n.opaque=void 0!==a&&a;var s=k_(t.getAttribute("noSubsets"));void 0===s&&(s=r.noSubsets),n.noSubsets=void 0!==s&&s;var l=D_(t.getAttribute("fixedWidth"));l||(l=r.fixedWidth),n.fixedWidth=l;var u=D_(t.getAttribute("fixedHeight"));u||(u=r.fixedHeight),n.fixedHeight=u;["Style","CRS","AuthorityURL"].forEach((function(t){if(t in r){var e=n[t]||[];n[t]=e.concat(r[t])}}));return["EX_GeographicBoundingBox","BoundingBox","Dimension","Attribution","MinScaleDenominator","MaxScaleDenominator"].forEach((function(t){if(!(t in n)){var e=r[t];n[t]=e}})),n}}function TC(t,e){return Uc({},wC,t,e)}function CC(t,e){return Uc({},vC,t,e)}function OC(t,e){var r=TC(t,e);if(r){var n=[z_(t.getAttribute("width")),z_(t.getAttribute("height"))];return r.size=n,r}}function PC(t,e){return Uc([],SC,t,e)}var RC=lC,IC=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),LC=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.featureNS_="http://mapserver.gis.umn.edu/mapserver",r.gmlFormat_=new $_,r.layers_=n.layers?n.layers:null,r}return IC(e,t),e.prototype.getLayers=function(){return this.layers_},e.prototype.setLayers=function(t){this.layers_=t},e.prototype.readFeatures_=function(t,e){t.setAttribute("namespaceURI",this.featureNS_);var r=t.localName,n=[];if(0===t.childNodes.length)return n;if("msGMLOutput"==r)for(var i=0,o=t.childNodes.length;i.75*c||u>.75*h?this.resetExtent_():te(o,n)||this.recenter_()}}},e.prototype.resetExtent_=function(){var t=this.getMap(),e=this.ovmap_,r=t.getSize(),n=t.getView().calculateExtentInternal(r),i=e.getView(),o=Math.log(7.5)/Math.LN2;Me(n,1/(.1*Math.pow(2,o/2))),i.fitInternal(gi(n))},e.prototype.recenter_=function(){var t=this.getMap(),e=this.ovmap_,r=t.getView();e.getView().setCenterInternal(r.getCenterInternal())},e.prototype.updateBox_=function(){var t=this.getMap(),e=this.ovmap_;if(t.isRendered()&&e.isRendered()){var r=t.getSize(),n=t.getView(),i=e.getView(),o=this.rotateWithView_?0:-n.getRotation(),a=this.boxOverlay_,s=this.boxOverlay_.getElement(),l=n.getCenterInternal(),u=n.getResolution(),c=i.getResolution(),h=r[0]*u/c,p=r[1]*u/c;if(a.setPosition(l),s){s.style.width=h+"px",s.style.height=p+"px";var f="rotate("+o+"rad)";s.style.transform=f}}},e.prototype.handleClick_=function(t){t.preventDefault(),this.handleToggle_()},e.prototype.handleToggle_=function(){this.element.classList.toggle("ol-collapsed"),this.collapsed_?po(this.collapseLabel_,this.label_):po(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_;var t=this.ovmap_;if(!this.collapsed_){if(t.isRendered())return this.viewExtent_=void 0,void t.render();t.updateSize(),this.resetExtent_(),K(t,qa,(function(t){this.updateBox_()}),this)}},e.prototype.getCollapsible=function(){return this.collapsible_},e.prototype.setCollapsible=function(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),!t&&this.collapsed_&&this.handleToggle_())},e.prototype.setCollapsed=function(t){this.collapsible_&&this.collapsed_!==t&&this.handleToggle_()},e.prototype.getCollapsed=function(){return this.collapsed_},e.prototype.getRotateWithView=function(){return this.rotateWithView_},e.prototype.setRotateWithView=function(t){this.rotateWithView_!==t&&(this.rotateWithView_=t,0!==this.getMap().getView().getRotation()&&(this.rotateWithView_?this.handleRotationChanged_():this.ovmap_.getView().setRotation(0),this.viewExtent_=void 0,this.validateExtent_(),this.updateBox_()))},e.prototype.getOverviewMap=function(){return this.ovmap_},e.prototype.render=function(t){this.validateExtent_(),this.updateBox_()},e}(As),lO=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),uO="degrees",cO="imperial",hO="nautical",pO="metric",fO="us",dO=[1,2,5],gO=function(t){function e(e){var r=this,n=e||{},i=void 0!==n.className?n.className:n.bar?"ol-scale-bar":"ol-scale-line";return(r=t.call(this,{element:document.createElement("div"),render:n.render,target:n.target})||this).innerElement_=document.createElement("div"),r.innerElement_.className=i+"-inner",r.element.className=i+" ol-unselectable",r.element.appendChild(r.innerElement_),r.viewState_=null,r.minWidth_=void 0!==n.minWidth?n.minWidth:64,r.renderedVisible_=!1,r.renderedWidth_=void 0,r.renderedHTML_="",r.addEventListener(it("units"),r.handleUnitsChanged_),r.setUnits(n.units||pO),r.scaleBar_=n.bar||!1,r.scaleBarSteps_=n.steps||4,r.scaleBarText_=n.text||!1,r.dpi_=n.dpi||void 0,r}return lO(e,t),e.prototype.getUnits=function(){return this.get("units")},e.prototype.handleUnitsChanged_=function(){this.updateElement_()},e.prototype.setUnits=function(t){this.set("units",t)},e.prototype.setDpi=function(t){this.dpi_=t},e.prototype.updateElement_=function(){var t=this.viewState_;if(t){var e=t.center,r=t.projection,n=this.getUnits(),i=n==uO?St.DEGREES:St.METERS,o=zr(r,t.resolution,e,i),a=this.minWidth_*(this.dpi_||25.4/.28)/(25.4/.28),s=a*o,l="";if(n==uO){var u=wt[St.DEGREES];(s*=u)=a)break;++d}f=this.scaleBar_?this.createScaleBar(h,c,l):c.toFixed(p<0?-p:0)+" "+l,this.renderedHTML_!=f&&(this.innerElement_.innerHTML=f,this.renderedHTML_=f),this.renderedWidth_!=h&&(this.innerElement_.style.width=h+"px",this.renderedWidth_=h),this.renderedVisible_||(this.element.style.display="",this.renderedVisible_=!0)}else this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1)},e.prototype.createScaleBar=function(t,e,r){for(var n="1 : "+Math.round(this.getScaleForResolution()).toLocaleString(),i=[],o=t/this.scaleBarSteps_,a="#ffffff",s=0;s
    '+this.createMarker("relative",s)+(s%2==0||2===this.scaleBarSteps_?this.createStepText(s,t,!1,e,r):"")+"
    "),s===this.scaleBarSteps_-1&&i.push(this.createStepText(s+1,t,!0,e,r)),a="#ffffff"===a?"#000000":"#ffffff";return'
    '+(this.scaleBarText_?'
    '+n+"
    ":"")+i.join("")+"
    "},e.prototype.createMarker=function(t,e){return'
    '},e.prototype.createStepText=function(t,e,r,n,i){var o=(0===t?0:Math.round(n/this.scaleBarSteps_*t*100)/100)+(0===t?"":" "+i);return'
    '+o+"
    "},e.prototype.getScaleForResolution=function(){var t=zr(this.viewState_.projection,this.viewState_.resolution,this.viewState_.center),e=this.dpi_||25.4/.28,r=this.viewState_.projection.getMetersPerUnit();return parseFloat(t.toString())*r*(1e3/25.4)*e},e.prototype.render=function(t){var e=t.frameState;this.viewState_=e?e.viewState:null,this.updateElement_()},e}(As),yO=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),mO=0,vO=1,_O=function(t){function e(e){var r=this,n=e||{};(r=t.call(this,{element:document.createElement("div"),render:n.render})||this).dragListenerKeys_=[],r.currentResolution_=void 0,r.direction_=mO,r.dragging_,r.heightLimit_=0,r.widthLimit_=0,r.startX_,r.startY_,r.thumbSize_=null,r.sliderInitialized_=!1,r.duration_=void 0!==n.duration?n.duration:200;var i=void 0!==n.className?n.className:"ol-zoomslider",o=document.createElement("button");o.setAttribute("type","button"),o.className=i+"-thumb ol-unselectable";var a=r.element;return a.className=i+" ol-unselectable ol-control",a.appendChild(o),a.addEventListener(Ua,r.handleDraggerStart_.bind(r),!1),a.addEventListener(za,r.handleDraggerDrag_.bind(r),!1),a.addEventListener(Ba,r.handleDraggerEnd_.bind(r),!1),a.addEventListener(N,r.handleContainerClick_.bind(r),!1),o.addEventListener(N,u,!1),r}return yO(e,t),e.prototype.setMap=function(e){t.prototype.setMap.call(this,e),e&&e.render()},e.prototype.initSlider_=function(){var t=this.element,e=t.offsetWidth,r=t.offsetHeight;if(0===e&&0===r)return this.sliderInitialized_=!1;var n=t.firstElementChild,i=getComputedStyle(n),o=n.offsetWidth+parseFloat(i.marginRight)+parseFloat(i.marginLeft),a=n.offsetHeight+parseFloat(i.marginTop)+parseFloat(i.marginBottom);return this.thumbSize_=[o,a],e>r?(this.direction_=vO,this.widthLimit_=e-o):(this.direction_=mO,this.heightLimit_=r-a),this.sliderInitialized_=!0},e.prototype.handleContainerClick_=function(t){var e=this.getMap().getView(),r=this.getRelativePosition_(t.offsetX-this.thumbSize_[0]/2,t.offsetY-this.thumbSize_[1]/2),n=this.getResolutionForPosition_(r),i=e.getConstrainedZoom(e.getZoomForResolution(n));e.animateInternal({zoom:i,duration:this.duration_,easing:io})},e.prototype.handleDraggerStart_=function(t){if(!this.dragging_&&t.target===this.element.firstElementChild){var e=this.element.firstElementChild;if(this.getMap().getView().beginInteraction(),this.startX_=t.clientX-parseFloat(e.style.left),this.startY_=t.clientY-parseFloat(e.style.top),this.dragging_=!0,0===this.dragListenerKeys_.length){var r=this.handleDraggerDrag_,n=this.handleDraggerEnd_,i=this.getMap().getOwnerDocument();this.dragListenerKeys_.push(Z(i,za,r,this),Z(i,Ba,n,this))}}},e.prototype.handleDraggerDrag_=function(t){if(this.dragging_){var e=t.clientX-this.startX_,r=t.clientY-this.startY_,n=this.getRelativePosition_(e,r);this.currentResolution_=this.getResolutionForPosition_(n),this.getMap().getView().setResolution(this.currentResolution_)}},e.prototype.handleDraggerEnd_=function(t){this.dragging_&&(this.getMap().getView().endInteraction(),this.dragging_=!1,this.startX_=void 0,this.startY_=void 0,this.dragListenerKeys_.forEach(H),this.dragListenerKeys_.length=0)},e.prototype.setThumbPosition_=function(t){var e=this.getPositionForResolution_(t),r=this.element.firstElementChild;this.direction_==vO?r.style.left=this.widthLimit_*e+"px":r.style.top=this.heightLimit_*e+"px"},e.prototype.getRelativePosition_=function(t,e){return Ne(this.direction_===vO?t/this.widthLimit_:e/this.heightLimit_,0,1)},e.prototype.getResolutionForPosition_=function(t){return this.getMap().getView().getResolutionForValueFunction()(1-t)},e.prototype.getPositionForResolution_=function(t){return Ne(1-this.getMap().getView().getValueForResolutionFunction()(t),0,1)},e.prototype.render=function(t){if(t.frameState&&(this.sliderInitialized_||this.initSlider_())){var e=t.frameState.viewState.resolution;this.currentResolution_=e,this.setThumbPosition_(e)}},e}(As),bO=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),xO=function(t){function e(e){var r=this,n=e||{};(r=t.call(this,{element:document.createElement("div"),target:n.target})||this).extent=n.extent?n.extent:null;var i=void 0!==n.className?n.className:"ol-zoom-extent",o=void 0!==n.label?n.label:"E",a=void 0!==n.tipLabel?n.tipLabel:"Fit to extent",s=document.createElement("button");s.setAttribute("type","button"),s.title=a,s.appendChild("string"==typeof o?document.createTextNode(o):o),s.addEventListener(N,r.handleClick_.bind(r),!1);var l=i+" ol-unselectable ol-control",u=r.element;return u.className=l,u.appendChild(s),r}return bO(e,t),e.prototype.handleClick_=function(t){t.preventDefault(),this.handleZoomToExtent()},e.prototype.handleZoomToExtent=function(){var t=this.getMap().getView(),e=this.extent?this.extent:t.getProjection().getExtent();t.fitInternal(gi(e))},e}(As),wO={};wO.AssertionError=l||{},wO.Collection=ht||{},wO.Collection.CollectionEvent=ct||{},wO.Disposable=p||{},wO.Feature=gt||{},wO.Feature.createStyleFunction=dt||{},wO.Geolocation=Ii||{},wO.Image=Ki||{},wO.Image.listenImage=Zi||{},wO.ImageBase=Mi||{},wO.ImageCanvas=$i||{},wO.ImageTile=vo||{},wO.Kinetic=_o||{},wO.Map=Wl||{},wO.MapBrowserEvent=Da||{},wO.MapBrowserEventHandler=Wa||{},wO.MapEvent=ja||{},wO.Object=ot||{},wO.Object.ObjectEvent=et||{},wO.Object.getChangeEventType=it||{},wO.Observable=Q||{},wO.Observable.unByKey=J||{},wO.Overlay=su||{},wO.PluggableMap=Ms||{},wO.Tile=lo||{},wO.TileCache=yu||{},wO.TileQueue=es||{},wO.TileQueue.getTilePriority=rs||{},wO.TileRange=_u||{},wO.TileRange.createOrUpdate=vu||{},wO.VectorRenderTile=wu||{},wO.VectorTile=Eu||{},wO.View=Cs||{},wO.View.createCenterConstraint=xs||{},wO.View.createResolutionConstraint=ws||{},wO.View.createRotationConstraint=Ss||{},wO.View.isNoopAnimation=Es||{},wO.array={},wO.array.binarySearch=f||{},wO.array.equals=b||{},wO.array.extend=v||{},wO.array.find=_||{},wO.array.findIndex=x||{},wO.array.includes=g||{},wO.array.isSorted=w||{},wO.array.linearFindNearest=y||{},wO.array.numberSafeCompareFunction=d||{},wO.array.remove=function(t,e){var r=t.indexOf(e),n=r>-1;return n&&t.splice(r,1),n}||{},wO.array.reverseSubArray=m||{},wO.array.stableSort=function(t,e){var r,n=t.length,i=Array(t.length);for(r=0;r3&&!!zn(t,e,r,n)}||{},wO.geom.flat.transform={},wO.geom.flat.transform.rotate=un||{},wO.geom.flat.transform.scale=cn||{},wO.geom.flat.transform.transform2D=ln||{},wO.geom.flat.transform.translate=hn||{},wO.has={},wO.has.DEVICE_PIXEL_RATIO=Vi||{},wO.has.FIREFOX=Gi||{},wO.has.IMAGE_DECODE=Wi||{},wO.has.MAC=Bi||{},wO.has.PASSIVE_EVENT_LISTENERS=qi||{},wO.has.SAFARI=zi||{},wO.has.WEBKIT=Ui||{},wO.has.WORKER_OFFSCREEN_CANVAS=Yi||{},wO.interaction={},wO.interaction.DoubleClickZoom=Zs||{},wO.interaction.DragAndDrop=Ev||{},wO.interaction.DragAndDrop.DragAndDropEvent=Sv||{},wO.interaction.DragBox=El||{},wO.interaction.DragBox.DragBoxEvent=Sl||{},wO.interaction.DragPan=fl||{},wO.interaction.DragRotate=gl||{},wO.interaction.DragRotateAndZoom=Cv||{},wO.interaction.DragZoom=Cl||{},wO.interaction.Draw=Gv||{},wO.interaction.Draw.DrawEvent=Dv||{},wO.interaction.Draw.createBox=function(){return function(t,e,r){var n=Kt([t[0],t[t.length-1]].map((function(t){return rn(t,r)}))),i=[[_e(n),be(n),Oe(n),Ce(n),_e(n)]],o=e;o?o.setCoordinates(i):o=new fi(i);var a=tn();return a&&o.transform(r,a),o}}||{},wO.interaction.Draw.createRegularPolygon=function(t,e){return function(r,n,i){var o=rn(r[0],i),a=rn(r[r.length-1],i),s=Math.sqrt(Rr(o,a)),l=n||yi(new Rv(o),t),u=e;if(!e&&0!==e){var c=a[0]-o[0],h=a[1]-o[1];u=Math.atan2(h,c)}mi(l,o,s,u);var p=tn();return p&&l.transform(i,p),l}}||{},wO.interaction.Extent=qv||{},wO.interaction.Extent.ExtentEvent=Bv||{},wO.interaction.Interaction=qs||{},wO.interaction.Interaction.pan=Ys||{},wO.interaction.Interaction.zoomByDelta=Ws||{},wO.interaction.KeyboardPan=Ml||{},wO.interaction.KeyboardZoom=Al||{},wO.interaction.Modify=r_||{},wO.interaction.Modify.ModifyEvent=Jv||{},wO.interaction.MouseWheelZoom=Dl||{},wO.interaction.PinchRotate=zl||{},wO.interaction.PinchZoom=Bl||{},wO.interaction.Pointer=$s||{},wO.interaction.Pointer.centroid=Hs||{},wO.interaction.Select=s_||{},wO.interaction.Select.SelectEvent=o_||{},wO.interaction.Snap=h_||{},wO.interaction.Translate=m_||{},wO.interaction.Translate.TranslateEvent=y_||{},wO.interaction.defaults=Vl||{},wO.layer={},wO.layer.Base=Wo||{},wO.layer.BaseImage=ad||{},wO.layer.BaseTile=vd||{},wO.layer.BaseVector=wg||{},wO.layer.Graticule=Ny||{},wO.layer.Group=Aa||{},wO.layer.Heatmap=Vy||{},wO.layer.Image=dd||{},wO.layer.Layer=na||{},wO.layer.Layer.inView=ra||{},wO.layer.MapboxVector=yv||{},wO.layer.MapboxVector.getMapboxPath=uv||{},wO.layer.MapboxVector.normalizeGlyphsUrl=hv||{},wO.layer.MapboxVector.normalizeSourceUrl=fv||{},wO.layer.MapboxVector.normalizeSpriteUrl=cv||{},wO.layer.MapboxVector.normalizeStyleUrl=pv||{},wO.layer.Tile=Sd||{},wO.layer.Vector=Iy||{},wO.layer.VectorImage=vv||{},wO.layer.VectorTile=lm||{},wO.layer.WebGLPoints=bv||{},wO.loadingstrategy={},wO.loadingstrategy.all=Fu||{},wO.loadingstrategy.bbox=function(t,e){return[t]}||{},wO.loadingstrategy.tile=function(t){return function(e,r){var n=t.getZForResolution(r),i=t.getTileRangeForExtentAndZ(e,n),o=[],a=[n,0,0];for(a[1]=i.minX;a[1]<=i.maxX;++a[1])for(a[2]=i.minY;a[2]<=i.maxY;++a[2])o.push(t.getTileCoordExtent(a));return o}}||{},wO.math={},wO.math.clamp=Ne||{},wO.math.cosh=De||{},wO.math.lerp=qe||{},wO.math.log2=Ge||{},wO.math.modulo=We||{},wO.math.solveLinearSystem=Be||{},wO.math.squaredDistance=Ue||{},wO.math.squaredSegmentDistance=ze||{},wO.math.toDegrees=Ve||{},wO.math.toRadians=Ye||{},wO.net={},wO.net.jsonp=Au||{},wO.obj={},wO.obj.assign=O||{},wO.obj.clear=P||{},wO.obj.getValues=R||{},wO.obj.isEmpty=I||{},wO.proj={},wO.proj.Projection=je||{},wO.proj.Units=St||{},wO.proj.Units.METERS_PER_UNIT=wt||{},wO.proj.addCommon=sn||{},wO.proj.addCoordinateTransforms=Wr||{},wO.proj.addEquivalentProjections=Ur||{},wO.proj.addEquivalentTransforms=Br||{},wO.proj.addProjection=Nr||{},wO.proj.addProjections=Dr||{},wO.proj.clearAllProjections=function(){lr(),pr()}||{},wO.proj.clearUserProjection=function(){Jr=null}||{},wO.proj.cloneTransform=kr||{},wO.proj.createProjection=Vr||{},wO.proj.createSafeCoordinateTransform=an||{},wO.proj.createTransformFromCoordinateTransform=Yr||{},wO.proj.epsg3857={},wO.proj.epsg3857.EXTENT=Ke||{},wO.proj.epsg3857.HALF_SIZE=Ze||{},wO.proj.epsg3857.MAX_SAFE_Y=$e||{},wO.proj.epsg3857.PROJECTIONS=Qe||{},wO.proj.epsg3857.RADIUS=6378137,wO.proj.epsg3857.WORLD_EXTENT=He||{},wO.proj.epsg3857.fromEPSG4326=tr||{},wO.proj.epsg3857.toEPSG4326=er||{},wO.proj.epsg4326={},wO.proj.epsg4326.EXTENT=nr||{},wO.proj.epsg4326.METERS_PER_UNIT=ir||{},wO.proj.epsg4326.PROJECTIONS=ar||{},wO.proj.epsg4326.RADIUS=6378137,wO.proj.equivalent=Xr||{},wO.proj.fromLonLat=qr||{},wO.proj.fromUserCoordinate=rn||{},wO.proj.fromUserExtent=on||{},wO.proj.get=Gr||{},wO.proj.getPointResolution=zr||{},wO.proj.getTransform=Kr||{},wO.proj.getTransformFromProjections=Zr||{},wO.proj.getUserProjection=tn||{},wO.proj.identityTransform=jr||{},wO.proj.proj4={},wO.proj.proj4.register=function(t){var e,r,n=Object.keys(t.defs),i=n.length;for(e=0;e180)&&(r[0]=We(n+180,360)-180),r}||{},wO.proj.toUserCoordinate=en||{},wO.proj.toUserExtent=nn||{},wO.proj.transform=Hr||{},wO.proj.transformExtent=$r||{},wO.proj.transformWithProjections=function(t,e,r){return Zr(e,r)(t)}||{},wO.proj.transforms={},wO.proj.transforms.add=fr||{},wO.proj.transforms.clear=pr||{},wO.proj.transforms.get=dr||{},wO.proj.transforms.remove=function(t,e){var r=t.getCode(),n=e.getCode(),i=hr[r][n];return delete hr[r][n],I(hr[r])&&delete hr[r],i}||{},wO.proj.useGeographic=function(){Qr("EPSG:4326")}||{},wO.render={},wO.render.Box=ml||{},wO.render.Event=la||{},wO.render.Feature=Cy||{},wO.render.VectorContext=ku||{},wO.render.canvas={},wO.render.canvas.Builder=Mg||{},wO.render.canvas.BuilderGroup=Yg||{},wO.render.canvas.Executor=ey||{},wO.render.canvas.ExecutorGroup=ay||{},wO.render.canvas.ExecutorGroup.getPixelIndexArray=oy||{},wO.render.canvas.ImageBuilder=Ag||{},wO.render.canvas.Immediate=Nu||{},wO.render.canvas.Instruction=Ig||{},wO.render.canvas.Instruction.beginPathInstruction=Pg||{},wO.render.canvas.Instruction.closePathInstruction=Rg||{},wO.render.canvas.Instruction.fillInstruction=Cg||{},wO.render.canvas.Instruction.strokeInstruction=Og||{},wO.render.canvas.LineStringBuilder=jg||{},wO.render.canvas.PolygonBuilder=Dg||{},wO.render.canvas.TextBuilder=Bg||{},wO.render.canvas.checkedFonts=da||{},wO.render.canvas.createTransformString=Ra||{},wO.render.canvas.defaultFillStyle="#000",wO.render.canvas.defaultFont="10px sans-serif",wO.render.canvas.defaultLineCap="round",wO.render.canvas.defaultLineDash=pa||{},wO.render.canvas.defaultLineDashOffset={},wO.render.canvas.defaultLineJoin="round",wO.render.canvas.defaultLineWidth=1,wO.render.canvas.defaultMiterLimit=10,wO.render.canvas.defaultPadding=fa||{},wO.render.canvas.defaultStrokeStyle="#000",wO.render.canvas.defaultTextAlign="center",wO.render.canvas.defaultTextBaseline="middle",wO.render.canvas.drawImageOrLabel=Oa||{},wO.render.canvas.hitdetect={},wO.render.canvas.hitdetect.createHitDetectionImageData=sy||{},wO.render.canvas.hitdetect.hitDetect=ly||{},wO.render.canvas.labelCache=ga||{},wO.render.canvas.measureAndCacheTextWidth=Ea||{},wO.render.canvas.measureTextHeight=xa||{},wO.render.canvas.measureTextWidth=Sa||{},wO.render.canvas.measureTextWidths=Ta||{},wO.render.canvas.registerFont=ba||{},wO.render.canvas.rotateAtOffset=Ca||{},wO.render.canvas.textHeights=_a||{},wO.render.getRenderPixel=function(t,e){var r=e.slice(0);return It(t.inversePixelTransform.slice(),r),r}||{},wO.render.getVectorContext=Ku||{},wO.render.toContext=function(t,e){var r=t.canvas,n=e||{},i=n.pixelRatio||Vi,o=n.size;o&&(r.width=o[0]*i,r.height=o[1]*i,r.style.width=o[0]+"px",r.style.height=o[1]+"px");var a=[0,0,r.width,r.height],s=Mt([1,0,0,1,0,0],i,i);return new Nu(t,i,a,s,0)}||{},wO.renderer={},wO.renderer.Composite=La||{},wO.renderer.Layer=ld||{},wO.renderer.Map=aa||{},wO.renderer.canvas={},wO.renderer.canvas.ImageLayer=pd||{},wO.renderer.canvas.Layer=cd||{},wO.renderer.canvas.TileLayer=xd||{},wO.renderer.canvas.VectorImageLayer=py||{},wO.renderer.canvas.VectorLayer=cy||{},wO.renderer.canvas.VectorTileLayer=_y||{},wO.renderer.vector={},wO.renderer.vector.defaultOrder=Wu||{},wO.renderer.vector.getSquaredTolerance=qu||{},wO.renderer.vector.getTolerance=Xu||{},wO.renderer.vector.renderFeature=Zu||{},wO.renderer.webgl={},wO.renderer.webgl.Layer=_g||{},wO.renderer.webgl.Layer.colorDecodeId=vg||{},wO.renderer.webgl.Layer.colorEncodeId=mg||{},wO.renderer.webgl.Layer.getBlankImageData=function(){var t=document.createElement("canvas").getContext("2d").createImageData(1,1);return t.data[0]=255,t.data[1]=255,t.data[2]=255,t.data[3]=255,t}||{},wO.renderer.webgl.Layer.writePointFeatureToBuffers=function(t,e,r,n,i,o){var a=3+i,s=t[e+0],l=t[e+1],u=dg;u.length=i;for(var c=0;c1?x(r.TileMatrixSetLink,"projection"in e?function(t,r,n){var o=_(i,(function(e){return e.Identifier==t.TileMatrixSet})).SupportedCRS,a=Gr(o),s=Gr(e.projection);return a&&s?Xr(a,s):o==e.projection}:function(t,r,n){return t.TileMatrixSet==e.matrixSet}):0)<0&&(n=0);var o=r.TileMatrixSetLink[n].TileMatrixSet,a=r.TileMatrixSetLink[n].TileMatrixSetLimits,s=r.Format[0];"format"in e&&(s=e.format),(n=x(r.Style,(function(t,r,n){return"style"in e?t.Title==e.style:t.isDefault})))<0&&(n=0);var l=r.Style[n].Identifier,u={};"Dimension"in r&&r.Dimension.forEach((function(t,e,r){var n=t.Identifier,i=t.Default;void 0===i&&(i=t.Value[0]),u[n]=i}));var c,h=_(t.Contents.TileMatrixSet,(function(t,e,r){return t.Identifier==o})),p=h.SupportedCRS;if(p&&(c=Gr(p)),"projection"in e){var f=Gr(e.projection);f&&(c&&!Xr(f,c)||(c=f))}var d="ne"==c.getAxisOrientation().substr(0,2),y=h.TileMatrix[0],m={MinTileCol:0,MinTileRow:0,MaxTileCol:y.MatrixWidth-1,MaxTileRow:y.MatrixHeight-1};if(a){m=a[a.length-1];var v=_(h.TileMatrix,(function(t){return t.Identifier===m.TileMatrix||h.Identifier+":"+t.Identifier===m.TileMatrix}));v&&(y=v)}var b=28e-5*y.ScaleDenominator/c.getMetersPerUnit(),w=d?[y.TopLeftCorner[1],y.TopLeftCorner[0]]:y.TopLeftCorner,S=y.TileWidth*b,E=y.TileHeight*b,T=[w[0]+S*m.MinTileCol,w[1]-E*(1+m.MaxTileRow),w[0]+S*(1+m.MaxTileCol),w[1]-E*m.MinTileRow];null===c.getExtent()&&c.setExtent(T);var C=Kh(h,T,a),O=[],P=e.requestEncoding;if(P=void 0!==P?P:"","OperationsMetadata"in t&&"GetTile"in t.OperationsMetadata)for(var R=t.OperationsMetadata.GetTile.DCP.HTTP.Get,I=0,L=R.length;I=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|t}function d(t,e){if(l.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return z(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return U(t).length;default:if(n)return z(t).length;e=(""+e).toLowerCase(),n=!0}}function g(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return R(this,e,r);case"utf8":case"utf-8":return C(this,e,r);case"ascii":return O(this,e,r);case"latin1":case"binary":return P(this,e,r);case"base64":return T(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function y(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function m(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=l.from(e,n)),l.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,i);if("number"==typeof e)return e&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,i){var o,a=1,s=t.length,l=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,s/=2,l/=2,r/=2}function u(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var c=-1;for(o=r;os&&(r=s-l),o=r;o>=0;o--){for(var h=!0,p=0;pi&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function T(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function C(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:u>223?3:u>191?2:1;if(i+h<=r)switch(h){case 1:u<128&&(c=u);break;case 2:128==(192&(o=t[i+1]))&&(l=(31&u)<<6|63&o)>127&&(c=l);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(l=(15&u)<<12|(63&o)<<6|63&a)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(l=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&l<1114112&&(c=l)}null===c?(c=65533,h=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=h}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),""},l.prototype.compare=function(t,e,r,n,i){if(!l.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0),s=Math.min(o,a),u=this.slice(n,i),c=t.slice(e,r),h=0;hi)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return _(this,t,e,r);case"utf8":case"utf-8":return b(this,t,e,r);case"ascii":return x(this,t,e,r);case"latin1":case"binary":return w(this,t,e,r);case"base64":return S(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function O(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;in)&&(r=n);for(var i="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function M(t,e,r,n,i,o){if(!l.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function F(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i>>8*(n?i:1-i)}function A(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i>>8*(n?i:3-i)&255}function k(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function j(t,e,r,n,o){return o||k(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function N(t,e,r,n,o){return o||k(t,0,r,8),i.write(t,e,r,n,52,8),r+8}l.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e0&&(i*=256);)n+=this[t+--e]*i;return n},l.prototype.readUInt8=function(t,e){return e||L(t,1,this.length),this[t]},l.prototype.readUInt16LE=function(t,e){return e||L(t,2,this.length),this[t]|this[t+1]<<8},l.prototype.readUInt16BE=function(t,e){return e||L(t,2,this.length),this[t]<<8|this[t+1]},l.prototype.readUInt32LE=function(t,e){return e||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},l.prototype.readUInt32BE=function(t,e){return e||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},l.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||L(t,e,this.length);for(var n=this[t],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*e)),n},l.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||L(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},l.prototype.readInt8=function(t,e){return e||L(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},l.prototype.readInt16LE=function(t,e){e||L(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt16BE=function(t,e){e||L(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt32LE=function(t,e){return e||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},l.prototype.readInt32BE=function(t,e){return e||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},l.prototype.readFloatLE=function(t,e){return e||L(t,4,this.length),i.read(this,t,!0,23,4)},l.prototype.readFloatBE=function(t,e){return e||L(t,4,this.length),i.read(this,t,!1,23,4)},l.prototype.readDoubleLE=function(t,e){return e||L(t,8,this.length),i.read(this,t,!0,52,8)},l.prototype.readDoubleBE=function(t,e){return e||L(t,8,this.length),i.read(this,t,!1,52,8)},l.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||M(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+i]=t/o&255;return e+r},l.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,1,255,0),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},l.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):F(this,t,e,!0),e+2},l.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):F(this,t,e,!1),e+2},l.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):A(this,t,e,!0),e+4},l.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):A(this,t,e,!1),e+4},l.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);M(this,t,e,r,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o>0)-s&255;return e+r},l.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);M(this,t,e,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},l.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,1,127,-128),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},l.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):F(this,t,e,!0),e+2},l.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):F(this,t,e,!1),e+2},l.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):A(this,t,e,!0),e+4},l.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):A(this,t,e,!1),e+4},l.prototype.writeFloatLE=function(t,e,r){return j(this,t,e,!0,r)},l.prototype.writeFloatBE=function(t,e,r){return j(this,t,e,!1,r)},l.prototype.writeDoubleLE=function(t,e,r){return N(this,t,e,!0,r)},l.prototype.writeDoubleBE=function(t,e,r){return N(this,t,e,!1,r)},l.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--i)t[i+e]=this[i+r];else if(o<1e3||!l.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function U(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(D,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function B(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}}).call(this,r(4))},function(t,e,r){"use strict";e.byteLength=function(t){var e=u(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,n=u(t),a=n[0],s=n[1],l=new o(function(t,e,r){return 3*(e+r)/4-r}(0,a,s)),c=0,h=s>0?a-4:a;for(r=0;r>16&255,l[c++]=e>>8&255,l[c++]=255&e;2===s&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,l[c++]=255&e);1===s&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,l[c++]=e>>8&255,l[c++]=255&e);return l},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],a=0,s=r-i;as?s:a+16383));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,l=a.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function c(t,e,r){for(var i,o,a=[],s=e;s>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){"use strict";function n(){return function(){throw new Error("Unimplemented abstract method.")}()}r.r(e);var i=0;function o(t){return t.ol_uid||(t.ol_uid=String(++i))}var a,s=(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),l=function(t){function e(e){var r=this,n="Assertion failed. See https://openlayers.org/en/"+("v"+"6.5.0".split("-")[0])+"/doc/errors/#"+e+" for details.";return(r=t.call(this,n)||this).code=e,r.name="AssertionError",r.message=n,r}return s(e,t),e}(Error);function u(t){t.stopPropagation()}var c=function(){function t(t){this.propagationStopped,this.type=t,this.target=null}return t.prototype.preventDefault=function(){this.propagationStopped=!0},t.prototype.stopPropagation=function(){this.propagationStopped=!0},t}(),h="propertychange",p=function(){function t(){this.disposed=!1}return t.prototype.dispose=function(){this.disposed||(this.disposed=!0,this.disposeInternal())},t.prototype.disposeInternal=function(){},t}();function f(t,e,r){for(var n,i,o=r||d,a=0,s=t.length,l=!1;a>1)],e))<0?a=n+1:(s=n,l=!i);return l?a:~a}function d(t,e){return t>e?1:t=0}function y(t,e,r){var n=t.length;if(t[0]<=e)return 0;if(e<=t[n-1])return n-1;var i=void 0;if(r>0){for(i=1;i>>0,i=0;i0||r&&0===o)}))}function S(){return!0}function E(){return!1}function T(){}function C(t){var e,r,n,i=!1;return function(){var o=Array.prototype.slice.call(arguments);return i&&this===n&&b(o,r)||(i=!0,n=this,r=o,e=t.apply(this,arguments)),e}}var O="function"==typeof Object.assign?Object.assign:function(t,e){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var r=Object(t),n=1,i=arguments.length;n0)},e.prototype.removeEventListener=function(t,e){var r=this.listeners_&&this.listeners_[t];if(r){var n=r.indexOf(e);-1!==n&&(this.pendingRemovals_&&t in this.pendingRemovals_?(r[n]=T,++this.pendingRemovals_[t]):(r.splice(n,1),0===r.length&&delete this.listeners_[t]))}},e}(p),F="change",A="error",k="clear",j="contextmenu",N="click",D="dblclick",G="dragenter",z="dragover",U="drop",B="keydown",V="keypress",Y="load",W="resize",q="touchmove",X="wheel";function Z(t,e,r,n,i){if(n&&n!==t&&(r=r.bind(n)),i){var o=r;r=function(){t.removeEventListener(e,r),o.apply(this,arguments)}}var a={target:t,type:e,listener:r};return t.addEventListener(e,r),a}function K(t,e,r,n){return Z(t,e,r,n,!0)}function H(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),P(t))}var $=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function J(t){if(Array.isArray(t))for(var e=0,r=t.length;e0;)this.pop()},e.prototype.extend=function(t){for(var e=0,r=t.length;ei&&(l|=qt),so&&(l|=Wt),l===Vt&&(l=Yt),l}function ne(){return[1/0,1/0,-1/0,-1/0]}function ie(t,e,r,n,i){return i?(i[0]=t,i[1]=e,i[2]=r,i[3]=n,i):[t,e,r,n]}function oe(t){return ie(1/0,1/0,-1/0,-1/0,t)}function ae(t,e){var r=t[0],n=t[1];return ie(r,n,r,n,e)}function se(t,e){return fe(oe(e),t)}function le(t,e,r,n,i){return de(oe(i),t,e,r,n)}function ue(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function ce(t,e,r){return Math.abs(t[0]-e[0])t[2]&&(t[2]=e[2]),e[1]t[3]&&(t[3]=e[3]),t}function pe(t,e){e[0]t[2]&&(t[2]=e[0]),e[1]t[3]&&(t[3]=e[1])}function fe(t,e){for(var r=0,n=e.length;re[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function Ie(t){return t[2]=a&&g<=l),n||!(o&qt)||i&qt||(n=(y=f-(p-l)*d)>=s&&y<=u),n||!(o&Xt)||i&Xt||(n=(g=p-(f-s)/d)>=a&&g<=l),n||!(o&Zt)||i&Zt||(n=(y=f-(p-a)*d)>=s&&y<=u)}return n}function Ae(t,e,r,n){var i=[];if(n>1)for(var o=t[2]-t[0],a=t[3]-t[1],s=0;s=r[2])){var i=Pe(r),o=Math.floor((n[0]-r[0])/i)*i;t[0]-=o,t[2]-=o}return t}var je=function(){function t(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}return t.prototype.canWrapX=function(){return this.canWrapX_},t.prototype.getCode=function(){return this.code_},t.prototype.getExtent=function(){return this.extent_},t.prototype.getUnits=function(){return this.units_},t.prototype.getMetersPerUnit=function(){return this.metersPerUnit_||wt[this.units_]},t.prototype.getWorldExtent=function(){return this.worldExtent_},t.prototype.getAxisOrientation=function(){return this.axisOrientation_},t.prototype.isGlobal=function(){return this.global_},t.prototype.setGlobal=function(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)},t.prototype.getDefaultTileGrid=function(){return this.defaultTileGrid_},t.prototype.setDefaultTileGrid=function(t){this.defaultTileGrid_=t},t.prototype.setExtent=function(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)},t.prototype.setWorldExtent=function(t){this.worldExtent_=t},t.prototype.setGetPointResolution=function(t){this.getPointResolutionFunc_=t},t.prototype.getPointResolutionFunc=function(){return this.getPointResolutionFunc_},t}();function Ne(t,e,r){return Math.min(Math.max(t,e),r)}var De="cosh"in Math?Math.cosh:function(t){var e=Math.exp(t);return(e+1/e)/2},Ge="log2"in Math?Math.log2:function(t){return Math.log(t)*Math.LOG2E};function ze(t,e,r,n,i,o){var a=i-r,s=o-n;if(0!==a||0!==s){var l=((t-r)*a+(e-n)*s)/(a*a+s*s);l>1?(r=i,n=o):l>0&&(r+=a*l,n+=s*l)}return Ue(t,e,r,n)}function Ue(t,e,r,n){var i=r-t,o=n-e;return i*i+o*o}function Be(t){for(var e=t.length,r=0;ri&&(i=a,n=o)}if(0===i)return null;var s=t[n];t[n]=t[r],t[r]=s;for(var l=r+1;l=0;p--){h[p]=t[p][e]/t[p][p];for(var f=p-1;f>=0;f--)t[f][e]-=t[f][p]*h[p]}return h}function Ve(t){return 180*t/Math.PI}function Ye(t){return t*Math.PI/180}function We(t,e){var r=t%e;return r*e<0?r+e:r}function qe(t,e,r){return t+r*(e-t)}var Xe=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ze=6378137*Math.PI,Ke=[-Ze,-Ze,Ze,Ze],He=[-180,-85,180,85],$e=6378137*Math.log(Math.tan(Math.PI/2)),Je=function(t){function e(e){return t.call(this,{code:e,units:St.METERS,extent:Ke,global:!0,worldExtent:He,getPointResolution:function(t,e){return t/De(e[1]/6378137)}})||this}return Xe(e,t),e}(je),Qe=[new Je("EPSG:3857"),new Je("EPSG:102100"),new Je("EPSG:102113"),new Je("EPSG:900913"),new Je("http://www.opengis.net/gml/srs/epsg.xml#3857")];function tr(t,e,r){var n=t.length,i=r>1?r:2,o=e;void 0===o&&(o=i>2?t.slice():new Array(n));for(var a=0;a$e?s=$e:s<-$e&&(s=-$e),o[a+1]=s}return o}function er(t,e,r){var n=t.length,i=r>1?r:2,o=e;void 0===o&&(o=i>2?t.slice():new Array(n));for(var a=0;ae?n:new Array(1+e-i).join("0")+n}function br(t,e){for(var r=(""+t).split("."),n=(""+e).split("."),i=0;ia)return 1;if(a>o)return-1}return 0}function xr(t,e){return t[0]+=+e[0],t[1]+=+e[1],t}function wr(t,e){var r=e.getRadius(),n=e.getCenter(),i=n[0],o=n[1],a=t[0]-i,s=t[1]-o;0===a&&0===s&&(a=1);var l=Math.sqrt(a*a+s*s);return[i+r*a/l,o+r*s/l]}function Sr(t,e){var r,n,i=t[0],o=t[1],a=e[0],s=e[1],l=a[0],u=a[1],c=s[0],h=s[1],p=c-l,f=h-u,d=0===p&&0===f?0:(p*(i-l)+f*(o-u))/(p*p+f*f||0);return d<=0?(r=l,n=u):d>=1?(r=c,n=h):(r=l+d*p,n=u+d*f),[r,n]}function Er(t,e,r){var n=We(e+180,360)-180,i=Math.abs(3600*n),o=r||0,a=Math.pow(10,o),s=Math.floor(i/3600),l=Math.floor((i-3600*s)/60),u=i-3600*s-60*l;return(u=Math.ceil(u*a)/a)>=60&&(u=0,l+=1),l>=60&&(l=0,s+=1),s+"° "+_r(l,2)+"′ "+_r(u,2,o)+"″"+(0==n?"":" "+t.charAt(n<0?1:0))}function Tr(t,e,r){return t?e.replace("{x}",t[0].toFixed(r)).replace("{y}",t[1].toFixed(r)):""}function Cr(t,e){for(var r=!0,n=t.length-1;n>=0;--n)if(t[n]!=e[n]){r=!1;break}return r}function Or(t,e){var r=Math.cos(e),n=Math.sin(e),i=t[0]*r-t[1]*n,o=t[1]*r+t[0]*n;return t[0]=i,t[1]=o,t}function Pr(t,e){return t[0]*=e,t[1]*=e,t}function Rr(t,e){var r=t[0]-e[0],n=t[1]-e[1];return r*r+n*n}function Ir(t,e){return Math.sqrt(Rr(t,e))}function Lr(t,e){return Rr(t,Sr(t,e))}function Mr(t,e){return Tr(t,"{x}, {y}",e)}function Fr(t,e){if(e.canWrapX()){var r=Pe(e.getExtent()),n=Ar(t,e,r);n&&(t[0]-=n*r)}return t}function Ar(t,e,r){var n=e.getExtent(),i=0;if(e.canWrapX()&&(t[0]n[2])){var o=r||Pe(n);i=Math.floor((t[0]-n[0])/o)}return i}function kr(t,e,r){var n;if(void 0!==e){for(var i=0,o=t.length;i=2;--u)a[s+u]=e[s+u]}return a}}function Wr(t,e,r,n){var i=Gr(t),o=Gr(e);fr(i,o,Yr(r)),fr(o,i,Yr(n))}function qr(t,e){return Hr(t,"EPSG:4326",void 0!==e?e:"EPSG:3857")}function Xr(t,e){if(t===e)return!0;var r=t.getUnits()===e.getUnits();return(t.getCode()===e.getCode()||Zr(t,e)===kr)&&r}function Zr(t,e){var r=dr(t.getCode(),e.getCode());return r||(r=jr),r}function Kr(t,e){return Zr(Gr(t),Gr(e))}function Hr(t,e,r){return Kr(e,r)(t,void 0,t.length)}function $r(t,e,r,n){return Ae(t,Kr(e,r),void 0,n)}var Jr=null;function Qr(t){Jr=Gr(t)}function tn(){return Jr}function en(t,e){return Jr?Hr(t,e,Jr):t}function rn(t,e){return Jr?Hr(t,Jr,e):t}function nn(t,e){return Jr?$r(t,e,Jr):t}function on(t,e){return Jr?$r(t,Jr,e):t}function an(t,e,r){return function(n){var i,o,a=n[0],s=n[1];if(t.canWrapX()){var l=t.getExtent(),u=Pe(l);(o=Ar(n,t,u))&&(a-=o*u),a=Ne(a,l[0],l[2]),s=Ne(s,l[1],l[3]),i=r([a,s])}else i=r(n);return o&&e.canWrapX()&&(i[0]+=o*Pe(e.getExtent())),i}}function sn(){Ur(Qe),Ur(ar),Br(ar,Qe,tr,er)}function ln(t,e,r,n,i,o){for(var a=o||[],s=0,l=e;l1)s=r;else{if(p>0){for(var f=0;fi&&(i=u),o=s,a=l}return i}function xn(t,e,r,n,i){for(var o=0,a=r.length;o0;){for(var h=u.pop(),p=u.pop(),f=0,d=t[p],g=t[p+1],y=t[h],m=t[h+1],v=p+n;vf&&(c=v,f=_)}f>i&&(l[(c-e)/n]=1,p+ni&&(o[a++]=u,o[a++]=c,s=u,l=c);return u==s&&c==l||(o[a++]=u,o[a++]=c),a}function Fn(t,e){return e*Math.round(t/e)}function An(t,e,r,n,i,o,a){if(e==r)return a;var s,l,u=Fn(t[e],i),c=Fn(t[e+1],i);e+=n,o[a++]=u,o[a++]=c;do{if(s=Fn(t[e],i),l=Fn(t[e+1],i),(e+=n)==r)return o[a++]=s,o[a++]=l,a}while(s==u&&l==c);for(;e0&&g>f)&&(d<0&&y0&&y>d)?(s=h,l=p):(o[a++]=s,o[a++]=l,u=s,c=l,s=h,l=p)}}return o[a++]=s,o[a++]=l,a}function kn(t,e,r,n,i,o,a,s){for(var l=0,u=r.length;lo&&(u-s)*(o-l)-(i-s)*(c-l)>0&&a++:c<=o&&(u-s)*(o-l)-(i-s)*(c-l)<0&&a--,s=u,l=c}return 0!==a}function Kn(t,e,r,n,i,o){if(0===r.length)return!1;if(!Zn(t,e,r[0],n,i,o))return!1;for(var a=1,s=r.length;ax&&Kn(t,e,r,n,u=(c+h)/2,g)&&(b=u,x=w),c=h}return isNaN(b)&&(b=i[o]),a?(a.push(b,g,x),a):[b,g,x]}function Jn(t,e,r,n,i){for(var o=[],a=0,s=r.length;a=i[0]&&o[2]<=i[2]||(o[1]>=i[1]&&o[3]<=i[3]||Qn(t,e,r,n,(function(t,e){return Fe(i,t,e)})))))}function ei(t,e,r,n,i){for(var o=0,a=r.length;o0}function si(t,e,r,n,i){for(var o=void 0!==i&&i,a=0,s=r.length;at)throw new Error("Tile load sequence violation");this.state=t,this.changed()},e.prototype.load=function(){n()},e.prototype.getAlpha=function(t,e){if(!this.transition_)return 1;var r=this.transitionStarts_[t];if(r){if(-1===r)return 1}else r=e,this.transitionStarts_[t]=r;var n=e-r+1e3/60;return n>=this.transition_?1:no(n/this.transition_)},e.prototype.inTransition=function(t){return!!this.transition_&&-1!==this.transitionStarts_[t]},e.prototype.endTransition=function(t){this.transition_&&(this.transitionStarts_[t]=-1)},e}(M);function uo(t,e,r){var n=r&&r.length?r.shift():Yi?new OffscreenCanvas(t||300,e||300):document.createElement("canvas");return t&&(n.width=t),e&&(n.height=e),n.getContext("2d")}function co(t){var e=t.offsetWidth,r=getComputedStyle(t);return e+=parseInt(r.marginLeft,10)+parseInt(r.marginRight,10)}function ho(t){var e=t.offsetHeight,r=getComputedStyle(t);return e+=parseInt(r.marginTop,10)+parseInt(r.marginBottom,10)}function po(t,e){var r=e.parentNode;r&&r.replaceChild(t,e)}function fo(t){return t&&t.parentNode?t.parentNode.removeChild(t):null}function go(t){for(;t.lastChild;)t.removeChild(t.lastChild)}function yo(t,e){for(var r=t.childNodes,n=0;;++n){var i=r[n],o=e[n];if(!i&&!o)break;i!==o&&(i?o?t.insertBefore(o,i):(t.removeChild(i),--n):t.appendChild(o))}}var mo=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();var vo=function(t){function e(e,r,n,i,o,a){var s=t.call(this,e,r,a)||this;return s.crossOrigin_=i,s.src_=n,s.key=n,s.image_=new Image,null!==i&&(s.image_.crossOrigin=i),s.unlisten_=null,s.tileLoadFunction_=o,s}return mo(e,t),e.prototype.getImage=function(){return this.image_},e.prototype.handleImageError_=function(){var t;this.state=eo,this.unlistenImage_(),this.image_=((t=uo(1,1)).fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas),this.changed()},e.prototype.handleImageLoad_=function(){var t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=to:this.state=ro,this.unlistenImage_(),this.changed()},e.prototype.load=function(){this.state==eo&&(this.state=Ji,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==Ji&&(this.state=Qi,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=Zi(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},e.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},e}(lo),_o=function(){function t(t,e,r){this.decay_=t,this.minVelocity_=e,this.delay_=r,this.points_=[],this.angle_=0,this.initialVelocity_=0}return t.prototype.begin=function(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0},t.prototype.update=function(t,e){this.points_.push(t,e,Date.now())},t.prototype.end=function(){if(this.points_.length<6)return!1;var t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]0&&this.points_[r+2]>t;)r-=3;var n=this.points_[e+2]-this.points_[r+2];if(n<1e3/60)return!1;var i=this.points_[e]-this.points_[r],o=this.points_[e+1]-this.points_[r+1];return this.angle_=Math.atan2(o,i),this.initialVelocity_=Math.sqrt(i*i+o*o)/n,this.initialVelocity_>this.minVelocity_},t.prototype.getDistance=function(){return(this.minVelocity_-this.initialVelocity_)/this.decay_},t.prototype.getAngle=function(){return this.angle_},t}(),bo=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,xo=/^([a-z]*)$|^hsla?\(.*\)$/i;function wo(t){return"string"==typeof t?t:Ro(t)}function So(t){var e=document.createElement("div");if(e.style.color=t,""!==e.style.color){document.body.appendChild(e);var r=getComputedStyle(e).color;return document.body.removeChild(e),r}return""}var Eo,To,Co=(Eo={},To=0,function(t){var e;if(Eo.hasOwnProperty(t))e=Eo[t];else{if(To>=1024){var r=0;for(var n in Eo)0==(3&r++)&&(delete Eo[n],--To)}e=function(t){var e,r,n,i,o;if(xo.exec(t)&&(t=So(t)),bo.exec(t)){var a=t.length-1,s=void 0;s=a<=4?1:2;var l=4===a||8===a;e=parseInt(t.substr(1+0*s,s),16),r=parseInt(t.substr(1+1*s,s),16),n=parseInt(t.substr(1+2*s,s),16),i=l?parseInt(t.substr(1+3*s,s),16):255,1==s&&(e=(e<<4)+e,r=(r<<4)+r,n=(n<<4)+n,l&&(i=(i<<4)+i)),o=[e,r,n,i/255]}else 0==t.indexOf("rgba(")?Po(o=t.slice(5,-1).split(",").map(Number)):0==t.indexOf("rgb(")?((o=t.slice(4,-1).split(",").map(Number)).push(1),Po(o)):pt(!1,14);return o}(t),Eo[t]=e,++To}return e});function Oo(t){return Array.isArray(t)?t:Co(t)}function Po(t){return t[0]=Ne(t[0]+.5|0,0,255),t[1]=Ne(t[1]+.5|0,0,255),t[2]=Ne(t[2]+.5|0,0,255),t[3]=Ne(t[3],0,1),t}function Ro(t){var e=t[0];e!=(0|e)&&(e=e+.5|0);var r=t[1];r!=(0|r)&&(r=r+.5|0);var n=t[2];return n!=(0|n)&&(n=n+.5|0),"rgba("+e+","+r+","+n+","+(void 0===t[3]?1:t[3])+")"}function Io(t){return xo.test(t)&&(t=So(t)),bo.test(t)||0===t.indexOf("rgba(")||0===t.indexOf("rgb(")}var Lo=function(){function t(){this.cache_={},this.cacheSize_=0,this.maxCacheSize_=32}return t.prototype.clear=function(){this.cache_={},this.cacheSize_=0},t.prototype.canExpireCache=function(){return this.cacheSize_>this.maxCacheSize_},t.prototype.expire=function(){if(this.canExpireCache()){var t=0;for(var e in this.cache_){var r=this.cache_[e];0!=(3&t++)||r.hasListener()||(delete this.cache_[e],--this.cacheSize_)}}},t.prototype.get=function(t,e,r){var n=Mo(t,e,r);return n in this.cache_?this.cache_[n]:null},t.prototype.set=function(t,e,r,n){var i=Mo(t,e,r);this.cache_[i]=n,++this.cacheSize_},t.prototype.setSize=function(t){this.maxCacheSize_=t,this.expire()},t}();function Mo(t,e,r){return e+":"+t+":"+(r?wo(r):"null")}var Fo=Lo,Ao=new Lo,ko="opacity",jo="visible",No="extent",Do="zIndex",Go="maxResolution",zo="minResolution",Uo="maxZoom",Bo="minZoom",Vo="source",Yo=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Wo=function(t){function e(e){var r=t.call(this)||this,n=O({},e);return n[ko]=void 0!==e.opacity?e.opacity:1,pt("number"==typeof n[ko],64),n[jo]=void 0===e.visible||e.visible,n[Do]=e.zIndex,n[Go]=void 0!==e.maxResolution?e.maxResolution:1/0,n[zo]=void 0!==e.minResolution?e.minResolution:0,n[Bo]=void 0!==e.minZoom?e.minZoom:-1/0,n[Uo]=void 0!==e.maxZoom?e.maxZoom:1/0,r.className_=void 0!==n.className?e.className:"ol-layer",delete n.className,r.setProperties(n),r.state_=null,r}return Yo(e,t),e.prototype.getClassName=function(){return this.className_},e.prototype.getLayerState=function(t){var e=this.state_||{layer:this,managed:void 0===t||t},r=this.getZIndex();return e.opacity=Ne(Math.round(100*this.getOpacity())/100,0,1),e.sourceState=this.getSourceState(),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=void 0!==r?r:!1===e.managed?1/0:0,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e},e.prototype.getLayersArray=function(t){return n()},e.prototype.getLayerStatesArray=function(t){return n()},e.prototype.getExtent=function(){return this.get(No)},e.prototype.getMaxResolution=function(){return this.get(Go)},e.prototype.getMinResolution=function(){return this.get(zo)},e.prototype.getMinZoom=function(){return this.get(Bo)},e.prototype.getMaxZoom=function(){return this.get(Uo)},e.prototype.getOpacity=function(){return this.get(ko)},e.prototype.getSourceState=function(){return n()},e.prototype.getVisible=function(){return this.get(jo)},e.prototype.getZIndex=function(){return this.get(Do)},e.prototype.setExtent=function(t){this.set(No,t)},e.prototype.setMaxResolution=function(t){this.set(Go,t)},e.prototype.setMinResolution=function(t){this.set(zo,t)},e.prototype.setMaxZoom=function(t){this.set(Uo,t)},e.prototype.setMinZoom=function(t){this.set(Bo,t)},e.prototype.setOpacity=function(t){pt("number"==typeof t,64),this.set(ko,t)},e.prototype.setVisible=function(t){this.set(jo,t)},e.prototype.setZIndex=function(t){this.set(Do,t)},e.prototype.disposeInternal=function(){this.state_&&(this.state_.layer=null,this.state_=null),t.prototype.disposeInternal.call(this)},e}(ot),qo="prerender",Xo="postrender",Zo="precompose",Ko="postcompose",Ho="rendercomplete",$o="undefined",Jo="loading",Qo="ready",ta="error",ea=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function ra(t,e){if(!t.visible)return!1;var r=e.resolution;if(r=t.maxResolution)return!1;var n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}var na=function(t){function e(e){var r=this,n=O({},e);delete n.source,(r=t.call(this,n)||this).mapPrecomposeKey_=null,r.mapRenderKey_=null,r.sourceChangeKey_=null,r.renderer_=null,e.render&&(r.render=e.render),e.map&&r.setMap(e.map),r.addEventListener(it(Vo),r.handleSourcePropertyChange_);var i=e.source?e.source:null;return r.setSource(i),r}return ea(e,t),e.prototype.getLayersArray=function(t){var e=t||[];return e.push(this),e},e.prototype.getLayerStatesArray=function(t){var e=t||[];return e.push(this.getLayerState()),e},e.prototype.getSource=function(){return this.get(Vo)||null},e.prototype.getSourceState=function(){var t=this.getSource();return t?t.getState():$o},e.prototype.handleSourceChange_=function(){this.changed()},e.prototype.handleSourcePropertyChange_=function(){this.sourceChangeKey_&&(H(this.sourceChangeKey_),this.sourceChangeKey_=null);var t=this.getSource();t&&(this.sourceChangeKey_=Z(t,F,this.handleSourceChange_,this)),this.changed()},e.prototype.getFeatures=function(t){return this.renderer_.getFeatures(t)},e.prototype.render=function(t,e){var r=this.getRenderer();if(r.prepareFrame(t))return r.renderFrame(t,e)},e.prototype.setMap=function(t){this.mapPrecomposeKey_&&(H(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(H(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=Z(t,Zo,(function(t){var e=t.frameState.layerStatesArray,r=this.getLayerState(!1);pt(!e.some((function(t){return t.layer===r.layer})),67),e.push(r)}),this),this.mapRenderKey_=Z(this,F,t.render,t),this.changed())},e.prototype.setSource=function(t){this.set(Vo,t)},e.prototype.getRenderer=function(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_},e.prototype.hasRenderer=function(){return!!this.renderer_},e.prototype.createRenderer=function(){return null},e.prototype.disposeInternal=function(){this.setSource(null),t.prototype.disposeInternal.call(this)},e}(Wo),ia=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function oa(t,e){Ao.expire()}var aa=function(t){function e(e){var r=t.call(this)||this;return r.map_=e,r}return ia(e,t),e.prototype.dispatchRenderEvent=function(t,e){n()},e.prototype.calculateMatrices2D=function(t){var e=t.viewState,r=t.coordinateToPixelTransform,n=t.pixelToCoordinateTransform;kt(r,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),jt(n,r)},e.prototype.forEachFeatureAtCoordinate=function(t,e,r,n,i,o,a,s){var l,u=e.viewState;function c(t,e,r,n){return i.call(o,e,t?r:null,n)}var h=u.projection,p=Fr(t.slice(),h),f=[[0,0]];if(h.canWrapX()&&n){var d=Pe(h.getExtent());f.push([-d,0],[d,0])}for(var g=e.layerStatesArray,y=g.length,m=[],v=[],_=0;_=0;--b){var x=g[b],w=x.layer;if(w.hasRenderer()&&ra(x,u)&&a.call(s,w)){var S=w.getRenderer(),E=w.getSource();if(S&&E){var T=E.getWrapX()?p:t,C=c.bind(null,x.managed);v[0]=T[0]+f[_][0],v[1]=T[1]+f[_][1],l=S.forEachFeatureAtCoordinate(v,e,r,C,m)}if(l)return l}}if(0!==m.length){var O=1/m.length;return m.forEach((function(t,e){return t.distanceSq+=e*O})),m.sort((function(t,e){return t.distanceSq-e.distanceSq})),m.some((function(t){return l=t.callback(t.feature,t.layer,t.geometry)})),l}},e.prototype.forEachLayerAtPixel=function(t,e,r,i,o){return n()},e.prototype.hasFeatureAtCoordinate=function(t,e,r,n,i,o){return void 0!==this.forEachFeatureAtCoordinate(t,e,r,n,S,this,i,o)},e.prototype.getMap=function(){return this.map_},e.prototype.renderFrame=function(t){n()},e.prototype.scheduleExpireIconCache=function(t){Ao.canExpireCache()&&t.postRenderFunctions.push(oa)},e}(p),sa=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),la=function(t){function e(e,r,n,i){var o=t.call(this,e)||this;return o.inversePixelTransform=r,o.frameState=n,o.context=i,o}return sa(e,t),e}(c),ua=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))","?\\s*([-,\\\"\\'\\sa-z]+?)\\s*$"].join(""),"i"),ca=["style","variant","weight","size","lineHeight","family"],ha=function(t){var e=t.match(ua);if(!e)return null;for(var r={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"},n=0,i=ca.length;n=0;--o)n[o].renderDeclutter(t);yo(this.element_,this.children_),this.dispatchRenderEvent(Ko,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}else this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1)},e.prototype.forEachLayerAtPixel=function(t,e,r,n,i){for(var o=e.viewState,a=e.layerStatesArray,s=a.length-1;s>=0;--s){var l=a[s],u=l.layer;if(u.hasRenderer()&&ra(l,o)&&i(u)){var c=u.getRenderer().getDataAtPixel(t,e,r);if(c){var h=n(u,c);if(h)return h}}}},e}(aa),Ma=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Fa="layers",Aa=function(t){function e(e){var r=this,n=e||{},i=O({},n);delete i.layers;var o=n.layers;return(r=t.call(this,i)||this).layersListenerKeys_=[],r.listenerKeys_={},r.addEventListener(it(Fa),r.handleLayersChanged_),o?Array.isArray(o)?o=new ht(o.slice(),{unique:!0}):pt("function"==typeof o.getArray,43):o=new ht(void 0,{unique:!0}),r.setLayers(o),r}return Ma(e,t),e.prototype.handleLayerChange_=function(){this.changed()},e.prototype.handleLayersChanged_=function(){this.layersListenerKeys_.forEach(H),this.layersListenerKeys_.length=0;var t=this.getLayers();for(var e in this.layersListenerKeys_.push(Z(t,at,this.handleLayersAdd_,this),Z(t,st,this.handleLayersRemove_,this)),this.listenerKeys_)this.listenerKeys_[e].forEach(H);P(this.listenerKeys_);for(var r=t.getArray(),n=0,i=r.length;nthis.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_},e.prototype.disposeInternal=function(){this.relayedListenerKey_&&(H(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(q,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(H(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(H),this.dragListenerKeys_.length=0,this.element_=null,t.prototype.disposeInternal.call(this)},e}(M),qa="postrender",Xa="movestart",Za="moveend",Ka="layergroup",Ha="size",$a="target",Ja="view",Qa=function(){function t(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}return t.prototype.clear=function(){this.elements_.length=0,this.priorities_.length=0,P(this.queuedElements_)},t.prototype.dequeue=function(){var t=this.elements_,e=this.priorities_,r=t[0];1==t.length?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));var n=this.keyFunction_(r);return delete this.queuedElements_[n],r},t.prototype.enqueue=function(t){pt(!(this.keyFunction_(t)in this.queuedElements_),31);var e=this.priorityFunction_(t);return e!=1/0&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)},t.prototype.getCount=function(){return this.elements_.length},t.prototype.getLeftChildIndex_=function(t){return 2*t+1},t.prototype.getRightChildIndex_=function(t){return 2*t+2},t.prototype.getParentIndex_=function(t){return t-1>>1},t.prototype.heapify_=function(){var t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)},t.prototype.isEmpty=function(){return 0===this.elements_.length},t.prototype.isKeyQueued=function(t){return t in this.queuedElements_},t.prototype.isQueued=function(t){return this.isKeyQueued(this.keyFunction_(t))},t.prototype.siftUp_=function(t){for(var e=this.elements_,r=this.priorities_,n=e.length,i=e[t],o=r[t],a=t;t>1;){var s=this.getLeftChildIndex_(t),l=this.getRightChildIndex_(t),u=lt;){var a=this.getParentIndex_(e);if(!(n[a]>o))break;r[e]=r[a],n[e]=n[a],e=a}r[e]=i,n[e]=o},t.prototype.reprioritize=function(){var t,e,r,n=this.priorityFunction_,i=this.elements_,o=this.priorities_,a=0,s=i.length;for(e=0;e0;)n=(r=this.dequeue()[0]).getKey(),r.getState()!==Ji||n in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[n]=!0,++this.tilesLoading_,++i,r.load())},e}(Qa);function rs(t,e,r,n,i){if(!t||!(r in t.wantedTiles))return 1/0;if(!t.wantedTiles[r][e.getKey()])return 1/0;var o=t.viewState.center,a=n[0]-o[0],s=n[1]-o[1];return 65536*Math.log(i)+Math.sqrt(a*a+s*s)/i}var ns=0,is=1,os="center",as="resolution",ss="rotation";function ls(t,e,r){return function(n,i,o,a,s){if(n){var l=e?0:o[0]*i,u=e?0:o[1]*i,c=s?s[0]:0,h=s?s[1]:0,p=t[0]+l/2+c,f=t[2]-l/2+c,d=t[1]+u/2+h,g=t[3]-u/2+h;p>f&&(f=p=(f+p)/2),d>g&&(g=d=(g+d)/2);var y=Ne(n[0],p,f),m=Ne(n[1],d,g),v=30*i;return a&&r&&(y+=-v*Math.log(1+Math.max(0,p-n[0])/v)+v*Math.log(1+Math.max(0,n[0]-f)/v),m+=-v*Math.log(1+Math.max(0,d-n[1])/v)+v*Math.log(1+Math.max(0,n[1]-g)/v)),[y,m]}}}function us(t){return t}function cs(t,e,r,n){var i=Pe(e)/r[0],o=Ee(e)/r[1];return n?Math.min(t,Math.max(i,o)):Math.min(t,Math.min(i,o))}function hs(t,e,r){var n=Math.min(t,e);return n*=Math.log(1+50*Math.max(0,t/e-1))/50+1,r&&(n=Math.max(n,r),n/=Math.log(1+50*Math.max(0,r/t-1))/50+1),Ne(n,r/2,2*e)}function ps(t,e,r,n){return function(i,o,a,s){if(void 0!==i){var l=t[0],u=t[t.length-1],c=r?cs(l,r,a,n):l;if(s)return void 0===e||e?hs(i,c,u):Ne(i,u,c);var h=Math.min(c,i),p=Math.floor(y(t,h,o));return t[p]>c&&p1&&"function"==typeof arguments[r-1]&&(e=arguments[r-1],--r),!this.isDef()){var n=arguments[r-1];return n.center&&this.setCenterInternal(n.center),void 0!==n.zoom&&this.setZoom(n.zoom),void 0!==n.rotation&&this.setRotation(n.rotation),void(e&&bs(e,!0))}for(var i=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,s=this.targetRotation_,l=[],u=0;u0},e.prototype.getInteracting=function(){return this.hints_[is]>0},e.prototype.cancelAnimations=function(){var t;this.setHint(ns,-this.hints_[ns]);for(var e=0,r=this.animations_.length;e=0;--r){for(var n=this.animations_[r],i=!0,o=0,a=n.length;o0?l/s.duration:1;u>=1?(s.complete=!0,u=1):i=!1;var c=s.easing(u);if(s.sourceCenter){var h=s.sourceCenter[0],p=s.sourceCenter[1],f=h+c*(s.targetCenter[0]-h),d=p+c*(s.targetCenter[1]-p);this.targetCenter_=[f,d]}if(s.sourceResolution&&s.targetResolution){var g=1===c?s.targetResolution:s.sourceResolution+c*(s.targetResolution-s.sourceResolution);if(s.anchor){var y=this.getViewportSize_(this.getRotation()),m=this.constraints_.resolution(g,0,y,!0);this.targetCenter_=this.calculateCenterZoom(m,s.anchor)}this.targetResolution_=g,this.applyTargetState_(!0)}if(void 0!==s.sourceRotation&&void 0!==s.targetRotation){var v=1===c?We(s.targetRotation+Math.PI,2*Math.PI)-Math.PI:s.sourceRotation+c*(s.targetRotation-s.sourceRotation);if(s.anchor){var _=this.constraints_.rotation(v,!0);this.targetCenter_=this.calculateCenterRotate(_,s.anchor)}this.targetRotation_=v}if(this.applyTargetState_(!0),e=!0,!s.complete)break}}if(i){this.animations_[r]=null,this.setHint(ns,-1);var b=n[0].callback;b&&bs(b,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}},e.prototype.calculateCenterRotate=function(t,e){var r,n=this.getCenterInternal();return void 0!==n&&(Or(r=[n[0]-e[0],n[1]-e[1]],t-this.getRotation()),xr(r,e)),r},e.prototype.calculateCenterZoom=function(t,e){var r,n=this.getCenterInternal(),i=this.getResolution();void 0!==n&&void 0!==i&&(r=[e[0]-t*(e[0]-n[0])/i,e[1]-t*(e[1]-n[1])/i]);return r},e.prototype.getViewportSize_=function(t){var e=this.viewportSize_;if(t){var r=e[0],n=e[1];return[Math.abs(r*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(r*Math.sin(t))+Math.abs(n*Math.cos(t))]}return e},e.prototype.setViewportSize=function(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)},e.prototype.getCenter=function(){var t=this.getCenterInternal();return t?en(t,this.getProjection()):t},e.prototype.getCenterInternal=function(){return this.get(os)},e.prototype.getConstraints=function(){return this.constraints_},e.prototype.getConstrainResolution=function(){return this.options_.constrainResolution},e.prototype.getHints=function(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()},e.prototype.calculateExtent=function(t){return nn(this.calculateExtentInternal(t),this.getProjection())},e.prototype.calculateExtentInternal=function(t){var e=t||this.getViewportSize_(),r=this.getCenterInternal();pt(r,1);var n=this.getResolution();pt(void 0!==n,2);var i=this.getRotation();return pt(void 0!==i,3),Se(r,n,i,e)},e.prototype.getMaxResolution=function(){return this.maxResolution_},e.prototype.getMinResolution=function(){return this.minResolution_},e.prototype.getMaxZoom=function(){return this.getZoomForResolution(this.minResolution_)},e.prototype.setMaxZoom=function(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))},e.prototype.getMinZoom=function(){return this.getZoomForResolution(this.maxResolution_)},e.prototype.setMinZoom=function(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))},e.prototype.setConstrainResolution=function(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))},e.prototype.getProjection=function(){return this.projection_},e.prototype.getResolution=function(){return this.get(as)},e.prototype.getResolutions=function(){return this.resolutions_},e.prototype.getResolutionForExtent=function(t,e){return this.getResolutionForExtentInternal(on(t,this.getProjection()),e)},e.prototype.getResolutionForExtentInternal=function(t,e){var r=e||this.getViewportSize_(),n=Pe(t)/r[0],i=Ee(t)/r[1];return Math.max(n,i)},e.prototype.getResolutionForValueFunction=function(t){var e=t||2,r=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,i=Math.log(r/n)/Math.log(e);return function(t){return r/Math.pow(e,t*i)}},e.prototype.getRotation=function(){return this.get(ss)},e.prototype.getValueForResolutionFunction=function(t){var e=Math.log(t||2),r=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,i=Math.log(r/n)/e;return function(t){return Math.log(r/t)/e/i}},e.prototype.getViewportSizeMinusPadding_=function(t){var e=this.getViewportSize_(t),r=this.padding;return r&&(e=[e[0]-r[1]-r[3],e[1]-r[0]-r[2]]),e},e.prototype.getState=function(){var t=this.getProjection(),e=this.getResolution(),r=this.getRotation(),n=this.getCenterInternal(),i=this.padding;if(i){var o=this.getViewportSizeMinusPadding_();n=Ts(n,this.getViewportSize_(),[o[0]/2+i[3],o[1]/2+i[0]],e,r)}return{center:n.slice(0),projection:void 0!==t?t:null,resolution:e,rotation:r,zoom:this.getZoom()}},e.prototype.getZoom=function(){var t,e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t},e.prototype.getZoomForResolution=function(t){var e,r,n=this.minZoom_||0;if(this.resolutions_){var i=y(this.resolutions_,t,1);n=i,e=this.resolutions_[i],r=i==this.resolutions_.length-1?2:e/this.resolutions_[i+1]}else e=this.maxResolution_,r=this.zoomFactor_;return n+Math.log(e/t)/Math.log(r)},e.prototype.getResolutionForZoom=function(t){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;var e=Ne(Math.floor(t),0,this.resolutions_.length-2),r=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(r,Ne(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)},e.prototype.fit=function(t,e){var r;if(pt(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,24),Array.isArray(t))pt(!Ie(t),25),r=gi(n=on(t,this.getProjection()));else if(t.getType()===bt.CIRCLE){var n;(r=gi(n=on(t.getExtent(),this.getProjection()))).rotate(this.getRotation(),xe(n))}else{var i=tn();r=i?t.clone().transform(i,this.getProjection()):t}this.fitInternal(r,e)},e.prototype.fitInternal=function(t,e){var r=e||{},n=r.size;n||(n=this.getViewportSizeMinusPadding_());var i,o=void 0!==r.padding?r.padding:[0,0,0,0],a=void 0!==r.nearest&&r.nearest;i=void 0!==r.minResolution?r.minResolution:void 0!==r.maxZoom?this.getResolutionForZoom(r.maxZoom):0;for(var s=t.getFlatCoordinates(),l=this.getRotation(),u=Math.cos(-l),c=Math.sin(-l),h=1/0,p=1/0,f=-1/0,d=-1/0,g=t.getStride(),y=0,m=s.length;y0&&t[1]>0}function Rs(t,e,r){return void 0===r&&(r=[0,0]),r[0]=t[0]*e+.5|0,r[1]=t[1]*e+.5|0,r}function Is(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}var Ls=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();var Ms=function(t){function e(e){var r=t.call(this)||this,n=function(t){var e=null;void 0!==t.keyboardEventTarget&&(e="string"==typeof t.keyboardEventTarget?document.getElementById(t.keyboardEventTarget):t.keyboardEventTarget);var r,n,i,o={},a=t.layers&&"function"==typeof t.layers.getLayers?t.layers:new Aa({layers:t.layers});o[Ka]=a,o[$a]=t.target,o[Ja]=void 0!==t.view?t.view:new Cs,void 0!==t.controls&&(Array.isArray(t.controls)?r=new ht(t.controls.slice()):(pt("function"==typeof t.controls.getArray,47),r=t.controls));void 0!==t.interactions&&(Array.isArray(t.interactions)?n=new ht(t.interactions.slice()):(pt("function"==typeof t.interactions.getArray,48),n=t.interactions));void 0!==t.overlays?Array.isArray(t.overlays)?i=new ht(t.overlays.slice()):(pt("function"==typeof t.overlays.getArray,49),i=t.overlays):i=new ht;return{controls:r,interactions:n,keyboardEventTarget:e,overlays:i,values:o}}(e);return r.boundHandleBrowserEvent_=r.handleBrowserEvent.bind(r),r.maxTilesLoading_=void 0!==e.maxTilesLoading?e.maxTilesLoading:16,r.pixelRatio_=void 0!==e.pixelRatio?e.pixelRatio:Vi,r.postRenderTimeoutHandle_,r.animationDelayKey_,r.animationDelay_=function(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}.bind(r),r.coordinateToPixelTransform_=[1,0,0,1,0,0],r.pixelToCoordinateTransform_=[1,0,0,1,0,0],r.frameIndex_=0,r.frameState_=null,r.previousExtent_=null,r.viewPropertyListenerKey_=null,r.viewChangeListenerKey_=null,r.layerGroupPropertyListenerKeys_=null,r.viewport_=document.createElement("div"),r.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),r.viewport_.style.position="relative",r.viewport_.style.overflow="hidden",r.viewport_.style.width="100%",r.viewport_.style.height="100%",r.overlayContainer_=document.createElement("div"),r.overlayContainer_.style.position="absolute",r.overlayContainer_.style.zIndex="0",r.overlayContainer_.style.width="100%",r.overlayContainer_.style.height="100%",r.overlayContainer_.style.pointerEvents="none",r.overlayContainer_.className="ol-overlaycontainer",r.viewport_.appendChild(r.overlayContainer_),r.overlayContainerStopEvent_=document.createElement("div"),r.overlayContainerStopEvent_.style.position="absolute",r.overlayContainerStopEvent_.style.zIndex="0",r.overlayContainerStopEvent_.style.width="100%",r.overlayContainerStopEvent_.style.height="100%",r.overlayContainerStopEvent_.style.pointerEvents="none",r.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",r.viewport_.appendChild(r.overlayContainerStopEvent_),r.mapBrowserEventHandler_=null,r.moveTolerance_=e.moveTolerance,r.keyboardEventTarget_=n.keyboardEventTarget,r.keyHandlerKeys_=null,r.controls=n.controls||new ht,r.interactions=n.interactions||new ht,r.overlays_=n.overlays,r.overlayIdIndex_={},r.renderer_=null,r.handleResize_,r.postRenderFunctions_=[],r.tileQueue_=new es(r.getTilePriority.bind(r),r.handleTileChange_.bind(r)),r.addEventListener(it(Ka),r.handleLayerGroupChanged_),r.addEventListener(it(Ja),r.handleViewChanged_),r.addEventListener(it(Ha),r.handleSizeChanged_),r.addEventListener(it($a),r.handleTargetChanged_),r.setProperties(n.values),r.controls.forEach(function(t){t.setMap(this)}.bind(r)),r.controls.addEventListener(at,function(t){t.element.setMap(this)}.bind(r)),r.controls.addEventListener(st,function(t){t.element.setMap(null)}.bind(r)),r.interactions.forEach(function(t){t.setMap(this)}.bind(r)),r.interactions.addEventListener(at,function(t){t.element.setMap(this)}.bind(r)),r.interactions.addEventListener(st,function(t){t.element.setMap(null)}.bind(r)),r.overlays_.forEach(r.addOverlayInternal_.bind(r)),r.overlays_.addEventListener(at,function(t){this.addOverlayInternal_(t.element)}.bind(r)),r.overlays_.addEventListener(st,function(t){var e=t.element.getId();void 0!==e&&delete this.overlayIdIndex_[e.toString()],t.element.setMap(null)}.bind(r)),r}return Ls(e,t),e.prototype.createRenderer=function(){throw new Error("Use a map type that has a createRenderer method")},e.prototype.addControl=function(t){this.getControls().push(t)},e.prototype.addInteraction=function(t){this.getInteractions().push(t)},e.prototype.addLayer=function(t){this.getLayerGroup().getLayers().push(t)},e.prototype.addOverlay=function(t){this.getOverlays().push(t)},e.prototype.addOverlayInternal_=function(t){var e=t.getId();void 0!==e&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)},e.prototype.disposeInternal=function(){this.setTarget(null),t.prototype.disposeInternal.call(this)},e.prototype.forEachFeatureAtPixel=function(t,e,r){if(this.frameState_){var n=this.getCoordinateFromPixelInternal(t),i=void 0!==(r=void 0!==r?r:{}).hitTolerance?r.hitTolerance:0,o=void 0!==r.layerFilter?r.layerFilter:S,a=!1!==r.checkWrapped;return this.renderer_.forEachFeatureAtCoordinate(n,this.frameState_,i,a,e,null,o,null)}},e.prototype.getFeaturesAtPixel=function(t,e){var r=[];return this.forEachFeatureAtPixel(t,(function(t){r.push(t)}),e),r},e.prototype.forEachLayerAtPixel=function(t,e,r){if(this.frameState_){var n=r||{},i=void 0!==n.hitTolerance?n.hitTolerance:0,o=n.layerFilter||S;return this.renderer_.forEachLayerAtPixel(t,this.frameState_,i,e,o)}},e.prototype.hasFeatureAtPixel=function(t,e){if(!this.frameState_)return!1;var r=this.getCoordinateFromPixelInternal(t),n=void 0!==(e=void 0!==e?e:{}).layerFilter?e.layerFilter:S,i=void 0!==e.hitTolerance?e.hitTolerance:0,o=!1!==e.checkWrapped;return this.renderer_.hasFeatureAtCoordinate(r,this.frameState_,i,o,n,null)},e.prototype.getEventCoordinate=function(t){return this.getCoordinateFromPixel(this.getEventPixel(t))},e.prototype.getEventCoordinateInternal=function(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))},e.prototype.getEventPixel=function(t){var e=this.viewport_.getBoundingClientRect(),r="changedTouches"in t?t.changedTouches[0]:t;return[r.clientX-e.left,r.clientY-e.top]},e.prototype.getTarget=function(){return this.get($a)},e.prototype.getTargetElement=function(){var t=this.getTarget();return void 0!==t?"string"==typeof t?document.getElementById(t):t:null},e.prototype.getCoordinateFromPixel=function(t){return en(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())},e.prototype.getCoordinateFromPixelInternal=function(t){var e=this.frameState_;return e?It(e.pixelToCoordinateTransform,t.slice()):null},e.prototype.getControls=function(){return this.controls},e.prototype.getOverlays=function(){return this.overlays_},e.prototype.getOverlayById=function(t){var e=this.overlayIdIndex_[t.toString()];return void 0!==e?e:null},e.prototype.getInteractions=function(){return this.interactions},e.prototype.getLayerGroup=function(){return this.get(Ka)},e.prototype.getLayers=function(){return this.getLayerGroup().getLayers()},e.prototype.getLoading=function(){for(var t=this.getLayerGroup().getLayerStatesArray(),e=0,r=t.length;e=0;s--){var l=a[s];if(l.getMap()===this&&l.getActive()&&this.getTargetElement())if(!l.handleEvent(t)||t.propagationStopped)break}}},e.prototype.handlePostRender=function(){var t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){var r=this.maxTilesLoading_,n=r;if(t){var i=t.viewHints;if(i[ns]||i[is]){var o=!Wi&&Date.now()-t.time>8;r=o?0:8,n=o?0:2}}e.getTilesLoading()0;if(this.renderedVisible_!=r&&(this.element.style.display=r?"":"none",this.renderedVisible_=r),!b(e,this.renderedAttributions_)){go(this.ulElement_);for(var n=0,i=e.length;n0&&e%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.duration_,easing:io}):t.setRotation(0))}},e.prototype.render=function(t){var e=t.frameState;if(e){var r=e.viewState.rotation;if(r!=this.rotation_){var n="rotate("+r+"rad)";if(this.autoHide_){var i=this.element.classList.contains("ol-hidden");i||0!==r?i&&0!==r&&this.element.classList.remove("ol-hidden"):this.element.classList.add("ol-hidden")}this.label_.style.transform=n}this.rotation_=r}},e}(As),Gs=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),zs=function(t){function e(e){var r=this,n=e||{};r=t.call(this,{element:document.createElement("div"),target:n.target})||this;var i=void 0!==n.className?n.className:"ol-zoom",o=void 0!==n.delta?n.delta:1,a=void 0!==n.zoomInClassName?n.zoomInClassName:i+"-in",s=void 0!==n.zoomOutClassName?n.zoomOutClassName:i+"-out",l=void 0!==n.zoomInLabel?n.zoomInLabel:"+",u=void 0!==n.zoomOutLabel?n.zoomOutLabel:"−",c=void 0!==n.zoomInTipLabel?n.zoomInTipLabel:"Zoom in",h=void 0!==n.zoomOutTipLabel?n.zoomOutTipLabel:"Zoom out",p=document.createElement("button");p.className=a,p.setAttribute("type","button"),p.title=c,p.appendChild("string"==typeof l?document.createTextNode(l):l),p.addEventListener(N,r.handleClick_.bind(r,o),!1);var f=document.createElement("button");f.className=s,f.setAttribute("type","button"),f.title=h,f.appendChild("string"==typeof u?document.createTextNode(u):u),f.addEventListener(N,r.handleClick_.bind(r,-o),!1);var d=i+" ol-unselectable ol-control",g=r.element;return g.className=d,g.appendChild(p),g.appendChild(f),r.duration_=void 0!==n.duration?n.duration:250,r}return Gs(e,t),e.prototype.handleClick_=function(t,e){e.preventDefault(),this.zoomByDelta_(t)},e.prototype.zoomByDelta_=function(t){var e=this.getMap().getView();if(e){var r=e.getZoom();if(void 0!==r){var n=e.getConstrainedZoom(r+t);this.duration_>0?(e.getAnimating()&&e.cancelAnimations(),e.animate({zoom:n,duration:this.duration_,easing:io})):e.setZoom(n)}}},e}(As);function Us(t){var e=t||{},r=new ht;return(void 0===e.zoom||e.zoom)&&r.push(new zs(e.zoomOptions)),(void 0===e.rotate||e.rotate)&&r.push(new Ds(e.rotateOptions)),(void 0===e.attribution||e.attribution)&&r.push(new js(e.attributionOptions)),r}var Bs="active",Vs=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Ys(t,e,r){var n=t.getCenterInternal();if(n){var i=[n[0]+e[0],n[1]+e[1]];t.animateInternal({duration:void 0!==r?r:250,easing:ao,center:t.getConstrainedCenter(i)})}}function Ws(t,e,r,n){var i=t.getZoom();if(void 0!==i){var o=t.getConstrainedZoom(i+e),a=t.getResolutionForZoom(o);t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:a,anchor:r,duration:void 0!==n?n:250,easing:io})}}var qs=function(t){function e(e){var r=t.call(this)||this;return e&&e.handleEvent&&(r.handleEvent=e.handleEvent),r.map_=null,r.setActive(!0),r}return Vs(e,t),e.prototype.getActive=function(){return this.get(Bs)},e.prototype.getMap=function(){return this.map_},e.prototype.handleEvent=function(t){return!0},e.prototype.setActive=function(t){this.set(Bs,t)},e.prototype.setMap=function(t){this.map_=t},e}(ot),Xs=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Zs=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.delta_=n.delta?n.delta:1,r.duration_=void 0!==n.duration?n.duration:250,r}return Xs(e,t),e.prototype.handleEvent=function(t){var e=!1;if(t.type==Ga.DBLCLICK){var r=t.originalEvent,n=t.map,i=t.coordinate,o=r.shiftKey?-this.delta_:this.delta_;Ws(n.getView(),o,i,this.duration_),r.preventDefault(),e=!0}return!e},e}(qs),Ks=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Hs(t){for(var e=t.length,r=0,n=0,i=0;i0}}else if(t.type==Ga.POINTERDOWN){var n=this.handleDownEvent(t);this.handlingDownUpSequence=n,e=this.stopDown(n)}else t.type==Ga.POINTERMOVE&&this.handleMoveEvent(t);return!e},e.prototype.handleMoveEvent=function(t){},e.prototype.handleUpEvent=function(t){return!1},e.prototype.stopDown=function(t){return t},e.prototype.updateTrackedPointers_=function(t){if(function(t){var e=t.type;return e===Ga.POINTERDOWN||e===Ga.POINTERDRAG||e===Ga.POINTERUP}(t)){var e=t.originalEvent,r=e.pointerId.toString();t.type==Ga.POINTERUP?delete this.trackedPointers_[r]:(t.type==Ga.POINTERDOWN||r in this.trackedPointers_)&&(this.trackedPointers_[r]=e),this.targetPointers=R(this.trackedPointers_)}},e}(qs);function Js(t){var e=arguments;return function(t){for(var r=!0,n=0,i=e.length;n0&&this.condition_(t)){var e=t.map.getView();return this.lastCentroid=null,e.getAnimating()&&e.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1},e}($s),dl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),gl=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,{stopDown:E})||this).condition_=n.condition?n.condition:tl,r.lastAngle_=void 0,r.duration_=void 0!==n.duration?n.duration:250,r}return dl(e,t),e.prototype.handleDragEvent=function(t){if(cl(t)){var e=t.map,r=e.getView();if(r.getConstraints().rotation!==gs){var n=e.getSize(),i=t.pixel,o=Math.atan2(n[1]/2-i[1],i[0]-n[0]/2);if(void 0!==this.lastAngle_){var a=o-this.lastAngle_;r.adjustRotationInternal(-a)}this.lastAngle_=o}}},e.prototype.handleUpEvent=function(t){return!cl(t)||(t.map.getView().endInteraction(this.duration_),!1)},e.prototype.handleDownEvent=function(t){return!!cl(t)&&(!(!il(t)||!this.condition_(t))&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0))},e}($s),yl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ml=function(t){function e(e){var r=t.call(this)||this;return r.geometry_=null,r.element_=document.createElement("div"),r.element_.style.position="absolute",r.element_.style.pointerEvents="auto",r.element_.className="ol-box "+e,r.map_=null,r.startPixel_=null,r.endPixel_=null,r}return yl(e,t),e.prototype.disposeInternal=function(){this.setMap(null)},e.prototype.render_=function(){var t=this.startPixel_,e=this.endPixel_,r=this.element_.style;r.left=Math.min(t[0],e[0])+"px",r.top=Math.min(t[1],e[1])+"px",r.width=Math.abs(e[0]-t[0])+"px",r.height=Math.abs(e[1]-t[1])+"px"},e.prototype.setMap=function(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);var e=this.element_.style;e.left="inherit",e.top="inherit",e.width="inherit",e.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)},e.prototype.setPixels=function(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()},e.prototype.createOrUpdateGeometry=function(){var t=this.startPixel_,e=this.endPixel_,r=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);r[4]=r[0].slice(),this.geometry_?this.geometry_.setCoordinates([r]):this.geometry_=new fi([r])},e.prototype.getGeometry=function(){return this.geometry_},e}(p),vl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),_l="boxstart",bl="boxdrag",xl="boxend",wl="boxcancel",Sl=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.coordinate=r,i.mapBrowserEvent=n,i}return vl(e,t),e}(c),El=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.box_=new ml(n.className||"ol-dragbox"),r.minArea_=void 0!==n.minArea?n.minArea:64,n.onBoxEnd&&(r.onBoxEnd=n.onBoxEnd),r.startPixel_=null,r.condition_=n.condition?n.condition:il,r.boxEndCondition_=n.boxEndCondition?n.boxEndCondition:r.defaultBoxEndCondition,r}return vl(e,t),e.prototype.defaultBoxEndCondition=function(t,e,r){var n=r[0]-e[0],i=r[1]-e[1];return n*n+i*i>=this.minArea_},e.prototype.getGeometry=function(){return this.box_.getGeometry()},e.prototype.handleDragEvent=function(t){this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new Sl(bl,t.coordinate,t))},e.prototype.handleUpEvent=function(t){this.box_.setMap(null);var e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new Sl(e?xl:wl,t.coordinate,t)),!1},e.prototype.handleDownEvent=function(t){return!!this.condition_(t)&&(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new Sl(_l,t.coordinate,t)),!0)},e.prototype.onBoxEnd=function(t){},e}($s),Tl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Cl=function(t){function e(e){var r=this,n=e||{},i=n.condition?n.condition:ll;return(r=t.call(this,{condition:i,className:n.className||"ol-dragzoom",minArea:n.minArea})||this).duration_=void 0!==n.duration?n.duration:200,r.out_=void 0!==n.out&&n.out,r}return Tl(e,t),e.prototype.onBoxEnd=function(t){var e=this.getMap(),r=e.getView(),n=e.getSize(),i=this.getGeometry().getExtent();if(this.out_){var o=r.calculateExtentInternal(n),a=se([e.getPixelFromCoordinateInternal(_e(i)),e.getPixelFromCoordinateInternal(Oe(i))]);Me(o,1/r.getResolutionForExtentInternal(a,n)),i=o}var s=r.getConstrainedResolution(r.getResolutionForExtentInternal(i,n)),l=r.getConstrainedCenter(xe(i),s);r.animateInternal({resolution:s,center:l,duration:this.duration_,easing:io})},e}(El),Ol=37,Pl=38,Rl=39,Il=40,Ll=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ml=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.defaultCondition_=function(t){return sl(t)&&ul(t)},r.condition_=void 0!==n.condition?n.condition:r.defaultCondition_,r.duration_=void 0!==n.duration?n.duration:100,r.pixelDelta_=void 0!==n.pixelDelta?n.pixelDelta:128,r}return Ll(e,t),e.prototype.handleEvent=function(t){var e=!1;if(t.type==B){var r=t.originalEvent,n=r.keyCode;if(this.condition_(t)&&(n==Il||n==Ol||n==Rl||n==Pl)){var i=t.map.getView(),o=i.getResolution()*this.pixelDelta_,a=0,s=0;n==Il?s=-o:n==Ol?a=-o:n==Rl?a=o:s=o;var l=[a,s];Or(l,i.getRotation()),Ys(i,l,this.duration_),r.preventDefault(),e=!0}}return!e},e}(qs),Fl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Al=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.condition_=n.condition?n.condition:ul,r.delta_=n.delta?n.delta:1,r.duration_=void 0!==n.duration?n.duration:100,r}return Fl(e,t),e.prototype.handleEvent=function(t){var e=!1;if(t.type==B||t.type==V){var r=t.originalEvent,n=r.charCode;if(this.condition_(t)&&(n=="+".charCodeAt(0)||n=="-".charCodeAt(0))){var i=t.map,o=n=="+".charCodeAt(0)?this.delta_:-this.delta_;Ws(i.getView(),o,void 0,this.duration_),r.preventDefault(),e=!0}}return!e},e}(qs),kl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),jl="trackpad",Nl="wheel",Dl=function(t){function e(e){var r=this,n=e||{};(r=t.call(this,n)||this).totalDelta_=0,r.lastDelta_=0,r.maxDelta_=void 0!==n.maxDelta?n.maxDelta:1,r.duration_=void 0!==n.duration?n.duration:250,r.timeout_=void 0!==n.timeout?n.timeout:80,r.useAnchor_=void 0===n.useAnchor||n.useAnchor,r.constrainResolution_=void 0!==n.constrainResolution&&n.constrainResolution;var i=n.condition?n.condition:nl;return r.condition_=n.onFocusOnly?Js(rl,i):i,r.lastAnchor_=null,r.startTime_=void 0,r.timeoutId_,r.mode_=void 0,r.trackpadEventGap_=400,r.trackpadTimeoutId_,r.deltaPerZoom_=300,r}return kl(e,t),e.prototype.endInteraction_=function(){this.trackpadTimeoutId_=void 0,this.getMap().getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_)},e.prototype.handleEvent=function(t){if(!this.condition_(t))return!0;if(t.type!==X)return!0;var e,r=t.map,n=t.originalEvent;if(n.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.coordinate),t.type==X&&(e=n.deltaY,Gi&&n.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(e/=Vi),n.deltaMode===WheelEvent.DOM_DELTA_LINE&&(e*=40)),0===e)return!1;this.lastDelta_=e;var i=Date.now();void 0===this.startTime_&&(this.startTime_=i),(!this.mode_||i-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(e)<4?jl:Nl);var o=r.getView();if(this.mode_===jl&&!o.getConstrainResolution()&&!this.constrainResolution_)return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(o.getAnimating()&&o.cancelAnimations(),o.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),o.adjustZoom(-e/this.deltaPerZoom_,this.lastAnchor_),this.startTime_=i,!1;this.totalDelta_+=e;var a=Math.max(this.timeout_-(i-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,r),a),!1},e.prototype.handleWheelZoom_=function(t){var e=t.getView();e.getAnimating()&&e.cancelAnimations();var r=-Ne(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(r=r?r>0?1:-1:0),Ws(e,r,this.lastAnchor_,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0},e.prototype.setMouseAnchor=function(t){this.useAnchor_=t,t||(this.lastAnchor_=null)},e}(qs),Gl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),zl=function(t){function e(e){var r=this,n=e||{},i=n;return i.stopDown||(i.stopDown=E),(r=t.call(this,i)||this).anchor_=null,r.lastAngle_=void 0,r.rotating_=!1,r.rotationDelta_=0,r.threshold_=void 0!==n.threshold?n.threshold:.3,r.duration_=void 0!==n.duration?n.duration:250,r}return Gl(e,t),e.prototype.handleDragEvent=function(t){var e=0,r=this.targetPointers[0],n=this.targetPointers[1],i=Math.atan2(n.clientY-r.clientY,n.clientX-r.clientX);if(void 0!==this.lastAngle_){var o=i-this.lastAngle_;this.rotationDelta_+=o,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=o}this.lastAngle_=i;var a=t.map,s=a.getView();if(s.getConstraints().rotation!==gs){var l=a.getViewport().getBoundingClientRect(),u=Hs(this.targetPointers);u[0]-=l.left,u[1]-=l.top,this.anchor_=a.getCoordinateFromPixelInternal(u),this.rotating_&&(a.render(),s.adjustRotationInternal(e,this.anchor_))}},e.prototype.handleUpEvent=function(t){return!(this.targetPointers.length<2)||(t.map.getView().endInteraction(this.duration_),!1)},e.prototype.handleDownEvent=function(t){if(this.targetPointers.length>=2){var e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1},e}($s),Ul=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Bl=function(t){function e(e){var r=this,n=e||{},i=n;return i.stopDown||(i.stopDown=E),(r=t.call(this,i)||this).anchor_=null,r.duration_=void 0!==n.duration?n.duration:400,r.lastDistance_=void 0,r.lastScaleDelta_=1,r}return Ul(e,t),e.prototype.handleDragEvent=function(t){var e=1,r=this.targetPointers[0],n=this.targetPointers[1],i=r.clientX-n.clientX,o=r.clientY-n.clientY,a=Math.sqrt(i*i+o*o);void 0!==this.lastDistance_&&(e=this.lastDistance_/a),this.lastDistance_=a;var s=t.map,l=s.getView();1!=e&&(this.lastScaleDelta_=e);var u=s.getViewport().getBoundingClientRect(),c=Hs(this.targetPointers);c[0]-=u.left,c[1]-=u.top,this.anchor_=s.getCoordinateFromPixelInternal(c),s.render(),l.adjustResolutionInternal(e,this.anchor_)},e.prototype.handleUpEvent=function(t){if(this.targetPointers.length<2){var e=t.map.getView(),r=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,r),!1}return!0},e.prototype.handleDownEvent=function(t){if(this.targetPointers.length>=2){var e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1},e}($s);function Vl(t){var e=t||{},r=new ht,n=new _o(-.005,.05,100);return(void 0===e.altShiftDragRotate||e.altShiftDragRotate)&&r.push(new gl),(void 0===e.doubleClickZoom||e.doubleClickZoom)&&r.push(new Zs({delta:e.zoomDelta,duration:e.zoomDuration})),(void 0===e.dragPan||e.dragPan)&&r.push(new fl({onFocusOnly:e.onFocusOnly,kinetic:n})),(void 0===e.pinchRotate||e.pinchRotate)&&r.push(new zl),(void 0===e.pinchZoom||e.pinchZoom)&&r.push(new Bl({duration:e.zoomDuration})),(void 0===e.keyboard||e.keyboard)&&(r.push(new Ml),r.push(new Al({delta:e.zoomDelta,duration:e.zoomDuration}))),(void 0===e.mouseWheelZoom||e.mouseWheelZoom)&&r.push(new Dl({onFocusOnly:e.onFocusOnly,duration:e.zoomDuration})),(void 0===e.shiftDragZoom||e.shiftDragZoom)&&r.push(new Cl({duration:e.zoomDuration})),r}var Yl=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Wl=function(t){function e(e){return(e=O({},e)).controls||(e.controls=Us()),e.interactions||(e.interactions=Vl({onFocusOnly:!0})),t.call(this,e)||this}return Yl(e,t),e.prototype.createRenderer=function(){return new La(this)},e}(Ms),ql="bottom-left",Xl="bottom-center",Zl="bottom-right",Kl="center-left",Hl="center-center",$l="center-right",Jl="top-left",Ql="top-center",tu="top-right",eu=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ru="element",nu="map",iu="offset",ou="position",au="positioning",su=function(t){function e(e){var r=t.call(this)||this;r.options=e,r.id=e.id,r.insertFirst=void 0===e.insertFirst||e.insertFirst,r.stopEvent=void 0===e.stopEvent||e.stopEvent,r.element=document.createElement("div"),r.element.className=void 0!==e.className?e.className:"ol-overlay-container ol-selectable",r.element.style.position="absolute",r.element.style.pointerEvents="auto";var n=e.autoPan;return n&&"object"!=typeof n&&(n={animation:e.autoPanAnimation,margin:e.autoPanMargin}),r.autoPan=n||!1,r.rendered={transform_:"",visible:!0},r.mapPostrenderListenerKey=null,r.addEventListener(it(ru),r.handleElementChanged),r.addEventListener(it(nu),r.handleMapChanged),r.addEventListener(it(iu),r.handleOffsetChanged),r.addEventListener(it(ou),r.handlePositionChanged),r.addEventListener(it(au),r.handlePositioningChanged),void 0!==e.element&&r.setElement(e.element),r.setOffset(void 0!==e.offset?e.offset:[0,0]),r.setPositioning(void 0!==e.positioning?e.positioning:Jl),void 0!==e.position&&r.setPosition(e.position),r}return eu(e,t),e.prototype.getElement=function(){return this.get(ru)},e.prototype.getId=function(){return this.id},e.prototype.getMap=function(){return this.get(nu)},e.prototype.getOffset=function(){return this.get(iu)},e.prototype.getPosition=function(){return this.get(ou)},e.prototype.getPositioning=function(){return this.get(au)},e.prototype.handleElementChanged=function(){go(this.element);var t=this.getElement();t&&this.element.appendChild(t)},e.prototype.handleMapChanged=function(){this.mapPostrenderListenerKey&&(fo(this.element),H(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);var t=this.getMap();if(t){this.mapPostrenderListenerKey=Z(t,qa,this.render,this),this.updatePixelPosition();var e=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();this.insertFirst?e.insertBefore(this.element,e.childNodes[0]||null):e.appendChild(this.element),this.performAutoPan()}},e.prototype.render=function(){this.updatePixelPosition()},e.prototype.handleOffsetChanged=function(){this.updatePixelPosition()},e.prototype.handlePositionChanged=function(){this.updatePixelPosition(),this.performAutoPan()},e.prototype.handlePositioningChanged=function(){this.updatePixelPosition()},e.prototype.setElement=function(t){this.set(ru,t)},e.prototype.setMap=function(t){this.set(nu,t)},e.prototype.setOffset=function(t){this.set(iu,t)},e.prototype.setPosition=function(t){this.set(ou,t)},e.prototype.performAutoPan=function(){this.autoPan&&this.panIntoView(this.autoPan)},e.prototype.panIntoView=function(t){var e=this.getMap();if(e&&e.getTargetElement()&&this.get(ou)){var r=this.getRect(e.getTargetElement(),e.getSize()),n=this.getElement(),i=this.getRect(n,[co(n),ho(n)]),o=t||{},a=void 0===o.margin?20:o.margin;if(!te(r,i)){var s=i[0]-r[0],l=r[2]-i[2],u=i[1]-r[1],c=r[3]-i[3],h=[0,0];if(s<0?h[0]=s-a:l<0&&(h[0]=Math.abs(l)+a),u<0?h[1]=u-a:c<0&&(h[1]=Math.abs(c)+a),0!==h[0]||0!==h[1]){var p=e.getView().getCenterInternal(),f=e.getPixelFromCoordinateInternal(p);if(!f)return;var d=[f[0]+h[0],f[1]+h[1]],g=o.animation||{};e.getView().animateInternal({center:e.getCoordinateFromPixelInternal(d),duration:g.duration,easing:g.easing})}}}},e.prototype.getRect=function(t,e){var r=t.getBoundingClientRect(),n=r.left+window.pageXOffset,i=r.top+window.pageYOffset;return[n,i,n+e[0],i+e[1]]},e.prototype.setPositioning=function(t){this.set(au,t)},e.prototype.setVisible=function(t){this.rendered.visible!==t&&(this.element.style.display=t?"":"none",this.rendered.visible=t)},e.prototype.updatePixelPosition=function(){var t=this.getMap(),e=this.getPosition();if(t&&t.isRendered()&&e){var r=t.getPixelFromCoordinate(e),n=t.getSize();this.updateRenderedPosition(r,n)}else this.setVisible(!1)},e.prototype.updateRenderedPosition=function(t,e){var r=this.element.style,n=this.getOffset(),i=this.getPositioning();this.setVisible(!0);var o=Math.round(t[0]+n[0])+"px",a=Math.round(t[1]+n[1])+"px",s="0%",l="0%";i==Zl||i==$l||i==tu?s="-100%":i!=Xl&&i!=Hl&&i!=Ql||(s="-50%"),i==ql||i==Xl||i==Zl?l="-100%":i!=Kl&&i!=Hl&&i!=$l||(l="-50%");var u="translate("+s+", "+l+") translate("+o+", "+a+")";this.rendered.transform_!=u&&(this.rendered.transform_=u,r.transform=u,r.msTransform=u)},e.prototype.getOptions=function(){return this.options},e}(ot),lu=function(){function t(t){this.highWaterMark=void 0!==t?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}return t.prototype.canExpireCache=function(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark},t.prototype.clear=function(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null},t.prototype.containsKey=function(t){return this.entries_.hasOwnProperty(t)},t.prototype.forEach=function(t){for(var e=this.oldest_;e;)t(e.value_,e.key_,this),e=e.newer},t.prototype.get=function(t,e){var r=this.entries_[t];return pt(void 0!==r,15),r===this.newest_||(r===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(r.newer.older=r.older,r.older.newer=r.newer),r.newer=null,r.older=this.newest_,this.newest_.newer=r,this.newest_=r),r.value_},t.prototype.remove=function(t){var e=this.entries_[t];return pt(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_),r=0;for(t=this.newest_;t;t=t.older)e[r++]=t.key_;return e},t.prototype.getValues=function(){var t,e=new Array(this.count_),r=0;for(t=this.newest_;t;t=t.older)e[r++]=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){pt(!(t in this.entries_),16);var r={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=r:this.oldest_=r,this.newest_=r,this.entries_[t]=r,++this.count_},t.prototype.setSize=function(t){this.highWaterMark=t},t}();function uu(t,e,r,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=r,n):[t,e,r]}function cu(t,e,r){return t+"/"+e+"/"+r}function hu(t){return cu(t[0],t[1],t[2])}function pu(t){return t.split("/").map(Number)}function fu(t){return(t[1]<r||r>e.getMaxZoom())return!1;var o=e.getFullTileRange(r);return!o||o.containsXY(n,i)}var gu=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),yu=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return gu(e,t),e.prototype.expireCache=function(t){for(;this.canExpireCache();){if(this.peekLast().getKey()in t)break;this.pop().release()}},e.prototype.pruneExceptNewestZ=function(){if(0!==this.getCount()){var t=pu(this.peekFirstKey())[0];this.forEach(function(e){e.tileCoord[0]!==t&&(this.remove(hu(e.tileCoord)),e.release())}.bind(this))}},e}(lu),mu=function(){function t(t,e,r,n){this.minX=t,this.maxX=e,this.minY=r,this.maxY=n}return t.prototype.contains=function(t){return this.containsXY(t[1],t[2])},t.prototype.containsTileRange=function(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY},t.prototype.containsXY=function(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY},t.prototype.equals=function(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY},t.prototype.extend=function(t){t.minXthis.maxX&&(this.maxX=t.maxX),t.minYthis.maxY&&(this.maxY=t.maxY)},t.prototype.getHeight=function(){return this.maxY-this.minY+1},t.prototype.getSize=function(){return[this.getWidth(),this.getHeight()]},t.prototype.getWidth=function(){return this.maxX-this.minX+1},t.prototype.intersects=function(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY},t}();function vu(t,e,r,n,i){return void 0!==i?(i.minX=t,i.maxX=e,i.minY=r,i.maxY=n,i):new mu(t,e,r,n)}var _u=mu,bu=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),xu=[],wu=function(t){function e(e,r,n,i){var o=t.call(this,e,r,{transition:0})||this;return o.context_={},o.executorGroups={},o.declutterExecutorGroups={},o.loadingSourceTiles=0,o.errorSourceTileKeys={},o.hitDetectionImageData={},o.replayState_={},o.sourceTiles=null,o.wantedResolution,o.getSourceTiles=i.bind(void 0,o),o.sourceZ=-1,o.hifi=!1,o.wrappedTileCoord=n,o}return bu(e,t),e.prototype.getContext=function(t){var e=o(t);return e in this.context_||(this.context_[e]=uo(1,1,xu)),this.context_[e]},e.prototype.hasContext=function(t){return o(t)in this.context_},e.prototype.getImage=function(t){return this.hasContext(t)?this.getContext(t).canvas:null},e.prototype.getReplayState=function(t){var e=o(t);return e in this.replayState_||(this.replayState_[e]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedZ:-1,renderedTileZ:-1}),this.replayState_[e]},e.prototype.load=function(){this.getSourceTiles()},e.prototype.release=function(){for(var e in this.context_)xu.push(this.context_[e].canvas),delete this.context_[e];t.prototype.release.call(this)},e}(lo),Su=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Eu=function(t){function e(e,r,n,i,o,a){var s=t.call(this,e,r,a)||this;return s.extent=null,s.format_=i,s.features_=null,s.loader_,s.projection=null,s.resolution,s.tileLoadFunction_=o,s.url_=n,s.key=n,s}return Su(e,t),e.prototype.getFormat=function(){return this.format_},e.prototype.getFeatures=function(){return this.features_},e.prototype.load=function(){this.state==Ji&&(this.setState(Qi),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))},e.prototype.onLoad=function(t,e){this.setFeatures(t)},e.prototype.onError=function(){this.setState(eo)},e.prototype.setFeatures=function(t){this.features_=t,this.setState(to)},e.prototype.setLoader=function(t){this.loader_=t},e}(lo);function Tu(t){return Array.isArray(t)?Ro(t):t}var Cu="arraybuffer",Ou="json",Pu="text",Ru="xml",Iu=!1;function Lu(t,e,r,n,i,o,a){var s=new XMLHttpRequest;s.open("GET","function"==typeof t?t(r,n,i):t,!0),e.getType()==Cu&&(s.responseType="arraybuffer"),s.withCredentials=Iu,s.onload=function(t){if(!s.status||s.status>=200&&s.status<300){var n=e.getType(),l=void 0;n==Ou||n==Pu?l=s.responseText:n==Ru?(l=s.responseXML)||(l=(new DOMParser).parseFromString(s.responseText,"application/xml")):n==Cu&&(l=s.response),l?o(e.readFeatures(l,{extent:r,featureProjection:i}),e.readProjection(l)):a()}else a()},s.onerror=a,s.send()}function Mu(t,e){return function(r,n,i,o,a){var s=this;Lu(t,e,r,n,i,(function(t,e){void 0!==o&&o(t),s.addFeatures(t)}),a||T)}}function Fu(t,e){return[[-1/0,-1/0,1/0,1/0]]}function Au(t,e,r,n){var i=document.createElement("script"),a="olc_"+o(e);function s(){delete window[a],i.parentNode.removeChild(i)}i.async=!0,i.src=t+(-1==t.indexOf("?")?"?":"&")+(n||"callback")+"="+a;var l=setTimeout((function(){s(),r&&r()}),1e4);window[a]=function(t){clearTimeout(l),s(),e(t)},document.getElementsByTagName("head")[0].appendChild(i)}var ku=function(){function t(){}return t.prototype.drawCustom=function(t,e,r){},t.prototype.drawGeometry=function(t){},t.prototype.setStyle=function(t){},t.prototype.drawCircle=function(t,e){},t.prototype.drawFeature=function(t,e){},t.prototype.drawGeometryCollection=function(t,e){},t.prototype.drawLineString=function(t,e){},t.prototype.drawMultiLineString=function(t,e){},t.prototype.drawMultiPoint=function(t,e){},t.prototype.drawMultiPolygon=function(t,e){},t.prototype.drawPoint=function(t,e){},t.prototype.drawPolygon=function(t,e){},t.prototype.drawText=function(t,e){},t.prototype.setFillStrokeStyle=function(t,e){},t.prototype.setImageStyle=function(t,e){},t.prototype.setTextStyle=function(t,e){},t}(),ju=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Nu=function(t){function e(e,r,n,i,o,a,s){var l=t.call(this)||this;return l.context_=e,l.pixelRatio_=r,l.extent_=n,l.transform_=i,l.viewRotation_=o,l.squaredTolerance_=a,l.userTransform_=s,l.contextFillState_=null,l.contextStrokeState_=null,l.contextTextState_=null,l.fillState_=null,l.strokeState_=null,l.image_=null,l.imageAnchorX_=0,l.imageAnchorY_=0,l.imageHeight_=0,l.imageOpacity_=0,l.imageOriginX_=0,l.imageOriginY_=0,l.imageRotateWithView_=!1,l.imageRotation_=0,l.imageScale_=[0,0],l.imageWidth_=0,l.text_="",l.textOffsetX_=0,l.textOffsetY_=0,l.textRotateWithView_=!1,l.textRotation_=0,l.textScale_=[0,0],l.textFillState_=null,l.textStrokeState_=null,l.textState_=null,l.pixelCoordinates_=[],l.tmpLocalTransform_=[1,0,0,1,0,0],l}return ju(e,t),e.prototype.drawImages_=function(t,e,r,n){if(this.image_){var i=ln(t,e,r,2,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.tmpLocalTransform_,s=o.globalAlpha;1!=this.imageOpacity_&&(o.globalAlpha=s*this.imageOpacity_);var l=this.imageRotation_;this.imageRotateWithView_&&(l+=this.viewRotation_);for(var u=0,c=i.length;u2||Math.abs(t[4*e+3]-191.25)>2}function tc(t,e,r,n){var i=Hr(r,e,t),o=zr(e,n,r),a=e.getMetersPerUnit();void 0!==a&&(o*=a);var s=t.getMetersPerUnit();void 0!==s&&(o/=s);var l=t.getExtent();if(!l||Qt(l,i)){var u=zr(t,o,i)/o;isFinite(u)&&u>0&&(o/=u)}return o}function ec(t,e,r,n){var i=xe(r),o=tc(t,e,i,n);return(!isFinite(o)||o<=0)&&me(r,(function(r){return o=tc(t,e,r,n),isFinite(o)&&o>0})),o}function rc(t,e,r,n,i,o,a,s,l,u,c,h){var p=uo(Math.round(r*t),Math.round(r*e));if(O(p,h),0===l.length)return p.canvas;function f(t){return Math.round(t*r)/r}p.scale(r,r),p.globalCompositeOperation="lighter";var d=[1/0,1/0,-1/0,-1/0];l.forEach((function(t,e,r){he(d,t.extent)}));var g=Pe(d),y=Ee(d),m=uo(Math.round(r*g/n),Math.round(r*y/n));O(m,h);var v=r/n;l.forEach((function(t,e,r){var n=t.extent[0]-d[0],i=-(t.extent[3]-d[3]),o=Pe(t.extent),a=Ee(t.extent);t.image.width>0&&t.image.height>0&&m.drawImage(t.image,u,u,t.image.width-2*u,t.image.height-2*u,n*v,i*v,o*v,a*v)}));var _=Ce(a);return s.getTriangles().forEach((function(t,e,i){var a=t.source,s=t.target,l=a[0][0],u=a[0][1],c=a[1][0],g=a[1][1],y=a[2][0],v=a[2][1],b=f((s[0][0]-_[0])/o),x=f(-(s[0][1]-_[1])/o),w=f((s[1][0]-_[0])/o),S=f(-(s[1][1]-_[1])/o),E=f((s[2][0]-_[0])/o),T=f(-(s[2][1]-_[1])/o),C=l,O=u;l=0,u=0;var P=Be([[c-=C,g-=O,0,0,w-b],[y-=C,v-=O,0,0,E-b],[0,0,c,g,S-x],[0,0,y,v,T-x]]);if(P){if(p.save(),p.beginPath(),function(){if(void 0===Hu){var t=document.createElement("canvas").getContext("2d");t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",Ju(t,4,5,4,0),Ju(t,4,5,0,5);var e=t.getImageData(0,0,3,3).data;Hu=Qu(e,0)||Qu(e,4)||Qu(e,8)}return Hu}()||h===$u){p.moveTo(w,S);for(var R=b-w,I=x-S,L=0;L<4;L++)p.lineTo(w+f((L+1)*R/4),S+f(L*I/3)),3!=L&&p.lineTo(w+f((L+1)*R/4),S+f((L+1)*I/3));p.lineTo(E,T)}else p.moveTo(w,S),p.lineTo(b,x),p.lineTo(E,T);p.clip(),p.transform(P[0],P[2],P[1],P[3],b,x),p.translate(d[0]-C,d[3]-O),p.scale(n/r,-n/r),p.drawImage(m.canvas,0,0),p.restore()}})),c&&(p.save(),p.globalCompositeOperation="source-over",p.strokeStyle="black",p.lineWidth=1,s.getTriangles().forEach((function(t,e,r){var n=t.target,i=(n[0][0]-_[0])/o,a=-(n[0][1]-_[1])/o,s=(n[1][0]-_[0])/o,l=-(n[1][1]-_[1])/o,u=(n[2][0]-_[0])/o,c=-(n[2][1]-_[1])/o;p.beginPath(),p.moveTo(s,l),p.lineTo(i,a),p.lineTo(u,c),p.closePath(),p.stroke()})),p.restore()),p.canvas}var nc=[0,0,0],ic=function(){function t(t){var e;if(this.minZoom=void 0!==t.minZoom?t.minZoom:0,this.resolutions_=t.resolutions,pt(w(this.resolutions_,(function(t,e){return e-t}),!0),17),!t.origins)for(var r=0,n=this.resolutions_.length-1;r=this.minZoom;){if(e(s,2===this.zoomFactor_?vu(i=Math.floor(i/2),i,o=Math.floor(o/2),o,r):this.getTileRangeForExtentAndZ(a,s,r)))return!0;--s}return!1},t.prototype.getExtent=function(){return this.extent_},t.prototype.getMaxZoom=function(){return this.maxZoom},t.prototype.getMinZoom=function(){return this.minZoom},t.prototype.getOrigin=function(t){return this.origin_?this.origin_:this.origins_[t]},t.prototype.getResolution=function(t){return this.resolutions_[t]},t.prototype.getResolutions=function(){return this.resolutions_},t.prototype.getTileCoordChildTileRange=function(t,e,r){if(t[0]0?n:Math.max(a/s[0],o/s[1]),u=i+1,c=new Array(u),h=0;h=0;o--)this.postProcessPasses_[o].init(t);e.bindTexture(e.TEXTURE_2D,null),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.enable(e.BLEND),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA),e.useProgram(this.currentProgram_),this.applyFrameState(t),this.applyUniforms(t)},e.prototype.prepareDrawToRenderTarget=function(t,e,r){var n=this.getGL(),i=e.getSize();n.bindFramebuffer(n.FRAMEBUFFER,e.getFramebuffer()),n.viewport(0,0,i[0],i[1]),n.bindTexture(n.TEXTURE_2D,e.getTexture()),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.enable(n.BLEND),n.blendFunc(n.ONE,r?n.ZERO:n.ONE_MINUS_SRC_ALPHA),n.useProgram(this.currentProgram_),this.applyFrameState(t),this.applyUniforms(t)},e.prototype.drawElements=function(t,e){var r=this.getGL(),n=r.UNSIGNED_INT,i=e-t,o=4*t;r.drawElements(r.TRIANGLES,i,n,o)},e.prototype.finalizeDraw=function(t){for(var e=0;ethis.size_[0]||e>=this.size_[1])return yh[0]=0,yh[1]=0,yh[2]=0,yh[3]=0,yh;this.readAll();var r=Math.floor(t)+(this.size_[1]-Math.floor(e)-1)*this.size_[0];return yh[0]=this.data_[4*r],yh[1]=this.data_[4*r+1],yh[2]=this.data_[4*r+2],yh[3]=this.data_[4*r+3],yh},t.prototype.getTexture=function(){return this.texture_},t.prototype.getFramebuffer=function(){return this.framebuffer_},t.prototype.updateSize_=function(){var t=this.size_,e=this.helper_.getGL();this.texture_=this.helper_.createTexture(t,null,this.texture_),e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer_),e.viewport(0,0,t[0],t[1]),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this.texture_,0),this.data_=new Uint8Array(t[0]*t[1]*4)},t}(),vh=1,_h=2,bh=4,xh=8,wh=16,Sh=31,Eh={};function Th(t){if("number"==typeof t)return vh;if("boolean"==typeof t)return xh;if("string"==typeof t)return Io(t)?bh|_h:_h;if(!Array.isArray(t))throw new Error("Unhandled value type: "+JSON.stringify(t));var e=t;if(e.every((function(t){return"number"==typeof t})))return 3===e.length||4===e.length?bh|wh:wh;if("string"!=typeof e[0])throw new Error("Expected an expression operator but received: "+JSON.stringify(e));var r=Eh[e[0]];if(void 0===r)throw new Error("Unrecognized expression operator: "+JSON.stringify(e));return r.getReturnType(e.slice(1))}function Ch(t){return Math.log2(t)%1==0}function Oh(t){var e=t.toString();return-1===e.indexOf(".")?e+".0":e}function Ph(t){if(t.length<2||t.length>4)throw new Error("`formatArray` can only output `vec2`, `vec3` or `vec4` arrays.");return"vec"+t.length+"("+t.map(Oh).join(", ")+")"}function Rh(t){var e=Oo(t).slice();return e.length<4&&e.push(1),Ph(e.map((function(t,e){return e<3?t/255:t})))}function Ih(t,e){return void 0===t.stringLiteralsMap[e]&&(t.stringLiteralsMap[e]=Object.keys(t.stringLiteralsMap).length),t.stringLiteralsMap[e]}function Lh(t,e){return Oh(Ih(t,e))}function Mh(t,e,r){if(Array.isArray(e)&&"string"==typeof e[0]){var n=Eh[e[0]];if(void 0===n)throw new Error("Unrecognized expression operator: "+JSON.stringify(e));return n.toGlsl(t,e.slice(1),r)}var i=Th(e);return(i&vh)>0?Oh(e):(i&xh)>0?e.toString():(i&_h)>0&&(void 0===r||r==_h)?Lh(t,e.toString()):(i&bh)>0&&(void 0===r||r==bh)?Rh(e):(i&wh)>0?Ph(e):void 0}function Fh(t){if(!(Th(t)&vh))throw new Error("A numeric value was expected, got "+JSON.stringify(t)+" instead")}function Ah(t){for(var e=0;ee)throw new Error("At most "+e+" arguments were expected, got "+t.length+" instead")}function zh(t){if(t.length%2!=0)throw new Error("An even amount of arguments was expected, got "+t+" instead")}function Uh(t,e){if(!Ch(e))throw new Error("Could not infer only one type from the following expression: "+JSON.stringify(t))}function Bh(t){return{getReturnType:function(t){return xh},toGlsl:function(e,r){Nh(r,2);for(var n=Sh,i=0;i"]={getReturnType:function(t){return xh},toGlsl:function(t,e){return Nh(e,2),Ah(e),"("+Mh(t,e[0])+" > "+Mh(t,e[1])+")"}},Eh[">="]={getReturnType:function(t){return xh},toGlsl:function(t,e){return Nh(e,2),Ah(e),"("+Mh(t,e[0])+" >= "+Mh(t,e[1])+")"}},Eh["<"]={getReturnType:function(t){return xh},toGlsl:function(t,e){return Nh(e,2),Ah(e),"("+Mh(t,e[0])+" < "+Mh(t,e[1])+")"}},Eh["<="]={getReturnType:function(t){return xh},toGlsl:function(t,e){return Nh(e,2),Ah(e),"("+Mh(t,e[0])+" <= "+Mh(t,e[1])+")"}},Eh["=="]=Bh("=="),Eh["!="]=Bh("!="),Eh["!"]={getReturnType:function(t){return xh},toGlsl:function(t,e){return Nh(e,1),jh(e[0]),"(!"+Mh(t,e[0])+")"}},Eh.all=Vh("&&"),Eh.any=Vh("||"),Eh.between={getReturnType:function(t){return xh},toGlsl:function(t,e){Nh(e,3),Ah(e);var r=Mh(t,e[1]),n=Mh(t,e[2]),i=Mh(t,e[0]);return"("+i+" >= "+r+" && "+i+" <= "+n+")"}},Eh.array={getReturnType:function(t){return wh},toGlsl:function(t,e){Dh(e,2),Gh(e,4),Ah(e);var r=e.map((function(e){return Mh(t,e,vh)}));return"vec"+e.length+"("+r.join(", ")+")"}},Eh.color={getReturnType:function(t){return bh},toGlsl:function(t,e){Dh(e,3),Gh(e,4),Ah(e);var r=e;3===e.length&&r.push(1);var n=e.map((function(e,r){return Mh(t,e,vh)+(r<3?" / 255.0":"")}));return"vec"+e.length+"("+n.join(", ")+")"}},Eh.interpolate={getReturnType:function(t){for(var e=bh|vh,r=3;r=1;l-=2){s="("+o+" == "+Mh(t,e[l])+" ? "+Mh(t,e[l+1],i)+" : "+(s||a)+")"}return s}},Eh.case={getReturnType:function(t){for(var e=Sh,r=1;r=0;o-=2){s="("+Mh(t,e[o])+" ? "+Mh(t,e[o+1],i)+" : "+(s||a)+")"}return s}};var Yh=function(){function t(){this.uniforms=[],this.attributes=[],this.varyings=[],this.sizeExpression="vec2(1.0)",this.rotationExpression="0.0",this.offsetExpression="vec2(0.0)",this.colorExpression="vec4(1.0)",this.texCoordExpression="vec4(0.0, 0.0, 1.0, 1.0)",this.discardExpression="false",this.rotateWithView=!1}return t.prototype.addUniform=function(t){return this.uniforms.push(t),this},t.prototype.addAttribute=function(t){return this.attributes.push(t),this},t.prototype.addVarying=function(t,e,r){return this.varyings.push({name:t,type:e,expression:r}),this},t.prototype.setSizeExpression=function(t){return this.sizeExpression=t,this},t.prototype.setRotationExpression=function(t){return this.rotationExpression=t,this},t.prototype.setSymbolOffsetExpression=function(t){return this.offsetExpression=t,this},t.prototype.setColorExpression=function(t){return this.colorExpression=t,this},t.prototype.setTextureCoordinateExpression=function(t){return this.texCoordExpression=t,this},t.prototype.setFragmentDiscardExpression=function(t){return this.discardExpression=t,this},t.prototype.setSymbolRotateWithView=function(t){return this.rotateWithView=t,this},t.prototype.getSizeExpression=function(){return this.sizeExpression},t.prototype.getOffsetExpression=function(){return this.offsetExpression},t.prototype.getColorExpression=function(){return this.colorExpression},t.prototype.getTextureCoordinateExpression=function(){return this.texCoordExpression},t.prototype.getFragmentDiscardExpression=function(){return this.discardExpression},t.prototype.getSymbolVertexShader=function(t){var e=this.rotateWithView?"u_offsetScaleMatrix * u_offsetRotateMatrix":"u_offsetScaleMatrix",r=this.attributes,n=this.varyings;return t&&(r=r.concat("vec4 a_hitColor"),n=n.concat({name:"v_hitColor",type:"vec4",expression:"a_hitColor"})),"precision mediump float;\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_offsetScaleMatrix;\nuniform mat4 u_offsetRotateMatrix;\nuniform float u_time;\nuniform float u_zoom;\nuniform float u_resolution;\n"+this.uniforms.map((function(t){return"uniform "+t+";"})).join("\n")+"\nattribute vec2 a_position;\nattribute float a_index;\n"+r.map((function(t){return"attribute "+t+";"})).join("\n")+"\nvarying vec2 v_texCoord;\nvarying vec2 v_quadCoord;\n"+n.map((function(t){return"varying "+t.type+" "+t.name+";"})).join("\n")+"\nvoid main(void) {\n mat4 offsetMatrix = "+e+";\n vec2 halfSize = "+this.sizeExpression+" * 0.5;\n vec2 offset = "+this.offsetExpression+";\n float angle = "+this.rotationExpression+";\n float offsetX;\n float offsetY;\n if (a_index == 0.0) {\n offsetX = (offset.x - halfSize.x) * cos(angle) + (offset.y - halfSize.y) * sin(angle);\n offsetY = (offset.y - halfSize.y) * cos(angle) - (offset.x - halfSize.x) * sin(angle);\n } else if (a_index == 1.0) {\n offsetX = (offset.x + halfSize.x) * cos(angle) + (offset.y - halfSize.y) * sin(angle);\n offsetY = (offset.y - halfSize.y) * cos(angle) - (offset.x + halfSize.x) * sin(angle);\n } else if (a_index == 2.0) {\n offsetX = (offset.x + halfSize.x) * cos(angle) + (offset.y + halfSize.y) * sin(angle);\n offsetY = (offset.y + halfSize.y) * cos(angle) - (offset.x + halfSize.x) * sin(angle);\n } else {\n offsetX = (offset.x - halfSize.x) * cos(angle) + (offset.y + halfSize.y) * sin(angle);\n offsetY = (offset.y + halfSize.y) * cos(angle) - (offset.x - halfSize.x) * sin(angle);\n }\n vec4 offsets = offsetMatrix * vec4(offsetX, offsetY, 0.0, 0.0);\n gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0) + offsets;\n vec4 texCoord = "+this.texCoordExpression+";\n float u = a_index == 0.0 || a_index == 3.0 ? texCoord.s : texCoord.p;\n float v = a_index == 2.0 || a_index == 3.0 ? texCoord.t : texCoord.q;\n v_texCoord = vec2(u, v);\n u = a_index == 0.0 || a_index == 3.0 ? 0.0 : 1.0;\n v = a_index == 2.0 || a_index == 3.0 ? 0.0 : 1.0;\n v_quadCoord = vec2(u, v);\n"+n.map((function(t){return" "+t.name+" = "+t.expression+";"})).join("\n")+"\n}"},t.prototype.getSymbolFragmentShader=function(t){var e=t?" if (gl_FragColor.a < 0.1) { discard; } gl_FragColor = v_hitColor;":"",r=this.varyings;return t&&(r=r.concat({name:"v_hitColor",type:"vec4",expression:"a_hitColor"})),"precision mediump float;\nuniform float u_time;\nuniform float u_zoom;\nuniform float u_resolution;\n"+this.uniforms.map((function(t){return"uniform "+t+";"})).join("\n")+"\nvarying vec2 v_texCoord;\nvarying vec2 v_quadCoord;\n"+r.map((function(t){return"varying "+t.type+" "+t.name+";"})).join("\n")+"\nvoid main(void) {\n if ("+this.discardExpression+") { discard; }\n gl_FragColor = "+this.colorExpression+";\n gl_FragColor.rgb *= gl_FragColor.a;\n"+e+"\n}"},t}();function Wh(t){var e=t.symbol,r=void 0!==e.size?e.size:1,n=e.color||"white",i=e.textureCoord||[0,0,1,1],o=e.offset||[0,0],a=void 0!==e.opacity?e.opacity:1,s=void 0!==e.rotation?e.rotation:0,l={inFragmentShader:!1,variables:[],attributes:[],stringLiteralsMap:{}},u=Mh(l,r,wh|vh),c=Mh(l,o,wh),h=Mh(l,i,wh),p=Mh(l,s,vh),f={inFragmentShader:!0,variables:l.variables,attributes:[],stringLiteralsMap:l.stringLiteralsMap},d=Mh(f,n,bh),g=Mh(f,a,vh),y="1.0",m="vec2("+Mh(f,r,wh|vh)+").x";switch(e.symbolType){case"square":case"image":break;case"circle":y="(1.0-smoothstep(1.-4./"+m+",1.,dot(v_quadCoord-.5,v_quadCoord-.5)*4.))";break;case"triangle":var v="(v_quadCoord*2.-1.)",_="(atan("+v+".x,"+v+".y))";y="(1.0-smoothstep(.5-3./"+m+",.5,cos(floor(.5+"+_+"/2.094395102)*2.094395102-"+_+")*length("+v+")))";break;default:throw new Error("Unexpected symbol type: "+e.symbolType)}var b=(new Yh).setSizeExpression("vec2("+u+")").setRotationExpression(p).setSymbolOffsetExpression(c).setTextureCoordinateExpression(h).setSymbolRotateWithView(!!e.rotateWithView).setColorExpression("vec4("+d+".rgb, "+d+".a * "+g+" * "+y+")");if(t.filter){var x=Mh(f,t.filter,xh);b.setFragmentDiscardExpression("!"+x)}var w={};if(f.variables.forEach((function(e){b.addUniform("float u_"+e),w["u_"+e]=function(){if(!t.variables||void 0===t.variables[e])throw new Error("The following variable is missing from the style: "+e);var r=t.variables[e];return"string"==typeof r&&(r=Ih(l,r)),void 0!==r?r:-9999999}})),"image"===e.symbolType&&e.src){var S=new Image;S.src=e.src,b.addUniform("sampler2D u_texture").setColorExpression(b.getColorExpression()+" * texture2D(u_texture, v_texCoord)"),w.u_texture=S}return f.attributes.forEach((function(t){-1===l.attributes.indexOf(t)&&l.attributes.push(t),b.addVarying("v_"+t,"float","a_"+t)})),l.attributes.forEach((function(t){b.addAttribute("float a_"+t)})),{builder:b,attributes:l.attributes.map((function(t){return{name:t,callback:function(e,r){var n=r[t];return"string"==typeof n&&(n=Ih(l,n)),void 0!==n?n:-9999999}}})),uniforms:w}}var qh=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Xh=function(t){function e(e){var r=t.call(this,{extent:e.extent,origin:e.origin,origins:e.origins,resolutions:e.resolutions,tileSize:e.tileSize,tileSizes:e.tileSizes,sizes:e.sizes})||this;return r.matrixIds_=e.matrixIds,r}return qh(e,t),e.prototype.getMatrixId=function(t){return this.matrixIds_[t]},e.prototype.getMatrixIds=function(){return this.matrixIds_},e}(ic),Zh=Xh;function Kh(t,e,r){var n=[],i=[],o=[],a=[],s=[],l=void 0!==r?r:[],u=Gr(t.SupportedCRS),c=u.getMetersPerUnit(),h="ne"==u.getAxisOrientation().substr(0,2);return t.TileMatrix.sort((function(t,e){return e.ScaleDenominator-t.ScaleDenominator})),t.TileMatrix.forEach((function(e){if(!(l.length>0)||_(l,(function(r){return e.Identifier==r.TileMatrix||-1===e.Identifier.indexOf(":")&&t.Identifier+":"+e.Identifier===r.TileMatrix}))){i.push(e.Identifier);var r=28e-5*e.ScaleDenominator/c,u=e.TileWidth,p=e.TileHeight;h?o.push([e.TopLeftCorner[1],e.TopLeftCorner[0]]):o.push(e.TopLeftCorner),n.push(r),a.push(u==p?u:[u,p]),s.push([e.MatrixWidth,e.MatrixHeight])}})),new Xh({extent:e,origins:o,resolutions:n,matrixIds:i,tileSizes:a,sizes:s})}var Hh=function(){function t(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=Is(t.scale),this.displacement_=t.displacement}return t.prototype.clone=function(){var e=this.getScale();return new t({opacity:this.getOpacity(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice()})},t.prototype.getOpacity=function(){return this.opacity_},t.prototype.getRotateWithView=function(){return this.rotateWithView_},t.prototype.getRotation=function(){return this.rotation_},t.prototype.getScale=function(){return this.scale_},t.prototype.getScaleArray=function(){return this.scaleArray_},t.prototype.getDisplacement=function(){return this.displacement_},t.prototype.getAnchor=function(){return n()},t.prototype.getImage=function(t){return n()},t.prototype.getHitDetectionImage=function(){return n()},t.prototype.getPixelRatio=function(t){return 1},t.prototype.getImageState=function(){return n()},t.prototype.getImageSize=function(){return n()},t.prototype.getHitDetectionImageSize=function(){return n()},t.prototype.getOrigin=function(){return n()},t.prototype.getSize=function(){return n()},t.prototype.setOpacity=function(t){this.opacity_=t},t.prototype.setRotateWithView=function(t){this.rotateWithView_=t},t.prototype.setRotation=function(t){this.rotation_=t},t.prototype.setScale=function(t){this.scale_=t,this.scaleArray_=Is(t)},t.prototype.listenImageChange=function(t){n()},t.prototype.load=function(){n()},t.prototype.unlistenImageChange=function(t){n()},t}(),$h=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Jh=function(t){function e(e){var r=this,n=void 0!==e.rotateWithView&&e.rotateWithView;return(r=t.call(this,{opacity:1,rotateWithView:n,rotation:void 0!==e.rotation?e.rotation:0,scale:void 0!==e.scale?e.scale:1,displacement:void 0!==e.displacement?e.displacement:[0,0]})||this).canvas_={},r.hitDetectionCanvas_=null,r.fill_=void 0!==e.fill?e.fill:null,r.origin_=[0,0],r.points_=e.points,r.radius_=void 0!==e.radius?e.radius:e.radius1,r.radius2_=e.radius2,r.angle_=void 0!==e.angle?e.angle:0,r.stroke_=void 0!==e.stroke?e.stroke:null,r.anchor_=null,r.size_=null,r.imageSize_=null,r.hitDetectionImageSize_=null,r.render(),r}return $h(e,t),e.prototype.clone=function(){var t=this.getScale(),r=new e({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice()});return r.setOpacity(this.getOpacity()),r},e.prototype.getAnchor=function(){return this.anchor_},e.prototype.getAngle=function(){return this.angle_},e.prototype.getFill=function(){return this.fill_},e.prototype.getHitDetectionImage=function(){if(!this.hitDetectionCanvas_){var t=this.createRenderOptions();this.createHitDetectionCanvas_(t)}return this.hitDetectionCanvas_},e.prototype.getImage=function(t){if(!this.canvas_[t||1]){var e=this.createRenderOptions(),r=uo(e.size*t||1,e.size*t||1);this.draw_(e,r,0,0,t||1),this.canvas_[t||1]=r.canvas}return this.canvas_[t||1]},e.prototype.getPixelRatio=function(t){return t},e.prototype.getImageSize=function(){return this.imageSize_},e.prototype.getHitDetectionImageSize=function(){return this.hitDetectionImageSize_},e.prototype.getImageState=function(){return ki},e.prototype.getOrigin=function(){return this.origin_},e.prototype.getPoints=function(){return this.points_},e.prototype.getRadius=function(){return this.radius_},e.prototype.getRadius2=function(){return this.radius2_},e.prototype.getSize=function(){return this.size_},e.prototype.getStroke=function(){return this.stroke_},e.prototype.listenImageChange=function(t){},e.prototype.load=function(){},e.prototype.unlistenImageChange=function(t){},e.prototype.createRenderOptions=function(){var t,e="round",r="round",n=0,i=null,o=0,a=0;return this.stroke_&&(null===(t=this.stroke_.getColor())&&(t="#000"),t=Tu(t),void 0===(a=this.stroke_.getWidth())&&(a=1),i=this.stroke_.getLineDash(),o=this.stroke_.getLineDashOffset(),void 0===(r=this.stroke_.getLineJoin())&&(r="round"),void 0===(e=this.stroke_.getLineCap())&&(e="round"),void 0===(n=this.stroke_.getMiterLimit())&&(n=10)),{strokeStyle:t,strokeWidth:a,size:2*(this.radius_+a)+1,lineCap:e,lineDash:i,lineDashOffset:o,lineJoin:r,miterLimit:n}},e.prototype.render=function(){var t=this.createRenderOptions(),e=uo(t.size,t.size);this.draw_(t,e,0,0,1),this.canvas_={},this.canvas_[1]=e.canvas;var r=e.canvas.width,n=r,i=this.getDisplacement();this.hitDetectionImageSize_=[t.size,t.size],this.createHitDetectionCanvas_(t),this.anchor_=[r/2-i[0],r/2+i[1]],this.size_=[r,r],this.imageSize_=[n,n]},e.prototype.draw_=function(t,e,r,n,i){var o,a,s;e.setTransform(i,0,0,i,0,0),e.translate(r,n),e.beginPath();var l=this.points_;if(l===1/0)e.arc(t.size/2,t.size/2,this.radius_,0,2*Math.PI,!0);else{var u=void 0!==this.radius2_?this.radius2_:this.radius_;for(u!==this.radius_&&(l*=2),o=0;o<=l;o++)a=2*o*Math.PI/l-Math.PI/2+this.angle_,s=o%2==0?this.radius_:u,e.lineTo(t.size/2+s*Math.cos(a),t.size/2+s*Math.sin(a))}if(this.fill_){var c=this.fill_.getColor();null===c&&(c="#000"),e.fillStyle=Tu(c),e.fill()}this.stroke_&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,e.setLineDash&&t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke()),e.closePath()},e.prototype.createHitDetectionCanvas_=function(t){if(this.hitDetectionCanvas_=this.getImage(1),this.fill_){var e=this.fill_.getColor(),r=0;if("string"==typeof e&&(e=Oo(e)),null===e?r=1:Array.isArray(e)&&(r=4===e.length?e[3]:1),0===r){var n=uo(t.size,t.size);this.hitDetectionCanvas_=n.canvas,this.drawHitDetectionCanvas_(t,n,0,0)}}},e.prototype.drawHitDetectionCanvas_=function(t,e,r,n){e.translate(r,n),e.beginPath();var i=this.points_;if(i===1/0)e.arc(t.size/2,t.size/2,this.radius_,0,2*Math.PI,!0);else{var o=void 0!==this.radius2_?this.radius2_:this.radius_;o!==this.radius_&&(i*=2);var a=void 0,s=void 0,l=void 0;for(a=0;a<=i;a++)l=2*a*Math.PI/i-Math.PI/2+this.angle_,s=a%2==0?this.radius_:o,e.lineTo(t.size/2+s*Math.cos(l),t.size/2+s*Math.sin(l))}e.fillStyle="#000",e.fill(),this.stroke_&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.stroke()),e.closePath()},e}(Hh),Qh=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),tp=function(t){function e(e){var r=e||{};return t.call(this,{points:1/0,fill:r.fill,radius:r.radius,stroke:r.stroke,scale:void 0!==r.scale?r.scale:1,rotation:void 0!==r.rotation?r.rotation:0,rotateWithView:void 0!==r.rotateWithView&&r.rotateWithView,displacement:void 0!==r.displacement?r.displacement:[0,0]})||this}return Qh(e,t),e.prototype.clone=function(){var t=this.getScale(),r=new e({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice()});return r.setOpacity(this.getOpacity()),r},e.prototype.setRadius=function(t){this.radius_=t,this.render()},e}(Jh),ep=function(){function t(t){var e=t||{};this.color_=void 0!==e.color?e.color:null}return t.prototype.clone=function(){var e=this.getColor();return new t({color:Array.isArray(e)?e.slice():e||void 0})},t.prototype.getColor=function(){return this.color_},t.prototype.setColor=function(t){this.color_=t},t}(),rp="fraction",np="pixels",ip="bottom-left",op="bottom-right",ap="top-left",sp="top-right",lp=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),up=null,cp=function(t){function e(e,r,n,i,o,a){var s=t.call(this)||this;return s.hitDetectionImage_=null,s.image_=e||new Image,null!==i&&(s.image_.crossOrigin=i),s.canvas_={},s.color_=a,s.unlisten_=null,s.imageState_=o,s.size_=n,s.src_=r,s.tainted_,s}return lp(e,t),e.prototype.isTainted_=function(){if(void 0===this.tainted_&&this.imageState_===ki){up||(up=uo(1,1)),up.drawImage(this.image_,0,0);try{up.getImageData(0,0,1,1),this.tainted_=!1}catch(t){up=null,this.tainted_=!0}}return!0===this.tainted_},e.prototype.dispatchChangeEvent_=function(){this.dispatchEvent(F)},e.prototype.handleImageError_=function(){this.imageState_=ji,this.unlistenImage_(),this.dispatchChangeEvent_()},e.prototype.handleImageLoad_=function(){this.imageState_=ki,this.size_?(this.image_.width=this.size_[0],this.image_.height=this.size_[1]):this.size_=[this.image_.width,this.image_.height],this.unlistenImage_(),this.dispatchChangeEvent_()},e.prototype.getImage=function(t){return this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_},e.prototype.getPixelRatio=function(t){return this.replaceColor_(t),this.canvas_[t]?t:1},e.prototype.getImageState=function(){return this.imageState_},e.prototype.getHitDetectionImage=function(){if(!this.hitDetectionImage_)if(this.isTainted_()){var t=this.size_[0],e=this.size_[1],r=uo(t,e);r.fillRect(0,0,t,e),this.hitDetectionImage_=r.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_},e.prototype.getSize=function(){return this.size_},e.prototype.getSrc=function(){return this.src_},e.prototype.load=function(){if(this.imageState_==Fi){this.imageState_=Ai;try{this.image_.src=this.src_}catch(t){this.handleImageError_()}this.unlisten_=Zi(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}},e.prototype.replaceColor_=function(t){if(this.color_&&!this.canvas_[t]){var e=document.createElement("canvas");this.canvas_[t]=e,e.width=Math.ceil(this.image_.width*t),e.height=Math.ceil(this.image_.height*t);var r=e.getContext("2d");if(r.scale(t,t),r.drawImage(this.image_,0,0),r.globalCompositeOperation="multiply","multiply"===r.globalCompositeOperation||this.isTainted_())r.fillStyle=wo(this.color_),r.fillRect(0,0,e.width,e.height),r.globalCompositeOperation="destination-in",r.drawImage(this.image_,0,0);else{for(var n=r.getImageData(0,0,e.width,e.height),i=n.data,o=this.color_[0]/255,a=this.color_[1]/255,s=this.color_[2]/255,l=this.color_[3],u=0,c=i.length;u0,6);var p=void 0!==n.src?Fi:ki;return r.color_=void 0!==n.color?Oo(n.color):null,r.iconImage_=hp(u,h,c,r.crossOrigin_,p,r.color_),r.offset_=void 0!==n.offset?n.offset:[0,0],r.offsetOrigin_=void 0!==n.offsetOrigin?n.offsetOrigin:ap,r.origin_=null,r.size_=void 0!==n.size?n.size:null,r}return fp(e,t),e.prototype.clone=function(){var t=this.getScale();return new e({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,crossOrigin:this.crossOrigin_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,src:this.getSrc(),offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,size:null!==this.size_?this.size_.slice():void 0,opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView()})},e.prototype.getAnchor=function(){if(this.normalizedAnchor_)return this.normalizedAnchor_;var t=this.anchor_,e=this.getSize();if(this.anchorXUnits_==rp||this.anchorYUnits_==rp){if(!e)return null;t=this.anchor_.slice(),this.anchorXUnits_==rp&&(t[0]*=e[0]),this.anchorYUnits_==rp&&(t[1]*=e[1])}if(this.anchorOrigin_!=ap){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),this.anchorOrigin_!=sp&&this.anchorOrigin_!=op||(t[0]=-t[0]+e[0]),this.anchorOrigin_!=ip&&this.anchorOrigin_!=op||(t[1]=-t[1]+e[1])}return this.normalizedAnchor_=t,this.normalizedAnchor_},e.prototype.setAnchor=function(t){this.anchor_=t,this.normalizedAnchor_=null},e.prototype.getColor=function(){return this.color_},e.prototype.getImage=function(t){return this.iconImage_.getImage(t)},e.prototype.getPixelRatio=function(t){return this.iconImage_.getPixelRatio(t)},e.prototype.getImageSize=function(){return this.iconImage_.getSize()},e.prototype.getHitDetectionImageSize=function(){return this.getImageSize()},e.prototype.getImageState=function(){return this.iconImage_.getImageState()},e.prototype.getHitDetectionImage=function(){return this.iconImage_.getHitDetectionImage()},e.prototype.getOrigin=function(){if(this.origin_)return this.origin_;var t=this.offset_,e=this.getDisplacement();if(this.offsetOrigin_!=ap){var r=this.getSize(),n=this.iconImage_.getSize();if(!r||!n)return null;t=t.slice(),this.offsetOrigin_!=sp&&this.offsetOrigin_!=op||(t[0]=n[0]-r[0]-t[0]),this.offsetOrigin_!=ip&&this.offsetOrigin_!=op||(t[1]=n[1]-r[1]-t[1])}return t[0]+=e[0],t[1]+=e[1],this.origin_=t,this.origin_},e.prototype.getSrc=function(){return this.iconImage_.getSrc()},e.prototype.getSize=function(){return this.size_?this.size_:this.iconImage_.getSize()},e.prototype.listenImageChange=function(t){this.iconImage_.addEventListener(F,t)},e.prototype.load=function(){this.iconImage_.load()},e.prototype.unlistenImageChange=function(t){this.iconImage_.removeEventListener(F,t)},e}(Hh),gp=function(){function t(t){var e=t||{};this.color_=void 0!==e.color?e.color:null,this.lineCap_=e.lineCap,this.lineDash_=void 0!==e.lineDash?e.lineDash:null,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.width_=e.width}return t.prototype.clone=function(){var e=this.getColor();return new t({color:Array.isArray(e)?e.slice():e||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})},t.prototype.getColor=function(){return this.color_},t.prototype.getLineCap=function(){return this.lineCap_},t.prototype.getLineDash=function(){return this.lineDash_},t.prototype.getLineDashOffset=function(){return this.lineDashOffset_},t.prototype.getLineJoin=function(){return this.lineJoin_},t.prototype.getMiterLimit=function(){return this.miterLimit_},t.prototype.getWidth=function(){return this.width_},t.prototype.setColor=function(t){this.color_=t},t.prototype.setLineCap=function(t){this.lineCap_=t},t.prototype.setLineDash=function(t){this.lineDash_=t},t.prototype.setLineDashOffset=function(t){this.lineDashOffset_=t},t.prototype.setLineJoin=function(t){this.lineJoin_=t},t.prototype.setMiterLimit=function(t){this.miterLimit_=t},t.prototype.setWidth=function(t){this.width_=t},t}(),yp=function(){function t(t){var e=t||{};this.geometry_=null,this.geometryFunction_=xp,void 0!==e.geometry&&this.setGeometry(e.geometry),this.fill_=void 0!==e.fill?e.fill:null,this.image_=void 0!==e.image?e.image:null,this.renderer_=void 0!==e.renderer?e.renderer:null,this.stroke_=void 0!==e.stroke?e.stroke:null,this.text_=void 0!==e.text?e.text:null,this.zIndex_=e.zIndex}return t.prototype.clone=function(){var e=this.getGeometry();return e&&"object"==typeof e&&(e=e.clone()),new t({geometry:e,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})},t.prototype.getRenderer=function(){return this.renderer_},t.prototype.setRenderer=function(t){this.renderer_=t},t.prototype.getGeometry=function(){return this.geometry_},t.prototype.getGeometryFunction=function(){return this.geometryFunction_},t.prototype.getFill=function(){return this.fill_},t.prototype.setFill=function(t){this.fill_=t},t.prototype.getImage=function(){return this.image_},t.prototype.setImage=function(t){this.image_=t},t.prototype.getStroke=function(){return this.stroke_},t.prototype.setStroke=function(t){this.stroke_=t},t.prototype.getText=function(){return this.text_},t.prototype.setText=function(t){this.text_=t},t.prototype.getZIndex=function(){return this.zIndex_},t.prototype.setGeometry=function(t){"function"==typeof t?this.geometryFunction_=t:"string"==typeof t?this.geometryFunction_=function(e){return e.get(t)}:t?void 0!==t&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=xp,this.geometry_=t},t.prototype.setZIndex=function(t){this.zIndex_=t},t}();function mp(t){var e;if("function"==typeof t)e=t;else{var r;if(Array.isArray(t))r=t;else pt("function"==typeof t.getZIndex,41),r=[t];e=function(){return r}}return e}var vp=null;function _p(t,e){if(!vp){var r=new ep({color:"rgba(255,255,255,0.4)"}),n=new gp({color:"#3399CC",width:1.25});vp=[new yp({image:new tp({fill:r,stroke:n,radius:5}),fill:r,stroke:n})]}return vp}function bp(){var t={},e=[255,255,255,1],r=[0,153,255,1];return t[bt.POLYGON]=[new yp({fill:new ep({color:[255,255,255,.5]})})],t[bt.MULTI_POLYGON]=t[bt.POLYGON],t[bt.LINE_STRING]=[new yp({stroke:new gp({color:e,width:5})}),new yp({stroke:new gp({color:r,width:3})})],t[bt.MULTI_LINE_STRING]=t[bt.LINE_STRING],t[bt.CIRCLE]=t[bt.POLYGON].concat(t[bt.LINE_STRING]),t[bt.POINT]=[new yp({image:new tp({radius:6,fill:new ep({color:r}),stroke:new gp({color:e,width:1.5})}),zIndex:1/0})],t[bt.MULTI_POINT]=t[bt.POINT],t[bt.GEOMETRY_COLLECTION]=t[bt.POLYGON].concat(t[bt.LINE_STRING],t[bt.POINT]),t}function xp(t){return t.getGeometry()}var wp=yp,Sp="point",Ep="line",Tp=function(){function t(t){var e=t||{};this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.scale_=e.scale,this.scaleArray_=Is(void 0!==e.scale?e.scale:1),this.text_=e.text,this.textAlign_=e.textAlign,this.textBaseline_=e.textBaseline,this.fill_=void 0!==e.fill?e.fill:new ep({color:"#333"}),this.maxAngle_=void 0!==e.maxAngle?e.maxAngle:Math.PI/4,this.placement_=void 0!==e.placement?e.placement:Sp,this.overflow_=!!e.overflow,this.stroke_=void 0!==e.stroke?e.stroke:null,this.offsetX_=void 0!==e.offsetX?e.offsetX:0,this.offsetY_=void 0!==e.offsetY?e.offsetY:0,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=void 0===e.padding?null:e.padding}return t.prototype.clone=function(){var e=this.getScale();return new t({font:this.getFont(),placement:this.getPlacement(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(e)?e.slice():e,text:this.getText(),textAlign:this.getTextAlign(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()})},t.prototype.getOverflow=function(){return this.overflow_},t.prototype.getFont=function(){return this.font_},t.prototype.getMaxAngle=function(){return this.maxAngle_},t.prototype.getPlacement=function(){return this.placement_},t.prototype.getOffsetX=function(){return this.offsetX_},t.prototype.getOffsetY=function(){return this.offsetY_},t.prototype.getFill=function(){return this.fill_},t.prototype.getRotateWithView=function(){return this.rotateWithView_},t.prototype.getRotation=function(){return this.rotation_},t.prototype.getScale=function(){return this.scale_},t.prototype.getScaleArray=function(){return this.scaleArray_},t.prototype.getStroke=function(){return this.stroke_},t.prototype.getText=function(){return this.text_},t.prototype.getTextAlign=function(){return this.textAlign_},t.prototype.getTextBaseline=function(){return this.textBaseline_},t.prototype.getBackgroundFill=function(){return this.backgroundFill_},t.prototype.getBackgroundStroke=function(){return this.backgroundStroke_},t.prototype.getPadding=function(){return this.padding_},t.prototype.setOverflow=function(t){this.overflow_=t},t.prototype.setFont=function(t){this.font_=t},t.prototype.setMaxAngle=function(t){this.maxAngle_=t},t.prototype.setOffsetX=function(t){this.offsetX_=t},t.prototype.setOffsetY=function(t){this.offsetY_=t},t.prototype.setPlacement=function(t){this.placement_=t},t.prototype.setRotateWithView=function(t){this.rotateWithView_=t},t.prototype.setFill=function(t){this.fill_=t},t.prototype.setRotation=function(t){this.rotation_=t},t.prototype.setScale=function(t){this.scale_=t,this.scaleArray_=Is(void 0!==t?t:1)},t.prototype.setStroke=function(t){this.stroke_=t},t.prototype.setText=function(t){this.text_=t},t.prototype.setTextAlign=function(t){this.textAlign_=t},t.prototype.setTextBaseline=function(t){this.textBaseline_=t},t.prototype.setBackgroundFill=function(t){this.backgroundFill_=t},t.prototype.setBackgroundStroke=function(t){this.backgroundStroke_=t},t.prototype.setPadding=function(t){this.padding_=t},t}(),Cp=function(){function t(t){this.first_,this.last_,this.head_,this.circular_=void 0===t||t,this.length_=0}return t.prototype.insertItem=function(t){var e={prev:void 0,next:void 0,data:t},r=this.head_;if(r){var n=r.next;e.prev=r,e.next=n,r.next=e,n&&(n.prev=e),r===this.last_&&(this.last_=e)}else this.first_=e,this.last_=e,this.circular_&&(e.next=e,e.prev=e);this.head_=e,this.length_++},t.prototype.removeItem=function(){var t=this.head_;if(t){var e=t.next,r=t.prev;e&&(e.prev=r),r&&(r.next=e),this.head_=e||r,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_=r?this.head_.prev:this.head_),this.length_--}},t.prototype.firstItem=function(){if(this.head_=this.first_,this.head_)return this.head_.data},t.prototype.lastItem=function(){if(this.head_=this.last_,this.head_)return this.head_.data},t.prototype.nextItem=function(){if(this.head_&&this.head_.next)return this.head_=this.head_.next,this.head_.data},t.prototype.getNextItem=function(){if(this.head_&&this.head_.next)return this.head_.next.data},t.prototype.prevItem=function(){if(this.head_&&this.head_.prev)return this.head_=this.head_.prev,this.head_.data},t.prototype.getPrevItem=function(){if(this.head_&&this.head_.prev)return this.head_.prev.data},t.prototype.getCurrItem=function(){if(this.head_)return this.head_.data},t.prototype.setFirstItem=function(){this.circular_&&this.head_&&(this.first_=this.head_,this.last_=this.head_.prev)},t.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}},t.prototype.getLength=function(){return this.length_},t}(),Op=r(1),Pp=r.n(Op),Rp=function(){function t(t){this.rbush_=new Pp.a(t),this.items_={}}return t.prototype.insert=function(t,e){var r={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(r),this.items_[o(e)]=r},t.prototype.load=function(t,e){for(var r=new Array(e.length),n=0,i=e.length;nthis.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]-m>this.sourceWorldWidth_/2&&(e[0][0]-=this.sourceWorldWidth_),e[1][0]-m>this.sourceWorldWidth_/2&&(e[1][0]-=this.sourceWorldWidth_),e[2][0]-m>this.sourceWorldWidth_/2&&(e[2][0]-=this.sourceWorldWidth_);var r=Math.min(e[0][0],e[1][0],e[2][0]);Math.max(e[0][0],e[1][0],e[2][0])-r.5&&c<1,f=!1;if(l>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_)f=Pe(Kt([t,e,r,n]))/this.targetWorldWidth_>.25||f;!p&&this.sourceProj_.isGlobal()&&c&&(f=c>.25||f)}if(!(!f&&this.maxSourceExtent_&&isFinite(u[0])&&isFinite(u[1])&&isFinite(u[2])&&isFinite(u[3]))||Re(u,this.maxSourceExtent_)){var d=0;if(!(f||isFinite(i[0])&&isFinite(i[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(a[0])&&isFinite(a[1])&&isFinite(s[0])&&isFinite(s[1])))if(l>0)f=!0;else if(1!=(d=(isFinite(i[0])&&isFinite(i[1])?0:8)+(isFinite(o[0])&&isFinite(o[1])?0:4)+(isFinite(a[0])&&isFinite(a[1])?0:2)+(isFinite(s[0])&&isFinite(s[1])?0:1))&&2!=d&&4!=d&&8!=d)return;if(l>0){if(!f){var g=[(t[0]+r[0])/2,(t[1]+r[1])/2],y=this.transformInv_(g),m=void 0;if(p)m=(We(i[0],h)+We(a[0],h))/2-We(y[0],h);else m=(i[0]+a[0])/2-y[0];var v=(i[1]+a[1])/2-y[1];f=m*m+v*v>this.errorThresholdSquared_}if(f){if(Math.abs(t[0]-r[0])<=Math.abs(t[1]-r[1])){var _=[(e[0]+r[0])/2,(e[1]+r[1])/2],b=this.transformInv_(_),x=[(n[0]+t[0])/2,(n[1]+t[1])/2],w=this.transformInv_(x);this.addQuad_(t,e,_,x,i,o,b,w,l-1),this.addQuad_(x,_,r,n,w,b,a,s,l-1)}else{var S=[(t[0]+e[0])/2,(t[1]+e[1])/2],E=this.transformInv_(S),T=[(r[0]+n[0])/2,(r[1]+n[1])/2],C=this.transformInv_(T);this.addQuad_(t,S,T,n,i,E,C,s,l-1),this.addQuad_(S,e,r,T,E,o,a,C,l-1)}return}}if(p){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}0==(11&d)&&this.addTriangle_(t,r,n,i,a,s),0==(14&d)&&this.addTriangle_(t,r,e,i,a,o),d&&(0==(13&d)&&this.addTriangle_(e,n,t,o,s,i),0==(7&d)&&this.addTriangle_(e,n,r,o,s,a))}},t.prototype.calculateSourceExtent=function(){var t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach((function(e,r,n){var i=e.source;pe(t,i[0]),pe(t,i[1]),pe(t,i[2])})),t},t.prototype.getTriangles=function(){return this.triangles_},t}(),Lp=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Mp=function(t){function e(e,r,n,i,o,a,s,l,u,c,h,p){var f=t.call(this,o,Ji)||this;f.renderEdges_=void 0!==h&&h,f.contextOptions_=p,f.pixelRatio_=s,f.gutter_=l,f.canvas_=null,f.sourceTileGrid_=r,f.targetTileGrid_=i,f.wrappedTileCoord_=a||o,f.sourceTiles_=[],f.sourcesListenerKeys_=null,f.sourceZ_=0;var d=i.getTileCoordExtent(f.wrappedTileCoord_),g=f.targetTileGrid_.getExtent(),y=f.sourceTileGrid_.getExtent(),m=g?Te(d,g):d;if(0===ve(m))return f.state=ro,f;var v=e.getExtent();v&&(y=y?Te(y,v):v);var _=i.getResolution(f.wrappedTileCoord_[0]),b=ec(e,n,m,_);if(!isFinite(b)||b<=0)return f.state=ro,f;var x=void 0!==c?c:.5;if(f.triangulation_=new Ip(e,n,m,y,b*x,_),0===f.triangulation_.getTriangles().length)return f.state=ro,f;f.sourceZ_=r.getZForResolution(b);var w=f.triangulation_.calculateSourceExtent();if(y&&(e.canWrapX()?(w[1]=Ne(w[1],y[1],y[3]),w[3]=Ne(w[3],y[1],y[3])):w=Te(w,y)),ve(w)){for(var S=r.getTileRangeForExtentAndZ(w,f.sourceZ_),E=S.minX;E<=S.maxX;E++)for(var T=S.minY;T<=S.maxY;T++){var C=u(f.sourceZ_,E,T,s);C&&f.sourceTiles_.push(C)}0===f.sourceTiles_.length&&(f.state=ro)}else f.state=ro;return f}return Lp(e,t),e.prototype.getImage=function(){return this.canvas_},e.prototype.reproject_=function(){var t=[];if(this.sourceTiles_.forEach(function(e,r,n){e&&e.getState()==to&&t.push({extent:this.sourceTileGrid_.getTileCoordExtent(e.tileCoord),image:e.getImage()})}.bind(this)),this.sourceTiles_.length=0,0===t.length)this.state=eo;else{var e=this.wrappedTileCoord_[0],r=this.targetTileGrid_.getTileSize(e),n="number"==typeof r?r:r[0],i="number"==typeof r?r:r[1],o=this.targetTileGrid_.getResolution(e),a=this.sourceTileGrid_.getResolution(this.sourceZ_),s=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=rc(n,i,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,s,this.triangulation_,t,this.gutter_,this.renderEdges_,this.contextOptions_),this.state=to}this.changed()},e.prototype.load=function(){if(this.state==Ji){this.state=Qi,this.changed();var t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(function(e,r,n){var i=e.getState();if(i==Ji||i==Qi){t++;var o=Z(e,F,(function(r){var n=e.getState();n!=to&&n!=eo&&n!=ro||(H(o),0===--t&&(this.unlistenSources_(),this.reproject_()))}),this);this.sourcesListenerKeys_.push(o)}}.bind(this)),this.sourceTiles_.forEach((function(t,e,r){t.getState()==Ji&&t.load()})),0===t&&setTimeout(this.reproject_.bind(this),0)}},e.prototype.unlistenSources_=function(){this.sourcesListenerKeys_.forEach(H),this.sourcesListenerKeys_=null},e}(lo),Fp="tileloadstart",Ap="tileloadend",kp="tileloaderror",jp=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Np(t){return t?Array.isArray(t)?function(e){return t}:"function"==typeof t?t:function(e){return[t]}:null}var Dp=function(t){function e(e){var r=t.call(this)||this;return r.projection_=Gr(e.projection),r.attributions_=Np(e.attributions),r.attributionsCollapsible_=void 0===e.attributionsCollapsible||e.attributionsCollapsible,r.loading=!1,r.state_=void 0!==e.state?e.state:Qo,r.wrapX_=void 0!==e.wrapX&&e.wrapX,r}return jp(e,t),e.prototype.getAttributions=function(){return this.attributions_},e.prototype.getAttributionsCollapsible=function(){return this.attributionsCollapsible_},e.prototype.getProjection=function(){return this.projection_},e.prototype.getResolutions=function(){return n()},e.prototype.getState=function(){return this.state_},e.prototype.getWrapX=function(){return this.wrapX_},e.prototype.getContextOptions=function(){},e.prototype.refresh=function(){this.changed()},e.prototype.setAttributions=function(t){this.attributions_=Np(t),this.changed()},e.prototype.setState=function(t){this.state_=t,this.changed()},e}(ot),Gp=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),zp=function(t){function e(e){var r=t.call(this,{attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:e.projection,state:e.state,wrapX:e.wrapX})||this;r.opaque_=void 0!==e.opaque&&e.opaque,r.tilePixelRatio_=void 0!==e.tilePixelRatio?e.tilePixelRatio:1,r.tileGrid=void 0!==e.tileGrid?e.tileGrid:null;var n=e.tileGrid;return n&&Is(n.getTileSize(n.getMinZoom()),[256,256]),r.tileCache=new yu(e.cacheSize||0),r.tmpSize=[0,0],r.key_=e.key||"",r.tileOptions={transition:e.transition},r.zDirection=e.zDirection?e.zDirection:0,r}return Gp(e,t),e.prototype.canExpireCache=function(){return this.tileCache.canExpireCache()},e.prototype.expireCache=function(t,e){var r=this.getTileCacheForProjection(t);r&&r.expireCache(e)},e.prototype.forEachLoadedTile=function(t,e,r,n){var i=this.getTileCacheForProjection(t);if(!i)return!1;for(var o,a,s,l=!0,u=r.minX;u<=r.maxX;++u)for(var c=r.minY;c<=r.maxY;++c)a=cu(e,u,c),s=!1,i.containsKey(a)&&(s=(o=i.get(a)).getState()===to)&&(s=!1!==n(o)),s||(l=!1);return l},e.prototype.getGutterForProjection=function(t){return 0},e.prototype.getKey=function(){return this.key_},e.prototype.setKey=function(t){this.key_!==t&&(this.key_=t,this.changed())},e.prototype.getOpaque=function(t){return this.opaque_},e.prototype.getResolutions=function(){return this.tileGrid.getResolutions()},e.prototype.getTile=function(t,e,r,i,o){return n()},e.prototype.getTileGrid=function(){return this.tileGrid},e.prototype.getTileGridForProjection=function(t){return this.tileGrid?this.tileGrid:oc(t)},e.prototype.getTileCacheForProjection=function(t){return pt(Xr(this.getProjection(),t),68),this.tileCache},e.prototype.getTilePixelRatio=function(t){return this.tilePixelRatio_},e.prototype.getTilePixelSize=function(t,e,r){var n=this.getTileGridForProjection(r),i=this.getTilePixelRatio(e),o=Is(n.getTileSize(t),this.tmpSize);return 1==i?o:Rs(o,i,this.tmpSize)},e.prototype.getTileCoordForTileUrlFunction=function(t,e){var r=void 0!==e?e:this.getProjection(),n=this.getTileGridForProjection(r);return this.getWrapX()&&r.isGlobal()&&(t=ac(n,t,r)),du(t,n)?t:null},e.prototype.clear=function(){this.tileCache.clear()},e.prototype.refresh=function(){this.clear(),t.prototype.refresh.call(this)},e.prototype.updateCacheSize=function(t,e){var r=this.getTileCacheForProjection(e);t>r.highWaterMark&&(r.highWaterMark=t)},e.prototype.useTile=function(t,e,r,n){},e}(Dp),Up=function(t){function e(e,r){var n=t.call(this,e)||this;return n.tile=r,n}return Gp(e,t),e}(c),Bp=zp,Vp=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Yp=function(t){function e(r){var n=t.call(this,{attributions:r.attributions,cacheSize:r.cacheSize,opaque:r.opaque,projection:r.projection,state:r.state,tileGrid:r.tileGrid,tilePixelRatio:r.tilePixelRatio,wrapX:r.wrapX,transition:r.transition,key:r.key,attributionsCollapsible:r.attributionsCollapsible,zDirection:r.zDirection})||this;return n.generateTileUrlFunction_=n.tileUrlFunction===e.prototype.tileUrlFunction,n.tileLoadFunction=r.tileLoadFunction,r.tileUrlFunction&&(n.tileUrlFunction=r.tileUrlFunction),n.urls=null,r.urls?n.setUrls(r.urls):r.url&&n.setUrl(r.url),n.tileLoadingKeys_={},n}return Vp(e,t),e.prototype.getTileLoadFunction=function(){return this.tileLoadFunction},e.prototype.getTileUrlFunction=function(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction},e.prototype.getUrls=function(){return this.urls},e.prototype.handleTileChange=function(t){var e,r=t.target,n=o(r),i=r.getState();i==Qi?(this.tileLoadingKeys_[n]=!0,e=Fp):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],e=i==eo?kp:i==to?Ap:void 0),null!=e&&this.dispatchEvent(new Up(e,r))},e.prototype.setTileLoadFunction=function(t){this.tileCache.clear(),this.tileLoadFunction=t,this.changed()},e.prototype.setTileUrlFunction=function(t,e){this.tileUrlFunction=t,this.tileCache.pruneExceptNewestZ(),void 0!==e?this.setKey(e):this.changed()},e.prototype.setUrl=function(t){var e=yc(t);this.urls=e,this.setUrls(e)},e.prototype.setUrls=function(t){this.urls=t;var e=t.join("\n");this.generateTileUrlFunction_?this.setTileUrlFunction(fc(t,this.tileGrid),e):this.setKey(e)},e.prototype.tileUrlFunction=function(t,e,r){},e.prototype.useTile=function(t,e,r){var n=cu(t,e,r);this.tileCache.containsKey(n)&&this.tileCache.get(n)},e}(Bp),Wp=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function qp(t,e){t.getImage().src=e}var Xp=function(t){function e(e){var r=t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,opaque:e.opaque,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:qp,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection})||this;return r.crossOrigin=void 0!==e.crossOrigin?e.crossOrigin:null,r.tileClass=void 0!==e.tileClass?e.tileClass:vo,r.tileCacheForProjection={},r.tileGridForProjection={},r.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,r.contextOptions_=!1===e.imageSmoothing?$u:void 0,r.renderReprojectionEdges_=!1,r}return Wp(e,t),e.prototype.canExpireCache=function(){if(this.tileCache.canExpireCache())return!0;for(var t in this.tileCacheForProjection)if(this.tileCacheForProjection[t].canExpireCache())return!0;return!1},e.prototype.expireCache=function(t,e){var r=this.getTileCacheForProjection(t);for(var n in this.tileCache.expireCache(this.tileCache==r?e:{}),this.tileCacheForProjection){var i=this.tileCacheForProjection[n];i.expireCache(i==r?e:{})}},e.prototype.getContextOptions=function(){return this.contextOptions_},e.prototype.getGutterForProjection=function(t){return this.getProjection()&&t&&!Xr(this.getProjection(),t)?0:this.getGutter()},e.prototype.getGutter=function(){return 0},e.prototype.getKey=function(){return t.prototype.getKey.call(this)+(this.contextOptions_?"\n"+JSON.stringify(this.contextOptions_):"")},e.prototype.getOpaque=function(e){return!(this.getProjection()&&e&&!Xr(this.getProjection(),e))&&t.prototype.getOpaque.call(this,e)},e.prototype.getTileGridForProjection=function(t){var e=this.getProjection();if(!this.tileGrid||e&&!Xr(e,t)){var r=o(t);return r in this.tileGridForProjection||(this.tileGridForProjection[r]=oc(t)),this.tileGridForProjection[r]}return this.tileGrid},e.prototype.getTileCacheForProjection=function(t){var e=this.getProjection();if(!e||Xr(e,t))return this.tileCache;var r=o(t);return r in this.tileCacheForProjection||(this.tileCacheForProjection[r]=new yu(this.tileCache.highWaterMark)),this.tileCacheForProjection[r]},e.prototype.createTile_=function(t,e,r,n,i,o){var a=[t,e,r],s=this.getTileCoordForTileUrlFunction(a,i),l=s?this.tileUrlFunction(s,n,i):void 0,u=new this.tileClass(a,void 0!==l?Ji:ro,void 0!==l?l:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return u.key=o,u.addEventListener(F,this.handleTileChange.bind(this)),u},e.prototype.getTile=function(t,e,r,n,i){var o=this.getProjection();if(o&&i&&!Xr(o,i)){var a=this.getTileCacheForProjection(i),s=[t,e,r],l=void 0,u=hu(s);a.containsKey(u)&&(l=a.get(u));var c=this.getKey();if(l&&l.key==c)return l;var h=this.getTileGridForProjection(o),p=this.getTileGridForProjection(i),f=this.getTileCoordForTileUrlFunction(s,i),d=new Mp(o,h,i,p,s,f,this.getTilePixelRatio(n),this.getGutter(),function(t,e,r,n){return this.getTileInternal(t,e,r,n,o)}.bind(this),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.contextOptions_);return d.key=c,l?(d.interimTile=l,d.refreshInterimChain(),a.replace(u,d)):a.set(u,d),d}return this.getTileInternal(t,e,r,n,o||i)},e.prototype.getTileInternal=function(t,e,r,n,i){var o=null,a=cu(t,e,r),s=this.getKey();if(this.tileCache.containsKey(a)){if((o=this.tileCache.get(a)).key!=s){var l=o;o=this.createTile_(t,e,r,n,i,s),l.getState()==Ji?o.interimTile=l.interimTile:o.interimTile=l,o.refreshInterimChain(),this.tileCache.replace(a,o)}}else o=this.createTile_(t,e,r,n,i,s),this.tileCache.set(a,o);return o},e.prototype.setRenderReprojectionEdges=function(t){if(this.renderReprojectionEdges_!=t){for(var e in this.renderReprojectionEdges_=t,this.tileCacheForProjection)this.tileCacheForProjection[e].clear();this.changed()}},e.prototype.setTileGridForProjection=function(t,e){var r=Gr(t);if(r){var n=o(r);n in this.tileGridForProjection||(this.tileGridForProjection[n]=e)}},e}(Yp),Zp=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Kp(t){var e,r,n=t[0],i=new Array(n),o=1<>=1;return i.join("")}var Hp=function(t){function e(e){var r=this,n=void 0!==e.hidpi&&e.hidpi;return(r=t.call(this,{cacheSize:e.cacheSize,crossOrigin:"anonymous",imageSmoothing:e.imageSmoothing,opaque:!0,projection:Gr("EPSG:3857"),reprojectionErrorThreshold:e.reprojectionErrorThreshold,state:Jo,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:n?2:1,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition})||this).hidpi_=n,r.culture_=void 0!==e.culture?e.culture:"en-us",r.maxZoom_=void 0!==e.maxZoom?e.maxZoom:-1,r.apiKey_=e.key,r.imagerySet_=e.imagerySet,Au("https://dev.virtualearth.net/REST/v1/Imagery/Metadata/"+r.imagerySet_+"?uriScheme=https&include=ImageryProviders&key="+r.apiKey_+"&c="+r.culture_,r.handleImageryMetadataResponse.bind(r),void 0,"jsonp"),r}return Zp(e,t),e.prototype.getApiKey=function(){return this.apiKey_},e.prototype.getImagerySet=function(){return this.imagerySet_},e.prototype.handleImageryMetadataResponse=function(t){if(200==t.statusCode&&"OK"==t.statusDescription&&"ValidCredentials"==t.authenticationResultCode&&1==t.resourceSets.length&&1==t.resourceSets[0].resources.length){var e=t.resourceSets[0].resources[0],r=-1==this.maxZoom_?e.zoomMax:this.maxZoom_,n=hc(this.getProjection()),i=this.hidpi_?2:1,o=e.imageWidth==e.imageHeight?e.imageWidth/i:[e.imageWidth/i,e.imageHeight/i],a=lc({extent:n,minZoom:e.zoomMin,maxZoom:r,tileSize:o});this.tileGrid=a;var s=this.culture_,l=this.hidpi_;if(this.tileUrlFunction=dc(e.imageUrlSubdomains.map((function(t){var r=[0,0,0],n=e.imageUrl.replace("{subdomain}",t).replace("{culture}",s);return function(t,e,i){if(t){uu(t[0],t[1],t[2],r);var o=n;return l&&(o+="&dpi=d1&device=mobile"),o.replace("{quadkey}",Kp(r))}}}))),e.imageryProviders){var u=Zr(Gr("EPSG:4326"),this.getProjection());this.setAttributions(function(t){var r=[],n=t.viewState,i=this.getTileGrid(),o=i.getZForResolution(n.resolution,this.zDirection),a=i.getTileCoordForCoordAndZ(n.center,o)[0];return e.imageryProviders.map((function(e){for(var n=!1,i=e.coverageAreas,o=0,s=i.length;o=l.zoomMin&&a<=l.zoomMax){var c=l.bbox;if(Re(Ae([c[1],c[0],c[3],c[2]],u),t.extent)){n=!0;break}}}n&&r.push(e.attribution)})),r.push('Terms of Use'),r}.bind(this))}this.setState(Qo)}else this.setState(ta)},e}(Xp),$p=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Jp=function(t){function e(e){var r=e||{},n=void 0!==r.projection?r.projection:"EPSG:3857",i=void 0!==r.tileGrid?r.tileGrid:lc({extent:hc(n),maxResolution:r.maxResolution,maxZoom:r.maxZoom,minZoom:r.minZoom,tileSize:r.tileSize});return t.call(this,{attributions:r.attributions,cacheSize:r.cacheSize,crossOrigin:r.crossOrigin,imageSmoothing:r.imageSmoothing,opaque:r.opaque,projection:n,reprojectionErrorThreshold:r.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:r.tileLoadFunction,tilePixelRatio:r.tilePixelRatio,tileUrlFunction:r.tileUrlFunction,url:r.url,urls:r.urls,wrapX:void 0===r.wrapX||r.wrapX,transition:r.transition,attributionsCollapsible:r.attributionsCollapsible,zDirection:r.zDirection})||this}return $p(e,t),e}(Xp),Qp=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),tf=function(t){function e(e){var r=t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,maxZoom:void 0!==e.maxZoom?e.maxZoom:18,minZoom:e.minZoom,projection:e.projection,transition:e.transition,wrapX:e.wrapX})||this;return r.account_=e.account,r.mapId_=e.map||"",r.config_=e.config||{},r.templateCache_={},r.initializeMap_(),r}return Qp(e,t),e.prototype.getConfig=function(){return this.config_},e.prototype.updateConfig=function(t){O(this.config_,t),this.initializeMap_()},e.prototype.setConfig=function(t){this.config_=t||{},this.initializeMap_()},e.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 r=new XMLHttpRequest;r.addEventListener("load",this.handleInitResponse_.bind(this,t)),r.addEventListener("error",this.handleInitError_.bind(this)),r.open("POST",e),r.setRequestHeader("Content-type","application/json"),r.send(JSON.stringify(this.config_))}},e.prototype.handleInitResponse_=function(t,e){var r=e.target;if(!r.status||r.status>=200&&r.status<300){var n=void 0;try{n=JSON.parse(r.responseText)}catch(t){return void this.setState(ta)}this.applyTemplate_(n),this.templateCache_[t]=n,this.setState(Qo)}else this.setState(ta)},e.prototype.handleInitError_=function(t){this.setState(ta)},e.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)},e}(Jp),ef="addfeature",rf="changefeature",nf="clear",of="removefeature",af="featuresloadstart",sf="featuresloadend",lf="featuresloaderror",uf=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),cf=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.feature=r,i.features=n,i}return uf(e,t),e}(c),hf=function(t){function e(e){var r=this,n=e||{};(r=t.call(this,{attributions:n.attributions,projection:void 0,state:Qo,wrapX:void 0===n.wrapX||n.wrapX})||this).loader_=T,r.format_=n.format,r.overlaps_=void 0===n.overlaps||n.overlaps,r.url_=n.url,void 0!==n.loader?r.loader_=n.loader:void 0!==r.url_&&(pt(r.format_,7),r.loader_=Mu(r.url_,r.format_)),r.strategy_=void 0!==n.strategy?n.strategy:Fu;var i,o,a=void 0===n.useSpatialIndex||n.useSpatialIndex;return r.featuresRtree_=a?new Rp:null,r.loadedExtentsRtree_=new Rp,r.nullGeometryFeatures_={},r.idIndex_={},r.uidIndex_={},r.featureChangeKeys_={},r.featuresCollection_=null,Array.isArray(n.features)?o=n.features:n.features&&(o=(i=n.features).getArray()),a||void 0!==i||(i=new ht(o)),void 0!==o&&r.addFeaturesInternal(o),void 0!==i&&r.bindFeaturesCollection_(i),r}return uf(e,t),e.prototype.addFeature=function(t){this.addFeatureInternal(t),this.changed()},e.prototype.addFeatureInternal=function(t){var e=o(t);if(this.addToIndex_(e,t)){this.setupChangeEvents_(e,t);var r=t.getGeometry();if(r){var n=r.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(n,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new cf(ef,t))}else this.featuresCollection_&&this.featuresCollection_.remove(t)},e.prototype.setupChangeEvents_=function(t,e){this.featureChangeKeys_[t]=[Z(e,F,this.handleFeatureChange_,this),Z(e,h,this.handleFeatureChange_,this)]},e.prototype.addToIndex_=function(t,e){var r=!0,n=e.getId();return void 0!==n&&(n.toString()in this.idIndex_?r=!1:this.idIndex_[n.toString()]=e),r&&(pt(!(t in this.uidIndex_),30),this.uidIndex_[t]=e),r},e.prototype.addFeatures=function(t){this.addFeaturesInternal(t),this.changed()},e.prototype.addFeaturesInternal=function(t){for(var e=[],r=[],n=[],i=0,a=t.length;i=0;--r){var n=this.geometryFunction(t[r]);n?xr(e,n.getCoordinates()):t.splice(r,1)}Pr(e,1/t.length);var i=new gt(new qn(e));return i.set("features",t),i},e}(hf),df=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),gf="default",yf="truncated",mf=function(t){function e(e,r,n,i,o,a,s){var l=t.call(this,r,n,i,o,a,s)||this;return l.zoomifyImage_=null,l.tileSize_=e,l}return df(e,t),e.prototype.getImage=function(){if(this.zoomifyImage_)return this.zoomifyImage_;var e=t.prototype.getImage.call(this);if(this.state==to){var r=this.tileSize_;if(e.width==r[0]&&e.height==r[1])return this.zoomifyImage_=e,e;var n=uo(r[0],r[1]);return n.drawImage(e,0,0),this.zoomifyImage_=n.canvas,n.canvas}return e},e}(vo),vf=function(t){function e(e){var r=this,n=e,i=n.size,o=void 0!==n.tierSizeCalculation?n.tierSizeCalculation:gf,a=n.tilePixelRatio||1,s=i[0],l=i[1],u=[],c=n.tileSize||256,h=c*a;switch(o){case gf:for(;s>h||l>h;)u.push([Math.ceil(s/h),Math.ceil(l/h)]),h+=h;break;case yf:for(var p=s,f=l;p>h||f>h;)u.push([Math.ceil(p/h),Math.ceil(f/h)]),p>>=1,f>>=1;break;default:pt(!1,53)}u.push([1,1]),u.reverse();for(var d=[a],g=[0],y=1,m=u.length;y1,n=r&&t.imageInfo.profile[1].supports?t.imageInfo.profile[1].supports:[],i=r&&t.imageInfo.profile[1].formats?t.imageInfo.profile[1].formats:[],o=r&&t.imageInfo.profile[1].qualities?t.imageInfo.profile[1].qualities:[];return{url:t.imageInfo["@id"].replace(/\/?(?:info\.json)?$/g,""),sizes:void 0===t.imageInfo.sizes?void 0:t.imageInfo.sizes.map((function(t){return[t.width,t.height]})),tileSize:void 0===t.imageInfo.tiles?void 0:[t.imageInfo.tiles.map((function(t){return t.width}))[0],t.imageInfo.tiles.map((function(t){return void 0===t.height?t.width:t.height}))[0]],resolutions:void 0===t.imageInfo.tiles?void 0:t.imageInfo.tiles.map((function(t){return t.scaleFactors}))[0],supports:_f(e.supports,n),formats:_f(e.formats,i),qualities:_f(e.qualities,o)}},Of[wf]=function(t){var e=t.getComplianceLevelSupportedFeatures(),r=void 0===t.imageInfo.extraFormats?e.formats:_f(e.formats,t.imageInfo.extraFormats),n=void 0!==t.imageInfo.preferredFormats&&Array.isArray(t.imageInfo.preferredFormats)&&t.imageInfo.preferredFormats.length>0?t.imageInfo.preferredFormats.filter((function(t){return["jpg","png","gif"].includes(t)})).reduce((function(t,e){return void 0===t&&r.includes(e)?e:t}),void 0):void 0;return{url:t.imageInfo.id,sizes:void 0===t.imageInfo.sizes?void 0:t.imageInfo.sizes.map((function(t){return[t.width,t.height]})),tileSize:void 0===t.imageInfo.tiles?void 0:[t.imageInfo.tiles.map((function(t){return t.width}))[0],t.imageInfo.tiles.map((function(t){return t.height}))[0]],resolutions:void 0===t.imageInfo.tiles?void 0:t.imageInfo.tiles.map((function(t){return t.scaleFactors}))[0],supports:void 0===t.imageInfo.extraFeatures?e.supports:_f(e.supports,t.imageInfo.extraFeatures),formats:r,qualities:void 0===t.imageInfo.extraQualities?e.qualities:_f(e.qualities,t.imageInfo.extraQualities),preferredFormat:n}};var Pf=function(){function t(t){this.setImageInfo(t)}return t.prototype.setImageInfo=function(t){this.imageInfo="string"==typeof t?JSON.parse(t):t},t.prototype.getImageApiVersion=function(){if(void 0!==this.imageInfo){var t=this.imageInfo["@context"]||"ol-no-context";"string"==typeof t&&(t=[t]);for(var e=0;e0&&"string"==typeof this.imageInfo.profile[0]&&Tf.test(this.imageInfo.profile[0]))return this.imageInfo.profile[0]}},t.prototype.getComplianceLevelFromProfile=function(t){var e=this.getComplianceLevelEntryFromProfile(t);if(void 0!==e){var r=e.match(/level[0-2](?:\.json)?$/g);return Array.isArray(r)?r[0].replace(".json",""):void 0}},t.prototype.getComplianceLevelSupportedFeatures=function(){if(void 0!==this.imageInfo){var t=this.getImageApiVersion(),e=this.getComplianceLevelFromProfile(t);return void 0===e?Sf.none.none:Sf[t][e]}},t.prototype.getTileSourceOptions=function(t){var e=t||{},r=this.getImageApiVersion();if(void 0!==r){var n=void 0===r?void 0:Of[r](this);if(void 0!==n)return{url:n.url,version:r,size:[this.imageInfo.width,this.imageInfo.height],sizes:n.sizes,format:void 0!==e.format&&n.formats.includes(e.format)?e.format:void 0!==n.preferredFormat?n.preferredFormat:"jpg",supports:n.supports,quality:e.quality&&n.qualities.includes(e.quality)?e.quality:n.qualities.includes("native")?"native":"default",resolutions:Array.isArray(n.resolutions)?n.resolutions.sort((function(t,e){return e-t})):void 0,tileSize:n.tileSize}}},t}(),Rf=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function If(t){return t.toLocaleString("en",{maximumFractionDigits:10})}var Lf=function(t){function e(e){var r=this,n=e||{},i=n.url||"";i+=i.lastIndexOf("/")===i.length-1||""===i?"":"/";var o=n.version||xf,a=n.sizes||[],s=n.size;pt(null!=s&&Array.isArray(s)&&2==s.length&&!isNaN(s[0])&&s[0]>0&&!isNaN(s[1])&&s[1]>0,60);var l,u,c,h=s[0],p=s[1],f=n.tileSize,d=n.tilePixelRatio||1,g=n.format||"jpg",y=n.quality||(n.version==bf?"native":"default"),m=n.resolutions||[],v=n.supports||[],_=n.extent||[0,-p,h,0],b=null!=a&&Array.isArray(a)&&a.length>0,x=void 0!==f&&("number"==typeof f&&Number.isInteger(f)&&f>0||Array.isArray(f)&&f.length>0),w=null!=v&&Array.isArray(v)&&(v.includes("regionByPx")||v.includes("regionByPct"))&&(v.includes("sizeByWh")||v.includes("sizeByH")||v.includes("sizeByW")||v.includes("sizeByPct"));if(m.sort((function(t,e){return e-t})),x||w)if(null!=f&&("number"==typeof f&&Number.isInteger(f)&&f>0?(l=f,u=f):Array.isArray(f)&&f.length>0&&((1==f.length||null==f[1]&&Number.isInteger(f[0]))&&(l=f[0],u=f[0]),2==f.length&&(Number.isInteger(f[0])&&Number.isInteger(f[1])?(l=f[0],u=f[1]):null==f[0]&&Number.isInteger(f[1])&&(l=f[1],u=f[1])))),void 0!==l&&void 0!==u||(l=256,u=256),0==m.length)for(var S=c=Math.max(Math.ceil(Math.log(h/l)/Math.LN2),Math.ceil(Math.log(p/u)/Math.LN2));S>=0;S--)m.push(Math.pow(2,S));else{var E=Math.max.apply(Math,m);c=Math.round(Math.log(E)/Math.LN2)}else if(l=h,u=p,m=[],b){a.sort((function(t,e){return t[0]-e[0]})),c=-1;var T=[];for(S=0;S0&&m[m.length-1]==C?T.push(S):(m.push(C),c++)}if(T.length>0)for(S=0;Sc)){var d=t[1],_=t[2],S=m[f];if(!(void 0===d||void 0===_||void 0===S||d<0||Math.ceil(h/S/l)<=d||_<0||Math.ceil(p/S/u)<=_)){if(w||x){var E=d*l*S,T=_*u*S,C=l*S,O=u*S,P=l,R=u;if(E+C>h&&(C=h-E),T+O>p&&(O=p-T),E+l*S>h&&(P=Math.floor((h-E+S-1)/S)),T+u*S>p&&(R=Math.floor((p-T+S-1)/S)),0==E&&C==h&&0==T&&O==p)n="full";else if(!w||v.includes("regionByPx"))n=E+","+T+","+C+","+O;else if(v.includes("regionByPct")){n="pct:"+If(E/h*100)+","+If(T/p*100)+","+If(C/h*100)+","+If(O/p*100)}o!=wf||w&&!v.includes("sizeByWh")?!w||v.includes("sizeByW")?s=P+",":v.includes("sizeByH")?s=","+R:v.includes("sizeByWh")?s=P+","+R:v.includes("sizeByPct")&&(s="pct:"+If(100/S)):s=P+","+R}else if(n="full",b){var I=a[f][0],L=a[f][1];s=o==wf?I==h&&L==p?"max":I+","+L:I==h?"full":I+","}else s=o==wf?"max":"full";return i+n+"/"+s+"/0/"+y+"."+g}}},transition:n.transition})||this).zDirection=n.zDirection,r}return Rf(e,t),e}(Xp),Mf=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ff=function(t){function e(e,r,n,i,o,a,s){var l=this,u=e.getExtent(),c=r.getExtent(),h=c?Te(n,c):n,p=tc(e,r,xe(h),i),f=new Ip(e,r,h,u,.5*p,i),d=a(f.calculateSourceExtent(),p,o),g=d?Fi:Ni,y=d?d.getPixelRatio():1;return(l=t.call(this,n,i,y,g)||this).targetProj_=r,l.maxSourceExtent_=u,l.triangulation_=f,l.targetResolution_=i,l.targetExtent_=n,l.sourceImage_=d,l.sourcePixelRatio_=y,l.contextOptions_=s,l.canvas_=null,l.sourceListenerKey_=null,l}return Mf(e,t),e.prototype.disposeInternal=function(){this.state==Ai&&this.unlistenSource_(),t.prototype.disposeInternal.call(this)},e.prototype.getImage=function(){return this.canvas_},e.prototype.getProjection=function(){return this.targetProj_},e.prototype.reproject_=function(){var t=this.sourceImage_.getState();if(t==ki){var e=Pe(this.targetExtent_)/this.targetResolution_,r=Ee(this.targetExtent_)/this.targetResolution_;this.canvas_=rc(e,r,this.sourcePixelRatio_,this.sourceImage_.getResolution(),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0,void 0,this.contextOptions_)}this.state=t,this.changed()},e.prototype.load=function(){if(this.state==Fi){this.state=Ai,this.changed();var t=this.sourceImage_.getState();t==ki||t==ji?this.reproject_():(this.sourceListenerKey_=Z(this.sourceImage_,F,(function(t){var e=this.sourceImage_.getState();e!=ki&&e!=ji||(this.unlistenSource_(),this.reproject_())}),this),this.sourceImage_.load())}},e.prototype.unlistenSource_=function(){H(this.sourceListenerKey_),this.sourceListenerKey_=null},e}(Mi),Af=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),kf="imageloadstart",jf="imageloadend",Nf="imageloaderror",Df=function(t){function e(e,r){var n=t.call(this,e)||this;return n.image=r,n}return Af(e,t),e}(c);function Gf(t,e){t.getImage().src=e}var zf=function(t){function e(e){var r=t.call(this,{attributions:e.attributions,projection:e.projection,state:e.state})||this;return r.resolutions_=void 0!==e.resolutions?e.resolutions:null,r.reprojectedImage_=null,r.reprojectedRevision_=0,r.contextOptions_=!1===e.imageSmoothing?$u:void 0,r}return Af(e,t),e.prototype.getResolutions=function(){return this.resolutions_},e.prototype.getContextOptions=function(){return this.contextOptions_},e.prototype.findNearestResolution=function(t){if(this.resolutions_){var e=y(this.resolutions_,t,0);t=this.resolutions_[e]}return t},e.prototype.getImage=function(t,e,r,n){var i=this.getProjection();if(i&&n&&!Xr(i,n)){if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&Xr(this.reprojectedImage_.getProjection(),n)&&this.reprojectedImage_.getResolution()==e&&ue(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new Ff(i,n,t,e,r,function(t,e,r){return this.getImageInternal(t,e,r,i)}.bind(this),this.contextOptions_),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}return i&&(n=i),this.getImageInternal(t,e,r,n)},e.prototype.getImageInternal=function(t,e,r,i){return n()},e.prototype.handleImageChange=function(t){var e=t.target;switch(e.getState()){case Ai:this.loading=!0,this.dispatchEvent(new Df(kf,e));break;case ki:this.loading=!1,this.dispatchEvent(new Df(jf,e));break;case ji:this.loading=!1,this.dispatchEvent(new Df(Nf,e))}},e}(Dp),Uf=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Bf=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,{attributions:n.attributions,imageSmoothing:n.imageSmoothing,projection:n.projection,resolutions:n.resolutions})||this).crossOrigin_=void 0!==n.crossOrigin?n.crossOrigin:null,r.hidpi_=void 0===n.hidpi||n.hidpi,r.url_=n.url,r.imageLoadFunction_=void 0!==n.imageLoadFunction?n.imageLoadFunction:Gf,r.params_=n.params||{},r.image_=null,r.imageSize_=[0,0],r.renderedRevision_=0,r.ratio_=void 0!==n.ratio?n.ratio:1.5,r}return Uf(e,t),e.prototype.getParams=function(){return this.params_},e.prototype.getImageInternal=function(t,e,r,n){if(void 0===this.url_)return null;e=this.findNearestResolution(e),r=this.hidpi_?r:1;var i=this.image_;if(i&&this.renderedRevision_==this.getRevision()&&i.getResolution()==e&&i.getPixelRatio()==r&&te(i.getExtent(),t))return i;var o={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};O(o,this.params_);var a=((t=t.slice())[0]+t[2])/2,s=(t[1]+t[3])/2;if(1!=this.ratio_){var l=this.ratio_*Pe(t)/2,u=this.ratio_*Ee(t)/2;t[0]=a-l,t[1]=s-u,t[2]=a+l,t[3]=s+u}var c=e/r,h=Math.ceil(Pe(t)/c),p=Math.ceil(Ee(t)/c);t[0]=a-c*h/2,t[2]=a+c*h/2,t[1]=s-c*p/2,t[3]=s+c*p/2,this.imageSize_[0]=h,this.imageSize_[1]=p;var f=this.getRequestUrl_(t,this.imageSize_,r,n,o);return this.image_=new Ki(t,e,r,f,this.crossOrigin_,this.imageLoadFunction_),this.renderedRevision_=this.getRevision(),this.image_.addEventListener(F,this.handleImageChange.bind(this)),this.image_},e.prototype.getImageLoadFunction=function(){return this.imageLoadFunction_},e.prototype.getRequestUrl_=function(t,e,r,n,i){var o=n.getCode().split(":").pop();i.SIZE=e[0]+","+e[1],i.BBOX=t.join(","),i.BBOXSR=o,i.IMAGESR=o,i.DPI=Math.round(90*r);var a=this.url_,s=a.replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage");return s==a&&pt(!1,50),mc(s,i)},e.prototype.getUrl=function(){return this.url_},e.prototype.setImageLoadFunction=function(t){this.image_=null,this.imageLoadFunction_=t,this.changed()},e.prototype.setUrl=function(t){t!=this.url_&&(this.url_=t,this.image_=null,this.changed())},e.prototype.updateParams=function(t){O(this.params_,t),this.image_=null,this.changed()},e}(zf),Vf=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Yf=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,{attributions:n.attributions,imageSmoothing:n.imageSmoothing,projection:n.projection,resolutions:n.resolutions,state:n.state})||this).canvasFunction_=n.canvasFunction,r.canvas_=null,r.renderedRevision_=0,r.ratio_=void 0!==n.ratio?n.ratio:1.5,r}return Vf(e,t),e.prototype.getImageInternal=function(t,e,r,n){e=this.findNearestResolution(e);var i=this.canvas_;if(i&&this.renderedRevision_==this.getRevision()&&i.getResolution()==e&&i.getPixelRatio()==r&&te(i.getExtent(),t))return i;Me(t=t.slice(),this.ratio_);var o=[Pe(t)/e*r,Ee(t)/e*r],a=this.canvasFunction_.call(this,t,e,r,o,n);return a&&(i=new $i(t,e,r,a)),this.canvas_=i,this.renderedRevision_=this.getRevision(),i},e}(zf),Wf=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();var qf=function(t){function e(e){var r=t.call(this,{imageSmoothing:e.imageSmoothing,projection:e.projection,resolutions:e.resolutions})||this;return r.crossOrigin_=void 0!==e.crossOrigin?e.crossOrigin:null,r.displayDpi_=void 0!==e.displayDpi?e.displayDpi:96,r.params_=e.params||{},r.url_=e.url,r.imageLoadFunction_=void 0!==e.imageLoadFunction?e.imageLoadFunction:Gf,r.hidpi_=void 0===e.hidpi||e.hidpi,r.metersPerUnit_=void 0!==e.metersPerUnit?e.metersPerUnit:1,r.ratio_=void 0!==e.ratio?e.ratio:1,r.useOverlay_=void 0!==e.useOverlay&&e.useOverlay,r.image_=null,r.renderedRevision_=0,r}return Wf(e,t),e.prototype.getParams=function(){return this.params_},e.prototype.getImageInternal=function(t,e,r,n){e=this.findNearestResolution(e),r=this.hidpi_?r:1;var i=this.image_;if(i&&this.renderedRevision_==this.getRevision()&&i.getResolution()==e&&i.getPixelRatio()==r&&te(i.getExtent(),t))return i;1!=this.ratio_&&Me(t=t.slice(),this.ratio_);var o=[Pe(t)/e*r,Ee(t)/e*r];if(void 0!==this.url_){var a=this.getUrl(this.url_,this.params_,t,o,n);(i=new Ki(t,e,r,a,this.crossOrigin_,this.imageLoadFunction_)).addEventListener(F,this.handleImageChange.bind(this))}else i=null;return this.image_=i,this.renderedRevision_=this.getRevision(),i},e.prototype.getImageLoadFunction=function(){return this.imageLoadFunction_},e.prototype.updateParams=function(t){O(this.params_,t),this.changed()},e.prototype.getUrl=function(t,e,r,n,i){var o=function(t,e,r,n){var i=Pe(t),o=Ee(t),a=e[0],s=e[1],l=.0254/n;return s*i>a*o?i*r/(a*l):o*r/(s*l)}(r,n,this.metersPerUnit_,this.displayDpi_),a=xe(r),s={OPERATION:this.useOverlay_?"GETDYNAMICMAPOVERLAYIMAGE":"GETMAPIMAGE",VERSION:"2.0.0",LOCALE:"en",CLIENTAGENT:"ol/source/ImageMapGuide source",CLIP:"1",SETDISPLAYDPI:this.displayDpi_,SETDISPLAYWIDTH:Math.round(n[0]),SETDISPLAYHEIGHT:Math.round(n[1]),SETVIEWSCALE:o,SETVIEWCENTERX:a[0],SETVIEWCENTERY:a[1]};return O(s,e),mc(t,s)},e.prototype.setImageLoadFunction=function(t){this.image_=null,this.imageLoadFunction_=t,this.changed()},e}(zf),Xf=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Zf=function(t){function e(e){var r=this,n=void 0!==e.crossOrigin?e.crossOrigin:null,i=void 0!==e.imageLoadFunction?e.imageLoadFunction:Gf;return(r=t.call(this,{attributions:e.attributions,imageSmoothing:e.imageSmoothing,projection:Gr(e.projection)})||this).url_=e.url,r.imageExtent_=e.imageExtent,r.image_=new Ki(r.imageExtent_,void 0,1,r.url_,n,i),r.imageSize_=e.imageSize?e.imageSize:null,r.image_.addEventListener(F,r.handleImageChange.bind(r)),r}return Xf(e,t),e.prototype.getImageExtent=function(){return this.imageExtent_},e.prototype.getImageInternal=function(t,e,r,n){return Re(t,this.image_.getExtent())?this.image_:null},e.prototype.getUrl=function(){return this.url_},e.prototype.handleImageChange=function(e){if(this.image_.getState()==ki){var r=this.image_.getExtent(),n=this.image_.getImage(),i=void 0,o=void 0;this.imageSize_?(i=this.imageSize_[0],o=this.imageSize_[1]):(i=n.width,o=n.height);var a=Ee(r)/o,s=Math.ceil(Pe(r)/a);if(s!=i){var l=uo(s,o);O(l,this.getContextOptions());var u=l.canvas;l.drawImage(n,0,0,i,o,0,0,u.width,u.height),this.image_.setImage(u)}}t.prototype.handleImageChange.call(this,e)},e}(zf),Kf="carmentaserver",Hf="geoserver",$f="mapserver",Jf="qgis",Qf=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),td=[101,101],ed=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,{attributions:n.attributions,imageSmoothing:n.imageSmoothing,projection:n.projection,resolutions:n.resolutions})||this).crossOrigin_=void 0!==n.crossOrigin?n.crossOrigin:null,r.url_=n.url,r.imageLoadFunction_=void 0!==n.imageLoadFunction?n.imageLoadFunction:Gf,r.params_=n.params||{},r.v13_=!0,r.updateV13_(),r.serverType_=n.serverType,r.hidpi_=void 0===n.hidpi||n.hidpi,r.image_=null,r.imageSize_=[0,0],r.renderedRevision_=0,r.ratio_=void 0!==n.ratio?n.ratio:1.5,r}return Qf(e,t),e.prototype.getFeatureInfoUrl=function(t,e,r,n){if(void 0!==this.url_){var i=Gr(r),o=this.getProjection();o&&o!==i&&(e=tc(o,i,t,e),t=Hr(t,i,o));var a=Se(t,e,0,td),s={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.params_.LAYERS};O(s,this.params_,n);var l=Math.floor((t[0]-a[0])/e),u=Math.floor((a[3]-t[1])/e);return s[this.v13_?"I":"X"]=l,s[this.v13_?"J":"Y"]=u,this.getRequestUrl_(a,td,1,o||i,s)}},e.prototype.getLegendUrl=function(t,e){if(void 0!==this.url_){var r={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){var n=this.params_.LAYERS;if(!(!Array.isArray(n)||1===n.length))return;r.LAYER=n}if(void 0!==t){var i=this.getProjection()?this.getProjection().getMetersPerUnit():1;r.SCALE=t*i/28e-5}return O(r,e),mc(this.url_,r)}},e.prototype.getParams=function(){return this.params_},e.prototype.getImageInternal=function(t,e,r,n){if(void 0===this.url_)return null;e=this.findNearestResolution(e),1==r||this.hidpi_&&void 0!==this.serverType_||(r=1);var i=e/r,o=xe(t),a=Se(o,i,0,[Math.ceil(Pe(t)/i),Math.ceil(Ee(t)/i)]),s=Se(o,i,0,[Math.ceil(this.ratio_*Pe(t)/i),Math.ceil(this.ratio_*Ee(t)/i)]),l=this.image_;if(l&&this.renderedRevision_==this.getRevision()&&l.getResolution()==e&&l.getPixelRatio()==r&&te(l.getExtent(),a))return l;var u={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};O(u,this.params_),this.imageSize_[0]=Math.round(Pe(s)/i),this.imageSize_[1]=Math.round(Ee(s)/i);var c=this.getRequestUrl_(s,this.imageSize_,r,n,u);return this.image_=new Ki(s,e,r,c,this.crossOrigin_,this.imageLoadFunction_),this.renderedRevision_=this.getRevision(),this.image_.addEventListener(F,this.handleImageChange.bind(this)),this.image_},e.prototype.getImageLoadFunction=function(){return this.imageLoadFunction_},e.prototype.getRequestUrl_=function(t,e,r,n,i){if(pt(void 0!==this.url_,9),i[this.v13_?"CRS":"SRS"]=n.getCode(),"STYLES"in this.params_||(i.STYLES=""),1!=r)switch(this.serverType_){case Hf:var o=90*r+.5|0;"FORMAT_OPTIONS"in i?i.FORMAT_OPTIONS+=";dpi:"+o:i.FORMAT_OPTIONS="dpi:"+o;break;case $f:i.MAP_RESOLUTION=90*r;break;case Kf:case Jf:i.DPI=90*r;break;default:pt(!1,8)}i.WIDTH=e[0],i.HEIGHT=e[1];var a,s=n.getAxisOrientation();return a=this.v13_&&"ne"==s.substr(0,2)?[t[1],t[0],t[3],t[2]]:t,i.BBOX=a.join(","),mc(this.url_,i)},e.prototype.getUrl=function(){return this.url_},e.prototype.setImageLoadFunction=function(t){this.image_=null,this.imageLoadFunction_=t,this.changed()},e.prototype.setUrl=function(t){t!=this.url_&&(this.url_=t,this.image_=null,this.changed())},e.prototype.updateParams=function(t){O(this.params_,t),this.updateV13_(),this.image_=null,this.changed()},e.prototype.updateV13_=function(){var t=this.params_.VERSION||"1.3.0";this.v13_=br(t,"1.3")>=0},e}(zf),rd=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),nd='© OpenStreetMap contributors.',id=function(t){function e(e){var r,n=e||{};r=void 0!==n.attributions?n.attributions:[nd];var i=void 0!==n.crossOrigin?n.crossOrigin:"anonymous",o=void 0!==n.url?n.url:"https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png";return t.call(this,{attributions:r,attributionsCollapsible:!1,cacheSize:n.cacheSize,crossOrigin:i,imageSmoothing:n.imageSmoothing,maxZoom:void 0!==n.maxZoom?n.maxZoom:19,opaque:void 0===n.opaque||n.opaque,reprojectionErrorThreshold:n.reprojectionErrorThreshold,tileLoadFunction:n.tileLoadFunction,transition:n.transition,url:o,wrapX:n.wrapX})||this}return rd(e,t),e}(Jp),od=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ad=function(t){function e(e){var r=e||{};return t.call(this,r)||this}return od(e,t),e}(na),sd=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ld=function(t){function e(e){var r=t.call(this)||this;return r.boundHandleImageChange_=r.handleImageChange_.bind(r),r.layer_=e,r.declutterExecutorGroup=null,r}return sd(e,t),e.prototype.getFeatures=function(t){return n()},e.prototype.prepareFrame=function(t){return n()},e.prototype.renderFrame=function(t,e){return n()},e.prototype.loadedTileCallback=function(t,e,r){t[e]||(t[e]={}),t[e][r.tileCoord.toString()]=r},e.prototype.createLoadedTileFinder=function(t,e,r){return function(n,i){var o=this.loadedTileCallback.bind(this,r,n);return t.forEachLoadedTile(e,n,i,o)}.bind(this)},e.prototype.forEachFeatureAtCoordinate=function(t,e,r,n,i){},e.prototype.getDataAtPixel=function(t,e,r){return n()},e.prototype.getLayer=function(){return this.layer_},e.prototype.handleFontsChanged=function(){},e.prototype.handleImageChange_=function(t){t.target.getState()===ki&&this.renderIfReadyAndVisible()},e.prototype.loadImage=function(t){var e=t.getState();return e!=ki&&e!=ji&&t.addEventListener(F,this.boundHandleImageChange_),e==Fi&&(t.load(),e=t.getState()),e==ki},e.prototype.renderIfReadyAndVisible=function(){var t=this.getLayer();t.getVisible()&&t.getSourceState()==Qo&&t.changed()},e}(Q),ud=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),cd=function(t){function e(e){var r=t.call(this,e)||this;return r.container=null,r.renderedResolution,r.tempTransform=[1,0,0,1,0,0],r.pixelTransform=[1,0,0,1,0,0],r.inversePixelTransform=[1,0,0,1,0,0],r.context=null,r.containerReused=!1,r}return ud(e,t),e.prototype.useContainer=function(t,e,r){var n,i,o=this.getLayer().getClassName();t&&""===t.style.opacity&&t.className===o&&((s=t.firstElementChild)instanceof HTMLCanvasElement&&(i=s.getContext("2d")));if(!i||0!==i.canvas.width&&i.canvas.style.transform!==e?this.containerReused&&(this.container=null,this.context=null,this.containerReused=!1):(this.container=t,this.context=i,this.containerReused=!0),!this.container){(n=document.createElement("div")).className=o;var a=n.style;a.position="absolute",a.width="100%",a.height="100%";var s=(i=uo()).canvas;n.appendChild(s),(a=s.style).position="absolute",a.left="0",a.transformOrigin="top left",this.container=n,this.context=i}},e.prototype.clip=function(t,e,r){var n=e.pixelRatio,i=e.size[0]*n/2,o=e.size[1]*n/2,a=e.viewState.rotation,s=Ce(r),l=Oe(r),u=be(r),c=_e(r);It(e.coordinateToPixelTransform,s),It(e.coordinateToPixelTransform,l),It(e.coordinateToPixelTransform,u),It(e.coordinateToPixelTransform,c),t.save(),Ca(t,-a,i,o),t.beginPath(),t.moveTo(s[0]*n,s[1]*n),t.lineTo(l[0]*n,l[1]*n),t.lineTo(u[0]*n,u[1]*n),t.lineTo(c[0]*n,c[1]*n),t.clip(),Ca(t,a,i,o)},e.prototype.clipUnrotated=function(t,e,r){var n=Ce(r),i=Oe(r),o=be(r),a=_e(r);It(e.coordinateToPixelTransform,n),It(e.coordinateToPixelTransform,i),It(e.coordinateToPixelTransform,o),It(e.coordinateToPixelTransform,a);var s=this.inversePixelTransform;It(s,n),It(s,i),It(s,o),It(s,a),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(i[0]),Math.round(i[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.lineTo(Math.round(a[0]),Math.round(a[1])),t.clip()},e.prototype.dispatchRenderEvent_=function(t,e,r){var n=this.getLayer();if(n.hasListener(t)){var i=new la(t,this.inversePixelTransform,r,e);n.dispatchEvent(i)}},e.prototype.preRender=function(t,e){this.dispatchRenderEvent_(qo,t,e)},e.prototype.postRender=function(t,e){this.dispatchRenderEvent_(Xo,t,e)},e.prototype.getRenderTransform=function(t,e,r,n,i,o,a){var s=i/2,l=o/2,u=n/e,c=-u,h=-t[0]+a,p=-t[1];return kt(this.tempTransform,s,l,u,c,-r,h,p)},e.prototype.getDataAtPixel=function(t,e,r){var n,i=It(this.inversePixelTransform,t.slice()),o=this.context,a=this.getLayer().getExtent();if(a&&!Qt(a,It(e.pixelToCoordinateTransform,t.slice())))return null;try{var s=Math.round(i[0]),l=Math.round(i[1]),u=document.createElement("canvas"),c=u.getContext("2d");u.width=1,u.height=1,c.clearRect(0,0,1,1),c.drawImage(o.canvas,s,l,1,1,0,0,1,1),n=c.getImageData(0,0,1,1).data}catch(t){return"SecurityError"===t.name?new Uint8Array:n}return 0===n[3]?null:n},e}(ld),hd=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),pd=function(t){function e(e){var r=t.call(this,e)||this;return r.image_=null,r}return hd(e,t),e.prototype.getImage=function(){return this.image_?this.image_.getImage():null},e.prototype.prepareFrame=function(t){var e=t.layerStatesArray[t.layerIndex],r=t.pixelRatio,n=t.viewState,i=n.resolution,o=this.getLayer().getSource(),a=t.viewHints,s=t.extent;if(void 0!==e.extent&&(s=Te(s,on(e.extent,n.projection))),!a[ns]&&!a[is]&&!Ie(s))if(o){var l=n.projection,u=o.getImage(s,i,r,l);u&&this.loadImage(u)&&(this.image_=u)}else this.image_=null;return!!this.image_},e.prototype.renderFrame=function(t,e){var r=this.image_,n=r.getExtent(),i=r.getResolution(),o=r.getPixelRatio(),a=t.layerStatesArray[t.layerIndex],s=t.pixelRatio,l=t.viewState,u=l.center,c=l.resolution,h=t.size,p=s*i/(c*o),f=Math.round(h[0]*s),d=Math.round(h[1]*s),g=l.rotation;if(g){var y=Math.round(Math.sqrt(f*f+d*d));f=y,d=y}kt(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/s,1/s,g,-f/2,-d/2),jt(this.inversePixelTransform,this.pixelTransform);var m=Ra(this.pixelTransform);this.useContainer(e,m,a.opacity);var v=this.context,_=v.canvas;_.width!=f||_.height!=d?(_.width=f,_.height=d):this.containerReused||v.clearRect(0,0,f,d);var b=!1;if(a.extent){var x=on(a.extent,l.projection);(b=!te(x,t.extent)&&Re(x,t.extent))&&this.clipUnrotated(v,t,x)}var w=r.getImage(),S=kt(this.tempTransform,f/2,d/2,p,p,0,o*(n[0]-u[0])/i,o*(u[1]-n[3])/i);this.renderedResolution=i*s/o;var E=S[4],T=S[5],C=w.width*S[0],P=w.height*S[3];if(O(v,this.getLayer().getSource().getContextOptions()),this.preRender(v,t),C>=.5&&P>=.5){var R=a.opacity,I=void 0;1!==R&&(I=this.context.globalAlpha,this.context.globalAlpha=R),this.context.drawImage(w,0,0,+w.width,+w.height,Math.round(E),Math.round(T),Math.round(C),Math.round(P)),1!==R&&(this.context.globalAlpha=I)}return this.postRender(v,t),b&&v.restore(),m!==_.style.transform&&(_.style.transform=m),this.container},e}(cd),fd=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),dd=function(t){function e(e){return t.call(this,e)||this}return fd(e,t),e.prototype.createRenderer=function(){return new pd(this)},e}(ad),gd="preload",yd="useInterimTilesOnError",md=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),vd=function(t){function e(e){var r=this,n=e||{},i=O({},n);return delete i.preload,delete i.useInterimTilesOnError,(r=t.call(this,i)||this).setPreload(void 0!==n.preload?n.preload:0),r.setUseInterimTilesOnError(void 0===n.useInterimTilesOnError||n.useInterimTilesOnError),r}return md(e,t),e.prototype.getPreload=function(){return this.get(gd)},e.prototype.setPreload=function(t){this.set(gd,t)},e.prototype.getUseInterimTilesOnError=function(){return this.get(yd)},e.prototype.setUseInterimTilesOnError=function(t){this.set(yd,t)},e}(na),_d=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),bd=function(t){function e(e){var r=t.call(this,e)||this;return r.extentChanged=!0,r.renderedExtent_=null,r.renderedPixelRatio,r.renderedProjection=null,r.renderedRevision,r.renderedTiles=[],r.newTiles_=!1,r.tmpExtent=[1/0,1/0,-1/0,-1/0],r.tmpTileRange_=new _u(0,0,0,0),r}return _d(e,t),e.prototype.isDrawableTile=function(t){var e=this.getLayer(),r=t.getState(),n=e.getUseInterimTilesOnError();return r==to||r==ro||r==eo&&!n},e.prototype.getTile=function(t,e,r,n){var i=n.pixelRatio,o=n.viewState.projection,a=this.getLayer(),s=a.getSource().getTile(t,e,r,i,o);return s.getState()==eo&&(a.getUseInterimTilesOnError()?a.getPreload()>0&&(this.newTiles_=!0):s.setState(to)),this.isDrawableTile(s)||(s=s.getInterimTile()),s},e.prototype.loadedTileCallback=function(e,r,n){return!!this.isDrawableTile(n)&&t.prototype.loadedTileCallback.call(this,e,r,n)},e.prototype.prepareFrame=function(t){return!!this.getLayer().getSource()},e.prototype.renderFrame=function(t,e){var r=t.layerStatesArray[t.layerIndex],n=t.viewState,i=n.projection,a=n.resolution,s=n.center,l=n.rotation,u=t.pixelRatio,c=this.getLayer(),h=c.getSource(),p=h.getRevision(),f=h.getTileGridForProjection(i),g=f.getZForResolution(a,h.zDirection),y=f.getResolution(g),m=t.extent,v=r.extent&&on(r.extent,i);v&&(m=Te(m,on(r.extent,i)));var _=h.getTilePixelRatio(u),b=Math.round(t.size[0]*_),x=Math.round(t.size[1]*_);if(l){var w=Math.round(Math.sqrt(b*b+x*x));b=w,x=w}var S=y*b/2/_,E=y*x/2/_,T=[s[0]-S,s[1]-E,s[0]+S,s[1]+E],C=f.getTileRangeForExtentAndZ(m,g),P={};P[g]={};var R=this.createLoadedTileFinder(h,i,P),I=this.tmpExtent,L=this.tmpTileRange_;this.newTiles_=!1;for(var M=C.minX;M<=C.maxX;++M)for(var F=C.minY;F<=C.maxY;++F){var A=this.getTile(g,M,F,t);if(this.isDrawableTile(A)){var k=o(this);if(A.getState()==to){P[g][A.tileCoord.toString()]=A;var j=A.inTransition(k);this.newTiles_||!j&&-1!==this.renderedTiles.indexOf(A)||(this.newTiles_=!0)}if(1===A.getAlpha(k,t.time))continue}var N=f.getTileCoordChildTileRange(A.tileCoord,L,I),D=!1;N&&(D=R(g+1,N)),D||f.forEachTileCoordParentTileRange(A.tileCoord,R,L,I)}var G=y/a;kt(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/_,1/_,l,-b/2,-x/2);var z=Ra(this.pixelTransform);this.useContainer(e,z,r.opacity);var U=this.context,B=U.canvas;jt(this.inversePixelTransform,this.pixelTransform),kt(this.tempTransform,b/2,x/2,G,G,0,-b/2,-x/2),B.width!=b||B.height!=x?(B.width=b,B.height=x):this.containerReused||U.clearRect(0,0,b,x),v&&this.clipUnrotated(U,t,v),O(U,h.getContextOptions()),this.preRender(U,t),this.renderedTiles.length=0;var V,Y,W,q=Object.keys(P).map(Number);q.sort(d),1!==r.opacity||this.containerReused&&!h.getOpaque(t.viewState.projection)?(V=[],Y=[]):q=q.reverse();for(var X=q.length-1;X>=0;--X){var Z=q[X],K=h.getTilePixelSize(Z,u,i),H=f.getResolution(Z)/y,$=K[0]*H*G,J=K[1]*H*G,Q=f.getTileCoordForCoordAndZ(Ce(T),Z),tt=f.getTileCoordExtent(Q),et=It(this.tempTransform,[_*(tt[0]-T[0])/y,_*(T[3]-tt[3])/y]),rt=_*h.getGutterForProjection(i),nt=P[Z];for(var it in nt){var ot=(A=nt[it]).tileCoord,at=et[0]-(Q[1]-ot[1])*$,st=Math.round(at+$),lt=et[1]-(Q[2]-ot[2])*J,ut=Math.round(lt+J),ct=st-(M=Math.round(at)),ht=ut-(F=Math.round(lt)),pt=g===Z;if(!(j=pt&&1!==A.getAlpha(o(this),t.time)))if(V){U.save(),W=[M,F,M+ct,F,M+ct,F+ht,M,F+ht];for(var ft=0,dt=V.length;ftthis._maxQueueLength;)this._queue.shift().callback(null,null)},e.prototype._dispatch=function(){if(0===this._running&&this._queue.length>0){var t=this._queue.shift();this._job=t;var e=t.inputs[0].width,r=t.inputs[0].height,n=t.inputs.map((function(t){return t.data.buffer})),i=this._workers.length;if(this._running=i,1===i)this._workers[0].postMessage({buffers:n,meta:t.meta,imageOps:this._imageOps,width:e,height:r},n);else for(var o=t.inputs[0].data.length,a=4*Math.ceil(o/4/i),s=0;sStamen Design, under CC BY 3.0.',nd],Vd={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}},Yd={terrain:{minZoom:0,maxZoom:18},toner:{minZoom:0,maxZoom:20},watercolor:{minZoom:0,maxZoom:18}},Wd=function(t){function e(e){var r=e.layer.indexOf("-"),n=-1==r?e.layer:e.layer.slice(0,r),i=Yd[n],o=Vd[e.layer],a=void 0!==e.url?e.url:"https://stamen-tiles-{a-d}.a.ssl.fastly.net/"+e.layer+"/{z}/{x}/{y}."+o.extension;return t.call(this,{attributions:Bd,cacheSize:e.cacheSize,crossOrigin:"anonymous",imageSmoothing:e.imageSmoothing,maxZoom:null!=e.maxZoom?e.maxZoom:i.maxZoom,minZoom:null!=e.minZoom?e.minZoom:i.minZoom,opaque:o.opaque,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileLoadFunction:e.tileLoadFunction,transition:e.transition,url:a,wrapX:e.wrapX})||this}return Ud(e,t),e}(Jp),qd=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Xd=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this,{attributions:n.attributions,cacheSize:n.cacheSize,crossOrigin:n.crossOrigin,imageSmoothing:n.imageSmoothing,projection:n.projection,reprojectionErrorThreshold:n.reprojectionErrorThreshold,tileGrid:n.tileGrid,tileLoadFunction:n.tileLoadFunction,url:n.url,urls:n.urls,wrapX:void 0===n.wrapX||n.wrapX,transition:n.transition})||this).params_=n.params||{},r.hidpi_=void 0===n.hidpi||n.hidpi,r.tmpExtent_=[1/0,1/0,-1/0,-1/0],r.setKey(r.getKeyForParams_()),r}return qd(e,t),e.prototype.getKeyForParams_=function(){var t=0,e=[];for(var r in this.params_)e[t++]=r+"-"+this.params_[r];return e.join("/")},e.prototype.getParams=function(){return this.params_},e.prototype.getRequestUrl_=function(t,e,r,n,i,o){var a=this.urls;if(a){var s,l=i.getCode().split(":").pop();if(o.SIZE=e[0]+","+e[1],o.BBOX=r.join(","),o.BBOXSR=l,o.IMAGESR=l,o.DPI=Math.round(o.DPI?o.DPI*n:90*n),1==a.length)s=a[0];else s=a[We(fu(t),a.length)];return mc(s.replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage"),o)}},e.prototype.getTilePixelRatio=function(t){return this.hidpi_?t:1},e.prototype.updateParams=function(t){O(this.params_,t),this.setKey(this.getKeyForParams_())},e.prototype.tileUrlFunction=function(t,e,r){var n=this.getTileGrid();if(n||(n=this.getTileGridForProjection(r)),!(n.getResolutions().length<=t[0])){1==e||this.hidpi_||(e=1);var i=n.getTileCoordExtent(t,this.tmpExtent_),o=Is(n.getTileSize(t[0]),this.tmpSize);1!=e&&(o=Rs(o,e,this.tmpSize));var a={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};return O(a,this.params_),this.getRequestUrl_(t,o,i,e,r,a)}},e}(Xp),Zd=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Kd=function(t){function e(e,r,n){var i=t.call(this,e,to)||this;return i.tileSize_=r,i.text_=n,i.canvas_=null,i}return Zd(e,t),e.prototype.getImage=function(){if(this.canvas_)return this.canvas_;var t=this.tileSize_,e=uo(t[0],t[1]);return e.strokeStyle="grey",e.strokeRect(.5,.5,t[0]+.5,t[1]+.5),e.fillStyle="grey",e.strokeStyle="white",e.textAlign="center",e.textBaseline="middle",e.font="24px sans-serif",e.lineWidth=4,e.strokeText(this.text_,t[0]/2,t[1]/2,t[0]),e.fillText(this.text_,t[0]/2,t[1]/2,t[0]),this.canvas_=e.canvas,e.canvas},e.prototype.load=function(){},e}(lo),Hd=function(t){function e(e){var r=e||{};return t.call(this,{opaque:!1,projection:r.projection,tileGrid:r.tileGrid,wrapX:void 0===r.wrapX||r.wrapX,zDirection:r.zDirection})||this}return Zd(e,t),e.prototype.getTile=function(t,e,r){var n=cu(t,e,r);if(this.tileCache.containsKey(n))return this.tileCache.get(n);var i=Is(this.tileGrid.getTileSize(t)),o=[t,e,r],a=this.getTileCoordForTileUrlFunction(o),s=void 0;s=a?"z:"+a[0]+" x:"+a[1]+" y:"+a[2]:"none";var l=new Kd(o,i,s);return this.tileCache.set(n,l),l},e}(Jp),$d=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Jd=function(t){function e(e){var r=t.call(this,{attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,imageSmoothing:e.imageSmoothing,projection:Gr("EPSG:3857"),reprojectionErrorThreshold:e.reprojectionErrorThreshold,state:Jo,tileLoadFunction:e.tileLoadFunction,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition})||this;if(r.tileJSON_=null,r.tileSize_=e.tileSize,e.url)if(e.jsonp)Au(e.url,r.handleTileJSONResponse.bind(r),r.handleTileJSONError.bind(r));else{var n=new XMLHttpRequest;n.addEventListener("load",r.onXHRLoad_.bind(r)),n.addEventListener("error",r.onXHRError_.bind(r)),n.open("GET",e.url),n.send()}else e.tileJSON?r.handleTileJSONResponse(e.tileJSON):pt(!1,51);return r}return $d(e,t),e.prototype.onXHRLoad_=function(t){var e=t.target;if(!e.status||e.status>=200&&e.status<300){var r=void 0;try{r=JSON.parse(e.responseText)}catch(t){return void this.handleTileJSONError()}this.handleTileJSONResponse(r)}else this.handleTileJSONError()},e.prototype.onXHRError_=function(t){this.handleTileJSONError()},e.prototype.getTileJSON=function(){return this.tileJSON_},e.prototype.handleTileJSONResponse=function(t){var e,r=Gr("EPSG:4326"),n=this.getProjection();if(void 0!==t.bounds){var i=Zr(r,n);e=Ae(t.bounds,i)}var o=t.minzoom||0,a=t.maxzoom||22,s=lc({extent:hc(n),maxZoom:a,minZoom:o,tileSize:this.tileSize_});if(this.tileGrid=s,this.tileUrlFunction=fc(t.tiles,s),void 0!==t.attribution&&!this.getAttributions()){var l=void 0!==e?e:r.getExtent();this.setAttributions((function(e){return Re(l,e.extent)?[t.attribution]:null}))}this.tileJSON_=t,this.setState(Qo)},e.prototype.handleTileJSONError=function(){this.setState(ta)},e}(Xp),Qd=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),tg=function(t){function e(e){var r=this,n=e||{},i=n.params||{},o=!("TRANSPARENT"in i)||i.TRANSPARENT;return(r=t.call(this,{attributions:n.attributions,cacheSize:n.cacheSize,crossOrigin:n.crossOrigin,imageSmoothing:n.imageSmoothing,opaque:!o,projection:n.projection,reprojectionErrorThreshold:n.reprojectionErrorThreshold,tileClass:n.tileClass,tileGrid:n.tileGrid,tileLoadFunction:n.tileLoadFunction,url:n.url,urls:n.urls,wrapX:void 0===n.wrapX||n.wrapX,transition:n.transition})||this).gutter_=void 0!==n.gutter?n.gutter:0,r.params_=i,r.v13_=!0,r.serverType_=n.serverType,r.hidpi_=void 0===n.hidpi||n.hidpi,r.tmpExtent_=[1/0,1/0,-1/0,-1/0],r.updateV13_(),r.setKey(r.getKeyForParams_()),r}return Qd(e,t),e.prototype.getFeatureInfoUrl=function(t,e,r,n){var i=Gr(r),o=this.getProjection(),a=this.getTileGrid();a||(a=this.getTileGridForProjection(i));var s=a.getZForResolution(e,this.zDirection),l=a.getTileCoordForCoordAndZ(t,s);if(!(a.getResolutions().length<=l[0])){var u=a.getResolution(l[0]),c=a.getTileCoordExtent(l,this.tmpExtent_),h=Is(a.getTileSize(l[0]),this.tmpSize),p=this.gutter_;0!==p&&(h=Os(h,p,this.tmpSize),c=Ht(c,u*p,c)),o&&o!==i&&(u=tc(o,i,t,u),c=$r(c,i,o),t=Hr(t,i,o));var f={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.params_.LAYERS};O(f,this.params_,n);var d=Math.floor((t[0]-c[0])/u),g=Math.floor((c[3]-t[1])/u);return f[this.v13_?"I":"X"]=d,f[this.v13_?"J":"Y"]=g,this.getRequestUrl_(l,h,c,1,o||i,f)}},e.prototype.getLegendUrl=function(t,e){if(void 0!==this.urls[0]){var r={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){var n=this.params_.LAYERS;if(!(!Array.isArray(n)||1===n.length))return;r.LAYER=n}if(void 0!==t){var i=this.getProjection()?this.getProjection().getMetersPerUnit():1;r.SCALE=t*i/28e-5}return O(r,e),mc(this.urls[0],r)}},e.prototype.getGutter=function(){return this.gutter_},e.prototype.getParams=function(){return this.params_},e.prototype.getRequestUrl_=function(t,e,r,n,i,o){var a=this.urls;if(a){if(o.WIDTH=e[0],o.HEIGHT=e[1],o[this.v13_?"CRS":"SRS"]=i.getCode(),"STYLES"in this.params_||(o.STYLES=""),1!=n)switch(this.serverType_){case Hf:var s=90*n+.5|0;"FORMAT_OPTIONS"in o?o.FORMAT_OPTIONS+=";dpi:"+s:o.FORMAT_OPTIONS="dpi:"+s;break;case $f:o.MAP_RESOLUTION=90*n;break;case Kf:case Jf:o.DPI=90*n;break;default:pt(!1,52)}var l,u=i.getAxisOrientation(),c=r;if(this.v13_&&"ne"==u.substr(0,2)){var h=void 0;h=r[0],c[0]=r[1],c[1]=h,h=r[2],c[2]=r[3],c[3]=h}if(o.BBOX=c.join(","),1==a.length)l=a[0];else l=a[We(fu(t),a.length)];return mc(l,o)}},e.prototype.getTilePixelRatio=function(t){return this.hidpi_&&void 0!==this.serverType_?t:1},e.prototype.getKeyForParams_=function(){var t=0,e=[];for(var r in this.params_)e[t++]=r+"-"+this.params_[r];return e.join("/")},e.prototype.updateParams=function(t){O(this.params_,t),this.updateV13_(),this.setKey(this.getKeyForParams_())},e.prototype.updateV13_=function(){var t=this.params_.VERSION||"1.3.0";this.v13_=br(t,"1.3")>=0},e.prototype.tileUrlFunction=function(t,e,r){var n=this.getTileGrid();if(n||(n=this.getTileGridForProjection(r)),!(n.getResolutions().length<=t[0])){1==e||this.hidpi_&&void 0!==this.serverType_||(e=1);var i=n.getResolution(t[0]),o=n.getTileCoordExtent(t,this.tmpExtent_),a=Is(n.getTileSize(t[0]),this.tmpSize),s=this.gutter_;0!==s&&(a=Os(a,s,this.tmpSize),o=Ht(o,i*s,o)),1!=e&&(a=Rs(a,e,this.tmpSize));var l={SERVICE:"WMS",VERSION:"1.3.0",REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};return O(l,this.params_),this.getRequestUrl_(t,a,o,e,r,l)}},e}(Xp),eg=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),rg=function(t){function e(e,r,n,i,o,a){var s=t.call(this,e,r)||this;return s.src_=n,s.extent_=i,s.preemptive_=o,s.grid_=null,s.keys_=null,s.data_=null,s.jsonp_=a,s}return eg(e,t),e.prototype.getImage=function(){return null},e.prototype.getData=function(t){if(!this.grid_||!this.keys_)return null;var e=(t[0]-this.extent_[0])/(this.extent_[2]-this.extent_[0]),r=(t[1]-this.extent_[1])/(this.extent_[3]-this.extent_[1]),n=this.grid_[Math.floor((1-r)*this.grid_.length)];if("string"!=typeof n)return null;var i=n.charCodeAt(Math.floor(e*n.length));i>=93&&i--,i>=35&&i--;var o=null;if((i-=32)in this.keys_){var a=this.keys_[i];o=this.data_&&a in this.data_?this.data_[a]:a}return o},e.prototype.forDataAtCoordinate=function(t,e,r){this.state==ro&&!0===r?(this.state=Ji,K(this,F,(function(r){e(this.getData(t))}),this),this.loadInternal_()):!0===r?setTimeout(function(){e(this.getData(t))}.bind(this),0):e(this.getData(t))},e.prototype.getKey=function(){return this.src_},e.prototype.handleError_=function(){this.state=eo,this.changed()},e.prototype.handleLoad_=function(t){this.grid_=t.grid,this.keys_=t.keys,this.data_=t.data,this.state=to,this.changed()},e.prototype.loadInternal_=function(){if(this.state==Ji)if(this.state=Qi,this.jsonp_)Au(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()}},e.prototype.onXHRLoad_=function(t){var e=t.target;if(!e.status||e.status>=200&&e.status<300){var r=void 0;try{r=JSON.parse(e.responseText)}catch(t){return void this.handleError_()}this.handleLoad_(r)}else this.handleError_()},e.prototype.onXHRError_=function(t){this.handleError_()},e.prototype.load=function(){this.preemptive_?this.loadInternal_():this.setState(ro)},e}(lo),ng=function(t){function e(e){var r=t.call(this,{projection:Gr("EPSG:3857"),state:Jo})||this;if(r.preemptive_=void 0===e.preemptive||e.preemptive,r.tileUrlFunction_=gc,r.template_=void 0,r.jsonp_=e.jsonp||!1,e.url)if(r.jsonp_)Au(e.url,r.handleTileJSONResponse.bind(r),r.handleTileJSONError.bind(r));else{var n=new XMLHttpRequest;n.addEventListener("load",r.onXHRLoad_.bind(r)),n.addEventListener("error",r.onXHRError_.bind(r)),n.open("GET",e.url),n.send()}else e.tileJSON?r.handleTileJSONResponse(e.tileJSON):pt(!1,51);return r}return eg(e,t),e.prototype.onXHRLoad_=function(t){var e=t.target;if(!e.status||e.status>=200&&e.status<300){var r=void 0;try{r=JSON.parse(e.responseText)}catch(t){return void this.handleTileJSONError()}this.handleTileJSONResponse(r)}else this.handleTileJSONError()},e.prototype.onXHRError_=function(t){this.handleTileJSONError()},e.prototype.getTemplate=function(){return this.template_},e.prototype.forDataAtCoordinateAndResolution=function(t,e,r,n){if(this.tileGrid){var i=this.tileGrid.getZForResolution(e,this.zDirection),o=this.tileGrid.getTileCoordForCoordAndZ(t,i);this.getTile(o[0],o[1],o[2],1,this.getProjection()).forDataAtCoordinate(t,r,n)}else!0===n?setTimeout((function(){r(null)}),0):r(null)},e.prototype.handleTileJSONError=function(){this.setState(ta)},e.prototype.handleTileJSONResponse=function(t){var e,r=Gr("EPSG:4326"),n=this.getProjection();if(void 0!==t.bounds){var i=Zr(r,n);e=Ae(t.bounds,i)}var o=t.minzoom||0,a=t.maxzoom||22,s=lc({extent:hc(n),maxZoom:a,minZoom:o});this.tileGrid=s,this.template_=t.template;var l=t.grids;if(l){if(this.tileUrlFunction_=fc(l,s),void 0!==t.attribution){var u=void 0!==e?e:r.getExtent();this.setAttributions((function(e){return Re(u,e.extent)?[t.attribution]:null}))}this.setState(Qo)}else this.setState(ta)},e.prototype.getTile=function(t,e,r,n,i){var o=cu(t,e,r);if(this.tileCache.containsKey(o))return this.tileCache.get(o);var a=[t,e,r],s=this.getTileCoordForTileUrlFunction(a,i),l=this.tileUrlFunction_(s,n,i),u=new rg(a,void 0!==l?Ji:ro,void 0!==l?l:"",this.tileGrid.getTileCoordExtent(a),this.preemptive_,this.jsonp_);return this.tileCache.set(o,u),u},e.prototype.useTile=function(t,e,r){var n=cu(t,e,r);this.tileCache.containsKey(n)&&this.tileCache.get(n)},e}(Bp),ig=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),og=function(t){function e(e){var r=this,n=e.projection||"EPSG:3857",i=e.extent||hc(n),o=e.tileGrid||lc({extent:i,maxResolution:e.maxResolution,maxZoom:void 0!==e.maxZoom?e.maxZoom:22,minZoom:e.minZoom,tileSize:e.tileSize||512});return(r=t.call(this,{attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,cacheSize:e.cacheSize,opaque:!1,projection:n,state:e.state,tileGrid:o,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:ag,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition,zDirection:void 0===e.zDirection?1:e.zDirection})||this).format_=e.format?e.format:null,r.loadingTiles_={},r.sourceTileCache=new yu(r.tileCache.highWaterMark),r.overlaps_=null==e.overlaps||e.overlaps,r.tileClass=e.tileClass?e.tileClass:Eu,r.tileGrids_={},r}return ig(e,t),e.prototype.getFeaturesInExtent=function(t){var e=[],r=this.tileCache;if(0===r.getCount())return e;var n=pu(r.peekFirstKey())[0],i=this.tileGrid;return r.forEach((function(r){if(r.tileCoord[0]===n&&r.getState()===to)for(var o=r.getSourceTiles(),a=0,s=o.length;a0&&g[0].tileCoord[0]===f)c=g,h=!0,p=f;else{c=[],p=f+1;do{--p,h=!0,l.forEachTileCoord(o,p,function(n){var i,o=this.tileUrlFunction(n,t,e);if(void 0!==o)if(this.sourceTileCache.containsKey(o)){var a=(i=this.sourceTileCache.get(o)).getState();if(a===to||a===eo||a===ro)return void c.push(i)}else p===f&&((i=new this.tileClass(n,Ji,o,this.format_,this.tileLoadFunction)).extent=l.getTileCoordExtent(n),i.projection=e,i.resolution=l.getResolution(n[0]),this.sourceTileCache.set(o,i),i.addEventListener(F,this.handleTileChange.bind(this)),i.load());h=h&&i&&i.getState()===to,i&&i.getState()!==ro&&r.getState()===Ji&&(r.loadingSourceTiles++,i.addEventListener(F,(function t(){var e=i.getState(),n=i.getKey();if(e===to||e===eo){e===to?(i.removeEventListener(F,t),r.loadingSourceTiles--,delete r.errorSourceTileKeys[n]):e===eo&&(r.errorSourceTileKeys[n]=!0);var o=Object.keys(r.errorSourceTileKeys).length;r.loadingSourceTiles-o==0&&(r.hifi=0===o,r.sourceZ=f,r.setState(to))}})))}.bind(this)),h||(c.length=0)}while(!h&&p>d)}return r.getState()===Ji&&r.setState(Qi),h&&(r.hifi=f===p,r.sourceZ=p,r.getState()0&&(r.tileUrlFunction=dc(o.map(r.createFromWMTSTemplate.bind(r)))),r}return ug(e,t),e.prototype.setUrls=function(t){this.urls=t;var e=t.join("\n");this.setTileUrlFunction(dc(t.map(this.createFromWMTSTemplate.bind(this))),e)},e.prototype.getDimensions=function(){return this.dimensions_},e.prototype.getFormat=function(){return this.format_},e.prototype.getLayer=function(){return this.layer_},e.prototype.getMatrixSet=function(){return this.matrixSet_},e.prototype.getRequestEncoding=function(){return this.requestEncoding_},e.prototype.getStyle=function(){return this.style_},e.prototype.getVersion=function(){return this.version_},e.prototype.getKeyForDimensions_=function(){var t=0,e=[];for(var r in this.dimensions_)e[t++]=r+"-"+this.dimensions_[r];return e.join("/")},e.prototype.updateDimensions=function(t){O(this.dimensions_,t),this.setKey(this.getKeyForDimensions_())},e.prototype.createFromWMTSTemplate=function(t){var e=this.requestEncoding_,r={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};e==sg&&O(r,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_}),t=e==sg?mc(t,r):t.replace(/\{(\w+?)\}/g,(function(t,e){return e.toLowerCase()in r?r[e.toLowerCase()]:t}));var n=this.tileGrid,i=this.dimensions_;return function(r,o,a){if(r){var s={TileMatrix:n.getMatrixId(r[0]),TileCol:r[1],TileRow:r[2]};O(s,i);var l=t;return l=e==sg?mc(l,s):l.replace(/\{(\w+?)\}/g,(function(t,e){return s[e]}))}}},e}(Xp);var hg=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),pg="GENERATE_BUFFERS",fg=function(t){function e(e,r){var n=t.call(this,e)||this,i=r||{};return n.helper=new gh({postProcesses:i.postProcesses,uniforms:i.uniforms}),void 0!==i.className&&(n.helper.getCanvas().className=i.className),n}return hg(e,t),e.prototype.disposeInternal=function(){this.helper.dispose(),t.prototype.disposeInternal.call(this)},e.prototype.getShaderCompileErrors=function(){return this.helper.getShaderCompileErrors()},e.prototype.dispatchRenderEvent_=function(t,e){var r=this.getLayer();if(r.hasListener(t)){var n=new la(t,null,e,null);r.dispatchEvent(n)}},e.prototype.preRender=function(t){this.dispatchRenderEvent_(qo,t)},e.prototype.postRender=function(t){this.dispatchRenderEvent_(Xo,t)},e}(ld),dg=[],gg={vertexPosition:0,indexPosition:0};function yg(t,e,r,n,i){t[e+0]=r,t[e+1]=n,t[e+2]=i}function mg(t,e){var r=e||[];return r[0]=Math.floor(t/256/256/256)/255,r[1]=Math.floor(t/256/256)%256/255,r[2]=Math.floor(t/256)%256/255,r[3]=t%256/255,r}function vg(t){var e=0;return e+=Math.round(256*t[0]*256*256*255),e+=Math.round(256*t[1]*256*255),e+=Math.round(256*t[2]*255),e+=Math.round(255*t[3])}var _g=fg,bg=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),xg="renderOrder",wg=function(t){function e(e){var r=this,n=e||{},i=O({},n);return delete i.style,delete i.renderBuffer,delete i.updateWhileAnimating,delete i.updateWhileInteracting,(r=t.call(this,i)||this).declutter_=void 0!==n.declutter&&n.declutter,r.renderBuffer_=void 0!==n.renderBuffer?n.renderBuffer:100,r.style_=null,r.styleFunction_=void 0,r.setStyle(n.style),r.updateWhileAnimating_=void 0!==n.updateWhileAnimating&&n.updateWhileAnimating,r.updateWhileInteracting_=void 0!==n.updateWhileInteracting&&n.updateWhileInteracting,r}return bg(e,t),e.prototype.getDeclutter=function(){return this.declutter_},e.prototype.getFeatures=function(e){return t.prototype.getFeatures.call(this,e)},e.prototype.getRenderBuffer=function(){return this.renderBuffer_},e.prototype.getRenderOrder=function(){return this.get(xg)},e.prototype.getStyle=function(){return this.style_},e.prototype.getStyleFunction=function(){return this.styleFunction_},e.prototype.getUpdateWhileAnimating=function(){return this.updateWhileAnimating_},e.prototype.getUpdateWhileInteracting=function(){return this.updateWhileInteracting_},e.prototype.renderDeclutter=function(t){t.declutterTree||(t.declutterTree=new Pp.a(9)),this.getRenderer().renderDeclutter(t)},e.prototype.setRenderOrder=function(t){this.set(xg,t)},e.prototype.setStyle=function(t){this.style_=void 0!==t?t:_p,this.styleFunction_=null===t?void 0:mp(this.style_),this.changed()},e}(na),Sg=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Eg=function(t){function e(e,r){var n=this,i=r.uniforms||{},a=[1,0,0,1,0,0];i[ah]=a,(n=t.call(this,e,{className:r.className,uniforms:i,postProcesses:r.postProcesses})||this).sourceRevision_=-1,n.verticesBuffer_=new Qc(34962,35048),n.hitVerticesBuffer_=new Qc(34962,35048),n.indicesBuffer_=new Qc(34963,35048),n.program_=n.helper.getProgram(r.fragmentShader,r.vertexShader),n.hitDetectionEnabled_=!(!r.hitFragmentShader||!r.hitVertexShader),n.hitProgram_=n.hitDetectionEnabled_&&n.helper.getProgram(r.hitFragmentShader,r.hitVertexShader);var s=r.attributes?r.attributes.map((function(t){return{name:"a_"+t.name,size:1,type:ph.FLOAT}})):[];n.attributes=[{name:"a_position",size:2,type:ph.FLOAT},{name:"a_index",size:1,type:ph.FLOAT}].concat(s),n.hitDetectionAttributes=[{name:"a_position",size:2,type:ph.FLOAT},{name:"a_index",size:1,type:ph.FLOAT},{name:"a_hitColor",size:4,type:ph.FLOAT},{name:"a_featureUid",size:1,type:ph.FLOAT}].concat(s),n.customAttributes=r.attributes?r.attributes:[],n.previousExtent_=[1/0,1/0,-1/0,-1/0],n.currentTransform_=a,n.renderTransform_=[1,0,0,1,0,0],n.invertRenderTransform_=[1,0,0,1,0,0],n.renderInstructions_=new Float32Array(0),n.hitRenderInstructions_=new Float32Array(0),n.hitRenderTarget_=n.hitDetectionEnabled_&&new mh(n.helper),n.worker_=new Worker(Hc),n.worker_.addEventListener("message",function(t){var e=t.data;if(e.type===pg){var r=e.projectionTransform;e.hitDetection?(this.hitVerticesBuffer_.fromArrayBuffer(e.vertexBuffer),this.helper.flushBufferData(this.hitVerticesBuffer_)):(this.verticesBuffer_.fromArrayBuffer(e.vertexBuffer),this.helper.flushBufferData(this.verticesBuffer_)),this.indicesBuffer_.fromArrayBuffer(e.indexBuffer),this.helper.flushBufferData(this.indicesBuffer_),this.renderTransform_=r,jt(this.invertRenderTransform_,this.renderTransform_),e.hitDetection?this.hitRenderInstructions_=new Float32Array(t.data.renderInstructions):this.renderInstructions_=new Float32Array(t.data.renderInstructions),this.getLayer().changed()}}.bind(n)),n.featureCache_={},n.featureCount_=0;var l=n.getLayer().getSource();return n.sourceListenKeys_=[Z(l,ef,n.handleSourceFeatureAdded_,n),Z(l,rf,n.handleSourceFeatureChanged_,n),Z(l,of,n.handleSourceFeatureDelete_,n),Z(l,nf,n.handleSourceFeatureClear_,n)],l.forEachFeature(function(t){this.featureCache_[o(t)]={feature:t,properties:t.getProperties(),geometry:t.getGeometry()},this.featureCount_++}.bind(n)),n}return Sg(e,t),e.prototype.handleSourceFeatureAdded_=function(t){var e=t.feature;this.featureCache_[o(e)]={feature:e,properties:e.getProperties(),geometry:e.getGeometry()},this.featureCount_++},e.prototype.handleSourceFeatureChanged_=function(t){var e=t.feature;this.featureCache_[o(e)]={feature:e,properties:e.getProperties(),geometry:e.getGeometry()}},e.prototype.handleSourceFeatureDelete_=function(t){var e=t.feature;delete this.featureCache_[o(e)],this.featureCount_--},e.prototype.handleSourceFeatureClear_=function(){this.featureCache_={},this.featureCount_=0},e.prototype.renderFrame=function(t){this.preRender(t);var e=this.indicesBuffer_.getSize();this.helper.drawElements(0,e),this.helper.finalizeDraw(t);var r=this.helper.getCanvas(),n=t.layerStatesArray[t.layerIndex].opacity;return n!==parseFloat(r.style.opacity)&&(r.style.opacity=String(n)),this.hitDetectionEnabled_&&(this.renderHitDetection(t),this.hitRenderTarget_.clearCachedData()),this.postRender(t),r},e.prototype.prepareFrame=function(t){var e=this.getLayer(),r=e.getSource(),n=t.viewState,i=!t.viewHints[ns]&&!t.viewHints[is],o=!ue(this.previousExtent_,t.extent),a=this.sourceRevision_c&&this.instructions.push([Ig.CUSTOM,c,i,t,r,Nn])):l==bt.POINT&&(n=t.getFlatCoordinates(),this.coordinates.push(n[0],n[1]),i=this.coordinates.length,this.instructions.push([Ig.CUSTOM,c,i,t,r]));this.endGeometry(e)},e.prototype.beginGeometry=function(t,e){this.beginGeometryInstruction1_=[Ig.BEGIN_GEOMETRY,e,0,t],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[Ig.BEGIN_GEOMETRY,e,0,t],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)},e.prototype.finish=function(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}},e.prototype.reverseHitDetectionInstructions=function(){var t,e=this.hitDetectionInstructions;e.reverse();var r,n,i=e.length,o=-1;for(t=0;tthis.maxLineWidth&&(this.maxLineWidth=r.lineWidth,this.bufferedMaxExtent_=null)}else r.strokeStyle=void 0,r.lineCap=void 0,r.lineDash=null,r.lineDashOffset=void 0,r.lineJoin=void 0,r.lineWidth=void 0,r.miterLimit=void 0},e.prototype.createFill=function(t){var e=t.fillStyle,r=[Ig.SET_FILL_STYLE,e];return"string"!=typeof e&&r.push(!0),r},e.prototype.applyStroke=function(t){this.instructions.push(this.createStroke(t))},e.prototype.createStroke=function(t){return[Ig.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]},e.prototype.updateFillStyle=function(t,e){var r=t.fillStyle;"string"==typeof r&&t.currentFillStyle==r||(void 0!==r&&this.instructions.push(e.call(this,t)),t.currentFillStyle=r)},e.prototype.updateStrokeStyle=function(t,e){var r=t.strokeStyle,n=t.lineCap,i=t.lineDash,o=t.lineDashOffset,a=t.lineJoin,s=t.lineWidth,l=t.miterLimit;(t.currentStrokeStyle!=r||t.currentLineCap!=n||i!=t.currentLineDash&&!b(t.currentLineDash,i)||t.currentLineDashOffset!=o||t.currentLineJoin!=a||t.currentLineWidth!=s||t.currentMiterLimit!=l)&&(void 0!==r&&e.call(this,t),t.currentStrokeStyle=r,t.currentLineCap=n,t.currentLineDash=i,t.currentLineDashOffset=o,t.currentLineJoin=a,t.currentLineWidth=s,t.currentMiterLimit=l)},e.prototype.endGeometry=function(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;var e=[Ig.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)},e.prototype.getBufferedMaxExtent=function(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=$t(this.maxExtent),this.maxLineWidth>0)){var t=this.resolution*(this.maxLineWidth+1)/2;Ht(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_},e}(ku),Fg=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ag=function(t){function e(e,r,n,i){var o=t.call(this,e,r,n,i)||this;return o.hitDetectionImage_=null,o.image_=null,o.imagePixelRatio_=void 0,o.anchorX_=void 0,o.anchorY_=void 0,o.height_=void 0,o.opacity_=void 0,o.originX_=void 0,o.originY_=void 0,o.rotateWithView_=void 0,o.rotation_=void 0,o.scale_=void 0,o.width_=void 0,o.declutterImageWithText_=void 0,o}return Fg(e,t),e.prototype.drawPoint=function(t,e){if(this.image_){this.beginGeometry(t,e);var r=t.getFlatCoordinates(),n=t.getStride(),i=this.coordinates.length,o=this.appendFlatPointCoordinates(r,n);this.instructions.push([Ig.DRAW_IMAGE,i,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterImageWithText_]),this.hitDetectionInstructions.push([Ig.DRAW_IMAGE,i,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterImageWithText_]),this.endGeometry(e)}},e.prototype.drawMultiPoint=function(t,e){if(this.image_){this.beginGeometry(t,e);var r=t.getFlatCoordinates(),n=t.getStride(),i=this.coordinates.length,o=this.appendFlatPointCoordinates(r,n);this.instructions.push([Ig.DRAW_IMAGE,i,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterImageWithText_]),this.hitDetectionInstructions.push([Ig.DRAW_IMAGE,i,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterImageWithText_]),this.endGeometry(e)}},e.prototype.finish=function(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,t.prototype.finish.call(this)},e.prototype.setImageStyle=function(t,e){var r=t.getAnchor(),n=t.getSize(),i=t.getHitDetectionImage(),o=t.getImage(this.pixelRatio),a=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=r[0],this.anchorY_=r[1],this.hitDetectionImage_=i,this.image_=o,this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=a[0],this.originY_=a[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=n[0],this.declutterImageWithText_=e},e}(Mg),kg=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),jg=function(t){function e(e,r,n,i){return t.call(this,e,r,n,i)||this}return kg(e,t),e.prototype.drawFlatCoordinates_=function(t,e,r,n){var i=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,r,n,!1,!1),a=[Ig.MOVE_TO_LINE_TO,i,o];return this.instructions.push(a),this.hitDetectionInstructions.push(a),r},e.prototype.drawLineString=function(t,e){var r=this.state,n=r.strokeStyle,i=r.lineWidth;if(void 0!==n&&void 0!==i){this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([Ig.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset],Pg);var o=t.getFlatCoordinates(),a=t.getStride();this.drawFlatCoordinates_(o,0,o.length,a),this.hitDetectionInstructions.push(Og),this.endGeometry(e)}},e.prototype.drawMultiLineString=function(t,e){var r=this.state,n=r.strokeStyle,i=r.lineWidth;if(void 0!==n&&void 0!==i){this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([Ig.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset],Pg);for(var o=t.getEnds(),a=t.getFlatCoordinates(),s=t.getStride(),l=0,u=0,c=o.length;ut&&(m>y&&(y=m,d=v,g=o),m=0,v=o-i)),a=s,c=p,h=f),l=_,u=b}return(m+=s)>y?[v,o]:[d,g]}var zg=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ug={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},Bg=function(t){function e(e,r,n,i){var o=t.call(this,e,r,n,i)||this;return o.labels_=null,o.text_="",o.textOffsetX_=0,o.textOffsetY_=0,o.textRotateWithView_=void 0,o.textRotation_=0,o.textFillState_=null,o.fillStates={},o.textStrokeState_=null,o.strokeStates={},o.textState_={},o.textStates={},o.textKey_="",o.fillKey_="",o.strokeKey_="",o.declutterImageWithText_=void 0,o}return zg(e,t),e.prototype.finish=function(){var e=t.prototype.finish.call(this);return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e},e.prototype.drawText=function(t,e){var r=this.textFillState_,n=this.textStrokeState_,i=this.textState_;if(""!==this.text_&&i&&(r||n)){var o=this.coordinates,a=o.length,s=t.getType(),l=null,u=t.getStride();if(i.placement!==Ep||s!=bt.LINE_STRING&&s!=bt.MULTI_LINE_STRING&&s!=bt.POLYGON&&s!=bt.MULTI_POLYGON){var c=i.overflow?null:[];switch(s){case bt.POINT:case bt.MULTI_POINT:l=t.getFlatCoordinates();break;case bt.LINE_STRING:l=t.getFlatMidpoint();break;case bt.CIRCLE:l=t.getCenter();break;case bt.MULTI_LINE_STRING:l=t.getFlatMidpoints(),u=2;break;case bt.POLYGON:l=t.getFlatInteriorPoint(),i.overflow||c.push(l[2]/this.resolution),u=3;break;case bt.MULTI_POLYGON:var h=t.getFlatInteriorPoints();l=[];for(x=0,w=h.length;xP[2]}else T=b>C;var R,I=Math.PI,L=[],M=w+n===e;if(y=0,m=S,p=t[e=w],f=t[e+1],M){v();var F=Math.atan2(f-g,p-d);T&&(F+=F>0?-I:I);var A=(C+b)/2,k=(O+x)/2;return L[0]=[A,k,(E-o)/2,F,i],L}for(var j=0,N=i.length;j0?-I:I),void 0!==R){var G=D-R;if(G+=G>I?-2*I:G<-I?2*I:0,Math.abs(G)>a)return null}R=D;for(var z=j,U=0;jt?t-l:i,b=o+u>e?e-u:o,x=f[3]+_*h[0]+f[1],w=f[0]+b*h[1]+f[2],S=m-f[3],E=v-f[0];return(d||0!==c)&&(Zg[0]=S,$g[0]=S,Zg[1]=E,Kg[1]=E,Kg[0]=S+x,Hg[0]=Kg[0],Hg[1]=E+w,$g[1]=Hg[1]),0!==c?(It(y=kt([1,0,0,1,0,0],r,n,1,1,c,-r,-n),Zg),It(y,Kg),It(y,Hg),It(y,$g),ie(Math.min(Zg[0],Kg[0],Hg[0],$g[0]),Math.min(Zg[1],Kg[1],Hg[1],$g[1]),Math.max(Zg[0],Kg[0],Hg[0],$g[0]),Math.max(Zg[1],Kg[1],Hg[1],$g[1]),Xg)):ie(Math.min(S,S+x),Math.min(E,E+w),Math.max(S,S+x),Math.max(E,E+w),Xg),p&&(m=Math.round(m),v=Math.round(v)),{drawImageX:m,drawImageY:v,drawImageW:_,drawImageH:b,originX:l,originY:u,declutterBox:{minX:Xg[0],minY:Xg[1],maxX:Xg[2],maxY:Xg[3],value:g},canvasTransform:y,scale:h}},t.prototype.replayImageOrLabel_=function(t,e,r,n,i,o,a){var s=!(!o&&!a),l=n.declutterBox,u=t.canvas,c=a?a[2]*n.scale[0]/2:0;return l.minX-c<=u.width/e&&l.maxX+c>=0&&l.minY-c<=u.height/e&&l.maxY+c>=0&&(s&&this.replayTextBackground_(t,Zg,Kg,Hg,$g,o,a),Oa(t,n.canvasTransform,i,r,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0},t.prototype.fill_=function(t){if(this.alignFill_){var e=It(this.renderedTransform_,[0,0]),r=512*this.pixelRatio;t.save(),t.translate(e[0]%r,e[1]%r),t.rotate(this.viewRotation_)}t.fill(),this.alignFill_&&t.restore()},t.prototype.setStrokeStyle_=function(t,e){t.strokeStyle=e[1],t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.setLineDash&&(t.lineDashOffset=e[7],t.setLineDash(e[6]))},t.prototype.drawLabelWithPointPlacement_=function(t,e,r,n){var i=this.textStates[e],o=this.createLabel(t,e,n,r),a=this.strokeStates[r],s=this.pixelRatio,l=ty(t,i.textAlign||"center"),u=Ug[i.textBaseline||"middle"],c=a&&a.lineWidth?a.lineWidth:0;return{label:o,anchorX:l*(o.width/s-2*i.scale[0])+2*(.5-l)*c,anchorY:u*o.height/s+2*(.5-u)*c}},t.prototype.execute_=function(t,e,r,n,i,o,a,s){var l;this.pixelCoordinates_&&b(r,this.renderedTransform_)?l=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),l=ln(this.coordinates,0,this.coordinates.length,2,r,this.pixelCoordinates_),Rt(this.renderedTransform_,r));for(var u,c,h,p,f,d,g,y,m,v,_,x,w,S,E,T,C=0,O=n.length,P=0,R=0,I=0,L=null,M=null,F=this.coordinateCache_,A=this.viewRotation_,k=Math.round(1e12*Math.atan2(-r[1],r[0]))/1e12,j={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:A},N=this.instructions!=n||this.overlaps?0:200;CN&&(this.fill_(t),R=0),I>N&&(t.stroke(),I=0),R||I||(t.beginPath(),p=NaN,f=NaN),++C;break;case Ig.CIRCLE:var G=l[P=D[1]],z=l[P+1],U=l[P+2]-G,B=l[P+3]-z,V=Math.sqrt(U*U+B*B);t.moveTo(G+V,z),t.arc(G,z,V,0,2*Math.PI,!0),++C;break;case Ig.CLOSE_PATH:t.closePath(),++C;break;case Ig.CUSTOM:P=D[1],u=D[2];var Y=D[3],W=D[4],q=6==D.length?D[5]:void 0;j.geometry=Y,j.feature=w,C in F||(F[C]=[]);var X=F[C];q?q(l,P,u,2,X):(X[0]=l[P],X[1]=l[P+1],X.length=2),W(X,j),++C;break;case Ig.DRAW_IMAGE:P=D[1],u=D[2],y=D[3],c=D[4],h=D[5];var Z=D[6],K=D[7],H=D[8],$=D[9],J=D[10],Q=D[11],tt=D[12],et=D[13],rt=D[14];if(!y&&D.length>=19){m=D[18],v=D[19],_=D[20],x=D[21];var nt=this.drawLabelWithPointPlacement_(m,v,_,x);y=nt.label,D[3]=y;var it=D[22];c=(nt.anchorX-it)*this.pixelRatio,D[4]=c;var ot=D[23];h=(nt.anchorY-ot)*this.pixelRatio,D[5]=h,Z=y.height,D[6]=Z,et=y.width,D[13]=et}var at=void 0;D.length>24&&(at=D[24]);var st=void 0,lt=void 0,ut=void 0;D.length>16?(st=D[15],lt=D[16],ut=D[17]):(st=fa,lt=!1,ut=!1),J&&k?Q+=A:J||k||(Q-=A);for(var ct=0;P0){if(!o||h!==zu&&h!==Vu||-1!==o.indexOf(t)){var u=(p[s]-3)/4,f=n-u%a,d=n-(u/a|0),g=i(t,e,f*f+d*d);if(g)return g}c.clearRect(0,0,a,a);break}}var g,y,m,v,_,b=Object.keys(this.executorsByZIndex_).map(Number);for(b.sort(d),g=b.length-1;g>=0;--g){var x=b[g].toString();for(m=this.executorsByZIndex_[x],y=ry.length-1;y>=0;--y)if(void 0!==(v=m[h=ry[y]])&&(_=v.executeHitDetection(c,s,r,f,u)))return _}},t.prototype.getClipCoords=function(t){var e=this.maxExtent_;if(!e)return null;var r=e[0],n=e[1],i=e[2],o=e[3],a=[r,n,r,o,i,o,i,n];return ln(a,0,8,2,t,a),a},t.prototype.isEmpty=function(){return I(this.executorsByZIndex_)},t.prototype.execute=function(t,e,r,n,i,o,a){var s=Object.keys(this.executorsByZIndex_).map(Number);s.sort(d),this.maxExtent_&&(t.save(),this.clip(t,r));var l,u,c,h,p,f,g=o||ry;for(a&&s.reverse(),l=0,u=s.length;lr)break;var s=n[a];s||(s=[],n[a]=s),s.push(4*((t+i)*e+(t+o))+3),i>0&&s.push(4*((t-i)*e+(t+o))+3),o>0&&(s.push(4*((t+i)*e+(t-o))+3),i>0&&s.push(4*((t-i)*e+(t-o))+3))}for(var l=[],u=(i=0,n.length);i0&&(a.width=0),this.container;var u=Math.round(t.size[0]*r),c=Math.round(t.size[1]*r);a.width!=u||a.height!=c?(a.width=u,a.height=c,a.style.transform!==i&&(a.style.transform=i)):this.containerReused||o.clearRect(0,0,u,c),this.preRender(o,t);var h=t.viewState,p=h.projection,f=!1;if(n.extent&&this.clipping){var d=on(n.extent,p);(f=!te(d,t.extent)&&Re(d,t.extent))&&this.clipUnrotated(o,t,d)}this.renderWorlds(s,t),f&&o.restore(),this.postRender(o,t);var g=n.opacity,y=this.container;return g!==parseFloat(y.style.opacity)&&(y.style.opacity=1===g?"":String(g)),this.renderedRotation_!==h.rotation&&(this.renderedRotation_=h.rotation,this.hitDetectionImageData_=null),this.container},e.prototype.getFeatures=function(t){return new Promise(function(e){if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){var r=[this.context.canvas.width,this.context.canvas.height];It(this.pixelTransform,r);var n=this.renderedCenter_,i=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,s=this.renderedExtent_,l=this.getLayer(),u=[],c=r[0]/2,h=r[1]/2;u.push(this.getRenderTransform(n,i,o,.5,c,h,0).slice());var p=l.getSource(),f=a.getExtent();if(p.getWrapX()&&a.canWrapX()&&!te(f,s)){for(var d=s[0],g=Pe(f),y=0,m=void 0;df[2];)m=g*++y,u.push(this.getRenderTransform(n,i,o,.5,c,h,m).slice()),d-=g}this.hitDetectionImageData_=sy(r,u,this.renderedFeatures_,l.getStyleFunction(),s,i,o)}e(ly(t,this.renderedFeatures_,this.hitDetectionImageData_))}.bind(this))},e.prototype.forEachFeatureAtCoordinate=function(t,e,r,n,i){var a=this;if(this.replayGroup_){var s,l=e.viewState.resolution,u=e.viewState.rotation,c=this.getLayer(),h={},p=function(t,e,r){var a=o(t),s=h[a];if(s){if(!0!==s&&rv[0]&&x[2]>v[2]&&m.push([x[0]-_,x[1],x[2]-_,x[3]])}if(!this.dirty_&&this.renderedResolution_==c&&this.renderedRevision_==p&&this.renderedRenderOrder_==d&&te(this.renderedExtent_,y))return this.replayGroupChanged=!1,!0;this.replayGroup_=null,this.dirty_=!1;var w,S=new Yg(Xu(c,h),y,c,h);this.getLayer().getDeclutter()&&(w=new Yg(Xu(c,h),y,c,h));var E,T=tn();if(T){for(var C=0,O=m.length;C0)e([]);else{var m=Ce(h.getTileCoordExtent(n.wrappedTileCoord)),v=[(p[0]-m[0])/c,(m[1]-p[1])/c],_=n.getSourceTiles().reduce((function(t,e){return t.concat(e.getFeatures())}),[]),b=n.hitDetectionImageData[a];if(!b&&!this.animatingOrInteracting_){var x=Is(h.getTileSize(h.getZForResolution(c))),w=[x[0]/2,x[1]/2],S=this.renderedRotation_;b=sy(x,[this.getRenderTransform(h.getTileCoordCenter(n.wrappedTileCoord),c,0,.5,w[0],w[1],0)],_,i.getStyleFunction(),h.getTileCoordExtent(n.wrappedTileCoord),n.getReplayState(i).renderedResolution,S),n.hitDetectionImageData[a]=b}e(ly(v,_,b))}}.bind(this))},e.prototype.handleFontsChanged=function(){P(this.renderTileImageQueue_);var t=this.getLayer();t.getVisible()&&void 0!==this.renderedLayerRevision_&&t.changed()},e.prototype.handleStyleImageChange_=function(t){this.renderIfReadyAndVisible()},e.prototype.renderDeclutter=function(t){for(var e=t.viewHints,r=!(e[ns]||e[is]),n=this.renderedTiles,i=0,a=n.length;i=0;--u)l[u].execute(this.context,1,this.getTileRenderTransform(s,t),t.viewState.rotation,r,void 0,t.declutterTree)}},e.prototype.getTileRenderTransform=function(t,e){var r=e.pixelRatio,n=e.viewState,i=n.center,o=n.resolution,a=n.rotation,s=e.size,l=Math.round(s[0]*r),u=Math.round(s[1]*r),c=this.getLayer().getSource().getTileGridForProjection(e.viewState.projection),h=t.tileCoord,p=c.getTileCoordExtent(t.wrappedTileCoord),f=c.getTileCoordExtent(h,this.tmpExtent)[0]-p[0];return Ot(Mt(this.inversePixelTransform.slice(),1/r,1/r),this.getRenderTransform(i,o,a,r,l,u,f))},e.prototype.renderFrame=function(e,r){var n=e.viewHints,i=!(n[ns]||n[is]);this.renderQueuedTileImages_(i,e),t.prototype.renderFrame.call(this,e,r),this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice(),this.renderedRotation_=e.viewState.rotation;var a=this.getLayer(),s=a.getRenderMode();if(s===fy)return this.container;var l=a.getSource(),u=e.usedTiles[o(l)];for(var c in this.renderTileImageQueue_)u&&c in u||delete this.renderTileImageQueue_[c];for(var h=this.context,p=vy[s],f=e.viewState.rotation,d=this.renderedTiles,g=[],y=[],m=d.length-1;m>=0;--m)for(var v=d[m],_=this.getTileRenderTransform(v,e),b=v.executorGroups[o(a)],x=!1,w=0,S=b.length;w8){e.animate=!0;break}var n=this.renderTileImageQueue_[r];delete this.renderTileImageQueue_[r],this.renderTileImage_(n,e)}},e.prototype.renderFeature=function(t,e,r,n,i){if(!r)return!1;var o=!1;if(Array.isArray(r))for(var a=0,s=r.length;a1?a:2,x=o||new Array(b);for(g=0;g>1;i0&&y.length>0;)o=y.pop(),c=d.pop(),p=g.pop(),(l=o.toString())in m||(u.push(p[0],p[1]),m[l]=!0),a=y.pop(),h=d.pop(),f=g.pop(),ze((i=e(n=t(s=(o+a)/2)))[0],i[1],p[0],p[1],f[0],f[1])this.featurePool_.length;)s=new gt,this.featurePool_.push(s);var u=n.getFeaturesCollection();u.clear();var c,h,p=0;for(c=0,h=this.meridians_.length;cMath.PI/2);for(var y=Ku(t),m=h;m<=p;++m){var v=this.meridians_.length+this.parallels_.length,_=void 0,b=void 0,x=void 0,w=void 0;if(this.meridiansLabels_)for(b=0,x=this.meridiansLabels_.length;b=s?(t[0]=a[0],t[2]=a[2]):o=!0);var l=[Ne(e[0],this.minX_,this.maxX_),Ne(e[1],this.minY_,this.maxY_)],u=this.toLonLatTransform_(l);isNaN(u[1])&&(u[1]=Math.abs(this.maxLat_)>=Math.abs(this.minLat_)?this.maxLat_:this.minLat_);var c,h,p,f,d=Ne(u[0],this.minLon_,this.maxLon_),g=Ne(u[1],this.minLat_,this.maxLat_),y=this.maxLines_,m=t;o||(m=[Ne(t[0],this.minX_,this.maxX_),Ne(t[1],this.minY_,this.maxY_),Ne(t[2],this.minX_,this.maxX_),Ne(t[3],this.minY_,this.maxY_)]);var v=Ae(m,this.toLonLatTransform_,void 0,8),_=v[3],b=v[2],x=v[1],w=v[0];if(o||(Qt(m,this.bottomLeft_)&&(w=this.minLon_,x=this.minLat_),Qt(m,this.bottomRight_)&&(b=this.maxLon_,x=this.minLat_),Qt(m,this.topLeft_)&&(w=this.minLon_,_=this.maxLat_),Qt(m,this.topRight_)&&(b=this.maxLon_,_=this.maxLat_),_=Ne(_,g,this.maxLat_),b=Ne(b,d,this.maxLon_),x=Ne(x,this.minLat_,g),w=Ne(w,this.minLon_,d)),f=Ne(d=Math.floor(d/i)*i,this.minLon_,this.maxLon_),h=this.addMeridian_(f,x,_,n,t,0),c=0,o)for(;(f-=i)>=w&&c++n[o]&&(i=o,o=1);var a=Math.max(e[1],n[i]),s=Math.min(e[3],n[o]),l=Ne(e[1]+Math.abs(e[1]-e[3])*this.lonLabelPosition_,a,s),u=[n[i-1]+(n[o-1]-n[i-1])*(l-n[i])/(n[o]-n[i]),l],c=this.meridiansLabels_[r].geom;return c.setCoordinates(u),c},e.prototype.getMeridians=function(){return this.meridians_},e.prototype.getParallel_=function(t,e,r,n,i){var o=Fy(t,e,r,this.projection_,n),a=this.parallels_[i];return a?(a.setFlatCoordinates(yt,o),a.changed()):a=new Py(o,yt),a},e.prototype.getParallelPoint_=function(t,e,r){var n=t.getFlatCoordinates(),i=0,o=n.length-2;n[i]>n[o]&&(i=o,o=0);var a=Math.max(e[0],n[i]),s=Math.min(e[2],n[o]),l=Ne(e[0]+Math.abs(e[0]-e[2])*this.latLabelPosition_,a,s),u=[l,n[i+1]+(n[o+1]-n[i+1])*(l-n[i])/(n[o]-n[i])],c=this.parallelsLabels_[r].geom;return c.setCoordinates(u),c},e.prototype.getParallels=function(){return this.parallels_},e.prototype.updateProjectionInfo_=function(t){var e=Gr("EPSG:4326"),r=t.getWorldExtent();this.maxLat_=r[3],this.maxLon_=r[2],this.minLat_=r[1],this.minLon_=r[0];var n=Kr(t,e);if(this.minLon_=Math.abs(this.minLat_)?this.maxLat_:this.minLat_),this.projection_=t},e}(Iy),Dy=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Gy="blur",zy="gradient",Uy="radius",By=["#00f","#0ff","#0f0","#ff0","#f00"];var Vy=function(t){function e(e){var r=this,n=e||{},i=O({},n);delete i.gradient,delete i.radius,delete i.blur,delete i.weight,(r=t.call(this,i)||this).gradient_=null,r.addEventListener(it(zy),r.handleGradientChanged_),r.setGradient(n.gradient?n.gradient:By),r.setBlur(void 0!==n.blur?n.blur:15),r.setRadius(void 0!==n.radius?n.radius:8);var o=n.weight?n.weight:"weight";return r.weightFunction_="string"==typeof o?function(t){return t.get(o)}:o,r.setRenderOrder(null),r}return Dy(e,t),e.prototype.getBlur=function(){return this.get(Gy)},e.prototype.getGradient=function(){return this.get(zy)},e.prototype.getRadius=function(){return this.get(Uy)},e.prototype.handleGradientChanged_=function(){this.gradient_=function(t){for(var e=uo(1,256),r=e.createLinearGradient(0,0,1,256),n=1/(t.length-1),i=0,o=t.length;i>3)?r.readString():2===t?r.readFloat():3===t?r.readDouble():4===t?r.readVarint64():5===t?r.readVarint():6===t?r.readSVarint():7===t?r.readBoolean():null;e.values.push(n)}}function im(t,e,r){if(1==t)e.id=r.readVarint();else if(2==t)for(var n=r.readVarint()+r.pos;r.pos>3}a--,1===o||2===o?(s+=t.readSVarint(),l+=t.readSVarint(),1===o&&u>c&&(n.push(u),c=u),r.push(s,l),u+=2):7===o?u>c&&(r.push(r[c],r[c+1]),u+=2):pt(!1,59)}u>c&&(n.push(u),c=u)},e.prototype.createFeature_=function(t,e,r){var n,i=e.type;if(0===i)return null;var o,a=e.properties;this.idProperty_?(o=a[this.idProperty_],delete a[this.idProperty_]):o=e.id,a[this.layerName_]=e.layer.name;var s=[],l=[];this.readRawGeometry_(t,e,s,l);var u=function(t,e){var r;1===t?r=1===e?bt.POINT:bt.MULTI_POINT:2===t?r=1===e?bt.LINE_STRING:bt.MULTI_LINE_STRING:3===t&&(r=bt.POLYGON);return r}(i,l.length);if(this.featureClass_===Cy)(n=new this.featureClass_(u,s,l,a,o)).transform(r.dataProjection);else{var c=void 0;if(u==bt.POLYGON){for(var h=[],p=0,f=0,d=0,g=l.length;d1?new Jy(s,yt,h):new fi(s,yt,l)}else c=u===bt.POINT?new qn(s,yt):u===bt.LINE_STRING?new Py(s,yt):u===bt.POLYGON?new fi(s,yt,l):u===bt.MULTI_POINT?new Hy(s,yt):u===bt.MULTI_LINE_STRING?new Zy(s,yt,l):null;n=new(0,this.featureClass_),this.geometryName_&&n.setGeometryName(this.geometryName_);var m=Wy(c,!1,r);n.setGeometry(m),n.setId(o),n.setProperties(a,!0)}return n},e.prototype.getType=function(){return Cu},e.prototype.readFeatures=function(t,e){var r=this.layers_,n=this.adaptOptions(e),i=Gr(n.dataProjection);i.setWorldExtent(n.extent),n.dataProjection=i;var o=new tm.a(t),a=o.readFields(rm,{}),s=[];for(var l in a)if(!r||-1!=r.indexOf(l)){var u=a[l],c=u?[0,0,u.extent,u.extent]:null;i.setExtent(c);for(var h=0,p=u.length;h=.05){for(var r="",n=t.split("\n"),i=ym.slice(0,Math.round(e/.1)),o=0,a=n.length;o0&&(r+="\n"),r+=n[o].split("").join(i);return r}return t}function vm(){return gm||(gm=dm(1,1).getContext("2d")),gm}function _m(t,e){return vm().measureText(t).width+(t.length-1)*e}var bm={};ga&&Z(ga,k,(function(){bm={}}));var xm,wm,Sm=hm.e.isFunction,Em=hm.e.convertFunction,Tm=hm.c.isExpression,Cm=hm.c.createPropertyExpression,Om={Point:1,MultiPoint:1,LineString:2,MultiLineString:2,Polygon:3,MultiPolygon:3},Pm={center:[.5,.5],left:[0,.5],right:[1,.5],top:[.5,0],bottom:[.5,1],"top-left":[0,0],"top-right":[1,0],"bottom-left":[0,1],"bottom-right":[1,1]},Rm={},Im={zoom:0},Lm={};function Mm(t,e,r,n,i){var o=t.id;Lm[o]||(Lm[o]={});var a=Lm[o];if(!a[r]){var s=(t[e]||Rm)[r],l=hm.f[e+"_"+t.type][r];void 0===s&&(s=l.default);var u=Tm(s);if(!u&&Sm(s)&&(s=Em(s,l),u=!0),u){var c=function(t,e){var r=Cm(t,e);if("error"===r.result)throw new Error(r.value.map((function(t){return t.key+": "+t.message})).join(", "));return r.value}(s,l);a[r]=c.evaluate.bind(c)}else"color"==l.type&&(s=hm.a.parse(s)),a[r]=function(){return s}}return Im.zoom=n,a[r](Im,i)}var Fm={};function Am(t,e){if(t){if(0===t.a||0===e)return;var r=t.a;return e=void 0===e?1:e,"rgba("+Math.round(255*t.r/r)+","+Math.round(255*t.g/r)+","+Math.round(255*t.b/r)+","+r*e+")"}return t}var km=/^([^]*)\{(.*)\}([^]*)$/;function jm(t,e){var r;do{if(r=t.match(km)){var n=e[r[2]]||"";t=r[1]+n+r[3]}}while(r);return t}var Nm=!1;var Dm=function(t,e,r,n,i,o,a){if(void 0===n&&(n=fm),"string"==typeof e&&(e=JSON.parse(e)),8!=e.version)throw new Error("glStyle version 8 required.");var s,l;if(o)if("undefined"!=typeof Image){var u=new Image;u.crossOrigin="anonymous",u.onload=function(){s=u,l=[u.width,u.height],t.changed(),u.onload=null},u.src=o}else if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope){var c=self;c.postMessage({action:"loadImage",src:o}),c.addEventListener("message",(function(t){"imageLoaded"===t.data.action&&t.data.src===o&&(s=t.data.image,l=[s.width,s.height])}))}for(var h,p=Object(hm.b)(e.layers),f={},d=[],g=0,y=p.length;g=y.maxzoom)return"continue";var b=y.filter;if(!b||function(t,e,r,n){return t in Fm||(Fm[t]=Object(hm.d)(e).filter),Im.zoom=n,Fm[t](Im,r)}(m,b,p,u)){c=y;var x=void 0,w=void 0,P=void 0,R=void 0,I=void 0,L=void 0,M=g.index;if(3==h&&("fill"==y.type||"fill-extrusion"==y.type))if(w=Mm(y,"paint",y.type+"-opacity",u,p),y.type+"-pattern"in _){var F=Mm(y,"paint",y.type+"-pattern",u,p);if(F){var A="string"==typeof F?jm(F,r):F.toString();if(s&&i&&i[A]){++d,(L=O[d])&&L.getFill()&&!L.getStroke()&&!L.getText()||(L=O[d]=new wp({fill:new ep})),P=L.getFill(),L.setZIndex(M);var k=C[ut=A+"."+w];if(!k)(pt=(ht=dm((ct=i[A]).width,ct.height)).getContext("2d")).globalAlpha=w,pt.drawImage(s,ct.x,ct.y,ct.width,ct.height,0,0,ct.width,ct.height),k=pt.createPattern(ht,"repeat"),C[ut]=k;P.setColor(k)}}}else(x=Am(Mm(y,"paint",y.type+"-color",u,p),w))&&(y.type+"-outline-color"in _&&(I=Am(Mm(y,"paint",y.type+"-outline-color",u,p),w)),I||(I=x),++d,(L=O[d])&&L.getFill()&&L.getStroke()&&!L.getText()||(L=O[d]=new wp({fill:new ep,stroke:new gp})),(P=L.getFill()).setColor(x),(R=L.getStroke()).setColor(I),R.setWidth(1),L.setZIndex(M));if(1!=h&&"line"==y.type){x=!("line-pattern"in _)&&"line-color"in _?Am(Mm(y,"paint","line-color",u,p),Mm(y,"paint","line-opacity",u,p)):void 0;var j=Mm(y,"paint","line-width",u,p);x&&j>0&&(++d,(L=O[d])&&L.getStroke()&&!L.getFill()&&!L.getText()||(L=O[d]=new wp({stroke:new gp})),(R=L.getStroke()).setLineCap(Mm(y,"layout","line-cap",u,p)),R.setLineJoin(Mm(y,"layout","line-join",u,p)),R.setMiterLimit(Mm(y,"layout","line-miter-limit",u,p)),R.setColor(x),R.setWidth(j),R.setLineDash(_["line-dasharray"]?Mm(y,"paint","line-dasharray",u,p).map((function(t){return t*j})):null),L.setZIndex(M))}var N=!1,D=null,G=0,z=void 0,U=void 0,B=void 0;if((1==h||2==h)&&"icon-image"in v){var V=Mm(y,"layout","icon-image",u,p);if(V){z="string"==typeof V?jm(V,r):V.toString();var Y=void 0;if(s&&i&&i[z]){var W=Mm(y,"layout","icon-rotation-alignment",u,p);if(2==h){var q=t.getGeometry();if(q.getFlatMidpoint||q.getFlatMidpoints){var X=q.getExtent();if(Math.sqrt(Math.max(Math.pow((X[2]-X[0])/e,2),Math.pow((X[3]-X[1])/e,2)))>150){var Z="MultiLineString"===q.getType()?q.getFlatMidpoints():q.getFlatMidpoint();if(wm||(wm=new Cy("Point",xm=[NaN,NaN],[],{},null)),Y=wm,xm[0]=Z[0],xm[1]=Z[1],"line"===(Mt=Mm(y,"layout","symbol-placement",u,p))&&"map"===W)for(var K=q.getStride(),H=q.getFlatCoordinates(),$=0,J=H.length-K;$=nt&&Z[0]<=ot&&Z[1]>=it&&Z[1]<=at){G=Math.atan2(tt-rt,et-Q);break}}}}}if(2!==h||Y){++d,(L=O[d])&&L.getImage()&&!L.getFill()&&!L.getStroke()||(L=O[d]=new wp),L.setGeometry(Y);var st=Mm(y,"layout","icon-size",u,p),lt=void 0!==_["icon-color"]?Mm(y,"paint","icon-color",u,p):null,ut=z+"."+st;if(null!==lt&&(ut+="."+lt),!(U=T[ut])){var ct=i[z];if(null!==lt){var ht,pt;(pt=(ht=dm(ct.width,ct.height)).getContext("2d")).drawImage(s,ct.x,ct.y,ct.width,ct.height,0,0,ct.width,ct.height);for(var ft=pt.getImageData(0,0,ht.width,ht.height),dt=0,gt=ft.data.length;dt0?new gp({width:bt,color:vt}):void 0,fill:_t?new ep({color:_t}):void 0})),L.setImage(U),D=L.getText(),L.setText(void 0),L.setGeometry(void 0),L.setZIndex(M),N=!0}var wt=void 0;if("text-field"in v)wt=jm(Mm(y,"layout","text-field",u,p).toString(),r).trim(),w=Mm(y,"paint","text-opacity",u,p);if(wt&&w&&!B){N||(++d,(L=O[d])&&L.getText()&&!L.getFill()&&!L.getStroke()||(L=O[d]=new wp),L.setImage(void 0),L.setGeometry(void 0)),L.getText()||L.setText(D||new Tp({padding:[2,2,2,2]})),D=L.getText();var St=Math.round(Mm(y,"layout","text-size",u,p)),Et=Mm(y,"layout","text-font",u,p),Tt=Mm(y,"layout","text-line-height",u,p),Ct=cm()(a?a(Et):Et,St,Tt),Ot=v["text-transform"];"uppercase"==Ot?wt=wt.toUpperCase():"lowercase"==Ot&&(wt=wt.toLowerCase());var Pt=Mm(y,"layout","text-max-width",u,p),Rt=Mm(y,"layout","text-letter-spacing",u,p),It=2==h?mm(wt,Rt):function t(e,r,n,i){if(-1!==e.indexOf("\n")){for(var o=e.split("\n"),a=[],s=0,l=o.length;s1){var p=vm();p.font=r;var f=p.measureText("M").width*n,d="";for(a=[],s=0,l=h.length;s1;++s){var m=a[s];if(_m(m,i)<.35*f){var v=s>0?_m(a[s-1],i):1/0,_=s.7*f&&_m(x,i)<.6*f){var w=b.split(" "),S=w.pop();_m(S,i)<.2*f&&(a[s]=w.join(" "),a[s+1]=S+" "+x),l-=1}}c=a.join("\n")}else c=e;c=mm(c,i),bm[u]=c}return c}(wt,Ct,Pt,Rt);D.setText(It),D.setFont(Ct),D.setRotation(pm(Mm(y,"layout","text-rotate",u,p)));var Lt=Mm(y,"layout","text-anchor",u,p),Mt=N||1==h?"point":Mm(y,"layout","symbol-placement",u,p);D.setPlacement(Mt);var Ft=Mm(y,"paint","text-halo-width",u,p),At=Mm(y,"layout","text-offset",u,p),kt=Mm(y,"paint","text-translate",u,p),jt=0,Nt=0;if("point"==Mt){var Dt="center";-1!==Lt.indexOf("left")?(Dt="left",Nt=Ft):-1!==Lt.indexOf("right")&&(Dt="right",Nt=-Ft),D.setTextAlign(Dt);var Gt=Mm(y,"layout","text-rotation-alignment",u,p);D.setRotateWithView("map"==Gt)}else D.setMaxAngle(pm(Mm(y,"layout","text-max-angle",u,p))*wt.length/It.length),D.setTextAlign(),D.setRotateWithView(!1);var zt="middle";0==Lt.indexOf("bottom")?(zt="bottom",jt=-Ft-.5*(Tt-1)*St):0==Lt.indexOf("top")&&(zt="top",jt=Ft+.5*(Tt-1)*St),D.setTextBaseline(zt),D.setOffsetX(At[0]*St+Nt+kt[0]),D.setOffsetY(At[1]*St+jt+kt[1]),E.setColor(Am(Mm(y,"paint","text-color",u,p),w)),D.setFill(E);var Ut=Am(Mm(y,"paint","text-halo-color",u,p),w);if(Ut){S.setColor(Ut),Ft*=2;var Bt=.5*St;S.setWidth(Ft<=Bt?Ft:Bt),D.setStroke(S)}else D.setStroke(void 0);var Vt=Mm(y,"layout","text-padding",u,p),Yt=D.getPadding();Vt!==Yt[0]&&(Yt[0]=Yt[1]=Yt[2]=Yt[3]=Vt),L.setZIndex(M)}}},y=0,m=o.length;y-1?(O.length=d+1,Nm&&("function"==typeof t.set?t.set("mapbox-layer",c):t.getProperties()["mapbox-layer"]=c),O):void 0}};return t.setStyle(P),t.set("mapbox-source",h),t.set("mapbox-layers",d),P},Gm=r(6),zm=r.n(Gm),Um=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function Bm(t){for(var e=[],r=0,n=t.length;r2?n[2]:""):t+r}function sv(t,e,r,n,i){return new Promise((function(o,a){if("object"!=typeof e&&(e=JSON.parse(e)),8!=e.version)return a(new Error("glStyle version 8 required."));if(!(t instanceof Iy||t instanceof lm))return a(new Error("Can only apply to VectorLayer or VectorTileLayer"));var s,l,u;function c(){u||e.sprite&&!s?u?(t.setStyle(u),o()):a(new Error("Something went wrong trying to apply style.")):(u=Dm(t,e,r,i,s,l,nv),t.getStyle()?o():a(new Error("Nothing to show for source ["+r+"]")))}if(e.sprite){var h=.5==(window.devicePixelRatio>=1.5?.5:1)?"@2x":"",p=av(e.sprite,n,h+".json");fetch(p,{credentials:"same-origin"}).then((function(t){return t.ok||""===h?t:(p=av(e.sprite,n,".json"),fetch(p,{credentials:"same-origin"}))})).then((function(t){if(t.ok)return t.json();a(new Error("Problem fetching sprite from "+p+": "+t.statusText))})).then((function(t){if(void 0===t)return a(new Error("No sprites found."));s=t,l=av(e.sprite,n,h+".png"),c()})).catch((function(t){a(new Error("Sprites cannot be loaded: "+p+": "+t.message))}))}else c()}))}new $m;var lv=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function uv(t){return 0!==t.indexOf("mapbox://")?"":t.slice("mapbox://".length)}function cv(t,e){var r=uv(t);if(!r)return t;if(0!==r.indexOf("sprites/"))throw new Error("unexpected sprites url: "+t);return"https://api.mapbox.com/styles/v1/"+r.slice("sprites/".length)+"/sprite?access_token="+e}function hv(t,e){var r=uv(t);if(!r)return t;if(0!==r.indexOf("fonts/"))throw new Error("unexpected fonts url: "+t);return"https://api.mapbox.com/fonts/v1/"+r.slice("fonts/".length)+"/0-255.pbf?access_token="+e}function pv(t,e){var r=uv(t);if(!r)return t;if(0!==r.indexOf("styles/"))throw new Error("unexpected style url: "+t);return"https://api.mapbox.com/styles/v1/"+r.slice("styles/".length)+"?&access_token="+e}function fv(t,e){var r=uv(t);return r?"https://{a-d}.tiles.mapbox.com/v4/"+r+"/{z}/{x}/{y}.vector.pbf?access_token="+e:t}var dv=function(t){function e(e){var r=t.call(this,A)||this;return r.error=e,r}return lv(e,t),e}(c),gv="vector",yv=function(t){function e(e){var r=this,n=!("declutter"in e)||e.declutter,i=new og({state:Jo,format:new am});return(r=t.call(this,{source:i,declutter:n,className:e.className,opacity:e.opacity,visible:e.visible,zIndex:e.zIndex,minResolution:e.minResolution,maxResolution:e.maxResolution,minZoom:e.minZoom,maxZoom:e.maxZoom,renderOrder:e.renderOrder,renderBuffer:e.renderBuffer,renderMode:e.renderMode,map:e.map,updateWhileAnimating:e.updateWhileAnimating,updateWhileInteracting:e.updateWhileInteracting,preload:e.preload,useInterimTilesOnError:e.useInterimTilesOnError})||this).sourceId=e.source,r.layers=e.layers,r.accessToken=e.accessToken,r.fetchStyle(e.styleUrl),r}return lv(e,t),e.prototype.fetchStyle=function(t){var e=this,r=pv(t,this.accessToken);fetch(r).then((function(t){if(!t.ok)throw new Error("unexpected response when fetching style: "+t.status);return t.json()})).then((function(t){e.onStyleLoad(t)})).catch((function(t){e.handleError(t)}))},e.prototype.onStyleLoad=function(t){var e,r,n=this;if(this.layers){for(var i={},o=0;o0){this.source_&&(this.source_.clear(),this.source_.addFeatures(h)),this.dispatchEvent(new Sv(wv,t,h,o));break}}},e.prototype.registerListeners_=function(){var t=this.getMap();if(t){var e=this.target?this.target:t.getViewport();this.dropListenKeys_=[Z(e,U,this.handleDrop,this),Z(e,G,this.handleStop,this),Z(e,z,this.handleStop,this),Z(e,U,this.handleStop,this)]}},e.prototype.setActive=function(e){!this.getActive()&&e&&this.registerListeners_(),this.getActive()&&!e&&this.unregisterListeners_(),t.prototype.setActive.call(this,e)},e.prototype.setMap=function(e){this.unregisterListeners_(),t.prototype.setMap.call(this,e),this.getActive()&&this.registerListeners_()},e.prototype.tryReadFeatures_=function(t,e,r){try{return t.readFeatures(e,r)}catch(t){return null}},e.prototype.unregisterListeners_=function(){this.dropListenKeys_&&(this.dropListenKeys_.forEach(H),this.dropListenKeys_=null)},e.prototype.handleDrop=function(t){for(var e=t.dataTransfer.files,r=0,n=e.length;r1?1:-1;return e.endInteraction(this.duration_,r),this.lastScaleDelta_=0,!1},e.prototype.handleDownEvent=function(t){return!!cl(t)&&(!!this.condition_(t)&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,this.lastMagnitude_=void 0,!0))},e}($s),Ov=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Pv=function(t){function e(e,r,n){var i=t.call(this)||this;if(void 0!==n&&void 0===r)i.setFlatCoordinates(n,e);else{var o=r||0;i.setCenterAndRadius(e,o,n)}return i}return Ov(e,t),e.prototype.clone=function(){var t=new e(this.flatCoordinates.slice(),void 0,this.layout);return t.applyProperties(this),t},e.prototype.closestPointXY=function(t,e,r,n){var i=this.flatCoordinates,o=t-i[0],a=e-i[1],s=o*o+a*a;if(s=e[0]||(t[1]<=e[1]&&t[3]>=e[1]||me(t,this.intersectsCoordinate.bind(this)))}return!1},e.prototype.setCenter=function(t){var e=this.stride,r=this.flatCoordinates[e]-this.flatCoordinates[0],n=t.slice();n[e]=n[0]+r;for(var i=1;i=this.dragVertexDelay_?(this.downPx_=e.pixel,this.shouldHandle_=!this.freehand_,r=!0):this.lastDragTime_=void 0,this.shouldHandle_&&void 0!==this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0));return this.freehand_&&e.type===Ga.POINTERDRAG&&null!==this.sketchFeature_?(this.addToDrawing_(e.coordinate),n=!1):this.freehand_&&e.type===Ga.POINTERDOWN?n=!1:r&&this.getPointerCount()<2?(n=e.type===Ga.POINTERMOVE)&&this.freehand_?(this.handlePointerMove_(e),this.shouldHandle_&&e.originalEvent.preventDefault()):("mouse"===e.originalEvent.pointerType||e.type===Ga.POINTERDRAG&&void 0===this.downTimeout_)&&this.handlePointerMove_(e):e.type===Ga.DBLCLICK&&(n=!1),t.prototype.handleEvent.call(this,e)&&n},e.prototype.handleDownEvent=function(t){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=t.pixel,this.finishCoordinate_||this.startDrawing_(t.coordinate),!0):this.condition_(t)?(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout(function(){this.handlePointerMove_(new Da(Ga.POINTERMOVE,t.map,t.originalEvent,!1,t.frameState))}.bind(this),this.dragVertexDelay_),this.downPx_=t.pixel,!0):(this.lastDragTime_=void 0,!1)},e.prototype.handleUpEvent=function(t){var e=!0;if(0===this.getPointerCount())if(this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0),this.handlePointerMove_(t),this.shouldHandle_){switch(!0){case!this.finishCoordinate_:if(this.startDrawing_(t.coordinate),this.mode_!==Lv)break;case this.freehand_||this.atFinish_(t.pixel)&&this.finishCondition_(t):this.finishDrawing();break;case!this.freehand_:this.addToDrawing_(t.coordinate)}e=!1}else this.freehand_&&this.abortDrawing();return!e&&this.stopClick_&&t.originalEvent.stopPropagation(),e},e.prototype.handlePointerMove_=function(t){if(this.pointerType_=t.originalEvent.pointerType,this.downPx_&&(!this.freehand_&&this.shouldHandle_||this.freehand_&&!this.shouldHandle_)){var e=this.downPx_,r=t.pixel,n=e[0]-r[0],i=e[1]-r[1],o=n*n+i*i;if(this.shouldHandle_=this.freehand_?o>this.squaredClickTolerance_:o<=this.squaredClickTolerance_,!this.shouldHandle_)return}this.finishCoordinate_?this.modifyDrawing_(t.coordinate):this.createOrUpdateSketchPoint_(t)},e.prototype.atFinish_=function(t){var e=!1;if(this.sketchFeature_){var r=!1,n=[this.finishCoordinate_],i=this.mode_;if(i===Lv)e=!0;else if(i===Av)e=2===this.sketchCoords_.length;else if(i===Mv)r=this.sketchCoords_.length>this.minPoints_;else if(i===Fv){var o=this.sketchCoords_;r=o[0].length>this.minPoints_,n=[o[0][0],o[0][o[0].length-2]]}if(r)for(var a=this.getMap(),s=0,l=n.length;s=this.maxPoints_&&(this.freehand_?r.pop():e=!0),r.push(t.slice()),this.geometryFunction_(r,n,i)):o===Fv&&((r=this.sketchCoords_[0]).length>=this.maxPoints_&&(this.freehand_?r.pop():e=!0),r.push(t.slice()),e&&(this.finishCoordinate_=r[0]),this.geometryFunction_(this.sketchCoords_,n,i)),this.updateSketchFeatures_(),e&&this.finishDrawing()},e.prototype.removeLastPoint=function(){if(this.sketchFeature_){var t,e=this.sketchFeature_.getGeometry(),r=this.getMap().getView().getProjection(),n=this.mode_;if(n===Mv||n===Av){if((t=this.sketchCoords_).splice(-2,1),t.length>=2){this.finishCoordinate_=t[t.length-2].slice();var i=this.finishCoordinate_.slice();t[t.length-1]=i,this.sketchPoint_.setGeometry(new qn(i))}this.geometryFunction_(t,e,r),e.getType()===bt.POLYGON&&this.sketchLine_&&this.createOrUpdateCustomSketchLine_(e)}else if(n===Fv){(t=this.sketchCoords_[0]).splice(-2,1);var o=this.sketchLine_.getGeometry();if(t.length>=2){i=t[t.length-2].slice();t[t.length-1]=i,this.sketchPoint_.setGeometry(new qn(i))}o.setCoordinates(t),this.geometryFunction_(this.sketchCoords_,e,r)}1===t.length&&this.abortDrawing(),this.updateSketchFeatures_()}},e.prototype.finishDrawing=function(){var t=this.abortDrawing_();if(t){var e=this.sketchCoords_,r=t.getGeometry(),n=this.getMap().getView().getProjection();this.mode_===Mv?(e.pop(),this.geometryFunction_(e,r,n)):this.mode_===Fv&&(e[0].pop(),this.geometryFunction_(e,r,n),e=r.getCoordinates()),this.type_===bt.MULTI_POINT?t.setGeometry(new Hy([e])):this.type_===bt.MULTI_LINE_STRING?t.setGeometry(new Zy([e])):this.type_===bt.MULTI_POLYGON&&t.setGeometry(new Jy([e])),this.dispatchEvent(new Dv(jv,t)),this.features_&&this.features_.push(t),this.source_&&this.source_.addFeature(t)}},e.prototype.abortDrawing_=function(){this.finishCoordinate_=null;var t=this.sketchFeature_;return this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0),t},e.prototype.abortDrawing=function(){var t=this.abortDrawing_();t&&this.dispatchEvent(new Dv(Nv,t))},e.prototype.appendCoordinates=function(t){var e,r=this.mode_,n=!this.sketchFeature_;if(n&&this.startDrawing_(t[0]),r===Mv||r===Av)e=this.sketchCoords_;else{if(r!==Fv)return;e=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[]}n&&e.shift(),e.pop();for(var i=0;ih?o[1]:o[0]),a}}return null},e.prototype.handlePointerMove_=function(t){var e=t.pixel,r=t.map,n=this.snapToVertex_(e,r);n||(n=r.getCoordinateFromPixelInternal(e)),this.createOrUpdatePointerFeature_(n)},e.prototype.createOrUpdateExtentFeature_=function(t){var e=this.extentFeature_;return e?t?e.setGeometry(gi(t)):e.setGeometry(void 0):(e=new gt(t?gi(t):{}),this.extentFeature_=e,this.extentOverlay_.getSource().addFeature(e)),e},e.prototype.createOrUpdatePointerFeature_=function(t){var e=this.vertexFeature_;e?e.getGeometry().setCoordinates(t):(e=new gt(new qn(t)),this.vertexFeature_=e,this.vertexOverlay_.getSource().addFeature(e));return e},e.prototype.handleEvent=function(e){return!e.originalEvent||!this.condition_(e)||(e.type!=Ga.POINTERMOVE||this.handlingDownUpSequence||this.handlePointerMove_(e),t.prototype.handleEvent.call(this,e),!1)},e.prototype.handleDownEvent=function(t){var e=t.pixel,r=t.map,n=this.getExtentInternal(),i=this.snapToVertex_(e,r),o=function(t){var e=null,r=null;return t[0]==n[0]?e=n[2]:t[0]==n[2]&&(e=n[0]),t[1]==n[1]?r=n[3]:t[1]==n[3]&&(r=n[1]),null!==e&&null!==r?[e,r]:null};if(i&&n){var a=i[0]==n[0]||i[0]==n[2]?i[0]:null,s=i[1]==n[1]||i[1]==n[3]?i[1]:null;null!==a&&null!==s?this.pointerHandler_=Yv(o(i)):null!==a?this.pointerHandler_=Wv(o([a,n[1]]),o([a,n[3]])):null!==s&&(this.pointerHandler_=Wv(o([n[0],s]),o([n[2],s])))}else i=r.getCoordinateFromPixelInternal(e),this.setExtent([i[0],i[1],i[0],i[1]]),this.pointerHandler_=Yv(i);return!0},e.prototype.handleDragEvent=function(t){if(this.pointerHandler_){var e=t.coordinate;this.setExtent(this.pointerHandler_(e)),this.createOrUpdatePointerFeature_(e)}},e.prototype.handleUpEvent=function(t){this.pointerHandler_=null;var e=this.getExtentInternal();return e&&0!==ve(e)||this.setExtent(null),!1},e.prototype.setMap=function(e){this.extentOverlay_.setMap(e),this.vertexOverlay_.setMap(e),t.prototype.setMap.call(this,e)},e.prototype.getExtent=function(){return nn(this.getExtentInternal(),this.getMap().getView().getProjection())},e.prototype.getExtentInternal=function(){return this.extent_},e.prototype.setExtent=function(t){this.extent_=t||null,this.createOrUpdateExtentFeature_(t),this.dispatchEvent(new Bv(this.extent_))},e}($s),Xv=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Zv=[0,0,0,0],Kv=[],Hv="modifystart",$v="modifyend",Jv=function(t){function e(e,r,n){var i=t.call(this,e)||this;return i.features=r,i.mapBrowserEvent=n,i}return Xv(e,t),e}(c);function Qv(t,e){return t.index-e.index}function t_(t,e,r){var n=e.geometry;if(n.getType()===bt.CIRCLE){var i=n;if(1===e.index){var o=tn();o&&(i=i.clone().transform(o,r));var a=Rr(i.getCenter(),rn(t,r)),s=Math.sqrt(a)-i.getRadius();return s*s}}var l=rn(t,r);return Kv[0]=rn(e.segment[0],r),Kv[1]=rn(e.segment[1],r),Lr(l,Kv)}function e_(t,e,r){var n=e.geometry;if(n.getType()===bt.CIRCLE&&1===e.index){var i=n,o=tn();return o&&(i=i.clone().transform(o,r)),en(i.getClosestPoint(rn(t,r)),r)}var a=rn(t,r);return Kv[0]=rn(e.segment[0],r),Kv[1]=rn(e.segment[1],r),en(Sr(a,Kv),r)}var r_=function(t){function e(e){var r,n,i=t.call(this,e)||this;if(i.boundHandleFeatureChange_=i.handleFeatureChange_.bind(i),i.condition_=e.condition?e.condition:hl,i.defaultDeleteCondition_=function(t){return Qs(t)&&al(t)},i.deleteCondition_=e.deleteCondition?e.deleteCondition:i.defaultDeleteCondition_,i.insertVertexCondition_=e.insertVertexCondition?e.insertVertexCondition:nl,i.vertexFeature_=null,i.vertexSegments_=null,i.lastPixel_=[0,0],i.ignoreNextSingleClick_=!1,i.featuresBeingModified_=null,i.rBush_=new Rp,i.pixelTolerance_=void 0!==e.pixelTolerance?e.pixelTolerance:10,i.snappedToVertex_=!1,i.changingFeature_=!1,i.dragSegments_=[],i.overlay_=new Iy({source:new hf({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.style?e.style:(r=bp(),function(t,e){return r[bt.POINT]}),updateWhileAnimating:!0,updateWhileInteracting:!0}),i.SEGMENT_WRITERS_={Point:i.writePointGeometry_.bind(i),LineString:i.writeLineStringGeometry_.bind(i),LinearRing:i.writeLineStringGeometry_.bind(i),Polygon:i.writePolygonGeometry_.bind(i),MultiPoint:i.writeMultiPointGeometry_.bind(i),MultiLineString:i.writeMultiLineStringGeometry_.bind(i),MultiPolygon:i.writeMultiPolygonGeometry_.bind(i),Circle:i.writeCircleGeometry_.bind(i),GeometryCollection:i.writeGeometryCollectionGeometry_.bind(i)},i.source_=null,i.hitDetection_=null,e.features?n=e.features:e.source&&(i.source_=e.source,n=new ht(i.source_.getFeatures()),i.source_.addEventListener(ef,i.handleSourceAdd_.bind(i)),i.source_.addEventListener(of,i.handleSourceRemove_.bind(i))),!n)throw new Error("The modify interaction requires features, a source or a layer");return e.hitDetection&&(i.hitDetection_=e.hitDetection),i.features_=n,i.features_.forEach(i.addFeature_.bind(i)),i.features_.addEventListener(at,i.handleFeatureAdd_.bind(i)),i.features_.addEventListener(st,i.handleFeatureRemove_.bind(i)),i.lastPointerEvent_=null,i.delta_=[0,0],i}return Xv(e,t),e.prototype.addFeature_=function(t){var e=t.getGeometry();if(e){var r=this.SEGMENT_WRITERS_[e.getType()];r&&r(t,e)}var n=this.getMap();n&&n.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,n),t.addEventListener(F,this.boundHandleFeatureChange_)},e.prototype.willModifyFeatures_=function(t,e){if(!this.featuresBeingModified_){this.featuresBeingModified_=new ht;for(var r=this.featuresBeingModified_.getArray(),n=0,i=e.length;n=0;--n){for(var i=r[n],o=this.dragSegments_.length-1;o>=0;--o)this.dragSegments_[o][0]===i&&this.dragSegments_.splice(o,1);e.remove(i)}},e.prototype.setActive=function(e){this.vertexFeature_&&!e&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.prototype.setActive.call(this,e)},e.prototype.setMap=function(e){this.overlay_.setMap(e),t.prototype.setMap.call(this,e)},e.prototype.getOverlay=function(){return this.overlay_},e.prototype.handleSourceAdd_=function(t){t.feature&&this.features_.push(t.feature)},e.prototype.handleSourceRemove_=function(t){t.feature&&this.features_.remove(t.feature)},e.prototype.handleFeatureAdd_=function(t){this.addFeature_(t.element)},e.prototype.handleFeatureChange_=function(t){if(!this.changingFeature_){var e=t.target;this.removeFeature_(e),this.addFeature_(e)}},e.prototype.handleFeatureRemove_=function(t){var e=t.element;this.removeFeature_(e)},e.prototype.writePointGeometry_=function(t,e){var r=e.getCoordinates(),n={feature:t,geometry:e,segment:[r,r]};this.rBush_.insert(e.getExtent(),n)},e.prototype.writeMultiPointGeometry_=function(t,e){for(var r=e.getCoordinates(),n=0,i=r.length;n=0;--y)this.insertVertex_(i[y],a)}return!!this.vertexFeature_},e.prototype.handleUpEvent=function(t){for(var e=this.dragSegments_.length-1;e>=0;--e){var r=this.dragSegments_[e][0],n=r.geometry;if(n.getType()===bt.CIRCLE){var i=n.getCenter(),o=r.featureSegments[0],a=r.featureSegments[1];o.segment[0]=i,o.segment[1]=i,a.segment[0]=i,a.segment[1]=i,this.rBush_.update(ae(i),o);var s=n,l=tn();if(l){var u=t.map.getView().getProjection();s=yi(s=s.clone().transform(l,u)).transform(u,l)}this.rBush_.update(s.getExtent(),a)}else this.rBush_.update(Kt(r.segment),r)}return this.featuresBeingModified_&&(this.dispatchEvent(new Jv($v,this.featuresBeingModified_,t)),this.featuresBeingModified_=null),!1},e.prototype.handlePointerMove_=function(t){this.lastPixel_=t.pixel,this.handlePointerAtPixel_(t.pixel,t.map,t.coordinate)},e.prototype.handlePointerAtPixel_=function(t,e,r){var n,i,a=this,s=r||e.getCoordinateFromPixel(t),l=e.getView().getProjection();if(this.hitDetection_){var u="object"==typeof this.hitDetection_?function(t){return t===a.hitDetection_}:void 0;e.forEachFeatureAtPixel(t,(function(t,e,r){if((r=r||t.getGeometry()).getType()===bt.POINT){i=r;var o=r.getCoordinates();n=[{feature:t,geometry:r,segment:[o,o]}]}return!0}),{layerFilter:u})}if(!n){var c=nn(Ht(on(ae(s,Zv),l),e.getView().getResolution()*this.pixelTolerance_,Zv),l);n=this.rBush_.getInExtent(c)}if(n&&n.length>0){var h=n.sort((function(t,e){return t_(s,t,l)-t_(s,e,l)}))[0],p=h.segment,f=e_(s,h,l),d=e.getPixelFromCoordinate(f),g=Ir(t,d);if(i||g<=this.pixelTolerance_){var y={};if(y[o(p)]=!0,this.delta_[0]=f[0]-s[0],this.delta_[1]=f[1]-s[1],h.geometry.getType()===bt.CIRCLE&&1===h.index)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(f,[h.feature],[h.geometry]);else{var m=e.getPixelFromCoordinate(p[0]),v=e.getPixelFromCoordinate(p[1]),_=Rr(d,m),b=Rr(d,v);g=Math.sqrt(Math.min(_,b)),this.snappedToVertex_=g<=this.pixelTolerance_,this.snappedToVertex_&&(f=_>b?p[1]:p[0]),this.createOrUpdateVertexFeature_(f,[h.feature],[h.geometry]);var x={};x[o(h.geometry)]=!0;for(var w=1,S=n.length;w=0;--i)h=o((c=(r=p[i])[0]).feature),c.depth&&(h+="-"+c.depth.join("-")),h in f||(f[h]={}),0===r[1]?(f[h].right=c,f[h].index=c.index):1==r[1]&&(f[h].left=c,f[h].index=c.index+1);for(h in f){switch(u=f[h].right,s=f[h].left,(l=(a=f[h].index)-1)<0&&(l=0),t=e=(n=(c=void 0!==s?s:u).geometry).getCoordinates(),d=!1,n.getType()){case bt.MULTI_LINE_STRING:e[c.depth[0]].length>2&&(e[c.depth[0]].splice(a,1),d=!0);break;case bt.LINE_STRING:e.length>2&&(e.splice(a,1),d=!0);break;case bt.MULTI_POLYGON:t=t[c.depth[1]];case bt.POLYGON:(t=t[c.depth[0]]).length>4&&(a==t.length-1&&(a=0),t.splice(a,1),d=!0,0===a&&(t.pop(),t.push(t[0]),l=t.length-1))}if(d){this.setGeometryCoordinates_(n,e);var g=[];if(void 0!==s&&(this.rBush_.remove(s),g.push(s.segment[0])),void 0!==u&&(this.rBush_.remove(u),g.push(u.segment[1])),void 0!==s&&void 0!==u){var y={depth:c.depth,feature:c.feature,geometry:c.geometry,index:l,segment:g};this.rBush_.insert(Kt(y.segment),y)}this.updateSegmentIndices_(n,a,c.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),p.length=0}}return d},e.prototype.setGeometryCoordinates_=function(t,e){this.changingFeature_=!0,t.setCoordinates(e),this.changingFeature_=!1},e.prototype.updateSegmentIndices_=function(t,e,r,n){this.rBush_.forEachInExtent(t.getExtent(),(function(i){i.geometry===t&&(void 0===r||void 0===i.depth||b(i.depth,r))&&i.index>e&&(i.index+=n)}))},e}($s),n_=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),i_="select",o_=function(t){function e(e,r,n,i){var o=t.call(this,e)||this;return o.selected=r,o.deselected=n,o.mapBrowserEvent=i,o}return n_(e,t),e}(c),a_={};var s_=function(t){function e(e){var r,n,i=t.call(this)||this,o=e||{};if(i.boundAddFeature_=i.addFeature_.bind(i),i.boundRemoveFeature_=i.removeFeature_.bind(i),i.condition_=o.condition?o.condition:al,i.addCondition_=o.addCondition?o.addCondition:ol,i.removeCondition_=o.removeCondition?o.removeCondition:ol,i.toggleCondition_=o.toggleCondition?o.toggleCondition:ll,i.multi_=!!o.multi&&o.multi,i.filter_=o.filter?o.filter:S,i.hitTolerance_=o.hitTolerance?o.hitTolerance:0,i.style_=void 0!==o.style?o.style:(v((r=bp())[bt.POLYGON],r[bt.LINE_STRING]),v(r[bt.GEOMETRY_COLLECTION],r[bt.LINE_STRING]),function(t){return t.getGeometry()?r[t.getGeometry().getType()]:null}),i.features_=o.features||new ht,o.layers)if("function"==typeof o.layers)n=o.layers;else{var a=o.layers;n=function(t){return g(a,t)}}else n=S;return i.layerFilter_=n,i.featureLayerAssociation_={},i}return n_(e,t),e.prototype.addFeatureLayerAssociation_=function(t,e){this.featureLayerAssociation_[o(t)]=e},e.prototype.getFeatures=function(){return this.features_},e.prototype.getHitTolerance=function(){return this.hitTolerance_},e.prototype.getLayer=function(t){return this.featureLayerAssociation_[o(t)]},e.prototype.setHitTolerance=function(t){this.hitTolerance_=t},e.prototype.setMap=function(e){this.getMap()&&this.style_&&this.features_.forEach(this.restorePreviousStyle_.bind(this)),t.prototype.setMap.call(this,e),e?(this.features_.addEventListener(at,this.boundAddFeature_),this.features_.addEventListener(st,this.boundRemoveFeature_),this.style_&&this.features_.forEach(this.applySelectedStyle_.bind(this))):(this.features_.removeEventListener(at,this.boundAddFeature_),this.features_.removeEventListener(st,this.boundRemoveFeature_))},e.prototype.addFeature_=function(t){var e=t.element;this.style_&&this.applySelectedStyle_(e)},e.prototype.removeFeature_=function(t){var e=t.element;this.style_&&this.restorePreviousStyle_(e)},e.prototype.getStyle=function(){return this.style_},e.prototype.applySelectedStyle_=function(t){var e=o(t);e in a_||(a_[e]=t.getStyle()),t.setStyle(this.style_)},e.prototype.restorePreviousStyle_=function(t){for(var r=this.getMap().getInteractions().getArray(),n=r.length-1;n>=0;--n){var i=r[n];if(i!==this&&i instanceof e&&i.getStyle()&&-1!==i.getFeatures().getArray().lastIndexOf(t))return void t.setStyle(i.getStyle())}var a=o(t);t.setStyle(a_[a]),delete a_[a]},e.prototype.removeFeatureLayerAssociation_=function(t){delete this.featureLayerAssociation_[o(t)]},e.prototype.handleEvent=function(t){if(!this.condition_(t))return!0;var e=this.addCondition_(t),r=this.removeCondition_(t),n=this.toggleCondition_(t),i=!e&&!r&&!n,o=t.map,a=this.getFeatures(),s=[],l=[];if(i){P(this.featureLayerAssociation_),o.forEachFeatureAtPixel(t.pixel,function(t,e){if(this.filter_(t,e))return l.push(t),this.addFeatureLayerAssociation_(t,e),!this.multi_}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(var u=a.getLength()-1;u>=0;--u){var c=a.item(u),h=l.indexOf(c);h>-1?l.splice(h,1):(a.remove(c),s.push(c))}0!==l.length&&a.extend(l)}else{o.forEachFeatureAtPixel(t.pixel,function(t,i){if(this.filter_(t,i))return!e&&!n||g(a.getArray(),t)?(r||n)&&g(a.getArray(),t)&&(s.push(t),this.removeFeatureLayerAssociation_(t)):(l.push(t),this.addFeatureLayerAssociation_(t,i)),!this.multi_}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(var p=s.length-1;p>=0;--p)a.remove(s[p]);a.extend(l)}return(l.length>0||s.length>0)&&this.dispatchEvent(new o_(i_,l,s,t)),!0},e}(qs),l_=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();function u_(t){return t.feature?t.feature:t.element?t.element:void 0}var c_=[],h_=function(t){function e(e){var r=this,n=e||{},i=n;return i.handleDownEvent||(i.handleDownEvent=S),i.stopDown||(i.stopDown=E),(r=t.call(this,i)||this).source_=n.source?n.source:null,r.vertex_=void 0===n.vertex||n.vertex,r.edge_=void 0===n.edge||n.edge,r.features_=n.features?n.features:null,r.featuresListenerKeys_=[],r.featureChangeListenerKeys_={},r.indexedFeaturesExtents_={},r.pendingFeatures_={},r.pixelTolerance_=void 0!==n.pixelTolerance?n.pixelTolerance:10,r.rBush_=new Rp,r.SEGMENT_WRITERS_={Point:r.writePointGeometry_.bind(r),LineString:r.writeLineStringGeometry_.bind(r),LinearRing:r.writeLineStringGeometry_.bind(r),Polygon:r.writePolygonGeometry_.bind(r),MultiPoint:r.writeMultiPointGeometry_.bind(r),MultiLineString:r.writeMultiLineStringGeometry_.bind(r),MultiPolygon:r.writeMultiPolygonGeometry_.bind(r),GeometryCollection:r.writeGeometryCollectionGeometry_.bind(r),Circle:r.writeCircleGeometry_.bind(r)},r}return l_(e,t),e.prototype.addFeature=function(t,e){var r=void 0===e||e,n=o(t),i=t.getGeometry();if(i){var a=this.SEGMENT_WRITERS_[i.getType()];a&&(this.indexedFeaturesExtents_[n]=i.getExtent([1/0,1/0,-1/0,-1/0]),a(t,i))}r&&(this.featureChangeListenerKeys_[n]=Z(t,F,this.handleFeatureChange_,this))},e.prototype.forEachFeatureAdd_=function(t){this.addFeature(t)},e.prototype.forEachFeatureRemove_=function(t){this.removeFeature(t)},e.prototype.getFeatures_=function(){var t;return this.features_?t=this.features_:this.source_&&(t=this.source_.getFeatures()),t},e.prototype.handleEvent=function(e){var r=this.snapTo(e.pixel,e.coordinate,e.map);return r.snapped&&(e.coordinate=r.vertex.slice(0,2),e.pixel=r.vertexPixel),t.prototype.handleEvent.call(this,e)},e.prototype.handleFeatureAdd_=function(t){var e=u_(t);this.addFeature(e)},e.prototype.handleFeatureRemove_=function(t){var e=u_(t);this.removeFeature(e)},e.prototype.handleFeatureChange_=function(t){var e=t.target;if(this.handlingDownUpSequence){var r=o(e);r in this.pendingFeatures_||(this.pendingFeatures_[r]=e)}else this.updateFeature_(e)},e.prototype.handleUpEvent=function(t){var e=R(this.pendingFeatures_);return e.length&&(e.forEach(this.updateFeature_.bind(this)),this.pendingFeatures_={}),!1},e.prototype.removeFeature=function(t,e){var r=void 0===e||e,n=o(t),i=this.indexedFeaturesExtents_[n];if(i){var a=this.rBush_,s=[];a.forEachInExtent(i,(function(e){t===e.feature&&s.push(e)}));for(var l=s.length-1;l>=0;--l)a.remove(s[l])}r&&(H(this.featureChangeListenerKeys_[n]),delete this.featureChangeListenerKeys_[n])},e.prototype.setMap=function(e){var r=this.getMap(),n=this.featuresListenerKeys_,i=this.getFeatures_();r&&(n.forEach(H),n.length=0,i.forEach(this.forEachFeatureRemove_.bind(this))),t.prototype.setMap.call(this,e),e&&(this.features_?n.push(Z(this.features_,at,this.handleFeatureAdd_,this),Z(this.features_,st,this.handleFeatureRemove_,this)):this.source_&&n.push(Z(this.source_,ef,this.handleFeatureAdd_,this),Z(this.source_,of,this.handleFeatureRemove_,this)),i.forEach(this.forEachFeatureAdd_.bind(this)))},e.prototype.snapTo=function(t,e,r){var n=Kt([r.getCoordinateFromPixel([t[0]-this.pixelTolerance_,t[1]+this.pixelTolerance_]),r.getCoordinateFromPixel([t[0]+this.pixelTolerance_,t[1]-this.pixelTolerance_])]),i=this.rBush_.getInExtent(n);this.vertex_&&!this.edge_&&(i=i.filter((function(t){return t.feature.getGeometry().getType()!==bt.CIRCLE})));var o=!1,a=null,s=null;if(0===i.length)return{snapped:o,vertex:a,vertexPixel:s};for(var l,u=r.getView().getProjection(),c=rn(e,u),h=1/0,p=0;p_?g[1]:g[0],s=r.getPixelFromCoordinate(a))}else if(this.edge_){var b=l.feature.getGeometry().getType()===bt.CIRCLE;if(b){var x=l.feature.getGeometry(),w=tn();w&&(x=x.clone().transform(w,u)),a=en(wr(c,x),u)}else c_[0]=rn(g[0],u),c_[1]=rn(g[1],u),a=en(Sr(c,c_),u);if(Ir(t,s=r.getPixelFromCoordinate(a))<=this.pixelTolerance_&&(o=!0,this.vertex_&&!b)){y=r.getPixelFromCoordinate(g[0]),m=r.getPixelFromCoordinate(g[1]),v=Rr(s,y),_=Rr(s,m);Math.sqrt(Math.min(v,_))<=this.pixelTolerance_&&(a=v>_?g[1]:g[0],s=r.getPixelFromCoordinate(a))}}return o&&(s=[Math.round(s[0]),Math.round(s[1])]),{snapped:o,vertex:a,vertexPixel:s}},e.prototype.updateFeature_=function(t){this.removeFeature(t,!1),this.addFeature(t,!1)},e.prototype.writeCircleGeometry_=function(t,e){var r=this.getMap().getView().getProjection(),n=e,i=tn();i&&(n=n.clone().transform(i,r));var o=yi(n);i&&o.transform(r,i);for(var a=o.getCoordinates()[0],s=0,l=a.length-1;s=0;r--){var u=o[r][0];if(te(new Yn(u).getExtent(),new Yn(s).getExtent())){o[r].push(s),l=!0;break}}l||o.push([s.reverse()])}return o}(o.rings,a);1===s.length?(i=bt.POLYGON,t=O({},t,((r={}).rings=s[0],r))):(i=bt.MULTI_POLYGON,t=O({},t,((n={}).rings=s,n)))}return Wy((0,b_[i])(t),!1,e)}function S_(t){var e=yt;return!0===t.hasZ&&!0===t.hasM?e=_t:!0===t.hasZ?e=mt:!0===t.hasM&&(e=vt),e}function E_(t){var e=t.getLayout();return{hasZ:e===mt||e===_t,hasM:e===vt||e===_t}}function T_(t,e){return(0,x_[t.getType()])(Wy(t,!0,e),e)}x_[bt.POINT]=function(t,e){var r,n=t.getCoordinates(),i=t.getLayout();i===mt?r={x:n[0],y:n[1],z:n[2]}:i===vt?r={x:n[0],y:n[1],m:n[2]}:i===_t?r={x:n[0],y:n[1],z:n[2],m:n[3]}:i===yt?r={x:n[0],y:n[1]}:pt(!1,34);return r},x_[bt.LINE_STRING]=function(t,e){var r=E_(t);return{hasZ:r.hasZ,hasM:r.hasM,paths:[t.getCoordinates()]}},x_[bt.POLYGON]=function(t,e){var r=E_(t);return{hasZ:r.hasZ,hasM:r.hasM,rings:t.getCoordinates(!1)}},x_[bt.MULTI_POINT]=function(t,e){var r=E_(t);return{hasZ:r.hasZ,hasM:r.hasM,points:t.getCoordinates()}},x_[bt.MULTI_LINE_STRING]=function(t,e){var r=E_(t);return{hasZ:r.hasZ,hasM:r.hasM,paths:t.getCoordinates()}},x_[bt.MULTI_POLYGON]=function(t,e){for(var r=E_(t),n=t.getCoordinates(!1),i=[],o=0;o=0;a--)i.push(n[o][a]);return{hasZ:r.hasZ,hasM:r.hasM,rings:i}};var C_=function(t){function e(e){var r=this,n=e||{};return(r=t.call(this)||this).geometryName_=n.geometryName,r}return __(e,t),e.prototype.readFeatureFromObject=function(t,e,r){var n=t,i=w_(n.geometry,e),o=new gt;if(this.geometryName_&&o.setGeometryName(this.geometryName_),o.setGeometry(i),n.attributes){o.setProperties(n.attributes,!0);var a=n.attributes[r];void 0!==a&&o.setId(a)}return o},e.prototype.readFeaturesFromObject=function(t,e){var r=e||{};if(t.features){for(var n=[],i=t.features,o=0,a=i.length;o0?r[0]:null},e.prototype.readFeatureFromNode=function(t,e){return null},e.prototype.readFeatures=function(t,e){if(t){if("string"==typeof t){var r=Pc(t);return this.readFeaturesFromDocument(r,e)}return Cc(t)?this.readFeaturesFromDocument(t,e):this.readFeaturesFromNode(t,e)}return[]},e.prototype.readFeaturesFromDocument=function(t,e){for(var r=[],n=t.firstChild;n;n=n.nextSibling)n.nodeType==Node.ELEMENT_NODE&&v(r,this.readFeaturesFromNode(n,e));return r},e.prototype.readFeaturesFromNode=function(t,e){return n()},e.prototype.readGeometry=function(t,e){if(t){if("string"==typeof t){var r=Pc(t);return this.readGeometryFromDocument(r,e)}return Cc(t)?this.readGeometryFromDocument(t,e):this.readGeometryFromNode(t,e)}return null},e.prototype.readGeometryFromDocument=function(t,e){return null},e.prototype.readGeometryFromNode=function(t,e){return null},e.prototype.readProjection=function(t){if(t){if("string"==typeof t){var e=Pc(t);return this.readProjectionFromDocument(e)}return Cc(t)?this.readProjectionFromDocument(t):this.readProjectionFromNode(t)}return null},e.prototype.readProjectionFromDocument=function(t){return this.dataProjection},e.prototype.readProjectionFromNode=function(t){return this.dataProjection},e.prototype.writeFeature=function(t,e){var r=this.writeFeatureNode(t,e);return this.xmlSerializer_.serializeToString(r)},e.prototype.writeFeatureNode=function(t,e){return null},e.prototype.writeFeatures=function(t,e){var r=this.writeFeaturesNode(t,e);return this.xmlSerializer_.serializeToString(r)},e.prototype.writeFeaturesNode=function(t,e){return null},e.prototype.writeGeometry=function(t,e){var r=this.writeGeometryNode(t,e);return this.xmlSerializer_.serializeToString(r)},e.prototype.writeGeometryNode=function(t,e){return null},e}(Yy),R_=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),I_="http://www.opengis.net/gml",L_=/^[\s\xa0]*$/,M_=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.featureType=n.featureType,r.featureNS=n.featureNS,r.srsName=n.srsName,r.schemaLocation="",r.FEATURE_COLLECTION_PARSERS={},r.FEATURE_COLLECTION_PARSERS[r.namespace]={featureMember:Ic(r.readFeaturesInternal),featureMembers:Lc(r.readFeaturesInternal)},r}return R_(e,t),e.prototype.readFeaturesInternal=function(t,e){var r=t.localName,n=null;if("FeatureCollection"==r)n=Uc([],this.FEATURE_COLLECTION_PARSERS,t,e,this);else if("featureMembers"==r||"featureMember"==r||"member"==r){var i=e[0],o=i.featureType,a=i.featureNS;if(!o&&t.childNodes){o=[],a={};for(var s=0,l=t.childNodes.length;s0){i[s]={_content_:i[s]};for(var u=0;u0:h===bt.POINT||h===bt.MULTI_POINT}}s&&(l=o.get("name"),(s=s&&!!l)&&l.search(/&[^&]+;/)>-1&&(Tx||(Tx=document.createElement("textarea")),Tx.innerHTML=l,l=Tx.value));var p=r;if(t?p=t:e&&(p=function t(e,r,n){return Array.isArray(e)?e:"string"==typeof e?t(n[e],r,n):r}(e,r,n)),s){var f=function(t,e){var r=[0,0],n="start",i=t.getImage();if(i){var o=i.getImageSize();if(null===o&&(o=Kb),2==o.length){var a=i.getScaleArray();r[0]=a[0]*o[0]/2,r[1]=-a[1]*o[1]/2,n="left"}}var s=t.getText();s?((s=s.clone()).setFont(s.getFont()||Sx.getFont()),s.setScale(s.getScale()||Sx.getScale()),s.setFill(s.getFill()||Sx.getFill()),s.setStroke(s.getStroke()||xx)):s=Sx.clone();return s.setText(e),s.setOffsetX(r[0]),s.setOffsetY(r[1]),s.setTextAlign(n),new wp({image:i,text:s})}(p[0],l);return u.length>0?(f.setGeometry(new Vm(u)),[f,new wp({geometry:p[0].getGeometry(),image:null,fill:p[0].getFill(),stroke:p[0].getStroke(),text:null})].concat(p.slice(1))):f}return p}}(r.Style,r.styleUrl,this.defaultStyle_,this.sharedStyles_,this.showPointNames_);n.setStyle(s)}return delete r.Style,n.setProperties(r,!0),n}},e.prototype.readSharedStyle_=function(t,e){var r=t.getAttribute("id");if(null!==r){var n=nw.call(this,t,e);if(n){var i=void 0,o=t.baseURI;if(o&&"about:blank"!=o||(o=window.location.href),o)i=new URL("#"+r,o).href;else i="#"+r;this.sharedStyles_[i]=n}}},e.prototype.readSharedStyleMap_=function(t,e){var r=t.getAttribute("id");if(null!==r){var n=kx.call(this,t,e);if(n){var i,o=t.baseURI;if(o&&"about:blank"!=o||(o=window.location.href),o)i=new URL("#"+r,o).href;else i="#"+r;this.sharedStyles_[i]=n}}},e.prototype.readFeatureFromNode=function(t,e){if(!g(cx,t.namespaceURI))return null;var r=this.readPlacemark_(t,[this.getReadOptions(t,e)]);return r||null},e.prototype.readFeaturesFromNode=function(t,e){if(!g(cx,t.namespaceURI))return[];var r,n=t.localName;if("Document"==n||"Folder"==n)return(r=this.readDocumentOrFolder_(t,[this.getReadOptions(t,e)]))||[];if("Placemark"==n){var i=this.readPlacemark_(t,[this.getReadOptions(t,e)]);return i?[i]:[]}if("kml"==n){r=[];for(var o=t.firstElementChild;o;o=o.nextElementSibling){var a=this.readFeaturesFromNode(o,e);a&&v(r,a)}return r}return[]},e.prototype.readName=function(t){if(t){if("string"==typeof t){var e=Pc(t);return this.readNameFromDocument(e)}return Cc(t)?this.readNameFromDocument(t):this.readNameFromNode(t)}},e.prototype.readNameFromDocument=function(t){for(var e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE){var r=this.readNameFromNode(e);if(r)return r}},e.prototype.readNameFromNode=function(t){for(var e=t.firstElementChild;e;e=e.nextElementSibling)if(g(cx,e.namespaceURI)&&"name"==e.localName)return U_(e);for(e=t.firstElementChild;e;e=e.nextElementSibling){var r=e.localName;if(g(cx,e.namespaceURI)&&("Document"==r||"Folder"==r||"Placemark"==r||"kml"==r)){var n=this.readNameFromNode(e);if(n)return n}}},e.prototype.readNetworkLinks=function(t){var e=[];if("string"==typeof t){var r=Pc(t);v(e,this.readNetworkLinksFromDocument(r))}else Cc(t)?v(e,this.readNetworkLinksFromDocument(t)):v(e,this.readNetworkLinksFromNode(t));return e},e.prototype.readNetworkLinksFromDocument=function(t){for(var e=[],r=t.firstChild;r;r=r.nextSibling)r.nodeType==Node.ELEMENT_NODE&&v(e,this.readNetworkLinksFromNode(r));return e},e.prototype.readNetworkLinksFromNode=function(t){for(var e=[],r=t.firstElementChild;r;r=r.nextElementSibling)if(g(cx,r.namespaceURI)&&"NetworkLink"==r.localName){var n=Uc({},fx,r,[]);e.push(n)}for(r=t.firstElementChild;r;r=r.nextElementSibling){var i=r.localName;!g(cx,r.namespaceURI)||"Document"!=i&&"Folder"!=i&&"kml"!=i||v(e,this.readNetworkLinksFromNode(r))}return e},e.prototype.readRegion=function(t){var e=[];if("string"==typeof t){var r=Pc(t);v(e,this.readRegionFromDocument(r))}else Cc(t)?v(e,this.readRegionFromDocument(t)):v(e,this.readRegionFromNode(t));return e},e.prototype.readRegionFromDocument=function(t){for(var e=[],r=t.firstChild;r;r=r.nextSibling)r.nodeType==Node.ELEMENT_NODE&&v(e,this.readRegionFromNode(r));return e},e.prototype.readRegionFromNode=function(t){for(var e=[],r=t.firstElementChild;r;r=r.nextElementSibling)if(g(cx,r.namespaceURI)&&"Region"==r.localName){var n=Uc({},gx,r,[]);e.push(n)}for(r=t.firstElementChild;r;r=r.nextElementSibling){var i=r.localName;!g(cx,r.namespaceURI)||"Document"!=i&&"Folder"!=i&&"kml"!=i||v(e,this.readRegionFromNode(r))}return e},e.prototype.writeFeaturesNode=function(t,e){e=this.adaptOptions(e);var r=Sc(cx[4],"kml"),n="http://www.w3.org/2000/xmlns/";r.setAttributeNS(n,"xmlns:gx",ux[0]),r.setAttributeNS(n,"xmlns:xsi",wc),r.setAttributeNS(wc,"xsi:schemaLocation","http://www.opengis.net/kml/2.2 https://developers.google.com/kml/schema/kml22gx.xsd");var i={node:r},o={};t.length>1?o.Document=t:1==t.length&&(o.Placemark=t[0]);var a=yx[r.namespaceURI],s=Dc(o,a);return Vc(i,mx,Nc,s,[e],a,this),r},e}(P_);function Rx(t){var e=Ec(t,!1),r=/^\s*#?\s*([0-9A-Fa-f]{8})\s*$/.exec(e);if(r){var n=r[1];return[parseInt(n.substr(6,2),16),parseInt(n.substr(4,2),16),parseInt(n.substr(2,2),16),parseInt(n.substr(0,2),16)/255]}}function Ix(t){var e=Ec(t,!1),r=[];e=e.replace(/\s*,\s*/g,",");for(var n,i=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?),([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s+|,|$)(?:([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s+|$))?\s*/i;n=i.exec(e);){var o=parseFloat(n[1]),a=parseFloat(n[2]),s=n[3]?parseFloat(n[3]):0;r.push(o,a,s),e=e.substr(n[0].length)}if(""===e)return r}function Lx(t){var e=Ec(t,!1).trim(),r=t.baseURI;return r&&"about:blank"!=r||(r=window.location.href),r?new URL(e,r).href:e}function Mx(t){var e=Ec(t,!1).trim().replace(/^(?!.*#)/,"#"),r=t.baseURI;return r&&"about:blank"!=r||(r=window.location.href),r?new URL(e,r).href:e}function Fx(t){return N_(t)}var Ax=Gc(cx,{Pair:function(t,e){var r=Uc({},uw,t,e,this);if(!r)return;var n=r.key;if(n&&"normal"==n){var i=r.styleUrl;i&&(e[e.length-1]=i);var o=r.Style;o&&(e[e.length-1]=o)}}});function kx(t,e){return Uc(void 0,Ax,t,e,this)}var jx=Gc(cx,{Icon:Fc((function(t,e){var r=Uc({},Wx,t,e);return r||null})),color:Fc(Rx),heading:Fc(N_),hotSpot:Fc((function(t){var e,r=t.getAttribute("xunits"),n=t.getAttribute("yunits");return e="insetPixels"!==r?"insetPixels"!==n?ip:ap:"insetPixels"!==n?op:sp,{x:parseFloat(t.getAttribute("x")),xunits:hx[r],y:parseFloat(t.getAttribute("y")),yunits:hx[n],origin:e}})),scale:Fc(Fx)});var Nx=Gc(cx,{color:Fc(Rx),scale:Fc(Fx)});var Dx=Gc(cx,{color:Fc(Rx),width:Fc(N_)});var Gx=Gc(cx,{color:Fc(Rx),fill:Fc(A_),outline:Fc(A_)});var zx=Gc(cx,{coordinates:Lc(Ix)});function Ux(t,e){return Uc(null,zx,t,e)}var Bx=Gc(ux,{Track:Ic(Yx)});var Vx=Gc(cx,{when:function(t,e){var r=e[e.length-1].whens,n=Ec(t,!1),i=Date.parse(n);r.push(isNaN(i)?0:i)}},Gc(ux,{coord:function(t,e){var r=e[e.length-1].flatCoordinates,n=Ec(t,!1),i=/^\s*([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s*$/i.exec(n);if(i){var o=parseFloat(i[1]),a=parseFloat(i[2]),s=parseFloat(i[3]);r.push(o,a,s,0)}else r.push(0,0,0,0)}}));function Yx(t,e){var r=Uc({flatCoordinates:[],whens:[]},Vx,t,e);if(r){for(var n=r.flatCoordinates,i=r.whens,o=0,a=Math.min(n.length,i.length);o0,c=l.href;c?n=c:u&&(n=Hb);var h,p=ip,f=r.hotSpot;f?(i=[f.x,f.y],o=f.xunits,a=f.yunits,p=f.origin):n===Hb?(i=qb,o=Xb,a=Zb):/^http:\/\/maps\.(?:google|gstatic)\.com\//.test(n)&&(i=[.5,0],o=rp,a=rp);var d,g=l.x,y=l.y;void 0!==g&&void 0!==y&&(h=[g,y]);var m,v=l.w,_=l.h;void 0!==v&&void 0!==_&&(d=[v,_]);var b=r.heading;void 0!==b&&(m=Ye(b));var x=r.scale,w=r.color;if(u){n==Hb&&(d=Kb,void 0===x&&(x=$b));var S=new dp({anchor:i,anchorOrigin:p,anchorXUnits:o,anchorYUnits:a,crossOrigin:this.crossOrigin_,offset:h,offsetOrigin:ip,rotation:m,scale:x,size:d,src:this.iconUrlFunction_(n),color:w});s.imageStyle=S}else s.imageStyle=_x}},LabelStyle:function(t,e){var r=Uc({},Nx,t,e);if(r){var n=e[e.length-1],i=new Tp({fill:new ep({color:"color"in r?r.color:Wb}),scale:r.scale});n.textStyle=i}},LineStyle:function(t,e){var r=Uc({},Dx,t,e);if(r){var n=e[e.length-1],i=new gp({color:"color"in r?r.color:Wb,width:"width"in r?r.width:1});n.strokeStyle=i}},PolyStyle:function(t,e){var r=Uc({},Gx,t,e);if(r){var n=e[e.length-1],i=new ep({color:"color"in r?r.color:Wb});n.fillStyle=i;var o=r.fill;void 0!==o&&(n.fill=o);var a=r.outline;void 0!==a&&(n.outline=a)}}});function nw(t,e){var r=Uc({},rw,t,e,this);if(!r)return null;var n,i="fillStyle"in r?r.fillStyle:vx,o=r.fill;void 0===o||o||(i=null),"imageStyle"in r?r.imageStyle!=_x&&(n=r.imageStyle):n=bx;var a="textStyle"in r?r.textStyle:Sx,s="strokeStyle"in r?r.strokeStyle:wx,l=r.outline;return void 0===l||l?[new wp({fill:i,image:n,stroke:s,text:a,zIndex:void 0})]:[new wp({geometry:function(t){var e=t.getGeometry(),r=e.getType();return r===bt.GEOMETRY_COLLECTION?new Vm(e.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return e!==bt.POLYGON&&e!==bt.MULTI_POLYGON}))):r!==bt.POLYGON&&r!==bt.MULTI_POLYGON?e:void 0},fill:i,image:n,stroke:s,text:a,zIndex:void 0}),new wp({geometry:function(t){var e=t.getGeometry(),r=e.getType();return r===bt.GEOMETRY_COLLECTION?new Vm(e.getGeometriesArrayRecursive().filter((function(t){var e=t.getType();return e===bt.POLYGON||e===bt.MULTI_POLYGON}))):r===bt.POLYGON||r===bt.MULTI_POLYGON?e:void 0},fill:i,stroke:null,zIndex:void 0})]}function iw(t,e){var r,n,i,o=e.length,a=new Array(e.length),s=new Array(e.length),l=new Array(e.length);r=!1,n=!1,i=!1;for(var u=0;u0){var m=Dc(i,a);Vc(n,Gw,Uw,[{names:a,values:m}],r)}var v=r[0],_=e.getGeometry();_&&(_=Wy(_,!0,v)),Vc(n,Gw,Iw,[_],r)}var Vw=Gc(cx,["extrude","tessellate","altitudeMode","coordinates"]),Yw=Gc(cx,{extrude:Ac(B_),tessellate:Ac(B_),altitudeMode:Ac(X_),coordinates:Ac((function(t,e,r){var n,i=r[r.length-1],o=i.layout,a=i.stride;o==yt||o==vt?n=2:o==mt||o==_t?n=3:pt(!1,34);var s=e.length,l="";if(s>0){l+=e[0];for(var u=1;u>1):i>>1}return e}function NS(t){for(var e="",r=0,n=t.length;r=32;)e=63+(32|31&t),r+=String.fromCharCode(e),t>>=5;return e=t+63,r+=String.fromCharCode(e)}var zS=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.dataProjection=Gr("EPSG:4326"),r.factor_=n.factor?n.factor:1e5,r.geometryLayout_=n.geometryLayout?n.geometryLayout:yt,r}return IS(e,t),e.prototype.readFeatureFromText=function(t,e){var r=this.readGeometryFromText(t,e);return new gt(r)},e.prototype.readFeaturesFromText=function(t,e){return[this.readFeatureFromText(t,e)]},e.prototype.readGeometryFromText=function(t,e){var r=yn(this.geometryLayout_),n=MS(t,r,this.factor_);v_(n,0,n.length,r,n);var i=Nn(n,0,n.length,r);return Wy(new Py(i,this.geometryLayout_),!1,this.adaptOptions(e))},e.prototype.writeFeatureText=function(t,e){var r=t.getGeometry();return r?this.writeGeometryText(r,e):(pt(!1,40),"")},e.prototype.writeFeaturesText=function(t,e){return this.writeFeatureText(t[0],e)},e.prototype.writeGeometryText=function(t,e){var r=(t=Wy(t,!0,this.adaptOptions(e))).getFlatCoordinates(),n=t.getStride();return v_(r,0,r.length,n,r),LS(r,n,this.factor_)},e}(Jb),US=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),BS=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.layerName_=n.layerName,r.layers_=n.layers?n.layers:null,r.dataProjection=Gr(n.dataProjection?n.dataProjection:"EPSG:4326"),r}return US(e,t),e.prototype.readFeaturesFromObject=function(t,e){if("Topology"==t.type){var r=t,n=void 0,i=null,o=null;r.transform&&(i=(n=r.transform).scale,o=n.translate);var a=r.arcs;n&&function(t,e,r){for(var n=0,i=t.length;n0&&i.pop(),n=r>=0?e[r]:e[~r].slice().reverse(),i.push.apply(i,n);for(var s=0,l=i.length;s=2,57),n}return $S(e,t),e}(HS),QS=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),tE=function(t){function e(e){return t.call(this,"And",Array.prototype.slice.call(arguments))||this}return QS(e,t),e}(JS),eE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),rE=function(t){function e(e,r,n){var i=t.call(this,"BBOX")||this;if(i.geometryName=e,i.extent=r,4!==r.length)throw new Error("Expected an extent with four values ([minX, minY, maxX, maxY])");return i.srsName=n,i}return eE(e,t),e}(HS),nE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),iE=function(t){function e(e,r,n,i){var o=t.call(this,e)||this;return o.geometryName=r||"the_geom",o.geometry=n,o.srsName=i,o}return nE(e,t),e}(HS),oE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),aE=function(t){function e(e,r,n){return t.call(this,"Contains",e,r,n)||this}return oE(e,t),e}(iE),sE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),lE=function(t){function e(e,r,n,i,o){var a=t.call(this,"DWithin",e,r,o)||this;return a.distance=n,a.unit=i,a}return sE(e,t),e}(iE),uE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),cE=function(t){function e(e,r,n){return t.call(this,"Disjoint",e,r,n)||this}return uE(e,t),e}(iE),hE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),pE=function(t){function e(e,r){var n=t.call(this,e)||this;return n.propertyName=r,n}return hE(e,t),e}(HS),fE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),dE=function(t){function e(e,r,n){var i=t.call(this,"During",e)||this;return i.begin=r,i.end=n,i}return fE(e,t),e}(pE),gE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),yE=function(t){function e(e,r,n,i){var o=t.call(this,e,r)||this;return o.expression=n,o.matchCase=i,o}return gE(e,t),e}(pE),mE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),vE=function(t){function e(e,r,n){return t.call(this,"PropertyIsEqualTo",e,r,n)||this}return mE(e,t),e}(yE),_E=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),bE=function(t){function e(e,r){return t.call(this,"PropertyIsGreaterThan",e,r)||this}return _E(e,t),e}(yE),xE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),wE=function(t){function e(e,r){return t.call(this,"PropertyIsGreaterThanOrEqualTo",e,r)||this}return xE(e,t),e}(yE),SE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),EE=function(t){function e(e,r,n){return t.call(this,"Intersects",e,r,n)||this}return SE(e,t),e}(iE),TE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),CE=function(t){function e(e,r,n){var i=t.call(this,"PropertyIsBetween",e)||this;return i.lowerBoundary=r,i.upperBoundary=n,i}return TE(e,t),e}(pE),OE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),PE=function(t){function e(e,r,n,i,o,a){var s=t.call(this,"PropertyIsLike",e)||this;return s.pattern=r,s.wildCard=void 0!==n?n:"*",s.singleChar=void 0!==i?i:".",s.escapeChar=void 0!==o?o:"!",s.matchCase=a,s}return OE(e,t),e}(pE),RE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),IE=function(t){function e(e){return t.call(this,"PropertyIsNull",e)||this}return RE(e,t),e}(pE),LE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ME=function(t){function e(e,r){return t.call(this,"PropertyIsLessThan",e,r)||this}return LE(e,t),e}(yE),FE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),AE=function(t){function e(e,r){return t.call(this,"PropertyIsLessThanOrEqualTo",e,r)||this}return FE(e,t),e}(yE),kE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),jE=function(t){function e(e){var r=t.call(this,"Not")||this;return r.condition=e,r}return kE(e,t),e}(HS),NE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),DE=function(t){function e(e,r,n){return t.call(this,"PropertyIsNotEqualTo",e,r,n)||this}return NE(e,t),e}(yE),GE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),zE=function(t){function e(e){return t.call(this,"Or",Array.prototype.slice.call(arguments))||this}return GE(e,t),e}(JS),UE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),BE=function(t){function e(e){var r=t.call(this,"ResourceId")||this;return r.rid=e,r}return UE(e,t),e}(HS),VE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),YE=function(t){function e(e,r,n){return t.call(this,"Within",e,r,n)||this}return VE(e,t),e}(iE);function WE(t){var e=[null].concat(Array.prototype.slice.call(arguments));return new(Function.prototype.bind.apply(tE,e))}function qE(t,e,r){return new rE(t,e,r)}var XE=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ZE={"http://www.opengis.net/gml":{boundedBy:Fc(F_.prototype.readGeometryElement,"bounds")},"http://www.opengis.net/wfs/2.0":{member:Ic(F_.prototype.readFeaturesInternal)}},KE={"http://www.opengis.net/wfs":{totalInserted:Fc(G_),totalUpdated:Fc(G_),totalDeleted:Fc(G_)},"http://www.opengis.net/wfs/2.0":{totalInserted:Fc(G_),totalUpdated:Fc(G_),totalDeleted:Fc(G_)}},HE={"http://www.opengis.net/wfs":{TransactionSummary:Fc(sT,"transactionSummary"),InsertResults:Fc(hT,"insertIds")},"http://www.opengis.net/wfs/2.0":{TransactionSummary:Fc(sT,"transactionSummary"),InsertResults:Fc(hT,"insertIds")}},$E={"http://www.opengis.net/wfs":{PropertyName:Ac(X_)},"http://www.opengis.net/wfs/2.0":{PropertyName:Ac(X_)}},JE={"http://www.opengis.net/wfs":{Insert:Ac(pT),Update:Ac(yT),Delete:Ac(gT),Property:Ac(mT),Native:Ac(vT)},"http://www.opengis.net/wfs/2.0":{Insert:Ac(pT),Update:Ac(yT),Delete:Ac(gT),Property:Ac(mT),Native:Ac(vT)}},QE="http://www.w3.org/2000/xmlns/",tT={"2.0.0":"http://www.opengis.net/ogc/1.1","1.1.0":"http://www.opengis.net/ogc","1.0.0":"http://www.opengis.net/ogc"},eT={"2.0.0":"http://www.opengis.net/wfs/2.0","1.1.0":"http://www.opengis.net/wfs","1.0.0":"http://www.opengis.net/wfs"},rT={"2.0.0":"http://www.opengis.net/fes/2.0","1.1.0":"http://www.opengis.net/fes","1.0.0":"http://www.opengis.net/fes"},nT={"2.0.0":"http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd","1.1.0":"http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd","1.0.0":"http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/wfs.xsd"},iT={"2.0.0":ab,"1.1.0":eb,"1.0.0":$_},oT=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.version_=n.version?n.version:"1.1.0",r.featureType_=n.featureType,r.featureNS_=n.featureNS,r.gmlFormat_=n.gmlFormat?n.gmlFormat:new iT[r.version_],r.schemaLocation_=n.schemaLocation?n.schemaLocation:nT[r.version_],r}return XE(e,t),e.prototype.getFeatureType=function(){return this.featureType_},e.prototype.setFeatureType=function(t){this.featureType_=t},e.prototype.readFeaturesFromNode=function(t,e){var r={node:t};O(r,{featureType:this.featureType_,featureNS:this.featureNS_}),O(r,this.getReadOptions(t,e||{}));var n=[r],i=Uc([],"2.0.0"===this.version_?ZE:this.gmlFormat_.FEATURE_COLLECTION_PARSERS,t,n,this.gmlFormat_);return i||(i=[]),i},e.prototype.readTransactionResponse=function(t){if(t){if("string"==typeof t){var e=Pc(t);return this.readTransactionResponseFromDocument(e)}return Cc(t)?this.readTransactionResponseFromDocument(t):this.readTransactionResponseFromNode(t)}},e.prototype.readFeatureCollectionMetadata=function(t){if(t){if("string"==typeof t){var e=Pc(t);return this.readFeatureCollectionMetadataFromDocument(e)}return Cc(t)?this.readFeatureCollectionMetadataFromDocument(t):this.readFeatureCollectionMetadataFromNode(t)}},e.prototype.readFeatureCollectionMetadataFromDocument=function(t){for(var e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readFeatureCollectionMetadataFromNode(e)},e.prototype.readFeatureCollectionMetadataFromNode=function(t){var e={},r=z_(t.getAttribute("numberOfFeatures"));return e.numberOfFeatures=r,Uc(e,ZE,t,[],this.gmlFormat_)},e.prototype.readTransactionResponseFromDocument=function(t){for(var e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readTransactionResponseFromNode(e)},e.prototype.readTransactionResponseFromNode=function(t){return Uc({},HE,t,[])},e.prototype.writeGetFeature=function(t){var e=this,r=Sc(eT[this.version_],"GetFeature");r.setAttribute("service","WFS"),r.setAttribute("version",this.version_),t.handle&&r.setAttribute("handle",t.handle),t.outputFormat&&r.setAttribute("outputFormat",t.outputFormat),void 0!==t.maxFeatures&&r.setAttribute("maxFeatures",String(t.maxFeatures)),t.resultType&&r.setAttribute("resultType",t.resultType),void 0!==t.startIndex&&r.setAttribute("startIndex",String(t.startIndex)),void 0!==t.count&&r.setAttribute("count",String(t.count)),void 0!==t.viewParams&&r.setAttribute("viewParams",t.viewParams),r.setAttributeNS(wc,"xsi:schemaLocation",this.schemaLocation_);var n={node:r};if(O(n,{version:this.version_,srsName:t.srsName,featureNS:t.featureNS?t.featureNS:this.featureNS_,featurePrefix:t.featurePrefix,propertyNames:t.propertyNames?t.propertyNames:[]}),pt(Array.isArray(t.featureTypes),11),"string"==typeof t.featureTypes[0]){var i=t.filter;t.bbox&&(pt(t.geometryName,12),i=this.combineBboxAndFilter(t.geometryName,t.bbox,t.srsName,i)),O(n,{geometryName:t.geometryName,filter:i}),jT(r,t.featureTypes,[n])}else t.featureTypes.forEach((function(i){var o=e.combineBboxAndFilter(i.geometryName,i.bbox,t.srsName,t.filter);O(n,{geometryName:i.geometryName,filter:o}),jT(r,[i.name],[n])}));return r},e.prototype.combineBboxAndFilter=function(t,e,r,n){var i=qE(t,e,r);return n?WE(n,i):i},e.prototype.writeTransaction=function(t,e,r,n){var i,o=[],a=n.version?n.version:this.version_,s=Sc(eT[a],"Transaction");s.setAttribute("service","WFS"),s.setAttribute("version",a),n&&(i=n.gmlOptions?n.gmlOptions:{},n.handle&&s.setAttribute("handle",n.handle)),s.setAttributeNS(wc,"xsi:schemaLocation",nT[a]);var l=function(t,e,r,n){var i,o=n.featurePrefix?n.featurePrefix:"feature";"1.0.0"===r?i=2:"1.1.0"===r?i=3:"2.0.0"===r&&(i=3.2);return O({node:t},{version:r,featureNS:n.featureNS,featureType:n.featureType,featurePrefix:o,gmlVersion:i,hasZ:n.hasZ,srsName:n.srsName},e)}(s,i,a,n);return t&&aT("Insert",t,o,l),e&&aT("Update",e,o,l),r&&aT("Delete",r,o,l),n.nativeElements&&aT("Native",n.nativeElements,o,l),s},e.prototype.readProjectionFromDocument=function(t){for(var e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readProjectionFromNode(e);return null},e.prototype.readProjectionFromNode=function(t){if(t.firstElementChild&&t.firstElementChild.firstElementChild)for(var e=(t=t.firstElementChild.firstElementChild).firstElementChild;e;e=e.nextElementSibling)if(0!==e.childNodes.length&&(1!==e.childNodes.length||3!==e.firstChild.nodeType)){var r=[{}];return this.gmlFormat_.readGeometryElement(e,r),Gr(r.pop().srsName)}return null},e}(P_);function aT(t,e,r,n){Vc(n,JE,jc(t),e,r)}function sT(t,e){return Uc({},KE,t,e)}var lT={"http://www.opengis.net/ogc":{FeatureId:Ic((function(t,e){return t.getAttribute("fid")}))},"http://www.opengis.net/ogc/1.1":{FeatureId:Ic((function(t,e){return t.getAttribute("fid")}))}};function uT(t,e){zc(lT,t,e)}var cT={"http://www.opengis.net/wfs":{Feature:uT},"http://www.opengis.net/wfs/2.0":{Feature:uT}};function hT(t,e){return Uc([],cT,t,e)}function pT(t,e,r){var n=r[r.length-1],i=n.featureType,o=n.featureNS,a=n.gmlVersion,s=Sc(o,i);t.appendChild(s),2===a?$_.prototype.writeFeatureElement(s,e,r):3===a?eb.prototype.writeFeatureElement(s,e,r):ab.prototype.writeFeatureElement(s,e,r)}function fT(t,e,r){var n=r[r.length-1].version,i=tT[n],o=Sc(i,"Filter"),a=Sc(i,"FeatureId");o.appendChild(a),a.setAttribute("fid",e),t.appendChild(o)}function dT(t,e){var r=(t=t||"feature")+":";return 0===e.indexOf(r)?e:r+e}function gT(t,e,r){var n=r[r.length-1];pt(void 0!==e.getId(),26);var i=n.featureType,o=n.featurePrefix,a=n.featureNS,s=dT(o,i);t.setAttribute("typeName",s),t.setAttributeNS(QE,"xmlns:"+o,a);var l=e.getId();void 0!==l&&fT(t,l,r)}function yT(t,e,r){var n=r[r.length-1];pt(void 0!==e.getId(),27);var i=n.version,o=n.featureType,a=n.featurePrefix,s=n.featureNS,l=dT(a,o),u=e.getGeometryName();t.setAttribute("typeName",l),t.setAttributeNS(QE,"xmlns:"+a,s);var c=e.getId();if(void 0!==c){for(var h=e.getKeys(),p=[],f=0,d=h.length;f="a"&&t<="z"||t>="A"&&t<="Z"},t.prototype.isNumeric_=function(t,e){return t>="0"&&t<="9"||"."==t&&!(void 0!==e&&e)},t.prototype.isWhiteSpace_=function(t){return" "==t||"\t"==t||"\r"==t||"\n"==t},t.prototype.nextChar_=function(){return this.wkt.charAt(++this.index_)},t.prototype.nextToken=function(){var t,e=this.nextChar_(),r=this.index_,n=e;if("("==e)t=BT;else if(","==e)t=WT;else if(")"==e)t=VT;else if(this.isNumeric_(e)||"-"==e)t=YT,n=this.readNumber_();else if(this.isAlpha_(e))t=UT,n=this.readText_();else{if(this.isWhiteSpace_(e))return this.nextToken();if(""!==e)throw new Error("Unexpected character: "+e);t=qT}return{position:r,value:n,type:t}},t.prototype.readNumber_=function(){var t,e=this.index_,r=!1,n=!1;do{"."==t?r=!0:"e"!=t&&"E"!=t||(n=!0),t=this.nextChar_()}while(this.isNumeric_(t,r)||!n&&("e"==t||"E"==t)||n&&("-"==t||"+"==t));return parseFloat(this.wkt.substring(e,this.index_--))},t.prototype.readText_=function(){var t,e=this.index_;do{t=this.nextChar_()}while(this.isAlpha_(t));return this.wkt.substring(e,this.index_--).toUpperCase()},t}(),HT=function(){function t(t){this.lexer_=t,this.token_,this.layout_=yt}return t.prototype.consume_=function(){this.token_=this.lexer_.nextToken()},t.prototype.isTokenType=function(t){return this.token_.type==t},t.prototype.match=function(t){var e=this.isTokenType(t);return e&&this.consume_(),e},t.prototype.parse=function(){return this.consume_(),this.parseGeometry_()},t.prototype.parseGeometryLayout_=function(){var t=yt,e=this.token_;if(this.isTokenType(UT)){var r=e.value;"Z"===r?t=mt:"M"===r?t=vt:"ZM"===r&&(t=_t),t!==yt&&this.consume_()}return t},t.prototype.parseGeometryCollectionText_=function(){if(this.match(BT)){var t=[];do{t.push(this.parseGeometry_())}while(this.match(WT));if(this.match(VT))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parsePointText_=function(){if(this.match(BT)){var t=this.parsePoint_();if(this.match(VT))return t}else if(this.isEmptyGeometry_())return null;throw new Error(this.formatErrorMessage_())},t.prototype.parseLineStringText_=function(){if(this.match(BT)){var t=this.parsePointList_();if(this.match(VT))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parsePolygonText_=function(){if(this.match(BT)){var t=this.parseLineStringTextList_();if(this.match(VT))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parseMultiPointText_=function(){if(this.match(BT)){var t=void 0;if(t=this.token_.type==BT?this.parsePointTextList_():this.parsePointList_(),this.match(VT))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parseMultiLineStringText_=function(){if(this.match(BT)){var t=this.parseLineStringTextList_();if(this.match(VT))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parseMultiPolygonText_=function(){if(this.match(BT)){var t=this.parsePolygonTextList_();if(this.match(VT))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())},t.prototype.parsePoint_=function(){for(var t=[],e=this.layout_.length,r=0;r0&&(e+=" "+n)}return 0===r.length?e+" EMPTY":e+"("+r+")"}var nC=$T,iC=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),oC=[null,"http://www.opengis.net/wms"],aC=Gc(oC,{Service:Fc((function(t,e){return Uc({},uC,t,e)})),Capability:Fc((function(t,e){return Uc({},sC,t,e)}))}),sC=Gc(oC,{Request:Fc((function(t,e){return Uc({},mC,t,e)})),Exception:Fc((function(t,e){return Uc([],fC,t,e)})),Layer:Fc((function(t,e){var r=Uc({},dC,t,e);if(void 0===r.Layer)return Object.assign(r,EC(t,e));return r}))}),lC=function(t){function e(){var e=t.call(this)||this;return e.version=void 0,e}return iC(e,t),e.prototype.readFromNode=function(t){this.version=t.getAttribute("version").trim();var e=Uc({version:this.version},aC,t,[]);return e||null},e}(cS),uC=Gc(oC,{Name:Fc(U_),Title:Fc(U_),Abstract:Fc(U_),KeywordList:Fc(PC),OnlineResource:Fc(hS),ContactInformation:Fc((function(t,e){return Uc({},cC,t,e)})),Fees:Fc(U_),AccessConstraints:Fc(U_),LayerLimit:Fc(G_),MaxWidth:Fc(G_),MaxHeight:Fc(G_)}),cC=Gc(oC,{ContactPersonPrimary:Fc((function(t,e){return Uc({},hC,t,e)})),ContactPosition:Fc(U_),ContactAddress:Fc((function(t,e){return Uc({},pC,t,e)})),ContactVoiceTelephone:Fc(U_),ContactFacsimileTelephone:Fc(U_),ContactElectronicMailAddress:Fc(U_)}),hC=Gc(oC,{ContactPerson:Fc(U_),ContactOrganization:Fc(U_)}),pC=Gc(oC,{AddressType:Fc(U_),Address:Fc(U_),City:Fc(U_),StateOrProvince:Fc(U_),PostCode:Fc(U_),Country:Fc(U_)}),fC=Gc(oC,{Format:Ic(U_)}),dC=Gc(oC,{Name:Fc(U_),Title:Fc(U_),Abstract:Fc(U_),KeywordList:Fc(PC),CRS:Mc(U_),EX_GeographicBoundingBox:Fc((function(t,e){var r=Uc({},yC,t,e);if(!r)return;var n=r.westBoundLongitude,i=r.southBoundLatitude,o=r.eastBoundLongitude,a=r.northBoundLatitude;if(void 0===n||void 0===i||void 0===o||void 0===a)return;return[n,i,o,a]})),BoundingBox:Mc((function(t,e){var r=[D_(t.getAttribute("minx")),D_(t.getAttribute("miny")),D_(t.getAttribute("maxx")),D_(t.getAttribute("maxy"))],n=[D_(t.getAttribute("resx")),D_(t.getAttribute("resy"))];return{crs:t.getAttribute("CRS"),extent:r,res:n}})),Dimension:Mc((function(t,e){return{name:t.getAttribute("name"),units:t.getAttribute("units"),unitSymbol:t.getAttribute("unitSymbol"),default:t.getAttribute("default"),multipleValues:k_(t.getAttribute("multipleValues")),nearestValue:k_(t.getAttribute("nearestValue")),current:k_(t.getAttribute("current")),values:U_(t)}})),Attribution:Fc((function(t,e){return Uc({},gC,t,e)})),AuthorityURL:Mc((function(t,e){var r=TC(t,e);if(r)return r.name=t.getAttribute("name"),r;return})),Identifier:Mc(U_),MetadataURL:Mc((function(t,e){var r=TC(t,e);if(r)return r.type=t.getAttribute("type"),r;return})),DataURL:Mc(TC),FeatureListURL:Mc(TC),Style:Mc((function(t,e){return Uc({},xC,t,e)})),MinScaleDenominator:Fc(N_),MaxScaleDenominator:Fc(N_),Layer:Mc(EC)}),gC=Gc(oC,{Title:Fc(U_),OnlineResource:Fc(hS),LogoURL:Fc(OC)}),yC=Gc(oC,{westBoundLongitude:Fc(N_),eastBoundLongitude:Fc(N_),southBoundLatitude:Fc(N_),northBoundLatitude:Fc(N_)}),mC=Gc(oC,{GetCapabilities:Fc(CC),GetMap:Fc(CC),GetFeatureInfo:Fc(CC)}),vC=Gc(oC,{Format:Mc(U_),DCPType:Mc((function(t,e){return Uc({},_C,t,e)}))}),_C=Gc(oC,{HTTP:Fc((function(t,e){return Uc({},bC,t,e)}))}),bC=Gc(oC,{Get:Fc(TC),Post:Fc(TC)}),xC=Gc(oC,{Name:Fc(U_),Title:Fc(U_),Abstract:Fc(U_),LegendURL:Mc(OC),StyleSheetURL:Fc(TC),StyleURL:Fc(TC)}),wC=Gc(oC,{Format:Fc(U_),OnlineResource:Fc(hS)}),SC=Gc(oC,{Keyword:Ic(U_)});function EC(t,e){var r=e[e.length-1],n=Uc({},dC,t,e);if(n){var i=k_(t.getAttribute("queryable"));void 0===i&&(i=r.queryable),n.queryable=void 0!==i&&i;var o=z_(t.getAttribute("cascaded"));void 0===o&&(o=r.cascaded),n.cascaded=o;var a=k_(t.getAttribute("opaque"));void 0===a&&(a=r.opaque),n.opaque=void 0!==a&&a;var s=k_(t.getAttribute("noSubsets"));void 0===s&&(s=r.noSubsets),n.noSubsets=void 0!==s&&s;var l=D_(t.getAttribute("fixedWidth"));l||(l=r.fixedWidth),n.fixedWidth=l;var u=D_(t.getAttribute("fixedHeight"));u||(u=r.fixedHeight),n.fixedHeight=u;["Style","CRS","AuthorityURL"].forEach((function(t){if(t in r){var e=n[t]||[];n[t]=e.concat(r[t])}}));return["EX_GeographicBoundingBox","BoundingBox","Dimension","Attribution","MinScaleDenominator","MaxScaleDenominator"].forEach((function(t){if(!(t in n)){var e=r[t];n[t]=e}})),n}}function TC(t,e){return Uc({},wC,t,e)}function CC(t,e){return Uc({},vC,t,e)}function OC(t,e){var r=TC(t,e);if(r){var n=[z_(t.getAttribute("width")),z_(t.getAttribute("height"))];return r.size=n,r}}function PC(t,e){return Uc([],SC,t,e)}var RC=lC,IC=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),LC=function(t){function e(e){var r=t.call(this)||this,n=e||{};return r.featureNS_="http://mapserver.gis.umn.edu/mapserver",r.gmlFormat_=new $_,r.layers_=n.layers?n.layers:null,r}return IC(e,t),e.prototype.getLayers=function(){return this.layers_},e.prototype.setLayers=function(t){this.layers_=t},e.prototype.readFeatures_=function(t,e){t.setAttribute("namespaceURI",this.featureNS_);var r=t.localName,n=[];if(0===t.childNodes.length)return n;if("msGMLOutput"==r)for(var i=0,o=t.childNodes.length;i.75*c||u>.75*h?this.resetExtent_():te(o,n)||this.recenter_()}}},e.prototype.resetExtent_=function(){var t=this.getMap(),e=this.ovmap_,r=t.getSize(),n=t.getView().calculateExtentInternal(r),i=e.getView(),o=Math.log(7.5)/Math.LN2;Me(n,1/(.1*Math.pow(2,o/2))),i.fitInternal(gi(n))},e.prototype.recenter_=function(){var t=this.getMap(),e=this.ovmap_,r=t.getView();e.getView().setCenterInternal(r.getCenterInternal())},e.prototype.updateBox_=function(){var t=this.getMap(),e=this.ovmap_;if(t.isRendered()&&e.isRendered()){var r=t.getSize(),n=t.getView(),i=e.getView(),o=this.rotateWithView_?0:-n.getRotation(),a=this.boxOverlay_,s=this.boxOverlay_.getElement(),l=n.getCenterInternal(),u=n.getResolution(),c=i.getResolution(),h=r[0]*u/c,p=r[1]*u/c;if(a.setPosition(l),s){s.style.width=h+"px",s.style.height=p+"px";var f="rotate("+o+"rad)";s.style.transform=f}}},e.prototype.handleClick_=function(t){t.preventDefault(),this.handleToggle_()},e.prototype.handleToggle_=function(){this.element.classList.toggle("ol-collapsed"),this.collapsed_?po(this.collapseLabel_,this.label_):po(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_;var t=this.ovmap_;if(!this.collapsed_){if(t.isRendered())return this.viewExtent_=void 0,void t.render();t.updateSize(),this.resetExtent_(),K(t,qa,(function(t){this.updateBox_()}),this)}},e.prototype.getCollapsible=function(){return this.collapsible_},e.prototype.setCollapsible=function(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),!t&&this.collapsed_&&this.handleToggle_())},e.prototype.setCollapsed=function(t){this.collapsible_&&this.collapsed_!==t&&this.handleToggle_()},e.prototype.getCollapsed=function(){return this.collapsed_},e.prototype.getRotateWithView=function(){return this.rotateWithView_},e.prototype.setRotateWithView=function(t){this.rotateWithView_!==t&&(this.rotateWithView_=t,0!==this.getMap().getView().getRotation()&&(this.rotateWithView_?this.handleRotationChanged_():this.ovmap_.getView().setRotation(0),this.viewExtent_=void 0,this.validateExtent_(),this.updateBox_()))},e.prototype.getOverviewMap=function(){return this.ovmap_},e.prototype.render=function(t){this.validateExtent_(),this.updateBox_()},e}(As),lO=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),uO="degrees",cO="imperial",hO="nautical",pO="metric",fO="us",dO=[1,2,5],gO=function(t){function e(e){var r=this,n=e||{},i=void 0!==n.className?n.className:n.bar?"ol-scale-bar":"ol-scale-line";return(r=t.call(this,{element:document.createElement("div"),render:n.render,target:n.target})||this).innerElement_=document.createElement("div"),r.innerElement_.className=i+"-inner",r.element.className=i+" ol-unselectable",r.element.appendChild(r.innerElement_),r.viewState_=null,r.minWidth_=void 0!==n.minWidth?n.minWidth:64,r.renderedVisible_=!1,r.renderedWidth_=void 0,r.renderedHTML_="",r.addEventListener(it("units"),r.handleUnitsChanged_),r.setUnits(n.units||pO),r.scaleBar_=n.bar||!1,r.scaleBarSteps_=n.steps||4,r.scaleBarText_=n.text||!1,r.dpi_=n.dpi||void 0,r}return lO(e,t),e.prototype.getUnits=function(){return this.get("units")},e.prototype.handleUnitsChanged_=function(){this.updateElement_()},e.prototype.setUnits=function(t){this.set("units",t)},e.prototype.setDpi=function(t){this.dpi_=t},e.prototype.updateElement_=function(){var t=this.viewState_;if(t){var e=t.center,r=t.projection,n=this.getUnits(),i=n==uO?St.DEGREES:St.METERS,o=zr(r,t.resolution,e,i),a=this.minWidth_*(this.dpi_||25.4/.28)/(25.4/.28),s=a*o,l="";if(n==uO){var u=wt[St.DEGREES];(s*=u)=a)break;++d}f=this.scaleBar_?this.createScaleBar(h,c,l):c.toFixed(p<0?-p:0)+" "+l,this.renderedHTML_!=f&&(this.innerElement_.innerHTML=f,this.renderedHTML_=f),this.renderedWidth_!=h&&(this.innerElement_.style.width=h+"px",this.renderedWidth_=h),this.renderedVisible_||(this.element.style.display="",this.renderedVisible_=!0)}else this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1)},e.prototype.createScaleBar=function(t,e,r){for(var n="1 : "+Math.round(this.getScaleForResolution()).toLocaleString(),i=[],o=t/this.scaleBarSteps_,a="#ffffff",s=0;s
    '+this.createMarker("relative",s)+(s%2==0||2===this.scaleBarSteps_?this.createStepText(s,t,!1,e,r):"")+""),s===this.scaleBarSteps_-1&&i.push(this.createStepText(s+1,t,!0,e,r)),a="#ffffff"===a?"#000000":"#ffffff";return'
    '+(this.scaleBarText_?'
    '+n+"
    ":"")+i.join("")+"
    "},e.prototype.createMarker=function(t,e){return'
    '},e.prototype.createStepText=function(t,e,r,n,i){var o=(0===t?0:Math.round(n/this.scaleBarSteps_*t*100)/100)+(0===t?"":" "+i);return'
    '+o+"
    "},e.prototype.getScaleForResolution=function(){var t=zr(this.viewState_.projection,this.viewState_.resolution,this.viewState_.center),e=this.dpi_||25.4/.28,r=this.viewState_.projection.getMetersPerUnit();return parseFloat(t.toString())*r*(1e3/25.4)*e},e.prototype.render=function(t){var e=t.frameState;this.viewState_=e?e.viewState:null,this.updateElement_()},e}(As),yO=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),mO=0,vO=1,_O=function(t){function e(e){var r=this,n=e||{};(r=t.call(this,{element:document.createElement("div"),render:n.render})||this).dragListenerKeys_=[],r.currentResolution_=void 0,r.direction_=mO,r.dragging_,r.heightLimit_=0,r.widthLimit_=0,r.startX_,r.startY_,r.thumbSize_=null,r.sliderInitialized_=!1,r.duration_=void 0!==n.duration?n.duration:200;var i=void 0!==n.className?n.className:"ol-zoomslider",o=document.createElement("button");o.setAttribute("type","button"),o.className=i+"-thumb ol-unselectable";var a=r.element;return a.className=i+" ol-unselectable ol-control",a.appendChild(o),a.addEventListener(Ua,r.handleDraggerStart_.bind(r),!1),a.addEventListener(za,r.handleDraggerDrag_.bind(r),!1),a.addEventListener(Ba,r.handleDraggerEnd_.bind(r),!1),a.addEventListener(N,r.handleContainerClick_.bind(r),!1),o.addEventListener(N,u,!1),r}return yO(e,t),e.prototype.setMap=function(e){t.prototype.setMap.call(this,e),e&&e.render()},e.prototype.initSlider_=function(){var t=this.element,e=t.offsetWidth,r=t.offsetHeight;if(0===e&&0===r)return this.sliderInitialized_=!1;var n=t.firstElementChild,i=getComputedStyle(n),o=n.offsetWidth+parseFloat(i.marginRight)+parseFloat(i.marginLeft),a=n.offsetHeight+parseFloat(i.marginTop)+parseFloat(i.marginBottom);return this.thumbSize_=[o,a],e>r?(this.direction_=vO,this.widthLimit_=e-o):(this.direction_=mO,this.heightLimit_=r-a),this.sliderInitialized_=!0},e.prototype.handleContainerClick_=function(t){var e=this.getMap().getView(),r=this.getRelativePosition_(t.offsetX-this.thumbSize_[0]/2,t.offsetY-this.thumbSize_[1]/2),n=this.getResolutionForPosition_(r),i=e.getConstrainedZoom(e.getZoomForResolution(n));e.animateInternal({zoom:i,duration:this.duration_,easing:io})},e.prototype.handleDraggerStart_=function(t){if(!this.dragging_&&t.target===this.element.firstElementChild){var e=this.element.firstElementChild;if(this.getMap().getView().beginInteraction(),this.startX_=t.clientX-parseFloat(e.style.left),this.startY_=t.clientY-parseFloat(e.style.top),this.dragging_=!0,0===this.dragListenerKeys_.length){var r=this.handleDraggerDrag_,n=this.handleDraggerEnd_,i=this.getMap().getOwnerDocument();this.dragListenerKeys_.push(Z(i,za,r,this),Z(i,Ba,n,this))}}},e.prototype.handleDraggerDrag_=function(t){if(this.dragging_){var e=t.clientX-this.startX_,r=t.clientY-this.startY_,n=this.getRelativePosition_(e,r);this.currentResolution_=this.getResolutionForPosition_(n),this.getMap().getView().setResolution(this.currentResolution_)}},e.prototype.handleDraggerEnd_=function(t){this.dragging_&&(this.getMap().getView().endInteraction(),this.dragging_=!1,this.startX_=void 0,this.startY_=void 0,this.dragListenerKeys_.forEach(H),this.dragListenerKeys_.length=0)},e.prototype.setThumbPosition_=function(t){var e=this.getPositionForResolution_(t),r=this.element.firstElementChild;this.direction_==vO?r.style.left=this.widthLimit_*e+"px":r.style.top=this.heightLimit_*e+"px"},e.prototype.getRelativePosition_=function(t,e){return Ne(this.direction_===vO?t/this.widthLimit_:e/this.heightLimit_,0,1)},e.prototype.getResolutionForPosition_=function(t){return this.getMap().getView().getResolutionForValueFunction()(1-t)},e.prototype.getPositionForResolution_=function(t){return Ne(1-this.getMap().getView().getValueForResolutionFunction()(t),0,1)},e.prototype.render=function(t){if(t.frameState&&(this.sliderInitialized_||this.initSlider_())){var e=t.frameState.viewState.resolution;this.currentResolution_=e,this.setThumbPosition_(e)}},e}(As),bO=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),xO=function(t){function e(e){var r=this,n=e||{};(r=t.call(this,{element:document.createElement("div"),target:n.target})||this).extent=n.extent?n.extent:null;var i=void 0!==n.className?n.className:"ol-zoom-extent",o=void 0!==n.label?n.label:"E",a=void 0!==n.tipLabel?n.tipLabel:"Fit to extent",s=document.createElement("button");s.setAttribute("type","button"),s.title=a,s.appendChild("string"==typeof o?document.createTextNode(o):o),s.addEventListener(N,r.handleClick_.bind(r),!1);var l=i+" ol-unselectable ol-control",u=r.element;return u.className=l,u.appendChild(s),r}return bO(e,t),e.prototype.handleClick_=function(t){t.preventDefault(),this.handleZoomToExtent()},e.prototype.handleZoomToExtent=function(){var t=this.getMap().getView(),e=this.extent?this.extent:t.getProjection().getExtent();t.fitInternal(gi(e))},e}(As),wO={};wO.AssertionError=l||{},wO.Collection=ht||{},wO.Collection.CollectionEvent=ct||{},wO.Disposable=p||{},wO.Feature=gt||{},wO.Feature.createStyleFunction=dt||{},wO.Geolocation=Ii||{},wO.Image=Ki||{},wO.Image.listenImage=Zi||{},wO.ImageBase=Mi||{},wO.ImageCanvas=$i||{},wO.ImageTile=vo||{},wO.Kinetic=_o||{},wO.Map=Wl||{},wO.MapBrowserEvent=Da||{},wO.MapBrowserEventHandler=Wa||{},wO.MapEvent=ja||{},wO.Object=ot||{},wO.Object.ObjectEvent=et||{},wO.Object.getChangeEventType=it||{},wO.Observable=Q||{},wO.Observable.unByKey=J||{},wO.Overlay=su||{},wO.PluggableMap=Ms||{},wO.Tile=lo||{},wO.TileCache=yu||{},wO.TileQueue=es||{},wO.TileQueue.getTilePriority=rs||{},wO.TileRange=_u||{},wO.TileRange.createOrUpdate=vu||{},wO.VectorRenderTile=wu||{},wO.VectorTile=Eu||{},wO.View=Cs||{},wO.View.createCenterConstraint=xs||{},wO.View.createResolutionConstraint=ws||{},wO.View.createRotationConstraint=Ss||{},wO.View.isNoopAnimation=Es||{},wO.array={},wO.array.binarySearch=f||{},wO.array.equals=b||{},wO.array.extend=v||{},wO.array.find=_||{},wO.array.findIndex=x||{},wO.array.includes=g||{},wO.array.isSorted=w||{},wO.array.linearFindNearest=y||{},wO.array.numberSafeCompareFunction=d||{},wO.array.remove=function(t,e){var r=t.indexOf(e),n=r>-1;return n&&t.splice(r,1),n}||{},wO.array.reverseSubArray=m||{},wO.array.stableSort=function(t,e){var r,n=t.length,i=Array(t.length);for(r=0;r3&&!!zn(t,e,r,n)}||{},wO.geom.flat.transform={},wO.geom.flat.transform.rotate=un||{},wO.geom.flat.transform.scale=cn||{},wO.geom.flat.transform.transform2D=ln||{},wO.geom.flat.transform.translate=hn||{},wO.has={},wO.has.DEVICE_PIXEL_RATIO=Vi||{},wO.has.FIREFOX=Gi||{},wO.has.IMAGE_DECODE=Wi||{},wO.has.MAC=Bi||{},wO.has.PASSIVE_EVENT_LISTENERS=qi||{},wO.has.SAFARI=zi||{},wO.has.WEBKIT=Ui||{},wO.has.WORKER_OFFSCREEN_CANVAS=Yi||{},wO.interaction={},wO.interaction.DoubleClickZoom=Zs||{},wO.interaction.DragAndDrop=Ev||{},wO.interaction.DragAndDrop.DragAndDropEvent=Sv||{},wO.interaction.DragBox=El||{},wO.interaction.DragBox.DragBoxEvent=Sl||{},wO.interaction.DragPan=fl||{},wO.interaction.DragRotate=gl||{},wO.interaction.DragRotateAndZoom=Cv||{},wO.interaction.DragZoom=Cl||{},wO.interaction.Draw=Gv||{},wO.interaction.Draw.DrawEvent=Dv||{},wO.interaction.Draw.createBox=function(){return function(t,e,r){var n=Kt([t[0],t[t.length-1]].map((function(t){return rn(t,r)}))),i=[[_e(n),be(n),Oe(n),Ce(n),_e(n)]],o=e;o?o.setCoordinates(i):o=new fi(i);var a=tn();return a&&o.transform(r,a),o}}||{},wO.interaction.Draw.createRegularPolygon=function(t,e){return function(r,n,i){var o=rn(r[0],i),a=rn(r[r.length-1],i),s=Math.sqrt(Rr(o,a)),l=n||yi(new Rv(o),t),u=e;if(!e&&0!==e){var c=a[0]-o[0],h=a[1]-o[1];u=Math.atan2(h,c)}mi(l,o,s,u);var p=tn();return p&&l.transform(i,p),l}}||{},wO.interaction.Extent=qv||{},wO.interaction.Extent.ExtentEvent=Bv||{},wO.interaction.Interaction=qs||{},wO.interaction.Interaction.pan=Ys||{},wO.interaction.Interaction.zoomByDelta=Ws||{},wO.interaction.KeyboardPan=Ml||{},wO.interaction.KeyboardZoom=Al||{},wO.interaction.Modify=r_||{},wO.interaction.Modify.ModifyEvent=Jv||{},wO.interaction.MouseWheelZoom=Dl||{},wO.interaction.PinchRotate=zl||{},wO.interaction.PinchZoom=Bl||{},wO.interaction.Pointer=$s||{},wO.interaction.Pointer.centroid=Hs||{},wO.interaction.Select=s_||{},wO.interaction.Select.SelectEvent=o_||{},wO.interaction.Snap=h_||{},wO.interaction.Translate=m_||{},wO.interaction.Translate.TranslateEvent=y_||{},wO.interaction.defaults=Vl||{},wO.layer={},wO.layer.Base=Wo||{},wO.layer.BaseImage=ad||{},wO.layer.BaseTile=vd||{},wO.layer.BaseVector=wg||{},wO.layer.Graticule=Ny||{},wO.layer.Group=Aa||{},wO.layer.Heatmap=Vy||{},wO.layer.Image=dd||{},wO.layer.Layer=na||{},wO.layer.Layer.inView=ra||{},wO.layer.MapboxVector=yv||{},wO.layer.MapboxVector.getMapboxPath=uv||{},wO.layer.MapboxVector.normalizeGlyphsUrl=hv||{},wO.layer.MapboxVector.normalizeSourceUrl=fv||{},wO.layer.MapboxVector.normalizeSpriteUrl=cv||{},wO.layer.MapboxVector.normalizeStyleUrl=pv||{},wO.layer.Tile=Sd||{},wO.layer.Vector=Iy||{},wO.layer.VectorImage=vv||{},wO.layer.VectorTile=lm||{},wO.layer.WebGLPoints=bv||{},wO.loadingstrategy={},wO.loadingstrategy.all=Fu||{},wO.loadingstrategy.bbox=function(t,e){return[t]}||{},wO.loadingstrategy.tile=function(t){return function(e,r){var n=t.getZForResolution(r),i=t.getTileRangeForExtentAndZ(e,n),o=[],a=[n,0,0];for(a[1]=i.minX;a[1]<=i.maxX;++a[1])for(a[2]=i.minY;a[2]<=i.maxY;++a[2])o.push(t.getTileCoordExtent(a));return o}}||{},wO.math={},wO.math.clamp=Ne||{},wO.math.cosh=De||{},wO.math.lerp=qe||{},wO.math.log2=Ge||{},wO.math.modulo=We||{},wO.math.solveLinearSystem=Be||{},wO.math.squaredDistance=Ue||{},wO.math.squaredSegmentDistance=ze||{},wO.math.toDegrees=Ve||{},wO.math.toRadians=Ye||{},wO.net={},wO.net.jsonp=Au||{},wO.obj={},wO.obj.assign=O||{},wO.obj.clear=P||{},wO.obj.getValues=R||{},wO.obj.isEmpty=I||{},wO.proj={},wO.proj.Projection=je||{},wO.proj.Units=St||{},wO.proj.Units.METERS_PER_UNIT=wt||{},wO.proj.addCommon=sn||{},wO.proj.addCoordinateTransforms=Wr||{},wO.proj.addEquivalentProjections=Ur||{},wO.proj.addEquivalentTransforms=Br||{},wO.proj.addProjection=Nr||{},wO.proj.addProjections=Dr||{},wO.proj.clearAllProjections=function(){lr(),pr()}||{},wO.proj.clearUserProjection=function(){Jr=null}||{},wO.proj.cloneTransform=kr||{},wO.proj.createProjection=Vr||{},wO.proj.createSafeCoordinateTransform=an||{},wO.proj.createTransformFromCoordinateTransform=Yr||{},wO.proj.epsg3857={},wO.proj.epsg3857.EXTENT=Ke||{},wO.proj.epsg3857.HALF_SIZE=Ze||{},wO.proj.epsg3857.MAX_SAFE_Y=$e||{},wO.proj.epsg3857.PROJECTIONS=Qe||{},wO.proj.epsg3857.RADIUS=6378137,wO.proj.epsg3857.WORLD_EXTENT=He||{},wO.proj.epsg3857.fromEPSG4326=tr||{},wO.proj.epsg3857.toEPSG4326=er||{},wO.proj.epsg4326={},wO.proj.epsg4326.EXTENT=nr||{},wO.proj.epsg4326.METERS_PER_UNIT=ir||{},wO.proj.epsg4326.PROJECTIONS=ar||{},wO.proj.epsg4326.RADIUS=6378137,wO.proj.equivalent=Xr||{},wO.proj.fromLonLat=qr||{},wO.proj.fromUserCoordinate=rn||{},wO.proj.fromUserExtent=on||{},wO.proj.get=Gr||{},wO.proj.getPointResolution=zr||{},wO.proj.getTransform=Kr||{},wO.proj.getTransformFromProjections=Zr||{},wO.proj.getUserProjection=tn||{},wO.proj.identityTransform=jr||{},wO.proj.proj4={},wO.proj.proj4.register=function(t){var e,r,n=Object.keys(t.defs),i=n.length;for(e=0;e180)&&(r[0]=We(n+180,360)-180),r}||{},wO.proj.toUserCoordinate=en||{},wO.proj.toUserExtent=nn||{},wO.proj.transform=Hr||{},wO.proj.transformExtent=$r||{},wO.proj.transformWithProjections=function(t,e,r){return Zr(e,r)(t)}||{},wO.proj.transforms={},wO.proj.transforms.add=fr||{},wO.proj.transforms.clear=pr||{},wO.proj.transforms.get=dr||{},wO.proj.transforms.remove=function(t,e){var r=t.getCode(),n=e.getCode(),i=hr[r][n];return delete hr[r][n],I(hr[r])&&delete hr[r],i}||{},wO.proj.useGeographic=function(){Qr("EPSG:4326")}||{},wO.render={},wO.render.Box=ml||{},wO.render.Event=la||{},wO.render.Feature=Cy||{},wO.render.VectorContext=ku||{},wO.render.canvas={},wO.render.canvas.Builder=Mg||{},wO.render.canvas.BuilderGroup=Yg||{},wO.render.canvas.Executor=ey||{},wO.render.canvas.ExecutorGroup=ay||{},wO.render.canvas.ExecutorGroup.getPixelIndexArray=oy||{},wO.render.canvas.ImageBuilder=Ag||{},wO.render.canvas.Immediate=Nu||{},wO.render.canvas.Instruction=Ig||{},wO.render.canvas.Instruction.beginPathInstruction=Pg||{},wO.render.canvas.Instruction.closePathInstruction=Rg||{},wO.render.canvas.Instruction.fillInstruction=Cg||{},wO.render.canvas.Instruction.strokeInstruction=Og||{},wO.render.canvas.LineStringBuilder=jg||{},wO.render.canvas.PolygonBuilder=Dg||{},wO.render.canvas.TextBuilder=Bg||{},wO.render.canvas.checkedFonts=da||{},wO.render.canvas.createTransformString=Ra||{},wO.render.canvas.defaultFillStyle="#000",wO.render.canvas.defaultFont="10px sans-serif",wO.render.canvas.defaultLineCap="round",wO.render.canvas.defaultLineDash=pa||{},wO.render.canvas.defaultLineDashOffset={},wO.render.canvas.defaultLineJoin="round",wO.render.canvas.defaultLineWidth=1,wO.render.canvas.defaultMiterLimit=10,wO.render.canvas.defaultPadding=fa||{},wO.render.canvas.defaultStrokeStyle="#000",wO.render.canvas.defaultTextAlign="center",wO.render.canvas.defaultTextBaseline="middle",wO.render.canvas.drawImageOrLabel=Oa||{},wO.render.canvas.hitdetect={},wO.render.canvas.hitdetect.createHitDetectionImageData=sy||{},wO.render.canvas.hitdetect.hitDetect=ly||{},wO.render.canvas.labelCache=ga||{},wO.render.canvas.measureAndCacheTextWidth=Ea||{},wO.render.canvas.measureTextHeight=xa||{},wO.render.canvas.measureTextWidth=Sa||{},wO.render.canvas.measureTextWidths=Ta||{},wO.render.canvas.registerFont=ba||{},wO.render.canvas.rotateAtOffset=Ca||{},wO.render.canvas.textHeights=_a||{},wO.render.getRenderPixel=function(t,e){var r=e.slice(0);return It(t.inversePixelTransform.slice(),r),r}||{},wO.render.getVectorContext=Ku||{},wO.render.toContext=function(t,e){var r=t.canvas,n=e||{},i=n.pixelRatio||Vi,o=n.size;o&&(r.width=o[0]*i,r.height=o[1]*i,r.style.width=o[0]+"px",r.style.height=o[1]+"px");var a=[0,0,r.width,r.height],s=Mt([1,0,0,1,0,0],i,i);return new Nu(t,i,a,s,0)}||{},wO.renderer={},wO.renderer.Composite=La||{},wO.renderer.Layer=ld||{},wO.renderer.Map=aa||{},wO.renderer.canvas={},wO.renderer.canvas.ImageLayer=pd||{},wO.renderer.canvas.Layer=cd||{},wO.renderer.canvas.TileLayer=xd||{},wO.renderer.canvas.VectorImageLayer=py||{},wO.renderer.canvas.VectorLayer=cy||{},wO.renderer.canvas.VectorTileLayer=_y||{},wO.renderer.vector={},wO.renderer.vector.defaultOrder=Wu||{},wO.renderer.vector.getSquaredTolerance=qu||{},wO.renderer.vector.getTolerance=Xu||{},wO.renderer.vector.renderFeature=Zu||{},wO.renderer.webgl={},wO.renderer.webgl.Layer=_g||{},wO.renderer.webgl.Layer.colorDecodeId=vg||{},wO.renderer.webgl.Layer.colorEncodeId=mg||{},wO.renderer.webgl.Layer.getBlankImageData=function(){var t=document.createElement("canvas").getContext("2d").createImageData(1,1);return t.data[0]=255,t.data[1]=255,t.data[2]=255,t.data[3]=255,t}||{},wO.renderer.webgl.Layer.writePointFeatureToBuffers=function(t,e,r,n,i,o){var a=3+i,s=t[e+0],l=t[e+1],u=dg;u.length=i;for(var c=0;c1?x(r.TileMatrixSetLink,"projection"in e?function(t,r,n){var o=_(i,(function(e){return e.Identifier==t.TileMatrixSet})).SupportedCRS,a=Gr(o),s=Gr(e.projection);return a&&s?Xr(a,s):o==e.projection}:function(t,r,n){return t.TileMatrixSet==e.matrixSet}):0)<0&&(n=0);var o=r.TileMatrixSetLink[n].TileMatrixSet,a=r.TileMatrixSetLink[n].TileMatrixSetLimits,s=r.Format[0];"format"in e&&(s=e.format),(n=x(r.Style,(function(t,r,n){return"style"in e?t.Title==e.style:t.isDefault})))<0&&(n=0);var l=r.Style[n].Identifier,u={};"Dimension"in r&&r.Dimension.forEach((function(t,e,r){var n=t.Identifier,i=t.Default;void 0===i&&(i=t.Value[0]),u[n]=i}));var c,h=_(t.Contents.TileMatrixSet,(function(t,e,r){return t.Identifier==o})),p=h.SupportedCRS;if(p&&(c=Gr(p)),"projection"in e){var f=Gr(e.projection);f&&(c&&!Xr(f,c)||(c=f))}var d="ne"==c.getAxisOrientation().substr(0,2),y=h.TileMatrix[0],m={MinTileCol:0,MinTileRow:0,MaxTileCol:y.MatrixWidth-1,MaxTileRow:y.MatrixHeight-1};if(a){m=a[a.length-1];var v=_(h.TileMatrix,(function(t){return t.Identifier===m.TileMatrix||h.Identifier+":"+t.Identifier===m.TileMatrix}));v&&(y=v)}var b=28e-5*y.ScaleDenominator/c.getMetersPerUnit(),w=d?[y.TopLeftCorner[1],y.TopLeftCorner[0]]:y.TopLeftCorner,S=y.TileWidth*b,E=y.TileHeight*b,T=[w[0]+S*m.MinTileCol,w[1]-E*(1+m.MaxTileRow),w[0]+S*(1+m.MaxTileCol),w[1]-E*m.MinTileRow];null===c.getExtent()&&c.setExtent(T);var C=Kh(h,T,a),O=[],P=e.requestEncoding;if(P=void 0!==P?P:"","OperationsMetadata"in t&&"GetTile"in t.OperationsMetadata)for(var R=t.OperationsMetadata.GetTile.DCP.HTTP.Get,I=0,L=R.length;I