From 80ba471f4e4c18776f3331e11d6abddf5b1da639 Mon Sep 17 00:00:00 2001
From: Peter Rushforth <peter.rushforth@gmail.com>
Date: Thu, 16 Dec 2021 22:44:31 -0500
Subject: [PATCH 1/4] Update dist to pre-integrate work from
 https://github.com/Maps4HTML/Web-Map-Custom-Element/pull/596 Hopefully won't
 mess up history too badly, should get overwritten when that PR is merged.

---
 dist/mapml-viewer.js |   1 +
 dist/mapml.js        | 255 +++++++++++++++++++++++++++++++++++--------
 dist/mapml.min.js    |   2 +-
 dist/web-map.js      |   2 +
 4 files changed, 213 insertions(+), 47 deletions(-)

diff --git a/dist/mapml-viewer.js b/dist/mapml-viewer.js
index 6df2915..965fcf0 100644
--- a/dist/mapml-viewer.js
+++ b/dist/mapml-viewer.js
@@ -199,6 +199,7 @@ export class MapViewer extends HTMLElement {
             query: true,
             contextMenu: true,
             announceMovement: M.options.announceMovement,
+            featureIndex: true,
             mapEl: this,
             crs: M[this.projection],
             zoom: this.zoom,
diff --git a/dist/mapml.js b/dist/mapml.js
index cefe4ff..f7399c4 100644
--- a/dist/mapml.js
+++ b/dist/mapml.js
@@ -341,6 +341,7 @@
           L.DomUtil.remove(this._container);
         }
         L.FeatureGroup.prototype.onRemove.call(this, map);
+        this._map.featureIndex.cleanIndex();
       },
 
       getEvents: function(){
@@ -432,6 +433,8 @@
 
       _resetFeatures : function (zoom){
         this.clearLayers();
+        // since features are removed and re-added by zoom level, need to clean the feature index before re-adding
+        if(this._map) this._map.featureIndex.cleanIndex();
         if(this._features && this._features[zoom]){
           for(let k =0;k < this._features[zoom].length;k++){
             this.addLayer(this._features[zoom][k]);
@@ -3044,9 +3047,9 @@
         mapFocusButton.type = "button";
         mapFocusButton.title = "Focus Map";
         mapFocusButton.innerHTML = "<span aria-hidden='true'>|&#10094;</span>";
-        L.DomEvent.disableClickPropagation(mapFocusButton);
-        L.DomEvent.on(mapFocusButton, 'click', L.DomEvent.stop);
         L.DomEvent.on(mapFocusButton, 'click', (e)=>{
+          L.DomEvent.stop(e);
+          map.featureIndex._sortIndex();
           map.closePopup();
           map._container.focus();
         }, popup);
@@ -3056,8 +3059,6 @@
         previousButton.type = "button";
         previousButton.title = "Previous Feature";
         previousButton.innerHTML = "<span aria-hidden='true'>&#10094;</span>";
-        L.DomEvent.disableClickPropagation(previousButton);
-        L.DomEvent.on(previousButton, 'click', L.DomEvent.stop);
         L.DomEvent.on(previousButton, 'click', layer._previousFeature, popup);
 
         // static feature counter that 1/1
@@ -3070,8 +3071,6 @@
         nextButton.type = "button";
         nextButton.title = "Next Feature";
         nextButton.innerHTML = "<span aria-hidden='true'>&#10095;</span>";
-        L.DomEvent.disableClickPropagation(nextButton);
-        L.DomEvent.on(nextButton, 'click', L.DomEvent.stop);
         L.DomEvent.on(nextButton, 'click', layer._nextFeature, popup);
         
         // creates >| button, focuses map controls
@@ -3079,9 +3078,12 @@
         controlFocusButton.type = "button";
         controlFocusButton.title = "Focus Controls";
         controlFocusButton.innerHTML = "<span aria-hidden='true'>&#10095;|</span>";
-        L.DomEvent.disableClickPropagation(controlFocusButton);
-        L.DomEvent.on(controlFocusButton, 'click', L.DomEvent.stop);
         L.DomEvent.on(controlFocusButton, 'click', (e) => {
+          map.featureIndex._sortIndex();
+          map.featureIndex.currentIndex = map.featureIndex.inBoundFeatures.length - 1;
+          map.featureIndex.inBoundFeatures[0].path.setAttribute("tabindex", -1);
+          map.featureIndex.inBoundFeatures[map.featureIndex.currentIndex].path.setAttribute("tabindex", 0);
+          L.DomEvent.stop(e);
           map.closePopup();
           map._controlContainer.querySelector("A").focus();
         }, popup);
@@ -3108,9 +3110,11 @@
           let isTab = focusEvent.originalEvent.keyCode === 9,
               shiftPressed = focusEvent.originalEvent.shiftKey;
           if((path[0].classList.contains("leaflet-popup-close-button") && isTab && !shiftPressed) || focusEvent.originalEvent.keyCode === 27){
-            L.DomEvent.stop(focusEvent);
-            map.closePopup(popup);
-            group.focus();
+            setTimeout(() => {
+              L.DomEvent.stop(focusEvent);
+              map.closePopup(popup);
+              group.focus();
+            }, 0);
           } else if ((path[0].title==="Focus Map" || path[0].classList.contains("mapml-popup-content")) && isTab && shiftPressed){
             setTimeout(() => { //timeout needed so focus of the feature is done even after the keypressup event occurs
               L.DomEvent.stop(focusEvent);
@@ -4962,6 +4966,7 @@
       return false;
     },
 
+    // TODO: should be merged with the 'mapfocused' event emitted by mapml-viewer and map, not trivial
     _isMapFocused: function (e) {
       //set this._map.isFocused = true if arrow buttons are used
       if(!this._map._container.parentNode.activeElement){
@@ -4973,6 +4978,7 @@
         this._map.isFocused = false;
       } else this._map.isFocused = isLeafletContainer && ["keyup", "keydown"].includes(e.type);
 
+      if(this._map.isFocused) this._map.fire("mapkeyboardfocused");
       this._addOrRemoveMapOutline();
       this._addOrRemoveCrosshair();
     },
@@ -5270,13 +5276,19 @@
         this._coordinateToArrays(span, main, subParts, false, span.getAttribute("class"), parents.concat([span]));
       }
       let noSpan = coords.textContent.replace(/(<([^>]+)>)/ig, ''),
-          pairs = noSpan.match(/(\S+\s+\S+)/gim), local = [];
+          pairs = noSpan.match(/(\S+\s+\S+)/gim), local = [], bounds;
       for (let p of pairs) {
         let numPair = [];
         p.split(/\s+/gim).forEach(M.parseNumber, numPair);
         let point = M.pointToPCRSPoint(L.point(numPair), this.options.zoom, this.options.projection, this.options.nativeCS);
         local.push(point);
-        this._bounds = this._bounds ? this._bounds.extend(point) : L.bounds(point, point);
+        bounds = bounds ? bounds.extend(point) : L.bounds(point, point);
+      }
+      if (this._bounds) {
+        this._bounds.extend(bounds.min);
+        this._bounds.extend(bounds.max);
+      } else {
+        this._bounds = bounds;
       }
       if (isFirst) {
         main.push({ points: local });
@@ -5289,6 +5301,7 @@
         }
         subParts.unshift({
           points: local,
+          center: bounds.getCenter(),
           cls: `${cls || ""} ${wrapperAttr.className || ""}`.trim(),
           attr: attrMap,
           link: wrapperAttr.link,
@@ -5325,6 +5338,10 @@
       if (!this._bounds) return null;
       return this._map.options.crs.unproject(this._bounds.getCenter());
     },
+
+    getPCRSCenter: function () {
+      return this._bounds.getCenter();
+    },
   });
 
   /**
@@ -5343,8 +5360,6 @@
    * @returns {*}
    */
   var FeatureRenderer = L.SVG.extend({
-    
-
     /**
      * Override method of same name from L.SVG, use the this._container property
      * to set up the role="none presentation" on featureGroupu container,
@@ -5387,9 +5402,6 @@
         if (p.subrings) {
           for (let r of p.subrings) {
             this._createPath(r, layer.options.className, r.attr['aria-label'], (r.link !== undefined), r.attr);
-            if(r.attr && r.attr.tabindex){
-              p.path.setAttribute('tabindex', r.attr.tabindex || '0');
-            }
           }
         }
         this._updateStyle(layer);
@@ -5416,7 +5428,7 @@
         if (title) p.setAttribute('aria-label', title);
       } else {
         for(let [name, value] of Object.entries(attr)){
-          if(name === "id") continue;
+          if(name === "id" || name === "tabindex") continue;
           p.setAttribute(name, value);
         }
       }
@@ -5642,7 +5654,6 @@
       L.LayerGroup.prototype.initialize.call(this, layers, options);
 
       if((this.options.onEachFeature && this.options.properties) || this.options.link) {
-        this.options.group.setAttribute('tabindex', '0');
         L.DomUtil.addClass(this.options.group, "leaflet-interactive");
         L.DomEvent.on(this.options.group, "keyup keydown mousedown", this._handleFocus, this);
         let firstLayer = layers[Object.keys(layers)[0]];
@@ -5662,12 +5673,59 @@
       if(this.options.featureID) this.options.group.setAttribute("data-fid", this.options.featureID);
     },
 
+    onAdd: function (map) {
+      L.LayerGroup.prototype.onAdd.call(this, map);
+      this.updateInteraction();
+    },
+
+    updateInteraction: function () {
+      let map = this._map || this.options._leafletLayer._map;
+      if((this.options.onEachFeature && this.options.properties) || this.options.link)
+        map.featureIndex.addToIndex(this, this.getPCRSCenter(), this.options.group);
+
+      for (let layerID in this._layers) {
+        let layer = this._layers[layerID];
+        for(let part of layer._parts){
+          if(layer.featureAttributes && layer.featureAttributes.tabindex)
+            map.featureIndex.addToIndex(layer, layer.getPCRSCenter(), part.path);
+          for(let subPart of part.subrings) {
+            if(subPart.attr && subPart.attr.tabindex) map.featureIndex.addToIndex(layer, subPart.center, subPart.path);
+          }
+        }
+      }
+    },
+
     /**
      * Handler for focus events
      * @param {L.DOMEvent} e - Event that occurred
      * @private
      */
     _handleFocus: function(e) {
+      if((e.keyCode === 9 || e.keyCode === 16) && e.type === "keydown"){
+        let index = this._map.featureIndex.currentIndex;
+        if(e.keyCode === 9 && e.shiftKey) {
+          if(index === this._map.featureIndex.inBoundFeatures.length - 1)
+            this._map.featureIndex.inBoundFeatures[index].path.setAttribute("tabindex", -1);
+          if(index !== 0){
+            L.DomEvent.stop(e);
+            this._map.featureIndex.inBoundFeatures[index - 1].path.focus();
+            this._map.featureIndex.currentIndex--;
+          }
+        } else if (e.keyCode === 9) {
+          if(index !== this._map.featureIndex.inBoundFeatures.length - 1) {
+            L.DomEvent.stop(e);
+            this._map.featureIndex.inBoundFeatures[index + 1].path.focus();
+            this._map.featureIndex.currentIndex++;
+          } else {
+            this._map.featureIndex.inBoundFeatures[0].path.setAttribute("tabindex", -1);
+            this._map.featureIndex.inBoundFeatures[index].path.setAttribute("tabindex", 0);
+          }
+        }
+      } else if (!(e.keyCode === 9 || e.keyCode === 16 || e.keyCode === 13)){
+        this._map.featureIndex.currentIndex = 0;
+        this._map.featureIndex.inBoundFeatures[0].path.focus();
+      }
+
       if(e.target.tagName.toUpperCase() !== "G") return;
       if((e.keyCode === 9 || e.keyCode === 16 || e.keyCode === 13) && e.type === "keyup") {
         this.openTooltip();
@@ -5699,22 +5757,10 @@
      * @private
      */
     _previousFeature: function(e){
-      let group = this._source.group.previousSibling;
-      if(!group){
-        let currentIndex = this._source.group.closest("div.mapml-layer").style.zIndex;
-        let overlays = this._map.getPane("overlayPane").children;
-        for(let i = overlays.length - 1; i >= 0; i--){
-          let layer = overlays[i];
-          if(layer.style.zIndex >= currentIndex) continue;
-          group = layer.querySelector("g.leaflet-interactive");
-          if(group){
-            group = group.parentNode.lastChild;
-            break;
-          }
-        }
-        if (!group) group = this._source.group;
-      }
-      group.focus();
+      L.DomEvent.stop(e);
+      this._map.featureIndex.currentIndex = Math.max(this._map.featureIndex.currentIndex - 1, 0);
+      let prevFocus = this._map.featureIndex.inBoundFeatures[this._map.featureIndex.currentIndex];
+      prevFocus.path.focus();
       this._map.closePopup();
     },
 
@@ -5724,19 +5770,24 @@
      * @private
      */
     _nextFeature: function(e){
-      let group = this._source.group.nextSibling;
-      if(!group){
-        let currentIndex = this._source.group.closest("div.mapml-layer").style.zIndex;
+      L.DomEvent.stop(e);
+      this._map.featureIndex.currentIndex = Math.min(this._map.featureIndex.currentIndex + 1, this._map.featureIndex.inBoundFeatures.length - 1);
+      let nextFocus = this._map.featureIndex.inBoundFeatures[this._map.featureIndex.currentIndex];
+      nextFocus.path.focus();
+      this._map.closePopup();
+    },
 
-        for(let layer of this._map.getPane("overlayPane").children){
-          if(layer.style.zIndex <= currentIndex) continue;
-          group = layer.querySelectorAll("g.leaflet-interactive");
-          if(group.length > 0)break;
+    getPCRSCenter: function () {
+      let bounds;
+      for(let l in this._layers){
+        let layer = this._layers[l];
+        if (!bounds) {
+          bounds = L.bounds(layer.getPCRSCenter(), layer.getPCRSCenter());
+        } else {
+          bounds.extend(layer.getPCRSCenter());
         }
-        group = group && group.length > 0 ? group[0] : this._source.group;
       }
-      group.focus();
-      this._map.closePopup();
+      return bounds.getCenter();
     },
   });
 
@@ -5881,6 +5932,116 @@
 
   });
 
+  var FeatureIndex = L.Handler.extend({
+    initialize: function (map) {
+      L.Handler.prototype.initialize.call(this, map);
+      this.inBoundFeatures = [];
+      this.outBoundFeatures = [];
+      this.currentIndex = 0;
+      this._mapPCRSBounds = M.pixelToPCRSBounds(
+        map.getPixelBounds(),
+        map.getZoom(),
+        map.options.projection);
+    },
+
+    addHooks: function () {
+      this._map.on("mapkeyboardfocused", this._updateMapBounds, this);
+      this._map.on('mapkeyboardfocused', this._sortIndex, this);
+    },
+
+    removeHooks: function () {
+      this._map.off("mapkeyboardfocused", this._updateMapBounds);
+      this._map.off('mapkeyboardfocused', this._sortIndex);
+    },
+
+    /**
+     * Adds a svg element to the index of tabbable features, it also keeps track of the layer it's associated + center
+     * @param layer - the layer object the feature is associated with
+     * @param lc - the layer center
+     * @param path - the svg element that needs to be focused, can be a path or g
+     */
+    addToIndex: function (layer, lc, path) {
+      let mc = this._mapPCRSBounds.getCenter();
+      let dist = Math.sqrt(Math.pow(lc.x - mc.x, 2) + Math.pow(lc.y - mc.y, 2));
+      let index = this._mapPCRSBounds.contains(lc) ? this.inBoundFeatures : this.outBoundFeatures;
+
+      let elem = {path: path, layer: layer, center: lc, dist: dist};
+      path.setAttribute("tabindex", -1);
+
+      index.push(elem);
+
+      // TODO: this insertion loop has potential to be improved slightly
+      for (let i = index.length - 1; i > 0 && index[i].dist < index[i-1].dist; i--) {
+        let tmp = index[i];
+        index[i] = index[i-1];
+        index[i-1] = tmp;
+      }
+
+      if (this._mapPCRSBounds.contains(lc))
+        this.inBoundFeatures = index;
+      else
+        this.outBoundFeatures = index;
+    },
+
+    /**
+     * Removes features that are no longer on the map, also moves features to the respective array depending
+     * on whether the feature is in the maps viewport or not
+     */
+    cleanIndex: function() {
+      this.currentIndex = 0;
+      this.inBoundFeatures = this.inBoundFeatures.filter((elem) => {
+        let inbound = this._mapPCRSBounds.contains(elem.center);
+        elem.path.setAttribute("tabindex", -1);
+        if (elem.layer._map && !inbound) {
+          this.outBoundFeatures.push(elem);
+        }
+        return elem.layer._map && inbound;
+      });
+      this.outBoundFeatures = this.outBoundFeatures.filter((elem) => {
+        let inbound = this._mapPCRSBounds.contains(elem.center);
+        elem.path.setAttribute("tabindex", -1);
+        if (elem.layer._map && inbound) {
+          this.inBoundFeatures.push(elem);
+        }
+        return elem.layer._map && !inbound;
+      });
+    },
+
+    /**
+     * Sorts the index of features in the map's viewport based on distance from center
+     * @private
+     */
+    _sortIndex: function() {
+      this.cleanIndex();
+      if(this.inBoundFeatures.length === 0) return;
+
+      let mc = this._mapPCRSBounds.getCenter();
+
+      this.inBoundFeatures.sort(function(a, b) {
+        let ac = a.center;
+        let bc = b.center;
+        a.dist = Math.sqrt(Math.pow(ac.x - mc.x, 2) + Math.pow(ac.y - mc.y, 2));
+        b.dist = Math.sqrt(Math.pow(bc.x - mc.x, 2) + Math.pow(bc.y - mc.y, 2));
+        return a.dist - b.dist;
+      });
+
+      this.inBoundFeatures[0].path.setAttribute("tabindex", 0);
+    },
+
+    /**
+     * Event handler for 'mapfocused' event to update the map's bounds in terms of PCRS
+     * @param e - the event object
+     * @private
+     */
+    _updateMapBounds: function (e) {
+      // TODO: map's PCRS bounds is used in other parts of the viewer, can be moved out to the map object directly
+      this._mapPCRSBounds = M.pixelToPCRSBounds(
+        this._map.getPixelBounds(),
+        this._map.getZoom(),
+        this._map.options.projection);
+    },
+  });
+
   var Options = {
     announceMovement: false,
     locale: {
@@ -6554,11 +6715,13 @@
   M.QueryHandler = QueryHandler;
   M.ContextMenu = ContextMenu;
   M.AnnounceMovement = AnnounceMovement;
+  M.FeatureIndex = FeatureIndex;
 
   // see https://leafletjs.com/examples/extending/extending-3-controls.html#handlers
   L.Map.addInitHook('addHandler', 'query', M.QueryHandler);
   L.Map.addInitHook('addHandler', 'contextMenu', M.ContextMenu);
   L.Map.addInitHook('addHandler', 'announceMovement', M.AnnounceMovement);
+  L.Map.addInitHook('addHandler', 'featureIndex', M.FeatureIndex);
 
   M.MapMLLayer = MapMLLayer;
   M.mapMLLayer = mapMLLayer;
diff --git a/dist/mapml.min.js b/dist/mapml.min.js
index 7d2b297..052dba3 100644
--- a/dist/mapml.min.js
+++ b/dist/mapml.min.js
@@ -1,3 +1,3 @@
 /*! @maps4html/web-map-custom-element 16-12-2021 */
 
-!function(){"use strict";var t=L.GridLayer.extend({initialize:function(t){this.zoomBounds=this._getZoomBounds(t.tileContainer,t.maxZoomBound),L.extend(t,this.zoomBounds),L.setOptions(this,t),this._groups=this._groupTiles(this.options.tileContainer.getElementsByTagName("map-tile"))},onAdd:function(){this._bounds=this._getLayerBounds(this._groups,this._map.options.projection),this.layerBounds=this._bounds[Object.keys(this._bounds)[0]];for(let t of Object.keys(this._bounds))this.layerBounds.extend(this._bounds[t].min),this.layerBounds.extend(this._bounds[t].max);L.GridLayer.prototype.onAdd.call(this,this._map),this._handleMoveEnd()},getEvents:function(){let t=L.GridLayer.prototype.getEvents.call(this,this._map);return this._parentOnMoveEnd=t.moveend,t.moveend=this._handleMoveEnd,t.move=(()=>{}),t},_handleMoveEnd:function(t){let e=this._map.getZoom(),i=e;i=(i=i>this.options.maxNativeZoom?this.options.maxNativeZoom:i)<this.options.minNativeZoom?this.options.minNativeZoom:i,this.isVisible=e<=this.zoomBounds.maxZoom&&e>=this.zoomBounds.minZoom&&this._bounds[i]&&this._bounds[i].overlaps(M.pixelToPCRSBounds(this._map.getPixelBounds(),this._map.getZoom(),this._map.options.projection)),this.isVisible&&this._parentOnMoveEnd()},_isValidTile(t){return this._groups[this._tileCoordsToKey(t)]},createTile:function(t){let e=this._groups[this._tileCoordsToKey(t)]||[],i=document.createElement("map-tile"),o=this.getTileSize();i.setAttribute("col",t.x),i.setAttribute("row",t.y),i.setAttribute("zoom",t.z);for(let t=0;t<e.length;t++){let n=document.createElement("img");n.width=o.x,n.height=o.y,n.alt="",n.setAttribute("role","presentation"),n.src=e[t].src,i.appendChild(n)}return i},_getLayerBounds:function(t,e){let i={},o=M[e].options.crs.tile.bounds.max.x;for(let e in t){let t=e.split(":"),n={};n.x=+t[0]*o,n.y=+t[1]*o,n.z=+t[2],t[2]in i?(i[t[2]].extend(L.point(n.x,n.y)),i[t[2]].extend(L.point(n.x+o,n.y+o))):i[t[2]]=L.bounds(L.point(n.x,n.y),L.point(n.x+o,n.y+o))}for(let t in i){let o=+t;i[t]=M.pixelToPCRSBounds(i[t],o,e)}return i},_getZoomBounds:function(t,e){if(!t)return null;let i=M.metaContentToObject(t.getElementsByTagName("map-tiles")[0].getAttribute("zoom")),o={},n=t.getElementsByTagName("map-tile");o.nativeZoom=+i.value||0,o.maxNativeZoom=0,o.minNativeZoom=e;for(let t=0;t<n.length;t++){let e=+n[t].getAttribute("zoom");n[t].getAttribute("zoom")||(e=o.nativeZoom),o.minNativeZoom=Math.min(o.minNativeZoom,e),o.maxNativeZoom=Math.max(o.maxNativeZoom,e)}return o.minZoom=o.minNativeZoom-2<=0?0:o.minNativeZoom-2,o.maxZoom=e,i.min&&(o.minZoom=+i.min<o.minNativeZoom-2?o.minNativeZoom-2:+i.min),i.max&&(o.maxZoom=+i.max),o},_groupTiles:function(t){let e={};for(let i=0;i<t.length;i++){let o={};o.row=+t[i].getAttribute("row"),o.col=+t[i].getAttribute("col"),o.zoom=+t[i].getAttribute("zoom")||this.options.nativeZoom,o.src=t[i].getAttribute("src");let n=o.col+":"+o.row+":"+o.zoom;n in e?e[n].push(o):e[n]=[o]}return e}}),e=function(e){return new t(e)},i=L.Control.Layers.extend({options:{autoZIndex:!1,sortLayers:!0,sortFunction:function(t,e){return t.options.zIndex<e.options.zIndex?-1:t.options.zIndex>e.options.zIndex?1:0}},initialize:function(t,e){for(var i in L.setOptions(this,e),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,t)this._addLayer(t[i],i,!0)},onAdd:function(){return this._initLayout(),this._map.on("validate",this._validateInput,this),L.DomEvent.on(this.options.mapEl,"layerchange",this._validateInput,this),L.DomEvent.on(this._container,"keydown",this._focusFirstLayer,this._container),this._update(),this._layers.length<1&&!this._map._showControls?this._container.setAttribute("hidden",""):this._map._showControls=!0,this._container},onRemove:function(t){t.off("validate",this._validateInput,this),L.DomEvent.off(this._container,"keydown",this._focusFirstLayer,this._container);for(var e=0;e<this._layers.length;e++)this._layers[e].layer.off("add remove",this._onLayerChange,this),this._layers[e].layer.off("extentload",this._validateInput,this)},addOrUpdateOverlay:function(t,e){for(var i=!1,o=0;o<this._layers.length;o++)if(this._layers[o].layer===t){i=!0,this._layers[o].name=e;break}return i||this.addOverlay(t,e),this._layers.length>0&&(this._container.removeAttribute("hidden"),this._map._showControls=!0),this._map?this._update():this},removeLayer:function(t){L.Control.Layers.prototype.removeLayer.call(this,t),0===this._layers.length&&this._container.setAttribute("hidden","")},_validateInput:function(t){for(let t=0;t<this._layers.length;t++){if(!this._layers[t].input.labels[0])continue;let e=this._layers[t].input.labels[0].getElementsByTagName("span"),i=this._layers[t].input.labels[0].getElementsByTagName("input");i[0].checked=this._layers[t].layer._layerEl.checked,this._layers[t].layer._layerEl.disabled&&this._layers[t].layer._layerEl.checked?(i[0].closest("fieldset").disabled=!0,e[0].style.fontStyle="italic"):(i[0].closest("fieldset").disabled=!1,e[0].style.fontStyle="normal")}},_focusFirstLayer:function(t){if("Enter"===t.key&&"leaflet-control-layers leaflet-control leaflet-control-layers-expanded"!=this.className){var e=this.children[1].children[2].children[0].children[0].children[0].children[0];e&&setTimeout(()=>e.focus(),0)}},_withinZoomBounds:function(t,e){return e.min<=t&&t<=e.max},_addItem:function(t){var e=t.layer.getLayerUserControlsHTML();return t.input=e.querySelector("input"),this._layerControlInputs.push(t.input),t.input.layerId=L.stamp(t.layer),L.DomEvent.on(t.input,"click",this._onInputClick,this),t.layer.on("extentload",this._validateInput,this),this._overlaysList.appendChild(e),e},collapse:function(t){return"SELECT"===t.target.tagName||t.relatedTarget&&t.relatedTarget.parentElement&&("mapml-contextmenu mapml-layer-menu"===t.relatedTarget.className||"mapml-contextmenu mapml-layer-menu"===t.relatedTarget.parentElement.className)||this._map&&"block"===this._map.contextMenu._layerMenu.style.display?this:(L.DomUtil.removeClass(this._container,"leaflet-control-layers-expanded"),this)}}),o=function(t,e){return new i(t,e)};const n="OSMTILE",a="mapmltemplatedtileplaceholder";var s=L.FeatureGroup.extend({initialize:function(t,e){if(L.setOptions(this,e),this.options.static&&(this._container=L.DomUtil.create("div","leaflet-layer",this.options.pane),L.DomUtil.addClass(this._container,"leaflet-pane mapml-vector-container"),L.setOptions(this.options.renderer,{pane:this._container})),this._layers={},this.options.query){this._mapmlFeatures=t,this.isVisible=!0;let e=this._getNativeVariables(t);this.options.nativeZoom=e.zoom,this.options.nativeCS=e.cs}if(t&&!this.options.query){let e=this._getNativeVariables(t);!t.querySelector("map-extent")&&t.querySelector("map-feature")&&this.options.static&&(this._features={},this._staticFeature=!0,this.isVisible=!0,this.zoomBounds=this._getZoomBounds(t,e.zoom),this.layerBounds=this._getLayerBounds(t),L.extend(this.options,this.zoomBounds)),this.addData(t,e.cs,e.zoom),this._staticFeature&&(this._resetFeatures(this._clampZoom(this.options._leafletLayer._map.getZoom())),this.options._leafletLayer._map._addZoomLimit(this))}},onAdd:function(t){L.FeatureGroup.prototype.onAdd.call(this,t),this._mapmlFeatures&&t.on("featurepagination",this.showPaginationFeature,this)},onRemove:function(t){this._mapmlFeatures&&(t.off("featurepagination",this.showPaginationFeature,this),delete this._mapmlFeatures,L.DomUtil.remove(this._container)),L.FeatureGroup.prototype.onRemove.call(this,t)},getEvents:function(){return this._staticFeature?{moveend:this._handleMoveEnd,zoomend:this._handleZoomEnd}:{moveend:this._removeCSS}},showPaginationFeature:function(t){if(this.options.query&&this._mapmlFeatures.querySelectorAll("map-feature")[t.i]){let e=this._mapmlFeatures.querySelectorAll("map-feature")[t.i];this.clearLayers(),this.addData(e,this.options.nativeCS,this.options.nativeZoom),t.popup._navigationBar.querySelector("p").innerText=t.i+1+"/"+this.options._leafletLayer._totalFeatureCount,t.popup._content.querySelector("iframe").setAttribute("sandbox","allow-same-origin allow-forms"),t.popup._content.querySelector("iframe").srcdoc=e.querySelector("map-properties").innerHTML}},_getNativeVariables:function(t){return{zoom:t.querySelector("map-meta[name=zoom]")&&+M.metaContentToObject(t.querySelector("map-meta[name=zoom]").getAttribute("content")).value||0,cs:t.querySelector("map-meta[name=cs]")&&M.metaContentToObject(t.querySelector("map-meta[name=cs]").getAttribute("content")).content||"GCRS"}},_handleMoveEnd:function(){let t=this._map.getZoom(),e=t<=this.zoomBounds.maxZoom&&t>=this.zoomBounds.minZoom;this.isVisible=e&&this._layers&&this.layerBounds&&this.layerBounds.overlaps(M.pixelToPCRSBounds(this._map.getPixelBounds(),t,this._map.options.projection)),this._removeCSS()},_handleZoomEnd:function(t){let e=this._map.getZoom();if(e>this.zoomBounds.maxZoom||e<this.zoomBounds.minZoom)return void this.clearLayers();let i=this._clampZoom(e);this._resetFeatures(i)},_getLayerBounds:function(t){if(!t)return null;let e="TILEMATRIX",i=t.querySelector("map-meta[name=projection]")&&M.metaContentToObject(t.querySelector("map-meta[name=projection]").getAttribute("content")).content.toUpperCase()||n;try{let o=t.querySelector("map-meta[name=extent]")&&M.metaContentToObject(t.querySelector("map-meta[name=extent]").getAttribute("content")),n=o.zoom||0,a=Object.keys(o);for(let t=0;t<a.length;t++)if(!a[t].includes("zoom")){e=M.axisToCS(a[t].split("-")[2]);break}let s=M.csToAxes(e);return M.boundsToPCRSBounds(L.bounds(L.point(+o[`top-left-${s[0]}`],+o[`top-left-${s[1]}`]),L.point(+o[`bottom-right-${s[0]}`],+o[`bottom-right-${s[1]}`])),n,i,e)}catch(t){return M.boundsToPCRSBounds(M[i].options.crs.tilematrix.bounds(0),0,i,e)}},_resetFeatures:function(t){if(this.clearLayers(),this._features&&this._features[t])for(let e=0;e<this._features[t].length;e++)this.addLayer(this._features[t][e])},_clampZoom:function(t){return t>this.zoomBounds.maxZoom||t<this.zoomBounds.minZoom?t:void 0!==this.zoomBounds.minNativeZoom&&t<this.zoomBounds.minNativeZoom?this.zoomBounds.minNativeZoom:void 0!==this.zoomBounds.maxNativeZoom&&this.zoomBounds.maxNativeZoom<t?this.zoomBounds.maxNativeZoom:t},_setZoomTransform:function(t,e){var i=this._map.getZoomScale(this._map.getZoom(),e),o=t.multiplyBy(i).subtract(this._map._getNewPixelOrigin(t,this._map.getZoom())).round();any3d?L.setTransform(this._layers[e],o,i):L.setPosition(this._layers[e],o)},_getZoomBounds:function(t,e){if(!t)return null;let i,o,a=100,s=0,r=t.getElementsByTagName("map-feature");for(let t=0;t<r.length;t++){let i=+r[t].getAttribute("zoom");r[t].getAttribute("zoom")||(i=e),s=Math.max(s,i),a=Math.min(a,i)}try{o=M.metaContentToObject(t.querySelector("map-meta[name=projection]").getAttribute("content")).content,i=M.metaContentToObject(t.querySelector("map-meta[name=zoom]").getAttribute("content"))}catch(t){return{minZoom:0,maxZoom:M[o||n].options.resolutions.length-1,minNativeZoom:a,maxNativeZoom:s}}return{minZoom:+i.min,maxZoom:+i.max,minNativeZoom:a,maxNativeZoom:s}},addData:function(t,e,i){var o,n,a,s=t.nodeType===Node.DOCUMENT_NODE||"LAYER-"===t.nodeName?t.getElementsByTagName("map-feature"):null;if(t.nodeType===Node.DOCUMENT_NODE?t.querySelector("map-link[rel=stylesheet],map-style"):null){var r=t.querySelector("map-base")&&t.querySelector("map-base").hasAttribute("href")?new URL(t.querySelector("map-base").getAttribute("href")).href:t.URL;M.parseStylesheetAsHTML(t,r,this._container)}if(s){for(o=0,n=s.length;o<n;o++){(a=s[o]).getElementsByTagName("map-geometry").length&&a.getElementsByTagName("map-coordinates").length&&this.addData(a,e,i)}return this}var l=this.options;if(l.filter&&!l.filter(t))return;t.classList.length&&(l.className=t.classList.value);let m=t.getAttribute("zoom")||i,u=t.querySelector("map-featurecaption");u=u?u.innerHTML:"Feature",t.querySelector("map-properties")&&(l.properties=document.createElement("div"),l.properties.classList.add("mapml-popup-content"),l.properties.insertAdjacentHTML("afterbegin",t.querySelector("map-properties").innerHTML));let p=this.geometryToLayer(t,l,e,+m,u);if(p){if(!p.options.color&&t.hasAttribute("class")&&(p.options.className=t.getAttribute("class")),p.defaultOptions=p.options,this.resetStyle(p),l.onEachFeature&&p.bindTooltip(u,{interactive:!0,sticky:!0}),this._staticFeature){let e=t.getAttribute("zoom")||i;return void(e in this._features?this._features[e].push(p):this._features[e]=[p])}return this.addLayer(p)}},resetStyle:function(t){var e=this.options.style;e&&(L.Util.extend(t.options,t.defaultOptions),this._setLayerStyle(t,e))},setStyle:function(t){this.eachLayer(function(e){this._setLayerStyle(e,t)},this)},_setLayerStyle:function(t,e){"function"==typeof e&&(e=e(t.feature)),t.setStyle&&t.setStyle(e)},_removeCSS:function(){let t=this._container.querySelectorAll("link[rel=stylesheet],style");for(let e=0;e<t.length;e++)this._container.removeChild(t[e])},geometryToLayer:function(t,e,i,o,n){let a="MAP-FEATURE"===t.tagName.toUpperCase()?t.getElementsByTagName("map-geometry")[0]:t,s=a.getAttribute("cs")||i,r=[],l=L.SVG.create("g"),m=Object.assign({},e);for(let e of a.querySelectorAll("map-polygon, map-linestring, map-multilinestring, map-point, map-multipoint"))r.push(M.feature(e,Object.assign(m,{nativeCS:s,nativeZoom:o,projection:this.options.projection,featureID:t.id,group:l,wrappers:this._getGeometryParents(e.parentElement),featureLayer:this,_leafletLayer:this.options._leafletLayer})));let u={group:l,featureID:t.id,accessibleTitle:n,onEachFeature:e.onEachFeature,properties:e.properties,_leafletLayer:this.options._leafletLayer},p=a.querySelector("map-multipolygon")||a.querySelector("map-geometrycollection");return p&&(u.wrappers=this._getGeometryParents(p.parentElement)),M.featureGroup(r,u)},_getGeometryParents:function(t,e=[]){return t&&"MAP-GEOMETRY"!==t.tagName.toUpperCase()?"MAP-MULTIPOLYGON"===t.tagName.toUpperCase()||"MAP-GEOMETRYCOLLECTION"===t.tagName.toUpperCase()?this._getGeometryParents(t.parentElement,e):this._getGeometryParents(t.parentElement,e.concat([t])):e}}),r=function(t,e){return new s(t,e)},l=L.TileLayer.extend({initialize:function(t,e){let i=M.extractInputBounds(t);this.zoomBounds=i.zoomBounds,this.layerBounds=i.bounds,this.isVisible=!0,L.extend(e,this.zoomBounds),e.tms=t.tms,L.setOptions(this,e),this._setUpTileTemplateVars(t),t.tile.subdomains&&L.setOptions(this,L.extend(this.options,{subdomains:t.tile.subdomains})),this._template=t,this._initContainer(),L.TileLayer.prototype.initialize.call(this,t.template,L.extend(e,{pane:this._container}))},onAdd:function(){this._map._addZoomLimit(this),L.TileLayer.prototype.onAdd.call(this,this._map),this._handleMoveEnd()},getEvents:function(){let t=L.TileLayer.prototype.getEvents.call(this,this._map);return this._parentOnMoveEnd=t.moveend,t.moveend=this._handleMoveEnd,t},_initContainer:function(){this._container||(this._container=L.DomUtil.create("div","leaflet-layer",this.options.pane),L.DomUtil.addClass(this._container,"mapml-templated-tile-container"),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity())},_handleMoveEnd:function(t){let e=this._map.getZoom(),i=M.pixelToPCRSBounds(this._map.getPixelBounds(),e,this._map.options.projection);this.isVisible=e<=this.options.maxZoom&&e>=this.options.minZoom&&this.layerBounds.overlaps(i),this.isVisible&&this._parentOnMoveEnd()},createTile:function(t){let e=document.createElement("DIV"),i=this.getTileSize();if(L.DomUtil.addClass(e,"mapml-tile-group"),L.DomUtil.addClass(e,"leaflet-tile"),this._template.linkEl.dispatchEvent(new CustomEvent("tileloadstart",{detail:{x:t.x,y:t.y,zoom:t.z,appendTile:t=>{e.appendChild(t)}}})),this._template.type.startsWith("image/")){let o=L.TileLayer.prototype.createTile.call(this,t,function(){});o.width=i.x,o.height=i.y,e.appendChild(o)}else this._url.includes(a)||this._fetchTile(t,e);return e},_mapmlTileReady:function(t){L.DomUtil.addClass(t,"leaflet-tile-loaded")},getPane:function(){return this.options.pane},_fetchTile:function(t,e){fetch(this.getTileUrl(t),{redirect:"follow"}).then(function(t){return t.status>=200&&t.status<300?Promise.resolve(t):(console.log("Looks like there was a problem. Status Code: "+t.status),Promise.reject(t))}).then(function(t){return t.text()}).then(t=>{return(new DOMParser).parseFromString(t,"application/xml")}).then(i=>{this._createFeatures(i,t,e),this._mapmlTileReady(e)}).catch(t=>{console.log("Error Creating Tile")})},_createFeatures:function(t,e,i){if(t.querySelector("map-link[rel=stylesheet],map-style")){let e=t.querySelector("map-base")&&t.querySelector("map-base").hasAttribute("href")?new URL(t.querySelector("map-base").getAttribute("href")).href:t.URL;M.parseStylesheetAsHTML(t,e,i)}let o=L.SVG.create("svg"),n=L.SVG.create("g"),a=this._map.options.crs.options.crs.tile.bounds.max.x,s=e.x*a,r=e.y*a,l=M.mapMlFeatures(t,{projection:this._map.options.projection,static:!1,interactive:!1});for(let t in l._layers)for(let i in l._layers[t]._layers){let o=l._layers[t]._layers[i];M.FeatureRenderer.prototype._initPath(o,!1),o._project(this._map,L.point([s,r]),e.z),M.FeatureRenderer.prototype._addPath(o,n,!1),M.FeatureRenderer.prototype._updateFeature(o)}o.setAttribute("width",a.toString()),o.setAttribute("height",a.toString()),o.appendChild(n),i.appendChild(o)},getTileUrl:function(t){if(t.z>=this._template.tilematrix.bounds.length||!this._template.tilematrix.bounds[t.z].contains(t))return"";var e={};for(var i in e[this._template.tilematrix.col.name]=t.x,e[this._template.tilematrix.row.name]=t.y,e[this._template.zoom.name]=this._getZoomForUrl(),e[this._template.pcrs.easting.left]=this._tileMatrixToPCRSPosition(t,"top-left").x,e[this._template.pcrs.easting.right]=this._tileMatrixToPCRSPosition(t,"top-right").x,e[this._template.pcrs.northing.top]=this._tileMatrixToPCRSPosition(t,"top-left").y,e[this._template.pcrs.northing.bottom]=this._tileMatrixToPCRSPosition(t,"bottom-left").y,e[this._template.tile.server]=this._getSubdomain(t),this._template.tile)["row","col","zoom","left","right","top","bottom"].indexOf(i)<0&&(e[i]=this._template.tile[i]);if(this._map&&!this._map.options.crs.infinite){let i=this._globalTileRange.max.y-t.y;this.options.tms&&(e[this._template.tilematrix.row.name]=i)}return e.r=this.options.detectRetina&&L.Browser.retina&&this.options.maxZoom>0?"@2x":"",L.Util.template(this._url,e)},_tileMatrixToPCRSPosition:function(t,e){var i=this._map.options.crs,o=this.getTileSize(),n=t.scaleBy(o),a=n.add(o),s=n.add(Math.floor(o/2)),r=i.transformation.untransform(n,i.scale(t.z)),l=i.transformation.untransform(a,i.scale(t.z)),m=i.transformation.untransform(s,i.scale(t.z)),u=null;switch(e){case"top-left":u=r;break;case"bottom-left":u=new L.Point(r.x,l.y);break;case"center-left":u=new L.Point(r.x,m.y);break;case"top-right":u=new L.Point(l.x,r.y);break;case"bottom-right":u=l;break;case"center-right":u=new L.Point(l.x,m.y);break;case"top-center":u=new L.Point(m.x,r.y);break;case"bottom-center":u=new L.Point(m.x,l.y);break;case"center":u=m}return u},_setUpTileTemplateVars:function(t){t.tile={};for(var e,i,o,n,a,s=t.values,r=this.options.crs.options,l=0;l<t.values.length;l++){var m=s[l].getAttribute("type"),u=s[l].getAttribute("units"),p=s[l].getAttribute("axis"),c=s[l].getAttribute("name"),h=s[l].getAttribute("position"),d="hidden"===m&&s[l].hasAttribute("shard"),_="map-select"===s[l].tagName.toLowerCase(),y=s[l].getAttribute("value"),g=s[l].getAttribute("min"),f=s[l].getAttribute("max");if("location"===m&&"tilematrix"===u)switch(p){case"column":a={name:c,min:r.crs.tilematrix.horizontal.min,max:r.crs.tilematrix.horizontal.max(r.resolutions.length-1)},isNaN(Number.parseFloat(g))||(a.min=Number.parseFloat(g)),isNaN(Number.parseFloat(f))||(a.max=Number.parseFloat(f));break;case"row":n={name:c,min:r.crs.tilematrix.vertical.min,max:r.crs.tilematrix.vertical.max(r.resolutions.length-1)},isNaN(Number.parseFloat(g))||(n.min=Number.parseFloat(g)),isNaN(Number.parseFloat(f))||(n.max=Number.parseFloat(f));break;case"longitude":case"easting":i||(i={min:r.crs.pcrs.horizontal.min,max:r.crs.pcrs.horizontal.max}),isNaN(Number.parseFloat(g))||(i.min=Number.parseFloat(g)),isNaN(Number.parseFloat(f))||(i.max=Number.parseFloat(f)),h&&(h.match(/.*?-left/i)?i.left=c:h.match(/.*?-right/i)&&(i.right=c));break;case"latitude":case"northing":o||(o={min:r.crs.pcrs.vertical.min,max:r.crs.pcrs.vertical.max}),isNaN(Number.parseFloat(g))||(o.min=Number.parseFloat(g)),isNaN(Number.parseFloat(f))||(o.max=Number.parseFloat(f)),h&&(h.match(/top-.*?/i)?o.top=c:h.match(/bottom-.*?/i)&&(o.bottom=c))}else if(m&&"zoom"===m.toLowerCase())e={name:c,min:0,max:r.resolutions.length,value:r.resolutions.length},!isNaN(Number.parseInt(y,10))&&Number.parseInt(y,10)>=e.min&&Number.parseInt(y,10)<=e.max?e.value=Number.parseInt(y,10):e.value=e.max,!isNaN(Number.parseInt(g,10))&&Number.parseInt(g,10)>=e.min&&Number.parseInt(g,10)<=e.max&&(e.min=Number.parseInt(g,10)),!isNaN(Number.parseInt(f,10))&&Number.parseInt(f,10)>=e.min&&Number.parseInt(f,10)<=e.max&&(e.max=Number.parseInt(f,10)),t.zoom=e;else if(d)t.tile.server=c,t.tile.subdomains=s[l].servers.slice();else if(_){const e=s[l].htmlselect;t.tile[c]=function(){return e.value}}else{const e=s[l];t.tile[c]=function(){return e.getAttribute("value")}}}var b=this.options.crs.transformation,x=this.options.crs.options.crs.tile.bounds.max.x,v=L.bind(this.options.crs.scale,this.options.crs),A=function(t,e){return b.transform(t,v(e)).divideBy(x).floor()};i&&o?(t.pcrs={},t.pcrs.bounds=L.bounds([i.min,o.min],[i.max,o.max]),t.pcrs.easting=i,t.pcrs.northing=o):a&&n&&!isNaN(e.value)?(t.pcrs||(t.pcrs={},t.pcrs.easting="",t.pcrs.northing=""),t.pcrs.bounds=M.boundsToPCRSBounds(L.bounds(L.point([a.min,n.min]),L.point([a.max,n.max])),e.value,this.options.crs,M.axisToCS("column")),t.tilematrix={},t.tilematrix.col=a,t.tilematrix.row=n):console.log("Unable to determine bounds for tile template: "+t.template),t.tilematrix||(t.tilematrix={},t.tilematrix.col={},t.tilematrix.row={}),t.tilematrix.bounds=[];for(var E=t.pcrs.bounds,C=t.zoom?t.zoom.min:0,S=t.zoom?t.zoom.max:r.resolutions.length,T=0;T<=S;T++)t.tilematrix.bounds[T]=T>=C?L.bounds(A(E.min,T),A(E.max,T)):L.bounds(L.point([-1,-1]),L.point([-1,-1]))}}),m=function(t,e){return new l(t,e)},u=L.Layer.extend({initialize:function(t,e){this._templates=t,L.setOptions(this,e),this._container=L.DomUtil.create("div","leaflet-layer",e.pane),L.DomUtil.addClass(this._container,"mapml-templatedlayer-container");for(var i=0;i<t.length;i++)if("tile"===t[i].rel)this._templates[i].layer=M.templatedTileLayer(t[i],L.Util.extend(e,{errorTileUrl:"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",zIndex:i,pane:this._container}));else if("image"===t[i].rel)this._templates[i].layer=M.templatedImageLayer(t[i],L.Util.extend(e,{zIndex:i,pane:this._container}));else if("features"===t[i].rel)this._templates[i].layer=M.templatedFeaturesLayer(t[i],L.Util.extend(e,{zIndex:i,pane:this._container}));else if("query"===t[i].rel){this.hasSetBoundsHandler=!0,this._queries||(this._queries=[]);let e=M.extractInputBounds(t[i]);t[i].layerBounds=e.bounds,t[i].zoomBounds=e.zoomBounds,this._queries.push(L.extend(t[i],this._setupQueryVars(t[i])))}},getEvents:function(){return{zoomstart:this._onZoomStart}},redraw:function(){this.closePopup();for(var t=0;t<this._templates.length;t++)"tile"!==this._templates[t].rel&&"image"!==this._templates[t].rel&&"features"!==this._templates[t].rel||this._templates[t].layer.redraw()},_onZoomStart:function(){this.closePopup()},_setupQueryVars:function(t){for(var e={query:{}},i=t.values,o=0;o<t.values.length;o++){var n=i[o].getAttribute("type"),a=i[o].getAttribute("units"),s=i[o].getAttribute("axis"),r=i[o].getAttribute("name"),l=i[o].getAttribute("position"),m=i[o].getAttribute("rel"),u="map-select"===i[o].tagName.toLowerCase();if("width"===n)e.query.width=r;else if("height"===n)e.query.height=r;else if("location"===n)switch(s){case"x":case"y":case"column":case"row":e.query[s]=r;break;case"longitude":case"easting":l?l.match(/.*?-left/i)?"pixel"===m?e.query.pixelleft=r:"tile"===m?e.query.tileleft=r:e.query.mapleft=r:l.match(/.*?-right/i)&&("pixel"===m?e.query.pixelright=r:"tile"===m?e.query.tileright=r:e.query.mapright=r):e.query[s]=r;break;case"latitude":case"northing":l?l.match(/top-.*?/i)?"pixel"===m?e.query.pixeltop=r:"tile"===m?e.query.tiletop=r:e.query.maptop=r:l.match(/bottom-.*?/i)&&("pixel"===m?e.query.pixelbottom=r:"tile"===m?e.query.tilebottom=r:e.query.mapbottom=r):e.query[s]=r;break;case"i":"tile"===a?e.query.tilei=r:e.query.mapi=r;break;case"j":"tile"===a?e.query.tilej=r:e.query.mapj=r}else if("zoom"===n)e.query.zoom=r;else if(u){const t=i[o].htmlselect;e.query[r]=function(){return t.value}}else{const t=i[o];e.query[r]=function(){return t.getAttribute("value")}}}return e.query.title=t.title,e},reset:function(t){if(t&&this._map){var e=this._map&&this._map.hasLayer(this),i=this._templates;delete this._queries,this._map.off("click",null,this),this._templates=t;for(var o=0;o<t.length;o++)"tile"===t[o].rel?this._templates[o].layer=M.templatedTileLayer(t[o],L.Util.extend(this.options,{errorTileUrl:"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",zIndex:o,pane:this._container})):"image"===t[o].rel?this._templates[o].layer=M.templatedImageLayer(t[o],L.Util.extend(this.options,{zIndex:o,pane:this._container})):"features"===t[o].rel?this._templates[o].layer=M.templatedFeaturesLayer(t[o],L.Util.extend(this.options,{zIndex:o,pane:this._container})):"query"===t[o].rel&&(this._queries||(this._queries=[]),this._queries.push(L.extend(t[o],this._setupQueryVars(t[o])))),e&&this.onAdd(this._map);for(o=0;o<i.length;o++)this._map.hasLayer(i[o].layer)&&this._map.removeLayer(i[o].layer)}},onAdd:function(t){for(var e=0;e<this._templates.length;e++)"query"!==this._templates[e].rel&&t.addLayer(this._templates[e].layer)},onRemove:function(t){L.DomUtil.remove(this._container);for(var e=0;e<this._templates.length;e++)"query"!==this._templates[e].rel&&t.removeLayer(this._templates[e].layer)},_previousFeature:function(t){this._count+-1>=0&&(this._count--,this._map.fire("featurepagination",{i:this._count,popup:this}))},_nextFeature:function(t){this._count+1<this._source._totalFeatureCount&&(this._count++,this._map.fire("featurepagination",{i:this._count,popup:this}))}}),p=function(t,e){return new u(t,e)},c=L.Layer.extend({initialize:function(t,e){let i=M.extractInputBounds(t);this.zoomBounds=i.zoomBounds,this.layerBounds=i.bounds,this.isVisible=!0,this._template=t,this._container=L.DomUtil.create("div","leaflet-layer",e.pane),L.extend(e,this.zoomBounds),L.DomUtil.addClass(this._container,"mapml-features-container"),L.setOptions(this,L.extend(e,this._setUpFeaturesTemplateVars(t)))},getEvents:function(){return{moveend:this._onMoveEnd}},onAdd:function(){this._map._addZoomLimit(this);var t,e=new Headers({Accept:"text/mapml"}),i=new DOMParser,o=this.options.opacity||1,n=this._container,a=this._map;this._features||(this._features=M.mapMlFeatures(null,{renderer:M.featureRenderer(),pane:n,opacity:o,projection:a.options.projection,static:!0,onEachFeature:function(t,e){var i=document.createElement("div");i.classList.add("mapml-popup-content"),i.insertAdjacentHTML("afterbegin",t.innerHTML),e.bindPopup(i,{autoClose:!1,minWidth:108})}}));var s=this._features,r=function(o,n){return fetch(o,{redirect:"follow",headers:e}).then(function(t){return t.text()}).then(function(e){t=i.parseFromString(e,"application/xml");var a=new URL(t.querySelector("map-base")?t.querySelector("map-base").getAttribute("href"):o).href;o=(o=t.querySelector("map-link[rel=next]")?t.querySelector("map-link[rel=next]").getAttribute("href"):null)?new URL(o,a).href:null;let l=t.querySelector("map-meta[name=zoom]")&&+M.metaContentToObject(t.querySelector("map-meta[name=zoom]").getAttribute("content")).value||0,m=t.querySelector("map-meta[name=cs]")&&M.metaContentToObject(t.querySelector("map-meta[name=cs]").getAttribute("content")).content||"GCRS";if(s.addData(t,m,l),o&&--n)return r(o,n)})};r(this._getfeaturesUrl(),10).then(function(){a.addLayer(s),a.fire("moveend")}).catch(function(t){console.log(t)})},redraw:function(){this._onMoveEnd()},_onMoveEnd:function(){let t=this._map.getZoom(),e=M.pixelToPCRSBounds(this._map.getPixelBounds(),t,this._map.options.projection);if(this.isVisible=t<=this.zoomBounds.maxZoom&&t>=this.zoomBounds.minZoom&&this.layerBounds.overlaps(e),this._features.clearLayers(),this.isVisible){var i,o=new Headers({Accept:"text/mapml;q=0.9,application/geo+json;q=0.8"}),n=new DOMParser,a=this._features,s=this._map,r=this,l=function(t,e){return fetch(t,{redirect:"follow",headers:o}).then(function(t){return t.text()}).then(function(o){i=n.parseFromString(o,"application/xml");var s=new URL(i.querySelector("map-base")?i.querySelector("map-base").getAttribute("href"):t).href;t=(t=i.querySelector("map-link[rel=next]")?i.querySelector("map-link[rel=next]").getAttribute("href"):null)?new URL(t,s).href:null;let r=i.querySelector("map-meta[name=zoom]")&&+M.metaContentToObject(i.querySelector("map-meta[name=zoom]").getAttribute("content")).value||0,m=i.querySelector("map-meta[name=cs]")&&M.metaContentToObject(i.querySelector("map-meta[name=cs]").getAttribute("content")).content||"GCRS";if(a.addData(i,m,r),t&&--e)return l(t,e)})};l(this._getfeaturesUrl(),10).then(function(){s.addLayer(a),M.TemplatedFeaturesLayer.prototype._updateTabIndex(r)}).catch(function(t){console.log(t)})}},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},_updateTabIndex:function(t){let e=t||this;for(let t in e._features._layers){let i=e._features._layers[t];if(i._path&&("M0 0"!==i._path.getAttribute("d")?i._path.setAttribute("tabindex",0):i._path.removeAttribute("tabindex"),0===i._path.childElementCount)){let t=document.createElement("title");t.innerText="Feature",i._path.appendChild(t)}}},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},onRemove:function(){this._map.removeLayer(this._features)},_getfeaturesUrl:function(){var t={};for(var e in this.options.feature.zoom&&(t[this.options.feature.zoom]=this._map.getZoom()),this.options.feature.width&&(t[this.options.feature.width]=this._map.getSize().x),this.options.feature.height&&(t[this.options.feature.height]=this._map.getSize().y),this.options.feature.bottom&&(t[this.options.feature.bottom]=this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).y),this.options.feature.left&&(t[this.options.feature.left]=this._TCRSToPCRS(this._map.getPixelBounds().min,this._map.getZoom()).x),this.options.feature.top&&(t[this.options.feature.top]=this._TCRSToPCRS(this._map.getPixelBounds().min,this._map.getZoom()).y),this.options.feature.right&&(t[this.options.feature.right]=this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).x),this.options.feature)["width","height","left","right","top","bottom","zoom"].indexOf(e)<0&&(t[e]=this.options.feature[e]);return L.Util.template(this._template.template,t)},_TCRSToPCRS:function(t,e){var i=this._map.options.crs;return i.transformation.untransform(t,i.scale(e))},_setUpFeaturesTemplateVars:function(t){var e={feature:{}},i=t.values;e.feature.hidden=[];for(var o=0;o<i.length;o++){var n=i[o].getAttribute("type"),a=i[o].getAttribute("units"),s=i[o].getAttribute("axis"),r=i[o].getAttribute("name"),l=i[o].getAttribute("position"),m=(i[o].getAttribute("value"),"map-select"===i[o].tagName.toLowerCase());if("width"===n)e.feature.width=r;else if("height"===n)e.feature.height=r;else if("zoom"===n)e.feature.zoom=r;else if("location"!==n||"pcrs"!==a&&"gcrs"!==a)if(m){const t=i[o].htmlselect;e.feature[r]=function(){return t.value}}else{const t=i[o];e.feature[r]=function(){return t.getAttribute("value")}}else switch(s){case"x":case"longitude":case"easting":l&&(l.match(/.*?-left/i)?e.feature.left=r:l.match(/.*?-right/i)&&(e.feature.right=r));break;case"y":case"latitude":case"northing":l&&(l.match(/top-.*?/i)?e.feature.top=r:l.match(/bottom-.*?/i)&&(e.feature.bottom=r))}}return e}}),h=function(t,e){return new c(t,e)},d=L.Layer.extend({initialize:function(t,e){this._template=t,this._container=L.DomUtil.create("div","leaflet-layer",e.pane),L.DomUtil.addClass(this._container,"mapml-image-container");let i=M.extractInputBounds(t);this.zoomBounds=i.zoomBounds,this.layerBounds=i.bounds,this.isVisible=!0,L.extend(e,this.zoomBounds),L.setOptions(this,L.extend(e,this._setUpExtentTemplateVars(t)))},getEvents:function(){return{moveend:this._onMoveEnd}},onAdd:function(){this._map._addZoomLimit(this),this.setZIndex(this.options.zIndex),this._onMoveEnd()},redraw:function(){this._onMoveEnd()},_clearLayer:function(){let t=this._container.querySelectorAll("img");for(let e=0;e<t.length;e++)this._container.removeChild(t[e])},_onMoveEnd:function(){let t=this._map.getZoom(),e=M.pixelToPCRSBounds(this._map.getPixelBounds(),t,this._map.options.projection);if(this.isVisible=t<=this.zoomBounds.maxZoom&&t>=this.zoomBounds.minZoom&&this.layerBounds.overlaps(e),this.isVisible){var i=this._map,o=i.getPixelBounds().min.subtract(i.getPixelOrigin()),n=i.getSize(),a=this.getImageUrl(),s=this._imageOverlay;this._imageOverlay=M.imageOverlay(a,o,n,0,this._container),this._imageOverlay.addTo(i),s&&this._imageOverlay.on("load error",function(){i.removeLayer(s)})}else this._clearLayer()},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},onRemove:function(t){this._clearLayer(),t._removeZoomLimit(this),this._container=null},getImageUrl:function(){var t={};for(var e in t[this.options.extent.width]=this._map.getSize().x,t[this.options.extent.height]=this._map.getSize().y,t[this.options.extent.bottom]=this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).y,t[this.options.extent.left]=this._TCRSToPCRS(this._map.getPixelBounds().min,this._map.getZoom()).x,t[this.options.extent.top]=this._TCRSToPCRS(this._map.getPixelBounds().min,this._map.getZoom()).y,t[this.options.extent.right]=this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).x,this.options.extent)["width","height","left","right","top","bottom"].indexOf(e)<0&&(t[e]=this.options.extent[e]);return L.Util.template(this._template.template,t)},_TCRSToPCRS:function(t,e){var i=this._map.options.crs;return i.transformation.untransform(t,i.scale(e))},_setUpExtentTemplateVars:function(t){for(var e={extent:{}},i=t.values,o=0;o<t.values.length;o++){var n=i[o].getAttribute("type"),a=i[o].getAttribute("units"),s=i[o].getAttribute("axis"),r=i[o].getAttribute("name"),l=i[o].getAttribute("position"),m="map-select"===i[o].tagName.toLowerCase();if("width"===n)e.extent.width=r;else if("height"===n)e.extent.height=r;else if("location"!==n||"pcrs"!==a&&"gcrs"!==a)if(m){const t=i[o].htmlselect;e.extent[r]=function(){return t.value}}else{const t=i[o];e.extent[r]=function(){return t.getAttribute("value")}}else switch(s){case"longitude":case"easting":l&&(l.match(/.*?-left/i)?e.extent.left=r:l.match(/.*?-right/i)&&(e.extent.right=r));break;case"latitude":case"northing":l&&(l.match(/top-.*?/i)?e.extent.top=r:l.match(/bottom-.*?/i)&&(e.extent.bottom=r))}}return e}}),_=function(t,e){return new d(t,e)},y=L.ImageOverlay.extend({initialize:function(t,e,i,o,n,a){this._container=n,this._url=t,this._location=e,this._size=L.point(i),this._angle=o,L.setOptions(this,a)},getEvents:function(){var t={viewreset:this._reset};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},onAdd:function(){this.on({load:this._onImageLoad}),this._image||this._initImage(),this.options.interactive&&(L.DomUtil.addClass(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this._container.appendChild(this._image),this._reset()},onRemove:function(){L.DomUtil.remove(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},_onImageLoad:function(){this._image&&(this._image.loaded=+new Date,this._updateOpacity())},_animateZoom:function(t){var e=this._map.getZoomScale(t.zoom),i=this._map.getPixelOrigin().add(this._location).multiplyBy(e).subtract(this._map._getNewPixelOrigin(t.center,t.zoom)).round();L.Browser.any3d?L.DomUtil.setTransform(this._image,i,e):L.DomUtil.setPosition(this._image,i)},_reset:function(){var t=this._image,e=this._location,i=this._size;L.DomUtil.setPosition(t,e),t.style.width=i.x+"px",t.style.height=i.y+"px"},_updateOpacity:function(){if(this._map){var t=+new Date,e=!1,i=this._image,o=Math.min(1,(t-i.loaded)/200);L.DomUtil.setOpacity(i,o),o<1&&(e=!0),e&&(L.Util.cancelAnimFrame(this._fadeFrame),this._fadeFrame=L.Util.requestAnimFrame(this._updateOpacity,this)),L.DomUtil.addClass(i,"leaflet-image-loaded")}}}),g=function(t,e,i,o,n,a){return new y(t,e,i,o,n,a)},f=L.Layer.extend({options:{maxNext:10,zIndex:0,maxZoom:25},initialize:function(t,e,i){var o;t&&(this._href=t),e&&(this._layerEl=e,o=!!e.querySelector("map-feature,map-tile,map-extent"),!t&&o&&(this._content=e)),L.setOptions(this,i),this._container=L.DomUtil.create("div","leaflet-layer"),L.DomUtil.addClass(this._container,"mapml-layer"),this._imageContainer=L.DomUtil.create("div","leaflet-layer",this._container),L.DomUtil.addClass(this._imageContainer,"mapml-image-container"),this._mapmlTileContainer=L.DomUtil.create("div","mapml-tile-container",this._container),!o&&e&&e.hasAttribute("label")&&(this._title=e.getAttribute("label")),this._initCount=0,this._initExtent(o?e:null),this.on("attached",this._validateExtent,this),this.validProjection=!0},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},_changeOpacity:function(t){t&&t.target&&t.target.value>=0&&t.target.value<=1&&this.changeOpacity(t.target.value)},changeOpacity:function(t){this._container.style.opacity=t,this.opacityEl&&(this.opacityEl.value=t)},onAdd:function(t){!this._extent||this._validProjection(t)?(this._map=t,this._content?(this._mapmlvectors||(this._mapmlvectors=M.mapMlFeatures(this._content,{renderer:M.featureRenderer(),pane:this._container,opacity:this.options.opacity,projection:t.options.projection,_leafletLayer:this,static:!0,onEachFeature:function(t,e){if(t){var i=document.createElement("div");i.classList.add("mapml-popup-content"),i.insertAdjacentHTML("afterbegin",t.innerHTML),e.bindPopup(i,{autoClose:!1,minWidth:165})}}})),t.addLayer(this._mapmlvectors)):this.once("extentload",function(){this._validProjection(t)?(this._mapmlvectors||(this._mapmlvectors=M.mapMlFeatures(this._content,{renderer:M.featureRenderer(),pane:this._container,opacity:this.options.opacity,projection:t.options.projection,_leafletLayer:this,static:!0,onEachFeature:function(t,e){if(t){var i=document.createElement("div");i.classList.add("mapml-popup-content"),i.insertAdjacentHTML("afterbegin",t.innerHTML),e.bindPopup(i,{autoClose:!1,minWidth:165})}}}).addTo(t)),this._setLayerElExtent()):this.validProjection=!1},this),this._imageLayer||(this._imageLayer=L.layerGroup()),t.addLayer(this._imageLayer),(!this._staticTileLayer||null===this._staticTileLayer._container)&&this._mapmlTileContainer.getElementsByTagName("map-tiles").length>0&&(this._staticTileLayer=M.mapMLStaticTileLayer({pane:this._container,_leafletLayer:this,className:"mapml-static-tile-layer",tileContainer:this._mapmlTileContainer,maxZoomBound:t.options.crs.options.resolutions.length-1,tileSize:t.options.crs.options.crs.tile.bounds.max.x}),t.addLayer(this._staticTileLayer)),this._extent?this._templateVars&&(this._templatedLayer=M.templatedLayer(this._templateVars,{pane:this._container,_leafletLayer:this,crs:this.crs}).addTo(t)):this.once("extentload",function(){this._validProjection(t)?this._templateVars&&(this._templatedLayer=M.templatedLayer(this._templateVars,{pane:this._container,_leafletLayer:this,crs:this.crs}).addTo(t),this._setLayerElExtent()):this.validProjection=!1},this),this._setLayerElExtent(),this.setZIndex(this.options.zIndex),this.getPane().appendChild(this._container),setTimeout(()=>{t.fire("checkdisabled")},0),t.on("popupopen",this._attachSkipButtons,this)):this.validProjection=!1},_validProjection:function(t){let e=!1;if(this._templateVars)for(let i of this._templateVars)i.projectionMatch||i.projection===t.options.projection||(e=!0);return!(e||this.getProjection()!==t.options.projection.toUpperCase())},_setLayerElExtent:function(){let t,e;["_staticTileLayer","_imageLayer","_mapmlvectors","_templatedLayer"].forEach(i=>{if(this[i])if("_templatedLayer"===i)for(let o=0;o<this[i]._templates.length;o++)"query"!==this[i]._templates[o].rel&&this[i]._templates[o].layer.layerBounds&&(t?(t.extend(this[i]._templates[o].layer.layerBounds.min),t.extend(this[i]._templates[o].layer.layerBounds.max)):(t=this[i]._templates[o].layer.layerBounds,e=this[i]._templates[o].layer.zoomBounds));else this[i].layerBounds&&(t?(t.extend(this[i].layerBounds.min),t.extend(this[i].layerBounds.max)):(t=this[i].layerBounds,e=this[i].zoomBounds))}),t&&(this._layerEl.extent=Object.assign(M.convertAndFormatPCRS(t,this._map),{zoom:e}))},addTo:function(t){return t.addLayer(this),this},getEvents:function(){return{zoomanim:this._onZoomAnim}},redraw:function(){this._templatedLayer&&this._templatedLayer.redraw()},_onZoomAnim:function(t){var e=t.zoom,i=this._extent?this._extent.querySelector("map-input[type=zoom]"):null,o=i&&i.hasAttribute("min")?parseInt(i.getAttribute("min")):this._map.getMinZoom(),n=i&&i.hasAttribute("max")?parseInt(i.getAttribute("max")):this._map.getMaxZoom();e<o&&this._extent.zoomout||e>n&&this._extent.zoomin;o<=e&&e<=n||(this._extent.zoomin&&e>n?(this._href=this._extent.zoomin,this._layerEl.src=this._extent.zoomin,this.href=this._extent.zoomin,this._layerEl.src=this._extent.zoomin):this._extent.zoomout&&e<o&&(this._href=this._extent.zoomout,this.href=this._extent.zoomout,this._layerEl.src=this._extent.zoomout)),this._templatedLayer},onRemove:function(t){L.DomUtil.remove(this._container),this._staticTileLayer&&t.removeLayer(this._staticTileLayer),this._mapmlvectors&&t.removeLayer(this._mapmlvectors),this._imageLayer&&t.removeLayer(this._imageLayer),this._templatedLayer&&t.removeLayer(this._templatedLayer),t.fire("checkdisabled"),t.off("popupopen",this._attachSkipButtons)},getZoomBounds:function(){var t=this._extent,e=t?t.querySelector("[type=zoom]"):void 0,i=e&&e.hasAttribute("min")?e.getAttribute("min"):this._map.getMinZoom(),o=e&&e.hasAttribute("max")?e.getAttribute("max"):this._map.getMaxZoom(),n={};return n.min=Math.min(i,o),n.max=Math.max(i,o),n},_transformDeprectatedInput:function(t){var e=t.getAttribute("type").toLowerCase();if("xmin"===e||"ymin"===e||"xmax"===e||"ymax"===e)switch(t.setAttribute("type","location"),t.setAttribute("units","tcrs"),e){case"xmin":t.setAttribute("axis","x"),t.setAttribute("position","top-left");break;case"ymin":t.setAttribute("axis","y"),t.setAttribute("position","top-left");break;case"xmax":t.setAttribute("axis","x"),t.setAttribute("position","bottom-right");break;case"ymax":t.setAttribute("axis","y"),t.setAttribute("position","bottom-right")}},getLayerExtentBounds:function(t){if(this._extent){var e,i,o,n,a,s,r,l,m=t.getZoom(),u=t.options.projection,p=u!==this._extent.getAttribute("units");if(s=this._extent.querySelector("[type=xmin]").getAttribute("min"),r=this._extent.querySelector("[type=xmax]").getAttribute("min"),i=Math.min(s,r),s=this._extent.querySelector("[type=xmin]").getAttribute("max"),r=this._extent.querySelector("[type=xmax]").getAttribute("max"),n=Math.max(s,r),s=this._extent.querySelector("[type=ymin]").getAttribute("min"),r=this._extent.querySelector("[type=ymax]").getAttribute("min"),o=Math.min(s,r),s=this._extent.querySelector("[type=ymin]").getAttribute("max"),r=this._extent.querySelector("[type=ymax]").getAttribute("max"),a=Math.max(s,r),p){var c=[(e=M[u]).latLngToPoint(L.latLng([o,i]),m),e.latLngToPoint(L.latLng([a,n]),m),e.latLngToPoint(L.latLng([o,i]),m),e.latLngToPoint(L.latLng([o,n]),m)];return L.bounds(c)}return(l=parseInt(this._extent.querySelector("[type=zoom]").getAttribute("value")))!==m?(e=M[u],L.bounds(e.latLngToPoint(e.pointToLatLng(L.point(i,o),l),m),e.latLngToPoint(e.pointToLatLng(L.point(n,a),l),m))):L.bounds(L.point(i,o),L.point(n,a))}},getAttribution:function(){return this.options.attribution},getLayerUserControlsHTML:function(){var t=L.DomUtil.create("fieldset","mapml-layer-item"),e=L.DomUtil.create("input"),i=L.DomUtil.create("span","mapml-layer-item-name"),o=L.DomUtil.create("span"),n=L.DomUtil.create("div","mapml-layer-item-properties",t),a=L.DomUtil.create("div","mapml-layer-item-settings",t),s=L.DomUtil.create("label","mapml-layer-item-toggle",n),r=L.DomUtil.create("div","mapml-layer-item-controls",n),l=L.DomUtil.create("details","mapml-layer-item-opacity mapml-control-layers",a),m=L.DomUtil.create("input"),u=L.DomUtil.create("summary"),p=L.SVG.create("svg"),c=L.SVG.create("path"),h=L.SVG.create("path"),d=this._layerEl.parentNode;this.opacityEl=m,p.setAttribute("viewBox","0 0 24 24"),p.setAttribute("height","22"),p.setAttribute("width","22"),c.setAttribute("d","M0 0h24v24H0z"),c.setAttribute("fill","none"),h.setAttribute("d","M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"),p.appendChild(c),p.appendChild(h),a.hidden=!0,o.setAttribute("aria-hidden",!0);let _=L.DomUtil.create("button","mapml-layer-item-remove-control",r);_.type="button",_.title="Remove Layer",_.innerHTML="<span aria-hidden='true'>&#10005;</span>",_.classList.add("mapml-button"),L.DomEvent.on(_,"click",L.DomEvent.stop),L.DomEvent.on(_,"click",t=>{let e,i,o=0;if(i="MAPML-VIEWER"===d.tagName?d.shadowRoot:d.querySelector(".mapml-web-map").shadowRoot,t.target.closest("fieldset").nextElementSibling&&!t.target.closest("fieldset").nextElementSibling.disbaled)for(e=t.target.closest("fieldset").previousElementSibling;e;)o+=2,e=e.previousElementSibling;else e="link";d.removeChild(t.target.closest("fieldset").querySelector("span").layer._layerEl),(e=e?i.querySelector(".leaflet-control-attribution").firstElementChild:e=i.querySelectorAll("input")[o]).focus()},this);let y=L.DomUtil.create("button","mapml-layer-item-settings-control",r);if(y.type="button",y.title="Layer Settings",y.setAttribute("aria-expanded",!1),y.classList.add("mapml-button"),L.DomEvent.on(y,"click",t=>{1==a.hidden?(y.setAttribute("aria-expanded",!0),a.hidden=!1):(y.setAttribute("aria-expanded",!1),a.hidden=!0)},this),e.defaultChecked=!!this._map,e.type="checkbox",i.layer=this,this._legendUrl){var g=document.createElement("a");g.text=" "+this._title,g.href=this._legendUrl,g.target="_blank",g.draggable=!1,i.appendChild(g)}else i.innerHTML=this._title;if(i.id="mapml-layer-item-name-{"+L.stamp(i)+"}",u.innerText="Opacity",u.id="mapml-layer-item-opacity-"+L.stamp(u),l.appendChild(u),l.appendChild(m),m.setAttribute("type","range"),m.setAttribute("min","0"),m.setAttribute("max","1.0"),m.setAttribute("value",this._container.style.opacity||"1.0"),m.setAttribute("step","0.1"),m.setAttribute("aria-labelledby",u.id),m.value=this._container.style.opacity||"1.0",t.setAttribute("aria-grabbed","false"),t.setAttribute("aria-labelledby",i.id),t.onmousedown=(e=>{if("input"===e.target.tagName.toLowerCase()||"select"===e.target.tagName.toLowerCase())return;e.preventDefault();let i=t,o=t.parentNode,n=!1,a=e.clientY;document.body.onmousemove=(t=>{t.preventDefault();let e=t.clientY-a;if(n=Math.abs(e)>5||n,o&&!n||o&&o.childElementCount<=1||o.getBoundingClientRect().top>i.getBoundingClientRect().bottom||o.getBoundingClientRect().bottom<i.getBoundingClientRect().top)return;o.classList.add("mapml-draggable"),i.style.transform="translateY("+e+"px)",i.style.pointerEvents="none";let s=t.clientX,r=t.clientY,l=("MAPML-VIEWER"===d.tagName?d.shadowRoot:d.querySelector(".mapml-web-map").shadowRoot).elementFromPoint(s,r),m=l&&l.closest("fieldset")?l.closest("fieldset"):i;m=Math.abs(e)<=m.offsetHeight?i:m,i.setAttribute("aria-grabbed","true"),i.setAttribute("aria-dropeffect","move"),m&&o===m.parentNode&&(m=m!==i.nextSibling?m:m.nextSibling,i!==m&&(a=t.clientY,i.style.transform=null),o.insertBefore(i,m))}),document.body.onmouseup=(()=>{i.setAttribute("aria-grabbed","false"),i.removeAttribute("aria-dropeffect"),i.style.pointerEvents=null,i.style.transform=null;let t=o.children,e=1;for(let i of t){let t=i.querySelector("span").layer._layerEl;t.setAttribute("data-moving",""),d.insertAdjacentElement("beforeend",t),t.removeAttribute("data-moving"),t._layer.setZIndex(e),e++}o.classList.remove("mapml-draggable"),document.body.onmousemove=document.body.onmouseup=null})}),L.DomEvent.on(m,"change",this._changeOpacity,this),s.appendChild(e),s.appendChild(i),y.appendChild(o),o.appendChild(p),this._styles&&a.appendChild(this._styles),this._userInputs){var f=document.createDocumentFragment(),b=this._templateVars;if(b)for(var x=0;x<b.length;x++)for(var v=b[x],A=0;A<v.values.length;A++){var M=v.values[A],E="#"+M.getAttribute("id");if("map-select"===M.tagName.toLowerCase()&&!f.querySelector(E)){var C=L.DomUtil.create("details","mapml-layer-item-time mapml-control-layers",f),S=L.DomUtil.create("summary"),T=L.DomUtil.create("label");T.innerText=M.getAttribute("name"),T.setAttribute("for",M.getAttribute("id")),S.appendChild(T),C.appendChild(S),C.appendChild(M.htmlselect)}}a.appendChild(f)}return t},_initExtent:function(t){if(this._href||t){var e,i,o=this;if(this._href){var s=new XMLHttpRequest;e=this._href,i=l,s.onreadystatechange=function(){this.readyState===this.DONE&&(400!==this.status&&404!==this.status&&500!==this.status&&406!==this.status||(o.error=!0,o.fire("extentload",o,!0),s.abort()))},s.onload=i,s.onerror=function(){o.error=!0,o.fire("extentload",o,!0)},s.open("GET",e),s.setRequestHeader("Accept",M.mime),s.overrideMimeType("text/xml"),s.send()}else t&&l.call(this,t)}function r(t){var e=document.createElement("select"),i=t.getAttributeNames();for(let o=0;o<i.length;o++)e.setAttribute(i[o],t.getAttribute(i[o]));var o=t.children;for(let t=0;t<o.length;t++){var n=document.createElement("option"),a=o[t].getAttributeNames();for(let e=0;e<a.length;e++)n.setAttribute(a[e],o[t].getAttribute(a[e]));n.innerHTML=o[t].innerHTML,e.appendChild(n)}return e}function l(t){var e=this.responseXML||t;if(e.querySelector&&e.querySelector("map-feature")&&(o._content=e),!this.responseXML&&this.responseText&&(e=(new DOMParser).parseFromString(this.responseText,"text/xml")),this.readyState===this.DONE&&e.querySelector&&!e.querySelector("parsererror")){var i,s=e.querySelector("map-extent")||e.querySelector("map-meta[name=projection]");"map-extent"===s.tagName.toLowerCase()&&s.hasAttribute("units")?i=s.getAttribute("units"):"map-meta"===s.tagName.toLowerCase()&&s.hasAttribute("content")&&(i=M.metaContentToObject(s.getAttribute("content")).content);var l=i&&i===o.options.mapprojection,m=e.querySelector("map-meta[name=extent]"),u=!l&&e.querySelector("map-head map-link[rel=alternate][projection="+o.options.mapprojection+"]"),p=new URL(e.querySelector("map-base")?e.querySelector("map-base").getAttribute("href"):e.baseURI||this.responseURL,this.responseURL).href;if(s){if(!l&&u&&u.hasAttribute("href"))return void o.fire("changeprojection",{href:new URL(u.getAttribute("href"),p).href},!1);if(!l&&o._map&&1===o._map.options.mapEl.querySelectorAll("layer-").length)return void(o._map.options.mapEl.projection=i);if(s.querySelector("map-link[rel=tile],map-link[rel=image],map-link[rel=features],map-link[rel=query]")&&s.hasAttribute("units")){o._templateVars=[];var c=s.querySelectorAll("map-link[rel=tile],map-link[rel=image],map-link[rel=features],map-link[rel=query]"),h=new RegExp("(?:{)(.*?)(?:})","g"),d=s.querySelector('map-input[type="zoom" i]'),_=!1,y={zoom:0};if(m){let t=M.metaContentToObject(m.getAttribute("content"));y.zoom=t.zoom||y.zoom;let e=Object.keys(t);for(let t=0;t<e.length;t++)if(!e[t].includes("zoom")){y.cs=M.axisToCS(e[t].split("-")[2]);break}let o=M.csToAxes(y.cs);y.bounds=M.boundsToPCRSBounds(L.bounds(L.point(+t[`top-left-${o[0]}`],+t[`top-left-${o[1]}`]),L.point(+t[`bottom-right-${o[0]}`],+t[`bottom-right-${o[1]}`])),y.zoom,i,y.cs)}else y.bounds=M[i].options.crs.pcrs.bounds,y.cs="PCRS";for(var g=0;g<c.length;g++){var f=c[g],b=f.getAttribute("tref");if(!b){b=a;let t=e.querySelectorAll("map-input");for(let e of t)b+=`{${e.getAttribute("name")}}`}for(var x,v=f.hasAttribute("title")?f.getAttribute("title"):"Query this layer",A=b.match(h),E=f.hasAttribute("rel")&&"tile"!==f.getAttribute("rel").toLowerCase()?f.getAttribute("rel").toLowerCase():"tile",C=f.hasAttribute("type")?f.getAttribute("type").toLowerCase():"image/*",S=[],T=f&&f.hasAttribute("tms"),z=e.querySelector("map-meta[name=zoom]")?M.metaContentToObject(e.querySelector("map-meta[name=zoom]").getAttribute("content")):void 0;null!==(x=h.exec(b));){var k=x[1],P=s.querySelector("map-input[name="+k+"],map-select[name="+k+"]");if(!P){console.log("input with name="+k+" not found for template variable of same name");break}if(P.hasAttribute("type")&&"location"===P.getAttribute("type")&&!P.hasAttribute("min")&&P.hasAttribute("axis")&&!["i","j"].includes(P.getAttribute("axis").toLowerCase())){d.setAttribute("value",y.zoom);let t=P.getAttribute("axis"),e=M.convertPCRSBounds(y.bounds,y.zoom,i,M.axisToCS(t));P.setAttribute("min",e.min[M.axisToXY(t)]),P.setAttribute("max",e.max[M.axisToXY(t)])}if(S.push(P),_=_||P.hasAttribute("type")&&"zoom"===P.getAttribute("type").toLowerCase(),P.hasAttribute("shard")){var w=P.getAttribute("list");P.servers=[];var I=s.querySelectorAll("map-datalist#"+w+" > map-option");0===I.length&&P.hasAttribute("value")&&(I=P.getAttribute("value").split(""));for(var B=0;B<I.length;B++)I[B].getAttribute?P.servers.push(I[B].getAttribute("value")):P.servers.push(I[B])}else if("map-select"===P.tagName.toLowerCase()){var D=document.createElement("div");D.insertAdjacentHTML("afterbegin",P.outerHTML),P.htmlselect=D.querySelector("map-select"),P.htmlselect=r(P.htmlselect),L.DomEvent.on(P.htmlselect,"change",o.redraw,o),o._userInputs||(o._userInputs=[]),o._userInputs.push(P.htmlselect)}}(b&&A.length===S.length||b===a)&&("query"===E&&(o.queryable=!0),!_&&d&&S.push(d),o._templateVars.push({template:decodeURI(new URL(b,p)),linkEl:f,title:v,rel:E,type:C,values:S,zoomBounds:z,extentPCRSFallback:{bounds:y.bounds},projectionMatch:l||u,projection:s.getAttribute("units")||n,tms:T}))}}}else s=o._synthesizeExtent(e),e.querySelector("map-feature,map-tile")&&(o._content=e);o._parseLicenseAndLegend(e,o),o._extent=s;var q=e.querySelector("map-link[rel=zoomin]"),F=e.querySelector("map-link[rel=zoomout]");if(delete o._extent.zoomin,delete o._extent.zoomout,q&&(o._extent.zoomin=new URL(q.getAttribute("href"),p).href),F&&(o._extent.zoomout=new URL(F.getAttribute("href"),p).href),o._templatedLayer&&o._templatedLayer.reset(o._templateVars),e.querySelector("map-tile")){var R=document.createElement("map-tiles"),N=e.querySelector("map-meta[name=zoom][content]")||e.querySelector("map-input[type=zoom][value]");R.setAttribute("zoom",N&&N.getAttribute("content")||N&&N.getAttribute("value")||"0");for(var O=e.getElementsByTagName("map-tile"),U=0;U<O.length;U++)R.appendChild(document.importNode(O[U],!0));o._mapmlTileContainer.appendChild(R)}M.parseStylesheetAsHTML(e,p,o._container);var j=e.querySelectorAll('map-link[rel=style],map-link[rel="self style"],map-link[rel="style self"]');if(j.length>1){var Z=document.createElement("details"),G=document.createElement("summary");G.innerText="Style",Z.appendChild(G);for(var H=function(t){o.fire("changestyle",{src:t.target.getAttribute("data-href")},!1)},$=0;$<j.length;$++){var V=document.createElement("div"),W=V.appendChild(document.createElement("input"));W.setAttribute("type","radio"),W.setAttribute("id","rad-"+L.stamp(W)),W.setAttribute("name","styles-"+o._title),W.setAttribute("value",j[$].getAttribute("title")),W.setAttribute("data-href",new URL(j[$].getAttribute("href"),p).href);var K=V.appendChild(document.createElement("label"));K.setAttribute("for","rad-"+L.stamp(W)),K.innerText=j[$].getAttribute("title"),"style self"!==j[$].getAttribute("rel")&&"self style"!==j[$].getAttribute("rel")||(W.checked=!0),Z.appendChild(V),L.DomUtil.addClass(Z,"mapml-layer-item-style mapml-control-layers"),L.DomEvent.on(W,"click",H,o)}o._styles=Z}e.querySelector("map-title")?o._title=e.querySelector("map-title").textContent.trim():e instanceof Element&&e.hasAttribute("label")&&(o._title=e.getAttribute("label").trim()),o._map&&(o._validateExtent(),o._map.hasLayer(o)&&o._map.attributionControl.addAttribution(o.getAttribution()))}else o.error=!0;o.fire("extentload",o,!1),o._layerEl.dispatchEvent(new CustomEvent("extentload",{detail:o}))}},_createExtent:function(){var t=document.createElement("map-extent"),e=document.createElement("map-input"),i=document.createElement("map-input"),o=document.createElement("map-input"),n=document.createElement("map-input"),a=document.createElement("map-input"),s=document.createElement("map-input");return a.setAttribute("type","zoom"),a.setAttribute("min","0"),a.setAttribute("max","0"),e.setAttribute("type","xmin"),e.setAttribute("min",""),e.setAttribute("max",""),i.setAttribute("type","ymin"),i.setAttribute("min",""),i.setAttribute("max",""),o.setAttribute("type","xmax"),o.setAttribute("min",""),o.setAttribute("max",""),n.setAttribute("type","ymax"),n.setAttribute("min",""),n.setAttribute("max",""),s.setAttribute("type","projection"),s.setAttribute("value","WGS84"),t.appendChild(e),t.appendChild(i),t.appendChild(o),t.appendChild(n),t.appendChild(a),t.appendChild(s),t},_validateExtent:function(){var t=this._extent;if(t&&t.querySelector&&this._map){if(t.querySelector('[type=xmin][min=""], [type=xmin][max=""], [type=xmax][min=""], [type=xmax][max=""], [type=ymin][min=""], [type=ymin][max=""]')){var e,i,o=t.querySelector("[type=xmin]"),n=t.querySelector("[type=ymin]"),a=t.querySelector("[type=xmax]"),s=t.querySelector("[type=ymax]"),r=t.querySelector("[type=projection][value]");r?(i=r.getAttribute("value"))&&"WGS84"===i?(e=this._map.getBounds(),o.setAttribute("min",e.getWest()),o.setAttribute("max",e.getEast()),n.setAttribute("min",e.getSouth()),n.setAttribute("max",e.getNorth()),a.setAttribute("min",e.getWest()),a.setAttribute("max",e.getEast()),s.setAttribute("min",e.getSouth()),s.setAttribute("max",e.getNorth())):i&&(e=this._map.getPixelBounds(),o.setAttribute("min",e.getBottomLeft().x),o.setAttribute("max",e.getTopRight().x),n.setAttribute("min",e.getTopRight().y),n.setAttribute("max",e.getBottomLeft().y),a.setAttribute("min",e.getBottomLeft().x),a.setAttribute("max",e.getTopRight().x),s.setAttribute("min",e.getTopRight().y),s.setAttribute("max",e.getBottomLeft().y)):this.error=!0}if(t.querySelector('[type=zoom][min=""], [type=zoom][max=""]')){var l=t.querySelector("[type=zoom]");l.setAttribute("min",this._map.getMinZoom()),l.setAttribute("max",this._map.getMaxZoom())}var m=t.hasAttribute("units")?t.getAttribute("units"):null;m&&M[m]?this.crs=M[m]:this.crs=M.OSMTILE}},_getMapMLExtent:function(t,e,i){var o=this._createExtent(),n=o.querySelector("map-input[type=zoom]"),a=o.querySelector("map-input[type=xmin]"),s=o.querySelector("map-input[type=ymin]"),r=o.querySelector("map-input[type=xmax]"),l=o.querySelector("map-input[type=ymax]"),m=o.querySelector("map-input[type=projection]"),u=void 0!==e[0]&&void 0!==e[1]?Math.min(e[0],e[1]):"",p=void 0!==e[0]&&void 0!==e[1]?Math.max(e[0],e[1]):"",c=t?t._southWest?t.getWest():t.getBottomLeft().x:"",h=t?t._southWest?t.getSouth():t.getTopRight().y:"",d=t?t._southWest?t.getEast():t.getTopRight().x:"",_=t?t._southWest?t.getNorth():t.getBottomLeft().y:"";return n.setAttribute("min","number"==typeof u&&isNaN(u)?"":u),n.setAttribute("max","number"==typeof p&&isNaN(p)?"":p),a.setAttribute("min",c),a.setAttribute("max",d),s.setAttribute("min",h),s.setAttribute("max",_),r.setAttribute("min",c),r.setAttribute("max",d),l.setAttribute("min",h),l.setAttribute("max",_),m.setAttribute("value",t&&t._southWest&&!i?"WGS84":i),o},_synthesizeExtent:function(t){var e,i,o,a,s,r,l,m,u,p,c,h,d=t.querySelectorAll("map-meta[name=zoom]")[0],_=t.querySelector("map-meta[name=extent]"),y=t.querySelector("map-meta[name=projection]"),g=y?y.getAttribute("content"):n;if(d)for(i=d.getAttribute("content").split(","),e=0;e<i.length;e++)c=(p=i[e].split("="))[0],h=p[1],"min"===c&&(a=parseInt(h)),"max"===c&&(s=parseInt(h));if(_)for(i=_.getAttribute("content").split(","),e=0;e<i.length;e++)c=(p=i[e].split("="))[0],h=p[1],"xmin"===c&&(r=parseFloat(h)),"xmax"===c&&(m=parseFloat(h)),"ymin"===c&&(l=parseFloat(h)),"ymax"===c&&(u=parseFloat(h));if(r&&l&&m&&u&&"WGS84"===g){var f=L.latLng(l,r),b=L.latLng(u,m);o=L.latLngBounds(f,b)}else r&&l&&m&&u&&(o=L.bounds([[r,l],[m,u]]));return this._getMapMLExtent(o,[a,s],g)},getProjection:function(){let t=this._extent;if(!t)return n;switch(t.tagName.toUpperCase()){case"MAP-EXTENT":if(t.hasAttribute("units"))return t.getAttribute("units").toUpperCase();break;case"MAP-INPUT":if(t.hasAttribute("value"))return t.getAttribute("value").toUpperCase();break;case"MAP-META":if(t.hasAttribute("content"))return M.metaContentToObject(t.getAttribute("content")).content.toUpperCase();break;default:return n}return n},_parseLicenseAndLegend:function(t,e){var i,o,n=t.querySelector("map-link[rel=license]");n&&(i=n.getAttribute("title"),o='<a href="'+n.getAttribute("href")+'" title="'+i+'">'+i+"</a>"),L.setOptions(e,{attribution:o});var a=t.querySelector("map-link[rel=legend]");a&&(e._legendUrl=a.getAttribute("href"))},_getUnprojectedMapLatLngBounds:function(t){var e=(t=t||this._map).getPixelOrigin(),i=t.getPixelBounds(),o=t.unproject(e),n=t.unproject(i.getBottomLeft()),a=t.unproject(i.getTopRight()),s=t.unproject(e.add(t.getSize()));return L.latLngBounds(n,a).extend(s).extend(o)},_projectionMatches:function(t){t=t||this._map;var e=this.getProjection();return!(!t.options.projection||"WGS84"!==e&&t.options.projection!==e)},getQueryTemplates:function(){if(this._templatedLayer&&this._templatedLayer._queries)return this._templatedLayer._queries},_attachSkipButtons:function(t){let e,i,o=t.popup,n=t.target,a=o._container.getElementsByClassName("mapml-popup-content")[0];o._container.setAttribute("role","dialog"),a.setAttribute("tabindex","-1"),a.setAttribute("role","document"),o._count=0,o._source._eventParents?(e=o._source._eventParents[Object.keys(o._source._eventParents)[0]],i=o._source.group):e=o._source._templatedLayer,o._container.querySelector('nav[class="mapml-focus-buttons"]')&&(L.DomUtil.remove(o._container.querySelector('nav[class="mapml-focus-buttons"]')),L.DomUtil.remove(o._container.querySelector("hr")));let s=L.DomUtil.create("nav","mapml-focus-buttons"),r=L.DomUtil.create("button","mapml-popup-button",s);r.type="button",r.title="Focus Map",r.innerHTML="<span aria-hidden='true'>|&#10094;</span>",L.DomEvent.disableClickPropagation(r),L.DomEvent.on(r,"click",L.DomEvent.stop),L.DomEvent.on(r,"click",t=>{n.closePopup(),n._container.focus()},o);let l=L.DomUtil.create("button","mapml-popup-button",s);l.type="button",l.title="Previous Feature",l.innerHTML="<span aria-hidden='true'>&#10094;</span>",L.DomEvent.disableClickPropagation(l),L.DomEvent.on(l,"click",L.DomEvent.stop),L.DomEvent.on(l,"click",e._previousFeature,o);let m=L.DomUtil.create("p","mapml-feature-count",s),u=this._totalFeatureCount?this._totalFeatureCount:1;m.innerText=o._count+1+"/"+u;let p=L.DomUtil.create("button","mapml-popup-button",s);p.type="button",p.title="Next Feature",p.innerHTML="<span aria-hidden='true'>&#10095;</span>",L.DomEvent.disableClickPropagation(p),L.DomEvent.on(p,"click",L.DomEvent.stop),L.DomEvent.on(p,"click",e._nextFeature,o);let c=L.DomUtil.create("button","mapml-popup-button",s);c.type="button",c.title="Focus Controls",c.innerHTML="<span aria-hidden='true'>&#10095;|</span>",L.DomEvent.disableClickPropagation(c),L.DomEvent.on(c,"click",L.DomEvent.stop),L.DomEvent.on(c,"click",t=>{n.closePopup(),n._controlContainer.querySelector("A").focus()},o);let h=L.DomUtil.create("hr");function d(t){let e=t.originalEvent.path||t.originalEvent.composedPath(),a=9===t.originalEvent.keyCode,s=t.originalEvent.shiftKey;e[0].classList.contains("leaflet-popup-close-button")&&a&&!s||27===t.originalEvent.keyCode?(L.DomEvent.stop(t),n.closePopup(o),i.focus()):("Focus Map"===e[0].title||e[0].classList.contains("mapml-popup-content"))&&a&&s&&setTimeout(()=>{L.DomEvent.stop(t),n.closePopup(o),i.focus()},0)}function _(t){let e=t.originalEvent.path||t.originalEvent.composedPath(),i=9===t.originalEvent.keyCode,a=t.originalEvent.shiftKey;13===t.originalEvent.keyCode&&e[0].classList.contains("leaflet-popup-close-button")||27===t.originalEvent.keyCode?(L.DomEvent.stopPropagation(t),n._container.focus(),n.closePopup(o),27!==t.originalEvent.keyCode&&(n._popupClosed=!0)):i&&e[0].classList.contains("leaflet-popup-close-button")?n.closePopup(o):("Focus Map"===e[0].title||e[0].classList.contains("mapml-popup-content"))&&i&&a&&setTimeout(()=>{L.DomEvent.stop(t),n.closePopup(o),n._container.focus()},0)}o._navigationBar=s,o._content.appendChild(h),o._content.appendChild(s),a.focus(),i?(i.setAttribute("aria-expanded","true"),n.on("keydown",d)):n.on("keydown",_),n.on("popupclose",function t(e){e.popup===o&&(n.off("keydown",d),n.off("keydown",_),n.off("popupclose",t),i&&i.setAttribute("aria-expanded","false"))})}}),b=function(t,e,i){return t||e?new f(t,e,i):null},x=L.Layer.extend({onAdd:function(t){let e=t.getSize();(e.x>400||e.y>300)&&(this._container=L.DomUtil.create("table","mapml-debug",t._container),this._panel=E({className:"mapml-debug-panel",pane:this._container}),t.addLayer(this._panel)),this._grid=S({className:"mapml-debug-grid",pane:t._panes.mapPane,zIndex:400,tileSize:t.options.crs.options.crs.tile.bounds.max.x}),t.addLayer(this._grid),this._vectors=z({className:"mapml-debug-vectors",pane:t._panes.mapPane,toolPane:this._container}),t.addLayer(this._vectors)},onRemove:function(t){t.removeLayer(this._grid),t.removeLayer(this._vectors),this._panel&&(t.removeLayer(this._panel),L.DomUtil.remove(this._container))}}),v=function(){return new x},A=L.Layer.extend({initialize:function(t){L.setOptions(this,t)},onAdd:function(t){this._title=L.DomUtil.create("caption","mapml-debug-banner",this.options.pane),this._title.innerHTML="Debug mode",t.debug={},t.debug._infoContainer=this._debugContainer=L.DomUtil.create("tbody","mapml-debug-panel",this.options.pane);let e=t.debug._infoContainer;t.debug._tileCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._tileMatrixCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._mapCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._tcrsCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._pcrsCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._gcrsCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),this._map.on("mousemove",this._updateCoords)},onRemove:function(){L.DomUtil.remove(this._title),this._debugContainer&&(L.DomUtil.remove(this._debugContainer),this._map.off("mousemove",this._updateCoords))},_updateCoords:function(t){if(this.contextMenu._visible)return;let e=this.options.mapEl,i=e._map.project(t.latlng),o=e._map.options.crs.scale(+e.zoom),n=e._map.options.crs.transformation.untransform(i,o),a=e._map.options.crs.options.crs.tile.bounds.max.x,s=i.x%a,r=i.y%a;s<0&&(s+=a),r<0&&(r+=a),this.debug._tileCoord.innerHTML=`\n      <th scope="row">tile: </th>\n      <td>i: ${Math.trunc(s)}, </td>\n      <td>j: ${Math.trunc(r)}</td>\n      `,this.debug._mapCoord.innerHTML=`\n      <th scope="row">map: </th>\n      <td>i: ${Math.trunc(t.containerPoint.x)}, </td>\n      <td>j: ${Math.trunc(t.containerPoint.y)}</td>\n      `,this.debug._gcrsCoord.innerHTML=`\n      <th scope="row">gcrs: </th>\n      <td>lon: ${t.latlng.lng.toFixed(6)}, </td>\n      <td>lat: ${t.latlng.lat.toFixed(6)}</td>\n      `,this.debug._tcrsCoord.innerHTML=`\n      <th scope="row">tcrs: </th>\n      <td>x: ${Math.trunc(i.x)}, </td>\n      <td>y: ${Math.trunc(i.y)}</td>\n      `,this.debug._tileMatrixCoord.innerHTML=`\n      <th scope="row">tilematrix: </th>\n      <td>column: ${Math.trunc(i.x/a)}, </td>\n      <td>row: ${Math.trunc(i.y/a)}</td>\n      `,this.debug._pcrsCoord.innerHTML=`\n      <th scope="row">pcrs: </th>\n      <td>easting: ${n.x.toFixed(2)}, </td>\n      <td>northing: ${n.y.toFixed(2)}</td>\n      `}}),E=function(t){return new A(t)},C=L.GridLayer.extend({initialize:function(t){L.setOptions(this,t),L.GridLayer.prototype.initialize.call(this,this._map)},createTile:function(t){let e=L.DomUtil.create("div","mapml-debug-tile");return e.setAttribute("col",t.x),e.setAttribute("row",t.y),e.setAttribute("zoom",t.z),e.innerHTML=[`col: ${t.x}`,`row: ${t.y}`,`zoom: ${t.z}`].join(", "),e.style.outline="1px dashed red",e}}),S=function(t){return new C(t)},T=L.LayerGroup.extend({initialize:function(t){L.setOptions(this,t),L.LayerGroup.prototype.initialize.call(this,this._map,t)},onAdd:function(t){t.on("overlayremove",this._mapLayerUpdate,this),t.on("overlayadd",this._mapLayerUpdate,this);let e=t.options.crs.transformation.transform(L.point(0,0),t.options.crs.scale(0));this._centerVector=L.circle(t.options.crs.pointToLatLng(e,0),{radius:250}),this._centerVector.bindTooltip("Projection Center"),this._addBounds(t)},onRemove:function(t){this.clearLayers()},_addBounds:function(t){let e=Object.keys(t._layers),i=t._layers,o=["#FF5733","#8DFF33","#3397FF","#E433FF","#F3FF33"],n=0;this.addLayer(this._centerVector);for(let t of e)if(i[t].layerBounds){let e=[i[t].layerBounds.min,L.point(i[t].layerBounds.max.x,i[t].layerBounds.min.y),i[t].layerBounds.max,L.point(i[t].layerBounds.min.x,i[t].layerBounds.max.y)],a=P(e,{color:o[n%o.length],weight:2,opacity:1,fillOpacity:.01,fill:!0});i[t].options._leafletLayer&&a.bindTooltip(i[t].options._leafletLayer._title,{sticky:!0}),this.addLayer(a),n++}if(t.totalLayerBounds){let e=[t.totalLayerBounds.min,L.point(t.totalLayerBounds.max.x,t.totalLayerBounds.min.y),t.totalLayerBounds.max,L.point(t.totalLayerBounds.min.x,t.totalLayerBounds.max.y)],i=P(e,{color:"#808080",weight:5,opacity:.5,fill:!1});this.addLayer(i)}},_mapLayerUpdate:function(t){this.clearLayers(),this._addBounds(t.target)}}),z=function(t){return new T(t)},k=L.Path.extend({options:{className:"mapml-debug-extent"},initialize:function(t,e){this._locations=t,L.setOptions(this,e)},_project:function(){this._rings=[];let t=this._map.options.crs.scale(this._map.getZoom()),e=this._map;for(let i=0;i<this._locations.length;i++){let o=e.options.crs.transformation.transform(this._locations[i],t);this._rings.push(L.point(o.x,o.y)._subtract(e.getPixelOrigin()))}this._parts=[this._rings]},_update:function(){this._map&&this._renderer._updatePoly(this,!0)}}),P=function(t,e){return new k(t,e)},w=L.Handler.extend({addHooks:function(){L.setOptions(this,{mapEl:this._map.options.mapEl}),L.DomEvent.on(this._map,"click",this._queryTopLayer,this),L.DomEvent.on(this._map,"keypress",this._queryTopLayerAtMapCenter,this)},removeHooks:function(){L.DomEvent.off(this._map,"click",this._queryTopLayer,this),L.DomEvent.on(this._map,"keypress",this._queryTopLayerAtMapCenter,this)},_getTopQueryableLayer:function(){for(var t=this.options.mapEl.layers,e=t.length-1;e>=0;e--){var i=t[e]._layer;if(t[e].checked&&i.queryable)return i}},_queryTopLayerAtMapCenter:function(t){setTimeout(()=>{!this._map.isFocused||this._map._popupClosed||" "!==t.originalEvent.key&&13!=+t.originalEvent.keyCode?delete this._map._popupClosed:this._map.fire("click",{latlng:this._map.getCenter(),layerPoint:this._map.latLngToLayerPoint(this._map.getCenter()),containerPoint:this._map.latLngToContainerPoint(this._map.getCenter())})},0)},_queryTopLayer:function(t){var e=this._getTopQueryableLayer();e&&this._query(t,e)},_query(t,e){var i={},o=e.getQueryTemplates()[0],n=t.target.getZoom(),a=this._map,s=e.crs,r=a.options.crs.options.crs.tile.bounds.max.x,l=e._container,m={autoClose:!1,autoPan:!0,maxHeight:.5*a.getSize().y-50},u=function(t){return s.transformation.untransform(t,s.scale(n))},p=function(t){return s.unproject(s.transformation.untransform(t,s.scale(n)),n)},c=s.latLngToPoint(t.latlng,n),h=c.divideBy(r).floor(),d=new L.Bounds(c.divideBy(r).floor().multiplyBy(r),c.divideBy(r).ceil().multiplyBy(r));for(var _ in i[o.query.tilei]=c.x.toFixed()-h.x*r,i[o.query.tilej]=c.y.toFixed()-h.y*r,i[o.query.mapi]=a.getSize().divideBy(2).x.toFixed(),i[o.query.mapj]=a.getSize().divideBy(2).y.toFixed(),i[o.query.pixelleft]=s.pointToLatLng(c,n).lng,i[o.query.pixeltop]=s.pointToLatLng(c,n).lat,i[o.query.pixelright]=s.pointToLatLng(c.add([1,1]),n).lng,i[o.query.pixelbottom]=s.pointToLatLng(c.add([1,1]),n).lat,i[o.query.column]=h.x,i[o.query.row]=h.y,i[o.query.x]=c.x.toFixed(),i[o.query.y]=c.y.toFixed(),i[o.query.easting]=u(c).x,i[o.query.northing]=u(c).y,i[o.query.longitude]=p(c).lng,i[o.query.latitude]=p(c).lat,i[o.query.zoom]=n,i[o.query.width]=a.getSize().x,i[o.query.height]=a.getSize().y,i[o.query.mapbottom]=u(c.add(a.getSize().divideBy(2))).y,i[o.query.mapleft]=u(c.subtract(a.getSize().divideBy(2))).x,i[o.query.maptop]=u(c.subtract(a.getSize().divideBy(2))).y,i[o.query.mapright]=u(c.add(a.getSize().divideBy(2))).x,i[o.query.tilebottom]=u(d.max).y,i[o.query.tileleft]=u(d.min).x,i[o.query.tiletop]=u(d.min).y,i[o.query.tileright]=u(d.max).x,o.query)["mapi","mapj","tilei","tilej","row","col","x","y","easting","northing","longitude","latitude","width","height","zoom","mapleft","mapright",",maptop","mapbottom","tileleft","tileright","tiletop","tilebottom","pixeltop","pixelbottom","pixelleft","pixelright"].indexOf(_)<0&&(i[_]=o.query[_]);let y,g=this._map.project(t.latlng),f=this._map.options.crs.scale(this._map.getZoom()),b=this._map.options.crs.transformation.untransform(g,f);o.layerBounds.contains(b)&&fetch(L.Util.template(o.template,i),{redirect:"follow"}).then(t=>{if(y=t.headers.get("Content-Type"),t.status>=200&&t.status<300)return t.text();throw new Error(t.status)}).then(i=>y.startsWith("text/mapml")?function(t,i){let o=(new DOMParser).parseFromString(t,"application/xml");for(let t of o.querySelectorAll("map-feature"))if(!t.querySelector("map-geometry")){let e=document.createElement("map-geometry"),o=document.createElement("map-point"),n=document.createElement("map-coordinates");e.setAttribute("cs","gcrs"),n.innerHTML=`${i.lng} ${i.lat}`,o.appendChild(n),e.appendChild(o),t.appendChild(e)}let n=M.mapMlFeatures(o,{renderer:M.featureRenderer(),pane:l,projection:a.options.projection,_leafletLayer:e,query:!0,static:!0});n.addTo(a);let s=L.DomUtil.create("div","mapml-popup-content"),r=L.DomUtil.create("iframe");r.style="border: none",r.srcdoc=o.querySelector("map-feature map-properties").innerHTML,r.setAttribute("sandbox","allow-same-origin allow-forms"),s.appendChild(r),e._totalFeatureCount=o.querySelectorAll("map-feature").length,e.bindPopup(s,m).openPopup(i),e.on("popupclose",function(){a.removeLayer(n)}),n.showPaginationFeature({i:0,popup:e._popup})}(i,t.latlng):function(t,e,i){let o=L.DomUtil.create("div","mapml-popup-content"),n=L.DomUtil.create("iframe");n.style="border: none",n.srcdoc=t,n.setAttribute("sandbox","allow-same-origin allow-forms"),o.appendChild(n),e.bindPopup(o,m).openPopup(i)}(i,e,t.latlng)).catch(t=>{console.log("Looks like there was a problem. Status: "+t.message)})}}),I=L.Handler.extend({_touchstart:L.Browser.msPointer?"MSPointerDown":L.Browser.pointer?"pointerdown":"touchstart",initialize:function(t){L.Handler.prototype.initialize.call(this,t),this._items=[{text:M.options.locale.cmBack+" (<kbd>B</kbd>)",callback:this._goBack},{text:M.options.locale.cmForward+" (<kbd>F</kbd>)",callback:this._goForward},{text:M.options.locale.cmReload+" (<kbd>R</kbd>)",callback:this._reload},{spacer:"-"},{text:M.options.locale.cmToggleControls+" (<kbd>T</kbd>)",callback:this._toggleControls},{text:M.options.locale.cmCopyCoords+" (<kbd>C</kbd>)<span></span>",callback:this._copyCoords,hideOnSelect:!1,popup:!0,submenu:[{text:"tile",callback:this._copyTile},{text:"tilematrix",callback:this._copyTileMatrix},{spacer:"-"},{text:"map",callback:this._copyMap},{spacer:"-"},{text:"tcrs",callback:this._copyTCRS},{text:"pcrs",callback:this._copyPCRS},{text:"gcrs",callback:this._copyGCRS},{spacer:"-"},{text:M.options.locale.cmCopyAll,callback:this._copyAllCoords}]},{text:M.options.locale.cmToggleDebug+" (<kbd>D</kbd>)",callback:this._toggleDebug},{text:M.options.locale.cmCopyMapML+" (<kbd>M</kbd>)",callback:this._copyMapML},{text:M.options.locale.cmViewSource+" (<kbd>V</kbd>)",callback:this._viewSource}],this._layerItems=[{text:M.options.locale.lmZoomToLayer+" (<kbd>Z</kbd>)",callback:this._zoomToLayer},{text:M.options.locale.lmCopyExtent+" (<kbd>C</kbd>)",callback:this._copyLayerExtent}],this._mapMenuVisible=!1,this._keyboardEvent=!1,this._container=L.DomUtil.create("div","mapml-contextmenu",t._container),this._container.setAttribute("hidden","");for(let t=0;t<6;t++)this._items[t].el=this._createItem(this._container,this._items[t]);this._coordMenu=L.DomUtil.create("div","mapml-contextmenu mapml-submenu",this._container),this._coordMenu.id="mapml-copy-submenu",this._coordMenu.setAttribute("hidden",""),this._clickEvent=null;for(let t=0;t<this._items[5].submenu.length;t++)this._createItem(this._coordMenu,this._items[5].submenu[t],t);this._items[6].el=this._createItem(this._container,this._items[6]),this._items[7].el=this._createItem(this._container,this._items[7]),this._items[8].el=this._createItem(this._container,this._items[8]),this._layerMenu=L.DomUtil.create("div","mapml-contextmenu mapml-layer-menu",t._container),this._layerMenu.setAttribute("hidden","");for(let t=0;t<this._layerItems.length;t++)this._createItem(this._layerMenu,this._layerItems[t]);L.DomEvent.on(this._container,"click",L.DomEvent.stop).on(this._container,"mousedown",L.DomEvent.stop).on(this._container,"dblclick",L.DomEvent.stop).on(this._container,"contextmenu",L.DomEvent.stop).on(this._layerMenu,"click",L.DomEvent.stop).on(this._layerMenu,"mousedown",L.DomEvent.stop).on(this._layerMenu,"dblclick",L.DomEvent.stop).on(this._layerMenu,"contextmenu",L.DomEvent.stop)},addHooks:function(){var t=this._map.getContainer();L.DomEvent.on(t,"mouseleave",this._hide,this).on(document,"keydown",this._onKeyDown,this),L.Browser.touch&&L.DomEvent.on(document,this._touchstart,this._hide,this),this._map.on({contextmenu:this._show,mousedown:this._hide,zoomstart:this._hide},this)},removeHooks:function(){var t=this._map.getContainer();L.DomEvent.off(t,"mouseleave",this._hide,this).off(document,"keydown",this._onKeyDown,this),L.Browser.touch&&L.DomEvent.off(document,this._touchstart,this._hide,this),this._map.off({contextmenu:this._show,mousedown:this._hide,zoomstart:this._hide},this)},_copyLayerExtent:function(t){let e=t instanceof KeyboardEvent?this._map.contextMenu:this.contextMenu,i=e._layerClicked.layer._layerEl,o=i.extent.topLeft.pcrs,n=i.extent.bottomRight.pcrs,a=`<map-meta name="extent" content="top-left-easting=${o.horizontal}, top-left-northing=${o.vertical}, bottom-right-easting=${n.horizontal}, bottom-right-northing=${n.vertical}"></map-meta>`;e._copyData(a)},_zoomToLayer:function(t){(t instanceof KeyboardEvent?this._map.contextMenu:this.contextMenu)._layerClicked.layer._layerEl.focus()},_goForward:function(t){(t instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl).forward()},_goBack:function(t){(t instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl).back()},_reload:function(t){(t instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl).reload()},_toggleControls:function(t){(t instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl)._toggleControls()},_copyMapML:function(t){let e=t instanceof KeyboardEvent?this._map.contextMenu:this.contextMenu,i=t instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl;e._copyData(i.outerHTML.replace(/<div class="mapml-web-map">.*?<\/div>|<style>\[is="web-map"].*?<\/style>|<style>mapml-viewer.*?<\/style>/gm,""))},_viewSource:function(t){(t instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl).viewSource()},_toggleDebug:function(t){(t instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl).toggleDebug()},_copyCoords:function(t){(this.contextMenu?this.contextMenu:this)._showCoordMenu(t)},_copyData:function(t){const e=document.createElement("textarea");e.value=t,document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)},_copyGCRS:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent;this.contextMenu._copyData(`z:${e.zoom}, lon :${i.latlng.lng.toFixed(6)}, lat:${i.latlng.lat.toFixed(6)}`)},_copyTCRS:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent,o=e._map.project(i.latlng);this.contextMenu._copyData(`z:${e.zoom}, x:${o.x}, y:${o.y}`)},_copyTileMatrix:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent,o=e._map.project(i.latlng),n=e._map.options.crs.options.crs.tile.bounds.max.x;this.contextMenu._copyData(`z:${e.zoom}, column:${Math.trunc(o.x/n)}, row:${Math.trunc(o.y/n)}`)},_copyPCRS:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent,o=e._map.project(i.latlng),n=e._map.options.crs.scale(+e.zoom),a=e._map.options.crs.transformation.untransform(o,n);this.contextMenu._copyData(`z:${e.zoom}, easting:${a.x.toFixed(2)}, northing:${a.y.toFixed(2)}`)},_copyTile:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent,o=e._map.options.crs.project(i.latlng),n=e._map.options.crs.options.crs.tile.bounds.max.x,a=o.x%n,s=o.y%n;a<0&&(a+=n),s<0&&(s+=n),this.contextMenu._copyData(`z:${e.zoom}, i:${Math.trunc(a)}, j:${Math.trunc(s)}`)},_copyMap:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent;this.contextMenu._copyData(`z:${e.zoom}, i:${Math.trunc(i.containerPoint.x)}, j:${Math.trunc(i.containerPoint.y)}`)},_copyAllCoords:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent,o=e._map.project(i.latlng),n=e._map.options.crs.options.crs.tile.bounds.max.x,a=o.x%n,s=o.y%n,r=e._map.options.crs.scale(+e.zoom),l=e._map.options.crs.transformation.untransform(o,r),m=`z:${e.zoom}\n`;m+=`tile: i:${Math.trunc(a)}, j:${Math.trunc(s)}\n`,m+=`tilematrix: column:${Math.trunc(o.x/n)}, row:${Math.trunc(o.y/n)}\n`,m+=`map: i:${Math.trunc(i.containerPoint.x)}, j:${Math.trunc(i.containerPoint.y)}\n`,m+=`tcrs: x:${Math.trunc(o.x)}, y:${Math.trunc(o.y)}\n`,m+=`pcrs: easting:${l.x.toFixed(2)}, northing:${l.y.toFixed(2)}\n`,m+=`gcrs: lon :${i.latlng.lng.toFixed(6)}, lat:${i.latlng.lat.toFixed(6)}`,this.contextMenu._copyData(m)},_createItem:function(t,e,i){if(e.spacer)return this._createSeparator(t,i);var o=this._insertElementAt("button","mapml-contextmenu-item",t,i),n=this._createEventHandler(o,e.callback,e.context,e.hideOnSelect);return o.innerHTML=""+e.text,o.setAttribute("type","button"),o.classList.add("mapml-button"),e.popup&&(o.setAttribute("aria-haspopup","true"),o.setAttribute("aria-expanded","false"),o.setAttribute("aria-controls","mapml-copy-submenu")),L.DomEvent.on(o,"mouseover",this._onItemMouseOver,this).on(o,"mouseout",this._onItemMouseOut,this).on(o,"mousedown",L.DomEvent.stopPropagation).on(o,"click",n),L.Browser.touch&&L.DomEvent.on(o,this._touchstart,L.DomEvent.stopPropagation),L.Browser.pointer||L.DomEvent.on(o,"click",this._onItemMouseOut,this),{id:L.Util.stamp(o),el:o,callback:n}},_createSeparator:function(t,e){let i=this._insertElementAt("div","mapml-contextmenu-separator",t,e);return{id:L.Util.stamp(i),el:i}},_createEventHandler:function(t,e,i,o){let n=this;return o=void 0===o||o,function(a){let s=n._map,r=n._showLocation.containerPoint,l=s.containerPointToLayerPoint(r),m={containerPoint:r,layerPoint:l,latlng:s.layerPointToLatLng(l),relatedTarget:n._showLocation.relatedTarget};o&&n._hide(),e&&e.call(i||s,m),n._map.fire("contextmenu.select",{contextmenu:n,el:t})}},_insertElementAt:function(t,e,i,o){let n,a=document.createElement(t);return a.className=e,void 0!==o&&(n=i.children[o]),n?i.insertBefore(a,n):i.appendChild(a),a},_show:function(t){this._mapMenuVisible&&this._hide(),this._clickEvent=t;let e=t.originalEvent.target;if(e.closest("fieldset")){if(!(e=e.closest("fieldset").querySelector("span")).layer.validProjection)return;this._layerClicked=e,this._showAtPoint(t.containerPoint,t,this._layerMenu)}else(e.classList.contains("leaflet-container")||e.classList.contains("mapml-debug-extent")||"path"===e.tagName)&&(this._layerClicked=void 0,this._showAtPoint(t.containerPoint,t,this._container));if(0===t.originalEvent.button||-1===t.originalEvent.button)if(this._keyboardEvent=!0,this._layerClicked){let t=document.activeElement;this._elementInFocus=t.shadowRoot.activeElement,this._layerMenuTabs=1,this._layerMenu.firstChild.focus()}else this._container.firstChild.focus()},_showAtPoint:function(t,e,i){if(this._items.length){let o=L.extend(e||{},{contextmenu:this});this._showLocation={containerPoint:t},e&&e.relatedTarget&&(this._showLocation.relatedTarget=e.relatedTarget),this._setPosition(t,i),this._mapMenuVisible||(i.removeAttribute("hidden"),this._mapMenuVisible=!0),this._map.fire("contextmenu.show",o)}},_hide:function(){this._mapMenuVisible&&(this._mapMenuVisible=!1,this._container.setAttribute("hidden",""),this._coordMenu.setAttribute("hidden",""),this._layerMenu.setAttribute("hidden",""),this._map.fire("contextmenu.hide",{contextmenu:this}),setTimeout(()=>this._map._container.focus(),0))},_setPosition:function(t,e){let i,o=this._map.getSize(),n=this._getElementSize(e);this._map.options.contextmenuAnchor&&(i=L.point(this._map.options.contextmenuAnchor),t=t.add(i)),e._leaflet_pos=t,t.x+n.x>o.x?(e.style.left="auto",e.style.right=Math.min(Math.max(o.x-t.x,0),o.x-n.x-1)+"px"):(e.style.left=Math.max(t.x,0)+"px",e.style.right="auto"),t.y+n.y>o.y?(e.style.top="auto",e.style.bottom=Math.min(Math.max(o.y-t.y,0),o.y-n.y-1)+"px"):(e.style.top=Math.max(t.y,0)+"px",e.style.bottom="auto")},_getElementSize:function(t){let e=this._size;return e&&!this._sizeChanged||(e={},t.style.left="-999999px",t.style.right="auto",e.x=t.offsetWidth,e.y=t.offsetHeight,t.style.left="auto",this._sizeChanged=!1),e},_focusOnLayerControl:function(){this._mapMenuVisible=!1,delete this._layerMenuTabs,this._layerMenu.setAttribute("hidden",""),this._elementInFocus?this._elementInFocus.focus():this._layerClicked.parentElement.firstChild.focus(),delete this._elementInFocus},_onKeyDown:function(t){if(!this._mapMenuVisible)return;let e=t.keyCode,i=t.path||t.composedPath();switch(13===e&&t.preventDefault(),!this._layerMenuTabs||9!==e&&27!==e?16===e||9===e||!this._layerClicked&&67===e||i[0].innerText===M.options.locale.cmCopyCoords+" (C)"||this._hide():(t.shiftKey?this._layerMenuTabs-=1:this._layerMenuTabs+=1,0!==this._layerMenuTabs&&3!==this._layerMenuTabs&&27!==e||(L.DomEvent.stop(t),this._focusOnLayerControl())),e){case 13:case 32:this._map._container.parentNode.activeElement.parentNode.classList.contains("mapml-contextmenu")&&this._map._container.parentNode.activeElement.click();break;case 66:this._goBack(t);break;case 67:this._layerClicked?this._copyLayerExtent(t):this._copyCoords({latlng:this._map.getCenter()});break;case 68:this._toggleDebug(t);break;case 77:this._copyMapML(t);break;case 70:this._goForward(t);break;case 82:this._reload(t);break;case 84:this._toggleControls(t);break;case 86:this._viewSource(t);break;case 90:this._layerClicked&&this._zoomToLayer(t)}},_showCoordMenu:function(t){let e=this._map.getSize(),i=this._clickEvent,o=this._coordMenu;this._items[5].el.el.setAttribute("aria-expanded","true"),o.removeAttribute("hidden"),i.containerPoint.x+160+80>e.x?(o.style.left="auto",o.style.right="160px"):(o.style.left="160px",o.style.right="auto"),i.containerPoint.y+160>e.y?(o.style.top="auto",o.style.bottom="20px"):(o.style.top="100px",o.style.bottom="auto"),this._keyboardEvent&&o.firstChild.focus()},_hideCoordMenu:function(t){if(t.srcElement.parentElement.classList.contains("mapml-submenu")||t.srcElement.innerText===M.options.locale.cmCopyCoords+" (C)")return;let e=this._coordMenu;this._items[5].el.el.setAttribute("aria-expanded","false"),e.setAttribute("hidden","")},_onItemMouseOver:function(t){L.DomUtil.addClass(t.target||t.srcElement,"over"),t.srcElement.innerText===M.options.locale.cmCopyCoords+" (C)"&&this._showCoordMenu(t)},_onItemMouseOut:function(t){L.DomUtil.removeClass(t.target||t.srcElement,"over"),this._hideCoordMenu(t)}}),B={convertAndFormatPCRS:function(t,e){if(!t||!e)return{};let i=[],o=[],n=[],a=[],s=e.options.crs.options.crs.tile.bounds.max.y;for(let r=0;r<e.options.crs.options.resolutions.length;r++){let l=e.options.crs.scale(r),m=e.options.crs.transformation.transform(t.min,l),u=e.options.crs.transformation.transform(t.max,l);i.push({horizontal:m.x,vertical:u.y}),o.push({horizontal:u.x,vertical:m.y}),n.push({horizontal:i[r].horizontal/s,vertical:i[r].vertical/s}),a.push({horizontal:o[r].horizontal/s,vertical:o[r].vertical/s})}let r=e.options.crs.unproject(t.min),l=e.options.crs.unproject(t.max),m={topLeft:{horizontal:r.lng,vertical:l.lat},bottomRight:{horizontal:l.lng,vertical:r.lat}},u={topLeft:{horizontal:t.min.x,vertical:t.max.y},bottomRight:{horizontal:t.max.x,vertical:t.min.y}};return{topLeft:{tcrs:i,tilematrix:n,gcrs:m.topLeft,pcrs:u.topLeft},bottomRight:{tcrs:o,tilematrix:a,gcrs:m.bottomRight,pcrs:u.bottomRight},projection:e.options.projection}},extractInputBounds:function(t){if(!t)return;let e=t.values,i=t.projection||n,o=0,a="TILEMATRIX",s=this[i].options.crs.tilematrix.bounds(0),r=0,l=this[i].options.resolutions.length-1,m=!1,u=0;t.zoomBounds||(t.zoomBounds={},t.zoomBounds.min=0,t.zoomBounds.max=l);for(let t=0;t<e.length;t++)switch(e[t].getAttribute("type")){case"zoom":r=+e[t].getAttribute("min"),l=+(e[t].hasAttribute("max")?e[t].getAttribute("max"):l),o=+e[t].getAttribute("value");break;case"location":if(!e[t].getAttribute("max")||!e[t].getAttribute("min"))continue;let i=+e[t].getAttribute("max"),n=+e[t].getAttribute("min");switch(e[t].getAttribute("axis").toLowerCase()){case"x":case"longitude":case"column":case"easting":a=M.axisToCS(e[t].getAttribute("axis").toLowerCase()),s.min.x=n,s.max.x=i,u++;break;case"y":case"latitude":case"row":case"northing":a=M.axisToCS(e[t].getAttribute("axis").toLowerCase()),s.min.y=n,s.max.y=i,u++}}return u>=2&&(m=!0),{zoomBounds:{minZoom:+t.zoomBounds.min,maxZoom:+t.zoomBounds.max,minNativeZoom:r,maxNativeZoom:l},bounds:s=!m&&t.extentPCRSFallback&&t.extentPCRSFallback.bounds?t.extentPCRSFallback.bounds:m?this.boundsToPCRSBounds(s,o,i,a):this[i].options.crs.pcrs.bounds}},axisToCS:function(t){try{switch(t.toLowerCase()){case"row":case"column":return"TILEMATRIX";case"i":case"j":return["MAP","TILE"];case"x":case"y":return"TCRS";case"latitude":case"longitude":return"GCRS";case"northing":case"easting":return"PCRS";default:return"TILEMATRIX"}}catch(t){return}},csToAxes:function(t){try{switch(t.toLowerCase()){case"tilematrix":return["column","row"];case"map":case"tile":return["i","j"];case"tcrs":return["x","y"];case"gcrs":return["longitude","latitude"];case"pcrs":return["easting","northing"]}}catch(t){return}},axisToXY:function(t){try{switch(t.toLowerCase()){case"i":case"column":case"longitude":case"x":case"easting":return"x";case"row":case"j":case"latitude":case"y":case"northing":return"y";default:return}}catch(t){return}},convertPCRSBounds:function(t,e,i,o){if(t&&(e||0===e)&&Number.isFinite(+e)&&i&&o)switch(i="string"==typeof i?M[i]:i,o.toUpperCase()){case"PCRS":return t;case"TCRS":case"TILEMATRIX":let n=i.transformation.transform(t.min,i.scale(+e)),a=i.transformation.transform(t.max,i.scale(+e));if("TCRS"===o.toUpperCase())return L.bounds(n,a);let s=i.options.crs.tile.bounds.max.x;return L.bounds(L.point(n.x/s,n.y/s),L.point(a.x/s,a.y/s));case"GCRS":let r=i.unproject(t.min),l=i.unproject(t.max);return L.bounds(L.point(r.lng,r.lat),L.point(l.lng,l.lat));default:return}},pointToPCRSPoint:function(t,e,i,o){if(!t||!e&&0!==e||!Number.isFinite(+e)||!o||!i)return;let n=(i="string"==typeof i?M[i]:i).options.crs.tile.bounds.max.x;switch(o.toUpperCase()){case"TILEMATRIX":return M.pixelToPCRSPoint(L.point(t.x*n,t.y*n),e,i);case"PCRS":return t;case"TCRS":return M.pixelToPCRSPoint(t,e,i);case"GCRS":return i.project(L.latLng(t.y,t.x));default:return}},pixelToPCRSPoint:function(t,e,i){if(t&&(e||0===e)&&Number.isFinite(+e)&&i)return(i="string"==typeof i?M[i]:i).transformation.untransform(t,i.scale(e))},boundsToPCRSBounds:function(t,e,i,o){if(t&&t.max&&t.min&&(e||0===e)&&Number.isFinite(+e)&&i&&o)return i="string"==typeof i?M[i]:i,L.bounds(M.pointToPCRSPoint(t.min,e,i,o),M.pointToPCRSPoint(t.max,e,i,o))},pixelToPCRSBounds:function(t,e,i){if(t&&t.max&&t.min&&(e||0===e)&&Number.isFinite(+e)&&i)return i="string"==typeof i?M[i]:i,L.bounds(M.pixelToPCRSPoint(t.min,e,i),M.pixelToPCRSPoint(t.max,e,i))},metaContentToObject:function(t){if(!t||t instanceof Object)return{};let e={},i=t.split(/\s+/).join("").split(",");for(let t=0;t<i.length;t++){let o=i[t].split("=");2===o.length&&(e[o[0]]=o[1])}return""!==e&&1===i[0].split("=").length&&(e.content=i[0]),e},coordsToArray:function(t){for(var e=1,i=[],o=t.split(",");e<o.length;e+=2)i.push([parseInt(o[e-1]),parseInt(o[e])]);return i},parseStylesheetAsHTML:function(t,e,i){if(i instanceof Element&&t&&t.querySelector("map-link[rel=stylesheet],map-style")){if(e instanceof Element)e=e.getAttribute("href")?e.getAttribute("href"):document.URL;else if(!e||""===e||e instanceof Object)return;for(var o=[],n=t.querySelectorAll("map-link[rel=stylesheet],map-style"),a=0;a<n.length;a++)if("MAP-LINK"===n[a].nodeName.toUpperCase()){var s=n[a].hasAttribute("href")?new URL(n[a].getAttribute("href"),e).href:null;if(s&&!i.querySelector("link[href='"+s+"']")){var r=document.createElement("link");r.setAttribute("href",s),r.setAttribute("rel","stylesheet"),o.push(r)}}else{var l=document.createElement("style");l.textContent=n[a].textContent,o.push(l)}for(var m=o.length-1;m>=0;m--)i.insertAdjacentElement("afterbegin",o[m])}},splitCoordinate:function(t,e,i){var o=[];t.split(/\s+/gim).forEach(M.parseNumber,o),this.push(o)},parseNumber:function(t,e,i){this.push(parseFloat(t))},handleLink:function(t,e){let i,o,n,a=!1,s=e._map;if("text/html"===t.type&&"_blank"!==t.target)t.target="_top";else if("text/html"!==t.type&&t.url.includes("#")){let e=t.url.split("#"),o=e[1].split(",");i={z:o[0]||0,lng:o[1]||0,lat:o[2]||0},a=!e[0],["/",".","#"].includes(t.url[0])&&(t.target="_self")}if(a)i&&!t.inPlace&&a&&(e._map.options.mapEl.zoomTo(+i.lat,+i.lng,+i.z),n&&(o.opacity=n));else{let a=!1;switch((o=document.createElement("layer-")).setAttribute("src",t.url),o.setAttribute("checked",""),t.target){case"_blank":"text/html"===t.type?window.open(t.url):(s.options.mapEl.appendChild(o),a=!0);break;case"_parent":for(let t of s.options.mapEl.querySelectorAll("layer-"))t._layer!==e&&s.options.mapEl.removeChild(t);s.options.mapEl.appendChild(o),s.options.mapEl.removeChild(e._layerEl),a=!0;break;case"_top":window.location.href=t.url;break;default:n=e._layerEl.opacity,e._layerEl.insertAdjacentElement("beforebegin",o),s.options.mapEl.removeChild(e._layerEl),a=!0}!t.inPlace&&a&&L.DomEvent.on(o,"extentload",function e(r){a&&["_parent","_self"].includes(t.target)&&1===o.parentElement.querySelectorAll("layer-").length&&(o.parentElement.projection=o._layer.getProjection()),o.extent&&(i?o.parentElement.zoomTo(+i.lat,+i.lng,+i.z):o.focus(),L.DomEvent.off(o,"extentload",e)),n&&(o.opacity=n),s.getContainer().focus()})}},gcrsToTileMatrix:function(t){let e=t._map.project(t._map.getCenter()),i=t._map.options.crs.options.crs.tile.bounds.max.y;return[Math.trunc(e.x/i),Math.trunc(e.y/i)]}},D=L.Control.extend({options:{position:"topleft"},onAdd:function(t){let e=L.DomUtil.create("div","mapml-reload-button leaflet-bar"),i=L.DomUtil.create("button","mapml-reload-button",e);return i.innerHTML="<span aria-hidden='true'>&#x021BA</span>",i.title=M.options.locale.cmReload,i.setAttribute("type","button"),i.classList.add("mapml-button"),i.setAttribute("aria-label","Reload"),L.DomEvent.disableClickPropagation(i),L.DomEvent.on(i,"click",L.DomEvent.stop),L.DomEvent.on(i,"click",this._goReload,this),this._reloadButton=i,this._updateDisabled(),t.on("moveend",this._updateDisabled,this),e},onRemove:function(t){t.off("moveend",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_goReload:function(t){!this._disabled&&this._map.options.mapEl._history.length>1&&this._map.options.mapEl.reload()},_updateDisabled:function(){setTimeout(()=>{L.DomUtil.removeClass(this._reloadButton,"leaflet-disabled"),this._reloadButton.setAttribute("aria-disabled","false"),this._map&&(this._disabled||this._map.options.mapEl._history.length<=1)&&(L.DomUtil.addClass(this._reloadButton,"leaflet-disabled"),this._reloadButton.setAttribute("aria-disabled","true"))},0)}}),q=function(t){return new D(t)},F=L.Control.extend({options:{position:"topleft",title:{false:"View fullscreen",true:"Exit fullscreen"}},onAdd:function(t){var e=L.DomUtil.create("div","leaflet-control-fullscreen leaflet-bar leaflet-control");return this.link=L.DomUtil.create("a","leaflet-control-fullscreen-button leaflet-bar-part",e),this.link.href="#",this.link.setAttribute("role","button"),this._map=t,this._map.on("fullscreenchange",this._toggleTitle,this),this._toggleTitle(),L.DomEvent.on(this.link,"click",this._click,this),e},onRemove:function(t){t.off("fullscreenchange",this._toggleTitle,this)},_click:function(t){L.DomEvent.stopPropagation(t),L.DomEvent.preventDefault(t),this._map.toggleFullscreen(this.options)},_toggleTitle:function(){this.link.title=this.options.title[this._map.isFullscreen()]}});L.Map.include({isFullscreen:function(){return this._isFullscreen||!1},toggleFullscreen:function(t){var e=this.getContainer().getRootNode().host,i="DIV"===e.nodeName?e.parentElement:e;this.isFullscreen()?t&&t.pseudoFullscreen?this._disablePseudoFullscreen(i):document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.msExitFullscreen?document.msExitFullscreen():this._disablePseudoFullscreen(i):t&&t.pseudoFullscreen?this._enablePseudoFullscreen(i):i.requestFullscreen?i.requestFullscreen():i.mozRequestFullScreen?i.mozRequestFullScreen():i.webkitRequestFullscreen?i.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):i.msRequestFullscreen?i.msRequestFullscreen():this._enablePseudoFullscreen(i)},_enablePseudoFullscreen:function(t){L.DomUtil.addClass(t,"leaflet-pseudo-fullscreen"),this._setFullscreen(!0),this.fire("fullscreenchange")},_disablePseudoFullscreen:function(t){L.DomUtil.removeClass(t,"leaflet-pseudo-fullscreen"),this._setFullscreen(!1),this.fire("fullscreenchange")},_setFullscreen:function(t){this._isFullscreen=t;var e=this.getContainer().getRootNode().host;t?L.DomUtil.addClass(e,"mapml-fullscreen-on"):L.DomUtil.removeClass(e,"mapml-fullscreen-on"),this.invalidateSize()},_onFullscreenChange:function(t){var e=document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement,i=this.getContainer().getRootNode().host,o="DIV"===i.nodeName?i.parentElement:i;e!==o||this._isFullscreen?e!==o&&this._isFullscreen&&(this._setFullscreen(!1),this.fire("fullscreenchange")):(this._setFullscreen(!0),this.fire("fullscreenchange"))}}),L.Map.mergeOptions({fullscreenControl:!1}),L.Map.addInitHook(function(){var t;if(this.options.fullscreenControl&&(this.fullscreenControl=new F(this.options.fullscreenControl),this.addControl(this.fullscreenControl)),"onfullscreenchange"in document?t="fullscreenchange":"onmozfullscreenchange"in document?t="mozfullscreenchange":"onwebkitfullscreenchange"in document?t="webkitfullscreenchange":"onmsfullscreenchange"in document&&(t="MSFullscreenChange"),t){var e=L.bind(this._onFullscreenChange,this);this.whenReady(function(){L.DomEvent.on(document,t,e)}),this.on("unload",function(){L.DomEvent.off(document,t,e)})}});var R=function(t){return new F(t)},N=L.Layer.extend({onAdd:function(t){this._container=L.DomUtil.create("div","mapml-crosshair",t._container),this._container.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 100 100"><g stroke="#fff" stroke-linecap="round" stroke-linejoin="round"><circle cx="50.028" cy="50.219" r="3.923" stroke-width="2" color="currentColor" overflow="visible"/><path stroke-width="3" d="M4.973 54.424h31.768a4.204 4.204 0 1 0 0-8.409H4.973A4.203 4.203 0 0 0 .77 50.22a4.203 4.203 0 0 0 4.204 4.205z" color="currentColor" overflow="visible"/><path stroke-width="3" d="M54.232 5.165a4.204 4.204 0 1 0-8.408 0v31.767a4.204 4.204 0 1 0 8.408 0V5.165z"/><path stroke-width="3" d="M99.288 50.22a4.204 4.204 0 0 0-4.204-4.205H63.317a4.204 4.204 0 1 0 0 8.409h31.767a4.205 4.205 0 0 0 4.204-4.205zM45.823 95.274a4.204 4.204 0 1 0 8.409 0V63.506a4.204 4.204 0 1 0-8.409 0v31.768z" color="currentColor" overflow="visible"/></g></svg>',t.isFocused=!1,this._isQueryable=!1,t.on("layerchange layeradd layerremove overlayremove",this._toggleEvents,this),t.on("popupopen",this._isMapFocused,this),L.DomEvent.on(t._container,"keydown keyup mousedown",this._isMapFocused,this),this._addOrRemoveCrosshair()},onRemove:function(t){t.off("layerchange layeradd layerremove overlayremove",this._toggleEvents),t.off("popupopen",this._isMapFocused),L.DomEvent.off(t._container,"keydown keyup mousedown",this._isMapFocused)},_toggleEvents:function(){this._hasQueryableLayer()?this._map.on("viewreset move moveend",this._addOrRemoveCrosshair,this):this._map.off("viewreset move moveend",this._addOrRemoveCrosshair,this),this._addOrRemoveCrosshair()},_addOrRemoveCrosshair:function(t){this._hasQueryableLayer()?this._container.removeAttribute("hidden"):this._container.setAttribute("hidden","")},_addOrRemoveMapOutline:function(t){let e=this._map._container;this._map.isFocused&&!this._outline?this._outline=L.DomUtil.create("div","mapml-outline",e):!this._map.isFocused&&this._outline&&(L.DomUtil.remove(this._outline),delete this._outline)},_hasQueryableLayer:function(){let t=this._map.options.mapEl.layers;if(this._map.isFocused)for(let e of t)if(e.checked&&e._layer.queryable)return!0;return!1},_isMapFocused:function(t){if(!this._map._container.parentNode.activeElement)return void(this._map.isFocused=!1);let e=this._map._container.parentNode.activeElement.classList.contains("leaflet-container");e&&["keydown"].includes(t.type)&&t.shiftKey&&9===t.keyCode?this._map.isFocused=!1:this._map.isFocused=e&&["keyup","keydown"].includes(t.type),this._addOrRemoveMapOutline(),this._addOrRemoveCrosshair()}}),O=function(t){return new N(t)},U=L.Path.extend({initialize:function(t,e){this.type=t.tagName.toUpperCase(),"MAP-POINT"!==this.type&&"MAP-MULTIPOINT"!==this.type||(e.fillOpacity=1),e.wrappers.length>0&&(e=Object.assign(this._convertWrappers(e.wrappers),e)),L.setOptions(this,e),this.group=this.options.group,this.options.interactive=this.options.link||this.options.properties&&this.options.onEachFeature,this._parts=[],this._markup=t,this.options.zoom=t.getAttribute("zoom")||this.options.nativeZoom,this._convertMarkup(),(t.querySelector("map-span")||t.querySelector("map-a"))&&this._generateOutlinePoints(),this.isClosed=this._isClosed()},attachLinkHandler:function(t,e,i){let o,n=document.createElement("div"),a=document.createElement("p"),s=!1;n.classList.add("mapml-link-preview"),n.appendChild(a),t.classList.add("map-a"),e.visited&&t.classList.add("map-a-visited"),L.DomEvent.on(t,"mousedown",t=>o={x:t.clientX,y:t.clientY},this),L.DomEvent.on(t,"mouseup",n=>{if(0!==n.button)return;let a=!0,s=this.options._leafletLayer._layerEl.nextElementSibling;for(;s&&a;)s.tagName&&"LAYER-"===s.tagName.toUpperCase()&&(a=!(s.checked&&s._layer.queryable)),s=s.nextElementSibling;if(a&&o){L.DomEvent.stop(n),Math.sqrt(Math.pow(o.x-n.clientX,2)+Math.pow(o.y-n.clientY,2))<=5&&(e.visited=!0,t.setAttribute("stroke","#6c00a2"),t.classList.add("map-a-visited"),M.handleLink(e,i))}},this),L.DomEvent.on(t,"keypress",o=>{L.DomEvent.stop(o),13!==o.keyCode&&32!==o.keyCode||(e.visited=!0,t.setAttribute("stroke","#6c00a2"),t.classList.add("map-a-visited"),M.handleLink(e,i))},this),L.DomEvent.on(t,"mouseenter keyup",t=>{if(t.target!==t.currentTarget)return;s=!0;let i=document.createElement("a"),o=this._map.getContainer().clientWidth;for(i.href=e.url,a.innerHTML=i.href,this._map.getContainer().appendChild(n);a.clientWidth>o/2;)a.innerHTML=a.innerHTML.substring(0,a.innerHTML.length-5)+"...";setTimeout(()=>{s&&(a.innerHTML=i.href)},1e3)},this),L.DomEvent.on(t,"mouseout keydown mousedown",t=>{t.target===t.currentTarget&&n.parentElement&&(s=!1,this._map.getContainer().removeChild(n))},this),L.DomEvent.on(i._map.getContainer(),"mouseout mouseenter click",t=>{n.parentElement&&(s=!1,this._map.getContainer().removeChild(n))},this)},_project:function(t,e,i){let o=t||this._map,n=e||o.getPixelOrigin(),a=void 0===i?o.getZoom():i;for(let t of this._parts){t.pixelRings=this._convertRing(t.rings,o,n,a);for(let e of t.subrings)e.pixelSubrings=this._convertRing([e],o,n,a)}if(this._outline){this.pixelOutline=[];for(let t of this._outline)this.pixelOutline=this.pixelOutline.concat(this._convertRing(t,o,n,a))}},_convertRing:function(t,e,i,o){let n=e.options.crs.scale(o),a=[];for(let o of t){let t=[];for(let a of o.points){let o=e.options.crs.transformation.transform(a,n);t.push(L.point(o.x,o.y)._subtract(i).round())}a.push(t)}return a},_update:function(){this._map&&this._renderer._updateFeature(this)},_convertWrappers:function(t){if(!t||0===t.length)return;let e="",i={};for(let o of t)if("MAP-A"!==o.tagName.toUpperCase()&&o.className)e+=`${o.className} `;else if(!i.link&&o.getAttribute("href")){let t={};t.url=o.getAttribute("href"),o.hasAttribute("target")&&(t.target=o.getAttribute("target")),o.hasAttribute("type")&&(t.type=o.getAttribute("type")),o.hasAttribute("inplace")&&(t.inPlace=!0),i.link=t}return i.className=`${e} ${this.options.className}`.trim(),i},_convertMarkup:function(){if(!this._markup)return;let t=this._markup.attributes;this.featureAttributes={},this.options.link&&"MAP-A"===this._markup.parentElement.tagName.toUpperCase()&&"MAP-GEOMETRY"!==this._markup.parentElement.parentElement.tagName.toUpperCase()&&(this.featureAttributes.tabindex="0");for(let e=0;e<t.length;e++)this.featureAttributes[t[e].name]=t[e].value;let e=!0;for(let t of this._markup.querySelectorAll("map-coordinates")){let i=[],o=[];if(this._coordinateToArrays(t,i,o,this.options.className),e||"MAP-POLYGON"!==this.type)if("MAP-MULTIPOINT"===this.type)for(let t of i[0].points.concat(o))this._parts.push({rings:[{points:[t]}],subrings:[],cls:`${t.cls||""} ${this.options.className||""}`.trim()});else this._parts.push({rings:i,subrings:o,cls:`${this.featureAttributes.class||""} ${this.options.className||""}`.trim()});else this._parts[0].rings.push(i[0]),o.length>0&&(this._parts[0].subrings=this._parts[0].subrings.concat(o));e=!1}},_generateOutlinePoints:function(){if("MAP-MULTIPOINT"!==this.type&&"MAP-POINT"!==this.type&&"MAP-LINESTRING"!==this.type&&"MAP-MULTILINESTRING"!==this.type){this._outline=[];for(let t of this._markup.querySelectorAll("map-coordinates")){let e=t.childNodes,i=0,o=document.createElement("div");e.length;for(let t=0;t<e.length;t++)0===e[t].textContent.trim().length&&e[t].remove();for(let t of e){let n=[];if(!t.tagName){let a="",s=((i-1)%e.length+e.length)%e.length;if(e[s].tagName){let t=e[s].textContent.trim().split(/\s+/);a+=`${t[t.length-2]} ${t[t.length-1]} `}if(a+=t.textContent,e[s=((i+1)%e.length+e.length)%e.length].tagName){let t=e[s].textContent.trim().split(/\s+/);a+=`${t[0]} ${t[1]} `}o.innerHTML=a,this._coordinateToArrays(o,n,[],!0,this.featureAttributes.class||this.options.className),this._outline.push(n)}i++}}}},_coordinateToArrays:function(t,e,i,o=!0,n,a=[]){for(let o of t.children)this._coordinateToArrays(o,e,i,!1,o.getAttribute("class"),a.concat([o]));let s=t.textContent.replace(/(<([^>]+)>)/gi,"").match(/(\S+\s+\S+)/gim),r=[];for(let t of s){let e=[];t.split(/\s+/gim).forEach(M.parseNumber,e);let i=M.pointToPCRSPoint(L.point(e),this.options.zoom,this.options.projection,this.options.nativeCS);r.push(i),this._bounds=this._bounds?this._bounds.extend(i):L.bounds(i,i)}if(o)e.push({points:r});else{let e={},o=t.attributes,s=this._convertWrappers(a);s.link&&(e.tabindex="0");for(let t=0;t<o.length;t++)"class"!==o[t].name&&(e[o[t].name]=o[t].value);i.unshift({points:r,cls:`${n||""} ${s.className||""}`.trim(),attr:e,link:s.link,linkTarget:s.linkTarget,linkType:s.linkType})}},_isClosed:function(){switch(this.type){case"MAP-POLYGON":case"MAP-MULTIPOLYGON":case"MAP-POINT":case"MAP-MULTIPOINT":return!0;case"MAP-LINESTRING":case"MAP-MULTILINESTRING":default:return!1}},getCenter:function(){return this._bounds?this._map.options.crs.unproject(this._bounds.getCenter()):null}}),j=function(t,e){return new U(t,e)},Z=L.SVG.extend({_initContainer:function(){L.SVG.prototype._initContainer.call(this),this._container.setAttribute("role","none presentation")},_initPath:function(t,e=!0){if(t._outline){let e=L.SVG.create("path");t.options.className&&L.DomUtil.addClass(e,t.featureAttributes.class||t.options.className),L.DomUtil.addClass(e,"mapml-feature-outline"),e.style.fill="none",t.outlinePath=e}for(let e of t._parts){if(e.rings&&(this._createPath(e,t.options.className,t.featureAttributes["aria-label"],t.options.interactive,t.featureAttributes),t.outlinePath&&(e.path.style.stroke="none")),e.subrings)for(let i of e.subrings)this._createPath(i,t.options.className,i.attr["aria-label"],void 0!==i.link,i.attr),i.attr&&i.attr.tabindex&&e.path.setAttribute("tabindex",i.attr.tabindex||"0");this._updateStyle(t)}if(e){let e=L.stamp(t);this._layers[e]=t}},_createPath:function(t,e,i,o=!1,n){let a=L.SVG.create("path");if(t.path=a,n)for(let[t,e]of Object.entries(n))"id"!==t&&a.setAttribute(t,e);else i&&a.setAttribute("aria-label",i);(t.cls||e)&&L.DomUtil.addClass(a,t.cls||e),o&&L.DomUtil.addClass(a,"leaflet-interactive")},_addPath:function(t,e,i=!0){this._rootGroup||e||this._initContainer();let o=e||this._rootGroup,n=!1;i&&t.addInteractiveTarget(t.group);for(let e of t._parts){e.path&&t.group.appendChild(e.path),i&&(t.options.link&&t.attachLinkHandler(e.path,t.options.link,t.options._leafletLayer),t.addInteractiveTarget(e.path)),!n&&t.pixelOutline&&(t.group.appendChild(t.outlinePath),n=!0);for(let i of e.subrings)i.path&&(i.link&&(t.attachLinkHandler(i.path,i.link,t.options._leafletLayer),t.addInteractiveTarget(i.path)),t.group.appendChild(i.path))}o.appendChild(t.group)},_removePath:function(t){for(let e of t._parts){e.path&&(t.removeInteractiveTarget(e.path),L.DomUtil.remove(e.path));for(let t of e.subrings)t.path&&L.DomUtil.remove(t.path)}t.outlinePath&&L.DomUtil.remove(t.outlinePath),t.removeInteractiveTarget(t.group),L.DomUtil.remove(t.group),delete this._layers[L.stamp(t)]},_updateFeature:function(t){t.pixelOutline&&this._setPath(t.outlinePath,this.geometryToPath(t.pixelOutline,!1));for(let e of t._parts){this._setPath(e.path,this.geometryToPath(e.pixelRings,t.isClosed));for(let t of e.subrings)this._setPath(t.path,this.geometryToPath(t.pixelSubrings,!1))}},_pointToMarker:function(t){return`M${t.x} ${t.y} L${t.x-12.5} ${t.y-30} C${t.x-12.5} ${t.y-50}, ${t.x+12.5} ${t.y-50}, ${t.x+12.5} ${t.y-30} L${t.x} ${t.y}z`},_updateStyle:function(t){this._updatePathStyle(t.outlinePath,t,!1,!0);for(let e of t._parts){e.path&&this._updatePathStyle(e.path,t,!0);for(let i of e.subrings)i.path&&this._updatePathStyle(i.path,t)}},_updatePathStyle:function(t,e,i=!1,o=!1){if(!t||!e)return;let n=e.options,a=e.isClosed;n.stroke&&(!a||o)||i&&!e.outlinePath?(t.setAttribute("stroke",n.color),t.setAttribute("stroke-opacity",n.opacity),t.setAttribute("stroke-width",n.weight),t.setAttribute("stroke-linecap",n.lineCap),t.setAttribute("stroke-linejoin",n.lineJoin),n.dashArray?t.setAttribute("stroke-dasharray",n.dashArray):t.removeAttribute("stroke-dasharray"),n.dashOffset?t.setAttribute("stroke-dashoffset",n.dashOffset):t.removeAttribute("stroke-dashoffset"),n.link&&(t.setAttribute("stroke",n.link.visited?"#6c00a2":"#0000EE"),t.setAttribute("stroke-opacity","1"),t.setAttribute("stroke-width","1px"),t.setAttribute("stroke-dasharray","none"))):t.setAttribute("stroke","none"),a&&!o?n.fill?t.setAttribute("fill",n.color):(t.setAttribute("fill",n.fillColor||n.color),t.setAttribute("fill-opacity",n.fillOpacity),t.setAttribute("fill-rule",n.fillRule||"evenodd")):t.setAttribute("fill","none")},_setPath:function(t,e){t.setAttribute("d",e)},geometryToPath:function(t,e){let i,o,n,a,s,r,l="";for(i=0,n=t.length;i<n;i++){if(1===(s=t[i]).length)return this._pointToMarker(s[0]);for(o=0,a=s.length;o<a;o++)r=s[o],l+=(o?"L":"M")+r.x+" "+r.y;l+=e?"z":""}return l||"M0 0"}}),G=function(t){return new Z(t)},H=L.FeatureGroup.extend({initialize:function(t,e){if(e.wrappers&&e.wrappers.length>0&&(e=Object.assign(M.Feature.prototype._convertWrappers(e.wrappers),e)),L.LayerGroup.prototype.initialize.call(this,t,e),this.options.onEachFeature&&this.options.properties||this.options.link){this.options.group.setAttribute("tabindex","0"),L.DomUtil.addClass(this.options.group,"leaflet-interactive"),L.DomEvent.on(this.options.group,"keyup keydown mousedown",this._handleFocus,this);let e=t[Object.keys(t)[0]];1===t.length&&e.options.link&&(this.options.link=e.options.link),this.options.link?(M.Feature.prototype.attachLinkHandler.call(this,this.options.group,this.options.link,this.options._leafletLayer),this.options.group.setAttribute("role","link")):(this.options.group.setAttribute("aria-expanded","false"),this.options.group.setAttribute("role","button"),this.options.onEachFeature(this.options.properties,this),this.off("click",this._openPopup))}this.options.group.setAttribute("aria-label",this.options.accessibleTitle),this.options.featureID&&this.options.group.setAttribute("data-fid",this.options.featureID)},_handleFocus:function(t){"G"===t.target.tagName.toUpperCase()&&(9!==t.keyCode&&16!==t.keyCode&&13!==t.keyCode||"keyup"!==t.type?13===t.keyCode||32===t.keyCode?(this.closeTooltip(),!this.options.link&&this.options.onEachFeature&&(L.DomEvent.stop(t),this.openPopup())):this.closeTooltip():this.openTooltip())},addLayer:function(t){!t.options.link&&t.options.interactive&&this.options.onEachFeature(this.options.properties,t),L.FeatureGroup.prototype.addLayer.call(this,t)},_previousFeature:function(t){let e=this._source.group.previousSibling;if(!e){let t=this._source.group.closest("div.mapml-layer").style.zIndex,i=this._map.getPane("overlayPane").children;for(let o=i.length-1;o>=0;o--){let n=i[o];if(!(n.style.zIndex>=t)&&(e=n.querySelector("g.leaflet-interactive"))){e=e.parentNode.lastChild;break}}e||(e=this._source.group)}e.focus(),this._map.closePopup()},_nextFeature:function(t){let e=this._source.group.nextSibling;if(!e){let t=this._source.group.closest("div.mapml-layer").style.zIndex;for(let i of this._map.getPane("overlayPane").children)if(!(i.style.zIndex<=t)&&(e=i.querySelectorAll("g.leaflet-interactive")).length>0)break;e=e&&e.length>0?e[0]:this._source.group}e.focus(),this._map.closePopup()}}),$=function(t,e){return new H(t,e)},V=L.Handler.extend({addHooks:function(){this._map.on({layeradd:this.totalBounds,layerremove:this.totalBounds}),this._map.options.mapEl.addEventListener("moveend",this.announceBounds),this._map.dragging._draggable.addEventListener("dragstart",this.dragged),this._map.options.mapEl.addEventListener("mapfocused",this.focusAnnouncement)},removeHooks:function(){this._map.off({layeradd:this.totalBounds,layerremove:this.totalBounds}),this._map.options.mapEl.removeEventListener("moveend",this.announceBounds),this._map.dragging._draggable.removeEventListener("dragstart",this.dragged),this._map.options.mapEl.removeEventListener("mapfocused",this.focusAnnouncement)},focusAnnouncement:function(){let t=this;setTimeout(function(){let e=t.querySelector(".mapml-web-map")?t.querySelector(".mapml-web-map").shadowRoot.querySelector(".leaflet-container"):t.shadowRoot.querySelector(".leaflet-container"),i=t._map.getZoom(),o=M.gcrsToTileMatrix(t),n=M.options.locale.amZoom+" "+i+" "+M.options.locale.amColumn+" "+o[0]+" "+M.options.locale.amRow+" "+o[1];i===t._map._layersMaxZoom?n=M.options.locale.amMaxZoom+" "+n:i===t._map._layersMinZoom&&(n=M.options.locale.amMinZoom+" "+n),e.setAttribute("aria-roledescription","region "+n),setTimeout(function(){e.removeAttribute("aria-roledescription")},2e3)},0)},announceBounds:function(){if(this._traversalCall>0)return;let t=this._map.getZoom(),e=M.pixelToPCRSBounds(this._map.getPixelBounds(),t,this._map.options.projection),i=!0;this._map.totalLayerBounds&&(i=t<=this._map._layersMaxZoom&&t>=this._map._layersMinZoom&&this._map.totalLayerBounds.overlaps(e));let o=this.querySelector(".mapml-web-map")?this.querySelector(".mapml-web-map").shadowRoot.querySelector(".mapml-screen-reader-output"):this.shadowRoot.querySelector(".mapml-screen-reader-output"),n=M.gcrsToTileMatrix(this),a=M.options.locale.amZoom+" "+t+" "+M.options.locale.amColumn+" "+n[0]+" "+M.options.locale.amRow+" "+n[1];if(i){let e=this._history[this._historyIndex-1]?this._history[this._historyIndex-1].zoom:this._history[this._historyIndex].zoom;t===this._map._layersMaxZoom&&t!==e?o.innerText=M.options.locale.amMaxZoom+" "+a:t===this._map._layersMinZoom&&t!==e?o.innerText=M.options.locale.amMinZoom+" "+a:o.innerText=a}else{let t=this._history[this._historyIndex],e=this._history[this._historyIndex-1];this.back(),this._history.pop(),t.zoom!==e.zoom?o.innerText=M.options.locale.amZoomedOut:this._map.dragging._draggable.wasDragged?o.innerText=M.options.locale.amDraggedOut:t.x>e.x?o.innerText=M.options.locale.amEastBound:t.x<e.x?o.innerText=M.options.locale.amWestBound:t.y<e.y?o.innerText=M.options.locale.amNorthBound:t.y>e.y&&(o.innerText=M.options.locale.amSouthBound)}this._map.dragging._draggable.wasDragged=!1},totalBounds:function(){let t=Object.keys(this._layers),e=L.bounds();t.forEach(t=>{if(this._layers[t].layerBounds){if(!e){let i=this._layers[t].layerBounds.getCenter();e=L.bounds(i,i)}e.extend(this._layers[t].layerBounds.min),e.extend(this._layers[t].layerBounds.max)}}),this.totalLayerBounds=e},dragged:function(){this.wasDragged=!0}}),W={announceMovement:!1,locale:{cmBack:"Back",cmForward:"Forward",cmReload:"Reload",cmToggleControls:"Toggle Controls",cmCopyCoords:"Copy Coordinates",cmToggleDebug:"Toggle Debug Mode",cmCopyMapML:"Copy MapML",cmViewSource:"View Map Source",cmCopyAll:"All",lmZoomToLayer:"Zoom To Layer",lmCopyExtent:"Copy Extent",lcOpacity:"Opacity",btnZoomIn:"Zoom in",btnZoomOut:"Zoom out",btnFullScreen:"View fullscreen",amZoom:"zoom level",amColumn:"column",amRow:"row",amMaxZoom:"At maximum zoom level, zoom in disabled",amMinZoom:"At minimum zoom level, zoom out disabled",amZoomedOut:"Zoomed out of bounds, returning to",amDraggedOut:"Dragged out of bounds, returning to",amEastBound:"Reached east bound, panning east disabled",amWestBound:"Reached west bound, panning west disabled",amNorthBound:"Reached north bound, panning north disabled",amSouthBound:"Reached south bound, panning south disabled"}};L.Map.Keyboard.include({_onKeyDown:function(t){if(t.altKey||t.metaKey)return;let e={187:187,107:107,61:61,171:171},i={189:189,109:109,54:54,173:173};var o,n=t.keyCode,a=this._map;if(n in this._panKeys)a._panAnim&&a._panAnim._inProgress||(o=this._panKeys[n],t.shiftKey&&(o=L.point(o).multiplyBy(3)),t.ctrlKey&&(o=L.point(o).divideBy(5)),a.panBy(o),a.options.maxBounds&&a.panInsideBounds(a.options.maxBounds));else if(n in this._zoomKeys)(n in e&&a._layersMaxZoom!==a.getZoom()||n in i&&a._layersMinZoom!==a.getZoom())&&a.setZoom(a.getZoom()+(t.shiftKey?3:1)*this._zoomKeys[n]);else{if(27!==n||!a._popup||!a._popup.options.closeOnEscapeKey)return;a.closePopup()}L.DomEvent.stop(t)}}),function(n,a,A){var M={};n.M=M,function(){M.detectImagePath=function(t){var e=L.DomUtil.create("div","leaflet-default-icon-path",t),i=L.DomUtil.getStyle(e,"background-image")||L.DomUtil.getStyle(e,"backgroundImage");return t.removeChild(e),i=null===i||0!==i.indexOf("url")?"":i.replace(/^url\(["']?/,"").replace(/marker-icon\.png["']?\)$/,"")},M.mime="text/mapml";let t=n.document.head.querySelector("map-options");M.options=W,t&&(M.options=Object.assign(M.options,JSON.parse(t.innerHTML))),M.WGS84=new L.Proj.CRS("EPSG:4326","+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs ",{origin:[-180,90],bounds:L.bounds([[-180,-90],[180,90]]),resolutions:[.703125,.3515625,.17578125,.087890625,.0439453125,.02197265625,.010986328125,.0054931640625,.00274658203125,.001373291015625,.0006866455078125,.0003433227539062,.0001716613769531,858306884766e-16,429153442383e-16,214576721191e-16,107288360596e-16,53644180298e-16,26822090149e-16,13411045074e-16,6.705522537e-7,3.352761269e-7],crs:{tcrs:{horizontal:{name:"x",min:0,max:t=>(M.WGS84.options.bounds.getSize().x/M.WGS84.options.resolutions[t]).toFixed()},vertical:{name:"y",min:0,max:t=>(M.WGS84.options.bounds.getSize().y/M.WGS84.options.resolutions[t]).toFixed()},bounds:t=>L.bounds([M.WGS84.options.crs.tcrs.horizontal.min,M.WGS84.options.crs.tcrs.vertical.min],[M.WGS84.options.crs.tcrs.horizontal.max(t),M.WGS84.options.crs.tcrs.vertical.max(t)])},pcrs:{horizontal:{name:"longitude",get min(){return M.WGS84.options.crs.gcrs.horizontal.min},get max(){return M.WGS84.options.crs.gcrs.horizontal.max}},vertical:{name:"latitude",get min(){return M.WGS84.options.crs.gcrs.vertical.min},get max(){return M.WGS84.options.crs.gcrs.vertical.max}},get bounds(){return M.WGS84.options.bounds}},gcrs:{horizontal:{name:"longitude",min:-180,max:180},vertical:{name:"latitude",min:-90,max:90},get bounds(){return L.latLngBounds([M.WGS84.options.crs.gcrs.vertical.min,M.WGS84.options.crs.gcrs.horizontal.min],[M.WGS84.options.crs.gcrs.vertical.max,M.WGS84.options.crs.gcrs.horizontal.max])}},map:{horizontal:{name:"i",min:0,max:t=>t.getSize().x},vertical:{name:"j",min:0,max:t=>t.getSize().y},bounds:t=>L.bounds(L.point([0,0]),t.getSize())},tile:{horizontal:{name:"i",min:0,max:256},vertical:{name:"j",min:0,max:256},get bounds(){return L.bounds([M.WGS84.options.crs.tile.horizontal.min,M.WGS84.options.crs.tile.vertical.min],[M.WGS84.options.crs.tile.horizontal.max,M.WGS84.options.crs.tile.vertical.max])}},tilematrix:{horizontal:{name:"column",min:0,max:t=>(M.WGS84.options.crs.tcrs.horizontal.max(t)/M.WGS84.options.crs.tile.bounds.getSize().x).toFixed()},vertical:{name:"row",min:0,max:t=>(M.WGS84.options.crs.tcrs.vertical.max(t)/M.WGS84.options.crs.tile.bounds.getSize().y).toFixed()},bounds:t=>L.bounds([M.WGS84.options.crs.tilematrix.horizontal.min,M.WGS84.options.crs.tilematrix.vertical.min],[M.WGS84.options.crs.tilematrix.horizontal.max(t),M.WGS84.options.crs.tilematrix.vertical.max(t)])}}}),M.CBMTILE=new L.Proj.CRS("EPSG:3978","+proj=lcc +lat_1=49 +lat_2=77 +lat_0=49 +lon_0=-95 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs",{origin:[-34655800,3931e4],bounds:L.bounds([[-34655800,-39e6],[1e7,3931e4]]),resolutions:[38364.660062653464,22489.62831258996,13229.193125052918,7937.5158750317505,4630.2175937685215,2645.8386250105837,1587.5031750063501,926.0435187537042,529.1677250021168,317.50063500127004,185.20870375074085,111.12522225044451,66.1459656252646,38.36466006265346,22.48962831258996,13.229193125052918,7.9375158750317505,4.6302175937685215,2.6458386250105836,1.5875031750063502,.9260435187537043,.5291677250021167,.31750063500127,.18520870375074083,.11112522225044451,.06614596562526459],crs:{tcrs:{horizontal:{name:"x",min:0,max:t=>(M.CBMTILE.options.bounds.getSize().x/M.CBMTILE.options.resolutions[t]).toFixed()},vertical:{name:"y",min:0,max:t=>(M.CBMTILE.options.bounds.getSize().y/M.CBMTILE.options.resolutions[t]).toFixed()},bounds:t=>L.bounds([M.CBMTILE.options.crs.tcrs.horizontal.min,M.CBMTILE.options.crs.tcrs.vertical.min],[M.CBMTILE.options.crs.tcrs.horizontal.max(t),M.CBMTILE.options.crs.tcrs.vertical.max(t)])},pcrs:{horizontal:{name:"easting",get min(){return M.CBMTILE.options.bounds.min.x},get max(){return M.CBMTILE.options.bounds.max.x}},vertical:{name:"northing",get min(){return M.CBMTILE.options.bounds.min.y},get max(){return M.CBMTILE.options.bounds.max.y}},get bounds(){return M.CBMTILE.options.bounds}},gcrs:{horizontal:{name:"longitude",min:-141.01,max:-47.74},vertical:{name:"latitude",min:40.04,max:86.46},get bounds(){return L.latLngBounds([M.CBMTILE.options.crs.gcrs.vertical.min,M.CBMTILE.options.crs.gcrs.horizontal.min],[M.CBMTILE.options.crs.gcrs.vertical.max,M.CBMTILE.options.crs.gcrs.horizontal.max])}},map:{horizontal:{name:"i",min:0,max:t=>t.getSize().x},vertical:{name:"j",min:0,max:t=>t.getSize().y},bounds:t=>L.bounds(L.point([0,0]),t.getSize())},tile:{horizontal:{name:"i",min:0,max:256},vertical:{name:"j",min:0,max:256},get bounds(){return L.bounds([M.CBMTILE.options.crs.tile.horizontal.min,M.CBMTILE.options.crs.tile.vertical.min],[M.CBMTILE.options.crs.tile.horizontal.max,M.CBMTILE.options.crs.tile.vertical.max])}},tilematrix:{horizontal:{name:"column",min:0,max:t=>(M.CBMTILE.options.crs.tcrs.horizontal.max(t)/M.CBMTILE.options.crs.tile.bounds.getSize().x).toFixed()},vertical:{name:"row",min:0,max:t=>(M.CBMTILE.options.crs.tcrs.vertical.max(t)/M.CBMTILE.options.crs.tile.bounds.getSize().y).toFixed()},bounds:t=>L.bounds([0,0],[M.CBMTILE.options.crs.tilematrix.horizontal.max(t),M.CBMTILE.options.crs.tilematrix.vertical.max(t)])}}}),M.APSTILE=new L.Proj.CRS("EPSG:5936","+proj=stere +lat_0=90 +lat_ts=50 +lon_0=-150 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m +no_defs",{origin:[-28567784.109255,32567784.109255],bounds:L.bounds([[-28567784.109254867,-28567784.109254755],[32567784.109255023,32567784.10925506]]),resolutions:[238810.813354,119405.406677,59702.7033384999,29851.3516692501,14925.675834625,7462.83791731252,3731.41895865639,1865.70947932806,932.854739664032,466.427369832148,233.213684916074,116.606842458037,58.3034212288862,29.1517106145754,14.5758553072877,7.28792765351156,3.64396382688807,1.82198191331174,.910990956788164,.45549547826179],crs:{tcrs:{horizontal:{name:"x",min:0,max:t=>(M.APSTILE.options.bounds.getSize().x/M.APSTILE.options.resolutions[t]).toFixed()},vertical:{name:"y",min:0,max:t=>(M.APSTILE.options.bounds.getSize().y/M.APSTILE.options.resolutions[t]).toFixed()},bounds:t=>L.bounds([M.APSTILE.options.crs.tcrs.horizontal.min,M.APSTILE.options.crs.tcrs.vertical.min],[M.APSTILE.options.crs.tcrs.horizontal.max(t),M.APSTILE.options.crs.tcrs.vertical.max(t)])},pcrs:{horizontal:{name:"easting",get min(){return M.APSTILE.options.bounds.min.x},get max(){return M.APSTILE.options.bounds.max.x}},vertical:{name:"northing",get min(){return M.APSTILE.options.bounds.min.y},get max(){return M.APSTILE.options.bounds.max.y}},get bounds(){return M.APSTILE.options.bounds}},gcrs:{horizontal:{name:"longitude",min:-180,max:180},vertical:{name:"latitude",min:60,max:90},get bounds(){return L.latLngBounds([M.APSTILE.options.crs.gcrs.vertical.min,M.APSTILE.options.crs.gcrs.horizontal.min],[M.APSTILE.options.crs.gcrs.vertical.max,M.APSTILE.options.crs.gcrs.horizontal.max])}},map:{horizontal:{name:"i",min:0,max:t=>t.getSize().x},vertical:{name:"j",min:0,max:t=>t.getSize().y},bounds:t=>L.bounds(L.point([0,0]),t.getSize())},tile:{horizontal:{name:"i",min:0,max:256},vertical:{name:"j",min:0,max:256},get bounds(){return L.bounds([M.APSTILE.options.crs.tile.horizontal.min,M.APSTILE.options.crs.tile.vertical.min],[M.APSTILE.options.crs.tile.horizontal.max,M.APSTILE.options.crs.tile.vertical.max])}},tilematrix:{horizontal:{name:"column",min:0,max:t=>(M.APSTILE.options.crs.tcrs.horizontal.max(t)/M.APSTILE.options.crs.tile.bounds.getSize().x).toFixed()},vertical:{name:"row",min:0,max:t=>(M.APSTILE.options.crs.tcrs.vertical.max(t)/M.APSTILE.options.crs.tile.bounds.getSize().y).toFixed()},bounds:t=>L.bounds([0,0],[M.APSTILE.options.crs.tilematrix.horizontal.max(t),M.APSTILE.options.crs.tilematrix.vertical.max(t)])}}}),M.OSMTILE=L.CRS.EPSG3857,L.setOptions(M.OSMTILE,{origin:[-20037508.342787,20037508.342787],bounds:L.bounds([[-20037508.342787,-20037508.342787],[20037508.342787,20037508.342787]]),resolutions:[156543.0339,78271.51695,39135.758475,19567.8792375,9783.93961875,4891.969809375,2445.9849046875,1222.9924523438,611.49622617188,305.74811308594,152.87405654297,76.437028271484,38.218514135742,19.109257067871,9.5546285339355,4.7773142669678,2.3886571334839,1.1943285667419,.59716428337097,.29858214168549,.14929107084274,.074645535421371,.03732276771068573,.018661383855342866,.009330691927671433],crs:{tcrs:{horizontal:{name:"x",min:0,max:t=>(M.OSMTILE.options.bounds.getSize().x/M.OSMTILE.options.resolutions[t]).toFixed()},vertical:{name:"y",min:0,max:t=>(M.OSMTILE.options.bounds.getSize().y/M.OSMTILE.options.resolutions[t]).toFixed()},bounds:t=>L.bounds([M.OSMTILE.options.crs.tcrs.horizontal.min,M.OSMTILE.options.crs.tcrs.vertical.min],[M.OSMTILE.options.crs.tcrs.horizontal.max(t),M.OSMTILE.options.crs.tcrs.vertical.max(t)])},pcrs:{horizontal:{name:"easting",get min(){return M.OSMTILE.options.bounds.min.x},get max(){return M.OSMTILE.options.bounds.max.x}},vertical:{name:"northing",get min(){return M.OSMTILE.options.bounds.min.y},get max(){return M.OSMTILE.options.bounds.max.y}},get bounds(){return M.OSMTILE.options.bounds}},gcrs:{horizontal:{name:"longitude",get min(){return M.OSMTILE.unproject(M.OSMTILE.options.bounds.min).lng},get max(){return M.OSMTILE.unproject(M.OSMTILE.options.bounds.max).lng}},vertical:{name:"latitude",get min(){return M.OSMTILE.unproject(M.OSMTILE.options.bounds.min).lat},get max(){return M.OSMTILE.unproject(M.OSMTILE.options.bounds.max).lat}},get bounds(){return L.latLngBounds([M.OSMTILE.options.crs.gcrs.vertical.min,M.OSMTILE.options.crs.gcrs.horizontal.min],[M.OSMTILE.options.crs.gcrs.vertical.max,M.OSMTILE.options.crs.gcrs.horizontal.max])}},map:{horizontal:{name:"i",min:0,max:t=>t.getSize().x},vertical:{name:"j",min:0,max:t=>t.getSize().y},bounds:t=>L.bounds(L.point([0,0]),t.getSize())},tile:{horizontal:{name:"i",min:0,max:256},vertical:{name:"j",min:0,max:256},get bounds(){return L.bounds([M.OSMTILE.options.crs.tile.horizontal.min,M.OSMTILE.options.crs.tile.vertical.min],[M.OSMTILE.options.crs.tile.horizontal.max,M.OSMTILE.options.crs.tile.vertical.max])}},tilematrix:{horizontal:{name:"column",min:0,max:t=>(M.OSMTILE.options.crs.tcrs.horizontal.max(t)/M.OSMTILE.options.crs.tile.bounds.getSize().x).toFixed()},vertical:{name:"row",min:0,max:t=>(M.OSMTILE.options.crs.tcrs.vertical.max(t)/M.OSMTILE.options.crs.tile.bounds.getSize().y).toFixed()},bounds:t=>L.bounds([0,0],[M.OSMTILE.options.crs.tilematrix.horizontal.max(t),M.OSMTILE.options.crs.tilematrix.vertical.max(t)])}}})}(),M.handleLink=B.handleLink,M.convertPCRSBounds=B.convertPCRSBounds,M.axisToXY=B.axisToXY,M.csToAxes=B.csToAxes,M.convertAndFormatPCRS=B.convertAndFormatPCRS,M.axisToCS=B.axisToCS,M.parseNumber=B.parseNumber,M.extractInputBounds=B.extractInputBounds,M.splitCoordinate=B.splitCoordinate,M.boundsToPCRSBounds=B.boundsToPCRSBounds,M.pixelToPCRSBounds=B.pixelToPCRSBounds,M.metaContentToObject=B.metaContentToObject,M.coordsToArray=B.coordsToArray,M.parseStylesheetAsHTML=B.parseStylesheetAsHTML,M.pointToPCRSPoint=B.pointToPCRSPoint,M.pixelToPCRSPoint=B.pixelToPCRSPoint,M.gcrsToTileMatrix=B.gcrsToTileMatrix,M.QueryHandler=w,M.ContextMenu=I,M.AnnounceMovement=V,L.Map.addInitHook("addHandler","query",M.QueryHandler),L.Map.addInitHook("addHandler","contextMenu",M.ContextMenu),L.Map.addInitHook("addHandler","announceMovement",M.AnnounceMovement),M.MapMLLayer=f,M.mapMLLayer=b,M.ImageOverlay=y,M.imageOverlay=g,M.TemplatedImageLayer=d,M.templatedImageLayer=_,M.TemplatedFeaturesLayer=c,M.templatedFeaturesLayer=h,M.TemplatedLayer=u,M.templatedLayer=p,M.TemplatedTileLayer=l,M.templatedTileLayer=m,M.MapMLFeatures=s,M.mapMlFeatures=r,M.MapMLLayerControl=i,M.mapMlLayerControl=o,M.ReloadButton=D,M.reloadButton=q,M.FullscreenButton=F,M.fullscreenButton=R,M.MapMLStaticTileLayer=t,M.mapMLStaticTileLayer=e,M.DebugOverlay=x,M.debugOverlay=v,M.Crosshair=N,M.crosshair=O,M.Feature=U,M.feature=j,M.FeatureRenderer=Z,M.featureRenderer=G,M.FeatureGroup=H,M.featureGroup=$}(window)}();
\ No newline at end of file
+!function(){"use strict";var t=L.GridLayer.extend({initialize:function(t){this.zoomBounds=this._getZoomBounds(t.tileContainer,t.maxZoomBound),L.extend(t,this.zoomBounds),L.setOptions(this,t),this._groups=this._groupTiles(this.options.tileContainer.getElementsByTagName("map-tile"))},onAdd:function(){this._bounds=this._getLayerBounds(this._groups,this._map.options.projection),this.layerBounds=this._bounds[Object.keys(this._bounds)[0]];for(let t of Object.keys(this._bounds))this.layerBounds.extend(this._bounds[t].min),this.layerBounds.extend(this._bounds[t].max);L.GridLayer.prototype.onAdd.call(this,this._map),this._handleMoveEnd()},getEvents:function(){let t=L.GridLayer.prototype.getEvents.call(this,this._map);return this._parentOnMoveEnd=t.moveend,t.moveend=this._handleMoveEnd,t.move=(()=>{}),t},_handleMoveEnd:function(t){let e=this._map.getZoom(),i=e;i=(i=i>this.options.maxNativeZoom?this.options.maxNativeZoom:i)<this.options.minNativeZoom?this.options.minNativeZoom:i,this.isVisible=e<=this.zoomBounds.maxZoom&&e>=this.zoomBounds.minZoom&&this._bounds[i]&&this._bounds[i].overlaps(M.pixelToPCRSBounds(this._map.getPixelBounds(),this._map.getZoom(),this._map.options.projection)),this.isVisible&&this._parentOnMoveEnd()},_isValidTile(t){return this._groups[this._tileCoordsToKey(t)]},createTile:function(t){let e=this._groups[this._tileCoordsToKey(t)]||[],i=document.createElement("map-tile"),o=this.getTileSize();i.setAttribute("col",t.x),i.setAttribute("row",t.y),i.setAttribute("zoom",t.z);for(let t=0;t<e.length;t++){let n=document.createElement("img");n.width=o.x,n.height=o.y,n.alt="",n.setAttribute("role","presentation"),n.src=e[t].src,i.appendChild(n)}return i},_getLayerBounds:function(t,e){let i={},o=M[e].options.crs.tile.bounds.max.x;for(let e in t){let t=e.split(":"),n={};n.x=+t[0]*o,n.y=+t[1]*o,n.z=+t[2],t[2]in i?(i[t[2]].extend(L.point(n.x,n.y)),i[t[2]].extend(L.point(n.x+o,n.y+o))):i[t[2]]=L.bounds(L.point(n.x,n.y),L.point(n.x+o,n.y+o))}for(let t in i){let o=+t;i[t]=M.pixelToPCRSBounds(i[t],o,e)}return i},_getZoomBounds:function(t,e){if(!t)return null;let i=M.metaContentToObject(t.getElementsByTagName("map-tiles")[0].getAttribute("zoom")),o={},n=t.getElementsByTagName("map-tile");o.nativeZoom=+i.value||0,o.maxNativeZoom=0,o.minNativeZoom=e;for(let t=0;t<n.length;t++){let e=+n[t].getAttribute("zoom");n[t].getAttribute("zoom")||(e=o.nativeZoom),o.minNativeZoom=Math.min(o.minNativeZoom,e),o.maxNativeZoom=Math.max(o.maxNativeZoom,e)}return o.minZoom=o.minNativeZoom-2<=0?0:o.minNativeZoom-2,o.maxZoom=e,i.min&&(o.minZoom=+i.min<o.minNativeZoom-2?o.minNativeZoom-2:+i.min),i.max&&(o.maxZoom=+i.max),o},_groupTiles:function(t){let e={};for(let i=0;i<t.length;i++){let o={};o.row=+t[i].getAttribute("row"),o.col=+t[i].getAttribute("col"),o.zoom=+t[i].getAttribute("zoom")||this.options.nativeZoom,o.src=t[i].getAttribute("src");let n=o.col+":"+o.row+":"+o.zoom;n in e?e[n].push(o):e[n]=[o]}return e}}),e=function(e){return new t(e)},i=L.Control.Layers.extend({options:{autoZIndex:!1,sortLayers:!0,sortFunction:function(t,e){return t.options.zIndex<e.options.zIndex?-1:t.options.zIndex>e.options.zIndex?1:0}},initialize:function(t,e){for(var i in L.setOptions(this,e),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,t)this._addLayer(t[i],i,!0)},onAdd:function(){return this._initLayout(),this._map.on("validate",this._validateInput,this),L.DomEvent.on(this.options.mapEl,"layerchange",this._validateInput,this),L.DomEvent.on(this._container,"keydown",this._focusFirstLayer,this._container),this._update(),this._layers.length<1&&!this._map._showControls?this._container.setAttribute("hidden",""):this._map._showControls=!0,this._container},onRemove:function(t){t.off("validate",this._validateInput,this),L.DomEvent.off(this._container,"keydown",this._focusFirstLayer,this._container);for(var e=0;e<this._layers.length;e++)this._layers[e].layer.off("add remove",this._onLayerChange,this),this._layers[e].layer.off("extentload",this._validateInput,this)},addOrUpdateOverlay:function(t,e){for(var i=!1,o=0;o<this._layers.length;o++)if(this._layers[o].layer===t){i=!0,this._layers[o].name=e;break}return i||this.addOverlay(t,e),this._layers.length>0&&(this._container.removeAttribute("hidden"),this._map._showControls=!0),this._map?this._update():this},removeLayer:function(t){L.Control.Layers.prototype.removeLayer.call(this,t),0===this._layers.length&&this._container.setAttribute("hidden","")},_validateInput:function(t){for(let t=0;t<this._layers.length;t++){if(!this._layers[t].input.labels[0])continue;let e=this._layers[t].input.labels[0].getElementsByTagName("span"),i=this._layers[t].input.labels[0].getElementsByTagName("input");i[0].checked=this._layers[t].layer._layerEl.checked,this._layers[t].layer._layerEl.disabled&&this._layers[t].layer._layerEl.checked?(i[0].closest("fieldset").disabled=!0,e[0].style.fontStyle="italic"):(i[0].closest("fieldset").disabled=!1,e[0].style.fontStyle="normal")}},_focusFirstLayer:function(t){if("Enter"===t.key&&"leaflet-control-layers leaflet-control leaflet-control-layers-expanded"!=this.className){var e=this.children[1].children[2].children[0].children[0].children[0].children[0];e&&setTimeout(()=>e.focus(),0)}},_withinZoomBounds:function(t,e){return e.min<=t&&t<=e.max},_addItem:function(t){var e=t.layer.getLayerUserControlsHTML();return t.input=e.querySelector("input"),this._layerControlInputs.push(t.input),t.input.layerId=L.stamp(t.layer),L.DomEvent.on(t.input,"click",this._onInputClick,this),t.layer.on("extentload",this._validateInput,this),this._overlaysList.appendChild(e),e},collapse:function(t){return"SELECT"===t.target.tagName||t.relatedTarget&&t.relatedTarget.parentElement&&("mapml-contextmenu mapml-layer-menu"===t.relatedTarget.className||"mapml-contextmenu mapml-layer-menu"===t.relatedTarget.parentElement.className)||this._map&&"block"===this._map.contextMenu._layerMenu.style.display?this:(L.DomUtil.removeClass(this._container,"leaflet-control-layers-expanded"),this)}}),o=function(t,e){return new i(t,e)};const n="OSMTILE",a="mapmltemplatedtileplaceholder";var s=L.FeatureGroup.extend({initialize:function(t,e){if(L.setOptions(this,e),this.options.static&&(this._container=L.DomUtil.create("div","leaflet-layer",this.options.pane),L.DomUtil.addClass(this._container,"leaflet-pane mapml-vector-container"),L.setOptions(this.options.renderer,{pane:this._container})),this._layers={},this.options.query){this._mapmlFeatures=t,this.isVisible=!0;let e=this._getNativeVariables(t);this.options.nativeZoom=e.zoom,this.options.nativeCS=e.cs}if(t&&!this.options.query){let e=this._getNativeVariables(t);!t.querySelector("map-extent")&&t.querySelector("map-feature")&&this.options.static&&(this._features={},this._staticFeature=!0,this.isVisible=!0,this.zoomBounds=this._getZoomBounds(t,e.zoom),this.layerBounds=this._getLayerBounds(t),L.extend(this.options,this.zoomBounds)),this.addData(t,e.cs,e.zoom),this._staticFeature&&(this._resetFeatures(this._clampZoom(this.options._leafletLayer._map.getZoom())),this.options._leafletLayer._map._addZoomLimit(this))}},onAdd:function(t){L.FeatureGroup.prototype.onAdd.call(this,t),this._mapmlFeatures&&t.on("featurepagination",this.showPaginationFeature,this)},onRemove:function(t){this._mapmlFeatures&&(t.off("featurepagination",this.showPaginationFeature,this),delete this._mapmlFeatures,L.DomUtil.remove(this._container)),L.FeatureGroup.prototype.onRemove.call(this,t),this._map.featureIndex.cleanIndex()},getEvents:function(){return this._staticFeature?{moveend:this._handleMoveEnd,zoomend:this._handleZoomEnd}:{moveend:this._removeCSS}},showPaginationFeature:function(t){if(this.options.query&&this._mapmlFeatures.querySelectorAll("map-feature")[t.i]){let e=this._mapmlFeatures.querySelectorAll("map-feature")[t.i];this.clearLayers(),this.addData(e,this.options.nativeCS,this.options.nativeZoom),t.popup._navigationBar.querySelector("p").innerText=t.i+1+"/"+this.options._leafletLayer._totalFeatureCount,t.popup._content.querySelector("iframe").setAttribute("sandbox","allow-same-origin allow-forms"),t.popup._content.querySelector("iframe").srcdoc=e.querySelector("map-properties").innerHTML}},_getNativeVariables:function(t){return{zoom:t.querySelector("map-meta[name=zoom]")&&+M.metaContentToObject(t.querySelector("map-meta[name=zoom]").getAttribute("content")).value||0,cs:t.querySelector("map-meta[name=cs]")&&M.metaContentToObject(t.querySelector("map-meta[name=cs]").getAttribute("content")).content||"GCRS"}},_handleMoveEnd:function(){let t=this._map.getZoom(),e=t<=this.zoomBounds.maxZoom&&t>=this.zoomBounds.minZoom;this.isVisible=e&&this._layers&&this.layerBounds&&this.layerBounds.overlaps(M.pixelToPCRSBounds(this._map.getPixelBounds(),t,this._map.options.projection)),this._removeCSS()},_handleZoomEnd:function(t){let e=this._map.getZoom();if(e>this.zoomBounds.maxZoom||e<this.zoomBounds.minZoom)return void this.clearLayers();let i=this._clampZoom(e);this._resetFeatures(i)},_getLayerBounds:function(t){if(!t)return null;let e="TILEMATRIX",i=t.querySelector("map-meta[name=projection]")&&M.metaContentToObject(t.querySelector("map-meta[name=projection]").getAttribute("content")).content.toUpperCase()||n;try{let o=t.querySelector("map-meta[name=extent]")&&M.metaContentToObject(t.querySelector("map-meta[name=extent]").getAttribute("content")),n=o.zoom||0,a=Object.keys(o);for(let t=0;t<a.length;t++)if(!a[t].includes("zoom")){e=M.axisToCS(a[t].split("-")[2]);break}let s=M.csToAxes(e);return M.boundsToPCRSBounds(L.bounds(L.point(+o[`top-left-${s[0]}`],+o[`top-left-${s[1]}`]),L.point(+o[`bottom-right-${s[0]}`],+o[`bottom-right-${s[1]}`])),n,i,e)}catch(t){return M.boundsToPCRSBounds(M[i].options.crs.tilematrix.bounds(0),0,i,e)}},_resetFeatures:function(t){if(this.clearLayers(),this._map&&this._map.featureIndex.cleanIndex(),this._features&&this._features[t])for(let e=0;e<this._features[t].length;e++)this.addLayer(this._features[t][e])},_clampZoom:function(t){return t>this.zoomBounds.maxZoom||t<this.zoomBounds.minZoom?t:void 0!==this.zoomBounds.minNativeZoom&&t<this.zoomBounds.minNativeZoom?this.zoomBounds.minNativeZoom:void 0!==this.zoomBounds.maxNativeZoom&&this.zoomBounds.maxNativeZoom<t?this.zoomBounds.maxNativeZoom:t},_setZoomTransform:function(t,e){var i=this._map.getZoomScale(this._map.getZoom(),e),o=t.multiplyBy(i).subtract(this._map._getNewPixelOrigin(t,this._map.getZoom())).round();any3d?L.setTransform(this._layers[e],o,i):L.setPosition(this._layers[e],o)},_getZoomBounds:function(t,e){if(!t)return null;let i,o,a=100,s=0,r=t.getElementsByTagName("map-feature");for(let t=0;t<r.length;t++){let i=+r[t].getAttribute("zoom");r[t].getAttribute("zoom")||(i=e),s=Math.max(s,i),a=Math.min(a,i)}try{o=M.metaContentToObject(t.querySelector("map-meta[name=projection]").getAttribute("content")).content,i=M.metaContentToObject(t.querySelector("map-meta[name=zoom]").getAttribute("content"))}catch(t){return{minZoom:0,maxZoom:M[o||n].options.resolutions.length-1,minNativeZoom:a,maxNativeZoom:s}}return{minZoom:+i.min,maxZoom:+i.max,minNativeZoom:a,maxNativeZoom:s}},addData:function(t,e,i){var o,n,a,s=t.nodeType===Node.DOCUMENT_NODE||"LAYER-"===t.nodeName?t.getElementsByTagName("map-feature"):null;if(t.nodeType===Node.DOCUMENT_NODE?t.querySelector("map-link[rel=stylesheet],map-style"):null){var r=t.querySelector("map-base")&&t.querySelector("map-base").hasAttribute("href")?new URL(t.querySelector("map-base").getAttribute("href")).href:t.URL;M.parseStylesheetAsHTML(t,r,this._container)}if(s){for(o=0,n=s.length;o<n;o++){(a=s[o]).getElementsByTagName("map-geometry").length&&a.getElementsByTagName("map-coordinates").length&&this.addData(a,e,i)}return this}var l=this.options;if(l.filter&&!l.filter(t))return;t.classList.length&&(l.className=t.classList.value);let u=t.getAttribute("zoom")||i,m=t.querySelector("map-featurecaption");m=m?m.innerHTML:"Feature",t.querySelector("map-properties")&&(l.properties=document.createElement("div"),l.properties.classList.add("mapml-popup-content"),l.properties.insertAdjacentHTML("afterbegin",t.querySelector("map-properties").innerHTML));let p=this.geometryToLayer(t,l,e,+u,m);if(p){if(!p.options.color&&t.hasAttribute("class")&&(p.options.className=t.getAttribute("class")),p.defaultOptions=p.options,this.resetStyle(p),l.onEachFeature&&p.bindTooltip(m,{interactive:!0,sticky:!0}),this._staticFeature){let e=t.getAttribute("zoom")||i;return void(e in this._features?this._features[e].push(p):this._features[e]=[p])}return this.addLayer(p)}},resetStyle:function(t){var e=this.options.style;e&&(L.Util.extend(t.options,t.defaultOptions),this._setLayerStyle(t,e))},setStyle:function(t){this.eachLayer(function(e){this._setLayerStyle(e,t)},this)},_setLayerStyle:function(t,e){"function"==typeof e&&(e=e(t.feature)),t.setStyle&&t.setStyle(e)},_removeCSS:function(){let t=this._container.querySelectorAll("link[rel=stylesheet],style");for(let e=0;e<t.length;e++)this._container.removeChild(t[e])},geometryToLayer:function(t,e,i,o,n){let a="MAP-FEATURE"===t.tagName.toUpperCase()?t.getElementsByTagName("map-geometry")[0]:t,s=a.getAttribute("cs")||i,r=[],l=L.SVG.create("g"),u=Object.assign({},e);for(let e of a.querySelectorAll("map-polygon, map-linestring, map-multilinestring, map-point, map-multipoint"))r.push(M.feature(e,Object.assign(u,{nativeCS:s,nativeZoom:o,projection:this.options.projection,featureID:t.id,group:l,wrappers:this._getGeometryParents(e.parentElement),featureLayer:this,_leafletLayer:this.options._leafletLayer})));let m={group:l,featureID:t.id,accessibleTitle:n,onEachFeature:e.onEachFeature,properties:e.properties,_leafletLayer:this.options._leafletLayer},p=a.querySelector("map-multipolygon")||a.querySelector("map-geometrycollection");return p&&(m.wrappers=this._getGeometryParents(p.parentElement)),M.featureGroup(r,m)},_getGeometryParents:function(t,e=[]){return t&&"MAP-GEOMETRY"!==t.tagName.toUpperCase()?"MAP-MULTIPOLYGON"===t.tagName.toUpperCase()||"MAP-GEOMETRYCOLLECTION"===t.tagName.toUpperCase()?this._getGeometryParents(t.parentElement,e):this._getGeometryParents(t.parentElement,e.concat([t])):e}}),r=function(t,e){return new s(t,e)},l=L.TileLayer.extend({initialize:function(t,e){let i=M.extractInputBounds(t);this.zoomBounds=i.zoomBounds,this.layerBounds=i.bounds,this.isVisible=!0,L.extend(e,this.zoomBounds),e.tms=t.tms,L.setOptions(this,e),this._setUpTileTemplateVars(t),t.tile.subdomains&&L.setOptions(this,L.extend(this.options,{subdomains:t.tile.subdomains})),this._template=t,this._initContainer(),L.TileLayer.prototype.initialize.call(this,t.template,L.extend(e,{pane:this._container}))},onAdd:function(){this._map._addZoomLimit(this),L.TileLayer.prototype.onAdd.call(this,this._map),this._handleMoveEnd()},getEvents:function(){let t=L.TileLayer.prototype.getEvents.call(this,this._map);return this._parentOnMoveEnd=t.moveend,t.moveend=this._handleMoveEnd,t},_initContainer:function(){this._container||(this._container=L.DomUtil.create("div","leaflet-layer",this.options.pane),L.DomUtil.addClass(this._container,"mapml-templated-tile-container"),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity())},_handleMoveEnd:function(t){let e=this._map.getZoom(),i=M.pixelToPCRSBounds(this._map.getPixelBounds(),e,this._map.options.projection);this.isVisible=e<=this.options.maxZoom&&e>=this.options.minZoom&&this.layerBounds.overlaps(i),this.isVisible&&this._parentOnMoveEnd()},createTile:function(t){let e=document.createElement("DIV"),i=this.getTileSize();if(L.DomUtil.addClass(e,"mapml-tile-group"),L.DomUtil.addClass(e,"leaflet-tile"),this._template.linkEl.dispatchEvent(new CustomEvent("tileloadstart",{detail:{x:t.x,y:t.y,zoom:t.z,appendTile:t=>{e.appendChild(t)}}})),this._template.type.startsWith("image/")){let o=L.TileLayer.prototype.createTile.call(this,t,function(){});o.width=i.x,o.height=i.y,e.appendChild(o)}else this._url.includes(a)||this._fetchTile(t,e);return e},_mapmlTileReady:function(t){L.DomUtil.addClass(t,"leaflet-tile-loaded")},getPane:function(){return this.options.pane},_fetchTile:function(t,e){fetch(this.getTileUrl(t),{redirect:"follow"}).then(function(t){return t.status>=200&&t.status<300?Promise.resolve(t):(console.log("Looks like there was a problem. Status Code: "+t.status),Promise.reject(t))}).then(function(t){return t.text()}).then(t=>{return(new DOMParser).parseFromString(t,"application/xml")}).then(i=>{this._createFeatures(i,t,e),this._mapmlTileReady(e)}).catch(t=>{console.log("Error Creating Tile")})},_createFeatures:function(t,e,i){if(t.querySelector("map-link[rel=stylesheet],map-style")){let e=t.querySelector("map-base")&&t.querySelector("map-base").hasAttribute("href")?new URL(t.querySelector("map-base").getAttribute("href")).href:t.URL;M.parseStylesheetAsHTML(t,e,i)}let o=L.SVG.create("svg"),n=L.SVG.create("g"),a=this._map.options.crs.options.crs.tile.bounds.max.x,s=e.x*a,r=e.y*a,l=M.mapMlFeatures(t,{projection:this._map.options.projection,static:!1,interactive:!1});for(let t in l._layers)for(let i in l._layers[t]._layers){let o=l._layers[t]._layers[i];M.FeatureRenderer.prototype._initPath(o,!1),o._project(this._map,L.point([s,r]),e.z),M.FeatureRenderer.prototype._addPath(o,n,!1),M.FeatureRenderer.prototype._updateFeature(o)}o.setAttribute("width",a.toString()),o.setAttribute("height",a.toString()),o.appendChild(n),i.appendChild(o)},getTileUrl:function(t){if(t.z>=this._template.tilematrix.bounds.length||!this._template.tilematrix.bounds[t.z].contains(t))return"";var e={};for(var i in e[this._template.tilematrix.col.name]=t.x,e[this._template.tilematrix.row.name]=t.y,e[this._template.zoom.name]=this._getZoomForUrl(),e[this._template.pcrs.easting.left]=this._tileMatrixToPCRSPosition(t,"top-left").x,e[this._template.pcrs.easting.right]=this._tileMatrixToPCRSPosition(t,"top-right").x,e[this._template.pcrs.northing.top]=this._tileMatrixToPCRSPosition(t,"top-left").y,e[this._template.pcrs.northing.bottom]=this._tileMatrixToPCRSPosition(t,"bottom-left").y,e[this._template.tile.server]=this._getSubdomain(t),this._template.tile)["row","col","zoom","left","right","top","bottom"].indexOf(i)<0&&(e[i]=this._template.tile[i]);if(this._map&&!this._map.options.crs.infinite){let i=this._globalTileRange.max.y-t.y;this.options.tms&&(e[this._template.tilematrix.row.name]=i)}return e.r=this.options.detectRetina&&L.Browser.retina&&this.options.maxZoom>0?"@2x":"",L.Util.template(this._url,e)},_tileMatrixToPCRSPosition:function(t,e){var i=this._map.options.crs,o=this.getTileSize(),n=t.scaleBy(o),a=n.add(o),s=n.add(Math.floor(o/2)),r=i.transformation.untransform(n,i.scale(t.z)),l=i.transformation.untransform(a,i.scale(t.z)),u=i.transformation.untransform(s,i.scale(t.z)),m=null;switch(e){case"top-left":m=r;break;case"bottom-left":m=new L.Point(r.x,l.y);break;case"center-left":m=new L.Point(r.x,u.y);break;case"top-right":m=new L.Point(l.x,r.y);break;case"bottom-right":m=l;break;case"center-right":m=new L.Point(l.x,u.y);break;case"top-center":m=new L.Point(u.x,r.y);break;case"bottom-center":m=new L.Point(u.x,l.y);break;case"center":m=u}return m},_setUpTileTemplateVars:function(t){t.tile={};for(var e,i,o,n,a,s=t.values,r=this.options.crs.options,l=0;l<t.values.length;l++){var u=s[l].getAttribute("type"),m=s[l].getAttribute("units"),p=s[l].getAttribute("axis"),c=s[l].getAttribute("name"),h=s[l].getAttribute("position"),d="hidden"===u&&s[l].hasAttribute("shard"),_="map-select"===s[l].tagName.toLowerCase(),y=s[l].getAttribute("value"),g=s[l].getAttribute("min"),f=s[l].getAttribute("max");if("location"===u&&"tilematrix"===m)switch(p){case"column":a={name:c,min:r.crs.tilematrix.horizontal.min,max:r.crs.tilematrix.horizontal.max(r.resolutions.length-1)},isNaN(Number.parseFloat(g))||(a.min=Number.parseFloat(g)),isNaN(Number.parseFloat(f))||(a.max=Number.parseFloat(f));break;case"row":n={name:c,min:r.crs.tilematrix.vertical.min,max:r.crs.tilematrix.vertical.max(r.resolutions.length-1)},isNaN(Number.parseFloat(g))||(n.min=Number.parseFloat(g)),isNaN(Number.parseFloat(f))||(n.max=Number.parseFloat(f));break;case"longitude":case"easting":i||(i={min:r.crs.pcrs.horizontal.min,max:r.crs.pcrs.horizontal.max}),isNaN(Number.parseFloat(g))||(i.min=Number.parseFloat(g)),isNaN(Number.parseFloat(f))||(i.max=Number.parseFloat(f)),h&&(h.match(/.*?-left/i)?i.left=c:h.match(/.*?-right/i)&&(i.right=c));break;case"latitude":case"northing":o||(o={min:r.crs.pcrs.vertical.min,max:r.crs.pcrs.vertical.max}),isNaN(Number.parseFloat(g))||(o.min=Number.parseFloat(g)),isNaN(Number.parseFloat(f))||(o.max=Number.parseFloat(f)),h&&(h.match(/top-.*?/i)?o.top=c:h.match(/bottom-.*?/i)&&(o.bottom=c))}else if(u&&"zoom"===u.toLowerCase())e={name:c,min:0,max:r.resolutions.length,value:r.resolutions.length},!isNaN(Number.parseInt(y,10))&&Number.parseInt(y,10)>=e.min&&Number.parseInt(y,10)<=e.max?e.value=Number.parseInt(y,10):e.value=e.max,!isNaN(Number.parseInt(g,10))&&Number.parseInt(g,10)>=e.min&&Number.parseInt(g,10)<=e.max&&(e.min=Number.parseInt(g,10)),!isNaN(Number.parseInt(f,10))&&Number.parseInt(f,10)>=e.min&&Number.parseInt(f,10)<=e.max&&(e.max=Number.parseInt(f,10)),t.zoom=e;else if(d)t.tile.server=c,t.tile.subdomains=s[l].servers.slice();else if(_){const e=s[l].htmlselect;t.tile[c]=function(){return e.value}}else{const e=s[l];t.tile[c]=function(){return e.getAttribute("value")}}}var x=this.options.crs.transformation,b=this.options.crs.options.crs.tile.bounds.max.x,v=L.bind(this.options.crs.scale,this.options.crs),A=function(t,e){return x.transform(t,v(e)).divideBy(b).floor()};i&&o?(t.pcrs={},t.pcrs.bounds=L.bounds([i.min,o.min],[i.max,o.max]),t.pcrs.easting=i,t.pcrs.northing=o):a&&n&&!isNaN(e.value)?(t.pcrs||(t.pcrs={},t.pcrs.easting="",t.pcrs.northing=""),t.pcrs.bounds=M.boundsToPCRSBounds(L.bounds(L.point([a.min,n.min]),L.point([a.max,n.max])),e.value,this.options.crs,M.axisToCS("column")),t.tilematrix={},t.tilematrix.col=a,t.tilematrix.row=n):console.log("Unable to determine bounds for tile template: "+t.template),t.tilematrix||(t.tilematrix={},t.tilematrix.col={},t.tilematrix.row={}),t.tilematrix.bounds=[];for(var C=t.pcrs.bounds,S=t.zoom?t.zoom.min:0,E=t.zoom?t.zoom.max:r.resolutions.length,T=0;T<=E;T++)t.tilematrix.bounds[T]=T>=S?L.bounds(A(C.min,T),A(C.max,T)):L.bounds(L.point([-1,-1]),L.point([-1,-1]))}}),u=function(t,e){return new l(t,e)},m=L.Layer.extend({initialize:function(t,e){this._templates=t,L.setOptions(this,e),this._container=L.DomUtil.create("div","leaflet-layer",e.pane),L.DomUtil.addClass(this._container,"mapml-templatedlayer-container");for(var i=0;i<t.length;i++)if("tile"===t[i].rel)this._templates[i].layer=M.templatedTileLayer(t[i],L.Util.extend(e,{errorTileUrl:"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",zIndex:i,pane:this._container}));else if("image"===t[i].rel)this._templates[i].layer=M.templatedImageLayer(t[i],L.Util.extend(e,{zIndex:i,pane:this._container}));else if("features"===t[i].rel)this._templates[i].layer=M.templatedFeaturesLayer(t[i],L.Util.extend(e,{zIndex:i,pane:this._container}));else if("query"===t[i].rel){this.hasSetBoundsHandler=!0,this._queries||(this._queries=[]);let e=M.extractInputBounds(t[i]);t[i].layerBounds=e.bounds,t[i].zoomBounds=e.zoomBounds,this._queries.push(L.extend(t[i],this._setupQueryVars(t[i])))}},getEvents:function(){return{zoomstart:this._onZoomStart}},redraw:function(){this.closePopup();for(var t=0;t<this._templates.length;t++)"tile"!==this._templates[t].rel&&"image"!==this._templates[t].rel&&"features"!==this._templates[t].rel||this._templates[t].layer.redraw()},_onZoomStart:function(){this.closePopup()},_setupQueryVars:function(t){for(var e={query:{}},i=t.values,o=0;o<t.values.length;o++){var n=i[o].getAttribute("type"),a=i[o].getAttribute("units"),s=i[o].getAttribute("axis"),r=i[o].getAttribute("name"),l=i[o].getAttribute("position"),u=i[o].getAttribute("rel"),m="map-select"===i[o].tagName.toLowerCase();if("width"===n)e.query.width=r;else if("height"===n)e.query.height=r;else if("location"===n)switch(s){case"x":case"y":case"column":case"row":e.query[s]=r;break;case"longitude":case"easting":l?l.match(/.*?-left/i)?"pixel"===u?e.query.pixelleft=r:"tile"===u?e.query.tileleft=r:e.query.mapleft=r:l.match(/.*?-right/i)&&("pixel"===u?e.query.pixelright=r:"tile"===u?e.query.tileright=r:e.query.mapright=r):e.query[s]=r;break;case"latitude":case"northing":l?l.match(/top-.*?/i)?"pixel"===u?e.query.pixeltop=r:"tile"===u?e.query.tiletop=r:e.query.maptop=r:l.match(/bottom-.*?/i)&&("pixel"===u?e.query.pixelbottom=r:"tile"===u?e.query.tilebottom=r:e.query.mapbottom=r):e.query[s]=r;break;case"i":"tile"===a?e.query.tilei=r:e.query.mapi=r;break;case"j":"tile"===a?e.query.tilej=r:e.query.mapj=r}else if("zoom"===n)e.query.zoom=r;else if(m){const t=i[o].htmlselect;e.query[r]=function(){return t.value}}else{const t=i[o];e.query[r]=function(){return t.getAttribute("value")}}}return e.query.title=t.title,e},reset:function(t){if(t&&this._map){var e=this._map&&this._map.hasLayer(this),i=this._templates;delete this._queries,this._map.off("click",null,this),this._templates=t;for(var o=0;o<t.length;o++)"tile"===t[o].rel?this._templates[o].layer=M.templatedTileLayer(t[o],L.Util.extend(this.options,{errorTileUrl:"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",zIndex:o,pane:this._container})):"image"===t[o].rel?this._templates[o].layer=M.templatedImageLayer(t[o],L.Util.extend(this.options,{zIndex:o,pane:this._container})):"features"===t[o].rel?this._templates[o].layer=M.templatedFeaturesLayer(t[o],L.Util.extend(this.options,{zIndex:o,pane:this._container})):"query"===t[o].rel&&(this._queries||(this._queries=[]),this._queries.push(L.extend(t[o],this._setupQueryVars(t[o])))),e&&this.onAdd(this._map);for(o=0;o<i.length;o++)this._map.hasLayer(i[o].layer)&&this._map.removeLayer(i[o].layer)}},onAdd:function(t){for(var e=0;e<this._templates.length;e++)"query"!==this._templates[e].rel&&t.addLayer(this._templates[e].layer)},onRemove:function(t){L.DomUtil.remove(this._container);for(var e=0;e<this._templates.length;e++)"query"!==this._templates[e].rel&&t.removeLayer(this._templates[e].layer)},_previousFeature:function(t){this._count+-1>=0&&(this._count--,this._map.fire("featurepagination",{i:this._count,popup:this}))},_nextFeature:function(t){this._count+1<this._source._totalFeatureCount&&(this._count++,this._map.fire("featurepagination",{i:this._count,popup:this}))}}),p=function(t,e){return new m(t,e)},c=L.Layer.extend({initialize:function(t,e){let i=M.extractInputBounds(t);this.zoomBounds=i.zoomBounds,this.layerBounds=i.bounds,this.isVisible=!0,this._template=t,this._container=L.DomUtil.create("div","leaflet-layer",e.pane),L.extend(e,this.zoomBounds),L.DomUtil.addClass(this._container,"mapml-features-container"),L.setOptions(this,L.extend(e,this._setUpFeaturesTemplateVars(t)))},getEvents:function(){return{moveend:this._onMoveEnd}},onAdd:function(){this._map._addZoomLimit(this);var t,e=new Headers({Accept:"text/mapml"}),i=new DOMParser,o=this.options.opacity||1,n=this._container,a=this._map;this._features||(this._features=M.mapMlFeatures(null,{renderer:M.featureRenderer(),pane:n,opacity:o,projection:a.options.projection,static:!0,onEachFeature:function(t,e){var i=document.createElement("div");i.classList.add("mapml-popup-content"),i.insertAdjacentHTML("afterbegin",t.innerHTML),e.bindPopup(i,{autoClose:!1,minWidth:108})}}));var s=this._features,r=function(o,n){return fetch(o,{redirect:"follow",headers:e}).then(function(t){return t.text()}).then(function(e){t=i.parseFromString(e,"application/xml");var a=new URL(t.querySelector("map-base")?t.querySelector("map-base").getAttribute("href"):o).href;o=(o=t.querySelector("map-link[rel=next]")?t.querySelector("map-link[rel=next]").getAttribute("href"):null)?new URL(o,a).href:null;let l=t.querySelector("map-meta[name=zoom]")&&+M.metaContentToObject(t.querySelector("map-meta[name=zoom]").getAttribute("content")).value||0,u=t.querySelector("map-meta[name=cs]")&&M.metaContentToObject(t.querySelector("map-meta[name=cs]").getAttribute("content")).content||"GCRS";if(s.addData(t,u,l),o&&--n)return r(o,n)})};r(this._getfeaturesUrl(),10).then(function(){a.addLayer(s),a.fire("moveend")}).catch(function(t){console.log(t)})},redraw:function(){this._onMoveEnd()},_onMoveEnd:function(){let t=this._map.getZoom(),e=M.pixelToPCRSBounds(this._map.getPixelBounds(),t,this._map.options.projection);if(this.isVisible=t<=this.zoomBounds.maxZoom&&t>=this.zoomBounds.minZoom&&this.layerBounds.overlaps(e),this._features.clearLayers(),this.isVisible){var i,o=new Headers({Accept:"text/mapml;q=0.9,application/geo+json;q=0.8"}),n=new DOMParser,a=this._features,s=this._map,r=this,l=function(t,e){return fetch(t,{redirect:"follow",headers:o}).then(function(t){return t.text()}).then(function(o){i=n.parseFromString(o,"application/xml");var s=new URL(i.querySelector("map-base")?i.querySelector("map-base").getAttribute("href"):t).href;t=(t=i.querySelector("map-link[rel=next]")?i.querySelector("map-link[rel=next]").getAttribute("href"):null)?new URL(t,s).href:null;let r=i.querySelector("map-meta[name=zoom]")&&+M.metaContentToObject(i.querySelector("map-meta[name=zoom]").getAttribute("content")).value||0,u=i.querySelector("map-meta[name=cs]")&&M.metaContentToObject(i.querySelector("map-meta[name=cs]").getAttribute("content")).content||"GCRS";if(a.addData(i,u,r),t&&--e)return l(t,e)})};l(this._getfeaturesUrl(),10).then(function(){s.addLayer(a),M.TemplatedFeaturesLayer.prototype._updateTabIndex(r)}).catch(function(t){console.log(t)})}},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},_updateTabIndex:function(t){let e=t||this;for(let t in e._features._layers){let i=e._features._layers[t];if(i._path&&("M0 0"!==i._path.getAttribute("d")?i._path.setAttribute("tabindex",0):i._path.removeAttribute("tabindex"),0===i._path.childElementCount)){let t=document.createElement("title");t.innerText="Feature",i._path.appendChild(t)}}},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},onRemove:function(){this._map.removeLayer(this._features)},_getfeaturesUrl:function(){var t={};for(var e in this.options.feature.zoom&&(t[this.options.feature.zoom]=this._map.getZoom()),this.options.feature.width&&(t[this.options.feature.width]=this._map.getSize().x),this.options.feature.height&&(t[this.options.feature.height]=this._map.getSize().y),this.options.feature.bottom&&(t[this.options.feature.bottom]=this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).y),this.options.feature.left&&(t[this.options.feature.left]=this._TCRSToPCRS(this._map.getPixelBounds().min,this._map.getZoom()).x),this.options.feature.top&&(t[this.options.feature.top]=this._TCRSToPCRS(this._map.getPixelBounds().min,this._map.getZoom()).y),this.options.feature.right&&(t[this.options.feature.right]=this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).x),this.options.feature)["width","height","left","right","top","bottom","zoom"].indexOf(e)<0&&(t[e]=this.options.feature[e]);return L.Util.template(this._template.template,t)},_TCRSToPCRS:function(t,e){var i=this._map.options.crs;return i.transformation.untransform(t,i.scale(e))},_setUpFeaturesTemplateVars:function(t){var e={feature:{}},i=t.values;e.feature.hidden=[];for(var o=0;o<i.length;o++){var n=i[o].getAttribute("type"),a=i[o].getAttribute("units"),s=i[o].getAttribute("axis"),r=i[o].getAttribute("name"),l=i[o].getAttribute("position"),u=(i[o].getAttribute("value"),"map-select"===i[o].tagName.toLowerCase());if("width"===n)e.feature.width=r;else if("height"===n)e.feature.height=r;else if("zoom"===n)e.feature.zoom=r;else if("location"!==n||"pcrs"!==a&&"gcrs"!==a)if(u){const t=i[o].htmlselect;e.feature[r]=function(){return t.value}}else{const t=i[o];e.feature[r]=function(){return t.getAttribute("value")}}else switch(s){case"x":case"longitude":case"easting":l&&(l.match(/.*?-left/i)?e.feature.left=r:l.match(/.*?-right/i)&&(e.feature.right=r));break;case"y":case"latitude":case"northing":l&&(l.match(/top-.*?/i)?e.feature.top=r:l.match(/bottom-.*?/i)&&(e.feature.bottom=r))}}return e}}),h=function(t,e){return new c(t,e)},d=L.Layer.extend({initialize:function(t,e){this._template=t,this._container=L.DomUtil.create("div","leaflet-layer",e.pane),L.DomUtil.addClass(this._container,"mapml-image-container");let i=M.extractInputBounds(t);this.zoomBounds=i.zoomBounds,this.layerBounds=i.bounds,this.isVisible=!0,L.extend(e,this.zoomBounds),L.setOptions(this,L.extend(e,this._setUpExtentTemplateVars(t)))},getEvents:function(){return{moveend:this._onMoveEnd}},onAdd:function(){this._map._addZoomLimit(this),this.setZIndex(this.options.zIndex),this._onMoveEnd()},redraw:function(){this._onMoveEnd()},_clearLayer:function(){let t=this._container.querySelectorAll("img");for(let e=0;e<t.length;e++)this._container.removeChild(t[e])},_onMoveEnd:function(){let t=this._map.getZoom(),e=M.pixelToPCRSBounds(this._map.getPixelBounds(),t,this._map.options.projection);if(this.isVisible=t<=this.zoomBounds.maxZoom&&t>=this.zoomBounds.minZoom&&this.layerBounds.overlaps(e),this.isVisible){var i=this._map,o=i.getPixelBounds().min.subtract(i.getPixelOrigin()),n=i.getSize(),a=this.getImageUrl(),s=this._imageOverlay;this._imageOverlay=M.imageOverlay(a,o,n,0,this._container),this._imageOverlay.addTo(i),s&&this._imageOverlay.on("load error",function(){i.removeLayer(s)})}else this._clearLayer()},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},onRemove:function(t){this._clearLayer(),t._removeZoomLimit(this),this._container=null},getImageUrl:function(){var t={};for(var e in t[this.options.extent.width]=this._map.getSize().x,t[this.options.extent.height]=this._map.getSize().y,t[this.options.extent.bottom]=this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).y,t[this.options.extent.left]=this._TCRSToPCRS(this._map.getPixelBounds().min,this._map.getZoom()).x,t[this.options.extent.top]=this._TCRSToPCRS(this._map.getPixelBounds().min,this._map.getZoom()).y,t[this.options.extent.right]=this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).x,this.options.extent)["width","height","left","right","top","bottom"].indexOf(e)<0&&(t[e]=this.options.extent[e]);return L.Util.template(this._template.template,t)},_TCRSToPCRS:function(t,e){var i=this._map.options.crs;return i.transformation.untransform(t,i.scale(e))},_setUpExtentTemplateVars:function(t){for(var e={extent:{}},i=t.values,o=0;o<t.values.length;o++){var n=i[o].getAttribute("type"),a=i[o].getAttribute("units"),s=i[o].getAttribute("axis"),r=i[o].getAttribute("name"),l=i[o].getAttribute("position"),u="map-select"===i[o].tagName.toLowerCase();if("width"===n)e.extent.width=r;else if("height"===n)e.extent.height=r;else if("location"!==n||"pcrs"!==a&&"gcrs"!==a)if(u){const t=i[o].htmlselect;e.extent[r]=function(){return t.value}}else{const t=i[o];e.extent[r]=function(){return t.getAttribute("value")}}else switch(s){case"longitude":case"easting":l&&(l.match(/.*?-left/i)?e.extent.left=r:l.match(/.*?-right/i)&&(e.extent.right=r));break;case"latitude":case"northing":l&&(l.match(/top-.*?/i)?e.extent.top=r:l.match(/bottom-.*?/i)&&(e.extent.bottom=r))}}return e}}),_=function(t,e){return new d(t,e)},y=L.ImageOverlay.extend({initialize:function(t,e,i,o,n,a){this._container=n,this._url=t,this._location=e,this._size=L.point(i),this._angle=o,L.setOptions(this,a)},getEvents:function(){var t={viewreset:this._reset};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},onAdd:function(){this.on({load:this._onImageLoad}),this._image||this._initImage(),this.options.interactive&&(L.DomUtil.addClass(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this._container.appendChild(this._image),this._reset()},onRemove:function(){L.DomUtil.remove(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},_onImageLoad:function(){this._image&&(this._image.loaded=+new Date,this._updateOpacity())},_animateZoom:function(t){var e=this._map.getZoomScale(t.zoom),i=this._map.getPixelOrigin().add(this._location).multiplyBy(e).subtract(this._map._getNewPixelOrigin(t.center,t.zoom)).round();L.Browser.any3d?L.DomUtil.setTransform(this._image,i,e):L.DomUtil.setPosition(this._image,i)},_reset:function(){var t=this._image,e=this._location,i=this._size;L.DomUtil.setPosition(t,e),t.style.width=i.x+"px",t.style.height=i.y+"px"},_updateOpacity:function(){if(this._map){var t=+new Date,e=!1,i=this._image,o=Math.min(1,(t-i.loaded)/200);L.DomUtil.setOpacity(i,o),o<1&&(e=!0),e&&(L.Util.cancelAnimFrame(this._fadeFrame),this._fadeFrame=L.Util.requestAnimFrame(this._updateOpacity,this)),L.DomUtil.addClass(i,"leaflet-image-loaded")}}}),g=function(t,e,i,o,n,a){return new y(t,e,i,o,n,a)},f=L.Layer.extend({options:{maxNext:10,zIndex:0,maxZoom:25},initialize:function(t,e,i){var o;t&&(this._href=t),e&&(this._layerEl=e,o=!!e.querySelector("map-feature,map-tile,map-extent"),!t&&o&&(this._content=e)),L.setOptions(this,i),this._container=L.DomUtil.create("div","leaflet-layer"),L.DomUtil.addClass(this._container,"mapml-layer"),this._imageContainer=L.DomUtil.create("div","leaflet-layer",this._container),L.DomUtil.addClass(this._imageContainer,"mapml-image-container"),this._mapmlTileContainer=L.DomUtil.create("div","mapml-tile-container",this._container),!o&&e&&e.hasAttribute("label")&&(this._title=e.getAttribute("label")),this._initCount=0,this._initExtent(o?e:null),this.on("attached",this._validateExtent,this),this.validProjection=!0},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},_changeOpacity:function(t){t&&t.target&&t.target.value>=0&&t.target.value<=1&&this.changeOpacity(t.target.value)},changeOpacity:function(t){this._container.style.opacity=t,this.opacityEl&&(this.opacityEl.value=t)},onAdd:function(t){!this._extent||this._validProjection(t)?(this._map=t,this._content?(this._mapmlvectors||(this._mapmlvectors=M.mapMlFeatures(this._content,{renderer:M.featureRenderer(),pane:this._container,opacity:this.options.opacity,projection:t.options.projection,_leafletLayer:this,static:!0,onEachFeature:function(t,e){if(t){var i=document.createElement("div");i.classList.add("mapml-popup-content"),i.insertAdjacentHTML("afterbegin",t.innerHTML),e.bindPopup(i,{autoClose:!1,minWidth:165})}}})),t.addLayer(this._mapmlvectors)):this.once("extentload",function(){this._validProjection(t)?(this._mapmlvectors||(this._mapmlvectors=M.mapMlFeatures(this._content,{renderer:M.featureRenderer(),pane:this._container,opacity:this.options.opacity,projection:t.options.projection,_leafletLayer:this,static:!0,onEachFeature:function(t,e){if(t){var i=document.createElement("div");i.classList.add("mapml-popup-content"),i.insertAdjacentHTML("afterbegin",t.innerHTML),e.bindPopup(i,{autoClose:!1,minWidth:165})}}}).addTo(t)),this._setLayerElExtent()):this.validProjection=!1},this),this._imageLayer||(this._imageLayer=L.layerGroup()),t.addLayer(this._imageLayer),(!this._staticTileLayer||null===this._staticTileLayer._container)&&this._mapmlTileContainer.getElementsByTagName("map-tiles").length>0&&(this._staticTileLayer=M.mapMLStaticTileLayer({pane:this._container,_leafletLayer:this,className:"mapml-static-tile-layer",tileContainer:this._mapmlTileContainer,maxZoomBound:t.options.crs.options.resolutions.length-1,tileSize:t.options.crs.options.crs.tile.bounds.max.x}),t.addLayer(this._staticTileLayer)),this._extent?this._templateVars&&(this._templatedLayer=M.templatedLayer(this._templateVars,{pane:this._container,_leafletLayer:this,crs:this.crs}).addTo(t)):this.once("extentload",function(){this._validProjection(t)?this._templateVars&&(this._templatedLayer=M.templatedLayer(this._templateVars,{pane:this._container,_leafletLayer:this,crs:this.crs}).addTo(t),this._setLayerElExtent()):this.validProjection=!1},this),this._setLayerElExtent(),this.setZIndex(this.options.zIndex),this.getPane().appendChild(this._container),setTimeout(()=>{t.fire("checkdisabled")},0),t.on("popupopen",this._attachSkipButtons,this)):this.validProjection=!1},_validProjection:function(t){let e=!1;if(this._templateVars)for(let i of this._templateVars)i.projectionMatch||i.projection===t.options.projection||(e=!0);return!(e||this.getProjection()!==t.options.projection.toUpperCase())},_setLayerElExtent:function(){let t,e;["_staticTileLayer","_imageLayer","_mapmlvectors","_templatedLayer"].forEach(i=>{if(this[i])if("_templatedLayer"===i)for(let o=0;o<this[i]._templates.length;o++)"query"!==this[i]._templates[o].rel&&this[i]._templates[o].layer.layerBounds&&(t?(t.extend(this[i]._templates[o].layer.layerBounds.min),t.extend(this[i]._templates[o].layer.layerBounds.max)):(t=this[i]._templates[o].layer.layerBounds,e=this[i]._templates[o].layer.zoomBounds));else this[i].layerBounds&&(t?(t.extend(this[i].layerBounds.min),t.extend(this[i].layerBounds.max)):(t=this[i].layerBounds,e=this[i].zoomBounds))}),t&&(this._layerEl.extent=Object.assign(M.convertAndFormatPCRS(t,this._map),{zoom:e}))},addTo:function(t){return t.addLayer(this),this},getEvents:function(){return{zoomanim:this._onZoomAnim}},redraw:function(){this._templatedLayer&&this._templatedLayer.redraw()},_onZoomAnim:function(t){var e=t.zoom,i=this._extent?this._extent.querySelector("map-input[type=zoom]"):null,o=i&&i.hasAttribute("min")?parseInt(i.getAttribute("min")):this._map.getMinZoom(),n=i&&i.hasAttribute("max")?parseInt(i.getAttribute("max")):this._map.getMaxZoom();e<o&&this._extent.zoomout||e>n&&this._extent.zoomin;o<=e&&e<=n||(this._extent.zoomin&&e>n?(this._href=this._extent.zoomin,this._layerEl.src=this._extent.zoomin,this.href=this._extent.zoomin,this._layerEl.src=this._extent.zoomin):this._extent.zoomout&&e<o&&(this._href=this._extent.zoomout,this.href=this._extent.zoomout,this._layerEl.src=this._extent.zoomout)),this._templatedLayer},onRemove:function(t){L.DomUtil.remove(this._container),this._staticTileLayer&&t.removeLayer(this._staticTileLayer),this._mapmlvectors&&t.removeLayer(this._mapmlvectors),this._imageLayer&&t.removeLayer(this._imageLayer),this._templatedLayer&&t.removeLayer(this._templatedLayer),t.fire("checkdisabled"),t.off("popupopen",this._attachSkipButtons)},getZoomBounds:function(){var t=this._extent,e=t?t.querySelector("[type=zoom]"):void 0,i=e&&e.hasAttribute("min")?e.getAttribute("min"):this._map.getMinZoom(),o=e&&e.hasAttribute("max")?e.getAttribute("max"):this._map.getMaxZoom(),n={};return n.min=Math.min(i,o),n.max=Math.max(i,o),n},_transformDeprectatedInput:function(t){var e=t.getAttribute("type").toLowerCase();if("xmin"===e||"ymin"===e||"xmax"===e||"ymax"===e)switch(t.setAttribute("type","location"),t.setAttribute("units","tcrs"),e){case"xmin":t.setAttribute("axis","x"),t.setAttribute("position","top-left");break;case"ymin":t.setAttribute("axis","y"),t.setAttribute("position","top-left");break;case"xmax":t.setAttribute("axis","x"),t.setAttribute("position","bottom-right");break;case"ymax":t.setAttribute("axis","y"),t.setAttribute("position","bottom-right")}},getLayerExtentBounds:function(t){if(this._extent){var e,i,o,n,a,s,r,l,u=t.getZoom(),m=t.options.projection,p=m!==this._extent.getAttribute("units");if(s=this._extent.querySelector("[type=xmin]").getAttribute("min"),r=this._extent.querySelector("[type=xmax]").getAttribute("min"),i=Math.min(s,r),s=this._extent.querySelector("[type=xmin]").getAttribute("max"),r=this._extent.querySelector("[type=xmax]").getAttribute("max"),n=Math.max(s,r),s=this._extent.querySelector("[type=ymin]").getAttribute("min"),r=this._extent.querySelector("[type=ymax]").getAttribute("min"),o=Math.min(s,r),s=this._extent.querySelector("[type=ymin]").getAttribute("max"),r=this._extent.querySelector("[type=ymax]").getAttribute("max"),a=Math.max(s,r),p){var c=[(e=M[m]).latLngToPoint(L.latLng([o,i]),u),e.latLngToPoint(L.latLng([a,n]),u),e.latLngToPoint(L.latLng([o,i]),u),e.latLngToPoint(L.latLng([o,n]),u)];return L.bounds(c)}return(l=parseInt(this._extent.querySelector("[type=zoom]").getAttribute("value")))!==u?(e=M[m],L.bounds(e.latLngToPoint(e.pointToLatLng(L.point(i,o),l),u),e.latLngToPoint(e.pointToLatLng(L.point(n,a),l),u))):L.bounds(L.point(i,o),L.point(n,a))}},getAttribution:function(){return this.options.attribution},getLayerUserControlsHTML:function(){var t=L.DomUtil.create("fieldset","mapml-layer-item"),e=L.DomUtil.create("input"),i=L.DomUtil.create("span","mapml-layer-item-name"),o=L.DomUtil.create("span"),n=L.DomUtil.create("div","mapml-layer-item-properties",t),a=L.DomUtil.create("div","mapml-layer-item-settings",t),s=L.DomUtil.create("label","mapml-layer-item-toggle",n),r=L.DomUtil.create("div","mapml-layer-item-controls",n),l=L.DomUtil.create("details","mapml-layer-item-opacity mapml-control-layers",a),u=L.DomUtil.create("input"),m=L.DomUtil.create("summary"),p=L.SVG.create("svg"),c=L.SVG.create("path"),h=L.SVG.create("path"),d=this._layerEl.parentNode;this.opacityEl=u,p.setAttribute("viewBox","0 0 24 24"),p.setAttribute("height","22"),p.setAttribute("width","22"),c.setAttribute("d","M0 0h24v24H0z"),c.setAttribute("fill","none"),h.setAttribute("d","M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"),p.appendChild(c),p.appendChild(h),a.hidden=!0,o.setAttribute("aria-hidden",!0);let _=L.DomUtil.create("button","mapml-layer-item-remove-control",r);_.type="button",_.title="Remove Layer",_.innerHTML="<span aria-hidden='true'>&#10005;</span>",_.classList.add("mapml-button"),L.DomEvent.on(_,"click",L.DomEvent.stop),L.DomEvent.on(_,"click",t=>{let e,i,o=0;if(i="MAPML-VIEWER"===d.tagName?d.shadowRoot:d.querySelector(".mapml-web-map").shadowRoot,t.target.closest("fieldset").nextElementSibling&&!t.target.closest("fieldset").nextElementSibling.disbaled)for(e=t.target.closest("fieldset").previousElementSibling;e;)o+=2,e=e.previousElementSibling;else e="link";d.removeChild(t.target.closest("fieldset").querySelector("span").layer._layerEl),(e=e?i.querySelector(".leaflet-control-attribution").firstElementChild:e=i.querySelectorAll("input")[o]).focus()},this);let y=L.DomUtil.create("button","mapml-layer-item-settings-control",r);if(y.type="button",y.title="Layer Settings",y.setAttribute("aria-expanded",!1),y.classList.add("mapml-button"),L.DomEvent.on(y,"click",t=>{1==a.hidden?(y.setAttribute("aria-expanded",!0),a.hidden=!1):(y.setAttribute("aria-expanded",!1),a.hidden=!0)},this),e.defaultChecked=!!this._map,e.type="checkbox",i.layer=this,this._legendUrl){var g=document.createElement("a");g.text=" "+this._title,g.href=this._legendUrl,g.target="_blank",g.draggable=!1,i.appendChild(g)}else i.innerHTML=this._title;if(i.id="mapml-layer-item-name-{"+L.stamp(i)+"}",m.innerText="Opacity",m.id="mapml-layer-item-opacity-"+L.stamp(m),l.appendChild(m),l.appendChild(u),u.setAttribute("type","range"),u.setAttribute("min","0"),u.setAttribute("max","1.0"),u.setAttribute("value",this._container.style.opacity||"1.0"),u.setAttribute("step","0.1"),u.setAttribute("aria-labelledby",m.id),u.value=this._container.style.opacity||"1.0",t.setAttribute("aria-grabbed","false"),t.setAttribute("aria-labelledby",i.id),t.onmousedown=(e=>{if("input"===e.target.tagName.toLowerCase()||"select"===e.target.tagName.toLowerCase())return;e.preventDefault();let i=t,o=t.parentNode,n=!1,a=e.clientY;document.body.onmousemove=(t=>{t.preventDefault();let e=t.clientY-a;if(n=Math.abs(e)>5||n,o&&!n||o&&o.childElementCount<=1||o.getBoundingClientRect().top>i.getBoundingClientRect().bottom||o.getBoundingClientRect().bottom<i.getBoundingClientRect().top)return;o.classList.add("mapml-draggable"),i.style.transform="translateY("+e+"px)",i.style.pointerEvents="none";let s=t.clientX,r=t.clientY,l=("MAPML-VIEWER"===d.tagName?d.shadowRoot:d.querySelector(".mapml-web-map").shadowRoot).elementFromPoint(s,r),u=l&&l.closest("fieldset")?l.closest("fieldset"):i;u=Math.abs(e)<=u.offsetHeight?i:u,i.setAttribute("aria-grabbed","true"),i.setAttribute("aria-dropeffect","move"),u&&o===u.parentNode&&(u=u!==i.nextSibling?u:u.nextSibling,i!==u&&(a=t.clientY,i.style.transform=null),o.insertBefore(i,u))}),document.body.onmouseup=(()=>{i.setAttribute("aria-grabbed","false"),i.removeAttribute("aria-dropeffect"),i.style.pointerEvents=null,i.style.transform=null;let t=o.children,e=1;for(let i of t){let t=i.querySelector("span").layer._layerEl;t.setAttribute("data-moving",""),d.insertAdjacentElement("beforeend",t),t.removeAttribute("data-moving"),t._layer.setZIndex(e),e++}o.classList.remove("mapml-draggable"),document.body.onmousemove=document.body.onmouseup=null})}),L.DomEvent.on(u,"change",this._changeOpacity,this),s.appendChild(e),s.appendChild(i),y.appendChild(o),o.appendChild(p),this._styles&&a.appendChild(this._styles),this._userInputs){var f=document.createDocumentFragment(),x=this._templateVars;if(x)for(var b=0;b<x.length;b++)for(var v=x[b],A=0;A<v.values.length;A++){var M=v.values[A],C="#"+M.getAttribute("id");if("map-select"===M.tagName.toLowerCase()&&!f.querySelector(C)){var S=L.DomUtil.create("details","mapml-layer-item-time mapml-control-layers",f),E=L.DomUtil.create("summary"),T=L.DomUtil.create("label");T.innerText=M.getAttribute("name"),T.setAttribute("for",M.getAttribute("id")),E.appendChild(T),S.appendChild(E),S.appendChild(M.htmlselect)}}a.appendChild(f)}return t},_initExtent:function(t){if(this._href||t){var e,i,o=this;if(this._href){var s=new XMLHttpRequest;e=this._href,i=l,s.onreadystatechange=function(){this.readyState===this.DONE&&(400!==this.status&&404!==this.status&&500!==this.status&&406!==this.status||(o.error=!0,o.fire("extentload",o,!0),s.abort()))},s.onload=i,s.onerror=function(){o.error=!0,o.fire("extentload",o,!0)},s.open("GET",e),s.setRequestHeader("Accept",M.mime),s.overrideMimeType("text/xml"),s.send()}else t&&l.call(this,t)}function r(t){var e=document.createElement("select"),i=t.getAttributeNames();for(let o=0;o<i.length;o++)e.setAttribute(i[o],t.getAttribute(i[o]));var o=t.children;for(let t=0;t<o.length;t++){var n=document.createElement("option"),a=o[t].getAttributeNames();for(let e=0;e<a.length;e++)n.setAttribute(a[e],o[t].getAttribute(a[e]));n.innerHTML=o[t].innerHTML,e.appendChild(n)}return e}function l(t){var e=this.responseXML||t;if(e.querySelector&&e.querySelector("map-feature")&&(o._content=e),!this.responseXML&&this.responseText&&(e=(new DOMParser).parseFromString(this.responseText,"text/xml")),this.readyState===this.DONE&&e.querySelector&&!e.querySelector("parsererror")){var i,s=e.querySelector("map-extent")||e.querySelector("map-meta[name=projection]");"map-extent"===s.tagName.toLowerCase()&&s.hasAttribute("units")?i=s.getAttribute("units"):"map-meta"===s.tagName.toLowerCase()&&s.hasAttribute("content")&&(i=M.metaContentToObject(s.getAttribute("content")).content);var l=i&&i===o.options.mapprojection,u=e.querySelector("map-meta[name=extent]"),m=!l&&e.querySelector("map-head map-link[rel=alternate][projection="+o.options.mapprojection+"]"),p=new URL(e.querySelector("map-base")?e.querySelector("map-base").getAttribute("href"):e.baseURI||this.responseURL,this.responseURL).href;if(s){if(!l&&m&&m.hasAttribute("href"))return void o.fire("changeprojection",{href:new URL(m.getAttribute("href"),p).href},!1);if(!l&&o._map&&1===o._map.options.mapEl.querySelectorAll("layer-").length)return void(o._map.options.mapEl.projection=i);if(s.querySelector("map-link[rel=tile],map-link[rel=image],map-link[rel=features],map-link[rel=query]")&&s.hasAttribute("units")){o._templateVars=[];var c=s.querySelectorAll("map-link[rel=tile],map-link[rel=image],map-link[rel=features],map-link[rel=query]"),h=new RegExp("(?:{)(.*?)(?:})","g"),d=s.querySelector('map-input[type="zoom" i]'),_=!1,y={zoom:0};if(u){let t=M.metaContentToObject(u.getAttribute("content"));y.zoom=t.zoom||y.zoom;let e=Object.keys(t);for(let t=0;t<e.length;t++)if(!e[t].includes("zoom")){y.cs=M.axisToCS(e[t].split("-")[2]);break}let o=M.csToAxes(y.cs);y.bounds=M.boundsToPCRSBounds(L.bounds(L.point(+t[`top-left-${o[0]}`],+t[`top-left-${o[1]}`]),L.point(+t[`bottom-right-${o[0]}`],+t[`bottom-right-${o[1]}`])),y.zoom,i,y.cs)}else y.bounds=M[i].options.crs.pcrs.bounds,y.cs="PCRS";for(var g=0;g<c.length;g++){var f=c[g],x=f.getAttribute("tref");if(!x){x=a;let t=e.querySelectorAll("map-input");for(let e of t)x+=`{${e.getAttribute("name")}}`}for(var b,v=f.hasAttribute("title")?f.getAttribute("title"):"Query this layer",A=x.match(h),C=f.hasAttribute("rel")&&"tile"!==f.getAttribute("rel").toLowerCase()?f.getAttribute("rel").toLowerCase():"tile",S=f.hasAttribute("type")?f.getAttribute("type").toLowerCase():"image/*",E=[],T=f&&f.hasAttribute("tms"),z=e.querySelector("map-meta[name=zoom]")?M.metaContentToObject(e.querySelector("map-meta[name=zoom]").getAttribute("content")):void 0;null!==(b=h.exec(x));){var k=b[1],P=s.querySelector("map-input[name="+k+"],map-select[name="+k+"]");if(!P){console.log("input with name="+k+" not found for template variable of same name");break}if(P.hasAttribute("type")&&"location"===P.getAttribute("type")&&!P.hasAttribute("min")&&P.hasAttribute("axis")&&!["i","j"].includes(P.getAttribute("axis").toLowerCase())){d.setAttribute("value",y.zoom);let t=P.getAttribute("axis"),e=M.convertPCRSBounds(y.bounds,y.zoom,i,M.axisToCS(t));P.setAttribute("min",e.min[M.axisToXY(t)]),P.setAttribute("max",e.max[M.axisToXY(t)])}if(E.push(P),_=_||P.hasAttribute("type")&&"zoom"===P.getAttribute("type").toLowerCase(),P.hasAttribute("shard")){var I=P.getAttribute("list");P.servers=[];var B=s.querySelectorAll("map-datalist#"+I+" > map-option");0===B.length&&P.hasAttribute("value")&&(B=P.getAttribute("value").split(""));for(var w=0;w<B.length;w++)B[w].getAttribute?P.servers.push(B[w].getAttribute("value")):P.servers.push(B[w])}else if("map-select"===P.tagName.toLowerCase()){var F=document.createElement("div");F.insertAdjacentHTML("afterbegin",P.outerHTML),P.htmlselect=F.querySelector("map-select"),P.htmlselect=r(P.htmlselect),L.DomEvent.on(P.htmlselect,"change",o.redraw,o),o._userInputs||(o._userInputs=[]),o._userInputs.push(P.htmlselect)}}(x&&A.length===E.length||x===a)&&("query"===C&&(o.queryable=!0),!_&&d&&E.push(d),o._templateVars.push({template:decodeURI(new URL(x,p)),linkEl:f,title:v,rel:C,type:S,values:E,zoomBounds:z,extentPCRSFallback:{bounds:y.bounds},projectionMatch:l||m,projection:s.getAttribute("units")||n,tms:T}))}}}else s=o._synthesizeExtent(e),e.querySelector("map-feature,map-tile")&&(o._content=e);o._parseLicenseAndLegend(e,o),o._extent=s;var q=e.querySelector("map-link[rel=zoomin]"),R=e.querySelector("map-link[rel=zoomout]");if(delete o._extent.zoomin,delete o._extent.zoomout,q&&(o._extent.zoomin=new URL(q.getAttribute("href"),p).href),R&&(o._extent.zoomout=new URL(R.getAttribute("href"),p).href),o._templatedLayer&&o._templatedLayer.reset(o._templateVars),e.querySelector("map-tile")){var D=document.createElement("map-tiles"),N=e.querySelector("map-meta[name=zoom][content]")||e.querySelector("map-input[type=zoom][value]");D.setAttribute("zoom",N&&N.getAttribute("content")||N&&N.getAttribute("value")||"0");for(var O=e.getElementsByTagName("map-tile"),U=0;U<O.length;U++)D.appendChild(document.importNode(O[U],!0));o._mapmlTileContainer.appendChild(D)}M.parseStylesheetAsHTML(e,p,o._container);var j=e.querySelectorAll('map-link[rel=style],map-link[rel="self style"],map-link[rel="style self"]');if(j.length>1){var Z=document.createElement("details"),G=document.createElement("summary");G.innerText="Style",Z.appendChild(G);for(var H=function(t){o.fire("changestyle",{src:t.target.getAttribute("data-href")},!1)},$=0;$<j.length;$++){var V=document.createElement("div"),W=V.appendChild(document.createElement("input"));W.setAttribute("type","radio"),W.setAttribute("id","rad-"+L.stamp(W)),W.setAttribute("name","styles-"+o._title),W.setAttribute("value",j[$].getAttribute("title")),W.setAttribute("data-href",new URL(j[$].getAttribute("href"),p).href);var K=V.appendChild(document.createElement("label"));K.setAttribute("for","rad-"+L.stamp(W)),K.innerText=j[$].getAttribute("title"),"style self"!==j[$].getAttribute("rel")&&"self style"!==j[$].getAttribute("rel")||(W.checked=!0),Z.appendChild(V),L.DomUtil.addClass(Z,"mapml-layer-item-style mapml-control-layers"),L.DomEvent.on(W,"click",H,o)}o._styles=Z}e.querySelector("map-title")?o._title=e.querySelector("map-title").textContent.trim():e instanceof Element&&e.hasAttribute("label")&&(o._title=e.getAttribute("label").trim()),o._map&&(o._validateExtent(),o._map.hasLayer(o)&&o._map.attributionControl.addAttribution(o.getAttribution()))}else o.error=!0;o.fire("extentload",o,!1),o._layerEl.dispatchEvent(new CustomEvent("extentload",{detail:o}))}},_createExtent:function(){var t=document.createElement("map-extent"),e=document.createElement("map-input"),i=document.createElement("map-input"),o=document.createElement("map-input"),n=document.createElement("map-input"),a=document.createElement("map-input"),s=document.createElement("map-input");return a.setAttribute("type","zoom"),a.setAttribute("min","0"),a.setAttribute("max","0"),e.setAttribute("type","xmin"),e.setAttribute("min",""),e.setAttribute("max",""),i.setAttribute("type","ymin"),i.setAttribute("min",""),i.setAttribute("max",""),o.setAttribute("type","xmax"),o.setAttribute("min",""),o.setAttribute("max",""),n.setAttribute("type","ymax"),n.setAttribute("min",""),n.setAttribute("max",""),s.setAttribute("type","projection"),s.setAttribute("value","WGS84"),t.appendChild(e),t.appendChild(i),t.appendChild(o),t.appendChild(n),t.appendChild(a),t.appendChild(s),t},_validateExtent:function(){var t=this._extent;if(t&&t.querySelector&&this._map){if(t.querySelector('[type=xmin][min=""], [type=xmin][max=""], [type=xmax][min=""], [type=xmax][max=""], [type=ymin][min=""], [type=ymin][max=""]')){var e,i,o=t.querySelector("[type=xmin]"),n=t.querySelector("[type=ymin]"),a=t.querySelector("[type=xmax]"),s=t.querySelector("[type=ymax]"),r=t.querySelector("[type=projection][value]");r?(i=r.getAttribute("value"))&&"WGS84"===i?(e=this._map.getBounds(),o.setAttribute("min",e.getWest()),o.setAttribute("max",e.getEast()),n.setAttribute("min",e.getSouth()),n.setAttribute("max",e.getNorth()),a.setAttribute("min",e.getWest()),a.setAttribute("max",e.getEast()),s.setAttribute("min",e.getSouth()),s.setAttribute("max",e.getNorth())):i&&(e=this._map.getPixelBounds(),o.setAttribute("min",e.getBottomLeft().x),o.setAttribute("max",e.getTopRight().x),n.setAttribute("min",e.getTopRight().y),n.setAttribute("max",e.getBottomLeft().y),a.setAttribute("min",e.getBottomLeft().x),a.setAttribute("max",e.getTopRight().x),s.setAttribute("min",e.getTopRight().y),s.setAttribute("max",e.getBottomLeft().y)):this.error=!0}if(t.querySelector('[type=zoom][min=""], [type=zoom][max=""]')){var l=t.querySelector("[type=zoom]");l.setAttribute("min",this._map.getMinZoom()),l.setAttribute("max",this._map.getMaxZoom())}var u=t.hasAttribute("units")?t.getAttribute("units"):null;u&&M[u]?this.crs=M[u]:this.crs=M.OSMTILE}},_getMapMLExtent:function(t,e,i){var o=this._createExtent(),n=o.querySelector("map-input[type=zoom]"),a=o.querySelector("map-input[type=xmin]"),s=o.querySelector("map-input[type=ymin]"),r=o.querySelector("map-input[type=xmax]"),l=o.querySelector("map-input[type=ymax]"),u=o.querySelector("map-input[type=projection]"),m=void 0!==e[0]&&void 0!==e[1]?Math.min(e[0],e[1]):"",p=void 0!==e[0]&&void 0!==e[1]?Math.max(e[0],e[1]):"",c=t?t._southWest?t.getWest():t.getBottomLeft().x:"",h=t?t._southWest?t.getSouth():t.getTopRight().y:"",d=t?t._southWest?t.getEast():t.getTopRight().x:"",_=t?t._southWest?t.getNorth():t.getBottomLeft().y:"";return n.setAttribute("min","number"==typeof m&&isNaN(m)?"":m),n.setAttribute("max","number"==typeof p&&isNaN(p)?"":p),a.setAttribute("min",c),a.setAttribute("max",d),s.setAttribute("min",h),s.setAttribute("max",_),r.setAttribute("min",c),r.setAttribute("max",d),l.setAttribute("min",h),l.setAttribute("max",_),u.setAttribute("value",t&&t._southWest&&!i?"WGS84":i),o},_synthesizeExtent:function(t){var e,i,o,a,s,r,l,u,m,p,c,h,d=t.querySelectorAll("map-meta[name=zoom]")[0],_=t.querySelector("map-meta[name=extent]"),y=t.querySelector("map-meta[name=projection]"),g=y?y.getAttribute("content"):n;if(d)for(i=d.getAttribute("content").split(","),e=0;e<i.length;e++)c=(p=i[e].split("="))[0],h=p[1],"min"===c&&(a=parseInt(h)),"max"===c&&(s=parseInt(h));if(_)for(i=_.getAttribute("content").split(","),e=0;e<i.length;e++)c=(p=i[e].split("="))[0],h=p[1],"xmin"===c&&(r=parseFloat(h)),"xmax"===c&&(u=parseFloat(h)),"ymin"===c&&(l=parseFloat(h)),"ymax"===c&&(m=parseFloat(h));if(r&&l&&u&&m&&"WGS84"===g){var f=L.latLng(l,r),x=L.latLng(m,u);o=L.latLngBounds(f,x)}else r&&l&&u&&m&&(o=L.bounds([[r,l],[u,m]]));return this._getMapMLExtent(o,[a,s],g)},getProjection:function(){let t=this._extent;if(!t)return n;switch(t.tagName.toUpperCase()){case"MAP-EXTENT":if(t.hasAttribute("units"))return t.getAttribute("units").toUpperCase();break;case"MAP-INPUT":if(t.hasAttribute("value"))return t.getAttribute("value").toUpperCase();break;case"MAP-META":if(t.hasAttribute("content"))return M.metaContentToObject(t.getAttribute("content")).content.toUpperCase();break;default:return n}return n},_parseLicenseAndLegend:function(t,e){var i,o,n=t.querySelector("map-link[rel=license]");n&&(i=n.getAttribute("title"),o='<a href="'+n.getAttribute("href")+'" title="'+i+'">'+i+"</a>"),L.setOptions(e,{attribution:o});var a=t.querySelector("map-link[rel=legend]");a&&(e._legendUrl=a.getAttribute("href"))},_getUnprojectedMapLatLngBounds:function(t){var e=(t=t||this._map).getPixelOrigin(),i=t.getPixelBounds(),o=t.unproject(e),n=t.unproject(i.getBottomLeft()),a=t.unproject(i.getTopRight()),s=t.unproject(e.add(t.getSize()));return L.latLngBounds(n,a).extend(s).extend(o)},_projectionMatches:function(t){t=t||this._map;var e=this.getProjection();return!(!t.options.projection||"WGS84"!==e&&t.options.projection!==e)},getQueryTemplates:function(){if(this._templatedLayer&&this._templatedLayer._queries)return this._templatedLayer._queries},_attachSkipButtons:function(t){let e,i,o=t.popup,n=t.target,a=o._container.getElementsByClassName("mapml-popup-content")[0];o._container.setAttribute("role","dialog"),a.setAttribute("tabindex","-1"),a.setAttribute("role","document"),o._count=0,o._source._eventParents?(e=o._source._eventParents[Object.keys(o._source._eventParents)[0]],i=o._source.group):e=o._source._templatedLayer,o._container.querySelector('nav[class="mapml-focus-buttons"]')&&(L.DomUtil.remove(o._container.querySelector('nav[class="mapml-focus-buttons"]')),L.DomUtil.remove(o._container.querySelector("hr")));let s=L.DomUtil.create("nav","mapml-focus-buttons"),r=L.DomUtil.create("button","mapml-popup-button",s);r.type="button",r.title="Focus Map",r.innerHTML="<span aria-hidden='true'>|&#10094;</span>",L.DomEvent.on(r,"click",t=>{L.DomEvent.stop(t),n.featureIndex._sortIndex(),n.closePopup(),n._container.focus()},o);let l=L.DomUtil.create("button","mapml-popup-button",s);l.type="button",l.title="Previous Feature",l.innerHTML="<span aria-hidden='true'>&#10094;</span>",L.DomEvent.on(l,"click",e._previousFeature,o);let u=L.DomUtil.create("p","mapml-feature-count",s),m=this._totalFeatureCount?this._totalFeatureCount:1;u.innerText=o._count+1+"/"+m;let p=L.DomUtil.create("button","mapml-popup-button",s);p.type="button",p.title="Next Feature",p.innerHTML="<span aria-hidden='true'>&#10095;</span>",L.DomEvent.on(p,"click",e._nextFeature,o);let c=L.DomUtil.create("button","mapml-popup-button",s);c.type="button",c.title="Focus Controls",c.innerHTML="<span aria-hidden='true'>&#10095;|</span>",L.DomEvent.on(c,"click",t=>{n.featureIndex._sortIndex(),n.featureIndex.currentIndex=n.featureIndex.inBoundFeatures.length-1,n.featureIndex.inBoundFeatures[0].path.setAttribute("tabindex",-1),n.featureIndex.inBoundFeatures[n.featureIndex.currentIndex].path.setAttribute("tabindex",0),L.DomEvent.stop(t),n.closePopup(),n._controlContainer.querySelector("A").focus()},o);let h=L.DomUtil.create("hr");function d(t){let e=t.originalEvent.path||t.originalEvent.composedPath(),a=9===t.originalEvent.keyCode,s=t.originalEvent.shiftKey;e[0].classList.contains("leaflet-popup-close-button")&&a&&!s||27===t.originalEvent.keyCode?setTimeout(()=>{L.DomEvent.stop(t),n.closePopup(o),i.focus()},0):("Focus Map"===e[0].title||e[0].classList.contains("mapml-popup-content"))&&a&&s&&setTimeout(()=>{L.DomEvent.stop(t),n.closePopup(o),i.focus()},0)}function _(t){let e=t.originalEvent.path||t.originalEvent.composedPath(),i=9===t.originalEvent.keyCode,a=t.originalEvent.shiftKey;13===t.originalEvent.keyCode&&e[0].classList.contains("leaflet-popup-close-button")||27===t.originalEvent.keyCode?(L.DomEvent.stopPropagation(t),n._container.focus(),n.closePopup(o),27!==t.originalEvent.keyCode&&(n._popupClosed=!0)):i&&e[0].classList.contains("leaflet-popup-close-button")?n.closePopup(o):("Focus Map"===e[0].title||e[0].classList.contains("mapml-popup-content"))&&i&&a&&setTimeout(()=>{L.DomEvent.stop(t),n.closePopup(o),n._container.focus()},0)}o._navigationBar=s,o._content.appendChild(h),o._content.appendChild(s),a.focus(),i?(i.setAttribute("aria-expanded","true"),n.on("keydown",d)):n.on("keydown",_),n.on("popupclose",function t(e){e.popup===o&&(n.off("keydown",d),n.off("keydown",_),n.off("popupclose",t),i&&i.setAttribute("aria-expanded","false"))})}}),x=function(t,e,i){return t||e?new f(t,e,i):null},b=L.Layer.extend({onAdd:function(t){let e=t.getSize();(e.x>400||e.y>300)&&(this._container=L.DomUtil.create("table","mapml-debug",t._container),this._panel=C({className:"mapml-debug-panel",pane:this._container}),t.addLayer(this._panel)),this._grid=E({className:"mapml-debug-grid",pane:t._panes.mapPane,zIndex:400,tileSize:t.options.crs.options.crs.tile.bounds.max.x}),t.addLayer(this._grid),this._vectors=z({className:"mapml-debug-vectors",pane:t._panes.mapPane,toolPane:this._container}),t.addLayer(this._vectors)},onRemove:function(t){t.removeLayer(this._grid),t.removeLayer(this._vectors),this._panel&&(t.removeLayer(this._panel),L.DomUtil.remove(this._container))}}),v=function(){return new b},A=L.Layer.extend({initialize:function(t){L.setOptions(this,t)},onAdd:function(t){this._title=L.DomUtil.create("caption","mapml-debug-banner",this.options.pane),this._title.innerHTML="Debug mode",t.debug={},t.debug._infoContainer=this._debugContainer=L.DomUtil.create("tbody","mapml-debug-panel",this.options.pane);let e=t.debug._infoContainer;t.debug._tileCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._tileMatrixCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._mapCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._tcrsCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._pcrsCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._gcrsCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),this._map.on("mousemove",this._updateCoords)},onRemove:function(){L.DomUtil.remove(this._title),this._debugContainer&&(L.DomUtil.remove(this._debugContainer),this._map.off("mousemove",this._updateCoords))},_updateCoords:function(t){if(this.contextMenu._visible)return;let e=this.options.mapEl,i=e._map.project(t.latlng),o=e._map.options.crs.scale(+e.zoom),n=e._map.options.crs.transformation.untransform(i,o),a=e._map.options.crs.options.crs.tile.bounds.max.x,s=i.x%a,r=i.y%a;s<0&&(s+=a),r<0&&(r+=a),this.debug._tileCoord.innerHTML=`\n      <th scope="row">tile: </th>\n      <td>i: ${Math.trunc(s)}, </td>\n      <td>j: ${Math.trunc(r)}</td>\n      `,this.debug._mapCoord.innerHTML=`\n      <th scope="row">map: </th>\n      <td>i: ${Math.trunc(t.containerPoint.x)}, </td>\n      <td>j: ${Math.trunc(t.containerPoint.y)}</td>\n      `,this.debug._gcrsCoord.innerHTML=`\n      <th scope="row">gcrs: </th>\n      <td>lon: ${t.latlng.lng.toFixed(6)}, </td>\n      <td>lat: ${t.latlng.lat.toFixed(6)}</td>\n      `,this.debug._tcrsCoord.innerHTML=`\n      <th scope="row">tcrs: </th>\n      <td>x: ${Math.trunc(i.x)}, </td>\n      <td>y: ${Math.trunc(i.y)}</td>\n      `,this.debug._tileMatrixCoord.innerHTML=`\n      <th scope="row">tilematrix: </th>\n      <td>column: ${Math.trunc(i.x/a)}, </td>\n      <td>row: ${Math.trunc(i.y/a)}</td>\n      `,this.debug._pcrsCoord.innerHTML=`\n      <th scope="row">pcrs: </th>\n      <td>easting: ${n.x.toFixed(2)}, </td>\n      <td>northing: ${n.y.toFixed(2)}</td>\n      `}}),C=function(t){return new A(t)},S=L.GridLayer.extend({initialize:function(t){L.setOptions(this,t),L.GridLayer.prototype.initialize.call(this,this._map)},createTile:function(t){let e=L.DomUtil.create("div","mapml-debug-tile");return e.setAttribute("col",t.x),e.setAttribute("row",t.y),e.setAttribute("zoom",t.z),e.innerHTML=[`col: ${t.x}`,`row: ${t.y}`,`zoom: ${t.z}`].join(", "),e.style.outline="1px dashed red",e}}),E=function(t){return new S(t)},T=L.LayerGroup.extend({initialize:function(t){L.setOptions(this,t),L.LayerGroup.prototype.initialize.call(this,this._map,t)},onAdd:function(t){t.on("overlayremove",this._mapLayerUpdate,this),t.on("overlayadd",this._mapLayerUpdate,this);let e=t.options.crs.transformation.transform(L.point(0,0),t.options.crs.scale(0));this._centerVector=L.circle(t.options.crs.pointToLatLng(e,0),{radius:250}),this._centerVector.bindTooltip("Projection Center"),this._addBounds(t)},onRemove:function(t){this.clearLayers()},_addBounds:function(t){let e=Object.keys(t._layers),i=t._layers,o=["#FF5733","#8DFF33","#3397FF","#E433FF","#F3FF33"],n=0;this.addLayer(this._centerVector);for(let t of e)if(i[t].layerBounds){let e=[i[t].layerBounds.min,L.point(i[t].layerBounds.max.x,i[t].layerBounds.min.y),i[t].layerBounds.max,L.point(i[t].layerBounds.min.x,i[t].layerBounds.max.y)],a=P(e,{color:o[n%o.length],weight:2,opacity:1,fillOpacity:.01,fill:!0});i[t].options._leafletLayer&&a.bindTooltip(i[t].options._leafletLayer._title,{sticky:!0}),this.addLayer(a),n++}if(t.totalLayerBounds){let e=[t.totalLayerBounds.min,L.point(t.totalLayerBounds.max.x,t.totalLayerBounds.min.y),t.totalLayerBounds.max,L.point(t.totalLayerBounds.min.x,t.totalLayerBounds.max.y)],i=P(e,{color:"#808080",weight:5,opacity:.5,fill:!1});this.addLayer(i)}},_mapLayerUpdate:function(t){this.clearLayers(),this._addBounds(t.target)}}),z=function(t){return new T(t)},k=L.Path.extend({options:{className:"mapml-debug-extent"},initialize:function(t,e){this._locations=t,L.setOptions(this,e)},_project:function(){this._rings=[];let t=this._map.options.crs.scale(this._map.getZoom()),e=this._map;for(let i=0;i<this._locations.length;i++){let o=e.options.crs.transformation.transform(this._locations[i],t);this._rings.push(L.point(o.x,o.y)._subtract(e.getPixelOrigin()))}this._parts=[this._rings]},_update:function(){this._map&&this._renderer._updatePoly(this,!0)}}),P=function(t,e){return new k(t,e)},I=L.Handler.extend({addHooks:function(){L.setOptions(this,{mapEl:this._map.options.mapEl}),L.DomEvent.on(this._map,"click",this._queryTopLayer,this),L.DomEvent.on(this._map,"keypress",this._queryTopLayerAtMapCenter,this)},removeHooks:function(){L.DomEvent.off(this._map,"click",this._queryTopLayer,this),L.DomEvent.on(this._map,"keypress",this._queryTopLayerAtMapCenter,this)},_getTopQueryableLayer:function(){for(var t=this.options.mapEl.layers,e=t.length-1;e>=0;e--){var i=t[e]._layer;if(t[e].checked&&i.queryable)return i}},_queryTopLayerAtMapCenter:function(t){setTimeout(()=>{!this._map.isFocused||this._map._popupClosed||" "!==t.originalEvent.key&&13!=+t.originalEvent.keyCode?delete this._map._popupClosed:this._map.fire("click",{latlng:this._map.getCenter(),layerPoint:this._map.latLngToLayerPoint(this._map.getCenter()),containerPoint:this._map.latLngToContainerPoint(this._map.getCenter())})},0)},_queryTopLayer:function(t){var e=this._getTopQueryableLayer();e&&this._query(t,e)},_query(t,e){var i={},o=e.getQueryTemplates()[0],n=t.target.getZoom(),a=this._map,s=e.crs,r=a.options.crs.options.crs.tile.bounds.max.x,l=e._container,u={autoClose:!1,autoPan:!0,maxHeight:.5*a.getSize().y-50},m=function(t){return s.transformation.untransform(t,s.scale(n))},p=function(t){return s.unproject(s.transformation.untransform(t,s.scale(n)),n)},c=s.latLngToPoint(t.latlng,n),h=c.divideBy(r).floor(),d=new L.Bounds(c.divideBy(r).floor().multiplyBy(r),c.divideBy(r).ceil().multiplyBy(r));for(var _ in i[o.query.tilei]=c.x.toFixed()-h.x*r,i[o.query.tilej]=c.y.toFixed()-h.y*r,i[o.query.mapi]=a.getSize().divideBy(2).x.toFixed(),i[o.query.mapj]=a.getSize().divideBy(2).y.toFixed(),i[o.query.pixelleft]=s.pointToLatLng(c,n).lng,i[o.query.pixeltop]=s.pointToLatLng(c,n).lat,i[o.query.pixelright]=s.pointToLatLng(c.add([1,1]),n).lng,i[o.query.pixelbottom]=s.pointToLatLng(c.add([1,1]),n).lat,i[o.query.column]=h.x,i[o.query.row]=h.y,i[o.query.x]=c.x.toFixed(),i[o.query.y]=c.y.toFixed(),i[o.query.easting]=m(c).x,i[o.query.northing]=m(c).y,i[o.query.longitude]=p(c).lng,i[o.query.latitude]=p(c).lat,i[o.query.zoom]=n,i[o.query.width]=a.getSize().x,i[o.query.height]=a.getSize().y,i[o.query.mapbottom]=m(c.add(a.getSize().divideBy(2))).y,i[o.query.mapleft]=m(c.subtract(a.getSize().divideBy(2))).x,i[o.query.maptop]=m(c.subtract(a.getSize().divideBy(2))).y,i[o.query.mapright]=m(c.add(a.getSize().divideBy(2))).x,i[o.query.tilebottom]=m(d.max).y,i[o.query.tileleft]=m(d.min).x,i[o.query.tiletop]=m(d.min).y,i[o.query.tileright]=m(d.max).x,o.query)["mapi","mapj","tilei","tilej","row","col","x","y","easting","northing","longitude","latitude","width","height","zoom","mapleft","mapright",",maptop","mapbottom","tileleft","tileright","tiletop","tilebottom","pixeltop","pixelbottom","pixelleft","pixelright"].indexOf(_)<0&&(i[_]=o.query[_]);let y,g=this._map.project(t.latlng),f=this._map.options.crs.scale(this._map.getZoom()),x=this._map.options.crs.transformation.untransform(g,f);o.layerBounds.contains(x)&&fetch(L.Util.template(o.template,i),{redirect:"follow"}).then(t=>{if(y=t.headers.get("Content-Type"),t.status>=200&&t.status<300)return t.text();throw new Error(t.status)}).then(i=>y.startsWith("text/mapml")?function(t,i){let o=(new DOMParser).parseFromString(t,"application/xml");for(let t of o.querySelectorAll("map-feature"))if(!t.querySelector("map-geometry")){let e=document.createElement("map-geometry"),o=document.createElement("map-point"),n=document.createElement("map-coordinates");e.setAttribute("cs","gcrs"),n.innerHTML=`${i.lng} ${i.lat}`,o.appendChild(n),e.appendChild(o),t.appendChild(e)}let n=M.mapMlFeatures(o,{renderer:M.featureRenderer(),pane:l,projection:a.options.projection,_leafletLayer:e,query:!0,static:!0});n.addTo(a);let s=L.DomUtil.create("div","mapml-popup-content"),r=L.DomUtil.create("iframe");r.style="border: none",r.srcdoc=o.querySelector("map-feature map-properties").innerHTML,r.setAttribute("sandbox","allow-same-origin allow-forms"),s.appendChild(r),e._totalFeatureCount=o.querySelectorAll("map-feature").length,e.bindPopup(s,u).openPopup(i),e.on("popupclose",function(){a.removeLayer(n)}),n.showPaginationFeature({i:0,popup:e._popup})}(i,t.latlng):function(t,e,i){let o=L.DomUtil.create("div","mapml-popup-content"),n=L.DomUtil.create("iframe");n.style="border: none",n.srcdoc=t,n.setAttribute("sandbox","allow-same-origin allow-forms"),o.appendChild(n),e.bindPopup(o,u).openPopup(i)}(i,e,t.latlng)).catch(t=>{console.log("Looks like there was a problem. Status: "+t.message)})}}),B=L.Handler.extend({_touchstart:L.Browser.msPointer?"MSPointerDown":L.Browser.pointer?"pointerdown":"touchstart",initialize:function(t){L.Handler.prototype.initialize.call(this,t),this._items=[{text:M.options.locale.cmBack+" (<kbd>B</kbd>)",callback:this._goBack},{text:M.options.locale.cmForward+" (<kbd>F</kbd>)",callback:this._goForward},{text:M.options.locale.cmReload+" (<kbd>R</kbd>)",callback:this._reload},{spacer:"-"},{text:M.options.locale.cmToggleControls+" (<kbd>T</kbd>)",callback:this._toggleControls},{text:M.options.locale.cmCopyCoords+" (<kbd>C</kbd>)<span></span>",callback:this._copyCoords,hideOnSelect:!1,popup:!0,submenu:[{text:"tile",callback:this._copyTile},{text:"tilematrix",callback:this._copyTileMatrix},{spacer:"-"},{text:"map",callback:this._copyMap},{spacer:"-"},{text:"tcrs",callback:this._copyTCRS},{text:"pcrs",callback:this._copyPCRS},{text:"gcrs",callback:this._copyGCRS},{spacer:"-"},{text:M.options.locale.cmCopyAll,callback:this._copyAllCoords}]},{text:M.options.locale.cmToggleDebug+" (<kbd>D</kbd>)",callback:this._toggleDebug},{text:M.options.locale.cmCopyMapML+" (<kbd>M</kbd>)",callback:this._copyMapML},{text:M.options.locale.cmViewSource+" (<kbd>V</kbd>)",callback:this._viewSource}],this._layerItems=[{text:M.options.locale.lmZoomToLayer+" (<kbd>Z</kbd>)",callback:this._zoomToLayer},{text:M.options.locale.lmCopyExtent+" (<kbd>C</kbd>)",callback:this._copyLayerExtent}],this._mapMenuVisible=!1,this._keyboardEvent=!1,this._container=L.DomUtil.create("div","mapml-contextmenu",t._container),this._container.setAttribute("hidden","");for(let t=0;t<6;t++)this._items[t].el=this._createItem(this._container,this._items[t]);this._coordMenu=L.DomUtil.create("div","mapml-contextmenu mapml-submenu",this._container),this._coordMenu.id="mapml-copy-submenu",this._coordMenu.setAttribute("hidden",""),this._clickEvent=null;for(let t=0;t<this._items[5].submenu.length;t++)this._createItem(this._coordMenu,this._items[5].submenu[t],t);this._items[6].el=this._createItem(this._container,this._items[6]),this._items[7].el=this._createItem(this._container,this._items[7]),this._items[8].el=this._createItem(this._container,this._items[8]),this._layerMenu=L.DomUtil.create("div","mapml-contextmenu mapml-layer-menu",t._container),this._layerMenu.setAttribute("hidden","");for(let t=0;t<this._layerItems.length;t++)this._createItem(this._layerMenu,this._layerItems[t]);L.DomEvent.on(this._container,"click",L.DomEvent.stop).on(this._container,"mousedown",L.DomEvent.stop).on(this._container,"dblclick",L.DomEvent.stop).on(this._container,"contextmenu",L.DomEvent.stop).on(this._layerMenu,"click",L.DomEvent.stop).on(this._layerMenu,"mousedown",L.DomEvent.stop).on(this._layerMenu,"dblclick",L.DomEvent.stop).on(this._layerMenu,"contextmenu",L.DomEvent.stop)},addHooks:function(){var t=this._map.getContainer();L.DomEvent.on(t,"mouseleave",this._hide,this).on(document,"keydown",this._onKeyDown,this),L.Browser.touch&&L.DomEvent.on(document,this._touchstart,this._hide,this),this._map.on({contextmenu:this._show,mousedown:this._hide,zoomstart:this._hide},this)},removeHooks:function(){var t=this._map.getContainer();L.DomEvent.off(t,"mouseleave",this._hide,this).off(document,"keydown",this._onKeyDown,this),L.Browser.touch&&L.DomEvent.off(document,this._touchstart,this._hide,this),this._map.off({contextmenu:this._show,mousedown:this._hide,zoomstart:this._hide},this)},_copyLayerExtent:function(t){let e=t instanceof KeyboardEvent?this._map.contextMenu:this.contextMenu,i=e._layerClicked.layer._layerEl,o=i.extent.topLeft.pcrs,n=i.extent.bottomRight.pcrs,a=`<map-meta name="extent" content="top-left-easting=${o.horizontal}, top-left-northing=${o.vertical}, bottom-right-easting=${n.horizontal}, bottom-right-northing=${n.vertical}"></map-meta>`;e._copyData(a)},_zoomToLayer:function(t){(t instanceof KeyboardEvent?this._map.contextMenu:this.contextMenu)._layerClicked.layer._layerEl.focus()},_goForward:function(t){(t instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl).forward()},_goBack:function(t){(t instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl).back()},_reload:function(t){(t instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl).reload()},_toggleControls:function(t){(t instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl)._toggleControls()},_copyMapML:function(t){let e=t instanceof KeyboardEvent?this._map.contextMenu:this.contextMenu,i=t instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl;e._copyData(i.outerHTML.replace(/<div class="mapml-web-map">.*?<\/div>|<style>\[is="web-map"].*?<\/style>|<style>mapml-viewer.*?<\/style>/gm,""))},_viewSource:function(t){(t instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl).viewSource()},_toggleDebug:function(t){(t instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl).toggleDebug()},_copyCoords:function(t){(this.contextMenu?this.contextMenu:this)._showCoordMenu(t)},_copyData:function(t){const e=document.createElement("textarea");e.value=t,document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)},_copyGCRS:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent;this.contextMenu._copyData(`z:${e.zoom}, lon :${i.latlng.lng.toFixed(6)}, lat:${i.latlng.lat.toFixed(6)}`)},_copyTCRS:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent,o=e._map.project(i.latlng);this.contextMenu._copyData(`z:${e.zoom}, x:${o.x}, y:${o.y}`)},_copyTileMatrix:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent,o=e._map.project(i.latlng),n=e._map.options.crs.options.crs.tile.bounds.max.x;this.contextMenu._copyData(`z:${e.zoom}, column:${Math.trunc(o.x/n)}, row:${Math.trunc(o.y/n)}`)},_copyPCRS:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent,o=e._map.project(i.latlng),n=e._map.options.crs.scale(+e.zoom),a=e._map.options.crs.transformation.untransform(o,n);this.contextMenu._copyData(`z:${e.zoom}, easting:${a.x.toFixed(2)}, northing:${a.y.toFixed(2)}`)},_copyTile:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent,o=e._map.options.crs.project(i.latlng),n=e._map.options.crs.options.crs.tile.bounds.max.x,a=o.x%n,s=o.y%n;a<0&&(a+=n),s<0&&(s+=n),this.contextMenu._copyData(`z:${e.zoom}, i:${Math.trunc(a)}, j:${Math.trunc(s)}`)},_copyMap:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent;this.contextMenu._copyData(`z:${e.zoom}, i:${Math.trunc(i.containerPoint.x)}, j:${Math.trunc(i.containerPoint.y)}`)},_copyAllCoords:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent,o=e._map.project(i.latlng),n=e._map.options.crs.options.crs.tile.bounds.max.x,a=o.x%n,s=o.y%n,r=e._map.options.crs.scale(+e.zoom),l=e._map.options.crs.transformation.untransform(o,r),u=`z:${e.zoom}\n`;u+=`tile: i:${Math.trunc(a)}, j:${Math.trunc(s)}\n`,u+=`tilematrix: column:${Math.trunc(o.x/n)}, row:${Math.trunc(o.y/n)}\n`,u+=`map: i:${Math.trunc(i.containerPoint.x)}, j:${Math.trunc(i.containerPoint.y)}\n`,u+=`tcrs: x:${Math.trunc(o.x)}, y:${Math.trunc(o.y)}\n`,u+=`pcrs: easting:${l.x.toFixed(2)}, northing:${l.y.toFixed(2)}\n`,u+=`gcrs: lon :${i.latlng.lng.toFixed(6)}, lat:${i.latlng.lat.toFixed(6)}`,this.contextMenu._copyData(u)},_createItem:function(t,e,i){if(e.spacer)return this._createSeparator(t,i);var o=this._insertElementAt("button","mapml-contextmenu-item",t,i),n=this._createEventHandler(o,e.callback,e.context,e.hideOnSelect);return o.innerHTML=""+e.text,o.setAttribute("type","button"),o.classList.add("mapml-button"),e.popup&&(o.setAttribute("aria-haspopup","true"),o.setAttribute("aria-expanded","false"),o.setAttribute("aria-controls","mapml-copy-submenu")),L.DomEvent.on(o,"mouseover",this._onItemMouseOver,this).on(o,"mouseout",this._onItemMouseOut,this).on(o,"mousedown",L.DomEvent.stopPropagation).on(o,"click",n),L.Browser.touch&&L.DomEvent.on(o,this._touchstart,L.DomEvent.stopPropagation),L.Browser.pointer||L.DomEvent.on(o,"click",this._onItemMouseOut,this),{id:L.Util.stamp(o),el:o,callback:n}},_createSeparator:function(t,e){let i=this._insertElementAt("div","mapml-contextmenu-separator",t,e);return{id:L.Util.stamp(i),el:i}},_createEventHandler:function(t,e,i,o){let n=this;return o=void 0===o||o,function(a){let s=n._map,r=n._showLocation.containerPoint,l=s.containerPointToLayerPoint(r),u={containerPoint:r,layerPoint:l,latlng:s.layerPointToLatLng(l),relatedTarget:n._showLocation.relatedTarget};o&&n._hide(),e&&e.call(i||s,u),n._map.fire("contextmenu.select",{contextmenu:n,el:t})}},_insertElementAt:function(t,e,i,o){let n,a=document.createElement(t);return a.className=e,void 0!==o&&(n=i.children[o]),n?i.insertBefore(a,n):i.appendChild(a),a},_show:function(t){this._mapMenuVisible&&this._hide(),this._clickEvent=t;let e=t.originalEvent.target;if(e.closest("fieldset")){if(!(e=e.closest("fieldset").querySelector("span")).layer.validProjection)return;this._layerClicked=e,this._showAtPoint(t.containerPoint,t,this._layerMenu)}else(e.classList.contains("leaflet-container")||e.classList.contains("mapml-debug-extent")||"path"===e.tagName)&&(this._layerClicked=void 0,this._showAtPoint(t.containerPoint,t,this._container));if(0===t.originalEvent.button||-1===t.originalEvent.button)if(this._keyboardEvent=!0,this._layerClicked){let t=document.activeElement;this._elementInFocus=t.shadowRoot.activeElement,this._layerMenuTabs=1,this._layerMenu.firstChild.focus()}else this._container.firstChild.focus()},_showAtPoint:function(t,e,i){if(this._items.length){let o=L.extend(e||{},{contextmenu:this});this._showLocation={containerPoint:t},e&&e.relatedTarget&&(this._showLocation.relatedTarget=e.relatedTarget),this._setPosition(t,i),this._mapMenuVisible||(i.removeAttribute("hidden"),this._mapMenuVisible=!0),this._map.fire("contextmenu.show",o)}},_hide:function(){this._mapMenuVisible&&(this._mapMenuVisible=!1,this._container.setAttribute("hidden",""),this._coordMenu.setAttribute("hidden",""),this._layerMenu.setAttribute("hidden",""),this._map.fire("contextmenu.hide",{contextmenu:this}),setTimeout(()=>this._map._container.focus(),0))},_setPosition:function(t,e){let i,o=this._map.getSize(),n=this._getElementSize(e);this._map.options.contextmenuAnchor&&(i=L.point(this._map.options.contextmenuAnchor),t=t.add(i)),e._leaflet_pos=t,t.x+n.x>o.x?(e.style.left="auto",e.style.right=Math.min(Math.max(o.x-t.x,0),o.x-n.x-1)+"px"):(e.style.left=Math.max(t.x,0)+"px",e.style.right="auto"),t.y+n.y>o.y?(e.style.top="auto",e.style.bottom=Math.min(Math.max(o.y-t.y,0),o.y-n.y-1)+"px"):(e.style.top=Math.max(t.y,0)+"px",e.style.bottom="auto")},_getElementSize:function(t){let e=this._size;return e&&!this._sizeChanged||(e={},t.style.left="-999999px",t.style.right="auto",e.x=t.offsetWidth,e.y=t.offsetHeight,t.style.left="auto",this._sizeChanged=!1),e},_focusOnLayerControl:function(){this._mapMenuVisible=!1,delete this._layerMenuTabs,this._layerMenu.setAttribute("hidden",""),this._elementInFocus?this._elementInFocus.focus():this._layerClicked.parentElement.firstChild.focus(),delete this._elementInFocus},_onKeyDown:function(t){if(!this._mapMenuVisible)return;let e=t.keyCode,i=t.path||t.composedPath();switch(13===e&&t.preventDefault(),!this._layerMenuTabs||9!==e&&27!==e?16===e||9===e||!this._layerClicked&&67===e||i[0].innerText===M.options.locale.cmCopyCoords+" (C)"||this._hide():(t.shiftKey?this._layerMenuTabs-=1:this._layerMenuTabs+=1,0!==this._layerMenuTabs&&3!==this._layerMenuTabs&&27!==e||(L.DomEvent.stop(t),this._focusOnLayerControl())),e){case 13:case 32:this._map._container.parentNode.activeElement.parentNode.classList.contains("mapml-contextmenu")&&this._map._container.parentNode.activeElement.click();break;case 66:this._goBack(t);break;case 67:this._layerClicked?this._copyLayerExtent(t):this._copyCoords({latlng:this._map.getCenter()});break;case 68:this._toggleDebug(t);break;case 77:this._copyMapML(t);break;case 70:this._goForward(t);break;case 82:this._reload(t);break;case 84:this._toggleControls(t);break;case 86:this._viewSource(t);break;case 90:this._layerClicked&&this._zoomToLayer(t)}},_showCoordMenu:function(t){let e=this._map.getSize(),i=this._clickEvent,o=this._coordMenu;this._items[5].el.el.setAttribute("aria-expanded","true"),o.removeAttribute("hidden"),i.containerPoint.x+160+80>e.x?(o.style.left="auto",o.style.right="160px"):(o.style.left="160px",o.style.right="auto"),i.containerPoint.y+160>e.y?(o.style.top="auto",o.style.bottom="20px"):(o.style.top="100px",o.style.bottom="auto"),this._keyboardEvent&&o.firstChild.focus()},_hideCoordMenu:function(t){if(t.srcElement.parentElement.classList.contains("mapml-submenu")||t.srcElement.innerText===M.options.locale.cmCopyCoords+" (C)")return;let e=this._coordMenu;this._items[5].el.el.setAttribute("aria-expanded","false"),e.setAttribute("hidden","")},_onItemMouseOver:function(t){L.DomUtil.addClass(t.target||t.srcElement,"over"),t.srcElement.innerText===M.options.locale.cmCopyCoords+" (C)"&&this._showCoordMenu(t)},_onItemMouseOut:function(t){L.DomUtil.removeClass(t.target||t.srcElement,"over"),this._hideCoordMenu(t)}}),w={convertAndFormatPCRS:function(t,e){if(!t||!e)return{};let i=[],o=[],n=[],a=[],s=e.options.crs.options.crs.tile.bounds.max.y;for(let r=0;r<e.options.crs.options.resolutions.length;r++){let l=e.options.crs.scale(r),u=e.options.crs.transformation.transform(t.min,l),m=e.options.crs.transformation.transform(t.max,l);i.push({horizontal:u.x,vertical:m.y}),o.push({horizontal:m.x,vertical:u.y}),n.push({horizontal:i[r].horizontal/s,vertical:i[r].vertical/s}),a.push({horizontal:o[r].horizontal/s,vertical:o[r].vertical/s})}let r=e.options.crs.unproject(t.min),l=e.options.crs.unproject(t.max),u={topLeft:{horizontal:r.lng,vertical:l.lat},bottomRight:{horizontal:l.lng,vertical:r.lat}},m={topLeft:{horizontal:t.min.x,vertical:t.max.y},bottomRight:{horizontal:t.max.x,vertical:t.min.y}};return{topLeft:{tcrs:i,tilematrix:n,gcrs:u.topLeft,pcrs:m.topLeft},bottomRight:{tcrs:o,tilematrix:a,gcrs:u.bottomRight,pcrs:m.bottomRight},projection:e.options.projection}},extractInputBounds:function(t){if(!t)return;let e=t.values,i=t.projection||n,o=0,a="TILEMATRIX",s=this[i].options.crs.tilematrix.bounds(0),r=0,l=this[i].options.resolutions.length-1,u=!1,m=0;t.zoomBounds||(t.zoomBounds={},t.zoomBounds.min=0,t.zoomBounds.max=l);for(let t=0;t<e.length;t++)switch(e[t].getAttribute("type")){case"zoom":r=+e[t].getAttribute("min"),l=+(e[t].hasAttribute("max")?e[t].getAttribute("max"):l),o=+e[t].getAttribute("value");break;case"location":if(!e[t].getAttribute("max")||!e[t].getAttribute("min"))continue;let i=+e[t].getAttribute("max"),n=+e[t].getAttribute("min");switch(e[t].getAttribute("axis").toLowerCase()){case"x":case"longitude":case"column":case"easting":a=M.axisToCS(e[t].getAttribute("axis").toLowerCase()),s.min.x=n,s.max.x=i,m++;break;case"y":case"latitude":case"row":case"northing":a=M.axisToCS(e[t].getAttribute("axis").toLowerCase()),s.min.y=n,s.max.y=i,m++}}return m>=2&&(u=!0),{zoomBounds:{minZoom:+t.zoomBounds.min,maxZoom:+t.zoomBounds.max,minNativeZoom:r,maxNativeZoom:l},bounds:s=!u&&t.extentPCRSFallback&&t.extentPCRSFallback.bounds?t.extentPCRSFallback.bounds:u?this.boundsToPCRSBounds(s,o,i,a):this[i].options.crs.pcrs.bounds}},axisToCS:function(t){try{switch(t.toLowerCase()){case"row":case"column":return"TILEMATRIX";case"i":case"j":return["MAP","TILE"];case"x":case"y":return"TCRS";case"latitude":case"longitude":return"GCRS";case"northing":case"easting":return"PCRS";default:return"TILEMATRIX"}}catch(t){return}},csToAxes:function(t){try{switch(t.toLowerCase()){case"tilematrix":return["column","row"];case"map":case"tile":return["i","j"];case"tcrs":return["x","y"];case"gcrs":return["longitude","latitude"];case"pcrs":return["easting","northing"]}}catch(t){return}},axisToXY:function(t){try{switch(t.toLowerCase()){case"i":case"column":case"longitude":case"x":case"easting":return"x";case"row":case"j":case"latitude":case"y":case"northing":return"y";default:return}}catch(t){return}},convertPCRSBounds:function(t,e,i,o){if(t&&(e||0===e)&&Number.isFinite(+e)&&i&&o)switch(i="string"==typeof i?M[i]:i,o.toUpperCase()){case"PCRS":return t;case"TCRS":case"TILEMATRIX":let n=i.transformation.transform(t.min,i.scale(+e)),a=i.transformation.transform(t.max,i.scale(+e));if("TCRS"===o.toUpperCase())return L.bounds(n,a);let s=i.options.crs.tile.bounds.max.x;return L.bounds(L.point(n.x/s,n.y/s),L.point(a.x/s,a.y/s));case"GCRS":let r=i.unproject(t.min),l=i.unproject(t.max);return L.bounds(L.point(r.lng,r.lat),L.point(l.lng,l.lat));default:return}},pointToPCRSPoint:function(t,e,i,o){if(!t||!e&&0!==e||!Number.isFinite(+e)||!o||!i)return;let n=(i="string"==typeof i?M[i]:i).options.crs.tile.bounds.max.x;switch(o.toUpperCase()){case"TILEMATRIX":return M.pixelToPCRSPoint(L.point(t.x*n,t.y*n),e,i);case"PCRS":return t;case"TCRS":return M.pixelToPCRSPoint(t,e,i);case"GCRS":return i.project(L.latLng(t.y,t.x));default:return}},pixelToPCRSPoint:function(t,e,i){if(t&&(e||0===e)&&Number.isFinite(+e)&&i)return(i="string"==typeof i?M[i]:i).transformation.untransform(t,i.scale(e))},boundsToPCRSBounds:function(t,e,i,o){if(t&&t.max&&t.min&&(e||0===e)&&Number.isFinite(+e)&&i&&o)return i="string"==typeof i?M[i]:i,L.bounds(M.pointToPCRSPoint(t.min,e,i,o),M.pointToPCRSPoint(t.max,e,i,o))},pixelToPCRSBounds:function(t,e,i){if(t&&t.max&&t.min&&(e||0===e)&&Number.isFinite(+e)&&i)return i="string"==typeof i?M[i]:i,L.bounds(M.pixelToPCRSPoint(t.min,e,i),M.pixelToPCRSPoint(t.max,e,i))},metaContentToObject:function(t){if(!t||t instanceof Object)return{};let e={},i=t.split(/\s+/).join("").split(",");for(let t=0;t<i.length;t++){let o=i[t].split("=");2===o.length&&(e[o[0]]=o[1])}return""!==e&&1===i[0].split("=").length&&(e.content=i[0]),e},coordsToArray:function(t){for(var e=1,i=[],o=t.split(",");e<o.length;e+=2)i.push([parseInt(o[e-1]),parseInt(o[e])]);return i},parseStylesheetAsHTML:function(t,e,i){if(i instanceof Element&&t&&t.querySelector("map-link[rel=stylesheet],map-style")){if(e instanceof Element)e=e.getAttribute("href")?e.getAttribute("href"):document.URL;else if(!e||""===e||e instanceof Object)return;for(var o=[],n=t.querySelectorAll("map-link[rel=stylesheet],map-style"),a=0;a<n.length;a++)if("MAP-LINK"===n[a].nodeName.toUpperCase()){var s=n[a].hasAttribute("href")?new URL(n[a].getAttribute("href"),e).href:null;if(s&&!i.querySelector("link[href='"+s+"']")){var r=document.createElement("link");r.setAttribute("href",s),r.setAttribute("rel","stylesheet"),o.push(r)}}else{var l=document.createElement("style");l.textContent=n[a].textContent,o.push(l)}for(var u=o.length-1;u>=0;u--)i.insertAdjacentElement("afterbegin",o[u])}},splitCoordinate:function(t,e,i){var o=[];t.split(/\s+/gim).forEach(M.parseNumber,o),this.push(o)},parseNumber:function(t,e,i){this.push(parseFloat(t))},handleLink:function(t,e){let i,o,n,a=!1,s=e._map;if("text/html"===t.type&&"_blank"!==t.target)t.target="_top";else if("text/html"!==t.type&&t.url.includes("#")){let e=t.url.split("#"),o=e[1].split(",");i={z:o[0]||0,lng:o[1]||0,lat:o[2]||0},a=!e[0],["/",".","#"].includes(t.url[0])&&(t.target="_self")}if(a)i&&!t.inPlace&&a&&(e._map.options.mapEl.zoomTo(+i.lat,+i.lng,+i.z),n&&(o.opacity=n));else{let a=!1;switch((o=document.createElement("layer-")).setAttribute("src",t.url),o.setAttribute("checked",""),t.target){case"_blank":"text/html"===t.type?window.open(t.url):(s.options.mapEl.appendChild(o),a=!0);break;case"_parent":for(let t of s.options.mapEl.querySelectorAll("layer-"))t._layer!==e&&s.options.mapEl.removeChild(t);s.options.mapEl.appendChild(o),s.options.mapEl.removeChild(e._layerEl),a=!0;break;case"_top":window.location.href=t.url;break;default:n=e._layerEl.opacity,e._layerEl.insertAdjacentElement("beforebegin",o),s.options.mapEl.removeChild(e._layerEl),a=!0}!t.inPlace&&a&&L.DomEvent.on(o,"extentload",function e(r){a&&["_parent","_self"].includes(t.target)&&1===o.parentElement.querySelectorAll("layer-").length&&(o.parentElement.projection=o._layer.getProjection()),o.extent&&(i?o.parentElement.zoomTo(+i.lat,+i.lng,+i.z):o.focus(),L.DomEvent.off(o,"extentload",e)),n&&(o.opacity=n),s.getContainer().focus()})}},gcrsToTileMatrix:function(t){let e=t._map.project(t._map.getCenter()),i=t._map.options.crs.options.crs.tile.bounds.max.y;return[Math.trunc(e.x/i),Math.trunc(e.y/i)]}},F=L.Control.extend({options:{position:"topleft"},onAdd:function(t){let e=L.DomUtil.create("div","mapml-reload-button leaflet-bar"),i=L.DomUtil.create("button","mapml-reload-button",e);return i.innerHTML="<span aria-hidden='true'>&#x021BA</span>",i.title=M.options.locale.cmReload,i.setAttribute("type","button"),i.classList.add("mapml-button"),i.setAttribute("aria-label","Reload"),L.DomEvent.disableClickPropagation(i),L.DomEvent.on(i,"click",L.DomEvent.stop),L.DomEvent.on(i,"click",this._goReload,this),this._reloadButton=i,this._updateDisabled(),t.on("moveend",this._updateDisabled,this),e},onRemove:function(t){t.off("moveend",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_goReload:function(t){!this._disabled&&this._map.options.mapEl._history.length>1&&this._map.options.mapEl.reload()},_updateDisabled:function(){setTimeout(()=>{L.DomUtil.removeClass(this._reloadButton,"leaflet-disabled"),this._reloadButton.setAttribute("aria-disabled","false"),this._map&&(this._disabled||this._map.options.mapEl._history.length<=1)&&(L.DomUtil.addClass(this._reloadButton,"leaflet-disabled"),this._reloadButton.setAttribute("aria-disabled","true"))},0)}}),q=function(t){return new F(t)},R=L.Control.extend({options:{position:"topleft",title:{false:"View fullscreen",true:"Exit fullscreen"}},onAdd:function(t){var e=L.DomUtil.create("div","leaflet-control-fullscreen leaflet-bar leaflet-control");return this.link=L.DomUtil.create("a","leaflet-control-fullscreen-button leaflet-bar-part",e),this.link.href="#",this.link.setAttribute("role","button"),this._map=t,this._map.on("fullscreenchange",this._toggleTitle,this),this._toggleTitle(),L.DomEvent.on(this.link,"click",this._click,this),e},onRemove:function(t){t.off("fullscreenchange",this._toggleTitle,this)},_click:function(t){L.DomEvent.stopPropagation(t),L.DomEvent.preventDefault(t),this._map.toggleFullscreen(this.options)},_toggleTitle:function(){this.link.title=this.options.title[this._map.isFullscreen()]}});L.Map.include({isFullscreen:function(){return this._isFullscreen||!1},toggleFullscreen:function(t){var e=this.getContainer().getRootNode().host,i="DIV"===e.nodeName?e.parentElement:e;this.isFullscreen()?t&&t.pseudoFullscreen?this._disablePseudoFullscreen(i):document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.msExitFullscreen?document.msExitFullscreen():this._disablePseudoFullscreen(i):t&&t.pseudoFullscreen?this._enablePseudoFullscreen(i):i.requestFullscreen?i.requestFullscreen():i.mozRequestFullScreen?i.mozRequestFullScreen():i.webkitRequestFullscreen?i.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):i.msRequestFullscreen?i.msRequestFullscreen():this._enablePseudoFullscreen(i)},_enablePseudoFullscreen:function(t){L.DomUtil.addClass(t,"leaflet-pseudo-fullscreen"),this._setFullscreen(!0),this.fire("fullscreenchange")},_disablePseudoFullscreen:function(t){L.DomUtil.removeClass(t,"leaflet-pseudo-fullscreen"),this._setFullscreen(!1),this.fire("fullscreenchange")},_setFullscreen:function(t){this._isFullscreen=t;var e=this.getContainer().getRootNode().host;t?L.DomUtil.addClass(e,"mapml-fullscreen-on"):L.DomUtil.removeClass(e,"mapml-fullscreen-on"),this.invalidateSize()},_onFullscreenChange:function(t){var e=document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement,i=this.getContainer().getRootNode().host,o="DIV"===i.nodeName?i.parentElement:i;e!==o||this._isFullscreen?e!==o&&this._isFullscreen&&(this._setFullscreen(!1),this.fire("fullscreenchange")):(this._setFullscreen(!0),this.fire("fullscreenchange"))}}),L.Map.mergeOptions({fullscreenControl:!1}),L.Map.addInitHook(function(){var t;if(this.options.fullscreenControl&&(this.fullscreenControl=new R(this.options.fullscreenControl),this.addControl(this.fullscreenControl)),"onfullscreenchange"in document?t="fullscreenchange":"onmozfullscreenchange"in document?t="mozfullscreenchange":"onwebkitfullscreenchange"in document?t="webkitfullscreenchange":"onmsfullscreenchange"in document&&(t="MSFullscreenChange"),t){var e=L.bind(this._onFullscreenChange,this);this.whenReady(function(){L.DomEvent.on(document,t,e)}),this.on("unload",function(){L.DomEvent.off(document,t,e)})}});var D=function(t){return new R(t)},N=L.Layer.extend({onAdd:function(t){this._container=L.DomUtil.create("div","mapml-crosshair",t._container),this._container.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 100 100"><g stroke="#fff" stroke-linecap="round" stroke-linejoin="round"><circle cx="50.028" cy="50.219" r="3.923" stroke-width="2" color="currentColor" overflow="visible"/><path stroke-width="3" d="M4.973 54.424h31.768a4.204 4.204 0 1 0 0-8.409H4.973A4.203 4.203 0 0 0 .77 50.22a4.203 4.203 0 0 0 4.204 4.205z" color="currentColor" overflow="visible"/><path stroke-width="3" d="M54.232 5.165a4.204 4.204 0 1 0-8.408 0v31.767a4.204 4.204 0 1 0 8.408 0V5.165z"/><path stroke-width="3" d="M99.288 50.22a4.204 4.204 0 0 0-4.204-4.205H63.317a4.204 4.204 0 1 0 0 8.409h31.767a4.205 4.205 0 0 0 4.204-4.205zM45.823 95.274a4.204 4.204 0 1 0 8.409 0V63.506a4.204 4.204 0 1 0-8.409 0v31.768z" color="currentColor" overflow="visible"/></g></svg>',t.isFocused=!1,this._isQueryable=!1,t.on("layerchange layeradd layerremove overlayremove",this._toggleEvents,this),t.on("popupopen",this._isMapFocused,this),L.DomEvent.on(t._container,"keydown keyup mousedown",this._isMapFocused,this),this._addOrRemoveCrosshair()},onRemove:function(t){t.off("layerchange layeradd layerremove overlayremove",this._toggleEvents),t.off("popupopen",this._isMapFocused),L.DomEvent.off(t._container,"keydown keyup mousedown",this._isMapFocused)},_toggleEvents:function(){this._hasQueryableLayer()?this._map.on("viewreset move moveend",this._addOrRemoveCrosshair,this):this._map.off("viewreset move moveend",this._addOrRemoveCrosshair,this),this._addOrRemoveCrosshair()},_addOrRemoveCrosshair:function(t){this._hasQueryableLayer()?this._container.removeAttribute("hidden"):this._container.setAttribute("hidden","")},_addOrRemoveMapOutline:function(t){let e=this._map._container;this._map.isFocused&&!this._outline?this._outline=L.DomUtil.create("div","mapml-outline",e):!this._map.isFocused&&this._outline&&(L.DomUtil.remove(this._outline),delete this._outline)},_hasQueryableLayer:function(){let t=this._map.options.mapEl.layers;if(this._map.isFocused)for(let e of t)if(e.checked&&e._layer.queryable)return!0;return!1},_isMapFocused:function(t){if(!this._map._container.parentNode.activeElement)return void(this._map.isFocused=!1);let e=this._map._container.parentNode.activeElement.classList.contains("leaflet-container");e&&["keydown"].includes(t.type)&&t.shiftKey&&9===t.keyCode?this._map.isFocused=!1:this._map.isFocused=e&&["keyup","keydown"].includes(t.type),this._map.isFocused&&this._map.fire("mapkeyboardfocused"),this._addOrRemoveMapOutline(),this._addOrRemoveCrosshair()}}),O=function(t){return new N(t)},U=L.Path.extend({initialize:function(t,e){this.type=t.tagName.toUpperCase(),"MAP-POINT"!==this.type&&"MAP-MULTIPOINT"!==this.type||(e.fillOpacity=1),e.wrappers.length>0&&(e=Object.assign(this._convertWrappers(e.wrappers),e)),L.setOptions(this,e),this.group=this.options.group,this.options.interactive=this.options.link||this.options.properties&&this.options.onEachFeature,this._parts=[],this._markup=t,this.options.zoom=t.getAttribute("zoom")||this.options.nativeZoom,this._convertMarkup(),(t.querySelector("map-span")||t.querySelector("map-a"))&&this._generateOutlinePoints(),this.isClosed=this._isClosed()},attachLinkHandler:function(t,e,i){let o,n=document.createElement("div"),a=document.createElement("p"),s=!1;n.classList.add("mapml-link-preview"),n.appendChild(a),t.classList.add("map-a"),e.visited&&t.classList.add("map-a-visited"),L.DomEvent.on(t,"mousedown",t=>o={x:t.clientX,y:t.clientY},this),L.DomEvent.on(t,"mouseup",n=>{if(0!==n.button)return;let a=!0,s=this.options._leafletLayer._layerEl.nextElementSibling;for(;s&&a;)s.tagName&&"LAYER-"===s.tagName.toUpperCase()&&(a=!(s.checked&&s._layer.queryable)),s=s.nextElementSibling;if(a&&o){L.DomEvent.stop(n),Math.sqrt(Math.pow(o.x-n.clientX,2)+Math.pow(o.y-n.clientY,2))<=5&&(e.visited=!0,t.setAttribute("stroke","#6c00a2"),t.classList.add("map-a-visited"),M.handleLink(e,i))}},this),L.DomEvent.on(t,"keypress",o=>{L.DomEvent.stop(o),13!==o.keyCode&&32!==o.keyCode||(e.visited=!0,t.setAttribute("stroke","#6c00a2"),t.classList.add("map-a-visited"),M.handleLink(e,i))},this),L.DomEvent.on(t,"mouseenter keyup",t=>{if(t.target!==t.currentTarget)return;s=!0;let i=document.createElement("a"),o=this._map.getContainer().clientWidth;for(i.href=e.url,a.innerHTML=i.href,this._map.getContainer().appendChild(n);a.clientWidth>o/2;)a.innerHTML=a.innerHTML.substring(0,a.innerHTML.length-5)+"...";setTimeout(()=>{s&&(a.innerHTML=i.href)},1e3)},this),L.DomEvent.on(t,"mouseout keydown mousedown",t=>{t.target===t.currentTarget&&n.parentElement&&(s=!1,this._map.getContainer().removeChild(n))},this),L.DomEvent.on(i._map.getContainer(),"mouseout mouseenter click",t=>{n.parentElement&&(s=!1,this._map.getContainer().removeChild(n))},this)},_project:function(t,e,i){let o=t||this._map,n=e||o.getPixelOrigin(),a=void 0===i?o.getZoom():i;for(let t of this._parts){t.pixelRings=this._convertRing(t.rings,o,n,a);for(let e of t.subrings)e.pixelSubrings=this._convertRing([e],o,n,a)}if(this._outline){this.pixelOutline=[];for(let t of this._outline)this.pixelOutline=this.pixelOutline.concat(this._convertRing(t,o,n,a))}},_convertRing:function(t,e,i,o){let n=e.options.crs.scale(o),a=[];for(let o of t){let t=[];for(let a of o.points){let o=e.options.crs.transformation.transform(a,n);t.push(L.point(o.x,o.y)._subtract(i).round())}a.push(t)}return a},_update:function(){this._map&&this._renderer._updateFeature(this)},_convertWrappers:function(t){if(!t||0===t.length)return;let e="",i={};for(let o of t)if("MAP-A"!==o.tagName.toUpperCase()&&o.className)e+=`${o.className} `;else if(!i.link&&o.getAttribute("href")){let t={};t.url=o.getAttribute("href"),o.hasAttribute("target")&&(t.target=o.getAttribute("target")),o.hasAttribute("type")&&(t.type=o.getAttribute("type")),o.hasAttribute("inplace")&&(t.inPlace=!0),i.link=t}return i.className=`${e} ${this.options.className}`.trim(),i},_convertMarkup:function(){if(!this._markup)return;let t=this._markup.attributes;this.featureAttributes={},this.options.link&&"MAP-A"===this._markup.parentElement.tagName.toUpperCase()&&"MAP-GEOMETRY"!==this._markup.parentElement.parentElement.tagName.toUpperCase()&&(this.featureAttributes.tabindex="0");for(let e=0;e<t.length;e++)this.featureAttributes[t[e].name]=t[e].value;let e=!0;for(let t of this._markup.querySelectorAll("map-coordinates")){let i=[],o=[];if(this._coordinateToArrays(t,i,o,this.options.className),e||"MAP-POLYGON"!==this.type)if("MAP-MULTIPOINT"===this.type)for(let t of i[0].points.concat(o))this._parts.push({rings:[{points:[t]}],subrings:[],cls:`${t.cls||""} ${this.options.className||""}`.trim()});else this._parts.push({rings:i,subrings:o,cls:`${this.featureAttributes.class||""} ${this.options.className||""}`.trim()});else this._parts[0].rings.push(i[0]),o.length>0&&(this._parts[0].subrings=this._parts[0].subrings.concat(o));e=!1}},_generateOutlinePoints:function(){if("MAP-MULTIPOINT"!==this.type&&"MAP-POINT"!==this.type&&"MAP-LINESTRING"!==this.type&&"MAP-MULTILINESTRING"!==this.type){this._outline=[];for(let t of this._markup.querySelectorAll("map-coordinates")){let e=t.childNodes,i=0,o=document.createElement("div");e.length;for(let t=0;t<e.length;t++)0===e[t].textContent.trim().length&&e[t].remove();for(let t of e){let n=[];if(!t.tagName){let a="",s=((i-1)%e.length+e.length)%e.length;if(e[s].tagName){let t=e[s].textContent.trim().split(/\s+/);a+=`${t[t.length-2]} ${t[t.length-1]} `}if(a+=t.textContent,e[s=((i+1)%e.length+e.length)%e.length].tagName){let t=e[s].textContent.trim().split(/\s+/);a+=`${t[0]} ${t[1]} `}o.innerHTML=a,this._coordinateToArrays(o,n,[],!0,this.featureAttributes.class||this.options.className),this._outline.push(n)}i++}}}},_coordinateToArrays:function(t,e,i,o=!0,n,a=[]){for(let o of t.children)this._coordinateToArrays(o,e,i,!1,o.getAttribute("class"),a.concat([o]));let s,r=t.textContent.replace(/(<([^>]+)>)/gi,"").match(/(\S+\s+\S+)/gim),l=[];for(let t of r){let e=[];t.split(/\s+/gim).forEach(M.parseNumber,e);let i=M.pointToPCRSPoint(L.point(e),this.options.zoom,this.options.projection,this.options.nativeCS);l.push(i),s=s?s.extend(i):L.bounds(i,i)}if(this._bounds?(this._bounds.extend(s.min),this._bounds.extend(s.max)):this._bounds=s,o)e.push({points:l});else{let e={},o=t.attributes,r=this._convertWrappers(a);r.link&&(e.tabindex="0");for(let t=0;t<o.length;t++)"class"!==o[t].name&&(e[o[t].name]=o[t].value);i.unshift({points:l,center:s.getCenter(),cls:`${n||""} ${r.className||""}`.trim(),attr:e,link:r.link,linkTarget:r.linkTarget,linkType:r.linkType})}},_isClosed:function(){switch(this.type){case"MAP-POLYGON":case"MAP-MULTIPOLYGON":case"MAP-POINT":case"MAP-MULTIPOINT":return!0;case"MAP-LINESTRING":case"MAP-MULTILINESTRING":default:return!1}},getCenter:function(){return this._bounds?this._map.options.crs.unproject(this._bounds.getCenter()):null},getPCRSCenter:function(){return this._bounds.getCenter()}}),j=function(t,e){return new U(t,e)},Z=L.SVG.extend({_initContainer:function(){L.SVG.prototype._initContainer.call(this),this._container.setAttribute("role","none presentation")},_initPath:function(t,e=!0){if(t._outline){let e=L.SVG.create("path");t.options.className&&L.DomUtil.addClass(e,t.featureAttributes.class||t.options.className),L.DomUtil.addClass(e,"mapml-feature-outline"),e.style.fill="none",t.outlinePath=e}for(let e of t._parts){if(e.rings&&(this._createPath(e,t.options.className,t.featureAttributes["aria-label"],t.options.interactive,t.featureAttributes),t.outlinePath&&(e.path.style.stroke="none")),e.subrings)for(let i of e.subrings)this._createPath(i,t.options.className,i.attr["aria-label"],void 0!==i.link,i.attr);this._updateStyle(t)}if(e){let e=L.stamp(t);this._layers[e]=t}},_createPath:function(t,e,i,o=!1,n){let a=L.SVG.create("path");if(t.path=a,n)for(let[t,e]of Object.entries(n))"id"!==t&&"tabindex"!==t&&a.setAttribute(t,e);else i&&a.setAttribute("aria-label",i);(t.cls||e)&&L.DomUtil.addClass(a,t.cls||e),o&&L.DomUtil.addClass(a,"leaflet-interactive")},_addPath:function(t,e,i=!0){this._rootGroup||e||this._initContainer();let o=e||this._rootGroup,n=!1;i&&t.addInteractiveTarget(t.group);for(let e of t._parts){e.path&&t.group.appendChild(e.path),i&&(t.options.link&&t.attachLinkHandler(e.path,t.options.link,t.options._leafletLayer),t.addInteractiveTarget(e.path)),!n&&t.pixelOutline&&(t.group.appendChild(t.outlinePath),n=!0);for(let i of e.subrings)i.path&&(i.link&&(t.attachLinkHandler(i.path,i.link,t.options._leafletLayer),t.addInteractiveTarget(i.path)),t.group.appendChild(i.path))}o.appendChild(t.group)},_removePath:function(t){for(let e of t._parts){e.path&&(t.removeInteractiveTarget(e.path),L.DomUtil.remove(e.path));for(let t of e.subrings)t.path&&L.DomUtil.remove(t.path)}t.outlinePath&&L.DomUtil.remove(t.outlinePath),t.removeInteractiveTarget(t.group),L.DomUtil.remove(t.group),delete this._layers[L.stamp(t)]},_updateFeature:function(t){t.pixelOutline&&this._setPath(t.outlinePath,this.geometryToPath(t.pixelOutline,!1));for(let e of t._parts){this._setPath(e.path,this.geometryToPath(e.pixelRings,t.isClosed));for(let t of e.subrings)this._setPath(t.path,this.geometryToPath(t.pixelSubrings,!1))}},_pointToMarker:function(t){return`M${t.x} ${t.y} L${t.x-12.5} ${t.y-30} C${t.x-12.5} ${t.y-50}, ${t.x+12.5} ${t.y-50}, ${t.x+12.5} ${t.y-30} L${t.x} ${t.y}z`},_updateStyle:function(t){this._updatePathStyle(t.outlinePath,t,!1,!0);for(let e of t._parts){e.path&&this._updatePathStyle(e.path,t,!0);for(let i of e.subrings)i.path&&this._updatePathStyle(i.path,t)}},_updatePathStyle:function(t,e,i=!1,o=!1){if(!t||!e)return;let n=e.options,a=e.isClosed;n.stroke&&(!a||o)||i&&!e.outlinePath?(t.setAttribute("stroke",n.color),t.setAttribute("stroke-opacity",n.opacity),t.setAttribute("stroke-width",n.weight),t.setAttribute("stroke-linecap",n.lineCap),t.setAttribute("stroke-linejoin",n.lineJoin),n.dashArray?t.setAttribute("stroke-dasharray",n.dashArray):t.removeAttribute("stroke-dasharray"),n.dashOffset?t.setAttribute("stroke-dashoffset",n.dashOffset):t.removeAttribute("stroke-dashoffset"),n.link&&(t.setAttribute("stroke",n.link.visited?"#6c00a2":"#0000EE"),t.setAttribute("stroke-opacity","1"),t.setAttribute("stroke-width","1px"),t.setAttribute("stroke-dasharray","none"))):t.setAttribute("stroke","none"),a&&!o?n.fill?t.setAttribute("fill",n.color):(t.setAttribute("fill",n.fillColor||n.color),t.setAttribute("fill-opacity",n.fillOpacity),t.setAttribute("fill-rule",n.fillRule||"evenodd")):t.setAttribute("fill","none")},_setPath:function(t,e){t.setAttribute("d",e)},geometryToPath:function(t,e){let i,o,n,a,s,r,l="";for(i=0,n=t.length;i<n;i++){if(1===(s=t[i]).length)return this._pointToMarker(s[0]);for(o=0,a=s.length;o<a;o++)r=s[o],l+=(o?"L":"M")+r.x+" "+r.y;l+=e?"z":""}return l||"M0 0"}}),G=function(t){return new Z(t)},H=L.FeatureGroup.extend({initialize:function(t,e){if(e.wrappers&&e.wrappers.length>0&&(e=Object.assign(M.Feature.prototype._convertWrappers(e.wrappers),e)),L.LayerGroup.prototype.initialize.call(this,t,e),this.options.onEachFeature&&this.options.properties||this.options.link){L.DomUtil.addClass(this.options.group,"leaflet-interactive"),L.DomEvent.on(this.options.group,"keyup keydown mousedown",this._handleFocus,this);let e=t[Object.keys(t)[0]];1===t.length&&e.options.link&&(this.options.link=e.options.link),this.options.link?(M.Feature.prototype.attachLinkHandler.call(this,this.options.group,this.options.link,this.options._leafletLayer),this.options.group.setAttribute("role","link")):(this.options.group.setAttribute("aria-expanded","false"),this.options.group.setAttribute("role","button"),this.options.onEachFeature(this.options.properties,this),this.off("click",this._openPopup))}this.options.group.setAttribute("aria-label",this.options.accessibleTitle),this.options.featureID&&this.options.group.setAttribute("data-fid",this.options.featureID)},onAdd:function(t){L.LayerGroup.prototype.onAdd.call(this,t),this.updateInteraction()},updateInteraction:function(){let t=this._map||this.options._leafletLayer._map;(this.options.onEachFeature&&this.options.properties||this.options.link)&&t.featureIndex.addToIndex(this,this.getPCRSCenter(),this.options.group);for(let e in this._layers){let i=this._layers[e];for(let e of i._parts){i.featureAttributes&&i.featureAttributes.tabindex&&t.featureIndex.addToIndex(i,i.getPCRSCenter(),e.path);for(let o of e.subrings)o.attr&&o.attr.tabindex&&t.featureIndex.addToIndex(i,o.center,o.path)}}},_handleFocus:function(t){if(9!==t.keyCode&&16!==t.keyCode||"keydown"!==t.type)9!==t.keyCode&&16!==t.keyCode&&13!==t.keyCode&&(this._map.featureIndex.currentIndex=0,this._map.featureIndex.inBoundFeatures[0].path.focus());else{let e=this._map.featureIndex.currentIndex;9===t.keyCode&&t.shiftKey?(e===this._map.featureIndex.inBoundFeatures.length-1&&this._map.featureIndex.inBoundFeatures[e].path.setAttribute("tabindex",-1),0!==e&&(L.DomEvent.stop(t),this._map.featureIndex.inBoundFeatures[e-1].path.focus(),this._map.featureIndex.currentIndex--)):9===t.keyCode&&(e!==this._map.featureIndex.inBoundFeatures.length-1?(L.DomEvent.stop(t),this._map.featureIndex.inBoundFeatures[e+1].path.focus(),this._map.featureIndex.currentIndex++):(this._map.featureIndex.inBoundFeatures[0].path.setAttribute("tabindex",-1),this._map.featureIndex.inBoundFeatures[e].path.setAttribute("tabindex",0)))}"G"===t.target.tagName.toUpperCase()&&(9!==t.keyCode&&16!==t.keyCode&&13!==t.keyCode||"keyup"!==t.type?13===t.keyCode||32===t.keyCode?(this.closeTooltip(),!this.options.link&&this.options.onEachFeature&&(L.DomEvent.stop(t),this.openPopup())):this.closeTooltip():this.openTooltip())},addLayer:function(t){!t.options.link&&t.options.interactive&&this.options.onEachFeature(this.options.properties,t),L.FeatureGroup.prototype.addLayer.call(this,t)},_previousFeature:function(t){L.DomEvent.stop(t),this._map.featureIndex.currentIndex=Math.max(this._map.featureIndex.currentIndex-1,0),this._map.featureIndex.inBoundFeatures[this._map.featureIndex.currentIndex].path.focus(),this._map.closePopup()},_nextFeature:function(t){L.DomEvent.stop(t),this._map.featureIndex.currentIndex=Math.min(this._map.featureIndex.currentIndex+1,this._map.featureIndex.inBoundFeatures.length-1),this._map.featureIndex.inBoundFeatures[this._map.featureIndex.currentIndex].path.focus(),this._map.closePopup()},getPCRSCenter:function(){let t;for(let e in this._layers){let i=this._layers[e];t?t.extend(i.getPCRSCenter()):t=L.bounds(i.getPCRSCenter(),i.getPCRSCenter())}return t.getCenter()}}),$=function(t,e){return new H(t,e)},V=L.Handler.extend({addHooks:function(){this._map.on({layeradd:this.totalBounds,layerremove:this.totalBounds}),this._map.options.mapEl.addEventListener("moveend",this.announceBounds),this._map.dragging._draggable.addEventListener("dragstart",this.dragged),this._map.options.mapEl.addEventListener("mapfocused",this.focusAnnouncement)},removeHooks:function(){this._map.off({layeradd:this.totalBounds,layerremove:this.totalBounds}),this._map.options.mapEl.removeEventListener("moveend",this.announceBounds),this._map.dragging._draggable.removeEventListener("dragstart",this.dragged),this._map.options.mapEl.removeEventListener("mapfocused",this.focusAnnouncement)},focusAnnouncement:function(){let t=this;setTimeout(function(){let e=t.querySelector(".mapml-web-map")?t.querySelector(".mapml-web-map").shadowRoot.querySelector(".leaflet-container"):t.shadowRoot.querySelector(".leaflet-container"),i=t._map.getZoom(),o=M.gcrsToTileMatrix(t),n=M.options.locale.amZoom+" "+i+" "+M.options.locale.amColumn+" "+o[0]+" "+M.options.locale.amRow+" "+o[1];i===t._map._layersMaxZoom?n=M.options.locale.amMaxZoom+" "+n:i===t._map._layersMinZoom&&(n=M.options.locale.amMinZoom+" "+n),e.setAttribute("aria-roledescription","region "+n),setTimeout(function(){e.removeAttribute("aria-roledescription")},2e3)},0)},announceBounds:function(){if(this._traversalCall>0)return;let t=this._map.getZoom(),e=M.pixelToPCRSBounds(this._map.getPixelBounds(),t,this._map.options.projection),i=!0;this._map.totalLayerBounds&&(i=t<=this._map._layersMaxZoom&&t>=this._map._layersMinZoom&&this._map.totalLayerBounds.overlaps(e));let o=this.querySelector(".mapml-web-map")?this.querySelector(".mapml-web-map").shadowRoot.querySelector(".mapml-screen-reader-output"):this.shadowRoot.querySelector(".mapml-screen-reader-output"),n=M.gcrsToTileMatrix(this),a=M.options.locale.amZoom+" "+t+" "+M.options.locale.amColumn+" "+n[0]+" "+M.options.locale.amRow+" "+n[1];if(i){let e=this._history[this._historyIndex-1]?this._history[this._historyIndex-1].zoom:this._history[this._historyIndex].zoom;t===this._map._layersMaxZoom&&t!==e?o.innerText=M.options.locale.amMaxZoom+" "+a:t===this._map._layersMinZoom&&t!==e?o.innerText=M.options.locale.amMinZoom+" "+a:o.innerText=a}else{let t=this._history[this._historyIndex],e=this._history[this._historyIndex-1];this.back(),this._history.pop(),t.zoom!==e.zoom?o.innerText=M.options.locale.amZoomedOut:this._map.dragging._draggable.wasDragged?o.innerText=M.options.locale.amDraggedOut:t.x>e.x?o.innerText=M.options.locale.amEastBound:t.x<e.x?o.innerText=M.options.locale.amWestBound:t.y<e.y?o.innerText=M.options.locale.amNorthBound:t.y>e.y&&(o.innerText=M.options.locale.amSouthBound)}this._map.dragging._draggable.wasDragged=!1},totalBounds:function(){let t=Object.keys(this._layers),e=L.bounds();t.forEach(t=>{if(this._layers[t].layerBounds){if(!e){let i=this._layers[t].layerBounds.getCenter();e=L.bounds(i,i)}e.extend(this._layers[t].layerBounds.min),e.extend(this._layers[t].layerBounds.max)}}),this.totalLayerBounds=e},dragged:function(){this.wasDragged=!0}}),W=L.Handler.extend({initialize:function(t){L.Handler.prototype.initialize.call(this,t),this.inBoundFeatures=[],this.outBoundFeatures=[],this.currentIndex=0,this._mapPCRSBounds=M.pixelToPCRSBounds(t.getPixelBounds(),t.getZoom(),t.options.projection)},addHooks:function(){this._map.on("mapkeyboardfocused",this._updateMapBounds,this),this._map.on("mapkeyboardfocused",this._sortIndex,this)},removeHooks:function(){this._map.off("mapkeyboardfocused",this._updateMapBounds),this._map.off("mapkeyboardfocused",this._sortIndex)},addToIndex:function(t,e,i){let o=this._mapPCRSBounds.getCenter(),n=Math.sqrt(Math.pow(e.x-o.x,2)+Math.pow(e.y-o.y,2)),a=this._mapPCRSBounds.contains(e)?this.inBoundFeatures:this.outBoundFeatures,s={path:i,layer:t,center:e,dist:n};i.setAttribute("tabindex",-1),a.push(s);for(let t=a.length-1;t>0&&a[t].dist<a[t-1].dist;t--){let e=a[t];a[t]=a[t-1],a[t-1]=e}this._mapPCRSBounds.contains(e)?this.inBoundFeatures=a:this.outBoundFeatures=a},cleanIndex:function(){this.currentIndex=0,this.inBoundFeatures=this.inBoundFeatures.filter(t=>{let e=this._mapPCRSBounds.contains(t.center);return t.path.setAttribute("tabindex",-1),t.layer._map&&!e&&this.outBoundFeatures.push(t),t.layer._map&&e}),this.outBoundFeatures=this.outBoundFeatures.filter(t=>{let e=this._mapPCRSBounds.contains(t.center);return t.path.setAttribute("tabindex",-1),t.layer._map&&e&&this.inBoundFeatures.push(t),t.layer._map&&!e})},_sortIndex:function(){if(this.cleanIndex(),0===this.inBoundFeatures.length)return;let t=this._mapPCRSBounds.getCenter();this.inBoundFeatures.sort(function(e,i){let o=e.center,n=i.center;return e.dist=Math.sqrt(Math.pow(o.x-t.x,2)+Math.pow(o.y-t.y,2)),i.dist=Math.sqrt(Math.pow(n.x-t.x,2)+Math.pow(n.y-t.y,2)),e.dist-i.dist}),this.inBoundFeatures[0].path.setAttribute("tabindex",0)},_updateMapBounds:function(t){this._mapPCRSBounds=M.pixelToPCRSBounds(this._map.getPixelBounds(),this._map.getZoom(),this._map.options.projection)}}),K={announceMovement:!1,locale:{cmBack:"Back",cmForward:"Forward",cmReload:"Reload",cmToggleControls:"Toggle Controls",cmCopyCoords:"Copy Coordinates",cmToggleDebug:"Toggle Debug Mode",cmCopyMapML:"Copy MapML",cmViewSource:"View Map Source",cmCopyAll:"All",lmZoomToLayer:"Zoom To Layer",lmCopyExtent:"Copy Extent",lcOpacity:"Opacity",btnZoomIn:"Zoom in",btnZoomOut:"Zoom out",btnFullScreen:"View fullscreen",amZoom:"zoom level",amColumn:"column",amRow:"row",amMaxZoom:"At maximum zoom level, zoom in disabled",amMinZoom:"At minimum zoom level, zoom out disabled",amZoomedOut:"Zoomed out of bounds, returning to",amDraggedOut:"Dragged out of bounds, returning to",amEastBound:"Reached east bound, panning east disabled",amWestBound:"Reached west bound, panning west disabled",amNorthBound:"Reached north bound, panning north disabled",amSouthBound:"Reached south bound, panning south disabled"}};L.Map.Keyboard.include({_onKeyDown:function(t){if(t.altKey||t.metaKey)return;let e={187:187,107:107,61:61,171:171},i={189:189,109:109,54:54,173:173};var o,n=t.keyCode,a=this._map;if(n in this._panKeys)a._panAnim&&a._panAnim._inProgress||(o=this._panKeys[n],t.shiftKey&&(o=L.point(o).multiplyBy(3)),t.ctrlKey&&(o=L.point(o).divideBy(5)),a.panBy(o),a.options.maxBounds&&a.panInsideBounds(a.options.maxBounds));else if(n in this._zoomKeys)(n in e&&a._layersMaxZoom!==a.getZoom()||n in i&&a._layersMinZoom!==a.getZoom())&&a.setZoom(a.getZoom()+(t.shiftKey?3:1)*this._zoomKeys[n]);else{if(27!==n||!a._popup||!a._popup.options.closeOnEscapeKey)return;a.closePopup()}L.DomEvent.stop(t)}}),function(n,a,A){var M={};n.M=M,function(){M.detectImagePath=function(t){var e=L.DomUtil.create("div","leaflet-default-icon-path",t),i=L.DomUtil.getStyle(e,"background-image")||L.DomUtil.getStyle(e,"backgroundImage");return t.removeChild(e),i=null===i||0!==i.indexOf("url")?"":i.replace(/^url\(["']?/,"").replace(/marker-icon\.png["']?\)$/,"")},M.mime="text/mapml";let t=n.document.head.querySelector("map-options");M.options=K,t&&(M.options=Object.assign(M.options,JSON.parse(t.innerHTML))),M.WGS84=new L.Proj.CRS("EPSG:4326","+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs ",{origin:[-180,90],bounds:L.bounds([[-180,-90],[180,90]]),resolutions:[.703125,.3515625,.17578125,.087890625,.0439453125,.02197265625,.010986328125,.0054931640625,.00274658203125,.001373291015625,.0006866455078125,.0003433227539062,.0001716613769531,858306884766e-16,429153442383e-16,214576721191e-16,107288360596e-16,53644180298e-16,26822090149e-16,13411045074e-16,6.705522537e-7,3.352761269e-7],crs:{tcrs:{horizontal:{name:"x",min:0,max:t=>(M.WGS84.options.bounds.getSize().x/M.WGS84.options.resolutions[t]).toFixed()},vertical:{name:"y",min:0,max:t=>(M.WGS84.options.bounds.getSize().y/M.WGS84.options.resolutions[t]).toFixed()},bounds:t=>L.bounds([M.WGS84.options.crs.tcrs.horizontal.min,M.WGS84.options.crs.tcrs.vertical.min],[M.WGS84.options.crs.tcrs.horizontal.max(t),M.WGS84.options.crs.tcrs.vertical.max(t)])},pcrs:{horizontal:{name:"longitude",get min(){return M.WGS84.options.crs.gcrs.horizontal.min},get max(){return M.WGS84.options.crs.gcrs.horizontal.max}},vertical:{name:"latitude",get min(){return M.WGS84.options.crs.gcrs.vertical.min},get max(){return M.WGS84.options.crs.gcrs.vertical.max}},get bounds(){return M.WGS84.options.bounds}},gcrs:{horizontal:{name:"longitude",min:-180,max:180},vertical:{name:"latitude",min:-90,max:90},get bounds(){return L.latLngBounds([M.WGS84.options.crs.gcrs.vertical.min,M.WGS84.options.crs.gcrs.horizontal.min],[M.WGS84.options.crs.gcrs.vertical.max,M.WGS84.options.crs.gcrs.horizontal.max])}},map:{horizontal:{name:"i",min:0,max:t=>t.getSize().x},vertical:{name:"j",min:0,max:t=>t.getSize().y},bounds:t=>L.bounds(L.point([0,0]),t.getSize())},tile:{horizontal:{name:"i",min:0,max:256},vertical:{name:"j",min:0,max:256},get bounds(){return L.bounds([M.WGS84.options.crs.tile.horizontal.min,M.WGS84.options.crs.tile.vertical.min],[M.WGS84.options.crs.tile.horizontal.max,M.WGS84.options.crs.tile.vertical.max])}},tilematrix:{horizontal:{name:"column",min:0,max:t=>(M.WGS84.options.crs.tcrs.horizontal.max(t)/M.WGS84.options.crs.tile.bounds.getSize().x).toFixed()},vertical:{name:"row",min:0,max:t=>(M.WGS84.options.crs.tcrs.vertical.max(t)/M.WGS84.options.crs.tile.bounds.getSize().y).toFixed()},bounds:t=>L.bounds([M.WGS84.options.crs.tilematrix.horizontal.min,M.WGS84.options.crs.tilematrix.vertical.min],[M.WGS84.options.crs.tilematrix.horizontal.max(t),M.WGS84.options.crs.tilematrix.vertical.max(t)])}}}),M.CBMTILE=new L.Proj.CRS("EPSG:3978","+proj=lcc +lat_1=49 +lat_2=77 +lat_0=49 +lon_0=-95 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs",{origin:[-34655800,3931e4],bounds:L.bounds([[-34655800,-39e6],[1e7,3931e4]]),resolutions:[38364.660062653464,22489.62831258996,13229.193125052918,7937.5158750317505,4630.2175937685215,2645.8386250105837,1587.5031750063501,926.0435187537042,529.1677250021168,317.50063500127004,185.20870375074085,111.12522225044451,66.1459656252646,38.36466006265346,22.48962831258996,13.229193125052918,7.9375158750317505,4.6302175937685215,2.6458386250105836,1.5875031750063502,.9260435187537043,.5291677250021167,.31750063500127,.18520870375074083,.11112522225044451,.06614596562526459],crs:{tcrs:{horizontal:{name:"x",min:0,max:t=>(M.CBMTILE.options.bounds.getSize().x/M.CBMTILE.options.resolutions[t]).toFixed()},vertical:{name:"y",min:0,max:t=>(M.CBMTILE.options.bounds.getSize().y/M.CBMTILE.options.resolutions[t]).toFixed()},bounds:t=>L.bounds([M.CBMTILE.options.crs.tcrs.horizontal.min,M.CBMTILE.options.crs.tcrs.vertical.min],[M.CBMTILE.options.crs.tcrs.horizontal.max(t),M.CBMTILE.options.crs.tcrs.vertical.max(t)])},pcrs:{horizontal:{name:"easting",get min(){return M.CBMTILE.options.bounds.min.x},get max(){return M.CBMTILE.options.bounds.max.x}},vertical:{name:"northing",get min(){return M.CBMTILE.options.bounds.min.y},get max(){return M.CBMTILE.options.bounds.max.y}},get bounds(){return M.CBMTILE.options.bounds}},gcrs:{horizontal:{name:"longitude",min:-141.01,max:-47.74},vertical:{name:"latitude",min:40.04,max:86.46},get bounds(){return L.latLngBounds([M.CBMTILE.options.crs.gcrs.vertical.min,M.CBMTILE.options.crs.gcrs.horizontal.min],[M.CBMTILE.options.crs.gcrs.vertical.max,M.CBMTILE.options.crs.gcrs.horizontal.max])}},map:{horizontal:{name:"i",min:0,max:t=>t.getSize().x},vertical:{name:"j",min:0,max:t=>t.getSize().y},bounds:t=>L.bounds(L.point([0,0]),t.getSize())},tile:{horizontal:{name:"i",min:0,max:256},vertical:{name:"j",min:0,max:256},get bounds(){return L.bounds([M.CBMTILE.options.crs.tile.horizontal.min,M.CBMTILE.options.crs.tile.vertical.min],[M.CBMTILE.options.crs.tile.horizontal.max,M.CBMTILE.options.crs.tile.vertical.max])}},tilematrix:{horizontal:{name:"column",min:0,max:t=>(M.CBMTILE.options.crs.tcrs.horizontal.max(t)/M.CBMTILE.options.crs.tile.bounds.getSize().x).toFixed()},vertical:{name:"row",min:0,max:t=>(M.CBMTILE.options.crs.tcrs.vertical.max(t)/M.CBMTILE.options.crs.tile.bounds.getSize().y).toFixed()},bounds:t=>L.bounds([0,0],[M.CBMTILE.options.crs.tilematrix.horizontal.max(t),M.CBMTILE.options.crs.tilematrix.vertical.max(t)])}}}),M.APSTILE=new L.Proj.CRS("EPSG:5936","+proj=stere +lat_0=90 +lat_ts=50 +lon_0=-150 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m +no_defs",{origin:[-28567784.109255,32567784.109255],bounds:L.bounds([[-28567784.109254867,-28567784.109254755],[32567784.109255023,32567784.10925506]]),resolutions:[238810.813354,119405.406677,59702.7033384999,29851.3516692501,14925.675834625,7462.83791731252,3731.41895865639,1865.70947932806,932.854739664032,466.427369832148,233.213684916074,116.606842458037,58.3034212288862,29.1517106145754,14.5758553072877,7.28792765351156,3.64396382688807,1.82198191331174,.910990956788164,.45549547826179],crs:{tcrs:{horizontal:{name:"x",min:0,max:t=>(M.APSTILE.options.bounds.getSize().x/M.APSTILE.options.resolutions[t]).toFixed()},vertical:{name:"y",min:0,max:t=>(M.APSTILE.options.bounds.getSize().y/M.APSTILE.options.resolutions[t]).toFixed()},bounds:t=>L.bounds([M.APSTILE.options.crs.tcrs.horizontal.min,M.APSTILE.options.crs.tcrs.vertical.min],[M.APSTILE.options.crs.tcrs.horizontal.max(t),M.APSTILE.options.crs.tcrs.vertical.max(t)])},pcrs:{horizontal:{name:"easting",get min(){return M.APSTILE.options.bounds.min.x},get max(){return M.APSTILE.options.bounds.max.x}},vertical:{name:"northing",get min(){return M.APSTILE.options.bounds.min.y},get max(){return M.APSTILE.options.bounds.max.y}},get bounds(){return M.APSTILE.options.bounds}},gcrs:{horizontal:{name:"longitude",min:-180,max:180},vertical:{name:"latitude",min:60,max:90},get bounds(){return L.latLngBounds([M.APSTILE.options.crs.gcrs.vertical.min,M.APSTILE.options.crs.gcrs.horizontal.min],[M.APSTILE.options.crs.gcrs.vertical.max,M.APSTILE.options.crs.gcrs.horizontal.max])}},map:{horizontal:{name:"i",min:0,max:t=>t.getSize().x},vertical:{name:"j",min:0,max:t=>t.getSize().y},bounds:t=>L.bounds(L.point([0,0]),t.getSize())},tile:{horizontal:{name:"i",min:0,max:256},vertical:{name:"j",min:0,max:256},get bounds(){return L.bounds([M.APSTILE.options.crs.tile.horizontal.min,M.APSTILE.options.crs.tile.vertical.min],[M.APSTILE.options.crs.tile.horizontal.max,M.APSTILE.options.crs.tile.vertical.max])}},tilematrix:{horizontal:{name:"column",min:0,max:t=>(M.APSTILE.options.crs.tcrs.horizontal.max(t)/M.APSTILE.options.crs.tile.bounds.getSize().x).toFixed()},vertical:{name:"row",min:0,max:t=>(M.APSTILE.options.crs.tcrs.vertical.max(t)/M.APSTILE.options.crs.tile.bounds.getSize().y).toFixed()},bounds:t=>L.bounds([0,0],[M.APSTILE.options.crs.tilematrix.horizontal.max(t),M.APSTILE.options.crs.tilematrix.vertical.max(t)])}}}),M.OSMTILE=L.CRS.EPSG3857,L.setOptions(M.OSMTILE,{origin:[-20037508.342787,20037508.342787],bounds:L.bounds([[-20037508.342787,-20037508.342787],[20037508.342787,20037508.342787]]),resolutions:[156543.0339,78271.51695,39135.758475,19567.8792375,9783.93961875,4891.969809375,2445.9849046875,1222.9924523438,611.49622617188,305.74811308594,152.87405654297,76.437028271484,38.218514135742,19.109257067871,9.5546285339355,4.7773142669678,2.3886571334839,1.1943285667419,.59716428337097,.29858214168549,.14929107084274,.074645535421371,.03732276771068573,.018661383855342866,.009330691927671433],crs:{tcrs:{horizontal:{name:"x",min:0,max:t=>(M.OSMTILE.options.bounds.getSize().x/M.OSMTILE.options.resolutions[t]).toFixed()},vertical:{name:"y",min:0,max:t=>(M.OSMTILE.options.bounds.getSize().y/M.OSMTILE.options.resolutions[t]).toFixed()},bounds:t=>L.bounds([M.OSMTILE.options.crs.tcrs.horizontal.min,M.OSMTILE.options.crs.tcrs.vertical.min],[M.OSMTILE.options.crs.tcrs.horizontal.max(t),M.OSMTILE.options.crs.tcrs.vertical.max(t)])},pcrs:{horizontal:{name:"easting",get min(){return M.OSMTILE.options.bounds.min.x},get max(){return M.OSMTILE.options.bounds.max.x}},vertical:{name:"northing",get min(){return M.OSMTILE.options.bounds.min.y},get max(){return M.OSMTILE.options.bounds.max.y}},get bounds(){return M.OSMTILE.options.bounds}},gcrs:{horizontal:{name:"longitude",get min(){return M.OSMTILE.unproject(M.OSMTILE.options.bounds.min).lng},get max(){return M.OSMTILE.unproject(M.OSMTILE.options.bounds.max).lng}},vertical:{name:"latitude",get min(){return M.OSMTILE.unproject(M.OSMTILE.options.bounds.min).lat},get max(){return M.OSMTILE.unproject(M.OSMTILE.options.bounds.max).lat}},get bounds(){return L.latLngBounds([M.OSMTILE.options.crs.gcrs.vertical.min,M.OSMTILE.options.crs.gcrs.horizontal.min],[M.OSMTILE.options.crs.gcrs.vertical.max,M.OSMTILE.options.crs.gcrs.horizontal.max])}},map:{horizontal:{name:"i",min:0,max:t=>t.getSize().x},vertical:{name:"j",min:0,max:t=>t.getSize().y},bounds:t=>L.bounds(L.point([0,0]),t.getSize())},tile:{horizontal:{name:"i",min:0,max:256},vertical:{name:"j",min:0,max:256},get bounds(){return L.bounds([M.OSMTILE.options.crs.tile.horizontal.min,M.OSMTILE.options.crs.tile.vertical.min],[M.OSMTILE.options.crs.tile.horizontal.max,M.OSMTILE.options.crs.tile.vertical.max])}},tilematrix:{horizontal:{name:"column",min:0,max:t=>(M.OSMTILE.options.crs.tcrs.horizontal.max(t)/M.OSMTILE.options.crs.tile.bounds.getSize().x).toFixed()},vertical:{name:"row",min:0,max:t=>(M.OSMTILE.options.crs.tcrs.vertical.max(t)/M.OSMTILE.options.crs.tile.bounds.getSize().y).toFixed()},bounds:t=>L.bounds([0,0],[M.OSMTILE.options.crs.tilematrix.horizontal.max(t),M.OSMTILE.options.crs.tilematrix.vertical.max(t)])}}})}(),M.handleLink=w.handleLink,M.convertPCRSBounds=w.convertPCRSBounds,M.axisToXY=w.axisToXY,M.csToAxes=w.csToAxes,M.convertAndFormatPCRS=w.convertAndFormatPCRS,M.axisToCS=w.axisToCS,M.parseNumber=w.parseNumber,M.extractInputBounds=w.extractInputBounds,M.splitCoordinate=w.splitCoordinate,M.boundsToPCRSBounds=w.boundsToPCRSBounds,M.pixelToPCRSBounds=w.pixelToPCRSBounds,M.metaContentToObject=w.metaContentToObject,M.coordsToArray=w.coordsToArray,M.parseStylesheetAsHTML=w.parseStylesheetAsHTML,M.pointToPCRSPoint=w.pointToPCRSPoint,M.pixelToPCRSPoint=w.pixelToPCRSPoint,M.gcrsToTileMatrix=w.gcrsToTileMatrix,M.QueryHandler=I,M.ContextMenu=B,M.AnnounceMovement=V,M.FeatureIndex=W,L.Map.addInitHook("addHandler","query",M.QueryHandler),L.Map.addInitHook("addHandler","contextMenu",M.ContextMenu),L.Map.addInitHook("addHandler","announceMovement",M.AnnounceMovement),L.Map.addInitHook("addHandler","featureIndex",M.FeatureIndex),M.MapMLLayer=f,M.mapMLLayer=x,M.ImageOverlay=y,M.imageOverlay=g,M.TemplatedImageLayer=d,M.templatedImageLayer=_,M.TemplatedFeaturesLayer=c,M.templatedFeaturesLayer=h,M.TemplatedLayer=m,M.templatedLayer=p,M.TemplatedTileLayer=l,M.templatedTileLayer=u,M.MapMLFeatures=s,M.mapMlFeatures=r,M.MapMLLayerControl=i,M.mapMlLayerControl=o,M.ReloadButton=F,M.reloadButton=q,M.FullscreenButton=R,M.fullscreenButton=D,M.MapMLStaticTileLayer=t,M.mapMLStaticTileLayer=e,M.DebugOverlay=b,M.debugOverlay=v,M.Crosshair=N,M.crosshair=O,M.Feature=U,M.feature=j,M.FeatureRenderer=Z,M.featureRenderer=G,M.FeatureGroup=H,M.featureGroup=$}(window)}();
\ No newline at end of file
diff --git a/dist/web-map.js b/dist/web-map.js
index 6237521..0b1bb19 100644
--- a/dist/web-map.js
+++ b/dist/web-map.js
@@ -169,6 +169,7 @@ export class WebMap extends HTMLMapElement {
     });
     this.controlsListObserver.observe(this, {attributes:true});
   }
+
   connectedCallback() {
     if (this.isConnected) {
 
@@ -213,6 +214,7 @@ export class WebMap extends HTMLMapElement {
             query: true,
             contextMenu: true,
             announceMovement: M.options.announceMovement,
+            featureIndex: true,
             mapEl: this,
             crs: M[this.projection],
             zoom: this.zoom,

From 74dd8c3ef9cbcdd99c45a24a4ce5343ac615945c Mon Sep 17 00:00:00 2001
From: prushforth <peter.rushforth@gmail.com>
Date: Wed, 12 Jan 2022 17:00:01 +0000
Subject: [PATCH 2/4] [AUTO] Sync MapML Build

---
 dist/mapml.min.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dist/mapml.min.js b/dist/mapml.min.js
index 88fe0a1..94ee3d7 100644
--- a/dist/mapml.min.js
+++ b/dist/mapml.min.js
@@ -1,4 +1,4 @@
-/*! @maps4html/web-map-custom-element 31-12-2021 */
+/*! @maps4html/web-map-custom-element 12-01-2022 */
 
 !function(){"use strict";function t(t){return new i(t)}function e(t,e){return new o(t,e)}var i=L.GridLayer.extend({initialize:function(t){this.zoomBounds=this._getZoomBounds(t.tileContainer,t.maxZoomBound),L.extend(t,this.zoomBounds),L.setOptions(this,t),this._groups=this._groupTiles(this.options.tileContainer.getElementsByTagName("map-tile"))},onAdd:function(){this._bounds=this._getLayerBounds(this._groups,this._map.options.projection),this.layerBounds=this._bounds[Object.keys(this._bounds)[0]];for(var t of Object.keys(this._bounds))this.layerBounds.extend(this._bounds[t].min),this.layerBounds.extend(this._bounds[t].max);L.GridLayer.prototype.onAdd.call(this,this._map),this._handleMoveEnd()},getEvents:function(){let t=L.GridLayer.prototype.getEvents.call(this,this._map);return this._parentOnMoveEnd=t.moveend,t.moveend=this._handleMoveEnd,t.move=()=>{},t},_handleMoveEnd:function(t){var e=this._map.getZoom();let i=e;i=i>this.options.maxNativeZoom?this.options.maxNativeZoom:i,i=i<this.options.minNativeZoom?this.options.minNativeZoom:i,this.isVisible=e<=this.zoomBounds.maxZoom&&e>=this.zoomBounds.minZoom&&this._bounds[i]&&this._bounds[i].overlaps(M.pixelToPCRSBounds(this._map.getPixelBounds(),this._map.getZoom(),this._map.options.projection)),this.isVisible&&this._parentOnMoveEnd()},_isValidTile(t){return this._groups[this._tileCoordsToKey(t)]},createTile:function(t){let i=this._groups[this._tileCoordsToKey(t)]||[],o=document.createElement("map-tile"),n=this.getTileSize();o.setAttribute("col",t.x),o.setAttribute("row",t.y),o.setAttribute("zoom",t.z);for(let e=0;e<i.length;e++){let t=document.createElement("img");t.width=n.x,t.height=n.y,t.alt="",t.setAttribute("role","presentation"),t.src=i[e].src,o.appendChild(t)}return o},_getLayerBounds:function(t,e){let i={},o=M[e].options.crs.tile.bounds.max.x;for(var n in t){let t=n.split(":"),e={};e.x=+t[0]*o,e.y=+t[1]*o,e.z=+t[2],t[2]in i?(i[t[2]].extend(L.point(e.x,e.y)),i[t[2]].extend(L.point(e.x+o,e.y+o))):i[t[2]]=L.bounds(L.point(e.x,e.y),L.point(e.x+o,e.y+o))}for(var a in i){var s=+a;i[a]=M.pixelToPCRSBounds(i[a],s,e)}return i},_getZoomBounds:function(t,e){if(!t)return null;let i=M.metaContentToObject(t.getElementsByTagName("map-tiles")[0].getAttribute("zoom")),o={},n=t.getElementsByTagName("map-tile");o.nativeZoom=+i.value||0,o.maxNativeZoom=0,o.minNativeZoom=e;for(let e=0;e<n.length;e++){let t=+n[e].getAttribute("zoom");n[e].getAttribute("zoom")||(t=o.nativeZoom),o.minNativeZoom=Math.min(o.minNativeZoom,t),o.maxNativeZoom=Math.max(o.maxNativeZoom,t)}return o.minZoom=o.minNativeZoom-2<=0?0:o.minNativeZoom-2,o.maxZoom=e,i.min&&(o.minZoom=+i.min<o.minNativeZoom-2?o.minNativeZoom-2:+i.min),i.max&&(o.maxZoom=+i.max),o},_groupTiles:function(i){let o={};for(let e=0;e<i.length;e++){let t={};t.row=+i[e].getAttribute("row"),t.col=+i[e].getAttribute("col"),t.zoom=+i[e].getAttribute("zoom")||this.options.nativeZoom,t.src=i[e].getAttribute("src");var n=t.col+":"+t.row+":"+t.zoom;n in o?o[n].push(t):o[n]=[t]}return o}}),o=L.Control.Layers.extend({options:{autoZIndex:!1,sortLayers:!0,sortFunction:function(t,e){return t.options.zIndex<e.options.zIndex?-1:t.options.zIndex>e.options.zIndex?1:0}},initialize:function(t,e){for(var i in L.setOptions(this,e),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,t)this._addLayer(t[i],i,!0)},onAdd:function(){return this._initLayout(),this._map.on("validate",this._validateInput,this),L.DomEvent.on(this.options.mapEl,"layerchange",this._validateInput,this),L.DomEvent.on(this._container,"keydown",this._focusFirstLayer,this._container),this._update(),this._layers.length<1&&!this._map._showControls?this._container.setAttribute("hidden",""):this._map._showControls=!0,this._container},onRemove:function(t){t.off("validate",this._validateInput,this),L.DomEvent.off(this._container,"keydown",this._focusFirstLayer,this._container);for(var e=0;e<this._layers.length;e++)this._layers[e].layer.off("add remove",this._onLayerChange,this),this._layers[e].layer.off("extentload",this._validateInput,this)},addOrUpdateOverlay:function(t,e){for(var i=!1,o=0;o<this._layers.length;o++)if(this._layers[o].layer===t){i=!0,this._layers[o].name=e;break}return i||this.addOverlay(t,e),0<this._layers.length&&(this._container.removeAttribute("hidden"),this._map._showControls=!0),this._map?this._update():this},removeLayer:function(t){L.Control.Layers.prototype.removeLayer.call(this,t),0===this._layers.length&&this._container.setAttribute("hidden","")},_validateInput:function(t){for(let i=0;i<this._layers.length;i++)if(this._layers[i].input.labels[0]){let t=this._layers[i].input.labels[0].getElementsByTagName("span"),e=this._layers[i].input.labels[0].getElementsByTagName("input");e[0].checked=this._layers[i].layer._layerEl.checked,this._layers[i].layer._layerEl.disabled&&this._layers[i].layer._layerEl.checked?(e[0].closest("fieldset").disabled=!0,t[0].style.fontStyle="italic"):(e[0].closest("fieldset").disabled=!1,t[0].style.fontStyle="normal")}},_focusFirstLayer:function(t){var e;"Enter"!==t.key||"leaflet-control-layers leaflet-control leaflet-control-layers-expanded"==this.className||(e=this.children[1].children[2].children[0].children[0].children[0].children[0])&&setTimeout(()=>e.focus(),0)},_withinZoomBounds:function(t,e){return e.min<=t&&t<=e.max},_addItem:function(t){var e=t.layer.getLayerUserControlsHTML();return t.input=e.querySelector("input"),this._layerControlInputs.push(t.input),t.input.layerId=L.stamp(t.layer),L.DomEvent.on(t.input,"click",this._onInputClick,this),t.layer.on("extentload",this._validateInput,this),this._overlaysList.appendChild(e),e},collapse:function(t){return"SELECT"===t.target.tagName||t.relatedTarget&&t.relatedTarget.parentElement&&("mapml-contextmenu mapml-layer-menu"===t.relatedTarget.className||"mapml-contextmenu mapml-layer-menu"===t.relatedTarget.parentElement.className)||this._map&&"block"===this._map.contextMenu._layerMenu.style.display||L.DomUtil.removeClass(this._container,"leaflet-control-layers-expanded"),this}});const H="OSMTILE",d="TILEMATRIX",V="mapmltemplatedtileplaceholder";function n(t,e){return new h(t,e)}function a(t,e){return new _(t,e)}function s(t,e){return new y(t,e)}function r(t,e){return new g(t,e)}function l(t,e){return new f(t,e)}function u(t,e,i,o,n,a){return new x(t,e,i,o,n,a)}function m(t,e,i){return t||e?new b(t,e,i):null}function p(){return new v}function c(t){return new J(t)}var h=L.FeatureGroup.extend({initialize:function(t,e){var i;L.setOptions(this,e),this.options.static&&(this._container=L.DomUtil.create("div","leaflet-layer",this.options.pane),L.DomUtil.addClass(this._container,"leaflet-pane mapml-vector-container"),L.setOptions(this.options.renderer,{pane:this._container})),this._layers={},this.options.query&&(this._mapmlFeatures=t,this.isVisible=!0,i=this._getNativeVariables(t),this.options.nativeZoom=i.zoom,this.options.nativeCS=i.cs),t&&!this.options.query&&(i=this._getNativeVariables(t),!t.querySelector("map-extent")&&t.querySelector("map-feature")&&this.options.static&&(this._features={},this._staticFeature=!0,this.isVisible=!0,this.zoomBounds=this._getZoomBounds(t,i.zoom),this.layerBounds=this._getLayerBounds(t),L.extend(this.options,this.zoomBounds)),this.addData(t,i.cs,i.zoom),this._staticFeature&&(this._resetFeatures(this._clampZoom(this.options._leafletLayer._map.getZoom())),this.options._leafletLayer._map._addZoomLimit(this)))},onAdd:function(t){L.FeatureGroup.prototype.onAdd.call(this,t),this._mapmlFeatures&&t.on("featurepagination",this.showPaginationFeature,this)},onRemove:function(t){this._mapmlFeatures&&(t.off("featurepagination",this.showPaginationFeature,this),delete this._mapmlFeatures,L.DomUtil.remove(this._container)),L.FeatureGroup.prototype.onRemove.call(this,t),this._map.featureIndex.cleanIndex()},getEvents:function(){return this._staticFeature?{moveend:this._handleMoveEnd,zoomend:this._handleZoomEnd}:{moveend:this._removeCSS}},showPaginationFeature:function(e){if(this.options.query&&this._mapmlFeatures.querySelectorAll("map-feature")[e.i]){let t=this._mapmlFeatures.querySelectorAll("map-feature")[e.i];this.clearLayers(),this.addData(t,this.options.nativeCS,this.options.nativeZoom),e.popup._navigationBar.querySelector("p").innerText=e.i+1+"/"+this.options._leafletLayer._totalFeatureCount,e.popup._content.querySelector("iframe").setAttribute("sandbox","allow-same-origin allow-forms"),e.popup._content.querySelector("iframe").srcdoc=t.querySelector("map-properties").innerHTML}},_getNativeVariables:function(t){return{zoom:t.querySelector("map-meta[name=zoom]")&&+M.metaContentToObject(t.querySelector("map-meta[name=zoom]").getAttribute("content")).value||0,cs:t.querySelector("map-meta[name=cs]")&&M.metaContentToObject(t.querySelector("map-meta[name=cs]").getAttribute("content")).content||"GCRS"}},_handleMoveEnd:function(){var t=this._map.getZoom(),e=t<=this.zoomBounds.maxZoom&&t>=this.zoomBounds.minZoom;this.isVisible=e&&this._layers&&this.layerBounds&&this.layerBounds.overlaps(M.pixelToPCRSBounds(this._map.getPixelBounds(),t,this._map.options.projection)),this._removeCSS()},_handleZoomEnd:function(t){var e=this._map.getZoom();e>this.zoomBounds.maxZoom||e<this.zoomBounds.minZoom?this.clearLayers():(e=this._clampZoom(e),this._resetFeatures(e))},_getLayerBounds:function(t){if(!t)return null;let i=d,o=t.querySelector("map-meta[name=projection]")&&M.metaContentToObject(t.querySelector("map-meta[name=projection]").getAttribute("content")).content.toUpperCase()||H;try{var n=t.querySelector("map-meta[name=extent]")&&M.metaContentToObject(t.querySelector("map-meta[name=extent]").getAttribute("content")),a=n.zoom||0;let e=Object.keys(n);for(let t=0;t<e.length;t++)if(!e[t].includes("zoom")){i=M.axisToCS(e[t].split("-")[2]);break}var s=M.csToAxes(i);return M.boundsToPCRSBounds(L.bounds(L.point(+n["top-left-"+s[0]],+n["top-left-"+s[1]]),L.point(+n["bottom-right-"+s[0]],+n["bottom-right-"+s[1]])),a,o,i)}catch(t){return M.boundsToPCRSBounds(M[o].options.crs.tilematrix.bounds(0),0,o,i)}},_resetFeatures:function(e){if(this.clearLayers(),this._map&&this._map.featureIndex.cleanIndex(),this._features&&this._features[e])for(let t=0;t<this._features[e].length;t++)this.addLayer(this._features[e][t])},_clampZoom:function(t){return t>this.zoomBounds.maxZoom||t<this.zoomBounds.minZoom?t:void 0!==this.zoomBounds.minNativeZoom&&t<this.zoomBounds.minNativeZoom?this.zoomBounds.minNativeZoom:void 0!==this.zoomBounds.maxNativeZoom&&this.zoomBounds.maxNativeZoom<t?this.zoomBounds.maxNativeZoom:t},_setZoomTransform:function(t,e){var i=this._map.getZoomScale(this._map.getZoom(),e),t=t.multiplyBy(i).subtract(this._map._getNewPixelOrigin(t,this._map.getZoom())).round();any3d?L.setTransform(this._layers[e],t,i):L.setPosition(this._layers[e],t)},_getZoomBounds:function(t,i){if(!t)return null;let o=100,n=0,a=t.getElementsByTagName("map-feature"),e,s;for(let e=0;e<a.length;e++){let t=+a[e].getAttribute("zoom");a[e].getAttribute("zoom")||(t=i),n=Math.max(n,t),o=Math.min(o,t)}try{s=M.metaContentToObject(t.querySelector("map-meta[name=projection]").getAttribute("content")).content,e=M.metaContentToObject(t.querySelector("map-meta[name=zoom]").getAttribute("content"))}catch(t){return{minZoom:0,maxZoom:M[s||H].options.resolutions.length-1,minNativeZoom:o,maxNativeZoom:n}}return{minZoom:+e.min,maxZoom:+e.max,minNativeZoom:o,maxNativeZoom:n}},addData:function(o,n,a){var t,e,i,s=o.nodeType===Node.DOCUMENT_NODE||"LAYER-"===o.nodeName?o.getElementsByTagName("map-feature"):null;if((o.nodeType===Node.DOCUMENT_NODE?o.querySelector("map-link[rel=stylesheet],map-style"):null)&&(r=o.querySelector("map-base")&&o.querySelector("map-base").hasAttribute("href")?new URL(o.querySelector("map-base").getAttribute("href")).href:o.URL,M.parseStylesheetAsHTML(o,r,this._container)),s){for(t=0,e=s.length;t<e;t++)(i=s[t]).getElementsByTagName("map-geometry").length&&i.getElementsByTagName("map-coordinates").length&&this.addData(i,n,a);return this}var r=this.options;if(!r.filter||r.filter(o)){o.classList.length&&(r.className=o.classList.value);let t=o.getAttribute("zoom")||a,e=o.querySelector("map-featurecaption");e=e?e.innerHTML:"Feature",o.querySelector("map-properties")&&(r.properties=document.createElement("div"),r.properties.classList.add("mapml-popup-content"),r.properties.insertAdjacentHTML("afterbegin",o.querySelector("map-properties").innerHTML));let i=this.geometryToLayer(o,r,n,+t,e);if(i){if(!i.options.color&&o.hasAttribute("class")&&(i.options.className=o.getAttribute("class")),i.defaultOptions=i.options,this.resetStyle(i),r.onEachFeature&&i.bindTooltip(e,{interactive:!0,sticky:!0}),!this._staticFeature)return this.addLayer(i);o=o.getAttribute("zoom")||a;o in this._features?this._features[o].push(i):this._features[o]=[i]}}},resetStyle:function(t){var e=this.options.style;e&&(L.Util.extend(t.options,t.defaultOptions),this._setLayerStyle(t,e))},setStyle:function(e){this.eachLayer(function(t){this._setLayerStyle(t,e)},this)},_setLayerStyle:function(t,e){"function"==typeof e&&(e=e(t.feature)),t.setStyle&&t.setStyle(e)},_removeCSS:function(){var e=this._container.querySelectorAll("link[rel=stylesheet],style");for(let t=0;t<e.length;t++)this._container.removeChild(e[t])},geometryToLayer:function(t,e,i,o,n){let a="MAP-FEATURE"===t.tagName.toUpperCase()?t.getElementsByTagName("map-geometry")[0]:t,s=a.getAttribute("cs")||i,r=[],l=L.SVG.create("g"),u=Object.assign({},e);for(var m of a.querySelectorAll("map-polygon, map-linestring, map-multilinestring, map-point, map-multipoint"))r.push(M.feature(m,Object.assign(u,{nativeCS:s,nativeZoom:o,projection:this.options.projection,featureID:t.id,group:l,wrappers:this._getGeometryParents(m.parentElement),featureLayer:this,_leafletLayer:this.options._leafletLayer})));let p={group:l,featureID:t.id,accessibleTitle:n,onEachFeature:e.onEachFeature,properties:e.properties,_leafletLayer:this.options._leafletLayer},c=a.querySelector("map-multipolygon")||a.querySelector("map-geometrycollection");return c&&(p.wrappers=this._getGeometryParents(c.parentElement)),M.featureGroup(r,p)},_getGeometryParents:function(t,e=[]){return t&&"MAP-GEOMETRY"!==t.tagName.toUpperCase()?"MAP-MULTIPOLYGON"===t.tagName.toUpperCase()||"MAP-GEOMETRYCOLLECTION"===t.tagName.toUpperCase()?this._getGeometryParents(t.parentElement,e):this._getGeometryParents(t.parentElement,e.concat([t])):e}}),_=L.TileLayer.extend({initialize:function(t,e){var i=M.extractInputBounds(t);this.zoomBounds=i.zoomBounds,this.layerBounds=i.bounds,this.isVisible=!0,L.extend(e,this.zoomBounds),e.tms=t.tms,L.setOptions(this,e),this._setUpTileTemplateVars(t),t.tile.subdomains&&L.setOptions(this,L.extend(this.options,{subdomains:t.tile.subdomains})),this._template=t,this._initContainer(),L.TileLayer.prototype.initialize.call(this,t.template,L.extend(e,{pane:this._container}))},onAdd:function(){this._map._addZoomLimit(this),L.TileLayer.prototype.onAdd.call(this,this._map),this._handleMoveEnd()},getEvents:function(){let t=L.TileLayer.prototype.getEvents.call(this,this._map);return this._parentOnMoveEnd=t.moveend,t.moveend=this._handleMoveEnd,t},_initContainer:function(){this._container||(this._container=L.DomUtil.create("div","leaflet-layer",this.options.pane),L.DomUtil.addClass(this._container,"mapml-templated-tile-container"),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity())},_handleMoveEnd:function(t){var e=this._map.getZoom(),i=M.pixelToPCRSBounds(this._map.getPixelBounds(),e,this._map.options.projection);this.isVisible=e<=this.options.maxZoom&&e>=this.options.minZoom&&this.layerBounds.overlaps(i),this.isVisible&&this._parentOnMoveEnd()},createTile:function(e){let i=document.createElement("DIV"),o=this.getTileSize();if(L.DomUtil.addClass(i,"mapml-tile-group"),L.DomUtil.addClass(i,"leaflet-tile"),this._template.linkEl.dispatchEvent(new CustomEvent("tileloadstart",{detail:{x:e.x,y:e.y,zoom:e.z,appendTile:t=>{i.appendChild(t)}}})),this._template.type.startsWith("image/")){let t=L.TileLayer.prototype.createTile.call(this,e,function(){});t.width=o.x,t.height=o.y,i.appendChild(t)}else this._url.includes(V)||this._fetchTile(e,i);return i},_mapmlTileReady:function(t){L.DomUtil.addClass(t,"leaflet-tile-loaded")},getPane:function(){return this.options.pane},_fetchTile:function(e,i){fetch(this.getTileUrl(e),{redirect:"follow"}).then(function(t){return 200<=t.status&&t.status<300?Promise.resolve(t):(console.log("Looks like there was a problem. Status Code: "+t.status),Promise.reject(t))}).then(function(t){return t.text()}).then(t=>{return(new DOMParser).parseFromString(t,"application/xml")}).then(t=>{this._createFeatures(t,e,i),this._mapmlTileReady(i)}).catch(t=>{console.log("Error Creating Tile")})},_createFeatures:function(t,e,i){var o;t.querySelector("map-link[rel=stylesheet],map-style")&&(o=t.querySelector("map-base")&&t.querySelector("map-base").hasAttribute("href")?new URL(t.querySelector("map-base").getAttribute("href")).href:t.URL,M.parseStylesheetAsHTML(t,o,i));let n=L.SVG.create("svg"),a=L.SVG.create("g"),s=this._map.options.crs.options.crs.tile.bounds.max.x,r=e.x*s,l=e.y*s;var u,m=M.mapMlFeatures(t,{projection:this._map.options.projection,static:!1,interactive:!1});for(u in m._layers)for(var p in m._layers[u]._layers){let t=m._layers[u]._layers[p];M.FeatureRenderer.prototype._initPath(t,!1),t._project(this._map,L.point([r,l]),e.z),M.FeatureRenderer.prototype._addPath(t,a,!1),M.FeatureRenderer.prototype._updateFeature(t)}n.setAttribute("width",s.toString()),n.setAttribute("height",s.toString()),n.appendChild(a),i.appendChild(n)},getTileUrl:function(t){if(t.z>=this._template.tilematrix.bounds.length||!this._template.tilematrix.bounds[t.z].contains(t))return"";var e,i={};for(e in i[this._template.tilematrix.col.name]=t.x,i[this._template.tilematrix.row.name]=t.y,i[this._template.zoom.name]=this._getZoomForUrl(),i[this._template.pcrs.easting.left]=this._tileMatrixToPCRSPosition(t,"top-left").x,i[this._template.pcrs.easting.right]=this._tileMatrixToPCRSPosition(t,"top-right").x,i[this._template.pcrs.northing.top]=this._tileMatrixToPCRSPosition(t,"top-left").y,i[this._template.pcrs.northing.bottom]=this._tileMatrixToPCRSPosition(t,"bottom-left").y,i[this._template.tile.server]=this._getSubdomain(t),this._template.tile)["row","col","zoom","left","right","top","bottom"].indexOf(e)<0&&(i[e]=this._template.tile[e]);return this._map&&!this._map.options.crs.infinite&&(t=this._globalTileRange.max.y-t.y,this.options.tms&&(i[this._template.tilematrix.row.name]=t)),i.r=this.options.detectRetina&&L.Browser.retina&&0<this.options.maxZoom?"@2x":"",L.Util.template(this._url,i)},_tileMatrixToPCRSPosition:function(t,e){var i=this._map.options.crs,o=this.getTileSize(),n=t.scaleBy(o),a=n.add(o),o=n.add(Math.floor(o/2)),s=i.transformation.untransform(n,i.scale(t.z)),r=i.transformation.untransform(a,i.scale(t.z)),l=i.transformation.untransform(o,i.scale(t.z)),u=null;switch(e){case"top-left":u=s;break;case"bottom-left":u=new L.Point(s.x,r.y);break;case"center-left":u=new L.Point(s.x,l.y);break;case"top-right":u=new L.Point(r.x,s.y);break;case"bottom-right":u=r;break;case"center-right":u=new L.Point(r.x,l.y);break;case"top-center":u=new L.Point(l.x,s.y);break;case"bottom-center":u=new L.Point(l.x,r.y);break;case"center":u=l}return u},_setUpTileTemplateVars:function(t){t.tile={};for(var e,i,o,n,a,s=t.values,r=this.options.crs.options,l=0;l<t.values.length;l++){var u=s[l].getAttribute("type"),m=s[l].getAttribute("units"),p=s[l].getAttribute("axis"),c=s[l].getAttribute("name"),h=s[l].getAttribute("position"),d="hidden"===u&&s[l].hasAttribute("shard"),_="map-select"===s[l].tagName.toLowerCase(),y=s[l].getAttribute("value"),g=s[l].getAttribute("min"),f=s[l].getAttribute("max");if("location"===u&&"tilematrix"===m)switch(p){case"column":a={name:c,min:r.crs.tilematrix.horizontal.min,max:r.crs.tilematrix.horizontal.max(r.resolutions.length-1)},isNaN(Number.parseFloat(g))||(a.min=Number.parseFloat(g)),isNaN(Number.parseFloat(f))||(a.max=Number.parseFloat(f));break;case"row":n={name:c,min:r.crs.tilematrix.vertical.min,max:r.crs.tilematrix.vertical.max(r.resolutions.length-1)},isNaN(Number.parseFloat(g))||(n.min=Number.parseFloat(g)),isNaN(Number.parseFloat(f))||(n.max=Number.parseFloat(f));break;case"longitude":case"easting":i=i||{min:r.crs.pcrs.horizontal.min,max:r.crs.pcrs.horizontal.max},isNaN(Number.parseFloat(g))||(i.min=Number.parseFloat(g)),isNaN(Number.parseFloat(f))||(i.max=Number.parseFloat(f)),h&&(h.match(/.*?-left/i)?i.left=c:h.match(/.*?-right/i)&&(i.right=c));break;case"latitude":case"northing":o=o||{min:r.crs.pcrs.vertical.min,max:r.crs.pcrs.vertical.max},isNaN(Number.parseFloat(g))||(o.min=Number.parseFloat(g)),isNaN(Number.parseFloat(f))||(o.max=Number.parseFloat(f)),h&&(h.match(/top-.*?/i)?o.top=c:h.match(/bottom-.*?/i)&&(o.bottom=c))}else if(u&&"zoom"===u.toLowerCase())e={name:c,min:0,max:r.resolutions.length,value:r.resolutions.length},!isNaN(Number.parseInt(y,10))&&Number.parseInt(y,10)>=e.min&&Number.parseInt(y,10)<=e.max?e.value=Number.parseInt(y,10):e.value=e.max,!isNaN(Number.parseInt(g,10))&&Number.parseInt(g,10)>=e.min&&Number.parseInt(g,10)<=e.max&&(e.min=Number.parseInt(g,10)),!isNaN(Number.parseInt(f,10))&&Number.parseInt(f,10)>=e.min&&Number.parseInt(f,10)<=e.max&&(e.max=Number.parseInt(f,10)),t.zoom=e;else if(d)t.tile.server=c,t.tile.subdomains=s[l].servers.slice();else if(_){const z=s[l].htmlselect;t.tile[c]=function(){return z.value}}else{const k=s[l];t.tile[c]=function(){return k.getAttribute("value")}}}function x(t,e){return b.transform(t,A(e)).divideBy(v).floor()}var b=this.options.crs.transformation,v=this.options.crs.options.crs.tile.bounds.max.x,A=L.bind(this.options.crs.scale,this.options.crs);i&&o?(t.pcrs={},t.pcrs.bounds=L.bounds([i.min,o.min],[i.max,o.max]),t.pcrs.easting=i,t.pcrs.northing=o):a&&n&&!isNaN(e.value)?(t.pcrs||(t.pcrs={},t.pcrs.easting="",t.pcrs.northing=""),t.pcrs.bounds=M.boundsToPCRSBounds(L.bounds(L.point([a.min,n.min]),L.point([a.max,n.max])),e.value,this.options.crs,M.axisToCS("column")),t.tilematrix={},t.tilematrix.col=a,t.tilematrix.row=n):console.log("Unable to determine bounds for tile template: "+t.template),t.tilematrix||(t.tilematrix={},t.tilematrix.col={},t.tilematrix.row={}),t.tilematrix.bounds=[];for(var C=t.pcrs.bounds,E=t.zoom?t.zoom.min:0,S=t.zoom?t.zoom.max:r.resolutions.length,T=0;T<=S;T++)t.tilematrix.bounds[T]=E<=T?L.bounds(x(C.min,T),x(C.max,T)):L.bounds(L.point([-1,-1]),L.point([-1,-1]))}}),y=L.Layer.extend({initialize:function(t,e){this._templates=t,L.setOptions(this,e),this._container=L.DomUtil.create("div","leaflet-layer",e.pane),L.DomUtil.addClass(this._container,"mapml-templatedlayer-container");for(var i,o=0;o<t.length;o++)"tile"===t[o].rel?this._templates[o].layer=M.templatedTileLayer(t[o],L.Util.extend(e,{errorTileUrl:"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",zIndex:o,pane:this._container})):"image"===t[o].rel?this._templates[o].layer=M.templatedImageLayer(t[o],L.Util.extend(e,{zIndex:o,pane:this._container})):"features"===t[o].rel?this._templates[o].layer=M.templatedFeaturesLayer(t[o],L.Util.extend(e,{zIndex:o,pane:this._container})):"query"===t[o].rel&&(this.hasSetBoundsHandler=!0,this._queries||(this._queries=[]),i=M.extractInputBounds(t[o]),t[o].layerBounds=i.bounds,t[o].zoomBounds=i.zoomBounds,this._queries.push(L.extend(t[o],this._setupQueryVars(t[o]))))},getEvents:function(){return{zoomstart:this._onZoomStart}},redraw:function(){this.closePopup();for(var t=0;t<this._templates.length;t++)"tile"!==this._templates[t].rel&&"image"!==this._templates[t].rel&&"features"!==this._templates[t].rel||this._templates[t].layer.redraw()},_onZoomStart:function(){this.closePopup()},_setupQueryVars:function(t){for(var e={query:{}},i=t.values,o=0;o<t.values.length;o++){var n=i[o].getAttribute("type"),a=i[o].getAttribute("units"),s=i[o].getAttribute("axis"),r=i[o].getAttribute("name"),l=i[o].getAttribute("position"),u=i[o].getAttribute("rel"),m="map-select"===i[o].tagName.toLowerCase();if("width"===n)e.query.width=r;else if("height"===n)e.query.height=r;else if("location"===n)switch(s){case"x":case"y":case"column":case"row":e.query[s]=r;break;case"longitude":case"easting":l?l.match(/.*?-left/i)?"pixel"===u?e.query.pixelleft=r:"tile"===u?e.query.tileleft=r:e.query.mapleft=r:l.match(/.*?-right/i)&&("pixel"===u?e.query.pixelright=r:"tile"===u?e.query.tileright=r:e.query.mapright=r):e.query[s]=r;break;case"latitude":case"northing":l?l.match(/top-.*?/i)?"pixel"===u?e.query.pixeltop=r:"tile"===u?e.query.tiletop=r:e.query.maptop=r:l.match(/bottom-.*?/i)&&("pixel"===u?e.query.pixelbottom=r:"tile"===u?e.query.tilebottom=r:e.query.mapbottom=r):e.query[s]=r;break;case"i":"tile"===a?e.query.tilei=r:e.query.mapi=r;break;case"j":"tile"===a?e.query.tilej=r:e.query.mapj=r}else if("zoom"===n)e.query.zoom=r;else if(m){const p=i[o].htmlselect;e.query[r]=function(){return p.value}}else{const c=i[o];e.query[r]=function(){return c.getAttribute("value")}}}return e.query.title=t.title,e},reset:function(t){if(t&&this._map){var e=this._map&&this._map.hasLayer(this),i=this._templates;delete this._queries,this._map.off("click",null,this),this._templates=t;for(var o=0;o<t.length;o++)"tile"===t[o].rel?this._templates[o].layer=M.templatedTileLayer(t[o],L.Util.extend(this.options,{errorTileUrl:"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",zIndex:o,pane:this._container})):"image"===t[o].rel?this._templates[o].layer=M.templatedImageLayer(t[o],L.Util.extend(this.options,{zIndex:o,pane:this._container})):"features"===t[o].rel?this._templates[o].layer=M.templatedFeaturesLayer(t[o],L.Util.extend(this.options,{zIndex:o,pane:this._container})):"query"===t[o].rel&&(this._queries||(this._queries=[]),this._queries.push(L.extend(t[o],this._setupQueryVars(t[o])))),e&&this.onAdd(this._map);for(o=0;o<i.length;o++)this._map.hasLayer(i[o].layer)&&this._map.removeLayer(i[o].layer)}},onAdd:function(t){for(var e=0;e<this._templates.length;e++)"query"!==this._templates[e].rel&&t.addLayer(this._templates[e].layer)},onRemove:function(t){L.DomUtil.remove(this._container);for(var e=0;e<this._templates.length;e++)"query"!==this._templates[e].rel&&t.removeLayer(this._templates[e].layer)},_previousFeature:function(t){0<=this._count+-1&&(this._count--,this._map.fire("featurepagination",{i:this._count,popup:this}))},_nextFeature:function(t){this._count+1<this._source._totalFeatureCount&&(this._count++,this._map.fire("featurepagination",{i:this._count,popup:this}))}}),g=L.Layer.extend({initialize:function(t,e){var i=M.extractInputBounds(t);this.zoomBounds=i.zoomBounds,this.layerBounds=i.bounds,this.isVisible=!0,this._template=t,this._container=L.DomUtil.create("div","leaflet-layer",e.pane),L.extend(e,this.zoomBounds),L.DomUtil.addClass(this._container,"mapml-features-container"),L.setOptions(this,L.extend(e,this._setUpFeaturesTemplateVars(t)))},getEvents:function(){return{moveend:this._onMoveEnd}},onAdd:function(){this._map._addZoomLimit(this);var n,t=new Headers({Accept:"text/mapml"}),a=new DOMParser,e=this.options.opacity||1,i=this._container,o=this._map;this._features||(this._features=M.mapMlFeatures(null,{renderer:M.featureRenderer(),pane:i,opacity:e,projection:o.options.projection,static:!0,onEachFeature:function(t,e){var i=document.createElement("div");i.classList.add("mapml-popup-content"),i.insertAdjacentHTML("afterbegin",t.innerHTML),e.bindPopup(i,{autoClose:!1,minWidth:108})}}));var s=this._features,r=function(i,o){return fetch(i,{redirect:"follow",headers:t}).then(function(t){return t.text()}).then(function(t){n=a.parseFromString(t,"application/xml");var e=new URL(n.querySelector("map-base")?n.querySelector("map-base").getAttribute("href"):i).href;i=(i=n.querySelector("map-link[rel=next]")?n.querySelector("map-link[rel=next]").getAttribute("href"):null)?new URL(i,e).href:null;t=n.querySelector("map-meta[name=zoom]")&&+M.metaContentToObject(n.querySelector("map-meta[name=zoom]").getAttribute("content")).value||0,e=n.querySelector("map-meta[name=cs]")&&M.metaContentToObject(n.querySelector("map-meta[name=cs]").getAttribute("content")).content||"GCRS";if(s.addData(n,e,t),i&&--o)return r(i,o)})};r(this._getfeaturesUrl(),10).then(function(){o.addLayer(s),o.fire("moveend")}).catch(function(t){console.log(t)})},redraw:function(){this._onMoveEnd()},_onMoveEnd:function(){var n,t,a,s,e,i,r,o=this._map.getZoom(),l=M.pixelToPCRSBounds(this._map.getPixelBounds(),o,this._map.options.projection);this.isVisible=o<=this.zoomBounds.maxZoom&&o>=this.zoomBounds.minZoom&&this.layerBounds.overlaps(l),this._features.clearLayers(),this.isVisible&&(t=new Headers({Accept:"text/mapml;q=0.9,application/geo+json;q=0.8"}),a=new DOMParser,s=this._features,e=this._map,(r=function(i,o){return fetch(i,{redirect:"follow",headers:t}).then(function(t){return t.text()}).then(function(t){n=a.parseFromString(t,"application/xml");var e=new URL(n.querySelector("map-base")?n.querySelector("map-base").getAttribute("href"):i).href;i=(i=n.querySelector("map-link[rel=next]")?n.querySelector("map-link[rel=next]").getAttribute("href"):null)?new URL(i,e).href:null;t=n.querySelector("map-meta[name=zoom]")&&+M.metaContentToObject(n.querySelector("map-meta[name=zoom]").getAttribute("content")).value||0,e=n.querySelector("map-meta[name=cs]")&&M.metaContentToObject(n.querySelector("map-meta[name=cs]").getAttribute("content")).content||"GCRS";if(s.addData(n,e,t),i&&--o)return r(i,o)})})((i=this)._getfeaturesUrl(),10).then(function(){e.addLayer(s),M.TemplatedFeaturesLayer.prototype._updateTabIndex(i)}).catch(function(t){console.log(t)}))},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},_updateTabIndex:function(t){var i,o=t||this;for(i in o._features._layers){let e=o._features._layers[i];if(e._path&&("M0 0"!==e._path.getAttribute("d")?e._path.setAttribute("tabindex",0):e._path.removeAttribute("tabindex"),0===e._path.childElementCount)){let t=document.createElement("title");t.innerText="Feature",e._path.appendChild(t)}}},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},onRemove:function(){this._map.removeLayer(this._features)},_getfeaturesUrl:function(){var t,e={};for(t in this.options.feature.zoom&&(e[this.options.feature.zoom]=this._map.getZoom()),this.options.feature.width&&(e[this.options.feature.width]=this._map.getSize().x),this.options.feature.height&&(e[this.options.feature.height]=this._map.getSize().y),this.options.feature.bottom&&(e[this.options.feature.bottom]=this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).y),this.options.feature.left&&(e[this.options.feature.left]=this._TCRSToPCRS(this._map.getPixelBounds().min,this._map.getZoom()).x),this.options.feature.top&&(e[this.options.feature.top]=this._TCRSToPCRS(this._map.getPixelBounds().min,this._map.getZoom()).y),this.options.feature.right&&(e[this.options.feature.right]=this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).x),this.options.feature)["width","height","left","right","top","bottom","zoom"].indexOf(t)<0&&(e[t]=this.options.feature[t]);return L.Util.template(this._template.template,e)},_TCRSToPCRS:function(t,e){var i=this._map.options.crs;return i.transformation.untransform(t,i.scale(e))},_setUpFeaturesTemplateVars:function(t){var e={feature:{}},i=t.values;e.feature.hidden=[];for(var o=0;o<i.length;o++){var n=i[o].getAttribute("type"),a=i[o].getAttribute("units"),s=i[o].getAttribute("axis"),r=i[o].getAttribute("name"),l=i[o].getAttribute("position"),u=(i[o].getAttribute("value"),"map-select"===i[o].tagName.toLowerCase());if("width"===n)e.feature.width=r;else if("height"===n)e.feature.height=r;else if("zoom"===n)e.feature.zoom=r;else if("location"!==n||"pcrs"!==a&&"gcrs"!==a)if(u){const m=i[o].htmlselect;e.feature[r]=function(){return m.value}}else{const p=i[o];e.feature[r]=function(){return p.getAttribute("value")}}else switch(s){case"x":case"longitude":case"easting":l&&(l.match(/.*?-left/i)?e.feature.left=r:l.match(/.*?-right/i)&&(e.feature.right=r));break;case"y":case"latitude":case"northing":l&&(l.match(/top-.*?/i)?e.feature.top=r:l.match(/bottom-.*?/i)&&(e.feature.bottom=r))}}return e}}),f=L.Layer.extend({initialize:function(t,e){this._template=t,this._container=L.DomUtil.create("div","leaflet-layer",e.pane),L.DomUtil.addClass(this._container,"mapml-image-container");var i=M.extractInputBounds(t);this.zoomBounds=i.zoomBounds,this.layerBounds=i.bounds,this.isVisible=!0,L.extend(e,this.zoomBounds),L.setOptions(this,L.extend(e,this._setUpExtentTemplateVars(t)))},getEvents:function(){return{moveend:this._onMoveEnd}},onAdd:function(){this._map._addZoomLimit(this),this.setZIndex(this.options.zIndex),this._onMoveEnd()},redraw:function(){this._onMoveEnd()},_clearLayer:function(){var e=this._container.querySelectorAll("img");for(let t=0;t<e.length;t++)this._container.removeChild(e[t])},_onMoveEnd:function(){var t,e,i,o=this._map.getZoom(),n=M.pixelToPCRSBounds(this._map.getPixelBounds(),o,this._map.options.projection);this.isVisible=o<=this.zoomBounds.maxZoom&&o>=this.zoomBounds.minZoom&&this.layerBounds.overlaps(n),this.isVisible?(e=(t=this._map).getPixelBounds().min.subtract(t.getPixelOrigin()),o=t.getSize(),n=this.getImageUrl(),i=this._imageOverlay,this._imageOverlay=M.imageOverlay(n,e,o,0,this._container),this._imageOverlay.addTo(t),i&&this._imageOverlay.on("load error",function(){t.removeLayer(i)})):this._clearLayer()},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},onRemove:function(t){this._clearLayer(),t._removeZoomLimit(this),this._container=null},getImageUrl:function(){var t,e={};for(t in e[this.options.extent.width]=this._map.getSize().x,e[this.options.extent.height]=this._map.getSize().y,e[this.options.extent.bottom]=this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).y,e[this.options.extent.left]=this._TCRSToPCRS(this._map.getPixelBounds().min,this._map.getZoom()).x,e[this.options.extent.top]=this._TCRSToPCRS(this._map.getPixelBounds().min,this._map.getZoom()).y,e[this.options.extent.right]=this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).x,this.options.extent)["width","height","left","right","top","bottom"].indexOf(t)<0&&(e[t]=this.options.extent[t]);return L.Util.template(this._template.template,e)},_TCRSToPCRS:function(t,e){var i=this._map.options.crs;return i.transformation.untransform(t,i.scale(e))},_setUpExtentTemplateVars:function(t){for(var e={extent:{}},i=t.values,o=0;o<t.values.length;o++){var n=i[o].getAttribute("type"),a=i[o].getAttribute("units"),s=i[o].getAttribute("axis"),r=i[o].getAttribute("name"),l=i[o].getAttribute("position"),u="map-select"===i[o].tagName.toLowerCase();if("width"===n)e.extent.width=r;else if("height"===n)e.extent.height=r;else if("location"!==n||"pcrs"!==a&&"gcrs"!==a)if(u){const m=i[o].htmlselect;e.extent[r]=function(){return m.value}}else{const p=i[o];e.extent[r]=function(){return p.getAttribute("value")}}else switch(s){case"longitude":case"easting":l&&(l.match(/.*?-left/i)?e.extent.left=r:l.match(/.*?-right/i)&&(e.extent.right=r));break;case"latitude":case"northing":l&&(l.match(/top-.*?/i)?e.extent.top=r:l.match(/bottom-.*?/i)&&(e.extent.bottom=r))}}return e}}),x=L.ImageOverlay.extend({initialize:function(t,e,i,o,n,a){this._container=n,this._url=t,this._location=e,this._size=L.point(i),this._angle=o,L.setOptions(this,a)},getEvents:function(){var t={viewreset:this._reset};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},onAdd:function(){this.on({load:this._onImageLoad}),this._image||this._initImage(),this.options.interactive&&(L.DomUtil.addClass(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this._container.appendChild(this._image),this._reset()},onRemove:function(){L.DomUtil.remove(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},_onImageLoad:function(){this._image&&(this._image.loaded=+new Date,this._updateOpacity())},_animateZoom:function(t){var e=this._map.getZoomScale(t.zoom),t=this._map.getPixelOrigin().add(this._location).multiplyBy(e).subtract(this._map._getNewPixelOrigin(t.center,t.zoom)).round();L.Browser.any3d?L.DomUtil.setTransform(this._image,t,e):L.DomUtil.setPosition(this._image,t)},_reset:function(){var t=this._image,e=this._location,i=this._size;L.DomUtil.setPosition(t,e),t.style.width=i.x+"px",t.style.height=i.y+"px"},_updateOpacity:function(){var t,e,i;this._map&&(i=+new Date,t=!1,e=this._image,i=Math.min(1,(i-e.loaded)/200),L.DomUtil.setOpacity(e,i),(t=i<1?!0:t)&&(L.Util.cancelAnimFrame(this._fadeFrame),this._fadeFrame=L.Util.requestAnimFrame(this._updateOpacity,this)),L.DomUtil.addClass(e,"leaflet-image-loaded"))}}),b=L.Layer.extend({options:{maxNext:10,zIndex:0,maxZoom:25},initialize:function(t,e,i){var o;t&&(this._href=t),e&&(o=!!(this._layerEl=e).querySelector("map-feature,map-tile,map-extent"),!t&&o&&(this._content=e)),L.setOptions(this,i),this._container=L.DomUtil.create("div","leaflet-layer"),L.DomUtil.addClass(this._container,"mapml-layer"),this._imageContainer=L.DomUtil.create("div","leaflet-layer",this._container),L.DomUtil.addClass(this._imageContainer,"mapml-image-container"),this._mapmlTileContainer=L.DomUtil.create("div","mapml-tile-container",this._container),!o&&e&&e.hasAttribute("label")&&(this._title=e.getAttribute("label")),this._initCount=0,this._initExtent(o?e:null),this.on("attached",this._validateExtent,this),this.validProjection=!0},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},_changeOpacity:function(t){t&&t.target&&0<=t.target.value&&t.target.value<=1&&this.changeOpacity(t.target.value)},changeOpacity:function(t){this._container.style.opacity=t,this.opacityEl&&(this.opacityEl.value=t)},onAdd:function(t){!this._extent||this._validProjection(t)?(this._map=t,this._content?(this._mapmlvectors||(this._mapmlvectors=M.mapMlFeatures(this._content,{renderer:M.featureRenderer(),pane:this._container,opacity:this.options.opacity,projection:t.options.projection,_leafletLayer:this,static:!0,onEachFeature:function(t,e){var i;t&&((i=document.createElement("div")).classList.add("mapml-popup-content"),i.insertAdjacentHTML("afterbegin",t.innerHTML),e.bindPopup(i,{autoClose:!1,minWidth:165}))}})),t.addLayer(this._mapmlvectors)):this.once("extentload",function(){this._validProjection(t)?(this._mapmlvectors||(this._mapmlvectors=M.mapMlFeatures(this._content,{renderer:M.featureRenderer(),pane:this._container,opacity:this.options.opacity,projection:t.options.projection,_leafletLayer:this,static:!0,onEachFeature:function(t,e){var i;t&&((i=document.createElement("div")).classList.add("mapml-popup-content"),i.insertAdjacentHTML("afterbegin",t.innerHTML),e.bindPopup(i,{autoClose:!1,minWidth:165}))}}).addTo(t)),this._setLayerElExtent()):this.validProjection=!1},this),this._imageLayer||(this._imageLayer=L.layerGroup()),t.addLayer(this._imageLayer),(!this._staticTileLayer||null===this._staticTileLayer._container)&&0<this._mapmlTileContainer.getElementsByTagName("map-tiles").length&&(this._staticTileLayer=M.mapMLStaticTileLayer({pane:this._container,_leafletLayer:this,className:"mapml-static-tile-layer",tileContainer:this._mapmlTileContainer,maxZoomBound:t.options.crs.options.resolutions.length-1,tileSize:t.options.crs.options.crs.tile.bounds.max.x}),t.addLayer(this._staticTileLayer)),this._extent?this._templateVars&&(this._templatedLayer=M.templatedLayer(this._templateVars,{pane:this._container,_leafletLayer:this,crs:this.crs}).addTo(t)):this.once("extentload",function(){this._validProjection(t)?this._templateVars&&(this._templatedLayer=M.templatedLayer(this._templateVars,{pane:this._container,_leafletLayer:this,crs:this.crs}).addTo(t),this._setLayerElExtent()):this.validProjection=!1},this),this._setLayerElExtent(),this.setZIndex(this.options.zIndex),this.getPane().appendChild(this._container),setTimeout(()=>{t.fire("checkdisabled")},0),t.on("popupopen",this._attachSkipButtons,this)):this.validProjection=!1},_validProjection:function(t){let e=!1;if(this._templateVars)for(var i of this._templateVars)i.projectionMatch||i.projection===t.options.projection||(e=!0);return!(e||this.getProjection()!==t.options.projection.toUpperCase())},_setLayerElExtent:function(){let i,o;["_staticTileLayer","_imageLayer","_mapmlvectors","_templatedLayer"].forEach(e=>{if(this[e])if("_templatedLayer"===e)for(let t=0;t<this[e]._templates.length;t++)"query"!==this[e]._templates[t].rel&&this[e]._templates[t].layer.layerBounds&&(i?(i.extend(this[e]._templates[t].layer.layerBounds.min),i.extend(this[e]._templates[t].layer.layerBounds.max)):(i=this[e]._templates[t].layer.layerBounds,o=this[e]._templates[t].layer.zoomBounds));else this[e].layerBounds&&(i?(i.extend(this[e].layerBounds.min),i.extend(this[e].layerBounds.max)):(i=this[e].layerBounds,o=this[e].zoomBounds))}),i&&(this._layerEl.extent=Object.assign(M.convertAndFormatPCRS(i,this._map),{zoom:o}))},addTo:function(t){return t.addLayer(this),this},getEvents:function(){return{zoomanim:this._onZoomAnim}},redraw:function(){this._templatedLayer&&this._templatedLayer.redraw()},_onZoomAnim:function(t){var e=t.zoom,i=this._extent?this._extent.querySelector("map-input[type=zoom]"):null,t=i&&i.hasAttribute("min")?parseInt(i.getAttribute("min")):this._map.getMinZoom(),i=i&&i.hasAttribute("max")?parseInt(i.getAttribute("max")):this._map.getMaxZoom();e<t&&this._extent.zoomout||i<e&&this._extent.zoomin;t<=e&&e<=i||(this._extent.zoomin&&i<e?(this._href=this._extent.zoomin,this._layerEl.src=this._extent.zoomin,this.href=this._extent.zoomin,this._layerEl.src=this._extent.zoomin):this._extent.zoomout&&e<t&&(this._href=this._extent.zoomout,this.href=this._extent.zoomout,this._layerEl.src=this._extent.zoomout)),this._templatedLayer},onRemove:function(t){L.DomUtil.remove(this._container),this._staticTileLayer&&t.removeLayer(this._staticTileLayer),this._mapmlvectors&&t.removeLayer(this._mapmlvectors),this._imageLayer&&t.removeLayer(this._imageLayer),this._templatedLayer&&t.removeLayer(this._templatedLayer),t.fire("checkdisabled"),t.off("popupopen",this._attachSkipButtons)},getZoomBounds:function(){var t=this._extent,e=t?t.querySelector("[type=zoom]"):void 0,i=e&&e.hasAttribute("min")?e.getAttribute("min"):this._map.getMinZoom(),t=e&&e.hasAttribute("max")?e.getAttribute("max"):this._map.getMaxZoom(),e={};return e.min=Math.min(i,t),e.max=Math.max(i,t),e},_transformDeprectatedInput:function(t){var e=t.getAttribute("type").toLowerCase();if("xmin"===e||"ymin"===e||"xmax"===e||"ymax"===e)switch(t.setAttribute("type","location"),t.setAttribute("units","tcrs"),e){case"xmin":t.setAttribute("axis","x"),t.setAttribute("position","top-left");break;case"ymin":t.setAttribute("axis","y"),t.setAttribute("position","top-left");break;case"xmax":t.setAttribute("axis","x"),t.setAttribute("position","bottom-right");break;case"ymax":t.setAttribute("axis","y"),t.setAttribute("position","bottom-right")}},getLayerExtentBounds:function(t){if(this._extent){var e,i=t.getZoom(),o=t.options.projection,n=o!==this._extent.getAttribute("units"),a=this._extent.querySelector("[type=xmin]").getAttribute("min"),s=this._extent.querySelector("[type=xmax]").getAttribute("min"),r=Math.min(a,s);if(a=this._extent.querySelector("[type=xmin]").getAttribute("max"),s=this._extent.querySelector("[type=xmax]").getAttribute("max"),e=Math.max(a,s),a=this._extent.querySelector("[type=ymin]").getAttribute("min"),s=this._extent.querySelector("[type=ymax]").getAttribute("min"),t=Math.min(a,s),a=this._extent.querySelector("[type=ymin]").getAttribute("max"),s=this._extent.querySelector("[type=ymax]").getAttribute("max"),s=Math.max(a,s),n){var l,u=[(l=M[o]).latLngToPoint(L.latLng([t,r]),i),l.latLngToPoint(L.latLng([s,e]),i),l.latLngToPoint(L.latLng([t,r]),i),l.latLngToPoint(L.latLng([t,e]),i)];return L.bounds(u)}return(u=parseInt(this._extent.querySelector("[type=zoom]").getAttribute("value")))!==i?(l=M[o],L.bounds(l.latLngToPoint(l.pointToLatLng(L.point(r,t),u),i),l.latLngToPoint(l.pointToLatLng(L.point(e,s),u),i))):L.bounds(L.point(r,t),L.point(e,s))}},getAttribution:function(){return this.options.attribution},getLayerUserControlsHTML:function(){var i=L.DomUtil.create("fieldset","mapml-layer-item"),t=L.DomUtil.create("input"),e=L.DomUtil.create("span","mapml-layer-item-name"),o=L.DomUtil.create("span"),n=L.DomUtil.create("div","mapml-layer-item-properties",i),a=L.DomUtil.create("div","mapml-layer-item-settings",i),s=L.DomUtil.create("label","mapml-layer-item-toggle",n),r=L.DomUtil.create("div","mapml-layer-item-controls",n),l=L.DomUtil.create("details","mapml-layer-item-opacity mapml-control-layers",a),u=L.DomUtil.create("input"),m=L.DomUtil.create("summary"),p=L.SVG.create("svg"),c=L.SVG.create("path"),n=L.SVG.create("path"),h=this._layerEl.parentNode;this.opacityEl=u,p.setAttribute("viewBox","0 0 24 24"),p.setAttribute("height","22"),p.setAttribute("width","22"),c.setAttribute("d","M0 0h24v24H0z"),c.setAttribute("fill","none"),n.setAttribute("d","M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"),p.appendChild(c),p.appendChild(n),a.hidden=!0,o.setAttribute("aria-hidden",!0);let d=L.DomUtil.create("button","mapml-layer-item-remove-control",r);d.type="button",d.title="Remove Layer",d.innerHTML="<span aria-hidden='true'>&#10005;</span>",d.classList.add("mapml-button"),L.DomEvent.on(d,"click",L.DomEvent.stop),L.DomEvent.on(d,"click",t=>{let e=0,i,o;if(o=("MAPML-VIEWER"===h.tagName?h:h.querySelector(".mapml-web-map")).shadowRoot,t.target.closest("fieldset").nextElementSibling&&!t.target.closest("fieldset").nextElementSibling.disbaled)for(i=t.target.closest("fieldset").previousElementSibling;i;)e+=2,i=i.previousElementSibling;else i="link";h.removeChild(t.target.closest("fieldset").querySelector("span").layer._layerEl),i=i?o.querySelector(".leaflet-control-attribution").firstElementChild:i=o.querySelectorAll("input")[e],i.focus()},this);let _=L.DomUtil.create("button","mapml-layer-item-settings-control",r);if(_.type="button",_.title="Layer Settings",_.setAttribute("aria-expanded",!1),_.classList.add("mapml-button"),L.DomEvent.on(_,"click",t=>{1==a.hidden?(_.setAttribute("aria-expanded",!0),a.hidden=!1):(_.setAttribute("aria-expanded",!1),a.hidden=!0)},this),t.defaultChecked=!!this._map,t.type="checkbox",(e.layer=this)._legendUrl?((r=document.createElement("a")).text=" "+this._title,r.href=this._legendUrl,r.target="_blank",r.draggable=!1,e.appendChild(r)):e.innerHTML=this._title,e.id="mapml-layer-item-name-{"+L.stamp(e)+"}",m.innerText="Opacity",m.id="mapml-layer-item-opacity-"+L.stamp(m),l.appendChild(m),l.appendChild(u),u.setAttribute("type","range"),u.setAttribute("min","0"),u.setAttribute("max","1.0"),u.setAttribute("value",this._container.style.opacity||"1.0"),u.setAttribute("step","0.1"),u.setAttribute("aria-labelledby",m.id),u.value=this._container.style.opacity||"1.0",i.setAttribute("aria-grabbed","false"),i.setAttribute("aria-labelledby",e.id),i.onmousedown=e=>{if("input"!==e.target.tagName.toLowerCase()&&"select"!==e.target.tagName.toLowerCase()){e.preventDefault();let r=i,l=i.parentNode,t=!1,u=e.clientY;document.body.onmousemove=a=>{a.preventDefault();var s=a.clientY-u;if(t=5<Math.abs(s)||t,!(l&&!t||l&&l.childElementCount<=1||l.getBoundingClientRect().top>r.getBoundingClientRect().bottom||l.getBoundingClientRect().bottom<r.getBoundingClientRect().top)){l.classList.add("mapml-draggable"),r.style.transform="translateY("+s+"px)",r.style.pointerEvents="none";let t=a.clientX,e=a.clientY,i=("MAPML-VIEWER"===h.tagName?h:h.querySelector(".mapml-web-map")).shadowRoot,o=i.elementFromPoint(t,e),n=o&&o.closest("fieldset")?o.closest("fieldset"):r;n=Math.abs(s)<=n.offsetHeight?r:n,r.setAttribute("aria-grabbed","true"),r.setAttribute("aria-dropeffect","move"),n&&l===n.parentNode&&(n=n!==r.nextSibling?n:n.nextSibling,r!==n&&(u=a.clientY,r.style.transform=null),l.insertBefore(r,n))}},document.body.onmouseup=()=>{r.setAttribute("aria-grabbed","false"),r.removeAttribute("aria-dropeffect"),r.style.pointerEvents=null,r.style.transform=null;let t=l.children,e=1;for(var i of t){let t=i.querySelector("span").layer._layerEl;t.setAttribute("data-moving",""),h.insertAdjacentElement("beforeend",t),t.removeAttribute("data-moving"),t._layer.setZIndex(e),e++}l.classList.remove("mapml-draggable"),document.body.onmousemove=document.body.onmouseup=null}}},L.DomEvent.on(u,"change",this._changeOpacity,this),s.appendChild(t),s.appendChild(e),_.appendChild(o),o.appendChild(p),this._styles&&a.appendChild(this._styles),this._userInputs){var y=document.createDocumentFragment(),g=this._templateVars;if(g)for(var f=0;f<g.length;f++)for(var x=g[f],b=0;b<x.values.length;b++){var v,A,M=x.values[b],C="#"+M.getAttribute("id");"map-select"!==M.tagName.toLowerCase()||y.querySelector(C)||(v=L.DomUtil.create("details","mapml-layer-item-time mapml-control-layers",y),A=L.DomUtil.create("summary"),(C=L.DomUtil.create("label")).innerText=M.getAttribute("name"),C.setAttribute("for",M.getAttribute("id")),A.appendChild(C),v.appendChild(A),v.appendChild(M.htmlselect))}a.appendChild(y)}return i},_initExtent:function(t){var G,e,i,o;function n(t){var e=this.responseXML||t;if(e.querySelector&&e.querySelector("map-feature")&&(G._content=e),!this.responseXML&&this.responseText&&(e=(new DOMParser).parseFromString(this.responseText,"text/xml")),this.readyState===this.DONE&&e.querySelector&&!e.querySelector("parsererror")){var i,o=e.querySelector("map-extent")||e.querySelector("map-meta[name=projection]");"map-extent"===o.tagName.toLowerCase()&&o.hasAttribute("units")?i=o.getAttribute("units"):"map-meta"===o.tagName.toLowerCase()&&o.hasAttribute("content")&&(i=M.metaContentToObject(o.getAttribute("content")).content);var n=i&&i===G.options.mapprojection,t=e.querySelector("map-meta[name=extent]"),a=!n&&e.querySelector("map-head map-link[rel=alternate][projection="+G.options.mapprojection+"]"),s=new URL(e.querySelector("map-base")?e.querySelector("map-base").getAttribute("href"):e.baseURI||this.responseURL,this.responseURL).href;if(o){if(!n&&a&&a.hasAttribute("href"))return void G.fire("changeprojection",{href:new URL(a.getAttribute("href"),s).href},!1);if(!n&&G._map&&1===G._map.options.mapEl.querySelectorAll("layer-").length)return void(G._map.options.mapEl.projection=i);if(o.querySelector("map-link[rel=tile],map-link[rel=image],map-link[rel=features],map-link[rel=query]")&&o.hasAttribute("units")){G._templateVars=[];var r=o.querySelectorAll("map-link[rel=tile],map-link[rel=image],map-link[rel=features],map-link[rel=query]"),l=new RegExp("(?:{)(.*?)(?:})","g"),u=o.querySelector('map-input[type="zoom" i]'),m=!1,p={zoom:0};if(t){var c=M.metaContentToObject(t.getAttribute("content"));p.zoom=c.zoom||p.zoom;let e=Object.keys(c);for(let t=0;t<e.length;t++)if(!e[t].includes("zoom")){p.cs=M.axisToCS(e[t].split("-")[2]);break}var h=M.csToAxes(p.cs);p.bounds=M.boundsToPCRSBounds(L.bounds(L.point(+c["top-left-"+h[0]],+c["top-left-"+h[1]]),L.point(+c["bottom-right-"+h[0]],+c["bottom-right-"+h[1]])),p.zoom,i,p.cs)}else p.bounds=M[i].options.crs.pcrs.bounds,p.cs="PCRS";for(var d=0;d<r.length;d++){var _=r[d];if(!(g=_.getAttribute("tref"))){var y,g=V;for(y of e.querySelectorAll("map-input"))g+=`{${y.getAttribute("name")}}`}for(var f=_.hasAttribute("title")?_.getAttribute("title"):"Query this layer",x=g.match(l),b=_.hasAttribute("rel")&&"tile"!==_.getAttribute("rel").toLowerCase()?_.getAttribute("rel").toLowerCase():"tile",v=_.hasAttribute("type")?_.getAttribute("type").toLowerCase():"image/*",A=[],C=_&&_.hasAttribute("tms"),E=e.querySelector("map-meta[name=zoom]")?M.metaContentToObject(e.querySelector("map-meta[name=zoom]").getAttribute("content")):void 0;null!==(S=l.exec(g));){var S,T=S[1],z=o.querySelector("map-input[name="+T+"],map-select[name="+T+"]");if(!z){console.log("input with name="+T+" not found for template variable of same name");break}if(z.hasAttribute("type")&&"location"===z.getAttribute("type")&&!z.hasAttribute("min")&&z.hasAttribute("axis")&&!["i","j"].includes(z.getAttribute("axis").toLowerCase())&&(u.setAttribute("value",p.zoom),S=z.getAttribute("axis"),T=M.convertPCRSBounds(p.bounds,p.zoom,i,M.axisToCS(S)),z.setAttribute("min",T.min[M.axisToXY(S)]),z.setAttribute("max",T.max[M.axisToXY(S)])),A.push(z),m=m||z.hasAttribute("type")&&"zoom"===z.getAttribute("type").toLowerCase(),z.hasAttribute("shard")){var k=z.getAttribute("list");z.servers=[];var I=o.querySelectorAll("map-datalist#"+k+" > map-option");0===I.length&&z.hasAttribute("value")&&(I=z.getAttribute("value").split(""));for(var P=0;P<I.length;P++)I[P].getAttribute?z.servers.push(I[P].getAttribute("value")):z.servers.push(I[P])}else"map-select"===z.tagName.toLowerCase()&&((k=document.createElement("div")).insertAdjacentHTML("afterbegin",z.outerHTML),z.htmlselect=k.querySelector("map-select"),z.htmlselect=function(e){var i=document.createElement("select"),o=e.getAttributeNames();for(let t=0;t<o.length;t++)i.setAttribute(o[t],e.getAttribute(o[t]));var n=e.children;for(let e=0;e<n.length;e++){var a=document.createElement("option"),s=n[e].getAttributeNames();for(let t=0;t<s.length;t++)a.setAttribute(s[t],n[e].getAttribute(s[t]));a.innerHTML=n[e].innerHTML,i.appendChild(a)}return i}(z.htmlselect),L.DomEvent.on(z.htmlselect,"change",G.redraw,G),G._userInputs||(G._userInputs=[]),G._userInputs.push(z.htmlselect))}(g&&x.length===A.length||g===V)&&("query"===b&&(G.queryable=!0),!m&&u&&A.push(u),G._templateVars.push({template:decodeURI(new URL(g,s)),linkEl:_,title:f,rel:b,type:v,values:A,zoomBounds:E,extentPCRSFallback:{bounds:p.bounds},projectionMatch:n||a,projection:o.getAttribute("units")||H,tms:C}))}}}else o=G._synthesizeExtent(e),e.querySelector("map-feature,map-tile")&&(G._content=e);G._parseLicenseAndLegend(e,G),G._extent=o;c=e.querySelector("map-link[rel=zoomin]"),h=e.querySelector("map-link[rel=zoomout]");if(delete G._extent.zoomin,delete G._extent.zoomout,c&&(G._extent.zoomin=new URL(c.getAttribute("href"),s).href),h&&(G._extent.zoomout=new URL(h.getAttribute("href"),s).href),G._templatedLayer&&G._templatedLayer.reset(G._templateVars),e.querySelector("map-tile")){var w=document.createElement("map-tiles"),B=e.querySelector("map-meta[name=zoom][content]")||e.querySelector("map-input[type=zoom][value]");w.setAttribute("zoom",B&&B.getAttribute("content")||B&&B.getAttribute("value")||"0");for(var F=e.getElementsByTagName("map-tile"),q=0;q<F.length;q++)w.appendChild(document.importNode(F[q],!0));G._mapmlTileContainer.appendChild(w)}M.parseStylesheetAsHTML(e,s,G._container);var D=e.querySelectorAll('map-link[rel=style],map-link[rel="self style"],map-link[rel="style self"]');if(1<D.length){var N=document.createElement("details"),B=document.createElement("summary");B.innerText="Style",N.appendChild(B);for(var R=function(t){G.fire("changestyle",{src:t.target.getAttribute("data-href")},!1)},O=0;O<D.length;O++){var U=document.createElement("div"),j=U.appendChild(document.createElement("input"));j.setAttribute("type","radio"),j.setAttribute("id","rad-"+L.stamp(j)),j.setAttribute("name","styles-"+G._title),j.setAttribute("value",D[O].getAttribute("title")),j.setAttribute("data-href",new URL(D[O].getAttribute("href"),s).href);var Z=U.appendChild(document.createElement("label"));Z.setAttribute("for","rad-"+L.stamp(j)),Z.innerText=D[O].getAttribute("title"),"style self"!==D[O].getAttribute("rel")&&"self style"!==D[O].getAttribute("rel")||(j.checked=!0),N.appendChild(U),L.DomUtil.addClass(N,"mapml-layer-item-style mapml-control-layers"),L.DomEvent.on(j,"click",R,G)}G._styles=N}e.querySelector("map-title")?G._title=e.querySelector("map-title").textContent.trim():e instanceof Element&&e.hasAttribute("label")&&(G._title=e.getAttribute("label").trim()),G._map&&(G._validateExtent(),G._map.hasLayer(G)&&G._map.attributionControl.addAttribution(G.getAttribution()))}else G.error=!0;G.fire("extentload",G,!1),G._layerEl.dispatchEvent(new CustomEvent("extentload",{detail:G}))}(this._href||t)&&((G=this)._href?(e=new XMLHttpRequest,i=this._href,o=n,e.onreadystatechange=function(){this.readyState===this.DONE&&(400!==this.status&&404!==this.status&&500!==this.status&&406!==this.status||(G.error=!0,G.fire("extentload",G,!0),e.abort()))},e.onload=o,e.onerror=function(){G.error=!0,G.fire("extentload",G,!0)},e.open("GET",i),e.setRequestHeader("Accept",M.mime),e.overrideMimeType("text/xml"),e.send()):t&&n.call(this,t))},_createExtent:function(){var t=document.createElement("map-extent"),e=document.createElement("map-input"),i=document.createElement("map-input"),o=document.createElement("map-input"),n=document.createElement("map-input"),a=document.createElement("map-input"),s=document.createElement("map-input");return a.setAttribute("type","zoom"),a.setAttribute("min","0"),a.setAttribute("max","0"),e.setAttribute("type","xmin"),e.setAttribute("min",""),e.setAttribute("max",""),i.setAttribute("type","ymin"),i.setAttribute("min",""),i.setAttribute("max",""),o.setAttribute("type","xmax"),o.setAttribute("min",""),o.setAttribute("max",""),n.setAttribute("type","ymax"),n.setAttribute("min",""),n.setAttribute("max",""),s.setAttribute("type","projection"),s.setAttribute("value","WGS84"),t.appendChild(e),t.appendChild(i),t.appendChild(o),t.appendChild(n),t.appendChild(a),t.appendChild(s),t},_validateExtent:function(){var t,e,i,o,n,a,s=this._extent;s&&s.querySelector&&this._map&&(s.querySelector('[type=xmin][min=""], [type=xmin][max=""], [type=xmax][min=""], [type=xmax][max=""], [type=ymin][min=""], [type=ymin][max=""]')&&(t=s.querySelector("[type=xmin]"),e=s.querySelector("[type=ymin]"),i=s.querySelector("[type=xmax]"),o=s.querySelector("[type=ymax]"),(n=s.querySelector("[type=projection][value]"))?(n=n.getAttribute("value"))&&"WGS84"===n?(a=this._map.getBounds(),t.setAttribute("min",a.getWest()),t.setAttribute("max",a.getEast()),e.setAttribute("min",a.getSouth()),e.setAttribute("max",a.getNorth()),i.setAttribute("min",a.getWest()),i.setAttribute("max",a.getEast()),o.setAttribute("min",a.getSouth()),o.setAttribute("max",a.getNorth())):n&&(a=this._map.getPixelBounds(),t.setAttribute("min",a.getBottomLeft().x),t.setAttribute("max",a.getTopRight().x),e.setAttribute("min",a.getTopRight().y),e.setAttribute("max",a.getBottomLeft().y),i.setAttribute("min",a.getBottomLeft().x),i.setAttribute("max",a.getTopRight().x),o.setAttribute("min",a.getTopRight().y),o.setAttribute("max",a.getBottomLeft().y)):this.error=!0),s.querySelector('[type=zoom][min=""], [type=zoom][max=""]')&&((a=s.querySelector("[type=zoom]")).setAttribute("min",this._map.getMinZoom()),a.setAttribute("max",this._map.getMaxZoom())),(s=s.hasAttribute("units")?s.getAttribute("units"):null)&&M[s]?this.crs=M[s]:this.crs=M.OSMTILE)},_getMapMLExtent:function(t,e,i){var o=this._createExtent(),n=o.querySelector("map-input[type=zoom]"),a=o.querySelector("map-input[type=xmin]"),s=o.querySelector("map-input[type=ymin]"),r=o.querySelector("map-input[type=xmax]"),l=o.querySelector("map-input[type=ymax]"),u=o.querySelector("map-input[type=projection]"),m=void 0!==e[0]&&void 0!==e[1]?Math.min(e[0],e[1]):"",p=void 0!==e[0]&&void 0!==e[1]?Math.max(e[0],e[1]):"",c=t?t._southWest?t.getWest():t.getBottomLeft().x:"",h=t?t._southWest?t.getSouth():t.getTopRight().y:"",d=t?t._southWest?t.getEast():t.getTopRight().x:"",e=t?t._southWest?t.getNorth():t.getBottomLeft().y:"";return n.setAttribute("min","number"==typeof m&&isNaN(m)?"":m),n.setAttribute("max","number"==typeof p&&isNaN(p)?"":p),a.setAttribute("min",c),a.setAttribute("max",d),s.setAttribute("min",h),s.setAttribute("max",e),r.setAttribute("min",c),r.setAttribute("max",d),l.setAttribute("min",h),l.setAttribute("max",e),u.setAttribute("value",t&&t._southWest&&!i?"WGS84":i),o},_synthesizeExtent:function(t){var e,i,o,n,a,s,r,l,u,m,p,c,h=t.querySelectorAll("map-meta[name=zoom]")[0],d=t.querySelector("map-meta[name=extent]"),t=t.querySelector("map-meta[name=projection]"),t=t?t.getAttribute("content"):H;if(h)for(i=h.getAttribute("content").split(","),e=0;e<i.length;e++)m=(u=i[e].split("="))[0],p=u[1],"min"===m&&(o=parseInt(p)),"max"===m&&(n=parseInt(p));if(d)for(i=d.getAttribute("content").split(","),e=0;e<i.length;e++)m=(u=i[e].split("="))[0],p=u[1],"xmin"===m&&(a=parseFloat(p)),"xmax"===m&&(r=parseFloat(p)),"ymin"===m&&(s=parseFloat(p)),"ymax"===m&&(l=parseFloat(p));return a&&s&&r&&l&&"WGS84"===t?(d=L.latLng(s,a),c=L.latLng(l,r),c=L.latLngBounds(d,c)):a&&s&&r&&l&&(c=L.bounds([[a,s],[r,l]])),this._getMapMLExtent(c,[o,n],t)},getProjection:function(){let t=this._extent;if(!t)return H;switch(t.tagName.toUpperCase()){case"MAP-EXTENT":if(t.hasAttribute("units"))return t.getAttribute("units").toUpperCase();break;case"MAP-INPUT":if(t.hasAttribute("value"))return t.getAttribute("value").toUpperCase();break;case"MAP-META":if(t.hasAttribute("content"))return M.metaContentToObject(t.getAttribute("content")).content.toUpperCase();break;default:return H}return H},_parseLicenseAndLegend:function(t,e){var i,o=t.querySelector("map-link[rel=license]");o&&(i=o.getAttribute("title"),i='<a href="'+o.getAttribute("href")+'" title="'+i+'">'+i+"</a>"),L.setOptions(e,{attribution:i});t=t.querySelector("map-link[rel=legend]");t&&(e._legendUrl=t.getAttribute("href"))},_getUnprojectedMapLatLngBounds:function(t){var e=(t=t||this._map).getPixelOrigin(),i=t.getPixelBounds(),o=t.unproject(e),n=t.unproject(i.getBottomLeft()),i=t.unproject(i.getTopRight()),t=t.unproject(e.add(t.getSize()));return L.latLngBounds(n,i).extend(t).extend(o)},_projectionMatches:function(t){t=t||this._map;var e=this.getProjection();return!(!t.options.projection||"WGS84"!==e&&t.options.projection!==e)},getQueryTemplates:function(){if(this._templatedLayer&&this._templatedLayer._queries)return this._templatedLayer._queries},_attachSkipButtons:function(t){let n=t.popup,a=t.target,e,s,i=n._container.getElementsByClassName("mapml-popup-content")[0];n._container.setAttribute("role","dialog"),i.setAttribute("tabindex","-1"),i.setAttribute("role","document"),n._count=0,n._source._eventParents?(e=n._source._eventParents[Object.keys(n._source._eventParents)[0]],s=n._source.group):e=n._source._templatedLayer,n._container.querySelector('nav[class="mapml-focus-buttons"]')&&(L.DomUtil.remove(n._container.querySelector('nav[class="mapml-focus-buttons"]')),L.DomUtil.remove(n._container.querySelector("hr")));var o=L.DomUtil.create("nav","mapml-focus-buttons");let r=L.DomUtil.create("button","mapml-popup-button",o);r.type="button",r.title="Focus Map",r.innerHTML="<span aria-hidden='true'>|&#10094;</span>",L.DomEvent.on(r,"click",t=>{L.DomEvent.stop(t),a.featureIndex._sortIndex(),a.closePopup(),a._container.focus()},n);let l=L.DomUtil.create("button","mapml-popup-button",o);l.type="button",l.title="Previous Feature",l.innerHTML="<span aria-hidden='true'>&#10094;</span>",L.DomEvent.on(l,"click",e._previousFeature,n);let u=L.DomUtil.create("p","mapml-feature-count",o),m=this._totalFeatureCount||1;u.innerText=n._count+1+"/"+m;let p=L.DomUtil.create("button","mapml-popup-button",o);p.type="button",p.title="Next Feature",p.innerHTML="<span aria-hidden='true'>&#10095;</span>",L.DomEvent.on(p,"click",e._nextFeature,n);let c=L.DomUtil.create("button","mapml-popup-button",o);c.type="button",c.title="Focus Controls",c.innerHTML="<span aria-hidden='true'>&#10095;|</span>",L.DomEvent.on(c,"click",t=>{a.featureIndex._sortIndex(),a.featureIndex.currentIndex=a.featureIndex.inBoundFeatures.length-1,a.featureIndex.inBoundFeatures[0].path.setAttribute("tabindex",-1),a.featureIndex.inBoundFeatures[a.featureIndex.currentIndex].path.setAttribute("tabindex",0),L.DomEvent.stop(t),a.closePopup(),a._controlContainer.querySelector("A").focus()},n);t=L.DomUtil.create("hr");function h(t){let e=t.originalEvent.path||t.originalEvent.composedPath();var i=9===t.originalEvent.keyCode,o=t.originalEvent.shiftKey;(e[0].classList.contains("leaflet-popup-close-button")&&i&&!o||27===t.originalEvent.keyCode||("Focus Map"===e[0].title||e[0].classList.contains("mapml-popup-content"))&&i&&o)&&setTimeout(()=>{L.DomEvent.stop(t),a.closePopup(n),s.focus()},0)}function d(t){let e=t.originalEvent.path||t.originalEvent.composedPath();var i=9===t.originalEvent.keyCode,o=t.originalEvent.shiftKey;13===t.originalEvent.keyCode&&e[0].classList.contains("leaflet-popup-close-button")||27===t.originalEvent.keyCode?(L.DomEvent.stopPropagation(t),a._container.focus(),a.closePopup(n),27!==t.originalEvent.keyCode&&(a._popupClosed=!0)):i&&e[0].classList.contains("leaflet-popup-close-button")?a.closePopup(n):("Focus Map"===e[0].title||e[0].classList.contains("mapml-popup-content"))&&i&&o&&setTimeout(()=>{L.DomEvent.stop(t),a.closePopup(n),a._container.focus()},0)}n._navigationBar=o,n._content.appendChild(t),n._content.appendChild(o),i.focus(),s?(s.setAttribute("aria-expanded","true"),a.on("keydown",h)):a.on("keydown",d),a.on("popupclose",function t(e){e.popup===n&&(a.off("keydown",h),a.off("keydown",d),a.off("popupclose",t),s&&s.setAttribute("aria-expanded","false"))})}}),v=L.Layer.extend({onAdd:function(t){var e=t.getSize();(400<e.x||300<e.y)&&(this._container=L.DomUtil.create("table","mapml-debug",t._container),this._panel=C({className:"mapml-debug-panel",pane:this._container}),t.addLayer(this._panel)),this._grid=S({className:"mapml-debug-grid",pane:t._panes.mapPane,zIndex:400,tileSize:t.options.crs.options.crs.tile.bounds.max.x}),t.addLayer(this._grid),this._vectors=z({className:"mapml-debug-vectors",pane:t._panes.mapPane,toolPane:this._container}),t.addLayer(this._vectors)},onRemove:function(t){t.removeLayer(this._grid),t.removeLayer(this._vectors),this._panel&&(t.removeLayer(this._panel),L.DomUtil.remove(this._container))}}),A=L.Layer.extend({initialize:function(t){L.setOptions(this,t)},onAdd:function(t){this._title=L.DomUtil.create("caption","mapml-debug-banner",this.options.pane),this._title.innerHTML="Debug mode",t.debug={},t.debug._infoContainer=this._debugContainer=L.DomUtil.create("tbody","mapml-debug-panel",this.options.pane);var e=t.debug._infoContainer;t.debug._tileCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._tileMatrixCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._mapCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._tcrsCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._pcrsCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._gcrsCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),this._map.on("mousemove",this._updateCoords)},onRemove:function(){L.DomUtil.remove(this._title),this._debugContainer&&(L.DomUtil.remove(this._debugContainer),this._map.off("mousemove",this._updateCoords))},_updateCoords:function(r){if(!this.contextMenu._visible){let t=this.options.mapEl,e=t._map.project(r.latlng),i=t._map.options.crs.scale(+t.zoom),o=t._map.options.crs.transformation.untransform(e,i),n=t._map.options.crs.options.crs.tile.bounds.max.x,a=e.x%n,s=e.y%n;a<0&&(a+=n),s<0&&(s+=n),this.debug._tileCoord.innerHTML=`
       <th scope="row">tile: </th>

From 5961de907763f6a773fc4215046e6047f8994e17 Mon Sep 17 00:00:00 2001
From: prushforth <peter.rushforth@gmail.com>
Date: Wed, 12 Jan 2022 19:33:39 +0000
Subject: [PATCH 3/4] [AUTO] Sync MapML Build

---
 dist/layer.js     |   16 +-
 dist/mapml.css    |    4 +-
 dist/mapml.js     | 1284 ++++++++++++++++++++++++---------------------
 dist/mapml.min.js |   16 +-
 4 files changed, 722 insertions(+), 598 deletions(-)

diff --git a/dist/layer.js b/dist/layer.js
index 8abacba..2e9ee85 100644
--- a/dist/layer.js
+++ b/dist/layer.js
@@ -195,10 +195,18 @@ export class MapLayer extends HTMLElement {
             let type = layerTypes[j];
             if(this.checked && layer[type]){
               if(type === "_templatedLayer"){
-                for(let j =0;j<layer[type]._templates.length;j++){
-                  if(layer[type]._templates[j].rel ==="query") continue;
-                  total++;
-                  if(!(layer[type]._templates[j].layer.isVisible))count++;
+                for(let i =0;i<layer._extent._mapExtents.length;i++){
+                  for(let j = 0; j < layer._extent._mapExtents[i].templatedLayer._templates.length; j++){
+                    if(layer._extent._mapExtents[i].templatedLayer._templates[j].rel ==="query") continue;
+                    total++;
+                    layer._extent._mapExtents[i].removeAttribute("disabled");
+                    layer._extent._mapExtents[i].disabled = false;
+                    if(!(layer._extent._mapExtents[i].templatedLayer._templates[j].layer.isVisible)){
+                      count++;
+                      layer._extent._mapExtents[i].setAttribute("disabled", "");
+                      layer._extent._mapExtents[i].disabled = true;
+                    }
+                  }  
                 }
               } else {
                 total++;
diff --git a/dist/mapml.css b/dist/mapml.css
index 357157e..0d52a5a 100644
--- a/dist/mapml.css
+++ b/dist/mapml.css
@@ -1,5 +1,5 @@
-.leaflet-image-layer,.leaflet-layer,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-pane,.leaflet-pane>canvas,.leaflet-pane>svg,.leaflet-tile,.leaflet-tile-container,.leaflet-zoom-box{position:absolute;left:0;top:0}.leaflet-container{overflow:hidden}.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile{-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-user-drag:none}.leaflet-tile::selection{background:0 0}.leaflet-safari .leaflet-tile{image-rendering:-webkit-optimize-contrast}.leaflet-safari .leaflet-tile-container{width:1600px;height:1600px;-webkit-transform-origin:0 0}.leaflet-marker-icon,.leaflet-marker-shadow{display:block}.leaflet-container .leaflet-marker-pane img,.leaflet-container .leaflet-overlay-pane svg,.leaflet-container .leaflet-shadow-pane img,.leaflet-container .leaflet-tile,.leaflet-container .leaflet-tile-pane img,.leaflet-container img.leaflet-image-layer{max-width:none!important;max-height:none!important}.leaflet-container.leaflet-touch-zoom{-ms-touch-action:pan-x pan-y;touch-action:pan-x pan-y}.leaflet-container.leaflet-touch-drag{-ms-touch-action:pinch-zoom;touch-action:none;touch-action:pinch-zoom}.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom{-ms-touch-action:none;touch-action:none}.leaflet-container{-webkit-tap-highlight-color:transparent}.leaflet-container a{-webkit-tap-highlight-color:rgba(51,181,229,0.4)}.leaflet-tile{filter:inherit;visibility:hidden}.leaflet-tile-loaded{visibility:inherit}.leaflet-zoom-box{width:0;height:0;-moz-box-sizing:border-box;box-sizing:border-box;z-index:800}.leaflet-overlay-pane svg{-moz-user-select:none}.leaflet-pane{z-index:400}.leaflet-tile-pane{z-index:200}.leaflet-overlay-pane{z-index:400}.leaflet-shadow-pane{z-index:500}.leaflet-marker-pane{z-index:600}.leaflet-tooltip-pane{z-index:650}.leaflet-popup-pane{z-index:700}.leaflet-map-pane canvas{z-index:100}.leaflet-map-pane svg{z-index:200}.leaflet-vml-shape{width:1px;height:1px}.lvml{behavior:url(#default#VML);display:inline-block;position:absolute}.leaflet-control{position:relative;z-index:800;pointer-events:visiblePainted;pointer-events:auto}.leaflet-bottom,.leaflet-top{position:absolute;z-index:1000;pointer-events:none}.leaflet-top{top:0}.leaflet-right{right:0}.leaflet-bottom{bottom:0}.leaflet-left{left:0}.leaflet-control{float:left;clear:both}.leaflet-right .leaflet-control{float:right}.leaflet-top .leaflet-control{margin-top:10px}.leaflet-bottom .leaflet-control{margin-bottom:10px}.leaflet-left .leaflet-control{margin-left:10px}.leaflet-right .leaflet-control{margin-right:10px}.leaflet-fade-anim .leaflet-tile{will-change:opacity}.leaflet-fade-anim .leaflet-popup{opacity:0;-webkit-transition:opacity .2s linear;-moz-transition:opacity .2s linear;transition:opacity .2s linear}.leaflet-fade-anim .leaflet-map-pane .leaflet-popup{opacity:1}.leaflet-zoom-animated{-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0}.leaflet-zoom-anim .leaflet-zoom-animated{will-change:transform}.leaflet-zoom-anim .leaflet-zoom-animated{-webkit-transition:-webkit-transform .25s cubic-bezier(0,0,.25,1);-moz-transition:-moz-transform .25s cubic-bezier(0,0,.25,1);transition:transform .25s cubic-bezier(0,0,.25,1)}.leaflet-pan-anim .leaflet-tile,.leaflet-zoom-anim .leaflet-tile{-webkit-transition:none;-moz-transition:none;transition:none}.leaflet-zoom-anim .leaflet-zoom-hide{visibility:hidden}.leaflet-interactive{cursor:pointer}.leaflet-grab{cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.leaflet-crosshair,.leaflet-crosshair .leaflet-interactive{cursor:crosshair}.leaflet-control,.leaflet-popup-pane{cursor:auto}.leaflet-dragging .leaflet-grab,.leaflet-dragging .leaflet-grab .leaflet-interactive,.leaflet-dragging .leaflet-marker-draggable{cursor:move;cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.leaflet-image-layer,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-pane>svg path,.leaflet-tile-container{pointer-events:none}.leaflet-image-layer.leaflet-interactive,.leaflet-marker-icon.leaflet-interactive,.leaflet-pane>svg path.leaflet-interactive,svg.leaflet-image-layer.leaflet-interactive path{pointer-events:visiblePainted;pointer-events:auto}.leaflet-container{background:#ddd;outline:0}.leaflet-container a{color:#0078a8}.leaflet-container a.leaflet-active{outline:2px solid orange}.leaflet-zoom-box{border:2px dotted #38f;background:rgba(255,255,255,.5)}.leaflet-container{font:12px/1.5 "Helvetica Neue",Arial,Helvetica,sans-serif}.leaflet-bar{box-shadow:0 1px 5px rgba(0,0,0,.65);border-radius:4px}.leaflet-bar a,.leaflet-bar a:hover{background-color:#fff;border-bottom:1px solid #ccc;width:26px;height:26px;line-height:26px;display:block;text-align:center;text-decoration:none;color:#000}.leaflet-bar a,.leaflet-control-layers-toggle{background-position:50% 50%;background-repeat:no-repeat;display:block}.leaflet-bar a:hover{background-color:#f4f4f4}.leaflet-bar a:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.leaflet-bar a:last-child{border-bottom-left-radius:4px;border-bottom-right-radius:4px;border-bottom:none}.leaflet-bar a.leaflet-disabled{cursor:default;background-color:#f4f4f4;color:#bbb}.leaflet-touch .leaflet-bar a{width:30px;height:30px;line-height:30px}.leaflet-touch .leaflet-bar a:first-child{border-top-left-radius:2px;border-top-right-radius:2px}.leaflet-touch .leaflet-bar a:last-child{border-bottom-left-radius:2px;border-bottom-right-radius:2px}.leaflet-control-zoom-in,.leaflet-control-zoom-out{font:bold 18px 'Lucida Console',Monaco,monospace;text-indent:1px}.leaflet-touch .leaflet-control-zoom-in,.leaflet-touch .leaflet-control-zoom-out{font-size:22px}.leaflet-control-layers{box-shadow:0 1px 5px rgba(0,0,0,.4);background:#fff;border-radius:5px}.leaflet-control-layers-toggle{background-image:url(images/layers.png);width:36px;height:36px}.leaflet-retina .leaflet-control-layers-toggle{background-image:url(images/layers-2x.png);background-size:26px 26px}.leaflet-touch .leaflet-control-layers-toggle{width:44px;height:44px}.leaflet-control-layers .leaflet-control-layers-list,.leaflet-control-layers-expanded .leaflet-control-layers-toggle{display:none}.leaflet-control-layers-expanded .leaflet-control-layers-list{display:block;position:relative}.leaflet-control-layers-expanded{padding:6px 10px 6px 6px;color:#333;background:#fff}.leaflet-control-layers-scrollbar{overflow-y:scroll;overflow-x:hidden;padding-right:5px}.leaflet-control-layers-selector{margin-top:2px;position:relative;top:1px}.leaflet-control-layers label{display:block}.leaflet-control-layers-separator{height:0;border-top:1px solid #ddd;margin:5px -10px 5px -6px}.leaflet-default-icon-path{background-image:url(images/marker-icon.png)}.leaflet-container .leaflet-control-attribution{background:#fff;background:rgba(255,255,255,.7);margin:0}.leaflet-control-attribution,.leaflet-control-scale-line{padding:0 5px;color:#333}.leaflet-control-attribution a{text-decoration:none}.leaflet-control-attribution a:hover{text-decoration:underline}.leaflet-container .leaflet-control-attribution,.leaflet-container .leaflet-control-scale{font-size:11px}.leaflet-left .leaflet-control-scale{margin-left:5px}.leaflet-bottom .leaflet-control-scale{margin-bottom:5px}.leaflet-control-scale-line{border:2px solid #777;border-top:none;line-height:1.1;padding:2px 5px 1px;font-size:11px;white-space:nowrap;overflow:hidden;-moz-box-sizing:border-box;box-sizing:border-box;background:#fff;background:rgba(255,255,255,.5)}.leaflet-control-scale-line:not(:first-child){border-top:2px solid #777;border-bottom:none;margin-top:-2px}.leaflet-control-scale-line:not(:first-child):not(:last-child){border-bottom:2px solid #777}.leaflet-touch .leaflet-bar,.leaflet-touch .leaflet-control-attribution,.leaflet-touch .leaflet-control-layers{box-shadow:none}.leaflet-touch .leaflet-bar,.leaflet-touch .leaflet-control-layers{border:2px solid rgba(0,0,0,.2);background-clip:padding-box}.leaflet-popup{position:absolute;text-align:center;margin-bottom:20px}.leaflet-popup-content-wrapper{padding:1px;text-align:left;border-radius:12px}.leaflet-popup-content{margin:13px 19px;line-height:1.4}.leaflet-popup-content p{margin:18px 0}.leaflet-popup-tip-container{width:40px;height:20px;position:absolute;left:50%;margin-left:-20px;overflow:hidden;pointer-events:none}.leaflet-popup-tip{width:17px;height:17px;padding:1px;margin:-10px auto 0;-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.leaflet-popup-content-wrapper,.leaflet-popup-tip{background:#fff;color:#333;box-shadow:0 3px 14px rgba(0,0,0,.4)}.leaflet-container a.leaflet-popup-close-button{position:absolute;top:0;right:0;padding:4px 4px 0 0;border:none;text-align:center;width:18px;height:14px;font:16px/14px Tahoma,Verdana,sans-serif;color:#c3c3c3;text-decoration:none;font-weight:700;background:0 0}.leaflet-container a.leaflet-popup-close-button:hover{color:#999}.leaflet-popup-scrolled{overflow:auto;border-bottom:1px solid #ddd;border-top:1px solid #ddd}.leaflet-oldie .leaflet-popup-content-wrapper{-ms-zoom:1}.leaflet-oldie .leaflet-popup-tip{width:24px;margin:0 auto}.leaflet-oldie .leaflet-popup-tip-container{margin-top:-1px}.leaflet-oldie .leaflet-control-layers,.leaflet-oldie .leaflet-control-zoom,.leaflet-oldie .leaflet-popup-content-wrapper,.leaflet-oldie .leaflet-popup-tip{border:1px solid #999}.leaflet-div-icon{background:#fff;border:1px solid #666}.leaflet-tooltip{position:absolute;padding:6px;background-color:#fff;border:1px solid #fff;border-radius:3px;color:#222;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;box-shadow:0 1px 3px rgba(0,0,0,.4)}.leaflet-tooltip.leaflet-clickable{cursor:pointer;pointer-events:auto}.leaflet-tooltip-bottom:before,.leaflet-tooltip-left:before,.leaflet-tooltip-right:before,.leaflet-tooltip-top:before{position:absolute;pointer-events:none;border:6px solid transparent;background:0 0;content:""}.leaflet-tooltip-bottom{margin-top:6px}.leaflet-tooltip-top{margin-top:-6px}.leaflet-tooltip-bottom:before,.leaflet-tooltip-top:before{left:50%;margin-left:-6px}.leaflet-tooltip-top:before{bottom:0;margin-bottom:-12px;border-top-color:#fff}.leaflet-tooltip-bottom:before{top:0;margin-top:-12px;margin-left:-6px;border-bottom-color:#fff}.leaflet-tooltip-left{margin-left:-6px}.leaflet-tooltip-right{margin-left:6px}.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{top:50%;margin-top:-6px}.leaflet-tooltip-left:before{right:0;margin-right:-12px;border-left-color:#fff}.leaflet-tooltip-right:before{left:0;margin-left:-12px;border-right-color:#fff}.leaflet-container{background-color:transparent;max-height:100%;max-width:100%;min-height:100%;min-width:100%;width:100%!important;height:100%!important}.leaflet-tile img{position:absolute;left:0;top:0}.leaflet-fade-anim .leaflet-image-layer{will-change:opacity}.leaflet-image-layer{visibility:hidden}.leaflet-image-loaded{visibility:inherit}.leaflet-container .leaflet-control-attribution,.leaflet-container .leaflet-control-scale,.leaflet-control-scale-line{font-size:12px}.mapml-button{background-color:transparent;border:none;border-radius:0;color:inherit;font:inherit;line-height:inherit;margin:0;padding:0;overflow:hidden;text-align:inherit;text-transform:none;-webkit-appearance:none;-moz-appearance:none;appearance:none}.leaflet-container a{color:revert}.leaflet-container a.leaflet-popup-close-button,.leaflet-container a.leaflet-popup-close-button:hover,.leaflet-control-container a,.mapml-reload-button{color:#000}.mapml-layer-item-name a{color:revert}.leaflet-top .leaflet-control{margin-top:5px}.leaflet-left .leaflet-control{margin-left:5px}.leaflet-bar a,.mapml-reload-button{background-color:#fff;box-sizing:border-box;width:44px!important;height:44px!important;line-height:44px!important;font-size:34px!important;font-weight:400;text-align:center}.mapml-reload-button:not([aria-disabled=true]):hover{background-color:#f4f4f4}.mapml-reload-button[aria-disabled=true]{color:#bbb;cursor:default}.leaflet-control-layers-toggle{width:44px!important;height:44px!important}.leaflet-bar a,.leaflet-control-layers,.mapml-reload-button{border-color:#e3e3e3!important}.leaflet-control-layers,.mapml-reload-button{border-radius:4px!important}.leaflet-touch .leaflet-bar a:last-child{border-bottom-left-radius:4px!important;border-bottom-right-radius:4px!important}.leaflet-touch .leaflet-bar a:first-child{border-top-left-radius:4px!important;border-top-right-radius:4px!important}.leaflet-touch .leaflet-bar,.leaflet-touch .leaflet-control-layers{border-style:inherit}.leaflet-bar,.leaflet-control-layers,.leaflet-popup-content-wrapper,.leaflet-popup-tip,.leaflet-tooltip-pane .leaflet-tooltip,.leaflet-touch .leaflet-bar,.leaflet-touch .leaflet-control-layers,.mapml-contextmenu,.mapml-debug{box-shadow:0 1px 3px rgba(0,0,0,.2),0 1px 2px rgb(0,0,0,.3)}.leaflet-container .leaflet-control-attribution{background-color:rgba(255,255,255,.95)}.leaflet-control-attribution a{color:revert;text-decoration:revert}.leaflet-control-zoom-in,.leaflet-control-zoom-out{text-indent:unset}.leaflet-control-fullscreen a{background-image:url("data:image/svg+xml,%0A%3Csvg width='26' height='52' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg transform='translate(0 -1000.4)'%3E%3Cuse transform='translate(0 26)' width='100%25' height='100%25' xlink:href='%23a'/%3E%3Cuse transform='translate(0 26)' width='100%25' height='100%25' xlink:href='%23b'/%3E%3Cuse transform='translate(0 26)' width='100%25' height='100%25' xlink:href='%23c'/%3E%3Cuse transform='translate(0 26)' width='100%25' height='100%25' xlink:href='%23d'/%3E%3Cpath id='a' transform='translate(0 1000.4)' d='M5 15v6h6v-2H7v-4z' color='%23000' fill='%23404040'/%3E%3Cpath id='b' transform='translate(0 1000.4)' d='M21 15v6h-6v-2h4v-4z' color='%23000' fill='%23404040'/%3E%3Cpath d='M10 1037.4v4l1 1h4l1-1v-4l-1-1h-4z' color='%23000' fill='%23404040'/%3E%3Cpath id='d' d='M5 1011.4v-6h6v2H7v4z' color='%23000' fill='%23404040'/%3E%3Cpath id='c' d='M21 1011.4v-6h-6v2h4v4z' color='%23000' fill='%23404040'/%3E%3C/g%3E%3C/svg%3E");background-repeat:no-repeat;background-size:38px 76px;background-position:3px 3px}:host(.mapml-fullscreen-on) .leaflet-control-fullscreen a{background-position:3px -35px}:host(:-webkit-full-screen){width:100%!important;height:100%!important}:host(.mapml-fullscreen-on){width:100%!important;height:100%!important}:host(.leaflet-pseudo-fullscreen){position:fixed!important;width:100%!important;height:100%!important;top:0!important;left:0!important;z-index:99999}.leaflet-control-layers.leaflet-control{margin-right:5px;margin-left:5px;padding:0}.leaflet-control-layers-list{padding:0;text-transform:capitalize}.leaflet-control-layers fieldset{margin:0;padding:0;min-height:44px}.leaflet-control-layers label{display:inline}.mapml-control-layers>:not(summary){display:block;margin-block-start:5px;margin-inline-start:15px;width:calc(100% - 15px)}.mapml-layer-item-style>div{display:flex}.mapml-layer-item-style input{margin-inline-start:0}.leaflet-control .leaflet-control-layers-toggle{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M0 0h24v24H0V0z' fill='none'/%3E%3Cpath d='m11.99 18.54-7.37-5.73L3 14.07l9 7 9-7-1.63-1.27zM12 16l7.36-5.73L21 9l-9-7-9 7 1.63 1.27L12 16zm0-11.47L17.74 9 12 13.47 6.26 9 12 4.53z'/%3E%3C/svg%3E");background-size:34px}.leaflet-control-layers-selector{margin-top:revert;position:revert}.mapml-contextmenu{border-radius:4px;padding:4px 0;background-color:#fff;cursor:default;position:absolute;width:160px;z-index:10001}.mapml-contextmenu button.mapml-contextmenu-item{color:#222;font-size:12px;line-height:20px;text-decoration:none;padding:0 12px;border-top:1px solid transparent;border-bottom:1px solid transparent;cursor:default;width:100%}.mapml-contextmenu button.mapml-contextmenu-item.over{background-color:#f4f4f4;border-top:1px solid #f0f0f0;border-bottom:1px solid #f0f0f0}.mapml-contextmenu-separator{border-bottom:1px solid #e3e3e3;margin:5px 0}.mapml-contextmenu.mapml-submenu{width:80px;margin-bottom:-2rem}@supports (contain:layout){.mapml-contextmenu{position:fixed}.mapml-contextmenu.mapml-submenu{position:absolute}}.mapml-contextmenu-item[aria-controls] span::after{content:">"}@supports (list-style-type:disclosure-open){.mapml-contextmenu-item[aria-controls] span{display:inline-block}.mapml-contextmenu-item[aria-controls] span::after{content:"";display:list-item;list-style-type:disclosure-closed;margin-inline-start:20px}}.mapml-debug{contain:content;max-height:100%;max-width:100%;border-radius:4px;padding:5px 10px;background-color:#fff;cursor:default;z-index:1000;position:absolute;display:block;top:auto;right:5px;bottom:5px;left:5px;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;font:inherit}.mapml-debug-banner{font-weight:700;text-transform:uppercase;display:inline-block;text-align:left;text-align:inline-start;line-height:2}.mapml-debug-grid,.mapml-debug-panel{font-family:monospace}.mapml-debug-tile{text-indent:6px;line-height:1.8}.mapml-debug-coordinates{padding-left:4px;padding-right:4px}.mapml-debug,.mapml-debug *{border-collapse:collapse;border-spacing:0}.mapml-debug-coordinates:empty{display:none}.mapml-debug-coordinates>*{display:inline}:host(.mapml-fullscreen-on) .mapml-debug-grid{color:#fff;text-shadow:1px 1px 1px #000,1px 1px 1px #000}:host(.leaflet-drag-target) .leaflet-grab{cursor:move;cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}:host(.leaflet-drag-target) .leaflet-control{pointer-events:none}.leaflet-control :not([draggable=true]),.leaflet-popup-close-button,.mapml-contextmenu :not([draggable=true]),.mapml-popup-button{-webkit-user-drag:none}.leaflet-control,.mapml-contextmenu,.mapml-debug,.mapml-focus-buttons,.mapml-layer-item-settings summary{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.leaflet-control a::selection,.leaflet-control-attribution::selection,.leaflet-popup-close-button::selection{background-color:transparent}.leaflet-crosshair *,.leaflet-tooltip,.mapml-contextmenu-item>*,.mapml-layer-item-settings .mapml-control-layers summary label,.mapml-link-preview{pointer-events:none!important}.leaflet-container :focus{outline-color:-webkit-focus-ring-color!important;outline-style:auto!important;outline-width:thin!important;outline:revert!important}.leaflet-active:not(:focus){outline:unset!important}.leaflet-container:not(:focus-within) .mapml-outline{outline:0}.leaflet-container:not(:focus-within) .mapml-crosshair{display:none}.leaflet-control a{-webkit-tap-highlight-color:initial}.leaflet-zoom-box{border:thin dotted;background-color:rgba(255,255,255,.33)}button,input,label,summary{cursor:pointer}.mapml-draggable,.mapml-draggable *{cursor:row-resize}.leaflet-crosshair{cursor:crosshair}[hidden]{display:none!important}.leaflet-container .leaflet-control-container,.leaflet-container .mapml-contextmenu{visibility:unset!important}.mapml-crosshair{margin:-36px 0 0 -36px;width:72px;height:72px;left:50%;top:50%;position:absolute;z-index:10000}.mapml-popup-button{padding:0 4px 0 4px;border:none;text-align:center;font:16px/14px Tahoma,Verdana,sans-serif;color:inherit;text-decoration:none;font-weight:700;background:0 0;white-space:nowrap;box-sizing:border-box;width:44px;height:44px;line-height:44px}.mapml-focus-buttons{white-space:nowrap}.mapml-feature-count{display:inline;white-space:nowrap;text-align:center;padding:2px}.leaflet-container a.leaflet-popup-close-button,.mapml-focus-buttons button{width:44px;height:44px;min-width:44px;min-height:44px;line-height:44px}.leaflet-popup-content{margin:0;min-width:min-content}.mapml-popup-content{padding-top:44px}.mapml-focus-buttons{display:block;text-align:center}.mapml-focus-buttons button{display:inline-block;padding:0}.leaflet-container a.leaflet-popup-close-button{padding:0;font-size:20px}.leaflet-popup-content .mapml-feature-count{margin:0;padding:0 5px;line-height:44px}.mapml-popup-content hr:last-of-type{margin-bottom:0;border-bottom:0;border-top:1px solid #e3e3e3}.mapml-popup-content :first-child{margin-top:0;padding-top:0}.mapml-popup-content>:not(.mapml-focus-buttons){padding:0 1rem}.leaflet-popup-tip-container{margin-top:-1px}.mapml-outline{outline-style:auto;outline-offset:-2px;z-index:1000;pointer-events:none;position:absolute;height:100%;width:100%;color:initial}@media print{.leaflet-control{-webkit-print-color-adjust:exact;color-adjust:exact}}.leaflet-pane>svg g.leaflet-interactive,svg.leaflet-image-layer.leaflet-interactive g{pointer-events:visiblePainted;pointer-events:auto}.mapml-link-preview{position:absolute;left:0;bottom:0;background-color:#dee1e6;border-radius:0 5px 0 0;z-index:1050}.mapml-link-preview>p{margin:3px 5px 2px 3px;color:#3c4043}.mapml-button[aria-disabled=true],.mapml-layer-item:disabled button.mapml-button,button.mapml-button:disabled{opacity:.3}.mapml-button-icon{pointer-events:none}.mapml-button-icon svg{fill:currentColor}.mapml-layer-item,.mapml-layer-item *{box-sizing:border-box}.mapml-layer-item{background-color:#fff;border:1px solid #fff;margin:0;padding:0}.mapml-layer-item:not(:last-of-type){border-bottom:1px solid #e3e3e3}.mapml-layer-item[aria-grabbed=true]{border:1px solid #e3e3e3;border-radius:0}.mapml-layer-item:first-of-type{border-top-left-radius:4px;border-top-right-radius:4px}.mapml-layer-item:last-of-type{border-bottom-left-radius:4px;border-bottom-right-radius:4px}.mapml-layer-item-properties{align-items:center;display:flex;justify-content:space-between;padding-inline-start:.5rem}.mapml-layer-item-controls{margin-inline-start:auto}.mapml-layer-item-controls button span{font-size:large;font-weight:900;vertical-align:middle}.mapml-layer-item-controls button svg{vertical-align:text-bottom}.mapml-layer-item-controls,.mapml-layer-item-remove-control,.mapml-layer-item-settings-control{align-items:center;display:flex;justify-content:center}.mapml-layer-item-remove-control,.mapml-layer-item-settings-control{min-height:44px;min-width:44px;height:44px;width:44px}label.mapml-layer-item-toggle{display:inline-flex;align-items:center;width:100%;min-height:44px}.mapml-layer-item-name{word-break:break-word;padding-block-start:.25rem;padding-block-end:.25rem;padding-inline-start:.25rem;padding-inline-end:1rem}.mapml-layer-item-settings>*{display:block;padding-block-start:.25rem;padding-block-end:.25rem;padding-inline-start:2rem;padding-inline-end:1rem}.mapml-screen-reader-output{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}.mapml-vector-container svg :is(
+.leaflet-image-layer,.leaflet-layer,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-pane,.leaflet-pane>canvas,.leaflet-pane>svg,.leaflet-tile,.leaflet-tile-container,.leaflet-zoom-box{position:absolute;left:0;top:0}.leaflet-container{overflow:hidden}.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile{-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-user-drag:none}.leaflet-tile::selection{background:0 0}.leaflet-safari .leaflet-tile{image-rendering:-webkit-optimize-contrast}.leaflet-safari .leaflet-tile-container{width:1600px;height:1600px;-webkit-transform-origin:0 0}.leaflet-marker-icon,.leaflet-marker-shadow{display:block}.leaflet-container .leaflet-marker-pane img,.leaflet-container .leaflet-overlay-pane svg,.leaflet-container .leaflet-shadow-pane img,.leaflet-container .leaflet-tile,.leaflet-container .leaflet-tile-pane img,.leaflet-container img.leaflet-image-layer{max-width:none!important;max-height:none!important}.leaflet-container.leaflet-touch-zoom{-ms-touch-action:pan-x pan-y;touch-action:pan-x pan-y}.leaflet-container.leaflet-touch-drag{-ms-touch-action:pinch-zoom;touch-action:none;touch-action:pinch-zoom}.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom{-ms-touch-action:none;touch-action:none}.leaflet-container{-webkit-tap-highlight-color:transparent}.leaflet-container a{-webkit-tap-highlight-color:rgba(51,181,229,0.4)}.leaflet-tile{filter:inherit;visibility:hidden}.leaflet-tile-loaded{visibility:inherit}.leaflet-zoom-box{width:0;height:0;-moz-box-sizing:border-box;box-sizing:border-box;z-index:800}.leaflet-overlay-pane svg{-moz-user-select:none}.leaflet-pane{z-index:400}.leaflet-tile-pane{z-index:200}.leaflet-overlay-pane{z-index:400}.leaflet-shadow-pane{z-index:500}.leaflet-marker-pane{z-index:600}.leaflet-tooltip-pane{z-index:650}.leaflet-popup-pane{z-index:700}.leaflet-map-pane canvas{z-index:100}.leaflet-map-pane svg{z-index:200}.leaflet-vml-shape{width:1px;height:1px}.lvml{behavior:url(#default#VML);display:inline-block;position:absolute}.leaflet-control{position:relative;z-index:800;pointer-events:visiblePainted;pointer-events:auto}.leaflet-bottom,.leaflet-top{position:absolute;z-index:1000;pointer-events:none}.leaflet-top{top:0}.leaflet-right{right:0}.leaflet-bottom{bottom:0}.leaflet-left{left:0}.leaflet-control{float:left;clear:both}.leaflet-right .leaflet-control{float:right}.leaflet-top .leaflet-control{margin-top:10px}.leaflet-bottom .leaflet-control{margin-bottom:10px}.leaflet-left .leaflet-control{margin-left:10px}.leaflet-right .leaflet-control{margin-right:10px}.leaflet-fade-anim .leaflet-tile{will-change:opacity}.leaflet-fade-anim .leaflet-popup{opacity:0;-webkit-transition:opacity .2s linear;-moz-transition:opacity .2s linear;transition:opacity .2s linear}.leaflet-fade-anim .leaflet-map-pane .leaflet-popup{opacity:1}.leaflet-zoom-animated{-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0}.leaflet-zoom-anim .leaflet-zoom-animated{will-change:transform}.leaflet-zoom-anim .leaflet-zoom-animated{-webkit-transition:-webkit-transform .25s cubic-bezier(0,0,.25,1);-moz-transition:-moz-transform .25s cubic-bezier(0,0,.25,1);transition:transform .25s cubic-bezier(0,0,.25,1)}.leaflet-pan-anim .leaflet-tile,.leaflet-zoom-anim .leaflet-tile{-webkit-transition:none;-moz-transition:none;transition:none}.leaflet-zoom-anim .leaflet-zoom-hide{visibility:hidden}.leaflet-interactive{cursor:pointer}.leaflet-grab{cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.leaflet-crosshair,.leaflet-crosshair .leaflet-interactive{cursor:crosshair}.leaflet-control,.leaflet-popup-pane{cursor:auto}.leaflet-dragging .leaflet-grab,.leaflet-dragging .leaflet-grab .leaflet-interactive,.leaflet-dragging .leaflet-marker-draggable{cursor:move;cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.leaflet-image-layer,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-pane>svg path,.leaflet-tile-container{pointer-events:none}.leaflet-image-layer.leaflet-interactive,.leaflet-marker-icon.leaflet-interactive,.leaflet-pane>svg path.leaflet-interactive,svg.leaflet-image-layer.leaflet-interactive path{pointer-events:visiblePainted;pointer-events:auto}.leaflet-container{background:#ddd;outline:0}.leaflet-container a{color:#0078a8}.leaflet-container a.leaflet-active{outline:2px solid orange}.leaflet-zoom-box{border:2px dotted #38f;background:rgba(255,255,255,.5)}.leaflet-container{font:12px/1.5 "Helvetica Neue",Arial,Helvetica,sans-serif}.leaflet-bar{box-shadow:0 1px 5px rgba(0,0,0,.65);border-radius:4px}.leaflet-bar a,.leaflet-bar a:hover{background-color:#fff;border-bottom:1px solid #ccc;width:26px;height:26px;line-height:26px;display:block;text-align:center;text-decoration:none;color:#000}.leaflet-bar a,.leaflet-control-layers-toggle{background-position:50% 50%;background-repeat:no-repeat;display:block}.leaflet-bar a:hover{background-color:#f4f4f4}.leaflet-bar a:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.leaflet-bar a:last-child{border-bottom-left-radius:4px;border-bottom-right-radius:4px;border-bottom:none}.leaflet-bar a.leaflet-disabled{cursor:default;background-color:#f4f4f4;color:#bbb}.leaflet-touch .leaflet-bar a{width:30px;height:30px;line-height:30px}.leaflet-touch .leaflet-bar a:first-child{border-top-left-radius:2px;border-top-right-radius:2px}.leaflet-touch .leaflet-bar a:last-child{border-bottom-left-radius:2px;border-bottom-right-radius:2px}.leaflet-control-zoom-in,.leaflet-control-zoom-out{font:bold 18px 'Lucida Console',Monaco,monospace;text-indent:1px}.leaflet-touch .leaflet-control-zoom-in,.leaflet-touch .leaflet-control-zoom-out{font-size:22px}.leaflet-control-layers{box-shadow:0 1px 5px rgba(0,0,0,.4);background:#fff;border-radius:5px}.leaflet-control-layers-toggle{background-image:url(images/layers.png);width:36px;height:36px}.leaflet-retina .leaflet-control-layers-toggle{background-image:url(images/layers-2x.png);background-size:26px 26px}.leaflet-touch .leaflet-control-layers-toggle{width:44px;height:44px}.leaflet-control-layers .leaflet-control-layers-list,.leaflet-control-layers-expanded .leaflet-control-layers-toggle{display:none}.leaflet-control-layers-expanded .leaflet-control-layers-list{display:block;position:relative}.leaflet-control-layers-expanded{padding:6px 10px 6px 6px;color:#333;background:#fff}.leaflet-control-layers-scrollbar{overflow-y:scroll;overflow-x:hidden;padding-right:5px}.leaflet-control-layers-selector{margin-top:2px;position:relative;top:1px}.leaflet-control-layers label{display:block}.leaflet-control-layers-separator{height:0;border-top:1px solid #ddd;margin:5px -10px 5px -6px}.leaflet-default-icon-path{background-image:url(images/marker-icon.png)}.leaflet-container .leaflet-control-attribution{background:#fff;background:rgba(255,255,255,.7);margin:0}.leaflet-control-attribution,.leaflet-control-scale-line{padding:0 5px;color:#333}.leaflet-control-attribution a{text-decoration:none}.leaflet-control-attribution a:hover{text-decoration:underline}.leaflet-container .leaflet-control-attribution,.leaflet-container .leaflet-control-scale{font-size:11px}.leaflet-left .leaflet-control-scale{margin-left:5px}.leaflet-bottom .leaflet-control-scale{margin-bottom:5px}.leaflet-control-scale-line{border:2px solid #777;border-top:none;line-height:1.1;padding:2px 5px 1px;font-size:11px;white-space:nowrap;overflow:hidden;-moz-box-sizing:border-box;box-sizing:border-box;background:#fff;background:rgba(255,255,255,.5)}.leaflet-control-scale-line:not(:first-child){border-top:2px solid #777;border-bottom:none;margin-top:-2px}.leaflet-control-scale-line:not(:first-child):not(:last-child){border-bottom:2px solid #777}.leaflet-touch .leaflet-bar,.leaflet-touch .leaflet-control-attribution,.leaflet-touch .leaflet-control-layers{box-shadow:none}.leaflet-touch .leaflet-bar,.leaflet-touch .leaflet-control-layers{border:2px solid rgba(0,0,0,.2);background-clip:padding-box}.leaflet-popup{position:absolute;text-align:center;margin-bottom:20px}.leaflet-popup-content-wrapper{padding:1px;text-align:left;border-radius:12px}.leaflet-popup-content{margin:13px 19px;line-height:1.4}.leaflet-popup-content p{margin:18px 0}.leaflet-popup-tip-container{width:40px;height:20px;position:absolute;left:50%;margin-left:-20px;overflow:hidden;pointer-events:none}.leaflet-popup-tip{width:17px;height:17px;padding:1px;margin:-10px auto 0;-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.leaflet-popup-content-wrapper,.leaflet-popup-tip{background:#fff;color:#333;box-shadow:0 3px 14px rgba(0,0,0,.4)}.leaflet-container a.leaflet-popup-close-button{position:absolute;top:0;right:0;padding:4px 4px 0 0;border:none;text-align:center;width:18px;height:14px;font:16px/14px Tahoma,Verdana,sans-serif;color:#c3c3c3;text-decoration:none;font-weight:700;background:0 0}.leaflet-container a.leaflet-popup-close-button:hover{color:#999}.leaflet-popup-scrolled{overflow:auto;border-bottom:1px solid #ddd;border-top:1px solid #ddd}.leaflet-oldie .leaflet-popup-content-wrapper{-ms-zoom:1}.leaflet-oldie .leaflet-popup-tip{width:24px;margin:0 auto}.leaflet-oldie .leaflet-popup-tip-container{margin-top:-1px}.leaflet-oldie .leaflet-control-layers,.leaflet-oldie .leaflet-control-zoom,.leaflet-oldie .leaflet-popup-content-wrapper,.leaflet-oldie .leaflet-popup-tip{border:1px solid #999}.leaflet-div-icon{background:#fff;border:1px solid #666}.leaflet-tooltip{position:absolute;padding:6px;background-color:#fff;border:1px solid #fff;border-radius:3px;color:#222;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;box-shadow:0 1px 3px rgba(0,0,0,.4)}.leaflet-tooltip.leaflet-clickable{cursor:pointer;pointer-events:auto}.leaflet-tooltip-bottom:before,.leaflet-tooltip-left:before,.leaflet-tooltip-right:before,.leaflet-tooltip-top:before{position:absolute;pointer-events:none;border:6px solid transparent;background:0 0;content:""}.leaflet-tooltip-bottom{margin-top:6px}.leaflet-tooltip-top{margin-top:-6px}.leaflet-tooltip-bottom:before,.leaflet-tooltip-top:before{left:50%;margin-left:-6px}.leaflet-tooltip-top:before{bottom:0;margin-bottom:-12px;border-top-color:#fff}.leaflet-tooltip-bottom:before{top:0;margin-top:-12px;margin-left:-6px;border-bottom-color:#fff}.leaflet-tooltip-left{margin-left:-6px}.leaflet-tooltip-right{margin-left:6px}.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{top:50%;margin-top:-6px}.leaflet-tooltip-left:before{right:0;margin-right:-12px;border-left-color:#fff}.leaflet-tooltip-right:before{left:0;margin-left:-12px;border-right-color:#fff}.leaflet-container{background-color:transparent;max-height:100%;max-width:100%;min-height:100%;min-width:100%;width:100%!important;height:100%!important}.leaflet-tile img{position:absolute;left:0;top:0}.leaflet-fade-anim .leaflet-image-layer{will-change:opacity}.leaflet-image-layer{visibility:hidden}.leaflet-image-loaded{visibility:inherit}.leaflet-container .leaflet-control-attribution,.leaflet-container .leaflet-control-scale,.leaflet-control-scale-line{font-size:12px}.mapml-button{background-color:transparent;border:none;border-radius:0;color:inherit;font:inherit;line-height:inherit;margin:0;padding:0;overflow:hidden;text-align:inherit;text-transform:none;-webkit-appearance:none;-moz-appearance:none;appearance:none}.leaflet-container a{color:revert}.leaflet-container a.leaflet-popup-close-button,.leaflet-container a.leaflet-popup-close-button:hover,.leaflet-control-container a,.mapml-reload-button{color:#000}.mapml-layer-item-name a{color:revert}.leaflet-top .leaflet-control{margin-top:5px}.leaflet-left .leaflet-control{margin-left:5px}.leaflet-bar a,.mapml-reload-button{background-color:#fff;box-sizing:border-box;width:44px!important;height:44px!important;line-height:44px!important;font-size:34px!important;font-weight:400;text-align:center}.mapml-reload-button:not([aria-disabled=true]):hover{background-color:#f4f4f4}.mapml-reload-button[aria-disabled=true]{color:#bbb;cursor:default}.leaflet-control-layers-toggle{width:44px!important;height:44px!important}.leaflet-bar a,.leaflet-control-layers,.mapml-reload-button{border-color:#e3e3e3!important}.leaflet-control-layers,.mapml-reload-button{border-radius:4px!important}.leaflet-touch .leaflet-bar a:last-child{border-bottom-left-radius:4px!important;border-bottom-right-radius:4px!important}.leaflet-touch .leaflet-bar a:first-child{border-top-left-radius:4px!important;border-top-right-radius:4px!important}.leaflet-touch .leaflet-bar,.leaflet-touch .leaflet-control-layers{border-style:inherit}.leaflet-bar,.leaflet-control-layers,.leaflet-popup-content-wrapper,.leaflet-popup-tip,.leaflet-tooltip-pane .leaflet-tooltip,.leaflet-touch .leaflet-bar,.leaflet-touch .leaflet-control-layers,.mapml-contextmenu,.mapml-debug{box-shadow:0 1px 3px rgba(0,0,0,.2),0 1px 2px rgb(0,0,0,.3)}.leaflet-container .leaflet-control-attribution{background-color:rgba(255,255,255,.95)}.leaflet-control-attribution a{color:revert;text-decoration:revert}.leaflet-control-zoom-in,.leaflet-control-zoom-out{text-indent:unset}.leaflet-control-fullscreen a{background-image:url("data:image/svg+xml,%0A%3Csvg width='26' height='52' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg transform='translate(0 -1000.4)'%3E%3Cuse transform='translate(0 26)' width='100%25' height='100%25' xlink:href='%23a'/%3E%3Cuse transform='translate(0 26)' width='100%25' height='100%25' xlink:href='%23b'/%3E%3Cuse transform='translate(0 26)' width='100%25' height='100%25' xlink:href='%23c'/%3E%3Cuse transform='translate(0 26)' width='100%25' height='100%25' xlink:href='%23d'/%3E%3Cpath id='a' transform='translate(0 1000.4)' d='M5 15v6h6v-2H7v-4z' color='%23000' fill='%23404040'/%3E%3Cpath id='b' transform='translate(0 1000.4)' d='M21 15v6h-6v-2h4v-4z' color='%23000' fill='%23404040'/%3E%3Cpath d='M10 1037.4v4l1 1h4l1-1v-4l-1-1h-4z' color='%23000' fill='%23404040'/%3E%3Cpath id='d' d='M5 1011.4v-6h6v2H7v4z' color='%23000' fill='%23404040'/%3E%3Cpath id='c' d='M21 1011.4v-6h-6v2h4v4z' color='%23000' fill='%23404040'/%3E%3C/g%3E%3C/svg%3E");background-repeat:no-repeat;background-size:38px 76px;background-position:3px 3px}:host(.mapml-fullscreen-on) .leaflet-control-fullscreen a{background-position:3px -35px}:host(:-webkit-full-screen){width:100%!important;height:100%!important}:host(.mapml-fullscreen-on){width:100%!important;height:100%!important}:host(.leaflet-pseudo-fullscreen){position:fixed!important;width:100%!important;height:100%!important;top:0!important;left:0!important;z-index:99999}.leaflet-control-layers.leaflet-control{margin-right:5px;margin-left:5px;padding:0}.leaflet-control-layers-list{padding:0;text-transform:capitalize}.leaflet-control-layers fieldset{margin:0;padding:0;min-height:44px}.leaflet-control-layers label{display:inline}.mapml-control-layers>:not(summary){display:block;margin-block-start:5px;margin-inline-start:15px;width:calc(100% - 15px)}.mapml-layer-item-style>div{display:flex}.mapml-layer-item-style input{margin-inline-start:0}.leaflet-control .leaflet-control-layers-toggle{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M0 0h24v24H0V0z' fill='none'/%3E%3Cpath d='m11.99 18.54-7.37-5.73L3 14.07l9 7 9-7-1.63-1.27zM12 16l7.36-5.73L21 9l-9-7-9 7 1.63 1.27L12 16zm0-11.47L17.74 9 12 13.47 6.26 9 12 4.53z'/%3E%3C/svg%3E");background-size:34px}.leaflet-control-layers-selector{margin-top:revert;position:revert}.mapml-contextmenu{border-radius:4px;padding:4px 0;background-color:#fff;cursor:default;position:absolute;width:160px;z-index:10001}.mapml-contextmenu button.mapml-contextmenu-item{color:#222;font-size:12px;line-height:20px;text-decoration:none;padding:0 12px;border-top:1px solid transparent;border-bottom:1px solid transparent;cursor:default;width:100%}.mapml-contextmenu button.mapml-contextmenu-item.over{background-color:#f4f4f4;border-top:1px solid #f0f0f0;border-bottom:1px solid #f0f0f0}.mapml-contextmenu-separator{border-bottom:1px solid #e3e3e3;margin:5px 0}.mapml-contextmenu.mapml-submenu{width:80px;margin-bottom:-2rem}@supports (contain:layout){.mapml-contextmenu{position:fixed}.mapml-contextmenu.mapml-submenu{position:absolute}}.mapml-contextmenu-item[aria-controls] span::after{content:">"}@supports (list-style-type:disclosure-open){.mapml-contextmenu-item[aria-controls] span{display:inline-block}.mapml-contextmenu-item[aria-controls] span::after{content:"";display:list-item;list-style-type:disclosure-closed;margin-inline-start:20px}}.mapml-debug{contain:content;max-height:100%;max-width:100%;border-radius:4px;padding:5px 10px;background-color:#fff;cursor:default;z-index:1000;position:absolute;display:block;top:auto;right:5px;bottom:5px;left:5px;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;font:inherit}.mapml-debug-banner{font-weight:700;text-transform:uppercase;display:inline-block;text-align:left;text-align:inline-start;line-height:2}.mapml-debug-grid,.mapml-debug-panel{font-family:monospace}.mapml-debug-tile{text-indent:6px;line-height:1.8}.mapml-debug-coordinates{padding-left:4px;padding-right:4px}.mapml-debug,.mapml-debug *{border-collapse:collapse;border-spacing:0}.mapml-debug-coordinates:empty{display:none}.mapml-debug-coordinates>*{display:inline}:host(.mapml-fullscreen-on) .mapml-debug-grid{color:#fff;text-shadow:1px 1px 1px #000,1px 1px 1px #000}:host(.leaflet-drag-target) .leaflet-grab{cursor:move;cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}:host(.leaflet-drag-target) .leaflet-control{pointer-events:none}.leaflet-control :not([draggable=true]),.leaflet-popup-close-button,.mapml-contextmenu :not([draggable=true]),.mapml-popup-button{-webkit-user-drag:none}.leaflet-control,.mapml-contextmenu,.mapml-debug,.mapml-focus-buttons,.mapml-layer-item-settings summary{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.leaflet-control a::selection,.leaflet-control-attribution::selection,.leaflet-popup-close-button::selection{background-color:transparent}.leaflet-crosshair *,.leaflet-tooltip,.mapml-contextmenu-item>*,.mapml-layer-item-settings .mapml-control-layers summary label,.mapml-link-preview{pointer-events:none!important}.leaflet-container :focus{outline-color:-webkit-focus-ring-color!important;outline-style:auto!important;outline-width:thin!important;outline:revert!important}.leaflet-active:not(:focus){outline:unset!important}.leaflet-container:not(:focus-within) .mapml-outline{outline:0}.leaflet-container:not(:focus-within) .mapml-crosshair{display:none}.leaflet-control a{-webkit-tap-highlight-color:initial}.leaflet-zoom-box{border:thin dotted;background-color:rgba(255,255,255,.33)}button,input,label,summary{cursor:pointer}.mapml-draggable,.mapml-draggable *{cursor:row-resize}.leaflet-crosshair{cursor:crosshair}[hidden]{display:none!important}.leaflet-container .leaflet-control-container,.leaflet-container .mapml-contextmenu{visibility:unset!important}.mapml-crosshair{margin:-36px 0 0 -36px;width:72px;height:72px;left:50%;top:50%;position:absolute;z-index:10000}.mapml-popup-button{padding:0 4px 0 4px;border:none;text-align:center;font:16px/14px Tahoma,Verdana,sans-serif;color:inherit;text-decoration:none;font-weight:700;background:0 0;white-space:nowrap;box-sizing:border-box;width:44px;height:44px;line-height:44px}.mapml-focus-buttons{white-space:nowrap}.mapml-feature-count{display:inline;white-space:nowrap;text-align:center;padding:2px}.leaflet-container a.leaflet-popup-close-button,.mapml-focus-buttons button{width:44px;height:44px;min-width:44px;min-height:44px;line-height:44px}.leaflet-popup-content{margin:0;min-width:min-content}.mapml-popup-content{padding-top:44px}.mapml-focus-buttons{display:block;text-align:center}.mapml-focus-buttons button{display:inline-block;padding:0}.leaflet-container a.leaflet-popup-close-button{padding:0;font-size:20px}.leaflet-popup-content .mapml-feature-count{margin:0;padding:0 5px;line-height:44px}.mapml-popup-content hr:last-of-type{margin-bottom:0;border-bottom:0;border-top:1px solid #e3e3e3}.mapml-popup-content :first-child{margin-top:0;padding-top:0}.mapml-popup-content>:not(.mapml-focus-buttons){padding:0 1rem}.leaflet-popup-tip-container{margin-top:-1px}.mapml-outline{outline-style:auto;outline-offset:-2px;z-index:1000;pointer-events:none;position:absolute;height:100%;width:100%;color:initial}@media print{.leaflet-control{-webkit-print-color-adjust:exact;color-adjust:exact}}.leaflet-pane>svg g.leaflet-interactive,svg.leaflet-image-layer.leaflet-interactive g{pointer-events:visiblePainted;pointer-events:auto}.mapml-link-preview{position:absolute;left:0;bottom:0;background-color:#dee1e6;border-radius:0 5px 0 0;z-index:1050}.mapml-link-preview>p{margin:3px 5px 2px 3px;color:#3c4043}.mapml-button[aria-disabled=true],.mapml-layer-item:disabled button.mapml-button,button.mapml-button:disabled{opacity:.3}.mapml-button-icon{pointer-events:none}.mapml-button-icon svg{fill:currentColor}.mapml-layer-item,.mapml-layer-item *{box-sizing:border-box}.mapml-layer-extent,.mapml-layer-grouped-extents,.mapml-layer-item{background-color:#fff;border:1px solid #fff;margin:0;padding:0}.mapml-layer-item:not(:last-of-type){border-bottom:1px solid #e3e3e3}.mapml-layer-extent[aria-grabbed=true],.mapml-layer-item[aria-grabbed=true]{border:1px solid #e3e3e3;border-radius:0}.mapml-layer-extent:first-of-type,.mapml-layer-item:first-of-type{border-top-left-radius:4px;border-top-right-radius:4px}.mapml-layer-extent:last-of-type,.mapml-layer-item:last-of-type{border-bottom-left-radius:4px;border-bottom-right-radius:4px}.mapml-layer-item-properties{align-items:center;display:flex;justify-content:space-between;padding-inline-start:.5rem}.mapml-layer-item-controls{margin-inline-start:auto}.mapml-layer-item-controls button span{font-size:large;font-weight:900;vertical-align:middle}.mapml-layer-item-controls button svg{vertical-align:text-bottom}.mapml-layer-item-controls,.mapml-layer-item-remove-control,.mapml-layer-item-settings-control{align-items:center;display:flex;justify-content:center}.mapml-layer-item-remove-control,.mapml-layer-item-settings-control{min-height:44px;min-width:44px;height:44px;width:44px}label.mapml-layer-item-toggle{display:inline-flex;align-items:center;width:100%;min-height:44px}.mapml-layer-item-name{word-break:break-word;padding-block-start:.25rem;padding-block-end:.25rem;padding-inline-start:.25rem;padding-inline-end:1rem}.mapml-layer-item-settings>*{display:block;padding-block-start:.25rem;padding-block-end:.25rem;padding-inline-start:2rem;padding-inline-end:1rem}.mapml-screen-reader-output{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}.mapml-vector-container svg :is(
 [role=link]:focus,[role=link]:hover,[role=link]:focus path,[role=link]:hover path,[role=link] path:focus,[role=link] path:hover,[role=button]:focus,[role=button]:hover,[role=button]:focus path,[role=button]:hover path,[role=button] path:focus,[role=button] path:hover,path[tabindex="0"]:focus
 ){stroke:#0000EE;stroke:LinkText}.mapml-vector-container svg :is(
 [role=link]:focus:not(:focus-visible),[role=link]:focus:not(:focus-visible) path,[role=link] path:focus:not(:focus-visible),[role=button]:focus:not(:focus-visible),[role=button]:focus:not(:focus-visible) path,[role=button] path:focus:not(:focus-visible),path[tabindex="0"]:focus:not(:focus-visible)
-){outline:0!important}
\ No newline at end of file
+){outline:0!important}.mapml-layer-item-settings .mapml-layer-extent{padding-inline-start:1.8rem}.mapml-layer-item-settings .mapml-layer-extent .mapml-layer-item-properties{padding-inline-start:0}.mapml-layer-item-settings .mapml-layer-extent .mapml-layer-item-opacity{padding-inline-start:1.6rem}.mapml-layer-item-settings .mapml-layer-extent .mapml-layer-item-controls{position:absolute;right:0}
\ No newline at end of file
diff --git a/dist/mapml.js b/dist/mapml.js
index 7fc2a4c..731808f 100644
--- a/dist/mapml.js
+++ b/dist/mapml.js
@@ -228,6 +228,20 @@
             input[0].closest("fieldset").disabled = false;
             label[0].style.fontStyle = "normal";
           }
+          // check if an extent is disabled and disable it
+          if(this._layers[i].layer._extent && this._layers[i].layer._extent._mapExtents){
+            for(let j = 0; j < this._layers[i].layer._extent._mapExtents.length; j++){
+              let input = this._layers[i].layer._extent._mapExtents[j].extentAnatomy,
+                  label = input.getElementsByClassName("mapml-layer-item-name")[0];
+              if(this._layers[i].layer._extent._mapExtents[j].disabled && this._layers[i].layer._extent._mapExtents[j].checked){
+                label.style.fontStyle = "italic";
+                input.disabled = true;
+              } else {
+                label.style.fontStyle = "normal";
+                input.disabled = false;
+              }
+            }
+          }
         }
 
       },
@@ -303,7 +317,7 @@
 
         this._layers = {};
         if(this.options.query){
-          this._mapmlFeatures = mapml;
+          this._mapmlFeatures = mapml.features ? mapml.features: mapml;
           this.isVisible = true;
           let native = this._getNativeVariables(mapml);
           this.options.nativeZoom = native.zoom;
@@ -358,8 +372,8 @@
 
 
       showPaginationFeature: function(e){
-        if(this.options.query && this._mapmlFeatures.querySelectorAll("map-feature")[e.i]){
-          let feature = this._mapmlFeatures.querySelectorAll("map-feature")[e.i];
+        if(this.options.query && this._mapmlFeatures[e.i]){
+          let feature = this._mapmlFeatures[e.i];
           this.clearLayers();
           this.addData(feature, this.options.nativeCS, this.options.nativeZoom);
           e.popup._navigationBar.querySelector("p").innerText = (e.i + 1) + "/" + this.options._leafletLayer._totalFeatureCount;
@@ -638,10 +652,11 @@
         // options first...
         let inputData = M.extractInputBounds(template);
         this.zoomBounds = inputData.zoomBounds;
-        this.layerBounds=inputData.bounds;
+        this.extentBounds=inputData.bounds;
         this.isVisible = true;
         L.extend(options, this.zoomBounds);
         options.tms = template.tms;
+        delete options.opacity;
         L.setOptions(this, options);
         this._setUpTileTemplateVars(template);
 
@@ -673,16 +688,12 @@
         this._container = L.DomUtil.create('div', 'leaflet-layer', this.options.pane);
         L.DomUtil.addClass(this._container,'mapml-templated-tile-container');
         this._updateZIndex();
-
-        if (this.options.opacity < 1) {
-          this._updateOpacity();
-        }
       },
       _handleMoveEnd : function(e){
         let mapZoom = this._map.getZoom();
         let mapBounds = M.pixelToPCRSBounds(this._map.getPixelBounds(),mapZoom,this._map.options.projection);
         this.isVisible = mapZoom <= this.options.maxZoom && mapZoom >= this.options.minZoom && 
-                          this.layerBounds.overlaps(mapBounds);
+                          this.extentBounds.overlaps(mapBounds);
           if(!(this.isVisible))return;
         this._parentOnMoveEnd();
       },
@@ -1083,16 +1094,20 @@
       this._templates =  templates;
       L.setOptions(this, options);
       this._container = L.DomUtil.create('div', 'leaflet-layer', options.pane);
+      this._container.style.opacity = this.options.opacity;
       L.DomUtil.addClass(this._container,'mapml-templatedlayer-container');
 
       for (var i=0;i<templates.length;i++) {
         if (templates[i].rel === 'tile') {
+            this.setZIndex(options.extentZIndex);
             this._templates[i].layer = M.templatedTileLayer(templates[i], 
-              L.Util.extend(options, {errorTileUrl: "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==", zIndex: i, pane: this._container}));
+              L.Util.extend(options, {errorTileUrl: "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==", zIndex: options.extentZIndex, pane: this._container}));
         } else if (templates[i].rel === 'image') {
-            this._templates[i].layer = M.templatedImageLayer(templates[i], L.Util.extend(options, {zIndex: i, pane: this._container}));
+            this.setZIndex(options.extentZIndex);
+            this._templates[i].layer = M.templatedImageLayer(templates[i], L.Util.extend(options, {zIndex: options.extentZIndex, pane: this._container}));
         } else if (templates[i].rel === 'features') {
-            this._templates[i].layer = M.templatedFeaturesLayer(templates[i], L.Util.extend(options, {zIndex: i, pane: this._container}));
+            this.setZIndex(options.extentZIndex);
+            this._templates[i].layer = M.templatedFeaturesLayer(templates[i], L.Util.extend(options, {zIndex: options.extentZIndex, pane: this._container}));
         } else if (templates[i].rel === 'query') {
             // add template to array of queryies to be added to map and processed
             // on click/tap events
@@ -1101,7 +1116,7 @@
               this._queries = [];
             }
             let inputData = M.extractInputBounds(templates[i]);
-            templates[i].layerBounds = inputData.bounds;
+            templates[i].extentBounds = inputData.bounds;
             templates[i].zoomBounds = inputData.zoomBounds;
             this._queries.push(L.extend(templates[i], this._setupQueryVars(templates[i])));
         }
@@ -1124,7 +1139,6 @@
         this.closePopup();
     },
 
-
     _setupQueryVars: function(template) {
         // process the inputs associated to template and create an object named
         // query with member properties as follows:
@@ -1248,7 +1262,7 @@
         queryVarNames.query.title = template.title;
         return queryVarNames;
     },
-    reset: function (templates) {
+    reset: function (templates, extentZIndex) {
       if (!templates) {return;}
       if (!this._map) {return;}
       var addToMap = this._map && this._map.hasLayer(this),
@@ -1260,11 +1274,11 @@
       for (var i=0;i<templates.length;i++) {
         if (templates[i].rel === 'tile') {
             this._templates[i].layer = M.templatedTileLayer(templates[i],
-              L.Util.extend(this.options, {errorTileUrl: "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==", zIndex: i, pane: this._container}));
+              L.Util.extend(this.options, {errorTileUrl: "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==", zIndex: extentZIndex, pane: this._container}));
         } else if (templates[i].rel === 'image') {
-            this._templates[i].layer = M.templatedImageLayer(templates[i], L.Util.extend(this.options, {zIndex: i, pane: this._container}));
+            this._templates[i].layer = M.templatedImageLayer(templates[i], L.Util.extend(this.options, {zIndex: extentZIndex, pane: this._container}));
         } else if (templates[i].rel === 'features') {
-            this._templates[i].layer = M.templatedFeaturesLayer(templates[i], L.Util.extend(this.options, {zIndex: i, pane: this._container}));
+            this._templates[i].layer = M.templatedFeaturesLayer(templates[i], L.Util.extend(this.options, {zIndex: extentZIndex, pane: this._container}));
         } else if (templates[i].rel === 'query') {
             if (!this._queries) {
               this._queries = [];
@@ -1288,17 +1302,22 @@
         }
       }
     },
-  //  setZIndex: function (zIndex) {
-  //      this.options.zIndex = zIndex;
-  //      this._updateZIndex();
-  //
-  //      return this;
-  //  },
-  //  _updateZIndex: function () {
-  //      if (this._container && this.options.zIndex !== undefined && this.options.zIndex !== null) {
-  //          this._container.style.zIndex = this.options.zIndex;
-  //      }
-  //  },
+    //addTo: function(map) {
+      //for(let i = 0; i < this._templates.length; i++){
+    //    this._templates[0].layer.addTo(map);
+      //}
+    //},
+    setZIndex: function (zIndex) {
+        this.options.zIndex = zIndex;
+        this._updateZIndex();
+
+        return this;
+    },
+    _updateZIndex: function () {
+        if (this._container && this.options.zIndex !== undefined && this.options.zIndex !== null) {
+            this._container.style.zIndex = this.options.zIndex;
+        }
+    },
     onRemove: function (map) {
       L.DomUtil.remove(this._container);
       for (var i=0;i<this._templates.length;i++) {
@@ -1322,6 +1341,10 @@
       }
     },
 
+    changeOpacity: function(opacity){
+      this._container.style.opacity = opacity;
+    },
+
   });
   var templatedLayer = function(templates, options) {
     // templates is an array of template objects
@@ -1336,12 +1359,13 @@
       initialize: function(template, options) {
         let inputData = M.extractInputBounds(template);
         this.zoomBounds = inputData.zoomBounds;
-        this.layerBounds=inputData.bounds;
+        this.extentBounds=inputData.bounds;
         this.isVisible = true;
         this._template = template;
         this._container = L.DomUtil.create('div', 'leaflet-layer', options.pane);
         L.extend(options, this.zoomBounds);
         L.DomUtil.addClass(this._container, 'mapml-features-container');
+        delete options.opacity;
         L.setOptions(this, L.extend(options,this._setUpFeaturesTemplateVars(template)));
       },
       getEvents: function () {
@@ -1412,7 +1436,7 @@
         let mapZoom = this._map.getZoom();
         let mapBounds = M.pixelToPCRSBounds(this._map.getPixelBounds(),mapZoom,this._map.options.projection);
         this.isVisible = mapZoom <= this.zoomBounds.maxZoom && mapZoom >= this.zoomBounds.minZoom && 
-                          this.layerBounds.overlaps(mapBounds);
+                          this.extentBounds.overlaps(mapBounds);
         
         this._features.clearLayers();
         if(!(this.isVisible)){
@@ -1607,8 +1631,9 @@
           L.DomUtil.addClass(this._container, 'mapml-image-container');
           let inputData = M.extractInputBounds(template);
           this.zoomBounds = inputData.zoomBounds;
-          this.layerBounds=inputData.bounds;
+          this.extentBounds=inputData.bounds;
           this.isVisible = true;
+          delete options.opacity;
           L.extend(options, this.zoomBounds);
           L.setOptions(this, L.extend(options,this._setUpExtentTemplateVars(template)));
       },
@@ -1638,7 +1663,7 @@
         let mapZoom = this._map.getZoom();
         let mapBounds = M.pixelToPCRSBounds(this._map.getPixelBounds(),mapZoom,this._map.options.projection);
         this.isVisible = mapZoom <= this.zoomBounds.maxZoom && mapZoom >= this.zoomBounds.minZoom && 
-                          this.layerBounds.overlaps(mapBounds);
+                          this.extentBounds.overlaps(mapBounds);
         if(!(this.isVisible)){
           this._clearLayer();
           return;
@@ -1905,8 +1930,7 @@
           // OR use the extent of the content provided
 
           if (!mapml && content && content.hasAttribute('label')) this._title = content.getAttribute('label');
-          this._initCount = 0;
-          this._initExtent(mapml ? content : null);
+          this._initialize(mapml ? content : null);
           
           // a default extent can't be correctly set without the map to provide
           // its bounds , projection, zoom range etc, so if that stuff's not
@@ -1931,6 +1955,19 @@
               this._container.style.zIndex = this.options.zIndex;
           }
       },
+      // remove all the extents before removing the layer from the map
+      _removeExtents: function(map){
+        if(this._extent._mapExtents){
+          for(let i = 0; i < this._extent._mapExtents.length; i++){
+            if(this._extent._mapExtents[i].templatedLayer){
+              map.removeLayer(this._extent._mapExtents[i].templatedLayer);
+            }
+          }
+        }
+        if (this._extent._queries) {
+          delete this._extent._queries;
+        }
+      },
       _changeOpacity: function(e) {
         if (e && e.target && e.target.value >=0 && e.target.value <= 1.0) {
           this.changeOpacity(e.target.value);
@@ -1940,8 +1977,36 @@
           this._container.style.opacity = opacity;
           if(this.opacityEl) this.opacityEl.value = opacity;
       },
+      _changeExtentOpacity: function(e){
+        if(e && e.target && e.target.value >=0 && e.target.value <= 1.0){
+          this.templatedLayer.changeOpacity(e.target.value);
+          this._templateVars.opacity = e.target.value;
+        }
+      },
+      _changeExtent: function(e, extentEl) {
+          if(e.target.checked){
+            extentEl.checked = true;
+            if(this._layerEl.checked){
+                extentEl.templatedLayer = M.templatedLayer(extentEl._templateVars, 
+                  { pane: this._container,
+                    opacity: extentEl._templateVars.opacity,
+                    _leafletLayer: this,
+                    crs: extentEl.crs,
+                    extentZIndex: extentEl.extentZIndex
+                  }).addTo(this._map);
+                  extentEl.templatedLayer.setZIndex();
+                  this._setLayerElExtent();  
+              }       
+          } else {
+              L.DomEvent.stopPropagation(e);
+              extentEl.checked = false;
+              if(this._layerEl.checked) this._map.removeLayer(extentEl.templatedLayer);
+              this._setLayerElExtent();
+          }
+      },
+
       onAdd: function (map) {
-          if(this._extent && !this._validProjection(map)){
+          if((this._extent || this._extent_mapExtents) && !this._validProjection(map)){
             this.validProjection = false;
             return;
           }
@@ -1971,6 +2036,7 @@
                 }
               });
             }
+            this._setLayerElExtent();
             map.addLayer(this._mapmlvectors);
           } else {
             this.once('extentload', function() {
@@ -2028,89 +2094,134 @@
               tileSize: map.options.crs.options.crs.tile.bounds.max.x,
             });
             map.addLayer(this._staticTileLayer);
+            this._setLayerElExtent();
           }
-
+          
+          const createAndAdd = createAndAddTemplatedLayers.bind(this);
           // if the extent has been initialized and received, update the map,
-          if (this._extent) {
-              if (this._templateVars) {
-                this._templatedLayer = M.templatedLayer(this._templateVars, 
-                { pane: this._container,
-                  _leafletLayer: this,
-                  crs: this.crs
-                }).addTo(map);
-              }
-          } else {
-              this.once('extentload', function() {
-                  if(!this._validProjection(map)){
-                    this.validProjection = false;
-                    return;
-                  }
-                  if (this._templateVars) {
-                    this._templatedLayer = M.templatedLayer(this._templateVars, 
-                    { pane: this._container,
-                      _leafletLayer: this,
-                      crs: this.crs
-                    }).addTo(map);
-                    this._setLayerElExtent();
-                  }
-                }, this);
+          if (this._extent && this._extent._mapExtents && this._extent._mapExtents[0]._templateVars) {
+            createAndAdd();
+          } else { // wait for extent to be loaded
+            this.once('extentload', function() {
+                if(!this._validProjection(map)){
+                  this.validProjection = false;
+                  return;
+                }
+                createAndAdd();
+              }, this);
           }
-          this._setLayerElExtent();
           this.setZIndex(this.options.zIndex);
           this.getPane().appendChild(this._container);
           setTimeout(() => {
             map.fire('checkdisabled');
           }, 0);
           map.on("popupopen", this._attachSkipButtons, this);
+          
+          function createAndAddTemplatedLayers() {
+            if(this._extent && this._extent._mapExtents){
+              for(let i = 0; i < this._extent._mapExtents.length; i++){
+                if (this._extent._mapExtents[i]._templateVars && this._extent._mapExtents[i].checked) {
+                  if(!this._extent._mapExtents[i].extentZIndex) this._extent._mapExtents[i].extentZIndex = i;
+                  this._templatedLayer = M.templatedLayer(this._extent._mapExtents[i]._templateVars, 
+                    { pane: this._container,
+                      opacity: this._extent._mapExtents[i]._templateVars.opacity,
+                      _leafletLayer: this,
+                      crs: this._extent.crs,
+                      extentZIndex: this._extent._mapExtents[i].extentZIndex,
+                      }).addTo(map);   
+                      this._extent._mapExtents[i].templatedLayer = this._templatedLayer;
+                      if(this._templatedLayer._queries){
+                        if(!this._extent._queries) this._extent._queries = [];
+                        this._extent._queries = this._extent._queries.concat(this._templatedLayer._queries);
+                      }
+                }
+               }
+              this._setLayerElExtent();
+            }
+          }
       },
 
+
       _validProjection : function(map){
         let noLayer = false;
-        if(this._templateVars){
-          for(let template of this._templateVars)
-            if(!template.projectionMatch && template.projection !== map.options.projection) noLayer = true;
+        if(this._extent && this._extent._mapExtents){
+          for(let i = 0; i < this._extent._mapExtents.length; i++){
+            if(this._extent._mapExtents[i]._templateVars){
+              for(let template of this._extent._mapExtents[i]._templateVars)
+                if(!template.projectionMatch && template.projection !== map.options.projection) {
+                  noLayer = true; // if there's a single template where projections don't match, set noLayer to true
+                  break;
+                } 
+              }
         }
+      }
         return !(noLayer || this.getProjection() !== map.options.projection.toUpperCase());
       },
 
       //sets the <layer-> elements .bounds property 
       _setLayerElExtent: function(){
-        let localBounds, localZoomRanges;
+        let bounds, zoomMax, zoomMin, maxNativeZoom, minNativeZoom,
+            zoomBounds = {minZoom: 0, maxZoom: 0, maxNativeZoom: 0, minNativeZoom: 0};
         let layerTypes = ["_staticTileLayer","_imageLayer","_mapmlvectors","_templatedLayer"];
         layerTypes.forEach((type) =>{
           if(this[type]){
             if(type === "_templatedLayer"){
-              for(let j =0;j<this[type]._templates.length;j++){
-                if(this[type]._templates[j].rel === "query") continue;
-                if(this[type]._templates[j].layer.layerBounds){
-                  if(!localBounds){
-                    localBounds = this[type]._templates[j].layer.layerBounds;
-                    localZoomRanges = this[type]._templates[j].layer.zoomBounds;
-                  } else {
-                    localBounds.extend(this[type]._templates[j].layer.layerBounds.min);
-                    localBounds.extend(this[type]._templates[j].layer.layerBounds.max);
+              for(let i = 0; i < this._extent._mapExtents.length; i++){
+                for(let j = 0; j < this._extent._mapExtents[i]._templateVars.length; j++){
+                  let inputData = M.extractInputBounds(this._extent._mapExtents[i]._templateVars[j]);
+                  this._extent._mapExtents[i]._templateVars[j].tempExtentBounds = inputData.bounds;
+                  this._extent._mapExtents[i]._templateVars[j].extentZoomBounds = inputData.zoomBounds;
+                }
+              }
+              for(let i = 0; i < this._extent._mapExtents.length; i++){
+                if(this._extent._mapExtents[i].checked){
+                  for(let j = 0; j < this._extent._mapExtents[i]._templateVars.length; j++){
+                    if(!bounds){
+                      bounds = this._extent._mapExtents[i]._templateVars[j].tempExtentBounds;
+                      zoomMax = this._extent._mapExtents[i]._templateVars[j].extentZoomBounds.maxZoom;
+                      zoomMin = this._extent._mapExtents[i]._templateVars[j].extentZoomBounds.minZoom;
+                      maxNativeZoom = this._extent._mapExtents[i]._templateVars[j].extentZoomBounds.maxNativeZoom;
+                      minNativeZoom = this._extent._mapExtents[i]._templateVars[j].extentZoomBounds.minNativeZoom;
+                    } else {
+                      bounds.extend(this._extent._mapExtents[i]._templateVars[j].tempExtentBounds.min);
+                      bounds.extend(this._extent._mapExtents[i]._templateVars[j].tempExtentBounds.max);
+                      zoomMax = Math.max(zoomMax, this._extent._mapExtents[i]._templateVars[j].extentZoomBounds.maxZoom);
+                      zoomMin = Math.min(zoomMin, this._extent._mapExtents[i]._templateVars[j].extentZoomBounds.minZoom);
+                      maxNativeZoom = Math.max(maxNativeZoom, this._extent._mapExtents[i]._templateVars[j].extentZoomBounds.maxNativeZoom);
+                      minNativeZoom = Math.min(minNativeZoom, this._extent._mapExtents[i]._templateVars[j].extentZoomBounds.minNativeZoom);
+                    }
                   }
                 }
               }
+              zoomBounds.minZoom = zoomMin;
+              zoomBounds.maxZoom = zoomMax;
+              zoomBounds.minNativeZoom = minNativeZoom;
+              zoomBounds.maxNativeZoom = maxNativeZoom;
+              this._extent.zoomBounds = zoomBounds;
+              this._extent.layerBounds = bounds;
+              // assign each template the layer and zoom bounds
+              for(let i = 0; i < this._extent._mapExtents.length; i++){
+                this._extent._mapExtents[i].templatedLayer.layerBounds = bounds;
+                this._extent._mapExtents[i].templatedLayer.zoomBounds = zoomBounds;
+              }
             } else {
               if(this[type].layerBounds){
-                if(!localBounds){
-                  localBounds = this[type].layerBounds;
-                  localZoomRanges = this[type].zoomBounds;
+                if(!bounds){
+                  bounds = this[type].layerBounds;
+                  zoomBounds = this[type].zoomBounds;
                 } else {
-                  localBounds.extend(this[type].layerBounds.min);
-                  localBounds.extend(this[type].layerBounds.max);
+                  bounds.extend(this[type].layerBounds.min);
+                  bounds.extend(this[type].layerBounds.max);
                 }
               } 
             }
           }
         });
-
-        if(localBounds){
+        if(bounds){
           //assigns the formatted extent object to .extent and spreads the zoom ranges to .extent also
           this._layerEl.extent = (Object.assign(
-                                    M.convertAndFormatPCRS(localBounds,this._map),
-                                    {zoom:localZoomRanges}));
+                                    M.convertAndFormatPCRS(bounds,this._map),
+                                    {zoom:zoomBounds}));
         }
       },
 
@@ -2123,16 +2234,28 @@
       },
       redraw: function() {
         // for now, only redraw templated layers.
-          if (this._templatedLayer) {
-            this._templatedLayer.redraw();
+          if (this._extent._mapExtents) {
+            for(let i = 0; i < this._extent._mapExtents.length; i++){
+              if(this._extent._mapExtents[i].templatedLayer){
+                this._extent._mapExtents[i].templatedLayer.redraw();
+              }
+            }
           }
       },
       _onZoomAnim: function(e) {
+        // get the min and max zooms from all extents
         var toZoom = e.zoom,
-            zoom = this._extent ? this._extent.querySelector("map-input[type=zoom]") : null, 
+            zoom = (this._extent && this._extent._mapExtents) ? this._extent._mapExtents[0].querySelector("map-input[type=zoom]") : null,
             min = zoom && zoom.hasAttribute("min") ? parseInt(zoom.getAttribute("min")) : this._map.getMinZoom(),
-            max =  zoom && zoom.hasAttribute("max") ? parseInt(zoom.getAttribute("max")) : this._map.getMaxZoom(),
-            canZoom = (toZoom < min && this._extent.zoomout) || (toZoom > max && this._extent.zoomin);
+            max =  zoom && zoom.hasAttribute("max") ? parseInt(zoom.getAttribute("max")) : this._map.getMaxZoom();
+        if(zoom){
+          for(let i = 1; i < this._extent._mapExtents.length; i++){
+            zoom = this._extent._mapExtents[i].querySelector("map-input[type=zoom]");
+            if(zoom && zoom.hasAttribute("min")) { min = Math.min(parseInt(zoom.getAttribute("min")), min); }
+            if(zoom && zoom.hasAttribute("max")){ max = Math.max(parseInt(zoom.getAttribute("max")), max); }
+          }
+        }
+        var canZoom = (toZoom < min && this._extent.zoomout) || (toZoom > max && this._extent.zoomin);
         if (!(min <= toZoom && toZoom <= max)){
           if (this._extent.zoomin && toZoom > max) {
             // this._href is the 'original' url from which this layer came
@@ -2157,100 +2280,181 @@
           if(this._staticTileLayer) map.removeLayer(this._staticTileLayer);
           if(this._mapmlvectors) map.removeLayer(this._mapmlvectors);
           if(this._imageLayer) map.removeLayer(this._imageLayer);
-          if (this._templatedLayer) map.removeLayer(this._templatedLayer);
+          if (this._extent && this._extent._mapExtents) this._removeExtents(map);
 
           map.fire("checkdisabled");
           map.off("popupopen", this._attachSkipButtons);
       },
-      getZoomBounds: function () {
-          var ext = this._extent;
-          var zoom = ext ? ext.querySelector('[type=zoom]') : undefined,
-              min = zoom && zoom.hasAttribute('min') ? zoom.getAttribute('min') : this._map.getMinZoom(),
-              max = zoom && zoom.hasAttribute('max') ? zoom.getAttribute('max') : this._map.getMaxZoom();
-          var bounds = {};
-          bounds.min = Math.min(min,max);
-          bounds.max = Math.max(min,max);
-          return bounds;
-      },
-      _transformDeprectatedInput: function (i) {
-        var type = i.getAttribute("type").toLowerCase();
-        if (type === "xmin" || type === "ymin" || type === "xmax" || type === "ymax") {
-          i.setAttribute("type", "location");
-          i.setAttribute("units","tcrs");
-          switch (type) {
-            case "xmin":
-              i.setAttribute("axis","x");
-              i.setAttribute("position","top-left");
-              break;
-            case "ymin":
-              i.setAttribute("axis","y");
-              i.setAttribute("position","top-left");
-              break;
-            case "xmax":
-              i.setAttribute("axis","x");
-              i.setAttribute("position","bottom-right");
-              break;
-            case "ymax":
-              i.setAttribute("axis","y");
-              i.setAttribute("position","bottom-right");
-              break;
-          }
-        } 
-      },
-      // retrieve the (projected, scaled) layer extent for the current map zoom level
-      getLayerExtentBounds: function(map) {
-          
-          if (!this._extent) return;
-          var zoom = map.getZoom(), projection = map.options.projection,
-              ep = this._extent.getAttribute("units"),
-              projecting = (projection !== ep),
-              p;
-          
-          var xmin,ymin,xmax,ymax,v1,v2,extentZoomValue;
-          
-          // todo: create an array of min values, converted to tcrs units
-          // take the Math.min of all of them.
-          v1 = this._extent.querySelector('[type=xmin]').getAttribute('min');
-          v2 = this._extent.querySelector('[type=xmax]').getAttribute('min');
-          xmin = Math.min(v1,v2);
-          v1 = this._extent.querySelector('[type=xmin]').getAttribute('max');
-          v2 = this._extent.querySelector('[type=xmax]').getAttribute('max');
-          xmax = Math.max(v1,v2);
-          v1 = this._extent.querySelector('[type=ymin]').getAttribute('min');
-          v2 = this._extent.querySelector('[type=ymax]').getAttribute('min');
-          ymin = Math.min(v1,v2);
-          v1 = this._extent.querySelector('[type=ymin]').getAttribute('max');
-          v2 = this._extent.querySelector('[type=ymax]').getAttribute('max');
-          ymax = Math.max(v1,v2);
-          // WGS84 can be converted to Tiled CRS units
-          if (projecting) {
-              //project and scale to M[projection] from WGS84
-              p = M[projection];
-              var corners = [
-                p.latLngToPoint(L.latLng([ymin,xmin]),zoom),
-                p.latLngToPoint(L.latLng([ymax,xmax]),zoom), 
-                p.latLngToPoint(L.latLng([ymin,xmin]),zoom), 
-                p.latLngToPoint(L.latLng([ymin,xmax]),zoom)
-              ];
-              return L.bounds(corners);
-          } else {
-              // if the zoom level of the extent does not match that of the map
-              extentZoomValue = parseInt(this._extent.querySelector('[type=zoom]').getAttribute('value'));
-              if (extentZoomValue !== zoom) {
-                  // convert the extent bounds to corresponding bounds at the current map zoom
-                  p = M[projection];
-                  return L.bounds(
-                      p.latLngToPoint(p.pointToLatLng(L.point(xmin,ymin),extentZoomValue),zoom),
-                      p.latLngToPoint(p.pointToLatLng(L.point(xmax,ymax),extentZoomValue),zoom));
-              } else {
-                  // the extent's zoom value === map.getZoom(), return the bounds
-                  return L.bounds(L.point(xmin,ymin), L.point(xmax,ymax));
-              }
-          }
-      },
       getAttribution: function () {
           return this.options.attribution;
       },
+
+      getLayerExtentHTML: function (labelName, i) {
+        var extent = L.DomUtil.create('fieldset', 'mapml-layer-extent'),
+          extentProperties = L.DomUtil.create('div', 'mapml-layer-item-properties', extent),
+          extentSettings = L.DomUtil.create('div', 'mapml-layer-item-settings', extent),
+          extentLabel = L.DomUtil.create('label', 'mapml-layer-item-toggle', extentProperties),
+          input = L.DomUtil.create('input'),
+          svgExtentControlIcon = L.SVG.create('svg'),
+          extentControlPath1 = L.SVG.create('path'),
+          extentControlPath2 = L.SVG.create('path'),
+          extentNameIcon = L.DomUtil.create('span'),
+          extentItemControls = L.DomUtil.create('div', 'mapml-layer-item-controls', extentProperties),
+          opacityControl = L.DomUtil.create('details', 'mapml-layer-item-opacity', extentSettings),
+          extentOpacitySummary = L.DomUtil.create('summary', '', opacityControl),
+          mapEl = this._layerEl.parentNode,
+          layerEl = this._layerEl,
+          opacity = L.DomUtil.create('input', '', opacityControl);
+          extentSettings.hidden = true;
+          extent.setAttribute("aria-grabbed", "false");
+          if(!labelName){ // if a label attribute is not present, set it to hidden in layer control
+            extent.setAttribute("hidden", "");
+            this._extent._mapExtents[i].hidden = true;
+          }
+
+          // append the svg paths
+          svgExtentControlIcon.setAttribute('viewBox', '0 0 24 24');
+          svgExtentControlIcon.setAttribute('height', '22');
+          svgExtentControlIcon.setAttribute('width', '22');
+          extentControlPath1.setAttribute('d', 'M0 0h24v24H0z');
+          extentControlPath1.setAttribute('fill', 'none');
+          extentControlPath2.setAttribute('d', 'M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z');
+          svgExtentControlIcon.appendChild(extentControlPath1);
+          svgExtentControlIcon.appendChild(extentControlPath2);
+
+          let removeExtentButton = L.DomUtil.create('button', 'mapml-layer-item-remove-control', extentItemControls);
+          removeExtentButton.type = 'button';
+          removeExtentButton.title = 'Remove Sub Layer';
+          removeExtentButton.innerHTML = "<span aria-hidden='true'>&#10005;</span>";
+          removeExtentButton.classList.add('mapml-button');
+          L.DomEvent.on(removeExtentButton, 'click', L.DomEvent.stop);
+          L.DomEvent.on(removeExtentButton, 'click', (e)=>{
+            let allRemoved = true;
+            e.target.checked = false;
+            this._extent._mapExtents[i].removed = true;
+            this._extent._mapExtents[i].checked = false;
+            if(this._layerEl.checked) this._changeExtent(e, this._extent._mapExtents[i]);
+            this._extent._mapExtents[i].extentAnatomy.parentNode.removeChild(this._extent._mapExtents[i].extentAnatomy);
+            for(let j = 0; j < this._extent._mapExtents.length; j++){
+              if(!this._extent._mapExtents[j].removed) allRemoved = false;
+            }
+            if(allRemoved) this._layerItemSettingsHTML.removeChild(this._extentGroupAnatomy); 
+          }, this);
+
+          let extentsettingsButton = L.DomUtil.create('button', 'mapml-layer-item-settings-control', extentItemControls);
+          extentsettingsButton.type = 'button';
+          extentsettingsButton.title = 'Extent Settings';
+          extentsettingsButton.setAttribute('aria-expanded', false);
+          extentsettingsButton.classList.add('mapml-button');
+          L.DomEvent.on(extentsettingsButton, 'click', (e)=>{
+            if(extentSettings.hidden == true){
+              extentsettingsButton.setAttribute('aria-expanded', true);
+              extentSettings.hidden = false;
+            } else {
+              extentsettingsButton.setAttribute('aria-expanded', false);
+              extentSettings.hidden = true;
+            }
+          }, this);
+
+          extentNameIcon.setAttribute('aria-hidden', true);
+          extentLabel.appendChild(input);
+          extentsettingsButton.appendChild(extentNameIcon);
+          extentNameIcon.appendChild(svgExtentControlIcon);
+          extentOpacitySummary.innerText = 'Opacity';
+          extentOpacitySummary.id = 'mapml-layer-item-opacity-' + L.stamp(extentOpacitySummary);
+          opacity.setAttribute('type','range');
+          opacity.setAttribute('min', '0');
+          opacity.setAttribute('max','1.0');
+          opacity.setAttribute('value', this._extent._mapExtents[i]._templateVars.opacity || '1.0');
+          opacity.setAttribute('step','0.1');
+          opacity.setAttribute('aria-labelledby', 'mapml-layer-item-opacity-' + L.stamp(extentOpacitySummary));
+          this._extent._mapExtents[i]._templateVars.opacity = this._extent._mapExtents[i]._templateVars.opacity || '1.0';
+          L.DomEvent.on(opacity, 'change', this._changeExtentOpacity, this._extent._mapExtents[i]);
+
+          var extentItemNameSpan = L.DomUtil.create('span', 'mapml-layer-item-name', extentLabel);
+          input.defaultChecked = this._extent._mapExtents[i] ? true: false;
+          this._extent._mapExtents[i].checked = input.defaultChecked;
+          input.type = 'checkbox';
+          extentItemNameSpan.innerHTML = labelName;
+          L.DomEvent.on(input, 'change', (e)=>{
+            this._changeExtent(e, this._extent._mapExtents[i]);
+          });
+          extentItemNameSpan.id = 'mapml-extent-item-name-{' + L.stamp(extentItemNameSpan) + '}';
+          extent.setAttribute('aria-labelledby', extentItemNameSpan.id);
+          extentItemNameSpan.extent = this._extent._mapExtents[i];
+
+          extent.onmousedown = (downEvent) => {
+            if(downEvent.target.tagName.toLowerCase() === "input" || downEvent.target.tagName.toLowerCase() === "select") return;
+            downEvent.preventDefault();
+            downEvent.stopPropagation();
+
+            let control = extent,
+                controls = extent.parentNode,
+                moving = false, yPos = downEvent.clientY;
+
+                document.body.onmousemove = (moveEvent) => {
+                  moveEvent.preventDefault();
+      
+                  // Fixes flickering by only moving element when there is enough space
+                  let offset = moveEvent.clientY - yPos;
+                  moving = Math.abs(offset) > 5 || moving;
+                  if( (controls && !moving) || (controls && controls.childElementCount <= 1) || 
+                      controls.getBoundingClientRect().top > control.getBoundingClientRect().bottom || 
+                      controls.getBoundingClientRect().bottom < control.getBoundingClientRect().top){
+                        return;
+                      }
+                  
+                  controls.classList.add("mapml-draggable");
+                  control.style.transform = "translateY("+ offset +"px)";
+                  control.style.pointerEvents = "none";
+      
+                  let x = moveEvent.clientX, y = moveEvent.clientY,
+                      root = mapEl.tagName === "MAPML-VIEWER" ? mapEl.shadowRoot : mapEl.querySelector(".mapml-web-map").shadowRoot,
+                      elementAt = root.elementFromPoint(x, y),
+                      swapControl = !elementAt || !elementAt.closest("fieldset") ? control : elementAt.closest("fieldset");
+            
+                  swapControl =  Math.abs(offset) <= swapControl.offsetHeight ? control : swapControl;
+                  
+                  control.setAttribute("aria-grabbed", 'true');
+                  control.setAttribute("aria-dropeffect", "move");
+                  if(swapControl && controls === swapControl.parentNode){
+                    swapControl = swapControl !== control.nextSibling? swapControl : swapControl.nextSibling;
+                    if(control !== swapControl){ 
+                      yPos = moveEvent.clientY;
+                      control.style.transform = null;
+                    }
+                    controls.insertBefore(control, swapControl);
+                  }
+                };
+
+                document.body.onmouseup = () => {
+                  control.setAttribute("aria-grabbed", "false");
+                  control.removeAttribute("aria-dropeffect");
+                  control.style.pointerEvents = null;
+                  control.style.transform = null;
+                  let controlsElems = controls.children,
+                      zIndex = 0;
+                  for(let c of controlsElems){
+                    let extentEl = c.querySelector("span").extent;
+                    
+                    extentEl.setAttribute("data-moving","");
+                    layerEl.insertAdjacentElement("beforeend", extentEl);
+                    extentEl.removeAttribute("data-moving");
+      
+                    extentEl.extentZIndex = zIndex;
+                    extentEl.templatedLayer.setZIndex(zIndex);
+                    zIndex++;
+                  }
+                  controls.classList.remove("mapml-draggable");
+                  document.body.onmousemove = document.body.onmouseup = null;
+                };
+
+                
+          };
+
+          return extent;
+      },
+
       getLayerUserControlsHTML: function () {
         var fieldset = L.DomUtil.create('fieldset', 'mapml-layer-item'),
           input = L.DomUtil.create('input'),
@@ -2266,6 +2470,7 @@
           svgSettingsControlIcon = L.SVG.create('svg'),
           settingsControlPath1 = L.SVG.create('path'),
           settingsControlPath2 = L.SVG.create('path'),
+          extentsFieldset = L.DomUtil.create('fieldset', 'mapml-layer-grouped-extents'),
           mapEl = this._layerEl.parentNode;
           this.opacityEl = opacity;
 
@@ -2427,9 +2632,10 @@
           if (this._styles) {
             layerItemSettings.appendChild(this._styles);
           }
+
           if (this._userInputs) {
             var frag = document.createDocumentFragment();
-            var templates = this._templateVars;
+            var templates = this._extent._templateVars;
             if (templates) {
               for (var i=0;i<templates.length;i++) {
                 var template = templates[i];
@@ -2453,9 +2659,23 @@
             }
             layerItemSettings.appendChild(frag);
           }
+
+          // if there are extents, add them to the layer control
+          if(this._extent && this._extent._mapExtents) {
+            var allHidden = true;
+            this._layerItemSettingsHTML = layerItemSettings;
+            this._extentGroupAnatomy = extentsFieldset;
+            extentsFieldset.setAttribute('aria-label', 'Sublayers');
+            for(let j=0; j < this._extent._mapExtents.length; j++) {
+              extentsFieldset.appendChild(this._extent._mapExtents[j].extentAnatomy);
+              if(!this._extent._mapExtents[j].hidden) allHidden = false;
+            }
+            if(!allHidden) layerItemSettings.appendChild(extentsFieldset);
+          }
+
           return fieldset;
       },
-      _initExtent: function(content) {
+      _initialize: function(content) {
           if (!this._href && !content) {return;}
           var layer = this;
           // the this._href (comes from layer@src) should take precedence over 
@@ -2517,201 +2737,225 @@
               return select;
           }
 
+          function _initTemplateVars(serverExtent, metaExtent, projection, mapml, base, projectionMatch){
+            var templateVars = [];
+            // set up the URL template and associated inputs (which yield variable values when processed)
+            var tlist = serverExtent.querySelectorAll('map-link[rel=tile],map-link[rel=image],map-link[rel=features],map-link[rel=query]'),
+                varNamesRe = (new RegExp('(?:\{)(.*?)(?:\})','g')),
+                zoomInput = serverExtent.querySelector('map-input[type="zoom" i]'),
+                includesZoom = false, extentFallback = {};
+
+            extentFallback.zoom = 0;
+            if (metaExtent){
+              let content = M.metaContentToObject(metaExtent.getAttribute("content")), cs;
+              
+              extentFallback.zoom = content.zoom || extentFallback.zoom;
+
+              let metaKeys = Object.keys(content);
+              for(let i =0;i<metaKeys.length;i++){
+                if(!metaKeys[i].includes("zoom")){
+                  cs = M.axisToCS(metaKeys[i].split("-")[2]);
+                  break;
+                }
+              }
+              let axes = M.csToAxes(cs);
+              extentFallback.bounds = M.boundsToPCRSBounds(
+                L.bounds(L.point(+content[`top-left-${axes[0]}`],+content[`top-left-${axes[1]}`]),
+                L.point(+content[`bottom-right-${axes[0]}`],+content[`bottom-right-${axes[1]}`])),
+                extentFallback.zoom, projection, cs);
+              
+            } else {
+              extentFallback.bounds = M[projection].options.crs.pcrs.bounds;
+            }
+              
+            for (var i=0;i< tlist.length;i++) {
+              var t = tlist[i], template = t.getAttribute('tref'); 
+              if(!template){
+                template = BLANK_TT_TREF;
+                let blankInputs = mapml.querySelectorAll('map-input');
+                for (let i of blankInputs){
+                  template += `{${i.getAttribute("name")}}`;
+                }
+              }
+              
+              var v,
+                  title = t.hasAttribute('title') ? t.getAttribute('title') : 'Query this layer',
+                  vcount=template.match(varNamesRe),
+                  trel = (!t.hasAttribute('rel') || t.getAttribute('rel').toLowerCase() === 'tile') ? 'tile' : t.getAttribute('rel').toLowerCase(),
+                  ttype = (!t.hasAttribute('type')? 'image/*':t.getAttribute('type').toLowerCase()),
+                  inputs = [],
+                  tms = t && t.hasAttribute("tms");
+                  var zoomBounds = mapml.querySelector('map-meta[name=zoom]')?
+                                    M.metaContentToObject(mapml.querySelector('map-meta[name=zoom]').getAttribute('content')):
+                                    undefined;
+              while ((v = varNamesRe.exec(template)) !== null) {
+                var varName = v[1],
+                    inp = serverExtent.querySelector('map-input[name='+varName+'],map-select[name='+varName+']');
+                if (inp) {
+
+                  if ((inp.hasAttribute("type") && inp.getAttribute("type")==="location") && 
+                      (!inp.hasAttribute("min" )) && 
+                      (inp.hasAttribute("axis") && !["i","j"].includes(inp.getAttribute("axis").toLowerCase()))){
+                    zoomInput.setAttribute("value", extentFallback.zoom);
+                    
+                    let axis = inp.getAttribute("axis"), 
+                        axisBounds = M.convertPCRSBounds(extentFallback.bounds, extentFallback.zoom, projection, M.axisToCS(axis));
+                    inp.setAttribute("min", axisBounds.min[M.axisToXY(axis)]);
+                    inp.setAttribute("max", axisBounds.max[M.axisToXY(axis)]);
+                  }
+
+                  inputs.push(inp);
+                  includesZoom = includesZoom || inp.hasAttribute("type") && inp.getAttribute("type").toLowerCase() === "zoom";
+                  if (inp.hasAttribute('shard')) {
+                    var id = inp.getAttribute('list');
+                    inp.servers = [];
+                    var servers = serverExtent.querySelectorAll('map-datalist#'+id + ' > map-option');
+                    if (servers.length === 0 && inp.hasAttribute('value')) {
+                      servers = inp.getAttribute('value').split('');
+                    }
+                    for (var s=0;s < servers.length;s++) {
+                      if (servers[s].getAttribute) {
+                        inp.servers.push(servers[s].getAttribute('value'));
+                      } else {
+                        inp.servers.push(servers[s]);
+                      }
+                    }
+                  } else if (inp.tagName.toLowerCase() === 'map-select') {
+                    // use a throwaway div to parse the input from MapML into HTML
+                    var div =document.createElement("div");
+                    div.insertAdjacentHTML("afterbegin",inp.outerHTML);
+                    // parse
+                    inp.htmlselect = div.querySelector("map-select");
+                    inp.htmlselect = transcribe(inp.htmlselect);
+
+                    // this goes into the layer control, so add a listener
+                    L.DomEvent.on(inp.htmlselect, 'change', layer.redraw, layer);
+                    if (!layer._userInputs) {
+                      layer._userInputs = [];
+                    }
+                    layer._userInputs.push(inp.htmlselect);
+                  }
+                  // TODO: if this is an input@type=location 
+                  // get the TCRS min,max attribute values at the identified zoom level 
+                  // save this information as properties of the serverExtent,
+                  // perhaps as a bounds object so that it can be easily used
+                  // later by the layer control to determine when to enable
+                  // disable the layer for drawing.
+                } else {
+                  console.log('input with name='+varName+' not found for template variable of same name');
+                  // no match found, template won't be used
+                  break;
+                }
+              }
+              if (template && vcount.length === inputs.length || template === BLANK_TT_TREF) {
+                if (trel === 'query') {
+                  layer.queryable = true;
+                }
+                if(!includesZoom && zoomInput) {
+                  inputs.push(zoomInput);
+                }
+                // template has a matching input for every variable reference {varref}
+                templateVars.push({
+                  template:decodeURI(new URL(template, base)), 
+                  linkEl: t,
+                  title:title, 
+                  rel: trel, 
+                  type: ttype, 
+                  values: inputs, 
+                  zoomBounds:zoomBounds,
+                  extentPCRSFallback: {bounds: extentFallback.bounds}, 
+                  projectionMatch: projectionMatch,
+                  projection:serverExtent.getAttribute("units") || FALLBACK_PROJECTION,
+                  tms:tms,
+                });
+              }
+            }
+            return templateVars;
+          }
+
           function _processInitialExtent(content) {
+            //TODO: include inline extents
               var mapml = this.responseXML || content;
               if(mapml.querySelector && mapml.querySelector('map-feature'))layer._content = mapml;
               if(!this.responseXML && this.responseText) mapml = new DOMParser().parseFromString(this.responseText,'text/xml');
               if (this.readyState === this.DONE && mapml.querySelector && !mapml.querySelector("parsererror")) {
-                  var serverExtent = mapml.querySelector('map-extent') || mapml.querySelector('map-meta[name=projection]'), projection;
-
-                  if (serverExtent.tagName.toLowerCase() === "map-extent" && serverExtent.hasAttribute('units')){
-                    projection = serverExtent.getAttribute("units");
-                  } else if (serverExtent.tagName.toLowerCase() === "map-meta" && serverExtent.hasAttribute('content')) {
-                    projection = M.metaContentToObject(serverExtent.getAttribute('content')).content;
-                  }
+                  var serverExtent = mapml.querySelectorAll('map-extent'), projection, projectionMatch, serverMeta;
                       
-                  var projectionMatch = projection && projection === layer.options.mapprojection,
-                      metaExtent = mapml.querySelector('map-meta[name=extent]'),
+                  
+                  if(!serverExtent.length){
+                    serverMeta = mapml.querySelector('map-meta[name=projection]');
+                  }
+
+                  // check whether all map-extent elements have the same units
+                  if(serverExtent.length >= 1){
+                    for(let i = 0; i < serverExtent.length; i++){
+                      if (serverExtent[i].tagName.toLowerCase() === "map-extent" && serverExtent[i].hasAttribute('units')){
+                        projection = serverExtent[i].getAttribute("units");
+                      }
+                      projectionMatch = projection && projection === layer.options.mapprojection;
+                      if(!projectionMatch){
+                        break;
+                      }
+                    }
+                  } else if(serverMeta){
+                    if (serverMeta.tagName.toLowerCase() === "map-meta" && serverMeta.hasAttribute('content')) {
+                      projection = M.metaContentToObject(serverMeta.getAttribute('content')).content;
+                      projectionMatch = projection && projection === layer.options.mapprojection;
+                    }
+                  }  
+                  
+                  var metaExtent = mapml.querySelector('map-meta[name=extent]'),
                       selectedAlternate = !projectionMatch && mapml.querySelector('map-head map-link[rel=alternate][projection='+layer.options.mapprojection+']'),
                       
                       base = 
         (new URL(mapml.querySelector('map-base') ? mapml.querySelector('map-base').getAttribute('href') : mapml.baseURI || this.responseURL, this.responseURL)).href;
                   
-                  if (!serverExtent) {
-                      serverExtent = layer._synthesizeExtent(mapml);
-                      // the mapml resource does not have a (complete) extent form, save
-                      // its content if any so we don't have to revisit the server, ever.
-                      if (mapml.querySelector('map-feature,map-tile')) {
-                          layer._content = mapml;
-                      }
-                  } else if (!projectionMatch && selectedAlternate && selectedAlternate.hasAttribute('href')) {
+                  if (!projectionMatch && selectedAlternate && selectedAlternate.hasAttribute('href')) {
                        
                       layer.fire('changeprojection', {href:  (new URL(selectedAlternate.getAttribute('href'), base)).href}, false);
                       return;
                   } else if (!projectionMatch && layer._map && layer._map.options.mapEl.querySelectorAll("layer-").length === 1){
                     layer._map.options.mapEl.projection = projection;
                     return;
-                  } else if (serverExtent.querySelector('map-link[rel=tile],map-link[rel=image],map-link[rel=features],map-link[rel=query]') &&
-                          serverExtent.hasAttribute("units")) {
-                    layer._templateVars = [];
-                    // set up the URL template and associated inputs (which yield variable values when processed)
-                    var tlist = serverExtent.querySelectorAll('map-link[rel=tile],map-link[rel=image],map-link[rel=features],map-link[rel=query]'),
-                        varNamesRe = (new RegExp('(?:\{)(.*?)(?:\})','g')),
-                        zoomInput = serverExtent.querySelector('map-input[type="zoom" i]'),
-                        includesZoom = false, extentFallback = {};
-
-                    extentFallback.zoom = 0;
-                    if (metaExtent){
-                      // if the extent is not in PCRS or GCRS, the user should supply
-                      // a zoom=n key within the meta content, so that the PCRS bounds
-                      // can be calculated
-                      let content = M.metaContentToObject(metaExtent.getAttribute("content"));
-                      
-                      // the extentFallback.zoom is used to calculate the PCRS bounds
-                      extentFallback.zoom = content.zoom || extentFallback.zoom;
-      
-                      let metaKeys = Object.keys(content);
-                      for(let i =0;i<metaKeys.length;i++){
-                        if(!metaKeys[i].includes("zoom")){
-                          // deduce the CS from the first recognized axis name, quit
-                          extentFallback.cs = M.axisToCS(metaKeys[i].split("-")[2]);
-                          break;
-                        }
-                      }
-                      let axes = M.csToAxes(extentFallback.cs);
-                      extentFallback.bounds = M.boundsToPCRSBounds(
-                        L.bounds(L.point(+content[`top-left-${axes[0]}`],+content[`top-left-${axes[1]}`]),
-                        L.point(+content[`bottom-right-${axes[0]}`],+content[`bottom-right-${axes[1]}`])),
-                        extentFallback.zoom, projection, extentFallback.cs);
-                      
-                    } else {
-                      extentFallback.bounds = M[projection].options.crs.pcrs.bounds;
-                      extentFallback.cs = "PCRS";
+                  } else if (!serverMeta){
+                    layer._extent = {};
+                    if(projectionMatch){
+                      layer._extent.crs = M[projection];
                     }
-                      
-                    for (var i=0;i< tlist.length;i++) {
-                      var t = tlist[i], template = t.getAttribute('tref'); 
-                      if(!template){
-                        template = BLANK_TT_TREF;
-                        let blankInputs = mapml.querySelectorAll('map-input');
-                        for (let i of blankInputs){
-                          template += `{${i.getAttribute("name")}}`;
-                        }
-                      }
-                      
-                      var v,
-                          title = t.hasAttribute('title') ? t.getAttribute('title') : 'Query this layer',
-                          vcount=template.match(varNamesRe),
-                          trel = (!t.hasAttribute('rel') || t.getAttribute('rel').toLowerCase() === 'tile') ? 'tile' : t.getAttribute('rel').toLowerCase(),
-                          ttype = (!t.hasAttribute('type')? 'image/*':t.getAttribute('type').toLowerCase()),
-                          inputs = [],
-                          tms = t && t.hasAttribute("tms");
-                          var zoomBounds = mapml.querySelector('map-meta[name=zoom]')?
-                                            M.metaContentToObject(mapml.querySelector('map-meta[name=zoom]').getAttribute('content')):
-                                            undefined;
-                      while ((v = varNamesRe.exec(template)) !== null) {
-                        var varName = v[1],
-                            inp = serverExtent.querySelector('map-input[name='+varName+'],map-select[name='+varName+']');
-                        if (inp) {
-                          // if location input is missing min/max, force set the
-                          // fallback min/max from the extentFallback
-                          if ((inp.hasAttribute("type") && inp.getAttribute("type")==="location") && 
-                              (!inp.hasAttribute("min" )) && 
-                              (inp.hasAttribute("axis") && !["i","j"].includes(inp.getAttribute("axis").toLowerCase()))){
-                            zoomInput.setAttribute("value", extentFallback.zoom);
-                            // set location input min/max axis values based on calculated 
-                            // and potentially converted from PCRS bounds read
-                            // from the <map-meta> element.  This is a fallback, but it only
-                            // works when the file includes location inputs.
-                            let axis = inp.getAttribute("axis"), 
-                                axisBounds = M.convertPCRSBounds(extentFallback.bounds, extentFallback.zoom, projection, M.axisToCS(axis));
-                            inp.setAttribute("min", axisBounds.min[M.axisToXY(axis)]);
-                            inp.setAttribute("max", axisBounds.max[M.axisToXY(axis)]);
-                          }
-
-                          inputs.push(inp);
-                          includesZoom = includesZoom || inp.hasAttribute("type") && inp.getAttribute("type").toLowerCase() === "zoom";
-                          if (inp.hasAttribute('shard')) {
-                            var id = inp.getAttribute('list');
-                            inp.servers = [];
-                            var servers = serverExtent.querySelectorAll('map-datalist#'+id + ' > map-option');
-                            if (servers.length === 0 && inp.hasAttribute('value')) {
-                              servers = inp.getAttribute('value').split('');
-                            }
-                            for (var s=0;s < servers.length;s++) {
-                              if (servers[s].getAttribute) {
-                                inp.servers.push(servers[s].getAttribute('value'));
-                              } else {
-                                inp.servers.push(servers[s]);
-                              }
-                            }
-                          } else if (inp.tagName.toLowerCase() === 'map-select') {
-                            // use a throwaway div to parse the input from MapML into HTML
-                            var div =document.createElement("div");
-                            div.insertAdjacentHTML("afterbegin",inp.outerHTML);
-                            // parse
-                            inp.htmlselect = div.querySelector("map-select");
-                            inp.htmlselect = transcribe(inp.htmlselect);
-
-                            // this goes into the layer control, so add a listener
-                            L.DomEvent.on(inp.htmlselect, 'change', layer.redraw, layer);
-                            if (!layer._userInputs) {
-                              layer._userInputs = [];
-                            }
-                            layer._userInputs.push(inp.htmlselect);
-                          }
-                          // TODO: if this is an input@type=location 
-                          // get the TCRS min,max attribute values at the identified zoom level 
-                          // save this information as properties of the serverExtent,
-                          // perhaps as a bounds object so that it can be easily used
-                          // later by the layer control to determine when to enable
-                          // disable the layer for drawing.
-                        } else {
-                          console.log('input with name='+varName+' not found for template variable of same name');
-                          // no match found, template won't be used
-                          break;
-                        }
-                      }
-                      if (template && vcount.length === inputs.length || template === BLANK_TT_TREF) {
-                        if (trel === 'query') {
-                          layer.queryable = true;
-                        }
-                        if(!includesZoom && zoomInput) {
-                          inputs.push(zoomInput);
-                        }
-                        // template has a matching input for every variable reference {varref}
-                        layer._templateVars.push({
-                          template:decodeURI(new URL(template, base)), 
-                          linkEl: t,
-                          title:title, 
-                          rel: trel, 
-                          type: ttype, 
-                          values: inputs, 
-                          zoomBounds:zoomBounds, 
-                          extentPCRSFallback: {bounds: extentFallback.bounds}, 
-                          projectionMatch: projectionMatch || selectedAlternate,
-                          projection:serverExtent.getAttribute("units") || FALLBACK_PROJECTION,
-                          tms:tms,
-                        });
-                      }
-                    }
-                  }
-                  layer._parseLicenseAndLegend(mapml, layer);
-                  layer._extent = serverExtent;
-                  
-                  
+                    layer._extent._mapExtents = []; // stores all the map-extent elements in the layer
+                    layer._extent._templateVars = []; // stores all template variables coming from all extents
+                    for(let j = 0; j < serverExtent.length; j++){
+                      if (serverExtent[j].querySelector('map-link[rel=tile],map-link[rel=image],map-link[rel=features],map-link[rel=query]') &&
+                          serverExtent[j].hasAttribute("units")) {
+                            layer._extent._mapExtents.push(serverExtent[j]);
+                            projectionMatch = projectionMatch || selectedAlternate;
+                            let templateVars = _initTemplateVars.call(layer, serverExtent[j], metaExtent, projection, mapml, base, projectionMatch);
+                            layer._extent._mapExtents[j]._templateVars = templateVars;
+                            layer._extent._templateVars = layer._extent._templateVars.concat(templateVars);
+                          } 
+                        }     
+                  } else {
+                    layer._extent = serverMeta;
+                  }  
+                  layer._parseLicenseAndLegend(mapml, layer, projection);
+
                   var zoomin = mapml.querySelector('map-link[rel=zoomin]'),
                       zoomout = mapml.querySelector('map-link[rel=zoomout]');
                   delete layer._extent.zoomin;
                   delete layer._extent.zoomout;
                   if (zoomin) {
-                      layer._extent.zoomin = (new URL(zoomin.getAttribute('href'), base)).href;
+                    layer._extent.zoomin = (new URL(zoomin.getAttribute('href'), base)).href;
                   }
                   if (zoomout) {
-                      layer._extent.zoomout = (new URL(zoomout.getAttribute('href'), base)).href;
+                    layer._extent.zoomout = (new URL(zoomout.getAttribute('href'), base)).href;
                   }
-                  if (layer._templatedLayer) {
-                    layer._templatedLayer.reset(layer._templateVars);
+                  if (layer._extent._mapExtents) {
+                    for(let i = 0; i < layer._extent._mapExtents.length; i++){
+                      if(layer._extent._mapExtents[i].templatedLayer){
+                        layer._extent._mapExtents[i].templatedLayer.reset(layer._extent._mapExtents[i]._templateVars, layer._extent._mapExtents[i].extentZIndex);
+                      }
+                    }
+                    
                   }
                   if (mapml.querySelector('map-tile')) {
                     var tiles = document.createElement("map-tiles"),
@@ -2724,6 +2968,16 @@
                     layer._mapmlTileContainer.appendChild(tiles);
                   }
                   M.parseStylesheetAsHTML(mapml, base, layer._container);
+
+                  // add multiple extents
+                  if(layer._extent._mapExtents){
+                    for(let j = 0; j < layer._extent._mapExtents.length; j++){
+                      var labelName = layer._extent._mapExtents[j].getAttribute('label');
+                      var extentElement = layer.getLayerExtentHTML(labelName, j);
+                      layer._extent._mapExtents[j].extentAnatomy = extentElement;
+                    }
+                  }
+
                   var styleLinks = mapml.querySelectorAll('map-link[rel=style],map-link[rel="self style"],map-link[rel="style self"]');
                   if (styleLinks.length > 1) {
                     var stylesControl = document.createElement('details'),
@@ -2739,7 +2993,7 @@
                       styleOptionInput = styleOption.appendChild(document.createElement('input'));
                       styleOptionInput.setAttribute("type", "radio");
                       styleOptionInput.setAttribute("id", "rad-"+L.stamp(styleOptionInput));
-                      styleOptionInput.setAttribute("name", "styles-"+layer._title);
+                      styleOptionInput.setAttribute("name", "styles-"+this._title);
                       styleOptionInput.setAttribute("value", styleLinks[j].getAttribute('title'));
                       styleOptionInput.setAttribute("data-href", new URL(styleLinks[j].getAttribute('href'),base).href);
                       var styleOptionLabel = styleOption.appendChild(document.createElement('label'));
@@ -2776,191 +3030,38 @@
               layer._layerEl.dispatchEvent(new CustomEvent('extentload', {detail: layer,}));
           }
       },
-      _createExtent: function () {
-      
-          var extent = document.createElement('map-extent'),
-              xminInput = document.createElement('map-input'),
-              yminInput = document.createElement('map-input'),
-              xmaxInput = document.createElement('map-input'),
-              ymaxInput = document.createElement('map-input'),
-              zoom = document.createElement('map-input'),
-              projection = document.createElement('map-input');
-      
-          zoom.setAttribute('type','zoom');
-          zoom.setAttribute('min','0');
-          zoom.setAttribute('max','0');
-          
-          xminInput.setAttribute('type','xmin');
-          xminInput.setAttribute('min','');
-          xminInput.setAttribute('max','');
-          
-          yminInput.setAttribute('type','ymin');
-          yminInput.setAttribute('min','');
-          yminInput.setAttribute('max','');
-          
-          xmaxInput.setAttribute('type','xmax');
-          xmaxInput.setAttribute('min','');
-          xmaxInput.setAttribute('max','');
-
-          ymaxInput.setAttribute('type','ymax');
-          ymaxInput.setAttribute('min','');
-          ymaxInput.setAttribute('max','');
-          
-          projection.setAttribute('type','projection');
-          projection.setAttribute('value','WGS84');
-          
-          extent.appendChild(xminInput);
-          extent.appendChild(yminInput);
-          extent.appendChild(xmaxInput);
-          extent.appendChild(ymaxInput);
-          extent.appendChild(zoom);
-          extent.appendChild(projection);
-
-          return extent;
-      },
       _validateExtent: function () {
         // TODO: change so that the _extent bounds are set based on inputs
-          var serverExtent = this._extent;
-          if (!serverExtent || !serverExtent.querySelector || !this._map) {
+        if(!this._extent || !this._map){
+          return;
+        }
+        var serverExtent = this._extent._mapExtents ? this._extent._mapExtents : [this._extent], lp;
+          
+          // loop through the map-extent elements and assign each one its crs
+          for(let i = 0; i < serverExtent.length; i++){
+            if (!serverExtent[i].querySelector) {
               return;
-          }
-          if (serverExtent.querySelector('[type=xmin][min=""], [type=xmin][max=""], [type=xmax][min=""], [type=xmax][max=""], [type=ymin][min=""], [type=ymin][max=""]')) {
-              var xmin = serverExtent.querySelector('[type=xmin]'),
-                  ymin = serverExtent.querySelector('[type=ymin]'),
-                  xmax = serverExtent.querySelector('[type=xmax]'),
-                  ymax = serverExtent.querySelector('[type=ymax]'),
-                  proj = serverExtent.querySelector('[type=projection][value]'),
-                  bounds, projection;
-              if (proj) {
-                  projection = proj.getAttribute('value');
-                  if (projection && projection === 'WGS84') {
-                      bounds = this._map.getBounds();
-                      xmin.setAttribute('min',bounds.getWest());
-                      xmin.setAttribute('max',bounds.getEast());
-                      ymin.setAttribute('min',bounds.getSouth());
-                      ymin.setAttribute('max',bounds.getNorth());
-                      xmax.setAttribute('min',bounds.getWest());
-                      xmax.setAttribute('max',bounds.getEast());
-                      ymax.setAttribute('min',bounds.getSouth());
-                      ymax.setAttribute('max',bounds.getNorth());
-                  } else if (projection) {
-                      // needs testing.  Also, this will likely be
-                      // messing with a server-generated extent.
-                      bounds = this._map.getPixelBounds();
-                      xmin.setAttribute('min',bounds.getBottomLeft().x);
-                      xmin.setAttribute('max',bounds.getTopRight().x);
-                      ymin.setAttribute('min',bounds.getTopRight().y);
-                      ymin.setAttribute('max',bounds.getBottomLeft().y);
-                      xmax.setAttribute('min',bounds.getBottomLeft().x);
-                      xmax.setAttribute('max',bounds.getTopRight().x);
-                      ymax.setAttribute('min',bounds.getTopRight().y);
-                      ymax.setAttribute('max',bounds.getBottomLeft().y);
-                  }
-              } else {
-                  this.error = true;
-              }
-
-          }
-          if (serverExtent.querySelector('[type=zoom][min=""], [type=zoom][max=""]')) {
-              var zoom = serverExtent.querySelector('[type=zoom]');
+            }
+          if (serverExtent[i].querySelector('[type=zoom][min=""], [type=zoom][max=""]')) {
+              var zoom = serverExtent[i].querySelector('[type=zoom]');
               zoom.setAttribute('min',this._map.getMinZoom());
               zoom.setAttribute('max',this._map.getMaxZoom());
           }
-          var lp = serverExtent.hasAttribute("units") ? serverExtent.getAttribute("units") : null;
-          if (lp && M[lp]) {
-            this.crs = M[lp];
-          } else {
-            this.crs = M.OSMTILE;
-          }
-      },
-      _getMapMLExtent: function (bounds, zooms, proj) {
-          
-          var extent = this._createExtent(),
-              zoom = extent.querySelector('map-input[type=zoom]'),
-              xminInput = extent.querySelector('map-input[type=xmin]'),
-              yminInput = extent.querySelector('map-input[type=ymin]'),
-              xmaxInput = extent.querySelector('map-input[type=xmax]'),
-              ymaxInput = extent.querySelector('map-input[type=ymax]'),
-              projection = extent.querySelector('map-input[type=projection]'),
-              zmin = zooms[0] !== undefined && zooms[1] !== undefined ? Math.min(zooms[0],zooms[1]) : '',
-              zmax = zooms[0] !== undefined && zooms[1] !== undefined ? Math.max(zooms[0],zooms[1]) : '',
-              xmin = bounds ? bounds._southWest ? bounds.getWest() : bounds.getBottomLeft().x : '',
-              ymin = bounds ? bounds._southWest ? bounds.getSouth() : bounds.getTopRight().y : '',
-              xmax = bounds ? bounds._southWest ? bounds.getEast() : bounds.getTopRight().x : '',
-              ymax = bounds ? bounds._southWest ? bounds.getNorth() : bounds.getBottomLeft().y : '';
-      
-          zoom.setAttribute('min', typeof(zmin) === 'number' && isNaN(zmin)? '' : zmin);
-          zoom.setAttribute('max', typeof(zmax) === 'number' && isNaN(zmax)? '' : zmax);
-          
-          xminInput.setAttribute('min',xmin);
-          xminInput.setAttribute('max',xmax);
-          
-          yminInput.setAttribute('min',ymin);
-          yminInput.setAttribute('max',ymax);
-          
-          xmaxInput.setAttribute('min',xmin);
-          xmaxInput.setAttribute('max',xmax);
-
-          ymaxInput.setAttribute('min',ymin);
-          ymaxInput.setAttribute('max',ymax);
-          
-          projection.setAttribute('value',bounds && bounds._southWest && !proj ? 'WGS84' : proj);
-
-          return extent;
-      },
-      _synthesizeExtent: function (mapml) {
-          var metaZoom = mapml.querySelectorAll('map-meta[name=zoom]')[0],
-              metaExtent = mapml.querySelector('map-meta[name=extent]'),
-              metaProjection = mapml.querySelector('map-meta[name=projection]'),
-              proj = metaProjection ? metaProjection.getAttribute('content'): FALLBACK_PROJECTION,
-              i,expressions,bounds,zmin,zmax,xmin,ymin,xmax,ymax,expr,lhs,rhs;
-          if (metaZoom) {
-              expressions = metaZoom.getAttribute('content').split(',');
-              for (i=0;i<expressions.length;i++) {
-                expr = expressions[i].split('=');
-                lhs = expr[0];
-                rhs=expr[1];
-                if (lhs === 'min') {
-                  zmin = parseInt(rhs);
-                }
-                if (lhs === 'max') {
-                  zmax = parseInt(rhs);
-                }
-              }
-          }  
-          if (metaExtent) {
-              expressions = metaExtent.getAttribute('content').split(',');
-              for (i=0;i<expressions.length;i++) {
-                expr = expressions[i].split('=');
-                lhs = expr[0];
-                rhs=expr[1];
-                if (lhs === 'xmin') {
-                  xmin = parseFloat(rhs);
-                }
-                if (lhs === 'xmax') {
-                  xmax = parseFloat(rhs);
-                }
-                if (lhs === 'ymin') {
-                  ymin = parseFloat(rhs);
-                }
-                if (lhs === 'ymax') {
-                  ymax = parseFloat(rhs);
-                }
-              }
-          }
-          if (xmin && ymin && xmax && ymax && proj === 'WGS84') {
-              var sw = L.latLng(ymin,xmin), ne = L.latLng(ymax,xmax);
-              bounds = L.latLngBounds(sw,ne);
-          } else if (xmin && ymin && xmax && ymax) {
-              // needs testing
-              bounds = L.bounds([[xmin,ymin],[xmax,ymax]]);
+            lp = serverExtent[i].hasAttribute("units") ? serverExtent[i].getAttribute("units") : null;
+            if (lp && M[lp]) {
+              if(this._extent._mapExtents) this._extent._mapExtents[i].crs = M[lp];
+              else this._extent.crs = M[lp];
+            } else {
+              if(this._extent._mapExtents) this._extent._mapExtents[i].crs = M.OSMTILE;
+              else this._extent.crs = M.OSMTILE;
+            }
           }
-          return this._getMapMLExtent(bounds, [zmin,zmax], proj);
       },
       // a layer must share a projection with the map so that all the layers can
       // be overlayed in one coordinate space.  WGS84 is a 'wildcard', sort of.
       getProjection: function () {
-        let extent = this._extent;
+        if(!this._extent) { return; }
+        let extent = this._extent._mapExtents ? this._extent._mapExtents[0] : this._extent; // the projections for each extent eould be the same (as) validated in _validProjection, so can use mapExtents[0]
         if(!extent) return FALLBACK_PROJECTION;
         switch (extent.tagName.toUpperCase()) {
           case "MAP-EXTENT":
@@ -2993,29 +3094,16 @@
             layer._legendUrl = legendLink.getAttribute('href');
           }
       },
-      // return the LatLngBounds of the map unprojected such that the whole
-      // map is covered, not just a band defined by the projected map bounds.
-      _getUnprojectedMapLatLngBounds: function(map) {
-        
-          map = map||this._map; 
-          var origin = map.getPixelOrigin(),
-            bounds = map.getPixelBounds(),
-            nw = map.unproject(origin),
-            sw = map.unproject(bounds.getBottomLeft()),
-            ne = map.unproject(bounds.getTopRight()),
-            se = map.unproject(origin.add(map.getSize()));
-          return L.latLngBounds(sw,ne).extend(se).extend(nw);
-      },
-      // this takes into account that WGS84 is considered a wildcard match.
-      _projectionMatches: function(map) {
-          map = map||this._map;
-          var projection = this.getProjection();
-          if (!map.options.projection || projection !== 'WGS84' && map.options.projection !== projection) return false;
-          return true;
-      },
-      getQueryTemplates: function() {
-          if (this._templatedLayer && this._templatedLayer._queries) {
-            return this._templatedLayer._queries;
+      getQueryTemplates: function(pcrsClick) {
+          if (this._extent && this._extent._queries) {
+            var templates = [];
+            // only return queries that are in bound
+            for(let i = 0; i < this._extent._queries.length; i++){
+              if(this._extent._queries[i].extentBounds.contains(pcrsClick)){
+                templates.push(this._extent._queries[i]);
+              }
+            }
+            return templates;
           }
       },
       _attachSkipButtons: function(e){
@@ -3344,13 +3432,23 @@
       this.addLayer(this._centerVector);
 
       for (let i of id) {
-        if (layers[i].layerBounds) {
-          let boundsArray = [
-            layers[i].layerBounds.min,
-            L.point(layers[i].layerBounds.max.x, layers[i].layerBounds.min.y),
-            layers[i].layerBounds.max,
-            L.point(layers[i].layerBounds.min.x, layers[i].layerBounds.max.y)
-          ];
+        if (layers[i].layerBounds || layers[i].extentBounds) {
+          let boundsArray;
+          if(layers[i].layerBounds){
+            boundsArray = [
+              layers[i].layerBounds.min,
+              L.point(layers[i].layerBounds.max.x, layers[i].layerBounds.min.y),
+              layers[i].layerBounds.max,
+              L.point(layers[i].layerBounds.min.x, layers[i].layerBounds.max.y)
+            ];
+          } else {
+            boundsArray = [
+              layers[i].extentBounds.min,
+              L.point(layers[i].extentBounds.max.x, layers[i].extentBounds.min.y),
+              layers[i].extentBounds.max,
+              L.point(layers[i].extentBounds.min.x, layers[i].extentBounds.max.y)
+            ];
+          }        
           let boundsRect = projectedExtent(boundsArray, {
             color: colors[j % colors.length],
             weight: 2,
@@ -3465,15 +3563,14 @@
       _queryTopLayer: function(event) {
           var layer = this._getTopQueryableLayer();
           if (layer) {
+              if(layer._mapmlFeatures) delete layer._mapmlFeatures;
               this._query(event, layer);
           }
       },
       _query(e, layer) {
-        var obj = {},
-            template = layer.getQueryTemplates()[0],
-            zoom = e.target.getZoom(),
+        var zoom = e.target.getZoom(),
             map = this._map,
-            crs = layer.crs,
+            crs = layer._extent.crs, // the crs for each extent would be the same
             tileSize = map.options.crs.options.crs.tile.bounds.max.x,
             container = layer._container,
             popupOptions = {autoClose: false, autoPan: true, maxHeight: (map.getSize().y * 0.5) - 50},
@@ -3487,7 +3584,45 @@
             tileMatrixClickLoc = tcrsClickLoc.divideBy(tileSize).floor(),
             tileBounds = new L.Bounds(tcrsClickLoc.divideBy(tileSize).floor().multiplyBy(tileSize), 
             tcrsClickLoc.divideBy(tileSize).ceil().multiplyBy(tileSize));
-    
+
+        let point = this._map.project(e.latlng),
+            scale = this._map.options.crs.scale(this._map.getZoom()),
+            pcrsClick = this._map.options.crs.transformation.untransform(point,scale),
+            contenttype;
+        var templates = layer.getQueryTemplates(pcrsClick);
+
+        var fetchFeatures = function(template, obj, lastOne) {
+          fetch(L.Util.template(template.template, obj), { redirect: 'follow' }).then((response) => {
+          contenttype = response.headers.get("Content-Type");
+          if (response.status >= 200 && response.status < 300) {
+            return response.text();
+          } else {
+            throw new Error(response.status);
+          }
+        }).then((mapml) => {
+          if (contenttype.startsWith("text/mapml")) {
+            //if(!this.mapml) this.mapml = "";
+            //this.mapml = this.mapml.concat(mapml);
+            if(!layer._mapmlFeatures) layer._mapmlFeatures = [];
+            let parser = new DOMParser(),
+                mapmldoc = parser.parseFromString(mapml, "application/xml"),
+                features = Array.prototype.slice.call(mapmldoc.querySelectorAll("map-feature"));
+                if(features.length) layer._mapmlFeatures = layer._mapmlFeatures.concat(features);
+                mapmldoc.features = layer._mapmlFeatures;
+            if(lastOne) return handleMapMLResponse(mapmldoc, e.latlng);
+          } else {
+            return handleOtherResponse(mapml, layer, e.latlng);
+          }
+        }).catch((err) => {
+          console.log('Looks like there was a problem. Status: ' + err.message);
+        });
+      };
+
+      for(let i = 0; i < templates.length; i++){
+
+        var obj = {},
+            template = templates[i];
+   
         // all of the following are locations that might be used in a query, I think.
         obj[template.query.tilei] = tcrsClickLoc.x.toFixed() - (tileMatrixClickLoc.x * tileSize);
         obj[template.query.tilej] = tcrsClickLoc.y.toFixed() - (tileMatrixClickLoc.y * tileSize);
@@ -3534,34 +3669,14 @@
             }
         }
 
-        let point = this._map.project(e.latlng),
-            scale = this._map.options.crs.scale(this._map.getZoom()),
-            pcrsClick = this._map.options.crs.transformation.untransform(point,scale),
-            contenttype;
-
-        if(template.layerBounds.contains(pcrsClick)){
-          fetch(L.Util.template(template.template, obj), { redirect: 'follow' }).then((response) => {
-            contenttype = response.headers.get("Content-Type");
-            if (response.status >= 200 && response.status < 300) {
-              return response.text();
-            } else {
-              throw new Error(response.status);
-            }
-          }).then((mapml) => {
-            if (contenttype.startsWith("text/mapml")) {
-              return handleMapMLResponse(mapml, e.latlng);
-            } else {
-              return handleOtherResponse(mapml, layer, e.latlng);
-            }
-          }).catch((err) => {
-            console.log('Looks like there was a problem. Status: ' + err.message);
-          });
+        if(template.extentBounds.contains(pcrsClick)){
+          let lastOne = (i === (templates.length - 1)) ? true: false;
+          fetchFeatures(template, obj, lastOne);
         }
-        function handleMapMLResponse(mapml, loc) {
-          let parser = new DOMParser(),
-            mapmldoc = parser.parseFromString(mapml, "application/xml");
+      }
+        function handleMapMLResponse(mapmldoc, loc) {
 
-          for(let feature of mapmldoc.querySelectorAll('map-feature')){
+          for(let feature of mapmldoc.features){
             if(!feature.querySelector('map-geometry')){
               let geo = document.createElement('map-geometry'), point = document.createElement('map-point'),
                 coords = document.createElement('map-coordinates');
@@ -3599,7 +3714,7 @@
           div.appendChild(c);
           // passing a latlng to the popup is necessary for when there is no
           // geometry / null geometry
-          layer._totalFeatureCount = mapmldoc.querySelectorAll("map-feature").length;
+          layer._totalFeatureCount = mapmldoc.features.length;
           layer.bindPopup(div, popupOptions).openPopup(loc);
           layer.on('popupclose', function() {
               map.removeLayer(f);
@@ -4038,7 +4153,8 @@
       this._clickEvent = e;
       let elem = e.originalEvent.target;
       if(elem.closest("fieldset")){
-        elem = elem.closest("fieldset").querySelector("span");
+        elem = elem.closest("fieldset");
+        elem = (elem.className === "mapml-layer-extent") ? elem.closest("fieldset").parentNode.parentNode.parentNode.querySelector("span") : elem.querySelector("span");
         if(!elem.layer.validProjection) return;
         this._layerClicked = elem;
         this._showAtPoint(e.containerPoint, e, this._layerMenu);
diff --git a/dist/mapml.min.js b/dist/mapml.min.js
index 94ee3d7..4123570 100644
--- a/dist/mapml.min.js
+++ b/dist/mapml.min.js
@@ -1,6 +1,6 @@
 /*! @maps4html/web-map-custom-element 12-01-2022 */
 
-!function(){"use strict";function t(t){return new i(t)}function e(t,e){return new o(t,e)}var i=L.GridLayer.extend({initialize:function(t){this.zoomBounds=this._getZoomBounds(t.tileContainer,t.maxZoomBound),L.extend(t,this.zoomBounds),L.setOptions(this,t),this._groups=this._groupTiles(this.options.tileContainer.getElementsByTagName("map-tile"))},onAdd:function(){this._bounds=this._getLayerBounds(this._groups,this._map.options.projection),this.layerBounds=this._bounds[Object.keys(this._bounds)[0]];for(var t of Object.keys(this._bounds))this.layerBounds.extend(this._bounds[t].min),this.layerBounds.extend(this._bounds[t].max);L.GridLayer.prototype.onAdd.call(this,this._map),this._handleMoveEnd()},getEvents:function(){let t=L.GridLayer.prototype.getEvents.call(this,this._map);return this._parentOnMoveEnd=t.moveend,t.moveend=this._handleMoveEnd,t.move=()=>{},t},_handleMoveEnd:function(t){var e=this._map.getZoom();let i=e;i=i>this.options.maxNativeZoom?this.options.maxNativeZoom:i,i=i<this.options.minNativeZoom?this.options.minNativeZoom:i,this.isVisible=e<=this.zoomBounds.maxZoom&&e>=this.zoomBounds.minZoom&&this._bounds[i]&&this._bounds[i].overlaps(M.pixelToPCRSBounds(this._map.getPixelBounds(),this._map.getZoom(),this._map.options.projection)),this.isVisible&&this._parentOnMoveEnd()},_isValidTile(t){return this._groups[this._tileCoordsToKey(t)]},createTile:function(t){let i=this._groups[this._tileCoordsToKey(t)]||[],o=document.createElement("map-tile"),n=this.getTileSize();o.setAttribute("col",t.x),o.setAttribute("row",t.y),o.setAttribute("zoom",t.z);for(let e=0;e<i.length;e++){let t=document.createElement("img");t.width=n.x,t.height=n.y,t.alt="",t.setAttribute("role","presentation"),t.src=i[e].src,o.appendChild(t)}return o},_getLayerBounds:function(t,e){let i={},o=M[e].options.crs.tile.bounds.max.x;for(var n in t){let t=n.split(":"),e={};e.x=+t[0]*o,e.y=+t[1]*o,e.z=+t[2],t[2]in i?(i[t[2]].extend(L.point(e.x,e.y)),i[t[2]].extend(L.point(e.x+o,e.y+o))):i[t[2]]=L.bounds(L.point(e.x,e.y),L.point(e.x+o,e.y+o))}for(var a in i){var s=+a;i[a]=M.pixelToPCRSBounds(i[a],s,e)}return i},_getZoomBounds:function(t,e){if(!t)return null;let i=M.metaContentToObject(t.getElementsByTagName("map-tiles")[0].getAttribute("zoom")),o={},n=t.getElementsByTagName("map-tile");o.nativeZoom=+i.value||0,o.maxNativeZoom=0,o.minNativeZoom=e;for(let e=0;e<n.length;e++){let t=+n[e].getAttribute("zoom");n[e].getAttribute("zoom")||(t=o.nativeZoom),o.minNativeZoom=Math.min(o.minNativeZoom,t),o.maxNativeZoom=Math.max(o.maxNativeZoom,t)}return o.minZoom=o.minNativeZoom-2<=0?0:o.minNativeZoom-2,o.maxZoom=e,i.min&&(o.minZoom=+i.min<o.minNativeZoom-2?o.minNativeZoom-2:+i.min),i.max&&(o.maxZoom=+i.max),o},_groupTiles:function(i){let o={};for(let e=0;e<i.length;e++){let t={};t.row=+i[e].getAttribute("row"),t.col=+i[e].getAttribute("col"),t.zoom=+i[e].getAttribute("zoom")||this.options.nativeZoom,t.src=i[e].getAttribute("src");var n=t.col+":"+t.row+":"+t.zoom;n in o?o[n].push(t):o[n]=[t]}return o}}),o=L.Control.Layers.extend({options:{autoZIndex:!1,sortLayers:!0,sortFunction:function(t,e){return t.options.zIndex<e.options.zIndex?-1:t.options.zIndex>e.options.zIndex?1:0}},initialize:function(t,e){for(var i in L.setOptions(this,e),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,t)this._addLayer(t[i],i,!0)},onAdd:function(){return this._initLayout(),this._map.on("validate",this._validateInput,this),L.DomEvent.on(this.options.mapEl,"layerchange",this._validateInput,this),L.DomEvent.on(this._container,"keydown",this._focusFirstLayer,this._container),this._update(),this._layers.length<1&&!this._map._showControls?this._container.setAttribute("hidden",""):this._map._showControls=!0,this._container},onRemove:function(t){t.off("validate",this._validateInput,this),L.DomEvent.off(this._container,"keydown",this._focusFirstLayer,this._container);for(var e=0;e<this._layers.length;e++)this._layers[e].layer.off("add remove",this._onLayerChange,this),this._layers[e].layer.off("extentload",this._validateInput,this)},addOrUpdateOverlay:function(t,e){for(var i=!1,o=0;o<this._layers.length;o++)if(this._layers[o].layer===t){i=!0,this._layers[o].name=e;break}return i||this.addOverlay(t,e),0<this._layers.length&&(this._container.removeAttribute("hidden"),this._map._showControls=!0),this._map?this._update():this},removeLayer:function(t){L.Control.Layers.prototype.removeLayer.call(this,t),0===this._layers.length&&this._container.setAttribute("hidden","")},_validateInput:function(t){for(let i=0;i<this._layers.length;i++)if(this._layers[i].input.labels[0]){let t=this._layers[i].input.labels[0].getElementsByTagName("span"),e=this._layers[i].input.labels[0].getElementsByTagName("input");e[0].checked=this._layers[i].layer._layerEl.checked,this._layers[i].layer._layerEl.disabled&&this._layers[i].layer._layerEl.checked?(e[0].closest("fieldset").disabled=!0,t[0].style.fontStyle="italic"):(e[0].closest("fieldset").disabled=!1,t[0].style.fontStyle="normal")}},_focusFirstLayer:function(t){var e;"Enter"!==t.key||"leaflet-control-layers leaflet-control leaflet-control-layers-expanded"==this.className||(e=this.children[1].children[2].children[0].children[0].children[0].children[0])&&setTimeout(()=>e.focus(),0)},_withinZoomBounds:function(t,e){return e.min<=t&&t<=e.max},_addItem:function(t){var e=t.layer.getLayerUserControlsHTML();return t.input=e.querySelector("input"),this._layerControlInputs.push(t.input),t.input.layerId=L.stamp(t.layer),L.DomEvent.on(t.input,"click",this._onInputClick,this),t.layer.on("extentload",this._validateInput,this),this._overlaysList.appendChild(e),e},collapse:function(t){return"SELECT"===t.target.tagName||t.relatedTarget&&t.relatedTarget.parentElement&&("mapml-contextmenu mapml-layer-menu"===t.relatedTarget.className||"mapml-contextmenu mapml-layer-menu"===t.relatedTarget.parentElement.className)||this._map&&"block"===this._map.contextMenu._layerMenu.style.display||L.DomUtil.removeClass(this._container,"leaflet-control-layers-expanded"),this}});const H="OSMTILE",d="TILEMATRIX",V="mapmltemplatedtileplaceholder";function n(t,e){return new h(t,e)}function a(t,e){return new _(t,e)}function s(t,e){return new y(t,e)}function r(t,e){return new g(t,e)}function l(t,e){return new f(t,e)}function u(t,e,i,o,n,a){return new x(t,e,i,o,n,a)}function m(t,e,i){return t||e?new b(t,e,i):null}function p(){return new v}function c(t){return new J(t)}var h=L.FeatureGroup.extend({initialize:function(t,e){var i;L.setOptions(this,e),this.options.static&&(this._container=L.DomUtil.create("div","leaflet-layer",this.options.pane),L.DomUtil.addClass(this._container,"leaflet-pane mapml-vector-container"),L.setOptions(this.options.renderer,{pane:this._container})),this._layers={},this.options.query&&(this._mapmlFeatures=t,this.isVisible=!0,i=this._getNativeVariables(t),this.options.nativeZoom=i.zoom,this.options.nativeCS=i.cs),t&&!this.options.query&&(i=this._getNativeVariables(t),!t.querySelector("map-extent")&&t.querySelector("map-feature")&&this.options.static&&(this._features={},this._staticFeature=!0,this.isVisible=!0,this.zoomBounds=this._getZoomBounds(t,i.zoom),this.layerBounds=this._getLayerBounds(t),L.extend(this.options,this.zoomBounds)),this.addData(t,i.cs,i.zoom),this._staticFeature&&(this._resetFeatures(this._clampZoom(this.options._leafletLayer._map.getZoom())),this.options._leafletLayer._map._addZoomLimit(this)))},onAdd:function(t){L.FeatureGroup.prototype.onAdd.call(this,t),this._mapmlFeatures&&t.on("featurepagination",this.showPaginationFeature,this)},onRemove:function(t){this._mapmlFeatures&&(t.off("featurepagination",this.showPaginationFeature,this),delete this._mapmlFeatures,L.DomUtil.remove(this._container)),L.FeatureGroup.prototype.onRemove.call(this,t),this._map.featureIndex.cleanIndex()},getEvents:function(){return this._staticFeature?{moveend:this._handleMoveEnd,zoomend:this._handleZoomEnd}:{moveend:this._removeCSS}},showPaginationFeature:function(e){if(this.options.query&&this._mapmlFeatures.querySelectorAll("map-feature")[e.i]){let t=this._mapmlFeatures.querySelectorAll("map-feature")[e.i];this.clearLayers(),this.addData(t,this.options.nativeCS,this.options.nativeZoom),e.popup._navigationBar.querySelector("p").innerText=e.i+1+"/"+this.options._leafletLayer._totalFeatureCount,e.popup._content.querySelector("iframe").setAttribute("sandbox","allow-same-origin allow-forms"),e.popup._content.querySelector("iframe").srcdoc=t.querySelector("map-properties").innerHTML}},_getNativeVariables:function(t){return{zoom:t.querySelector("map-meta[name=zoom]")&&+M.metaContentToObject(t.querySelector("map-meta[name=zoom]").getAttribute("content")).value||0,cs:t.querySelector("map-meta[name=cs]")&&M.metaContentToObject(t.querySelector("map-meta[name=cs]").getAttribute("content")).content||"GCRS"}},_handleMoveEnd:function(){var t=this._map.getZoom(),e=t<=this.zoomBounds.maxZoom&&t>=this.zoomBounds.minZoom;this.isVisible=e&&this._layers&&this.layerBounds&&this.layerBounds.overlaps(M.pixelToPCRSBounds(this._map.getPixelBounds(),t,this._map.options.projection)),this._removeCSS()},_handleZoomEnd:function(t){var e=this._map.getZoom();e>this.zoomBounds.maxZoom||e<this.zoomBounds.minZoom?this.clearLayers():(e=this._clampZoom(e),this._resetFeatures(e))},_getLayerBounds:function(t){if(!t)return null;let i=d,o=t.querySelector("map-meta[name=projection]")&&M.metaContentToObject(t.querySelector("map-meta[name=projection]").getAttribute("content")).content.toUpperCase()||H;try{var n=t.querySelector("map-meta[name=extent]")&&M.metaContentToObject(t.querySelector("map-meta[name=extent]").getAttribute("content")),a=n.zoom||0;let e=Object.keys(n);for(let t=0;t<e.length;t++)if(!e[t].includes("zoom")){i=M.axisToCS(e[t].split("-")[2]);break}var s=M.csToAxes(i);return M.boundsToPCRSBounds(L.bounds(L.point(+n["top-left-"+s[0]],+n["top-left-"+s[1]]),L.point(+n["bottom-right-"+s[0]],+n["bottom-right-"+s[1]])),a,o,i)}catch(t){return M.boundsToPCRSBounds(M[o].options.crs.tilematrix.bounds(0),0,o,i)}},_resetFeatures:function(e){if(this.clearLayers(),this._map&&this._map.featureIndex.cleanIndex(),this._features&&this._features[e])for(let t=0;t<this._features[e].length;t++)this.addLayer(this._features[e][t])},_clampZoom:function(t){return t>this.zoomBounds.maxZoom||t<this.zoomBounds.minZoom?t:void 0!==this.zoomBounds.minNativeZoom&&t<this.zoomBounds.minNativeZoom?this.zoomBounds.minNativeZoom:void 0!==this.zoomBounds.maxNativeZoom&&this.zoomBounds.maxNativeZoom<t?this.zoomBounds.maxNativeZoom:t},_setZoomTransform:function(t,e){var i=this._map.getZoomScale(this._map.getZoom(),e),t=t.multiplyBy(i).subtract(this._map._getNewPixelOrigin(t,this._map.getZoom())).round();any3d?L.setTransform(this._layers[e],t,i):L.setPosition(this._layers[e],t)},_getZoomBounds:function(t,i){if(!t)return null;let o=100,n=0,a=t.getElementsByTagName("map-feature"),e,s;for(let e=0;e<a.length;e++){let t=+a[e].getAttribute("zoom");a[e].getAttribute("zoom")||(t=i),n=Math.max(n,t),o=Math.min(o,t)}try{s=M.metaContentToObject(t.querySelector("map-meta[name=projection]").getAttribute("content")).content,e=M.metaContentToObject(t.querySelector("map-meta[name=zoom]").getAttribute("content"))}catch(t){return{minZoom:0,maxZoom:M[s||H].options.resolutions.length-1,minNativeZoom:o,maxNativeZoom:n}}return{minZoom:+e.min,maxZoom:+e.max,minNativeZoom:o,maxNativeZoom:n}},addData:function(o,n,a){var t,e,i,s=o.nodeType===Node.DOCUMENT_NODE||"LAYER-"===o.nodeName?o.getElementsByTagName("map-feature"):null;if((o.nodeType===Node.DOCUMENT_NODE?o.querySelector("map-link[rel=stylesheet],map-style"):null)&&(r=o.querySelector("map-base")&&o.querySelector("map-base").hasAttribute("href")?new URL(o.querySelector("map-base").getAttribute("href")).href:o.URL,M.parseStylesheetAsHTML(o,r,this._container)),s){for(t=0,e=s.length;t<e;t++)(i=s[t]).getElementsByTagName("map-geometry").length&&i.getElementsByTagName("map-coordinates").length&&this.addData(i,n,a);return this}var r=this.options;if(!r.filter||r.filter(o)){o.classList.length&&(r.className=o.classList.value);let t=o.getAttribute("zoom")||a,e=o.querySelector("map-featurecaption");e=e?e.innerHTML:"Feature",o.querySelector("map-properties")&&(r.properties=document.createElement("div"),r.properties.classList.add("mapml-popup-content"),r.properties.insertAdjacentHTML("afterbegin",o.querySelector("map-properties").innerHTML));let i=this.geometryToLayer(o,r,n,+t,e);if(i){if(!i.options.color&&o.hasAttribute("class")&&(i.options.className=o.getAttribute("class")),i.defaultOptions=i.options,this.resetStyle(i),r.onEachFeature&&i.bindTooltip(e,{interactive:!0,sticky:!0}),!this._staticFeature)return this.addLayer(i);o=o.getAttribute("zoom")||a;o in this._features?this._features[o].push(i):this._features[o]=[i]}}},resetStyle:function(t){var e=this.options.style;e&&(L.Util.extend(t.options,t.defaultOptions),this._setLayerStyle(t,e))},setStyle:function(e){this.eachLayer(function(t){this._setLayerStyle(t,e)},this)},_setLayerStyle:function(t,e){"function"==typeof e&&(e=e(t.feature)),t.setStyle&&t.setStyle(e)},_removeCSS:function(){var e=this._container.querySelectorAll("link[rel=stylesheet],style");for(let t=0;t<e.length;t++)this._container.removeChild(e[t])},geometryToLayer:function(t,e,i,o,n){let a="MAP-FEATURE"===t.tagName.toUpperCase()?t.getElementsByTagName("map-geometry")[0]:t,s=a.getAttribute("cs")||i,r=[],l=L.SVG.create("g"),u=Object.assign({},e);for(var m of a.querySelectorAll("map-polygon, map-linestring, map-multilinestring, map-point, map-multipoint"))r.push(M.feature(m,Object.assign(u,{nativeCS:s,nativeZoom:o,projection:this.options.projection,featureID:t.id,group:l,wrappers:this._getGeometryParents(m.parentElement),featureLayer:this,_leafletLayer:this.options._leafletLayer})));let p={group:l,featureID:t.id,accessibleTitle:n,onEachFeature:e.onEachFeature,properties:e.properties,_leafletLayer:this.options._leafletLayer},c=a.querySelector("map-multipolygon")||a.querySelector("map-geometrycollection");return c&&(p.wrappers=this._getGeometryParents(c.parentElement)),M.featureGroup(r,p)},_getGeometryParents:function(t,e=[]){return t&&"MAP-GEOMETRY"!==t.tagName.toUpperCase()?"MAP-MULTIPOLYGON"===t.tagName.toUpperCase()||"MAP-GEOMETRYCOLLECTION"===t.tagName.toUpperCase()?this._getGeometryParents(t.parentElement,e):this._getGeometryParents(t.parentElement,e.concat([t])):e}}),_=L.TileLayer.extend({initialize:function(t,e){var i=M.extractInputBounds(t);this.zoomBounds=i.zoomBounds,this.layerBounds=i.bounds,this.isVisible=!0,L.extend(e,this.zoomBounds),e.tms=t.tms,L.setOptions(this,e),this._setUpTileTemplateVars(t),t.tile.subdomains&&L.setOptions(this,L.extend(this.options,{subdomains:t.tile.subdomains})),this._template=t,this._initContainer(),L.TileLayer.prototype.initialize.call(this,t.template,L.extend(e,{pane:this._container}))},onAdd:function(){this._map._addZoomLimit(this),L.TileLayer.prototype.onAdd.call(this,this._map),this._handleMoveEnd()},getEvents:function(){let t=L.TileLayer.prototype.getEvents.call(this,this._map);return this._parentOnMoveEnd=t.moveend,t.moveend=this._handleMoveEnd,t},_initContainer:function(){this._container||(this._container=L.DomUtil.create("div","leaflet-layer",this.options.pane),L.DomUtil.addClass(this._container,"mapml-templated-tile-container"),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity())},_handleMoveEnd:function(t){var e=this._map.getZoom(),i=M.pixelToPCRSBounds(this._map.getPixelBounds(),e,this._map.options.projection);this.isVisible=e<=this.options.maxZoom&&e>=this.options.minZoom&&this.layerBounds.overlaps(i),this.isVisible&&this._parentOnMoveEnd()},createTile:function(e){let i=document.createElement("DIV"),o=this.getTileSize();if(L.DomUtil.addClass(i,"mapml-tile-group"),L.DomUtil.addClass(i,"leaflet-tile"),this._template.linkEl.dispatchEvent(new CustomEvent("tileloadstart",{detail:{x:e.x,y:e.y,zoom:e.z,appendTile:t=>{i.appendChild(t)}}})),this._template.type.startsWith("image/")){let t=L.TileLayer.prototype.createTile.call(this,e,function(){});t.width=o.x,t.height=o.y,i.appendChild(t)}else this._url.includes(V)||this._fetchTile(e,i);return i},_mapmlTileReady:function(t){L.DomUtil.addClass(t,"leaflet-tile-loaded")},getPane:function(){return this.options.pane},_fetchTile:function(e,i){fetch(this.getTileUrl(e),{redirect:"follow"}).then(function(t){return 200<=t.status&&t.status<300?Promise.resolve(t):(console.log("Looks like there was a problem. Status Code: "+t.status),Promise.reject(t))}).then(function(t){return t.text()}).then(t=>{return(new DOMParser).parseFromString(t,"application/xml")}).then(t=>{this._createFeatures(t,e,i),this._mapmlTileReady(i)}).catch(t=>{console.log("Error Creating Tile")})},_createFeatures:function(t,e,i){var o;t.querySelector("map-link[rel=stylesheet],map-style")&&(o=t.querySelector("map-base")&&t.querySelector("map-base").hasAttribute("href")?new URL(t.querySelector("map-base").getAttribute("href")).href:t.URL,M.parseStylesheetAsHTML(t,o,i));let n=L.SVG.create("svg"),a=L.SVG.create("g"),s=this._map.options.crs.options.crs.tile.bounds.max.x,r=e.x*s,l=e.y*s;var u,m=M.mapMlFeatures(t,{projection:this._map.options.projection,static:!1,interactive:!1});for(u in m._layers)for(var p in m._layers[u]._layers){let t=m._layers[u]._layers[p];M.FeatureRenderer.prototype._initPath(t,!1),t._project(this._map,L.point([r,l]),e.z),M.FeatureRenderer.prototype._addPath(t,a,!1),M.FeatureRenderer.prototype._updateFeature(t)}n.setAttribute("width",s.toString()),n.setAttribute("height",s.toString()),n.appendChild(a),i.appendChild(n)},getTileUrl:function(t){if(t.z>=this._template.tilematrix.bounds.length||!this._template.tilematrix.bounds[t.z].contains(t))return"";var e,i={};for(e in i[this._template.tilematrix.col.name]=t.x,i[this._template.tilematrix.row.name]=t.y,i[this._template.zoom.name]=this._getZoomForUrl(),i[this._template.pcrs.easting.left]=this._tileMatrixToPCRSPosition(t,"top-left").x,i[this._template.pcrs.easting.right]=this._tileMatrixToPCRSPosition(t,"top-right").x,i[this._template.pcrs.northing.top]=this._tileMatrixToPCRSPosition(t,"top-left").y,i[this._template.pcrs.northing.bottom]=this._tileMatrixToPCRSPosition(t,"bottom-left").y,i[this._template.tile.server]=this._getSubdomain(t),this._template.tile)["row","col","zoom","left","right","top","bottom"].indexOf(e)<0&&(i[e]=this._template.tile[e]);return this._map&&!this._map.options.crs.infinite&&(t=this._globalTileRange.max.y-t.y,this.options.tms&&(i[this._template.tilematrix.row.name]=t)),i.r=this.options.detectRetina&&L.Browser.retina&&0<this.options.maxZoom?"@2x":"",L.Util.template(this._url,i)},_tileMatrixToPCRSPosition:function(t,e){var i=this._map.options.crs,o=this.getTileSize(),n=t.scaleBy(o),a=n.add(o),o=n.add(Math.floor(o/2)),s=i.transformation.untransform(n,i.scale(t.z)),r=i.transformation.untransform(a,i.scale(t.z)),l=i.transformation.untransform(o,i.scale(t.z)),u=null;switch(e){case"top-left":u=s;break;case"bottom-left":u=new L.Point(s.x,r.y);break;case"center-left":u=new L.Point(s.x,l.y);break;case"top-right":u=new L.Point(r.x,s.y);break;case"bottom-right":u=r;break;case"center-right":u=new L.Point(r.x,l.y);break;case"top-center":u=new L.Point(l.x,s.y);break;case"bottom-center":u=new L.Point(l.x,r.y);break;case"center":u=l}return u},_setUpTileTemplateVars:function(t){t.tile={};for(var e,i,o,n,a,s=t.values,r=this.options.crs.options,l=0;l<t.values.length;l++){var u=s[l].getAttribute("type"),m=s[l].getAttribute("units"),p=s[l].getAttribute("axis"),c=s[l].getAttribute("name"),h=s[l].getAttribute("position"),d="hidden"===u&&s[l].hasAttribute("shard"),_="map-select"===s[l].tagName.toLowerCase(),y=s[l].getAttribute("value"),g=s[l].getAttribute("min"),f=s[l].getAttribute("max");if("location"===u&&"tilematrix"===m)switch(p){case"column":a={name:c,min:r.crs.tilematrix.horizontal.min,max:r.crs.tilematrix.horizontal.max(r.resolutions.length-1)},isNaN(Number.parseFloat(g))||(a.min=Number.parseFloat(g)),isNaN(Number.parseFloat(f))||(a.max=Number.parseFloat(f));break;case"row":n={name:c,min:r.crs.tilematrix.vertical.min,max:r.crs.tilematrix.vertical.max(r.resolutions.length-1)},isNaN(Number.parseFloat(g))||(n.min=Number.parseFloat(g)),isNaN(Number.parseFloat(f))||(n.max=Number.parseFloat(f));break;case"longitude":case"easting":i=i||{min:r.crs.pcrs.horizontal.min,max:r.crs.pcrs.horizontal.max},isNaN(Number.parseFloat(g))||(i.min=Number.parseFloat(g)),isNaN(Number.parseFloat(f))||(i.max=Number.parseFloat(f)),h&&(h.match(/.*?-left/i)?i.left=c:h.match(/.*?-right/i)&&(i.right=c));break;case"latitude":case"northing":o=o||{min:r.crs.pcrs.vertical.min,max:r.crs.pcrs.vertical.max},isNaN(Number.parseFloat(g))||(o.min=Number.parseFloat(g)),isNaN(Number.parseFloat(f))||(o.max=Number.parseFloat(f)),h&&(h.match(/top-.*?/i)?o.top=c:h.match(/bottom-.*?/i)&&(o.bottom=c))}else if(u&&"zoom"===u.toLowerCase())e={name:c,min:0,max:r.resolutions.length,value:r.resolutions.length},!isNaN(Number.parseInt(y,10))&&Number.parseInt(y,10)>=e.min&&Number.parseInt(y,10)<=e.max?e.value=Number.parseInt(y,10):e.value=e.max,!isNaN(Number.parseInt(g,10))&&Number.parseInt(g,10)>=e.min&&Number.parseInt(g,10)<=e.max&&(e.min=Number.parseInt(g,10)),!isNaN(Number.parseInt(f,10))&&Number.parseInt(f,10)>=e.min&&Number.parseInt(f,10)<=e.max&&(e.max=Number.parseInt(f,10)),t.zoom=e;else if(d)t.tile.server=c,t.tile.subdomains=s[l].servers.slice();else if(_){const z=s[l].htmlselect;t.tile[c]=function(){return z.value}}else{const k=s[l];t.tile[c]=function(){return k.getAttribute("value")}}}function x(t,e){return b.transform(t,A(e)).divideBy(v).floor()}var b=this.options.crs.transformation,v=this.options.crs.options.crs.tile.bounds.max.x,A=L.bind(this.options.crs.scale,this.options.crs);i&&o?(t.pcrs={},t.pcrs.bounds=L.bounds([i.min,o.min],[i.max,o.max]),t.pcrs.easting=i,t.pcrs.northing=o):a&&n&&!isNaN(e.value)?(t.pcrs||(t.pcrs={},t.pcrs.easting="",t.pcrs.northing=""),t.pcrs.bounds=M.boundsToPCRSBounds(L.bounds(L.point([a.min,n.min]),L.point([a.max,n.max])),e.value,this.options.crs,M.axisToCS("column")),t.tilematrix={},t.tilematrix.col=a,t.tilematrix.row=n):console.log("Unable to determine bounds for tile template: "+t.template),t.tilematrix||(t.tilematrix={},t.tilematrix.col={},t.tilematrix.row={}),t.tilematrix.bounds=[];for(var C=t.pcrs.bounds,E=t.zoom?t.zoom.min:0,S=t.zoom?t.zoom.max:r.resolutions.length,T=0;T<=S;T++)t.tilematrix.bounds[T]=E<=T?L.bounds(x(C.min,T),x(C.max,T)):L.bounds(L.point([-1,-1]),L.point([-1,-1]))}}),y=L.Layer.extend({initialize:function(t,e){this._templates=t,L.setOptions(this,e),this._container=L.DomUtil.create("div","leaflet-layer",e.pane),L.DomUtil.addClass(this._container,"mapml-templatedlayer-container");for(var i,o=0;o<t.length;o++)"tile"===t[o].rel?this._templates[o].layer=M.templatedTileLayer(t[o],L.Util.extend(e,{errorTileUrl:"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",zIndex:o,pane:this._container})):"image"===t[o].rel?this._templates[o].layer=M.templatedImageLayer(t[o],L.Util.extend(e,{zIndex:o,pane:this._container})):"features"===t[o].rel?this._templates[o].layer=M.templatedFeaturesLayer(t[o],L.Util.extend(e,{zIndex:o,pane:this._container})):"query"===t[o].rel&&(this.hasSetBoundsHandler=!0,this._queries||(this._queries=[]),i=M.extractInputBounds(t[o]),t[o].layerBounds=i.bounds,t[o].zoomBounds=i.zoomBounds,this._queries.push(L.extend(t[o],this._setupQueryVars(t[o]))))},getEvents:function(){return{zoomstart:this._onZoomStart}},redraw:function(){this.closePopup();for(var t=0;t<this._templates.length;t++)"tile"!==this._templates[t].rel&&"image"!==this._templates[t].rel&&"features"!==this._templates[t].rel||this._templates[t].layer.redraw()},_onZoomStart:function(){this.closePopup()},_setupQueryVars:function(t){for(var e={query:{}},i=t.values,o=0;o<t.values.length;o++){var n=i[o].getAttribute("type"),a=i[o].getAttribute("units"),s=i[o].getAttribute("axis"),r=i[o].getAttribute("name"),l=i[o].getAttribute("position"),u=i[o].getAttribute("rel"),m="map-select"===i[o].tagName.toLowerCase();if("width"===n)e.query.width=r;else if("height"===n)e.query.height=r;else if("location"===n)switch(s){case"x":case"y":case"column":case"row":e.query[s]=r;break;case"longitude":case"easting":l?l.match(/.*?-left/i)?"pixel"===u?e.query.pixelleft=r:"tile"===u?e.query.tileleft=r:e.query.mapleft=r:l.match(/.*?-right/i)&&("pixel"===u?e.query.pixelright=r:"tile"===u?e.query.tileright=r:e.query.mapright=r):e.query[s]=r;break;case"latitude":case"northing":l?l.match(/top-.*?/i)?"pixel"===u?e.query.pixeltop=r:"tile"===u?e.query.tiletop=r:e.query.maptop=r:l.match(/bottom-.*?/i)&&("pixel"===u?e.query.pixelbottom=r:"tile"===u?e.query.tilebottom=r:e.query.mapbottom=r):e.query[s]=r;break;case"i":"tile"===a?e.query.tilei=r:e.query.mapi=r;break;case"j":"tile"===a?e.query.tilej=r:e.query.mapj=r}else if("zoom"===n)e.query.zoom=r;else if(m){const p=i[o].htmlselect;e.query[r]=function(){return p.value}}else{const c=i[o];e.query[r]=function(){return c.getAttribute("value")}}}return e.query.title=t.title,e},reset:function(t){if(t&&this._map){var e=this._map&&this._map.hasLayer(this),i=this._templates;delete this._queries,this._map.off("click",null,this),this._templates=t;for(var o=0;o<t.length;o++)"tile"===t[o].rel?this._templates[o].layer=M.templatedTileLayer(t[o],L.Util.extend(this.options,{errorTileUrl:"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",zIndex:o,pane:this._container})):"image"===t[o].rel?this._templates[o].layer=M.templatedImageLayer(t[o],L.Util.extend(this.options,{zIndex:o,pane:this._container})):"features"===t[o].rel?this._templates[o].layer=M.templatedFeaturesLayer(t[o],L.Util.extend(this.options,{zIndex:o,pane:this._container})):"query"===t[o].rel&&(this._queries||(this._queries=[]),this._queries.push(L.extend(t[o],this._setupQueryVars(t[o])))),e&&this.onAdd(this._map);for(o=0;o<i.length;o++)this._map.hasLayer(i[o].layer)&&this._map.removeLayer(i[o].layer)}},onAdd:function(t){for(var e=0;e<this._templates.length;e++)"query"!==this._templates[e].rel&&t.addLayer(this._templates[e].layer)},onRemove:function(t){L.DomUtil.remove(this._container);for(var e=0;e<this._templates.length;e++)"query"!==this._templates[e].rel&&t.removeLayer(this._templates[e].layer)},_previousFeature:function(t){0<=this._count+-1&&(this._count--,this._map.fire("featurepagination",{i:this._count,popup:this}))},_nextFeature:function(t){this._count+1<this._source._totalFeatureCount&&(this._count++,this._map.fire("featurepagination",{i:this._count,popup:this}))}}),g=L.Layer.extend({initialize:function(t,e){var i=M.extractInputBounds(t);this.zoomBounds=i.zoomBounds,this.layerBounds=i.bounds,this.isVisible=!0,this._template=t,this._container=L.DomUtil.create("div","leaflet-layer",e.pane),L.extend(e,this.zoomBounds),L.DomUtil.addClass(this._container,"mapml-features-container"),L.setOptions(this,L.extend(e,this._setUpFeaturesTemplateVars(t)))},getEvents:function(){return{moveend:this._onMoveEnd}},onAdd:function(){this._map._addZoomLimit(this);var n,t=new Headers({Accept:"text/mapml"}),a=new DOMParser,e=this.options.opacity||1,i=this._container,o=this._map;this._features||(this._features=M.mapMlFeatures(null,{renderer:M.featureRenderer(),pane:i,opacity:e,projection:o.options.projection,static:!0,onEachFeature:function(t,e){var i=document.createElement("div");i.classList.add("mapml-popup-content"),i.insertAdjacentHTML("afterbegin",t.innerHTML),e.bindPopup(i,{autoClose:!1,minWidth:108})}}));var s=this._features,r=function(i,o){return fetch(i,{redirect:"follow",headers:t}).then(function(t){return t.text()}).then(function(t){n=a.parseFromString(t,"application/xml");var e=new URL(n.querySelector("map-base")?n.querySelector("map-base").getAttribute("href"):i).href;i=(i=n.querySelector("map-link[rel=next]")?n.querySelector("map-link[rel=next]").getAttribute("href"):null)?new URL(i,e).href:null;t=n.querySelector("map-meta[name=zoom]")&&+M.metaContentToObject(n.querySelector("map-meta[name=zoom]").getAttribute("content")).value||0,e=n.querySelector("map-meta[name=cs]")&&M.metaContentToObject(n.querySelector("map-meta[name=cs]").getAttribute("content")).content||"GCRS";if(s.addData(n,e,t),i&&--o)return r(i,o)})};r(this._getfeaturesUrl(),10).then(function(){o.addLayer(s),o.fire("moveend")}).catch(function(t){console.log(t)})},redraw:function(){this._onMoveEnd()},_onMoveEnd:function(){var n,t,a,s,e,i,r,o=this._map.getZoom(),l=M.pixelToPCRSBounds(this._map.getPixelBounds(),o,this._map.options.projection);this.isVisible=o<=this.zoomBounds.maxZoom&&o>=this.zoomBounds.minZoom&&this.layerBounds.overlaps(l),this._features.clearLayers(),this.isVisible&&(t=new Headers({Accept:"text/mapml;q=0.9,application/geo+json;q=0.8"}),a=new DOMParser,s=this._features,e=this._map,(r=function(i,o){return fetch(i,{redirect:"follow",headers:t}).then(function(t){return t.text()}).then(function(t){n=a.parseFromString(t,"application/xml");var e=new URL(n.querySelector("map-base")?n.querySelector("map-base").getAttribute("href"):i).href;i=(i=n.querySelector("map-link[rel=next]")?n.querySelector("map-link[rel=next]").getAttribute("href"):null)?new URL(i,e).href:null;t=n.querySelector("map-meta[name=zoom]")&&+M.metaContentToObject(n.querySelector("map-meta[name=zoom]").getAttribute("content")).value||0,e=n.querySelector("map-meta[name=cs]")&&M.metaContentToObject(n.querySelector("map-meta[name=cs]").getAttribute("content")).content||"GCRS";if(s.addData(n,e,t),i&&--o)return r(i,o)})})((i=this)._getfeaturesUrl(),10).then(function(){e.addLayer(s),M.TemplatedFeaturesLayer.prototype._updateTabIndex(i)}).catch(function(t){console.log(t)}))},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},_updateTabIndex:function(t){var i,o=t||this;for(i in o._features._layers){let e=o._features._layers[i];if(e._path&&("M0 0"!==e._path.getAttribute("d")?e._path.setAttribute("tabindex",0):e._path.removeAttribute("tabindex"),0===e._path.childElementCount)){let t=document.createElement("title");t.innerText="Feature",e._path.appendChild(t)}}},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},onRemove:function(){this._map.removeLayer(this._features)},_getfeaturesUrl:function(){var t,e={};for(t in this.options.feature.zoom&&(e[this.options.feature.zoom]=this._map.getZoom()),this.options.feature.width&&(e[this.options.feature.width]=this._map.getSize().x),this.options.feature.height&&(e[this.options.feature.height]=this._map.getSize().y),this.options.feature.bottom&&(e[this.options.feature.bottom]=this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).y),this.options.feature.left&&(e[this.options.feature.left]=this._TCRSToPCRS(this._map.getPixelBounds().min,this._map.getZoom()).x),this.options.feature.top&&(e[this.options.feature.top]=this._TCRSToPCRS(this._map.getPixelBounds().min,this._map.getZoom()).y),this.options.feature.right&&(e[this.options.feature.right]=this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).x),this.options.feature)["width","height","left","right","top","bottom","zoom"].indexOf(t)<0&&(e[t]=this.options.feature[t]);return L.Util.template(this._template.template,e)},_TCRSToPCRS:function(t,e){var i=this._map.options.crs;return i.transformation.untransform(t,i.scale(e))},_setUpFeaturesTemplateVars:function(t){var e={feature:{}},i=t.values;e.feature.hidden=[];for(var o=0;o<i.length;o++){var n=i[o].getAttribute("type"),a=i[o].getAttribute("units"),s=i[o].getAttribute("axis"),r=i[o].getAttribute("name"),l=i[o].getAttribute("position"),u=(i[o].getAttribute("value"),"map-select"===i[o].tagName.toLowerCase());if("width"===n)e.feature.width=r;else if("height"===n)e.feature.height=r;else if("zoom"===n)e.feature.zoom=r;else if("location"!==n||"pcrs"!==a&&"gcrs"!==a)if(u){const m=i[o].htmlselect;e.feature[r]=function(){return m.value}}else{const p=i[o];e.feature[r]=function(){return p.getAttribute("value")}}else switch(s){case"x":case"longitude":case"easting":l&&(l.match(/.*?-left/i)?e.feature.left=r:l.match(/.*?-right/i)&&(e.feature.right=r));break;case"y":case"latitude":case"northing":l&&(l.match(/top-.*?/i)?e.feature.top=r:l.match(/bottom-.*?/i)&&(e.feature.bottom=r))}}return e}}),f=L.Layer.extend({initialize:function(t,e){this._template=t,this._container=L.DomUtil.create("div","leaflet-layer",e.pane),L.DomUtil.addClass(this._container,"mapml-image-container");var i=M.extractInputBounds(t);this.zoomBounds=i.zoomBounds,this.layerBounds=i.bounds,this.isVisible=!0,L.extend(e,this.zoomBounds),L.setOptions(this,L.extend(e,this._setUpExtentTemplateVars(t)))},getEvents:function(){return{moveend:this._onMoveEnd}},onAdd:function(){this._map._addZoomLimit(this),this.setZIndex(this.options.zIndex),this._onMoveEnd()},redraw:function(){this._onMoveEnd()},_clearLayer:function(){var e=this._container.querySelectorAll("img");for(let t=0;t<e.length;t++)this._container.removeChild(e[t])},_onMoveEnd:function(){var t,e,i,o=this._map.getZoom(),n=M.pixelToPCRSBounds(this._map.getPixelBounds(),o,this._map.options.projection);this.isVisible=o<=this.zoomBounds.maxZoom&&o>=this.zoomBounds.minZoom&&this.layerBounds.overlaps(n),this.isVisible?(e=(t=this._map).getPixelBounds().min.subtract(t.getPixelOrigin()),o=t.getSize(),n=this.getImageUrl(),i=this._imageOverlay,this._imageOverlay=M.imageOverlay(n,e,o,0,this._container),this._imageOverlay.addTo(t),i&&this._imageOverlay.on("load error",function(){t.removeLayer(i)})):this._clearLayer()},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},onRemove:function(t){this._clearLayer(),t._removeZoomLimit(this),this._container=null},getImageUrl:function(){var t,e={};for(t in e[this.options.extent.width]=this._map.getSize().x,e[this.options.extent.height]=this._map.getSize().y,e[this.options.extent.bottom]=this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).y,e[this.options.extent.left]=this._TCRSToPCRS(this._map.getPixelBounds().min,this._map.getZoom()).x,e[this.options.extent.top]=this._TCRSToPCRS(this._map.getPixelBounds().min,this._map.getZoom()).y,e[this.options.extent.right]=this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).x,this.options.extent)["width","height","left","right","top","bottom"].indexOf(t)<0&&(e[t]=this.options.extent[t]);return L.Util.template(this._template.template,e)},_TCRSToPCRS:function(t,e){var i=this._map.options.crs;return i.transformation.untransform(t,i.scale(e))},_setUpExtentTemplateVars:function(t){for(var e={extent:{}},i=t.values,o=0;o<t.values.length;o++){var n=i[o].getAttribute("type"),a=i[o].getAttribute("units"),s=i[o].getAttribute("axis"),r=i[o].getAttribute("name"),l=i[o].getAttribute("position"),u="map-select"===i[o].tagName.toLowerCase();if("width"===n)e.extent.width=r;else if("height"===n)e.extent.height=r;else if("location"!==n||"pcrs"!==a&&"gcrs"!==a)if(u){const m=i[o].htmlselect;e.extent[r]=function(){return m.value}}else{const p=i[o];e.extent[r]=function(){return p.getAttribute("value")}}else switch(s){case"longitude":case"easting":l&&(l.match(/.*?-left/i)?e.extent.left=r:l.match(/.*?-right/i)&&(e.extent.right=r));break;case"latitude":case"northing":l&&(l.match(/top-.*?/i)?e.extent.top=r:l.match(/bottom-.*?/i)&&(e.extent.bottom=r))}}return e}}),x=L.ImageOverlay.extend({initialize:function(t,e,i,o,n,a){this._container=n,this._url=t,this._location=e,this._size=L.point(i),this._angle=o,L.setOptions(this,a)},getEvents:function(){var t={viewreset:this._reset};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},onAdd:function(){this.on({load:this._onImageLoad}),this._image||this._initImage(),this.options.interactive&&(L.DomUtil.addClass(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this._container.appendChild(this._image),this._reset()},onRemove:function(){L.DomUtil.remove(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},_onImageLoad:function(){this._image&&(this._image.loaded=+new Date,this._updateOpacity())},_animateZoom:function(t){var e=this._map.getZoomScale(t.zoom),t=this._map.getPixelOrigin().add(this._location).multiplyBy(e).subtract(this._map._getNewPixelOrigin(t.center,t.zoom)).round();L.Browser.any3d?L.DomUtil.setTransform(this._image,t,e):L.DomUtil.setPosition(this._image,t)},_reset:function(){var t=this._image,e=this._location,i=this._size;L.DomUtil.setPosition(t,e),t.style.width=i.x+"px",t.style.height=i.y+"px"},_updateOpacity:function(){var t,e,i;this._map&&(i=+new Date,t=!1,e=this._image,i=Math.min(1,(i-e.loaded)/200),L.DomUtil.setOpacity(e,i),(t=i<1?!0:t)&&(L.Util.cancelAnimFrame(this._fadeFrame),this._fadeFrame=L.Util.requestAnimFrame(this._updateOpacity,this)),L.DomUtil.addClass(e,"leaflet-image-loaded"))}}),b=L.Layer.extend({options:{maxNext:10,zIndex:0,maxZoom:25},initialize:function(t,e,i){var o;t&&(this._href=t),e&&(o=!!(this._layerEl=e).querySelector("map-feature,map-tile,map-extent"),!t&&o&&(this._content=e)),L.setOptions(this,i),this._container=L.DomUtil.create("div","leaflet-layer"),L.DomUtil.addClass(this._container,"mapml-layer"),this._imageContainer=L.DomUtil.create("div","leaflet-layer",this._container),L.DomUtil.addClass(this._imageContainer,"mapml-image-container"),this._mapmlTileContainer=L.DomUtil.create("div","mapml-tile-container",this._container),!o&&e&&e.hasAttribute("label")&&(this._title=e.getAttribute("label")),this._initCount=0,this._initExtent(o?e:null),this.on("attached",this._validateExtent,this),this.validProjection=!0},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},_changeOpacity:function(t){t&&t.target&&0<=t.target.value&&t.target.value<=1&&this.changeOpacity(t.target.value)},changeOpacity:function(t){this._container.style.opacity=t,this.opacityEl&&(this.opacityEl.value=t)},onAdd:function(t){!this._extent||this._validProjection(t)?(this._map=t,this._content?(this._mapmlvectors||(this._mapmlvectors=M.mapMlFeatures(this._content,{renderer:M.featureRenderer(),pane:this._container,opacity:this.options.opacity,projection:t.options.projection,_leafletLayer:this,static:!0,onEachFeature:function(t,e){var i;t&&((i=document.createElement("div")).classList.add("mapml-popup-content"),i.insertAdjacentHTML("afterbegin",t.innerHTML),e.bindPopup(i,{autoClose:!1,minWidth:165}))}})),t.addLayer(this._mapmlvectors)):this.once("extentload",function(){this._validProjection(t)?(this._mapmlvectors||(this._mapmlvectors=M.mapMlFeatures(this._content,{renderer:M.featureRenderer(),pane:this._container,opacity:this.options.opacity,projection:t.options.projection,_leafletLayer:this,static:!0,onEachFeature:function(t,e){var i;t&&((i=document.createElement("div")).classList.add("mapml-popup-content"),i.insertAdjacentHTML("afterbegin",t.innerHTML),e.bindPopup(i,{autoClose:!1,minWidth:165}))}}).addTo(t)),this._setLayerElExtent()):this.validProjection=!1},this),this._imageLayer||(this._imageLayer=L.layerGroup()),t.addLayer(this._imageLayer),(!this._staticTileLayer||null===this._staticTileLayer._container)&&0<this._mapmlTileContainer.getElementsByTagName("map-tiles").length&&(this._staticTileLayer=M.mapMLStaticTileLayer({pane:this._container,_leafletLayer:this,className:"mapml-static-tile-layer",tileContainer:this._mapmlTileContainer,maxZoomBound:t.options.crs.options.resolutions.length-1,tileSize:t.options.crs.options.crs.tile.bounds.max.x}),t.addLayer(this._staticTileLayer)),this._extent?this._templateVars&&(this._templatedLayer=M.templatedLayer(this._templateVars,{pane:this._container,_leafletLayer:this,crs:this.crs}).addTo(t)):this.once("extentload",function(){this._validProjection(t)?this._templateVars&&(this._templatedLayer=M.templatedLayer(this._templateVars,{pane:this._container,_leafletLayer:this,crs:this.crs}).addTo(t),this._setLayerElExtent()):this.validProjection=!1},this),this._setLayerElExtent(),this.setZIndex(this.options.zIndex),this.getPane().appendChild(this._container),setTimeout(()=>{t.fire("checkdisabled")},0),t.on("popupopen",this._attachSkipButtons,this)):this.validProjection=!1},_validProjection:function(t){let e=!1;if(this._templateVars)for(var i of this._templateVars)i.projectionMatch||i.projection===t.options.projection||(e=!0);return!(e||this.getProjection()!==t.options.projection.toUpperCase())},_setLayerElExtent:function(){let i,o;["_staticTileLayer","_imageLayer","_mapmlvectors","_templatedLayer"].forEach(e=>{if(this[e])if("_templatedLayer"===e)for(let t=0;t<this[e]._templates.length;t++)"query"!==this[e]._templates[t].rel&&this[e]._templates[t].layer.layerBounds&&(i?(i.extend(this[e]._templates[t].layer.layerBounds.min),i.extend(this[e]._templates[t].layer.layerBounds.max)):(i=this[e]._templates[t].layer.layerBounds,o=this[e]._templates[t].layer.zoomBounds));else this[e].layerBounds&&(i?(i.extend(this[e].layerBounds.min),i.extend(this[e].layerBounds.max)):(i=this[e].layerBounds,o=this[e].zoomBounds))}),i&&(this._layerEl.extent=Object.assign(M.convertAndFormatPCRS(i,this._map),{zoom:o}))},addTo:function(t){return t.addLayer(this),this},getEvents:function(){return{zoomanim:this._onZoomAnim}},redraw:function(){this._templatedLayer&&this._templatedLayer.redraw()},_onZoomAnim:function(t){var e=t.zoom,i=this._extent?this._extent.querySelector("map-input[type=zoom]"):null,t=i&&i.hasAttribute("min")?parseInt(i.getAttribute("min")):this._map.getMinZoom(),i=i&&i.hasAttribute("max")?parseInt(i.getAttribute("max")):this._map.getMaxZoom();e<t&&this._extent.zoomout||i<e&&this._extent.zoomin;t<=e&&e<=i||(this._extent.zoomin&&i<e?(this._href=this._extent.zoomin,this._layerEl.src=this._extent.zoomin,this.href=this._extent.zoomin,this._layerEl.src=this._extent.zoomin):this._extent.zoomout&&e<t&&(this._href=this._extent.zoomout,this.href=this._extent.zoomout,this._layerEl.src=this._extent.zoomout)),this._templatedLayer},onRemove:function(t){L.DomUtil.remove(this._container),this._staticTileLayer&&t.removeLayer(this._staticTileLayer),this._mapmlvectors&&t.removeLayer(this._mapmlvectors),this._imageLayer&&t.removeLayer(this._imageLayer),this._templatedLayer&&t.removeLayer(this._templatedLayer),t.fire("checkdisabled"),t.off("popupopen",this._attachSkipButtons)},getZoomBounds:function(){var t=this._extent,e=t?t.querySelector("[type=zoom]"):void 0,i=e&&e.hasAttribute("min")?e.getAttribute("min"):this._map.getMinZoom(),t=e&&e.hasAttribute("max")?e.getAttribute("max"):this._map.getMaxZoom(),e={};return e.min=Math.min(i,t),e.max=Math.max(i,t),e},_transformDeprectatedInput:function(t){var e=t.getAttribute("type").toLowerCase();if("xmin"===e||"ymin"===e||"xmax"===e||"ymax"===e)switch(t.setAttribute("type","location"),t.setAttribute("units","tcrs"),e){case"xmin":t.setAttribute("axis","x"),t.setAttribute("position","top-left");break;case"ymin":t.setAttribute("axis","y"),t.setAttribute("position","top-left");break;case"xmax":t.setAttribute("axis","x"),t.setAttribute("position","bottom-right");break;case"ymax":t.setAttribute("axis","y"),t.setAttribute("position","bottom-right")}},getLayerExtentBounds:function(t){if(this._extent){var e,i=t.getZoom(),o=t.options.projection,n=o!==this._extent.getAttribute("units"),a=this._extent.querySelector("[type=xmin]").getAttribute("min"),s=this._extent.querySelector("[type=xmax]").getAttribute("min"),r=Math.min(a,s);if(a=this._extent.querySelector("[type=xmin]").getAttribute("max"),s=this._extent.querySelector("[type=xmax]").getAttribute("max"),e=Math.max(a,s),a=this._extent.querySelector("[type=ymin]").getAttribute("min"),s=this._extent.querySelector("[type=ymax]").getAttribute("min"),t=Math.min(a,s),a=this._extent.querySelector("[type=ymin]").getAttribute("max"),s=this._extent.querySelector("[type=ymax]").getAttribute("max"),s=Math.max(a,s),n){var l,u=[(l=M[o]).latLngToPoint(L.latLng([t,r]),i),l.latLngToPoint(L.latLng([s,e]),i),l.latLngToPoint(L.latLng([t,r]),i),l.latLngToPoint(L.latLng([t,e]),i)];return L.bounds(u)}return(u=parseInt(this._extent.querySelector("[type=zoom]").getAttribute("value")))!==i?(l=M[o],L.bounds(l.latLngToPoint(l.pointToLatLng(L.point(r,t),u),i),l.latLngToPoint(l.pointToLatLng(L.point(e,s),u),i))):L.bounds(L.point(r,t),L.point(e,s))}},getAttribution:function(){return this.options.attribution},getLayerUserControlsHTML:function(){var i=L.DomUtil.create("fieldset","mapml-layer-item"),t=L.DomUtil.create("input"),e=L.DomUtil.create("span","mapml-layer-item-name"),o=L.DomUtil.create("span"),n=L.DomUtil.create("div","mapml-layer-item-properties",i),a=L.DomUtil.create("div","mapml-layer-item-settings",i),s=L.DomUtil.create("label","mapml-layer-item-toggle",n),r=L.DomUtil.create("div","mapml-layer-item-controls",n),l=L.DomUtil.create("details","mapml-layer-item-opacity mapml-control-layers",a),u=L.DomUtil.create("input"),m=L.DomUtil.create("summary"),p=L.SVG.create("svg"),c=L.SVG.create("path"),n=L.SVG.create("path"),h=this._layerEl.parentNode;this.opacityEl=u,p.setAttribute("viewBox","0 0 24 24"),p.setAttribute("height","22"),p.setAttribute("width","22"),c.setAttribute("d","M0 0h24v24H0z"),c.setAttribute("fill","none"),n.setAttribute("d","M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"),p.appendChild(c),p.appendChild(n),a.hidden=!0,o.setAttribute("aria-hidden",!0);let d=L.DomUtil.create("button","mapml-layer-item-remove-control",r);d.type="button",d.title="Remove Layer",d.innerHTML="<span aria-hidden='true'>&#10005;</span>",d.classList.add("mapml-button"),L.DomEvent.on(d,"click",L.DomEvent.stop),L.DomEvent.on(d,"click",t=>{let e=0,i,o;if(o=("MAPML-VIEWER"===h.tagName?h:h.querySelector(".mapml-web-map")).shadowRoot,t.target.closest("fieldset").nextElementSibling&&!t.target.closest("fieldset").nextElementSibling.disbaled)for(i=t.target.closest("fieldset").previousElementSibling;i;)e+=2,i=i.previousElementSibling;else i="link";h.removeChild(t.target.closest("fieldset").querySelector("span").layer._layerEl),i=i?o.querySelector(".leaflet-control-attribution").firstElementChild:i=o.querySelectorAll("input")[e],i.focus()},this);let _=L.DomUtil.create("button","mapml-layer-item-settings-control",r);if(_.type="button",_.title="Layer Settings",_.setAttribute("aria-expanded",!1),_.classList.add("mapml-button"),L.DomEvent.on(_,"click",t=>{1==a.hidden?(_.setAttribute("aria-expanded",!0),a.hidden=!1):(_.setAttribute("aria-expanded",!1),a.hidden=!0)},this),t.defaultChecked=!!this._map,t.type="checkbox",(e.layer=this)._legendUrl?((r=document.createElement("a")).text=" "+this._title,r.href=this._legendUrl,r.target="_blank",r.draggable=!1,e.appendChild(r)):e.innerHTML=this._title,e.id="mapml-layer-item-name-{"+L.stamp(e)+"}",m.innerText="Opacity",m.id="mapml-layer-item-opacity-"+L.stamp(m),l.appendChild(m),l.appendChild(u),u.setAttribute("type","range"),u.setAttribute("min","0"),u.setAttribute("max","1.0"),u.setAttribute("value",this._container.style.opacity||"1.0"),u.setAttribute("step","0.1"),u.setAttribute("aria-labelledby",m.id),u.value=this._container.style.opacity||"1.0",i.setAttribute("aria-grabbed","false"),i.setAttribute("aria-labelledby",e.id),i.onmousedown=e=>{if("input"!==e.target.tagName.toLowerCase()&&"select"!==e.target.tagName.toLowerCase()){e.preventDefault();let r=i,l=i.parentNode,t=!1,u=e.clientY;document.body.onmousemove=a=>{a.preventDefault();var s=a.clientY-u;if(t=5<Math.abs(s)||t,!(l&&!t||l&&l.childElementCount<=1||l.getBoundingClientRect().top>r.getBoundingClientRect().bottom||l.getBoundingClientRect().bottom<r.getBoundingClientRect().top)){l.classList.add("mapml-draggable"),r.style.transform="translateY("+s+"px)",r.style.pointerEvents="none";let t=a.clientX,e=a.clientY,i=("MAPML-VIEWER"===h.tagName?h:h.querySelector(".mapml-web-map")).shadowRoot,o=i.elementFromPoint(t,e),n=o&&o.closest("fieldset")?o.closest("fieldset"):r;n=Math.abs(s)<=n.offsetHeight?r:n,r.setAttribute("aria-grabbed","true"),r.setAttribute("aria-dropeffect","move"),n&&l===n.parentNode&&(n=n!==r.nextSibling?n:n.nextSibling,r!==n&&(u=a.clientY,r.style.transform=null),l.insertBefore(r,n))}},document.body.onmouseup=()=>{r.setAttribute("aria-grabbed","false"),r.removeAttribute("aria-dropeffect"),r.style.pointerEvents=null,r.style.transform=null;let t=l.children,e=1;for(var i of t){let t=i.querySelector("span").layer._layerEl;t.setAttribute("data-moving",""),h.insertAdjacentElement("beforeend",t),t.removeAttribute("data-moving"),t._layer.setZIndex(e),e++}l.classList.remove("mapml-draggable"),document.body.onmousemove=document.body.onmouseup=null}}},L.DomEvent.on(u,"change",this._changeOpacity,this),s.appendChild(t),s.appendChild(e),_.appendChild(o),o.appendChild(p),this._styles&&a.appendChild(this._styles),this._userInputs){var y=document.createDocumentFragment(),g=this._templateVars;if(g)for(var f=0;f<g.length;f++)for(var x=g[f],b=0;b<x.values.length;b++){var v,A,M=x.values[b],C="#"+M.getAttribute("id");"map-select"!==M.tagName.toLowerCase()||y.querySelector(C)||(v=L.DomUtil.create("details","mapml-layer-item-time mapml-control-layers",y),A=L.DomUtil.create("summary"),(C=L.DomUtil.create("label")).innerText=M.getAttribute("name"),C.setAttribute("for",M.getAttribute("id")),A.appendChild(C),v.appendChild(A),v.appendChild(M.htmlselect))}a.appendChild(y)}return i},_initExtent:function(t){var G,e,i,o;function n(t){var e=this.responseXML||t;if(e.querySelector&&e.querySelector("map-feature")&&(G._content=e),!this.responseXML&&this.responseText&&(e=(new DOMParser).parseFromString(this.responseText,"text/xml")),this.readyState===this.DONE&&e.querySelector&&!e.querySelector("parsererror")){var i,o=e.querySelector("map-extent")||e.querySelector("map-meta[name=projection]");"map-extent"===o.tagName.toLowerCase()&&o.hasAttribute("units")?i=o.getAttribute("units"):"map-meta"===o.tagName.toLowerCase()&&o.hasAttribute("content")&&(i=M.metaContentToObject(o.getAttribute("content")).content);var n=i&&i===G.options.mapprojection,t=e.querySelector("map-meta[name=extent]"),a=!n&&e.querySelector("map-head map-link[rel=alternate][projection="+G.options.mapprojection+"]"),s=new URL(e.querySelector("map-base")?e.querySelector("map-base").getAttribute("href"):e.baseURI||this.responseURL,this.responseURL).href;if(o){if(!n&&a&&a.hasAttribute("href"))return void G.fire("changeprojection",{href:new URL(a.getAttribute("href"),s).href},!1);if(!n&&G._map&&1===G._map.options.mapEl.querySelectorAll("layer-").length)return void(G._map.options.mapEl.projection=i);if(o.querySelector("map-link[rel=tile],map-link[rel=image],map-link[rel=features],map-link[rel=query]")&&o.hasAttribute("units")){G._templateVars=[];var r=o.querySelectorAll("map-link[rel=tile],map-link[rel=image],map-link[rel=features],map-link[rel=query]"),l=new RegExp("(?:{)(.*?)(?:})","g"),u=o.querySelector('map-input[type="zoom" i]'),m=!1,p={zoom:0};if(t){var c=M.metaContentToObject(t.getAttribute("content"));p.zoom=c.zoom||p.zoom;let e=Object.keys(c);for(let t=0;t<e.length;t++)if(!e[t].includes("zoom")){p.cs=M.axisToCS(e[t].split("-")[2]);break}var h=M.csToAxes(p.cs);p.bounds=M.boundsToPCRSBounds(L.bounds(L.point(+c["top-left-"+h[0]],+c["top-left-"+h[1]]),L.point(+c["bottom-right-"+h[0]],+c["bottom-right-"+h[1]])),p.zoom,i,p.cs)}else p.bounds=M[i].options.crs.pcrs.bounds,p.cs="PCRS";for(var d=0;d<r.length;d++){var _=r[d];if(!(g=_.getAttribute("tref"))){var y,g=V;for(y of e.querySelectorAll("map-input"))g+=`{${y.getAttribute("name")}}`}for(var f=_.hasAttribute("title")?_.getAttribute("title"):"Query this layer",x=g.match(l),b=_.hasAttribute("rel")&&"tile"!==_.getAttribute("rel").toLowerCase()?_.getAttribute("rel").toLowerCase():"tile",v=_.hasAttribute("type")?_.getAttribute("type").toLowerCase():"image/*",A=[],C=_&&_.hasAttribute("tms"),E=e.querySelector("map-meta[name=zoom]")?M.metaContentToObject(e.querySelector("map-meta[name=zoom]").getAttribute("content")):void 0;null!==(S=l.exec(g));){var S,T=S[1],z=o.querySelector("map-input[name="+T+"],map-select[name="+T+"]");if(!z){console.log("input with name="+T+" not found for template variable of same name");break}if(z.hasAttribute("type")&&"location"===z.getAttribute("type")&&!z.hasAttribute("min")&&z.hasAttribute("axis")&&!["i","j"].includes(z.getAttribute("axis").toLowerCase())&&(u.setAttribute("value",p.zoom),S=z.getAttribute("axis"),T=M.convertPCRSBounds(p.bounds,p.zoom,i,M.axisToCS(S)),z.setAttribute("min",T.min[M.axisToXY(S)]),z.setAttribute("max",T.max[M.axisToXY(S)])),A.push(z),m=m||z.hasAttribute("type")&&"zoom"===z.getAttribute("type").toLowerCase(),z.hasAttribute("shard")){var k=z.getAttribute("list");z.servers=[];var I=o.querySelectorAll("map-datalist#"+k+" > map-option");0===I.length&&z.hasAttribute("value")&&(I=z.getAttribute("value").split(""));for(var P=0;P<I.length;P++)I[P].getAttribute?z.servers.push(I[P].getAttribute("value")):z.servers.push(I[P])}else"map-select"===z.tagName.toLowerCase()&&((k=document.createElement("div")).insertAdjacentHTML("afterbegin",z.outerHTML),z.htmlselect=k.querySelector("map-select"),z.htmlselect=function(e){var i=document.createElement("select"),o=e.getAttributeNames();for(let t=0;t<o.length;t++)i.setAttribute(o[t],e.getAttribute(o[t]));var n=e.children;for(let e=0;e<n.length;e++){var a=document.createElement("option"),s=n[e].getAttributeNames();for(let t=0;t<s.length;t++)a.setAttribute(s[t],n[e].getAttribute(s[t]));a.innerHTML=n[e].innerHTML,i.appendChild(a)}return i}(z.htmlselect),L.DomEvent.on(z.htmlselect,"change",G.redraw,G),G._userInputs||(G._userInputs=[]),G._userInputs.push(z.htmlselect))}(g&&x.length===A.length||g===V)&&("query"===b&&(G.queryable=!0),!m&&u&&A.push(u),G._templateVars.push({template:decodeURI(new URL(g,s)),linkEl:_,title:f,rel:b,type:v,values:A,zoomBounds:E,extentPCRSFallback:{bounds:p.bounds},projectionMatch:n||a,projection:o.getAttribute("units")||H,tms:C}))}}}else o=G._synthesizeExtent(e),e.querySelector("map-feature,map-tile")&&(G._content=e);G._parseLicenseAndLegend(e,G),G._extent=o;c=e.querySelector("map-link[rel=zoomin]"),h=e.querySelector("map-link[rel=zoomout]");if(delete G._extent.zoomin,delete G._extent.zoomout,c&&(G._extent.zoomin=new URL(c.getAttribute("href"),s).href),h&&(G._extent.zoomout=new URL(h.getAttribute("href"),s).href),G._templatedLayer&&G._templatedLayer.reset(G._templateVars),e.querySelector("map-tile")){var w=document.createElement("map-tiles"),B=e.querySelector("map-meta[name=zoom][content]")||e.querySelector("map-input[type=zoom][value]");w.setAttribute("zoom",B&&B.getAttribute("content")||B&&B.getAttribute("value")||"0");for(var F=e.getElementsByTagName("map-tile"),q=0;q<F.length;q++)w.appendChild(document.importNode(F[q],!0));G._mapmlTileContainer.appendChild(w)}M.parseStylesheetAsHTML(e,s,G._container);var D=e.querySelectorAll('map-link[rel=style],map-link[rel="self style"],map-link[rel="style self"]');if(1<D.length){var N=document.createElement("details"),B=document.createElement("summary");B.innerText="Style",N.appendChild(B);for(var R=function(t){G.fire("changestyle",{src:t.target.getAttribute("data-href")},!1)},O=0;O<D.length;O++){var U=document.createElement("div"),j=U.appendChild(document.createElement("input"));j.setAttribute("type","radio"),j.setAttribute("id","rad-"+L.stamp(j)),j.setAttribute("name","styles-"+G._title),j.setAttribute("value",D[O].getAttribute("title")),j.setAttribute("data-href",new URL(D[O].getAttribute("href"),s).href);var Z=U.appendChild(document.createElement("label"));Z.setAttribute("for","rad-"+L.stamp(j)),Z.innerText=D[O].getAttribute("title"),"style self"!==D[O].getAttribute("rel")&&"self style"!==D[O].getAttribute("rel")||(j.checked=!0),N.appendChild(U),L.DomUtil.addClass(N,"mapml-layer-item-style mapml-control-layers"),L.DomEvent.on(j,"click",R,G)}G._styles=N}e.querySelector("map-title")?G._title=e.querySelector("map-title").textContent.trim():e instanceof Element&&e.hasAttribute("label")&&(G._title=e.getAttribute("label").trim()),G._map&&(G._validateExtent(),G._map.hasLayer(G)&&G._map.attributionControl.addAttribution(G.getAttribution()))}else G.error=!0;G.fire("extentload",G,!1),G._layerEl.dispatchEvent(new CustomEvent("extentload",{detail:G}))}(this._href||t)&&((G=this)._href?(e=new XMLHttpRequest,i=this._href,o=n,e.onreadystatechange=function(){this.readyState===this.DONE&&(400!==this.status&&404!==this.status&&500!==this.status&&406!==this.status||(G.error=!0,G.fire("extentload",G,!0),e.abort()))},e.onload=o,e.onerror=function(){G.error=!0,G.fire("extentload",G,!0)},e.open("GET",i),e.setRequestHeader("Accept",M.mime),e.overrideMimeType("text/xml"),e.send()):t&&n.call(this,t))},_createExtent:function(){var t=document.createElement("map-extent"),e=document.createElement("map-input"),i=document.createElement("map-input"),o=document.createElement("map-input"),n=document.createElement("map-input"),a=document.createElement("map-input"),s=document.createElement("map-input");return a.setAttribute("type","zoom"),a.setAttribute("min","0"),a.setAttribute("max","0"),e.setAttribute("type","xmin"),e.setAttribute("min",""),e.setAttribute("max",""),i.setAttribute("type","ymin"),i.setAttribute("min",""),i.setAttribute("max",""),o.setAttribute("type","xmax"),o.setAttribute("min",""),o.setAttribute("max",""),n.setAttribute("type","ymax"),n.setAttribute("min",""),n.setAttribute("max",""),s.setAttribute("type","projection"),s.setAttribute("value","WGS84"),t.appendChild(e),t.appendChild(i),t.appendChild(o),t.appendChild(n),t.appendChild(a),t.appendChild(s),t},_validateExtent:function(){var t,e,i,o,n,a,s=this._extent;s&&s.querySelector&&this._map&&(s.querySelector('[type=xmin][min=""], [type=xmin][max=""], [type=xmax][min=""], [type=xmax][max=""], [type=ymin][min=""], [type=ymin][max=""]')&&(t=s.querySelector("[type=xmin]"),e=s.querySelector("[type=ymin]"),i=s.querySelector("[type=xmax]"),o=s.querySelector("[type=ymax]"),(n=s.querySelector("[type=projection][value]"))?(n=n.getAttribute("value"))&&"WGS84"===n?(a=this._map.getBounds(),t.setAttribute("min",a.getWest()),t.setAttribute("max",a.getEast()),e.setAttribute("min",a.getSouth()),e.setAttribute("max",a.getNorth()),i.setAttribute("min",a.getWest()),i.setAttribute("max",a.getEast()),o.setAttribute("min",a.getSouth()),o.setAttribute("max",a.getNorth())):n&&(a=this._map.getPixelBounds(),t.setAttribute("min",a.getBottomLeft().x),t.setAttribute("max",a.getTopRight().x),e.setAttribute("min",a.getTopRight().y),e.setAttribute("max",a.getBottomLeft().y),i.setAttribute("min",a.getBottomLeft().x),i.setAttribute("max",a.getTopRight().x),o.setAttribute("min",a.getTopRight().y),o.setAttribute("max",a.getBottomLeft().y)):this.error=!0),s.querySelector('[type=zoom][min=""], [type=zoom][max=""]')&&((a=s.querySelector("[type=zoom]")).setAttribute("min",this._map.getMinZoom()),a.setAttribute("max",this._map.getMaxZoom())),(s=s.hasAttribute("units")?s.getAttribute("units"):null)&&M[s]?this.crs=M[s]:this.crs=M.OSMTILE)},_getMapMLExtent:function(t,e,i){var o=this._createExtent(),n=o.querySelector("map-input[type=zoom]"),a=o.querySelector("map-input[type=xmin]"),s=o.querySelector("map-input[type=ymin]"),r=o.querySelector("map-input[type=xmax]"),l=o.querySelector("map-input[type=ymax]"),u=o.querySelector("map-input[type=projection]"),m=void 0!==e[0]&&void 0!==e[1]?Math.min(e[0],e[1]):"",p=void 0!==e[0]&&void 0!==e[1]?Math.max(e[0],e[1]):"",c=t?t._southWest?t.getWest():t.getBottomLeft().x:"",h=t?t._southWest?t.getSouth():t.getTopRight().y:"",d=t?t._southWest?t.getEast():t.getTopRight().x:"",e=t?t._southWest?t.getNorth():t.getBottomLeft().y:"";return n.setAttribute("min","number"==typeof m&&isNaN(m)?"":m),n.setAttribute("max","number"==typeof p&&isNaN(p)?"":p),a.setAttribute("min",c),a.setAttribute("max",d),s.setAttribute("min",h),s.setAttribute("max",e),r.setAttribute("min",c),r.setAttribute("max",d),l.setAttribute("min",h),l.setAttribute("max",e),u.setAttribute("value",t&&t._southWest&&!i?"WGS84":i),o},_synthesizeExtent:function(t){var e,i,o,n,a,s,r,l,u,m,p,c,h=t.querySelectorAll("map-meta[name=zoom]")[0],d=t.querySelector("map-meta[name=extent]"),t=t.querySelector("map-meta[name=projection]"),t=t?t.getAttribute("content"):H;if(h)for(i=h.getAttribute("content").split(","),e=0;e<i.length;e++)m=(u=i[e].split("="))[0],p=u[1],"min"===m&&(o=parseInt(p)),"max"===m&&(n=parseInt(p));if(d)for(i=d.getAttribute("content").split(","),e=0;e<i.length;e++)m=(u=i[e].split("="))[0],p=u[1],"xmin"===m&&(a=parseFloat(p)),"xmax"===m&&(r=parseFloat(p)),"ymin"===m&&(s=parseFloat(p)),"ymax"===m&&(l=parseFloat(p));return a&&s&&r&&l&&"WGS84"===t?(d=L.latLng(s,a),c=L.latLng(l,r),c=L.latLngBounds(d,c)):a&&s&&r&&l&&(c=L.bounds([[a,s],[r,l]])),this._getMapMLExtent(c,[o,n],t)},getProjection:function(){let t=this._extent;if(!t)return H;switch(t.tagName.toUpperCase()){case"MAP-EXTENT":if(t.hasAttribute("units"))return t.getAttribute("units").toUpperCase();break;case"MAP-INPUT":if(t.hasAttribute("value"))return t.getAttribute("value").toUpperCase();break;case"MAP-META":if(t.hasAttribute("content"))return M.metaContentToObject(t.getAttribute("content")).content.toUpperCase();break;default:return H}return H},_parseLicenseAndLegend:function(t,e){var i,o=t.querySelector("map-link[rel=license]");o&&(i=o.getAttribute("title"),i='<a href="'+o.getAttribute("href")+'" title="'+i+'">'+i+"</a>"),L.setOptions(e,{attribution:i});t=t.querySelector("map-link[rel=legend]");t&&(e._legendUrl=t.getAttribute("href"))},_getUnprojectedMapLatLngBounds:function(t){var e=(t=t||this._map).getPixelOrigin(),i=t.getPixelBounds(),o=t.unproject(e),n=t.unproject(i.getBottomLeft()),i=t.unproject(i.getTopRight()),t=t.unproject(e.add(t.getSize()));return L.latLngBounds(n,i).extend(t).extend(o)},_projectionMatches:function(t){t=t||this._map;var e=this.getProjection();return!(!t.options.projection||"WGS84"!==e&&t.options.projection!==e)},getQueryTemplates:function(){if(this._templatedLayer&&this._templatedLayer._queries)return this._templatedLayer._queries},_attachSkipButtons:function(t){let n=t.popup,a=t.target,e,s,i=n._container.getElementsByClassName("mapml-popup-content")[0];n._container.setAttribute("role","dialog"),i.setAttribute("tabindex","-1"),i.setAttribute("role","document"),n._count=0,n._source._eventParents?(e=n._source._eventParents[Object.keys(n._source._eventParents)[0]],s=n._source.group):e=n._source._templatedLayer,n._container.querySelector('nav[class="mapml-focus-buttons"]')&&(L.DomUtil.remove(n._container.querySelector('nav[class="mapml-focus-buttons"]')),L.DomUtil.remove(n._container.querySelector("hr")));var o=L.DomUtil.create("nav","mapml-focus-buttons");let r=L.DomUtil.create("button","mapml-popup-button",o);r.type="button",r.title="Focus Map",r.innerHTML="<span aria-hidden='true'>|&#10094;</span>",L.DomEvent.on(r,"click",t=>{L.DomEvent.stop(t),a.featureIndex._sortIndex(),a.closePopup(),a._container.focus()},n);let l=L.DomUtil.create("button","mapml-popup-button",o);l.type="button",l.title="Previous Feature",l.innerHTML="<span aria-hidden='true'>&#10094;</span>",L.DomEvent.on(l,"click",e._previousFeature,n);let u=L.DomUtil.create("p","mapml-feature-count",o),m=this._totalFeatureCount||1;u.innerText=n._count+1+"/"+m;let p=L.DomUtil.create("button","mapml-popup-button",o);p.type="button",p.title="Next Feature",p.innerHTML="<span aria-hidden='true'>&#10095;</span>",L.DomEvent.on(p,"click",e._nextFeature,n);let c=L.DomUtil.create("button","mapml-popup-button",o);c.type="button",c.title="Focus Controls",c.innerHTML="<span aria-hidden='true'>&#10095;|</span>",L.DomEvent.on(c,"click",t=>{a.featureIndex._sortIndex(),a.featureIndex.currentIndex=a.featureIndex.inBoundFeatures.length-1,a.featureIndex.inBoundFeatures[0].path.setAttribute("tabindex",-1),a.featureIndex.inBoundFeatures[a.featureIndex.currentIndex].path.setAttribute("tabindex",0),L.DomEvent.stop(t),a.closePopup(),a._controlContainer.querySelector("A").focus()},n);t=L.DomUtil.create("hr");function h(t){let e=t.originalEvent.path||t.originalEvent.composedPath();var i=9===t.originalEvent.keyCode,o=t.originalEvent.shiftKey;(e[0].classList.contains("leaflet-popup-close-button")&&i&&!o||27===t.originalEvent.keyCode||("Focus Map"===e[0].title||e[0].classList.contains("mapml-popup-content"))&&i&&o)&&setTimeout(()=>{L.DomEvent.stop(t),a.closePopup(n),s.focus()},0)}function d(t){let e=t.originalEvent.path||t.originalEvent.composedPath();var i=9===t.originalEvent.keyCode,o=t.originalEvent.shiftKey;13===t.originalEvent.keyCode&&e[0].classList.contains("leaflet-popup-close-button")||27===t.originalEvent.keyCode?(L.DomEvent.stopPropagation(t),a._container.focus(),a.closePopup(n),27!==t.originalEvent.keyCode&&(a._popupClosed=!0)):i&&e[0].classList.contains("leaflet-popup-close-button")?a.closePopup(n):("Focus Map"===e[0].title||e[0].classList.contains("mapml-popup-content"))&&i&&o&&setTimeout(()=>{L.DomEvent.stop(t),a.closePopup(n),a._container.focus()},0)}n._navigationBar=o,n._content.appendChild(t),n._content.appendChild(o),i.focus(),s?(s.setAttribute("aria-expanded","true"),a.on("keydown",h)):a.on("keydown",d),a.on("popupclose",function t(e){e.popup===n&&(a.off("keydown",h),a.off("keydown",d),a.off("popupclose",t),s&&s.setAttribute("aria-expanded","false"))})}}),v=L.Layer.extend({onAdd:function(t){var e=t.getSize();(400<e.x||300<e.y)&&(this._container=L.DomUtil.create("table","mapml-debug",t._container),this._panel=C({className:"mapml-debug-panel",pane:this._container}),t.addLayer(this._panel)),this._grid=S({className:"mapml-debug-grid",pane:t._panes.mapPane,zIndex:400,tileSize:t.options.crs.options.crs.tile.bounds.max.x}),t.addLayer(this._grid),this._vectors=z({className:"mapml-debug-vectors",pane:t._panes.mapPane,toolPane:this._container}),t.addLayer(this._vectors)},onRemove:function(t){t.removeLayer(this._grid),t.removeLayer(this._vectors),this._panel&&(t.removeLayer(this._panel),L.DomUtil.remove(this._container))}}),A=L.Layer.extend({initialize:function(t){L.setOptions(this,t)},onAdd:function(t){this._title=L.DomUtil.create("caption","mapml-debug-banner",this.options.pane),this._title.innerHTML="Debug mode",t.debug={},t.debug._infoContainer=this._debugContainer=L.DomUtil.create("tbody","mapml-debug-panel",this.options.pane);var e=t.debug._infoContainer;t.debug._tileCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._tileMatrixCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._mapCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._tcrsCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._pcrsCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._gcrsCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),this._map.on("mousemove",this._updateCoords)},onRemove:function(){L.DomUtil.remove(this._title),this._debugContainer&&(L.DomUtil.remove(this._debugContainer),this._map.off("mousemove",this._updateCoords))},_updateCoords:function(r){if(!this.contextMenu._visible){let t=this.options.mapEl,e=t._map.project(r.latlng),i=t._map.options.crs.scale(+t.zoom),o=t._map.options.crs.transformation.untransform(e,i),n=t._map.options.crs.options.crs.tile.bounds.max.x,a=e.x%n,s=e.y%n;a<0&&(a+=n),s<0&&(s+=n),this.debug._tileCoord.innerHTML=`
+!function(){"use strict";function t(t){return new i(t)}function e(t,e){return new o(t,e)}var i=L.GridLayer.extend({initialize:function(t){this.zoomBounds=this._getZoomBounds(t.tileContainer,t.maxZoomBound),L.extend(t,this.zoomBounds),L.setOptions(this,t),this._groups=this._groupTiles(this.options.tileContainer.getElementsByTagName("map-tile"))},onAdd:function(){this._bounds=this._getLayerBounds(this._groups,this._map.options.projection),this.layerBounds=this._bounds[Object.keys(this._bounds)[0]];for(var t of Object.keys(this._bounds))this.layerBounds.extend(this._bounds[t].min),this.layerBounds.extend(this._bounds[t].max);L.GridLayer.prototype.onAdd.call(this,this._map),this._handleMoveEnd()},getEvents:function(){let t=L.GridLayer.prototype.getEvents.call(this,this._map);return this._parentOnMoveEnd=t.moveend,t.moveend=this._handleMoveEnd,t.move=()=>{},t},_handleMoveEnd:function(t){var e=this._map.getZoom();let i=e;i=i>this.options.maxNativeZoom?this.options.maxNativeZoom:i,i=i<this.options.minNativeZoom?this.options.minNativeZoom:i,this.isVisible=e<=this.zoomBounds.maxZoom&&e>=this.zoomBounds.minZoom&&this._bounds[i]&&this._bounds[i].overlaps(M.pixelToPCRSBounds(this._map.getPixelBounds(),this._map.getZoom(),this._map.options.projection)),this.isVisible&&this._parentOnMoveEnd()},_isValidTile(t){return this._groups[this._tileCoordsToKey(t)]},createTile:function(t){let i=this._groups[this._tileCoordsToKey(t)]||[],o=document.createElement("map-tile"),n=this.getTileSize();o.setAttribute("col",t.x),o.setAttribute("row",t.y),o.setAttribute("zoom",t.z);for(let e=0;e<i.length;e++){let t=document.createElement("img");t.width=n.x,t.height=n.y,t.alt="",t.setAttribute("role","presentation"),t.src=i[e].src,o.appendChild(t)}return o},_getLayerBounds:function(t,e){let i={},o=M[e].options.crs.tile.bounds.max.x;for(var n in t){let t=n.split(":"),e={};e.x=+t[0]*o,e.y=+t[1]*o,e.z=+t[2],t[2]in i?(i[t[2]].extend(L.point(e.x,e.y)),i[t[2]].extend(L.point(e.x+o,e.y+o))):i[t[2]]=L.bounds(L.point(e.x,e.y),L.point(e.x+o,e.y+o))}for(var a in i){var s=+a;i[a]=M.pixelToPCRSBounds(i[a],s,e)}return i},_getZoomBounds:function(t,e){if(!t)return null;let i=M.metaContentToObject(t.getElementsByTagName("map-tiles")[0].getAttribute("zoom")),o={},n=t.getElementsByTagName("map-tile");o.nativeZoom=+i.value||0,o.maxNativeZoom=0,o.minNativeZoom=e;for(let e=0;e<n.length;e++){let t=+n[e].getAttribute("zoom");n[e].getAttribute("zoom")||(t=o.nativeZoom),o.minNativeZoom=Math.min(o.minNativeZoom,t),o.maxNativeZoom=Math.max(o.maxNativeZoom,t)}return o.minZoom=o.minNativeZoom-2<=0?0:o.minNativeZoom-2,o.maxZoom=e,i.min&&(o.minZoom=+i.min<o.minNativeZoom-2?o.minNativeZoom-2:+i.min),i.max&&(o.maxZoom=+i.max),o},_groupTiles:function(i){let o={};for(let e=0;e<i.length;e++){let t={};t.row=+i[e].getAttribute("row"),t.col=+i[e].getAttribute("col"),t.zoom=+i[e].getAttribute("zoom")||this.options.nativeZoom,t.src=i[e].getAttribute("src");var n=t.col+":"+t.row+":"+t.zoom;n in o?o[n].push(t):o[n]=[t]}return o}}),o=L.Control.Layers.extend({options:{autoZIndex:!1,sortLayers:!0,sortFunction:function(t,e){return t.options.zIndex<e.options.zIndex?-1:t.options.zIndex>e.options.zIndex?1:0}},initialize:function(t,e){for(var i in L.setOptions(this,e),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,t)this._addLayer(t[i],i,!0)},onAdd:function(){return this._initLayout(),this._map.on("validate",this._validateInput,this),L.DomEvent.on(this.options.mapEl,"layerchange",this._validateInput,this),L.DomEvent.on(this._container,"keydown",this._focusFirstLayer,this._container),this._update(),this._layers.length<1&&!this._map._showControls?this._container.setAttribute("hidden",""):this._map._showControls=!0,this._container},onRemove:function(t){t.off("validate",this._validateInput,this),L.DomEvent.off(this._container,"keydown",this._focusFirstLayer,this._container);for(var e=0;e<this._layers.length;e++)this._layers[e].layer.off("add remove",this._onLayerChange,this),this._layers[e].layer.off("extentload",this._validateInput,this)},addOrUpdateOverlay:function(t,e){for(var i=!1,o=0;o<this._layers.length;o++)if(this._layers[o].layer===t){i=!0,this._layers[o].name=e;break}return i||this.addOverlay(t,e),0<this._layers.length&&(this._container.removeAttribute("hidden"),this._map._showControls=!0),this._map?this._update():this},removeLayer:function(t){L.Control.Layers.prototype.removeLayer.call(this,t),0===this._layers.length&&this._container.setAttribute("hidden","")},_validateInput:function(t){for(let o=0;o<this._layers.length;o++)if(this._layers[o].input.labels[0]){let t=this._layers[o].input.labels[0].getElementsByTagName("span"),e=this._layers[o].input.labels[0].getElementsByTagName("input");if(e[0].checked=this._layers[o].layer._layerEl.checked,this._layers[o].layer._layerEl.disabled&&this._layers[o].layer._layerEl.checked?(e[0].closest("fieldset").disabled=!0,t[0].style.fontStyle="italic"):(e[0].closest("fieldset").disabled=!1,t[0].style.fontStyle="normal"),this._layers[o].layer._extent&&this._layers[o].layer._extent._mapExtents)for(let i=0;i<this._layers[o].layer._extent._mapExtents.length;i++){let t=this._layers[o].layer._extent._mapExtents[i].extentAnatomy,e=t.getElementsByClassName("mapml-layer-item-name")[0];this._layers[o].layer._extent._mapExtents[i].disabled&&this._layers[o].layer._extent._mapExtents[i].checked?(e.style.fontStyle="italic",t.disabled=!0):(e.style.fontStyle="normal",t.disabled=!1)}}},_focusFirstLayer:function(t){var e;"Enter"!==t.key||"leaflet-control-layers leaflet-control leaflet-control-layers-expanded"==this.className||(e=this.children[1].children[2].children[0].children[0].children[0].children[0])&&setTimeout(()=>e.focus(),0)},_withinZoomBounds:function(t,e){return e.min<=t&&t<=e.max},_addItem:function(t){var e=t.layer.getLayerUserControlsHTML();return t.input=e.querySelector("input"),this._layerControlInputs.push(t.input),t.input.layerId=L.stamp(t.layer),L.DomEvent.on(t.input,"click",this._onInputClick,this),t.layer.on("extentload",this._validateInput,this),this._overlaysList.appendChild(e),e},collapse:function(t){return"SELECT"===t.target.tagName||t.relatedTarget&&t.relatedTarget.parentElement&&("mapml-contextmenu mapml-layer-menu"===t.relatedTarget.className||"mapml-contextmenu mapml-layer-menu"===t.relatedTarget.parentElement.className)||this._map&&"block"===this._map.contextMenu._layerMenu.style.display||L.DomUtil.removeClass(this._container,"leaflet-control-layers-expanded"),this}});const B="OSMTILE",d="TILEMATRIX",P="mapmltemplatedtileplaceholder";function n(t,e){return new h(t,e)}function a(t,e){return new _(t,e)}function s(t,e){return new y(t,e)}function r(t,e){return new x(t,e)}function l(t,e){return new g(t,e)}function m(t,e,i,o,n,a){return new f(t,e,i,o,n,a)}function u(t,e,i){return t||e?new b(t,e,i):null}function p(){return new v}function c(t){return new J(t)}var h=L.FeatureGroup.extend({initialize:function(t,e){var i;L.setOptions(this,e),this.options.static&&(this._container=L.DomUtil.create("div","leaflet-layer",this.options.pane),L.DomUtil.addClass(this._container,"leaflet-pane mapml-vector-container"),L.setOptions(this.options.renderer,{pane:this._container})),this._layers={},this.options.query&&(this._mapmlFeatures=t.features||t,this.isVisible=!0,i=this._getNativeVariables(t),this.options.nativeZoom=i.zoom,this.options.nativeCS=i.cs),t&&!this.options.query&&(i=this._getNativeVariables(t),!t.querySelector("map-extent")&&t.querySelector("map-feature")&&this.options.static&&(this._features={},this._staticFeature=!0,this.isVisible=!0,this.zoomBounds=this._getZoomBounds(t,i.zoom),this.layerBounds=this._getLayerBounds(t),L.extend(this.options,this.zoomBounds)),this.addData(t,i.cs,i.zoom),this._staticFeature&&(this._resetFeatures(this._clampZoom(this.options._leafletLayer._map.getZoom())),this.options._leafletLayer._map._addZoomLimit(this)))},onAdd:function(t){L.FeatureGroup.prototype.onAdd.call(this,t),this._mapmlFeatures&&t.on("featurepagination",this.showPaginationFeature,this)},onRemove:function(t){this._mapmlFeatures&&(t.off("featurepagination",this.showPaginationFeature,this),delete this._mapmlFeatures,L.DomUtil.remove(this._container)),L.FeatureGroup.prototype.onRemove.call(this,t),this._map.featureIndex.cleanIndex()},getEvents:function(){return this._staticFeature?{moveend:this._handleMoveEnd,zoomend:this._handleZoomEnd}:{moveend:this._removeCSS}},showPaginationFeature:function(e){if(this.options.query&&this._mapmlFeatures[e.i]){let t=this._mapmlFeatures[e.i];this.clearLayers(),this.addData(t,this.options.nativeCS,this.options.nativeZoom),e.popup._navigationBar.querySelector("p").innerText=e.i+1+"/"+this.options._leafletLayer._totalFeatureCount,e.popup._content.querySelector("iframe").setAttribute("sandbox","allow-same-origin allow-forms"),e.popup._content.querySelector("iframe").srcdoc=t.querySelector("map-properties").innerHTML}},_getNativeVariables:function(t){return{zoom:t.querySelector("map-meta[name=zoom]")&&+M.metaContentToObject(t.querySelector("map-meta[name=zoom]").getAttribute("content")).value||0,cs:t.querySelector("map-meta[name=cs]")&&M.metaContentToObject(t.querySelector("map-meta[name=cs]").getAttribute("content")).content||"GCRS"}},_handleMoveEnd:function(){var t=this._map.getZoom(),e=t<=this.zoomBounds.maxZoom&&t>=this.zoomBounds.minZoom;this.isVisible=e&&this._layers&&this.layerBounds&&this.layerBounds.overlaps(M.pixelToPCRSBounds(this._map.getPixelBounds(),t,this._map.options.projection)),this._removeCSS()},_handleZoomEnd:function(t){var e=this._map.getZoom();e>this.zoomBounds.maxZoom||e<this.zoomBounds.minZoom?this.clearLayers():(e=this._clampZoom(e),this._resetFeatures(e))},_getLayerBounds:function(t){if(!t)return null;let i=d,o=t.querySelector("map-meta[name=projection]")&&M.metaContentToObject(t.querySelector("map-meta[name=projection]").getAttribute("content")).content.toUpperCase()||B;try{var n=t.querySelector("map-meta[name=extent]")&&M.metaContentToObject(t.querySelector("map-meta[name=extent]").getAttribute("content")),a=n.zoom||0;let e=Object.keys(n);for(let t=0;t<e.length;t++)if(!e[t].includes("zoom")){i=M.axisToCS(e[t].split("-")[2]);break}var s=M.csToAxes(i);return M.boundsToPCRSBounds(L.bounds(L.point(+n["top-left-"+s[0]],+n["top-left-"+s[1]]),L.point(+n["bottom-right-"+s[0]],+n["bottom-right-"+s[1]])),a,o,i)}catch(t){return M.boundsToPCRSBounds(M[o].options.crs.tilematrix.bounds(0),0,o,i)}},_resetFeatures:function(e){if(this.clearLayers(),this._map&&this._map.featureIndex.cleanIndex(),this._features&&this._features[e])for(let t=0;t<this._features[e].length;t++)this.addLayer(this._features[e][t])},_clampZoom:function(t){return t>this.zoomBounds.maxZoom||t<this.zoomBounds.minZoom?t:void 0!==this.zoomBounds.minNativeZoom&&t<this.zoomBounds.minNativeZoom?this.zoomBounds.minNativeZoom:void 0!==this.zoomBounds.maxNativeZoom&&this.zoomBounds.maxNativeZoom<t?this.zoomBounds.maxNativeZoom:t},_setZoomTransform:function(t,e){var i=this._map.getZoomScale(this._map.getZoom(),e),t=t.multiplyBy(i).subtract(this._map._getNewPixelOrigin(t,this._map.getZoom())).round();any3d?L.setTransform(this._layers[e],t,i):L.setPosition(this._layers[e],t)},_getZoomBounds:function(t,i){if(!t)return null;let o=100,n=0,a=t.getElementsByTagName("map-feature"),e,s;for(let e=0;e<a.length;e++){let t=+a[e].getAttribute("zoom");a[e].getAttribute("zoom")||(t=i),n=Math.max(n,t),o=Math.min(o,t)}try{s=M.metaContentToObject(t.querySelector("map-meta[name=projection]").getAttribute("content")).content,e=M.metaContentToObject(t.querySelector("map-meta[name=zoom]").getAttribute("content"))}catch(t){return{minZoom:0,maxZoom:M[s||B].options.resolutions.length-1,minNativeZoom:o,maxNativeZoom:n}}return{minZoom:+e.min,maxZoom:+e.max,minNativeZoom:o,maxNativeZoom:n}},addData:function(o,n,a){var t,e,i,s=o.nodeType===Node.DOCUMENT_NODE||"LAYER-"===o.nodeName?o.getElementsByTagName("map-feature"):null;if((o.nodeType===Node.DOCUMENT_NODE?o.querySelector("map-link[rel=stylesheet],map-style"):null)&&(r=o.querySelector("map-base")&&o.querySelector("map-base").hasAttribute("href")?new URL(o.querySelector("map-base").getAttribute("href")).href:o.URL,M.parseStylesheetAsHTML(o,r,this._container)),s){for(t=0,e=s.length;t<e;t++)(i=s[t]).getElementsByTagName("map-geometry").length&&i.getElementsByTagName("map-coordinates").length&&this.addData(i,n,a);return this}var r=this.options;if(!r.filter||r.filter(o)){o.classList.length&&(r.className=o.classList.value);let t=o.getAttribute("zoom")||a,e=o.querySelector("map-featurecaption");e=e?e.innerHTML:"Feature",o.querySelector("map-properties")&&(r.properties=document.createElement("div"),r.properties.classList.add("mapml-popup-content"),r.properties.insertAdjacentHTML("afterbegin",o.querySelector("map-properties").innerHTML));let i=this.geometryToLayer(o,r,n,+t,e);if(i){if(!i.options.color&&o.hasAttribute("class")&&(i.options.className=o.getAttribute("class")),i.defaultOptions=i.options,this.resetStyle(i),r.onEachFeature&&i.bindTooltip(e,{interactive:!0,sticky:!0}),!this._staticFeature)return this.addLayer(i);o=o.getAttribute("zoom")||a;o in this._features?this._features[o].push(i):this._features[o]=[i]}}},resetStyle:function(t){var e=this.options.style;e&&(L.Util.extend(t.options,t.defaultOptions),this._setLayerStyle(t,e))},setStyle:function(e){this.eachLayer(function(t){this._setLayerStyle(t,e)},this)},_setLayerStyle:function(t,e){"function"==typeof e&&(e=e(t.feature)),t.setStyle&&t.setStyle(e)},_removeCSS:function(){var e=this._container.querySelectorAll("link[rel=stylesheet],style");for(let t=0;t<e.length;t++)this._container.removeChild(e[t])},geometryToLayer:function(t,e,i,o,n){let a="MAP-FEATURE"===t.tagName.toUpperCase()?t.getElementsByTagName("map-geometry")[0]:t,s=a.getAttribute("cs")||i,r=[],l=L.SVG.create("g"),m=Object.assign({},e);for(var u of a.querySelectorAll("map-polygon, map-linestring, map-multilinestring, map-point, map-multipoint"))r.push(M.feature(u,Object.assign(m,{nativeCS:s,nativeZoom:o,projection:this.options.projection,featureID:t.id,group:l,wrappers:this._getGeometryParents(u.parentElement),featureLayer:this,_leafletLayer:this.options._leafletLayer})));let p={group:l,featureID:t.id,accessibleTitle:n,onEachFeature:e.onEachFeature,properties:e.properties,_leafletLayer:this.options._leafletLayer},c=a.querySelector("map-multipolygon")||a.querySelector("map-geometrycollection");return c&&(p.wrappers=this._getGeometryParents(c.parentElement)),M.featureGroup(r,p)},_getGeometryParents:function(t,e=[]){return t&&"MAP-GEOMETRY"!==t.tagName.toUpperCase()?"MAP-MULTIPOLYGON"===t.tagName.toUpperCase()||"MAP-GEOMETRYCOLLECTION"===t.tagName.toUpperCase()?this._getGeometryParents(t.parentElement,e):this._getGeometryParents(t.parentElement,e.concat([t])):e}}),_=L.TileLayer.extend({initialize:function(t,e){var i=M.extractInputBounds(t);this.zoomBounds=i.zoomBounds,this.extentBounds=i.bounds,this.isVisible=!0,L.extend(e,this.zoomBounds),e.tms=t.tms,delete e.opacity,L.setOptions(this,e),this._setUpTileTemplateVars(t),t.tile.subdomains&&L.setOptions(this,L.extend(this.options,{subdomains:t.tile.subdomains})),this._template=t,this._initContainer(),L.TileLayer.prototype.initialize.call(this,t.template,L.extend(e,{pane:this._container}))},onAdd:function(){this._map._addZoomLimit(this),L.TileLayer.prototype.onAdd.call(this,this._map),this._handleMoveEnd()},getEvents:function(){let t=L.TileLayer.prototype.getEvents.call(this,this._map);return this._parentOnMoveEnd=t.moveend,t.moveend=this._handleMoveEnd,t},_initContainer:function(){this._container||(this._container=L.DomUtil.create("div","leaflet-layer",this.options.pane),L.DomUtil.addClass(this._container,"mapml-templated-tile-container"),this._updateZIndex())},_handleMoveEnd:function(t){var e=this._map.getZoom(),i=M.pixelToPCRSBounds(this._map.getPixelBounds(),e,this._map.options.projection);this.isVisible=e<=this.options.maxZoom&&e>=this.options.minZoom&&this.extentBounds.overlaps(i),this.isVisible&&this._parentOnMoveEnd()},createTile:function(e){let i=document.createElement("DIV"),o=this.getTileSize();if(L.DomUtil.addClass(i,"mapml-tile-group"),L.DomUtil.addClass(i,"leaflet-tile"),this._template.linkEl.dispatchEvent(new CustomEvent("tileloadstart",{detail:{x:e.x,y:e.y,zoom:e.z,appendTile:t=>{i.appendChild(t)}}})),this._template.type.startsWith("image/")){let t=L.TileLayer.prototype.createTile.call(this,e,function(){});t.width=o.x,t.height=o.y,i.appendChild(t)}else this._url.includes(P)||this._fetchTile(e,i);return i},_mapmlTileReady:function(t){L.DomUtil.addClass(t,"leaflet-tile-loaded")},getPane:function(){return this.options.pane},_fetchTile:function(e,i){fetch(this.getTileUrl(e),{redirect:"follow"}).then(function(t){return 200<=t.status&&t.status<300?Promise.resolve(t):(console.log("Looks like there was a problem. Status Code: "+t.status),Promise.reject(t))}).then(function(t){return t.text()}).then(t=>{return(new DOMParser).parseFromString(t,"application/xml")}).then(t=>{this._createFeatures(t,e,i),this._mapmlTileReady(i)}).catch(t=>{console.log("Error Creating Tile")})},_createFeatures:function(t,e,i){var o;t.querySelector("map-link[rel=stylesheet],map-style")&&(o=t.querySelector("map-base")&&t.querySelector("map-base").hasAttribute("href")?new URL(t.querySelector("map-base").getAttribute("href")).href:t.URL,M.parseStylesheetAsHTML(t,o,i));let n=L.SVG.create("svg"),a=L.SVG.create("g"),s=this._map.options.crs.options.crs.tile.bounds.max.x,r=e.x*s,l=e.y*s;var m,u=M.mapMlFeatures(t,{projection:this._map.options.projection,static:!1,interactive:!1});for(m in u._layers)for(var p in u._layers[m]._layers){let t=u._layers[m]._layers[p];M.FeatureRenderer.prototype._initPath(t,!1),t._project(this._map,L.point([r,l]),e.z),M.FeatureRenderer.prototype._addPath(t,a,!1),M.FeatureRenderer.prototype._updateFeature(t)}n.setAttribute("width",s.toString()),n.setAttribute("height",s.toString()),n.appendChild(a),i.appendChild(n)},getTileUrl:function(t){if(t.z>=this._template.tilematrix.bounds.length||!this._template.tilematrix.bounds[t.z].contains(t))return"";var e,i={};for(e in i[this._template.tilematrix.col.name]=t.x,i[this._template.tilematrix.row.name]=t.y,i[this._template.zoom.name]=this._getZoomForUrl(),i[this._template.pcrs.easting.left]=this._tileMatrixToPCRSPosition(t,"top-left").x,i[this._template.pcrs.easting.right]=this._tileMatrixToPCRSPosition(t,"top-right").x,i[this._template.pcrs.northing.top]=this._tileMatrixToPCRSPosition(t,"top-left").y,i[this._template.pcrs.northing.bottom]=this._tileMatrixToPCRSPosition(t,"bottom-left").y,i[this._template.tile.server]=this._getSubdomain(t),this._template.tile)["row","col","zoom","left","right","top","bottom"].indexOf(e)<0&&(i[e]=this._template.tile[e]);return this._map&&!this._map.options.crs.infinite&&(t=this._globalTileRange.max.y-t.y,this.options.tms&&(i[this._template.tilematrix.row.name]=t)),i.r=this.options.detectRetina&&L.Browser.retina&&0<this.options.maxZoom?"@2x":"",L.Util.template(this._url,i)},_tileMatrixToPCRSPosition:function(t,e){var i=this._map.options.crs,o=this.getTileSize(),n=t.scaleBy(o),a=n.add(o),o=n.add(Math.floor(o/2)),s=i.transformation.untransform(n,i.scale(t.z)),r=i.transformation.untransform(a,i.scale(t.z)),l=i.transformation.untransform(o,i.scale(t.z)),m=null;switch(e){case"top-left":m=s;break;case"bottom-left":m=new L.Point(s.x,r.y);break;case"center-left":m=new L.Point(s.x,l.y);break;case"top-right":m=new L.Point(r.x,s.y);break;case"bottom-right":m=r;break;case"center-right":m=new L.Point(r.x,l.y);break;case"top-center":m=new L.Point(l.x,s.y);break;case"bottom-center":m=new L.Point(l.x,r.y);break;case"center":m=l}return m},_setUpTileTemplateVars:function(t){t.tile={};for(var e,i,o,n,a,s=t.values,r=this.options.crs.options,l=0;l<t.values.length;l++){var m=s[l].getAttribute("type"),u=s[l].getAttribute("units"),p=s[l].getAttribute("axis"),c=s[l].getAttribute("name"),h=s[l].getAttribute("position"),d="hidden"===m&&s[l].hasAttribute("shard"),_="map-select"===s[l].tagName.toLowerCase(),y=s[l].getAttribute("value"),x=s[l].getAttribute("min"),g=s[l].getAttribute("max");if("location"===m&&"tilematrix"===u)switch(p){case"column":a={name:c,min:r.crs.tilematrix.horizontal.min,max:r.crs.tilematrix.horizontal.max(r.resolutions.length-1)},isNaN(Number.parseFloat(x))||(a.min=Number.parseFloat(x)),isNaN(Number.parseFloat(g))||(a.max=Number.parseFloat(g));break;case"row":n={name:c,min:r.crs.tilematrix.vertical.min,max:r.crs.tilematrix.vertical.max(r.resolutions.length-1)},isNaN(Number.parseFloat(x))||(n.min=Number.parseFloat(x)),isNaN(Number.parseFloat(g))||(n.max=Number.parseFloat(g));break;case"longitude":case"easting":i=i||{min:r.crs.pcrs.horizontal.min,max:r.crs.pcrs.horizontal.max},isNaN(Number.parseFloat(x))||(i.min=Number.parseFloat(x)),isNaN(Number.parseFloat(g))||(i.max=Number.parseFloat(g)),h&&(h.match(/.*?-left/i)?i.left=c:h.match(/.*?-right/i)&&(i.right=c));break;case"latitude":case"northing":o=o||{min:r.crs.pcrs.vertical.min,max:r.crs.pcrs.vertical.max},isNaN(Number.parseFloat(x))||(o.min=Number.parseFloat(x)),isNaN(Number.parseFloat(g))||(o.max=Number.parseFloat(g)),h&&(h.match(/top-.*?/i)?o.top=c:h.match(/bottom-.*?/i)&&(o.bottom=c))}else if(m&&"zoom"===m.toLowerCase())e={name:c,min:0,max:r.resolutions.length,value:r.resolutions.length},!isNaN(Number.parseInt(y,10))&&Number.parseInt(y,10)>=e.min&&Number.parseInt(y,10)<=e.max?e.value=Number.parseInt(y,10):e.value=e.max,!isNaN(Number.parseInt(x,10))&&Number.parseInt(x,10)>=e.min&&Number.parseInt(x,10)<=e.max&&(e.min=Number.parseInt(x,10)),!isNaN(Number.parseInt(g,10))&&Number.parseInt(g,10)>=e.min&&Number.parseInt(g,10)<=e.max&&(e.max=Number.parseInt(g,10)),t.zoom=e;else if(d)t.tile.server=c,t.tile.subdomains=s[l].servers.slice();else if(_){const z=s[l].htmlselect;t.tile[c]=function(){return z.value}}else{const k=s[l];t.tile[c]=function(){return k.getAttribute("value")}}}function f(t,e){return b.transform(t,E(e)).divideBy(v).floor()}var b=this.options.crs.transformation,v=this.options.crs.options.crs.tile.bounds.max.x,E=L.bind(this.options.crs.scale,this.options.crs);i&&o?(t.pcrs={},t.pcrs.bounds=L.bounds([i.min,o.min],[i.max,o.max]),t.pcrs.easting=i,t.pcrs.northing=o):a&&n&&!isNaN(e.value)?(t.pcrs||(t.pcrs={},t.pcrs.easting="",t.pcrs.northing=""),t.pcrs.bounds=M.boundsToPCRSBounds(L.bounds(L.point([a.min,n.min]),L.point([a.max,n.max])),e.value,this.options.crs,M.axisToCS("column")),t.tilematrix={},t.tilematrix.col=a,t.tilematrix.row=n):console.log("Unable to determine bounds for tile template: "+t.template),t.tilematrix||(t.tilematrix={},t.tilematrix.col={},t.tilematrix.row={}),t.tilematrix.bounds=[];for(var A=t.pcrs.bounds,C=t.zoom?t.zoom.min:0,S=t.zoom?t.zoom.max:r.resolutions.length,T=0;T<=S;T++)t.tilematrix.bounds[T]=C<=T?L.bounds(f(A.min,T),f(A.max,T)):L.bounds(L.point([-1,-1]),L.point([-1,-1]))}}),y=L.Layer.extend({initialize:function(t,e){this._templates=t,L.setOptions(this,e),this._container=L.DomUtil.create("div","leaflet-layer",e.pane),this._container.style.opacity=this.options.opacity,L.DomUtil.addClass(this._container,"mapml-templatedlayer-container");for(var i,o=0;o<t.length;o++)"tile"===t[o].rel?(this.setZIndex(e.extentZIndex),this._templates[o].layer=M.templatedTileLayer(t[o],L.Util.extend(e,{errorTileUrl:"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",zIndex:e.extentZIndex,pane:this._container}))):"image"===t[o].rel?(this.setZIndex(e.extentZIndex),this._templates[o].layer=M.templatedImageLayer(t[o],L.Util.extend(e,{zIndex:e.extentZIndex,pane:this._container}))):"features"===t[o].rel?(this.setZIndex(e.extentZIndex),this._templates[o].layer=M.templatedFeaturesLayer(t[o],L.Util.extend(e,{zIndex:e.extentZIndex,pane:this._container}))):"query"===t[o].rel&&(this.hasSetBoundsHandler=!0,this._queries||(this._queries=[]),i=M.extractInputBounds(t[o]),t[o].extentBounds=i.bounds,t[o].zoomBounds=i.zoomBounds,this._queries.push(L.extend(t[o],this._setupQueryVars(t[o]))))},getEvents:function(){return{zoomstart:this._onZoomStart}},redraw:function(){this.closePopup();for(var t=0;t<this._templates.length;t++)"tile"!==this._templates[t].rel&&"image"!==this._templates[t].rel&&"features"!==this._templates[t].rel||this._templates[t].layer.redraw()},_onZoomStart:function(){this.closePopup()},_setupQueryVars:function(t){for(var e={query:{}},i=t.values,o=0;o<t.values.length;o++){var n=i[o].getAttribute("type"),a=i[o].getAttribute("units"),s=i[o].getAttribute("axis"),r=i[o].getAttribute("name"),l=i[o].getAttribute("position"),m=i[o].getAttribute("rel"),u="map-select"===i[o].tagName.toLowerCase();if("width"===n)e.query.width=r;else if("height"===n)e.query.height=r;else if("location"===n)switch(s){case"x":case"y":case"column":case"row":e.query[s]=r;break;case"longitude":case"easting":l?l.match(/.*?-left/i)?"pixel"===m?e.query.pixelleft=r:"tile"===m?e.query.tileleft=r:e.query.mapleft=r:l.match(/.*?-right/i)&&("pixel"===m?e.query.pixelright=r:"tile"===m?e.query.tileright=r:e.query.mapright=r):e.query[s]=r;break;case"latitude":case"northing":l?l.match(/top-.*?/i)?"pixel"===m?e.query.pixeltop=r:"tile"===m?e.query.tiletop=r:e.query.maptop=r:l.match(/bottom-.*?/i)&&("pixel"===m?e.query.pixelbottom=r:"tile"===m?e.query.tilebottom=r:e.query.mapbottom=r):e.query[s]=r;break;case"i":"tile"===a?e.query.tilei=r:e.query.mapi=r;break;case"j":"tile"===a?e.query.tilej=r:e.query.mapj=r}else if("zoom"===n)e.query.zoom=r;else if(u){const p=i[o].htmlselect;e.query[r]=function(){return p.value}}else{const c=i[o];e.query[r]=function(){return c.getAttribute("value")}}}return e.query.title=t.title,e},reset:function(t,e){if(t&&this._map){var i=this._map&&this._map.hasLayer(this),o=this._templates;delete this._queries,this._map.off("click",null,this),this._templates=t;for(var n=0;n<t.length;n++)"tile"===t[n].rel?this._templates[n].layer=M.templatedTileLayer(t[n],L.Util.extend(this.options,{errorTileUrl:"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",zIndex:e,pane:this._container})):"image"===t[n].rel?this._templates[n].layer=M.templatedImageLayer(t[n],L.Util.extend(this.options,{zIndex:e,pane:this._container})):"features"===t[n].rel?this._templates[n].layer=M.templatedFeaturesLayer(t[n],L.Util.extend(this.options,{zIndex:e,pane:this._container})):"query"===t[n].rel&&(this._queries||(this._queries=[]),this._queries.push(L.extend(t[n],this._setupQueryVars(t[n])))),i&&this.onAdd(this._map);for(n=0;n<o.length;n++)this._map.hasLayer(o[n].layer)&&this._map.removeLayer(o[n].layer)}},onAdd:function(t){for(var e=0;e<this._templates.length;e++)"query"!==this._templates[e].rel&&t.addLayer(this._templates[e].layer)},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},onRemove:function(t){L.DomUtil.remove(this._container);for(var e=0;e<this._templates.length;e++)"query"!==this._templates[e].rel&&t.removeLayer(this._templates[e].layer)},_previousFeature:function(t){0<=this._count+-1&&(this._count--,this._map.fire("featurepagination",{i:this._count,popup:this}))},_nextFeature:function(t){this._count+1<this._source._totalFeatureCount&&(this._count++,this._map.fire("featurepagination",{i:this._count,popup:this}))},changeOpacity:function(t){this._container.style.opacity=t}}),x=L.Layer.extend({initialize:function(t,e){var i=M.extractInputBounds(t);this.zoomBounds=i.zoomBounds,this.extentBounds=i.bounds,this.isVisible=!0,this._template=t,this._container=L.DomUtil.create("div","leaflet-layer",e.pane),L.extend(e,this.zoomBounds),L.DomUtil.addClass(this._container,"mapml-features-container"),delete e.opacity,L.setOptions(this,L.extend(e,this._setUpFeaturesTemplateVars(t)))},getEvents:function(){return{moveend:this._onMoveEnd}},onAdd:function(){this._map._addZoomLimit(this);var n,t=new Headers({Accept:"text/mapml"}),a=new DOMParser,e=this.options.opacity||1,i=this._container,o=this._map;this._features||(this._features=M.mapMlFeatures(null,{renderer:M.featureRenderer(),pane:i,opacity:e,projection:o.options.projection,static:!0,onEachFeature:function(t,e){var i=document.createElement("div");i.classList.add("mapml-popup-content"),i.insertAdjacentHTML("afterbegin",t.innerHTML),e.bindPopup(i,{autoClose:!1,minWidth:108})}}));var s=this._features,r=function(i,o){return fetch(i,{redirect:"follow",headers:t}).then(function(t){return t.text()}).then(function(t){n=a.parseFromString(t,"application/xml");var e=new URL(n.querySelector("map-base")?n.querySelector("map-base").getAttribute("href"):i).href;i=(i=n.querySelector("map-link[rel=next]")?n.querySelector("map-link[rel=next]").getAttribute("href"):null)?new URL(i,e).href:null;t=n.querySelector("map-meta[name=zoom]")&&+M.metaContentToObject(n.querySelector("map-meta[name=zoom]").getAttribute("content")).value||0,e=n.querySelector("map-meta[name=cs]")&&M.metaContentToObject(n.querySelector("map-meta[name=cs]").getAttribute("content")).content||"GCRS";if(s.addData(n,e,t),i&&--o)return r(i,o)})};r(this._getfeaturesUrl(),10).then(function(){o.addLayer(s),o.fire("moveend")}).catch(function(t){console.log(t)})},redraw:function(){this._onMoveEnd()},_onMoveEnd:function(){var n,t,a,s,e,i,r,o=this._map.getZoom(),l=M.pixelToPCRSBounds(this._map.getPixelBounds(),o,this._map.options.projection);this.isVisible=o<=this.zoomBounds.maxZoom&&o>=this.zoomBounds.minZoom&&this.extentBounds.overlaps(l),this._features.clearLayers(),this.isVisible&&(t=new Headers({Accept:"text/mapml;q=0.9,application/geo+json;q=0.8"}),a=new DOMParser,s=this._features,e=this._map,(r=function(i,o){return fetch(i,{redirect:"follow",headers:t}).then(function(t){return t.text()}).then(function(t){n=a.parseFromString(t,"application/xml");var e=new URL(n.querySelector("map-base")?n.querySelector("map-base").getAttribute("href"):i).href;i=(i=n.querySelector("map-link[rel=next]")?n.querySelector("map-link[rel=next]").getAttribute("href"):null)?new URL(i,e).href:null;t=n.querySelector("map-meta[name=zoom]")&&+M.metaContentToObject(n.querySelector("map-meta[name=zoom]").getAttribute("content")).value||0,e=n.querySelector("map-meta[name=cs]")&&M.metaContentToObject(n.querySelector("map-meta[name=cs]").getAttribute("content")).content||"GCRS";if(s.addData(n,e,t),i&&--o)return r(i,o)})})((i=this)._getfeaturesUrl(),10).then(function(){e.addLayer(s),M.TemplatedFeaturesLayer.prototype._updateTabIndex(i)}).catch(function(t){console.log(t)}))},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},_updateTabIndex:function(t){var i,o=t||this;for(i in o._features._layers){let e=o._features._layers[i];if(e._path&&("M0 0"!==e._path.getAttribute("d")?e._path.setAttribute("tabindex",0):e._path.removeAttribute("tabindex"),0===e._path.childElementCount)){let t=document.createElement("title");t.innerText="Feature",e._path.appendChild(t)}}},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},onRemove:function(){this._map.removeLayer(this._features)},_getfeaturesUrl:function(){var t,e={};for(t in this.options.feature.zoom&&(e[this.options.feature.zoom]=this._map.getZoom()),this.options.feature.width&&(e[this.options.feature.width]=this._map.getSize().x),this.options.feature.height&&(e[this.options.feature.height]=this._map.getSize().y),this.options.feature.bottom&&(e[this.options.feature.bottom]=this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).y),this.options.feature.left&&(e[this.options.feature.left]=this._TCRSToPCRS(this._map.getPixelBounds().min,this._map.getZoom()).x),this.options.feature.top&&(e[this.options.feature.top]=this._TCRSToPCRS(this._map.getPixelBounds().min,this._map.getZoom()).y),this.options.feature.right&&(e[this.options.feature.right]=this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).x),this.options.feature)["width","height","left","right","top","bottom","zoom"].indexOf(t)<0&&(e[t]=this.options.feature[t]);return L.Util.template(this._template.template,e)},_TCRSToPCRS:function(t,e){var i=this._map.options.crs;return i.transformation.untransform(t,i.scale(e))},_setUpFeaturesTemplateVars:function(t){var e={feature:{}},i=t.values;e.feature.hidden=[];for(var o=0;o<i.length;o++){var n=i[o].getAttribute("type"),a=i[o].getAttribute("units"),s=i[o].getAttribute("axis"),r=i[o].getAttribute("name"),l=i[o].getAttribute("position"),m=(i[o].getAttribute("value"),"map-select"===i[o].tagName.toLowerCase());if("width"===n)e.feature.width=r;else if("height"===n)e.feature.height=r;else if("zoom"===n)e.feature.zoom=r;else if("location"!==n||"pcrs"!==a&&"gcrs"!==a)if(m){const u=i[o].htmlselect;e.feature[r]=function(){return u.value}}else{const p=i[o];e.feature[r]=function(){return p.getAttribute("value")}}else switch(s){case"x":case"longitude":case"easting":l&&(l.match(/.*?-left/i)?e.feature.left=r:l.match(/.*?-right/i)&&(e.feature.right=r));break;case"y":case"latitude":case"northing":l&&(l.match(/top-.*?/i)?e.feature.top=r:l.match(/bottom-.*?/i)&&(e.feature.bottom=r))}}return e}}),g=L.Layer.extend({initialize:function(t,e){this._template=t,this._container=L.DomUtil.create("div","leaflet-layer",e.pane),L.DomUtil.addClass(this._container,"mapml-image-container");var i=M.extractInputBounds(t);this.zoomBounds=i.zoomBounds,this.extentBounds=i.bounds,this.isVisible=!0,delete e.opacity,L.extend(e,this.zoomBounds),L.setOptions(this,L.extend(e,this._setUpExtentTemplateVars(t)))},getEvents:function(){return{moveend:this._onMoveEnd}},onAdd:function(){this._map._addZoomLimit(this),this.setZIndex(this.options.zIndex),this._onMoveEnd()},redraw:function(){this._onMoveEnd()},_clearLayer:function(){var e=this._container.querySelectorAll("img");for(let t=0;t<e.length;t++)this._container.removeChild(e[t])},_onMoveEnd:function(){var t,e,i,o=this._map.getZoom(),n=M.pixelToPCRSBounds(this._map.getPixelBounds(),o,this._map.options.projection);this.isVisible=o<=this.zoomBounds.maxZoom&&o>=this.zoomBounds.minZoom&&this.extentBounds.overlaps(n),this.isVisible?(e=(t=this._map).getPixelBounds().min.subtract(t.getPixelOrigin()),o=t.getSize(),n=this.getImageUrl(),i=this._imageOverlay,this._imageOverlay=M.imageOverlay(n,e,o,0,this._container),this._imageOverlay.addTo(t),i&&this._imageOverlay.on("load error",function(){t.removeLayer(i)})):this._clearLayer()},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},onRemove:function(t){this._clearLayer(),t._removeZoomLimit(this),this._container=null},getImageUrl:function(){var t,e={};for(t in e[this.options.extent.width]=this._map.getSize().x,e[this.options.extent.height]=this._map.getSize().y,e[this.options.extent.bottom]=this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).y,e[this.options.extent.left]=this._TCRSToPCRS(this._map.getPixelBounds().min,this._map.getZoom()).x,e[this.options.extent.top]=this._TCRSToPCRS(this._map.getPixelBounds().min,this._map.getZoom()).y,e[this.options.extent.right]=this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).x,this.options.extent)["width","height","left","right","top","bottom"].indexOf(t)<0&&(e[t]=this.options.extent[t]);return L.Util.template(this._template.template,e)},_TCRSToPCRS:function(t,e){var i=this._map.options.crs;return i.transformation.untransform(t,i.scale(e))},_setUpExtentTemplateVars:function(t){for(var e={extent:{}},i=t.values,o=0;o<t.values.length;o++){var n=i[o].getAttribute("type"),a=i[o].getAttribute("units"),s=i[o].getAttribute("axis"),r=i[o].getAttribute("name"),l=i[o].getAttribute("position"),m="map-select"===i[o].tagName.toLowerCase();if("width"===n)e.extent.width=r;else if("height"===n)e.extent.height=r;else if("location"!==n||"pcrs"!==a&&"gcrs"!==a)if(m){const u=i[o].htmlselect;e.extent[r]=function(){return u.value}}else{const p=i[o];e.extent[r]=function(){return p.getAttribute("value")}}else switch(s){case"longitude":case"easting":l&&(l.match(/.*?-left/i)?e.extent.left=r:l.match(/.*?-right/i)&&(e.extent.right=r));break;case"latitude":case"northing":l&&(l.match(/top-.*?/i)?e.extent.top=r:l.match(/bottom-.*?/i)&&(e.extent.bottom=r))}}return e}}),f=L.ImageOverlay.extend({initialize:function(t,e,i,o,n,a){this._container=n,this._url=t,this._location=e,this._size=L.point(i),this._angle=o,L.setOptions(this,a)},getEvents:function(){var t={viewreset:this._reset};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},onAdd:function(){this.on({load:this._onImageLoad}),this._image||this._initImage(),this.options.interactive&&(L.DomUtil.addClass(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this._container.appendChild(this._image),this._reset()},onRemove:function(){L.DomUtil.remove(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},_onImageLoad:function(){this._image&&(this._image.loaded=+new Date,this._updateOpacity())},_animateZoom:function(t){var e=this._map.getZoomScale(t.zoom),t=this._map.getPixelOrigin().add(this._location).multiplyBy(e).subtract(this._map._getNewPixelOrigin(t.center,t.zoom)).round();L.Browser.any3d?L.DomUtil.setTransform(this._image,t,e):L.DomUtil.setPosition(this._image,t)},_reset:function(){var t=this._image,e=this._location,i=this._size;L.DomUtil.setPosition(t,e),t.style.width=i.x+"px",t.style.height=i.y+"px"},_updateOpacity:function(){var t,e,i;this._map&&(i=+new Date,t=!1,e=this._image,i=Math.min(1,(i-e.loaded)/200),L.DomUtil.setOpacity(e,i),(t=i<1?!0:t)&&(L.Util.cancelAnimFrame(this._fadeFrame),this._fadeFrame=L.Util.requestAnimFrame(this._updateOpacity,this)),L.DomUtil.addClass(e,"leaflet-image-loaded"))}}),b=L.Layer.extend({options:{maxNext:10,zIndex:0,maxZoom:25},initialize:function(t,e,i){var o;t&&(this._href=t),e&&(o=!!(this._layerEl=e).querySelector("map-feature,map-tile,map-extent"),!t&&o&&(this._content=e)),L.setOptions(this,i),this._container=L.DomUtil.create("div","leaflet-layer"),L.DomUtil.addClass(this._container,"mapml-layer"),this._imageContainer=L.DomUtil.create("div","leaflet-layer",this._container),L.DomUtil.addClass(this._imageContainer,"mapml-image-container"),this._mapmlTileContainer=L.DomUtil.create("div","mapml-tile-container",this._container),!o&&e&&e.hasAttribute("label")&&(this._title=e.getAttribute("label")),this._initialize(o?e:null),this.on("attached",this._validateExtent,this),this.validProjection=!0},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},_removeExtents:function(e){if(this._extent._mapExtents)for(let t=0;t<this._extent._mapExtents.length;t++)this._extent._mapExtents[t].templatedLayer&&e.removeLayer(this._extent._mapExtents[t].templatedLayer);this._extent._queries&&delete this._extent._queries},_changeOpacity:function(t){t&&t.target&&0<=t.target.value&&t.target.value<=1&&this.changeOpacity(t.target.value)},changeOpacity:function(t){this._container.style.opacity=t,this.opacityEl&&(this.opacityEl.value=t)},_changeExtentOpacity:function(t){t&&t.target&&0<=t.target.value&&t.target.value<=1&&(this.templatedLayer.changeOpacity(t.target.value),this._templateVars.opacity=t.target.value)},_changeExtent:function(t,e){t.target.checked?(e.checked=!0,this._layerEl.checked&&(e.templatedLayer=M.templatedLayer(e._templateVars,{pane:this._container,opacity:e._templateVars.opacity,_leafletLayer:this,crs:e.crs,extentZIndex:e.extentZIndex}).addTo(this._map),e.templatedLayer.setZIndex(),this._setLayerElExtent())):(L.DomEvent.stopPropagation(t),e.checked=!1,this._layerEl.checked&&this._map.removeLayer(e.templatedLayer),this._setLayerElExtent())},onAdd:function(e){if(!this._extent&&!this._extent_mapExtents||this._validProjection(e)){this._map=e,this._content?(this._mapmlvectors||(this._mapmlvectors=M.mapMlFeatures(this._content,{renderer:M.featureRenderer(),pane:this._container,opacity:this.options.opacity,projection:e.options.projection,_leafletLayer:this,static:!0,onEachFeature:function(t,e){var i;t&&((i=document.createElement("div")).classList.add("mapml-popup-content"),i.insertAdjacentHTML("afterbegin",t.innerHTML),e.bindPopup(i,{autoClose:!1,minWidth:165}))}})),this._setLayerElExtent(),e.addLayer(this._mapmlvectors)):this.once("extentload",function(){this._validProjection(e)?(this._mapmlvectors||(this._mapmlvectors=M.mapMlFeatures(this._content,{renderer:M.featureRenderer(),pane:this._container,opacity:this.options.opacity,projection:e.options.projection,_leafletLayer:this,static:!0,onEachFeature:function(t,e){var i;t&&((i=document.createElement("div")).classList.add("mapml-popup-content"),i.insertAdjacentHTML("afterbegin",t.innerHTML),e.bindPopup(i,{autoClose:!1,minWidth:165}))}}).addTo(e)),this._setLayerElExtent()):this.validProjection=!1},this),this._imageLayer||(this._imageLayer=L.layerGroup()),e.addLayer(this._imageLayer),(!this._staticTileLayer||null===this._staticTileLayer._container)&&0<this._mapmlTileContainer.getElementsByTagName("map-tiles").length&&(this._staticTileLayer=M.mapMLStaticTileLayer({pane:this._container,_leafletLayer:this,className:"mapml-static-tile-layer",tileContainer:this._mapmlTileContainer,maxZoomBound:e.options.crs.options.resolutions.length-1,tileSize:e.options.crs.options.crs.tile.bounds.max.x}),e.addLayer(this._staticTileLayer),this._setLayerElExtent());const t=function(){if(this._extent&&this._extent._mapExtents){for(let t=0;t<this._extent._mapExtents.length;t++)this._extent._mapExtents[t]._templateVars&&this._extent._mapExtents[t].checked&&(this._extent._mapExtents[t].extentZIndex||(this._extent._mapExtents[t].extentZIndex=t),this._templatedLayer=M.templatedLayer(this._extent._mapExtents[t]._templateVars,{pane:this._container,opacity:this._extent._mapExtents[t]._templateVars.opacity,_leafletLayer:this,crs:this._extent.crs,extentZIndex:this._extent._mapExtents[t].extentZIndex}).addTo(e),this._extent._mapExtents[t].templatedLayer=this._templatedLayer,this._templatedLayer._queries&&(this._extent._queries||(this._extent._queries=[]),this._extent._queries=this._extent._queries.concat(this._templatedLayer._queries)));this._setLayerElExtent()}}.bind(this);this._extent&&this._extent._mapExtents&&this._extent._mapExtents[0]._templateVars?t():this.once("extentload",function(){this._validProjection(e)?t():this.validProjection=!1},this),this.setZIndex(this.options.zIndex),this.getPane().appendChild(this._container),setTimeout(()=>{e.fire("checkdisabled")},0),e.on("popupopen",this._attachSkipButtons,this)}else this.validProjection=!1},_validProjection:function(e){let i=!1;if(this._extent&&this._extent._mapExtents)for(let t=0;t<this._extent._mapExtents.length;t++)if(this._extent._mapExtents[t]._templateVars)for(var o of this._extent._mapExtents[t]._templateVars)if(!o.projectionMatch&&o.projection!==e.options.projection){i=!0;break}return!(i||this.getProjection()!==e.options.projection.toUpperCase())},_setLayerElExtent:function(){let o,n,a,s,r,e={minZoom:0,maxZoom:0,maxNativeZoom:0,minNativeZoom:0};["_staticTileLayer","_imageLayer","_mapmlvectors","_templatedLayer"].forEach(t=>{if(this[t])if("_templatedLayer"===t){for(let e=0;e<this._extent._mapExtents.length;e++)for(let t=0;t<this._extent._mapExtents[e]._templateVars.length;t++){var i=M.extractInputBounds(this._extent._mapExtents[e]._templateVars[t]);this._extent._mapExtents[e]._templateVars[t].tempExtentBounds=i.bounds,this._extent._mapExtents[e]._templateVars[t].extentZoomBounds=i.zoomBounds}for(let e=0;e<this._extent._mapExtents.length;e++)if(this._extent._mapExtents[e].checked)for(let t=0;t<this._extent._mapExtents[e]._templateVars.length;t++)r=o?(o.extend(this._extent._mapExtents[e]._templateVars[t].tempExtentBounds.min),o.extend(this._extent._mapExtents[e]._templateVars[t].tempExtentBounds.max),n=Math.max(n,this._extent._mapExtents[e]._templateVars[t].extentZoomBounds.maxZoom),a=Math.min(a,this._extent._mapExtents[e]._templateVars[t].extentZoomBounds.minZoom),s=Math.max(s,this._extent._mapExtents[e]._templateVars[t].extentZoomBounds.maxNativeZoom),Math.min(r,this._extent._mapExtents[e]._templateVars[t].extentZoomBounds.minNativeZoom)):(o=this._extent._mapExtents[e]._templateVars[t].tempExtentBounds,n=this._extent._mapExtents[e]._templateVars[t].extentZoomBounds.maxZoom,a=this._extent._mapExtents[e]._templateVars[t].extentZoomBounds.minZoom,s=this._extent._mapExtents[e]._templateVars[t].extentZoomBounds.maxNativeZoom,this._extent._mapExtents[e]._templateVars[t].extentZoomBounds.minNativeZoom);e.minZoom=a,e.maxZoom=n,e.minNativeZoom=r,e.maxNativeZoom=s,this._extent.zoomBounds=e,this._extent.layerBounds=o;for(let t=0;t<this._extent._mapExtents.length;t++)this._extent._mapExtents[t].templatedLayer.layerBounds=o,this._extent._mapExtents[t].templatedLayer.zoomBounds=e}else this[t].layerBounds&&(o?(o.extend(this[t].layerBounds.min),o.extend(this[t].layerBounds.max)):(o=this[t].layerBounds,e=this[t].zoomBounds))}),o&&(this._layerEl.extent=Object.assign(M.convertAndFormatPCRS(o,this._map),{zoom:e}))},addTo:function(t){return t.addLayer(this),this},getEvents:function(){return{zoomanim:this._onZoomAnim}},redraw:function(){if(this._extent._mapExtents)for(let t=0;t<this._extent._mapExtents.length;t++)this._extent._mapExtents[t].templatedLayer&&this._extent._mapExtents[t].templatedLayer.redraw()},_onZoomAnim:function(t){var t=t.zoom,e=this._extent&&this._extent._mapExtents?this._extent._mapExtents[0].querySelector("map-input[type=zoom]"):null,i=e&&e.hasAttribute("min")?parseInt(e.getAttribute("min")):this._map.getMinZoom(),o=e&&e.hasAttribute("max")?parseInt(e.getAttribute("max")):this._map.getMaxZoom();if(e)for(let t=1;t<this._extent._mapExtents.length;t++)(e=this._extent._mapExtents[t].querySelector("map-input[type=zoom]"))&&e.hasAttribute("min")&&(i=Math.min(parseInt(e.getAttribute("min")),i)),e&&e.hasAttribute("max")&&(o=Math.max(parseInt(e.getAttribute("max")),o));t<i&&this._extent.zoomout||o<t&&this._extent.zoomin;i<=t&&t<=o||(this._extent.zoomin&&o<t?(this._href=this._extent.zoomin,this._layerEl.src=this._extent.zoomin,this.href=this._extent.zoomin,this._layerEl.src=this._extent.zoomin):this._extent.zoomout&&t<i&&(this._href=this._extent.zoomout,this.href=this._extent.zoomout,this._layerEl.src=this._extent.zoomout)),this._templatedLayer},onRemove:function(t){L.DomUtil.remove(this._container),this._staticTileLayer&&t.removeLayer(this._staticTileLayer),this._mapmlvectors&&t.removeLayer(this._mapmlvectors),this._imageLayer&&t.removeLayer(this._imageLayer),this._extent&&this._extent._mapExtents&&this._removeExtents(t),t.fire("checkdisabled"),t.off("popupopen",this._attachSkipButtons)},getAttribution:function(){return this.options.attribution},getLayerExtentHTML:function(t,i){var o=L.DomUtil.create("fieldset","mapml-layer-extent"),e=L.DomUtil.create("div","mapml-layer-item-properties",o),n=L.DomUtil.create("div","mapml-layer-item-settings",o),a=L.DomUtil.create("label","mapml-layer-item-toggle",e),s=L.DomUtil.create("input"),r=L.SVG.create("svg"),l=L.SVG.create("path"),m=L.SVG.create("path"),u=L.DomUtil.create("span"),p=L.DomUtil.create("div","mapml-layer-item-controls",e),c=L.DomUtil.create("details","mapml-layer-item-opacity",n),e=L.DomUtil.create("summary","",c),h=this._layerEl.parentNode,d=this._layerEl,c=L.DomUtil.create("input","",c);n.hidden=!0,o.setAttribute("aria-grabbed","false"),t||(o.setAttribute("hidden",""),this._extent._mapExtents[i].hidden=!0),r.setAttribute("viewBox","0 0 24 24"),r.setAttribute("height","22"),r.setAttribute("width","22"),l.setAttribute("d","M0 0h24v24H0z"),l.setAttribute("fill","none"),m.setAttribute("d","M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"),r.appendChild(l),r.appendChild(m);let _=L.DomUtil.create("button","mapml-layer-item-remove-control",p);_.type="button",_.title="Remove Sub Layer",_.innerHTML="<span aria-hidden='true'>&#10005;</span>",_.classList.add("mapml-button"),L.DomEvent.on(_,"click",L.DomEvent.stop),L.DomEvent.on(_,"click",t=>{let e=!0;t.target.checked=!1,this._extent._mapExtents[i].removed=!0,this._extent._mapExtents[i].checked=!1,this._layerEl.checked&&this._changeExtent(t,this._extent._mapExtents[i]),this._extent._mapExtents[i].extentAnatomy.parentNode.removeChild(this._extent._mapExtents[i].extentAnatomy);for(let t=0;t<this._extent._mapExtents.length;t++)this._extent._mapExtents[t].removed||(e=!1);e&&this._layerItemSettingsHTML.removeChild(this._extentGroupAnatomy)},this);let y=L.DomUtil.create("button","mapml-layer-item-settings-control",p);y.type="button",y.title="Extent Settings",y.setAttribute("aria-expanded",!1),y.classList.add("mapml-button"),L.DomEvent.on(y,"click",t=>{1==n.hidden?(y.setAttribute("aria-expanded",!0),n.hidden=!1):(y.setAttribute("aria-expanded",!1),n.hidden=!0)},this),u.setAttribute("aria-hidden",!0),a.appendChild(s),y.appendChild(u),u.appendChild(r),e.innerText="Opacity",e.id="mapml-layer-item-opacity-"+L.stamp(e),c.setAttribute("type","range"),c.setAttribute("min","0"),c.setAttribute("max","1.0"),c.setAttribute("value",this._extent._mapExtents[i]._templateVars.opacity||"1.0"),c.setAttribute("step","0.1"),c.setAttribute("aria-labelledby","mapml-layer-item-opacity-"+L.stamp(e)),this._extent._mapExtents[i]._templateVars.opacity=this._extent._mapExtents[i]._templateVars.opacity||"1.0",L.DomEvent.on(c,"change",this._changeExtentOpacity,this._extent._mapExtents[i]);a=L.DomUtil.create("span","mapml-layer-item-name",a);return s.defaultChecked=!!this._extent._mapExtents[i],this._extent._mapExtents[i].checked=s.defaultChecked,s.type="checkbox",a.innerHTML=t,L.DomEvent.on(s,"change",t=>{this._changeExtent(t,this._extent._mapExtents[i])}),a.id="mapml-extent-item-name-{"+L.stamp(a)+"}",o.setAttribute("aria-labelledby",a.id),a.extent=this._extent._mapExtents[i],o.onmousedown=e=>{if("input"!==e.target.tagName.toLowerCase()&&"select"!==e.target.tagName.toLowerCase()){e.preventDefault(),e.stopPropagation();let r=o,l=o.parentNode,t=!1,m=e.clientY;document.body.onmousemove=a=>{a.preventDefault();var s=a.clientY-m;if(t=5<Math.abs(s)||t,!(l&&!t||l&&l.childElementCount<=1||l.getBoundingClientRect().top>r.getBoundingClientRect().bottom||l.getBoundingClientRect().bottom<r.getBoundingClientRect().top)){l.classList.add("mapml-draggable"),r.style.transform="translateY("+s+"px)",r.style.pointerEvents="none";let t=a.clientX,e=a.clientY,i=("MAPML-VIEWER"===h.tagName?h:h.querySelector(".mapml-web-map")).shadowRoot,o=i.elementFromPoint(t,e),n=o&&o.closest("fieldset")?o.closest("fieldset"):r;n=Math.abs(s)<=n.offsetHeight?r:n,r.setAttribute("aria-grabbed","true"),r.setAttribute("aria-dropeffect","move"),n&&l===n.parentNode&&(n=n!==r.nextSibling?n:n.nextSibling,r!==n&&(m=a.clientY,r.style.transform=null),l.insertBefore(r,n))}},document.body.onmouseup=()=>{r.setAttribute("aria-grabbed","false"),r.removeAttribute("aria-dropeffect"),r.style.pointerEvents=null,r.style.transform=null;let t=l.children,e=0;for(var i of t){let t=i.querySelector("span").extent;t.setAttribute("data-moving",""),d.insertAdjacentElement("beforeend",t),t.removeAttribute("data-moving"),t.extentZIndex=e,t.templatedLayer.setZIndex(e),e++}l.classList.remove("mapml-draggable"),document.body.onmousemove=document.body.onmouseup=null}}},o},getLayerUserControlsHTML:function(){var i=L.DomUtil.create("fieldset","mapml-layer-item"),t=L.DomUtil.create("input"),e=L.DomUtil.create("span","mapml-layer-item-name"),o=L.DomUtil.create("span"),n=L.DomUtil.create("div","mapml-layer-item-properties",i),a=L.DomUtil.create("div","mapml-layer-item-settings",i),s=L.DomUtil.create("label","mapml-layer-item-toggle",n),r=L.DomUtil.create("div","mapml-layer-item-controls",n),l=L.DomUtil.create("details","mapml-layer-item-opacity mapml-control-layers",a),m=L.DomUtil.create("input"),u=L.DomUtil.create("summary"),p=L.SVG.create("svg"),c=L.SVG.create("path"),n=L.SVG.create("path"),h=L.DomUtil.create("fieldset","mapml-layer-grouped-extents"),d=this._layerEl.parentNode;this.opacityEl=m,p.setAttribute("viewBox","0 0 24 24"),p.setAttribute("height","22"),p.setAttribute("width","22"),c.setAttribute("d","M0 0h24v24H0z"),c.setAttribute("fill","none"),n.setAttribute("d","M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"),p.appendChild(c),p.appendChild(n),a.hidden=!0,o.setAttribute("aria-hidden",!0);let _=L.DomUtil.create("button","mapml-layer-item-remove-control",r);_.type="button",_.title="Remove Layer",_.innerHTML="<span aria-hidden='true'>&#10005;</span>",_.classList.add("mapml-button"),L.DomEvent.on(_,"click",L.DomEvent.stop),L.DomEvent.on(_,"click",t=>{let e=0,i,o;if(o=("MAPML-VIEWER"===d.tagName?d:d.querySelector(".mapml-web-map")).shadowRoot,t.target.closest("fieldset").nextElementSibling&&!t.target.closest("fieldset").nextElementSibling.disbaled)for(i=t.target.closest("fieldset").previousElementSibling;i;)e+=2,i=i.previousElementSibling;else i="link";d.removeChild(t.target.closest("fieldset").querySelector("span").layer._layerEl),i=i?o.querySelector(".leaflet-control-attribution").firstElementChild:i=o.querySelectorAll("input")[e],i.focus()},this);let y=L.DomUtil.create("button","mapml-layer-item-settings-control",r);if(y.type="button",y.title="Layer Settings",y.setAttribute("aria-expanded",!1),y.classList.add("mapml-button"),L.DomEvent.on(y,"click",t=>{1==a.hidden?(y.setAttribute("aria-expanded",!0),a.hidden=!1):(y.setAttribute("aria-expanded",!1),a.hidden=!0)},this),t.defaultChecked=!!this._map,t.type="checkbox",(e.layer=this)._legendUrl?((r=document.createElement("a")).text=" "+this._title,r.href=this._legendUrl,r.target="_blank",r.draggable=!1,e.appendChild(r)):e.innerHTML=this._title,e.id="mapml-layer-item-name-{"+L.stamp(e)+"}",u.innerText="Opacity",u.id="mapml-layer-item-opacity-"+L.stamp(u),l.appendChild(u),l.appendChild(m),m.setAttribute("type","range"),m.setAttribute("min","0"),m.setAttribute("max","1.0"),m.setAttribute("value",this._container.style.opacity||"1.0"),m.setAttribute("step","0.1"),m.setAttribute("aria-labelledby",u.id),m.value=this._container.style.opacity||"1.0",i.setAttribute("aria-grabbed","false"),i.setAttribute("aria-labelledby",e.id),i.onmousedown=e=>{if("input"!==e.target.tagName.toLowerCase()&&"select"!==e.target.tagName.toLowerCase()){e.preventDefault();let r=i,l=i.parentNode,t=!1,m=e.clientY;document.body.onmousemove=a=>{a.preventDefault();var s=a.clientY-m;if(t=5<Math.abs(s)||t,!(l&&!t||l&&l.childElementCount<=1||l.getBoundingClientRect().top>r.getBoundingClientRect().bottom||l.getBoundingClientRect().bottom<r.getBoundingClientRect().top)){l.classList.add("mapml-draggable"),r.style.transform="translateY("+s+"px)",r.style.pointerEvents="none";let t=a.clientX,e=a.clientY,i=("MAPML-VIEWER"===d.tagName?d:d.querySelector(".mapml-web-map")).shadowRoot,o=i.elementFromPoint(t,e),n=o&&o.closest("fieldset")?o.closest("fieldset"):r;n=Math.abs(s)<=n.offsetHeight?r:n,r.setAttribute("aria-grabbed","true"),r.setAttribute("aria-dropeffect","move"),n&&l===n.parentNode&&(n=n!==r.nextSibling?n:n.nextSibling,r!==n&&(m=a.clientY,r.style.transform=null),l.insertBefore(r,n))}},document.body.onmouseup=()=>{r.setAttribute("aria-grabbed","false"),r.removeAttribute("aria-dropeffect"),r.style.pointerEvents=null,r.style.transform=null;let t=l.children,e=1;for(var i of t){let t=i.querySelector("span").layer._layerEl;t.setAttribute("data-moving",""),d.insertAdjacentElement("beforeend",t),t.removeAttribute("data-moving"),t._layer.setZIndex(e),e++}l.classList.remove("mapml-draggable"),document.body.onmousemove=document.body.onmouseup=null}}},L.DomEvent.on(m,"change",this._changeOpacity,this),s.appendChild(t),s.appendChild(e),y.appendChild(o),o.appendChild(p),this._styles&&a.appendChild(this._styles),this._userInputs){var x=document.createDocumentFragment(),g=this._extent._templateVars;if(g)for(var f=0;f<g.length;f++)for(var b=g[f],v=0;v<b.values.length;v++){var E,M,A=b.values[v],C="#"+A.getAttribute("id");"map-select"!==A.tagName.toLowerCase()||x.querySelector(C)||(E=L.DomUtil.create("details","mapml-layer-item-time mapml-control-layers",x),M=L.DomUtil.create("summary"),(C=L.DomUtil.create("label")).innerText=A.getAttribute("name"),C.setAttribute("for",A.getAttribute("id")),M.appendChild(C),E.appendChild(M),E.appendChild(A.htmlselect))}a.appendChild(x)}if(this._extent&&this._extent._mapExtents){var S=!0;this._layerItemSettingsHTML=a,(this._extentGroupAnatomy=h).setAttribute("aria-label","Sublayers");for(let t=0;t<this._extent._mapExtents.length;t++)h.appendChild(this._extent._mapExtents[t].extentAnatomy),this._extent._mapExtents[t].hidden||(S=!1);S||a.appendChild(h)}return i},_initialize:function(t){var I,e,i,o;function E(t,o,n,e,i,a){var s=[],r=t.querySelectorAll("map-link[rel=tile],map-link[rel=image],map-link[rel=features],map-link[rel=query]"),l=new RegExp("(?:{)(.*?)(?:})","g"),m=t.querySelector('map-input[type="zoom" i]'),u=!1,p={zoom:0};if(o){let t=M.metaContentToObject(o.getAttribute("content")),e;p.zoom=t.zoom||p.zoom;let i=Object.keys(t);for(let t=0;t<i.length;t++)if(!i[t].includes("zoom")){e=M.axisToCS(i[t].split("-")[2]);break}o=M.csToAxes(e);p.bounds=M.boundsToPCRSBounds(L.bounds(L.point(+t["top-left-"+o[0]],+t["top-left-"+o[1]]),L.point(+t["bottom-right-"+o[0]],+t["bottom-right-"+o[1]])),p.zoom,n,e)}else p.bounds=M[n].options.crs.pcrs.bounds;for(var c=0;c<r.length;c++){var h=r[c];if(!(_=h.getAttribute("tref"))){var d,_=P;for(d of e.querySelectorAll("map-input"))_+=`{${d.getAttribute("name")}}`}for(var y=h.hasAttribute("title")?h.getAttribute("title"):"Query this layer",x=_.match(l),g=h.hasAttribute("rel")&&"tile"!==h.getAttribute("rel").toLowerCase()?h.getAttribute("rel").toLowerCase():"tile",f=h.hasAttribute("type")?h.getAttribute("type").toLowerCase():"image/*",b=[],v=h&&h.hasAttribute("tms"),E=e.querySelector("map-meta[name=zoom]")?M.metaContentToObject(e.querySelector("map-meta[name=zoom]").getAttribute("content")):void 0;null!==(A=l.exec(_));){var A,C=A[1],S=t.querySelector("map-input[name="+C+"],map-select[name="+C+"]");if(!S){console.log("input with name="+C+" not found for template variable of same name");break}if(S.hasAttribute("type")&&"location"===S.getAttribute("type")&&!S.hasAttribute("min")&&S.hasAttribute("axis")&&!["i","j"].includes(S.getAttribute("axis").toLowerCase())&&(m.setAttribute("value",p.zoom),A=S.getAttribute("axis"),C=M.convertPCRSBounds(p.bounds,p.zoom,n,M.axisToCS(A)),S.setAttribute("min",C.min[M.axisToXY(A)]),S.setAttribute("max",C.max[M.axisToXY(A)])),b.push(S),u=u||S.hasAttribute("type")&&"zoom"===S.getAttribute("type").toLowerCase(),S.hasAttribute("shard")){var T=S.getAttribute("list");S.servers=[];var z=t.querySelectorAll("map-datalist#"+T+" > map-option");0===z.length&&S.hasAttribute("value")&&(z=S.getAttribute("value").split(""));for(var k=0;k<z.length;k++)z[k].getAttribute?S.servers.push(z[k].getAttribute("value")):S.servers.push(z[k])}else"map-select"===S.tagName.toLowerCase()&&((T=document.createElement("div")).insertAdjacentHTML("afterbegin",S.outerHTML),S.htmlselect=T.querySelector("map-select"),S.htmlselect=function(e){var i=document.createElement("select"),o=e.getAttributeNames();for(let t=0;t<o.length;t++)i.setAttribute(o[t],e.getAttribute(o[t]));var n=e.children;for(let e=0;e<n.length;e++){var a=document.createElement("option"),s=n[e].getAttributeNames();for(let t=0;t<s.length;t++)a.setAttribute(s[t],n[e].getAttribute(s[t]));a.innerHTML=n[e].innerHTML,i.appendChild(a)}return i}(S.htmlselect),L.DomEvent.on(S.htmlselect,"change",I.redraw,I),I._userInputs||(I._userInputs=[]),I._userInputs.push(S.htmlselect))}(_&&x.length===b.length||_===P)&&("query"===g&&(I.queryable=!0),!u&&m&&b.push(m),s.push({template:decodeURI(new URL(_,i)),linkEl:h,title:y,rel:g,type:f,values:b,zoomBounds:E,extentPCRSFallback:{bounds:p.bounds},projectionMatch:a,projection:t.getAttribute("units")||B,tms:v}))}return s}function n(t){var e=this.responseXML||t;if(e.querySelector&&e.querySelector("map-feature")&&(I._content=e),!this.responseXML&&this.responseText&&(e=(new DOMParser).parseFromString(this.responseText,"text/xml")),this.readyState===this.DONE&&e.querySelector&&!e.querySelector("parsererror")){var i,o=e.querySelectorAll("map-extent");if(o.length||(m=e.querySelector("map-meta[name=projection]")),1<=o.length)for(let t=0;t<o.length&&(n=(i="map-extent"===o[t].tagName.toLowerCase()&&o[t].hasAttribute("units")?o[t].getAttribute("units"):i)&&i===I.options.mapprojection);t++);else m&&"map-meta"===m.tagName.toLowerCase()&&m.hasAttribute("content")&&(n=(i=M.metaContentToObject(m.getAttribute("content")).content)&&i===I.options.mapprojection);var n,a,s=e.querySelector("map-meta[name=extent]"),r=!n&&e.querySelector("map-head map-link[rel=alternate][projection="+I.options.mapprojection+"]"),l=new URL(e.querySelector("map-base")?e.querySelector("map-base").getAttribute("href"):e.baseURI||this.responseURL,this.responseURL).href;if(!n&&r&&r.hasAttribute("href"))return void I.fire("changeprojection",{href:new URL(r.getAttribute("href"),l).href},!1);if(!n&&I._map&&1===I._map.options.mapEl.querySelectorAll("layer-").length)return void(I._map.options.mapEl.projection=i);if(m)I._extent=m;else{I._extent={},n&&(I._extent.crs=M[i]),I._extent._mapExtents=[],I._extent._templateVars=[];for(let t=0;t<o.length;t++)o[t].querySelector("map-link[rel=tile],map-link[rel=image],map-link[rel=features],map-link[rel=query]")&&o[t].hasAttribute("units")&&(I._extent._mapExtents.push(o[t]),n=n||r,a=E.call(I,o[t],s,i,e,l,n),I._extent._mapExtents[t]._templateVars=a,I._extent._templateVars=I._extent._templateVars.concat(a))}I._parseLicenseAndLegend(e,I,i);var t=e.querySelector("map-link[rel=zoomin]"),m=e.querySelector("map-link[rel=zoomout]");if(delete I._extent.zoomin,delete I._extent.zoomout,t&&(I._extent.zoomin=new URL(t.getAttribute("href"),l).href),m&&(I._extent.zoomout=new URL(m.getAttribute("href"),l).href),I._extent._mapExtents)for(let t=0;t<I._extent._mapExtents.length;t++)I._extent._mapExtents[t].templatedLayer&&I._extent._mapExtents[t].templatedLayer.reset(I._extent._mapExtents[t]._templateVars,I._extent._mapExtents[t].extentZIndex);if(e.querySelector("map-tile")){var u=document.createElement("map-tiles"),p=e.querySelector("map-meta[name=zoom][content]")||e.querySelector("map-input[type=zoom][value]");u.setAttribute("zoom",p&&p.getAttribute("content")||p&&p.getAttribute("value")||"0");for(var c=e.getElementsByTagName("map-tile"),h=0;h<c.length;h++)u.appendChild(document.importNode(c[h],!0));I._mapmlTileContainer.appendChild(u)}if(M.parseStylesheetAsHTML(e,l,I._container),I._extent._mapExtents)for(let t=0;t<I._extent._mapExtents.length;t++){var d=I._extent._mapExtents[t].getAttribute("label"),d=I.getLayerExtentHTML(d,t);I._extent._mapExtents[t].extentAnatomy=d}var _=e.querySelectorAll('map-link[rel=style],map-link[rel="self style"],map-link[rel="style self"]');if(1<_.length){var y=document.createElement("details"),p=document.createElement("summary");p.innerText="Style",y.appendChild(p);for(var x=function(t){I.fire("changestyle",{src:t.target.getAttribute("data-href")},!1)},g=0;g<_.length;g++){var f=document.createElement("div"),b=f.appendChild(document.createElement("input"));b.setAttribute("type","radio"),b.setAttribute("id","rad-"+L.stamp(b)),b.setAttribute("name","styles-"+this._title),b.setAttribute("value",_[g].getAttribute("title")),b.setAttribute("data-href",new URL(_[g].getAttribute("href"),l).href);var v=f.appendChild(document.createElement("label"));v.setAttribute("for","rad-"+L.stamp(b)),v.innerText=_[g].getAttribute("title"),"style self"!==_[g].getAttribute("rel")&&"self style"!==_[g].getAttribute("rel")||(b.checked=!0),y.appendChild(f),L.DomUtil.addClass(y,"mapml-layer-item-style mapml-control-layers"),L.DomEvent.on(b,"click",x,I)}I._styles=y}e.querySelector("map-title")?I._title=e.querySelector("map-title").textContent.trim():e instanceof Element&&e.hasAttribute("label")&&(I._title=e.getAttribute("label").trim()),I._map&&(I._validateExtent(),I._map.hasLayer(I)&&I._map.attributionControl.addAttribution(I.getAttribution()))}else I.error=!0;I.fire("extentload",I,!1),I._layerEl.dispatchEvent(new CustomEvent("extentload",{detail:I}))}(this._href||t)&&((I=this)._href?(e=new XMLHttpRequest,i=this._href,o=n,e.onreadystatechange=function(){this.readyState===this.DONE&&(400!==this.status&&404!==this.status&&500!==this.status&&406!==this.status||(I.error=!0,I.fire("extentload",I,!0),e.abort()))},e.onload=o,e.onerror=function(){I.error=!0,I.fire("extentload",I,!0)},e.open("GET",i),e.setRequestHeader("Accept",M.mime),e.overrideMimeType("text/xml"),e.send()):t&&n.call(this,t))},_validateExtent:function(){if(this._extent&&this._map){var e,i=this._extent._mapExtents||[this._extent];for(let t=0;t<i.length;t++){if(!i[t].querySelector)return;i[t].querySelector('[type=zoom][min=""], [type=zoom][max=""]')&&((e=i[t].querySelector("[type=zoom]")).setAttribute("min",this._map.getMinZoom()),e.setAttribute("max",this._map.getMaxZoom())),(e=i[t].hasAttribute("units")?i[t].getAttribute("units"):null)&&M[e]?this._extent._mapExtents?this._extent._mapExtents[t].crs=M[e]:this._extent.crs=M[e]:this._extent._mapExtents?this._extent._mapExtents[t].crs=M.OSMTILE:this._extent.crs=M.OSMTILE}}},getProjection:function(){if(this._extent){let t=this._extent._mapExtents?this._extent._mapExtents[0]:this._extent;if(!t)return B;switch(t.tagName.toUpperCase()){case"MAP-EXTENT":if(t.hasAttribute("units"))return t.getAttribute("units").toUpperCase();break;case"MAP-INPUT":if(t.hasAttribute("value"))return t.getAttribute("value").toUpperCase();break;case"MAP-META":if(t.hasAttribute("content"))return M.metaContentToObject(t.getAttribute("content")).content.toUpperCase();break;default:return B}return B}},_parseLicenseAndLegend:function(t,e){var i,o=t.querySelector("map-link[rel=license]");o&&(i=o.getAttribute("title"),i='<a href="'+o.getAttribute("href")+'" title="'+i+'">'+i+"</a>"),L.setOptions(e,{attribution:i});t=t.querySelector("map-link[rel=legend]");t&&(e._legendUrl=t.getAttribute("href"))},getQueryTemplates:function(e){if(this._extent&&this._extent._queries){var i=[];for(let t=0;t<this._extent._queries.length;t++)this._extent._queries[t].extentBounds.contains(e)&&i.push(this._extent._queries[t]);return i}},_attachSkipButtons:function(t){let n=t.popup,a=t.target,e,s,i=n._container.getElementsByClassName("mapml-popup-content")[0];n._container.setAttribute("role","dialog"),i.setAttribute("tabindex","-1"),i.setAttribute("role","document"),n._count=0,n._source._eventParents?(e=n._source._eventParents[Object.keys(n._source._eventParents)[0]],s=n._source.group):e=n._source._templatedLayer,n._container.querySelector('nav[class="mapml-focus-buttons"]')&&(L.DomUtil.remove(n._container.querySelector('nav[class="mapml-focus-buttons"]')),L.DomUtil.remove(n._container.querySelector("hr")));var o=L.DomUtil.create("nav","mapml-focus-buttons");let r=L.DomUtil.create("button","mapml-popup-button",o);r.type="button",r.title="Focus Map",r.innerHTML="<span aria-hidden='true'>|&#10094;</span>",L.DomEvent.on(r,"click",t=>{L.DomEvent.stop(t),a.featureIndex._sortIndex(),a.closePopup(),a._container.focus()},n);let l=L.DomUtil.create("button","mapml-popup-button",o);l.type="button",l.title="Previous Feature",l.innerHTML="<span aria-hidden='true'>&#10094;</span>",L.DomEvent.on(l,"click",e._previousFeature,n);let m=L.DomUtil.create("p","mapml-feature-count",o),u=this._totalFeatureCount||1;m.innerText=n._count+1+"/"+u;let p=L.DomUtil.create("button","mapml-popup-button",o);p.type="button",p.title="Next Feature",p.innerHTML="<span aria-hidden='true'>&#10095;</span>",L.DomEvent.on(p,"click",e._nextFeature,n);let c=L.DomUtil.create("button","mapml-popup-button",o);c.type="button",c.title="Focus Controls",c.innerHTML="<span aria-hidden='true'>&#10095;|</span>",L.DomEvent.on(c,"click",t=>{a.featureIndex._sortIndex(),a.featureIndex.currentIndex=a.featureIndex.inBoundFeatures.length-1,a.featureIndex.inBoundFeatures[0].path.setAttribute("tabindex",-1),a.featureIndex.inBoundFeatures[a.featureIndex.currentIndex].path.setAttribute("tabindex",0),L.DomEvent.stop(t),a.closePopup(),a._controlContainer.querySelector("A").focus()},n);t=L.DomUtil.create("hr");function h(t){let e=t.originalEvent.path||t.originalEvent.composedPath();var i=9===t.originalEvent.keyCode,o=t.originalEvent.shiftKey;(e[0].classList.contains("leaflet-popup-close-button")&&i&&!o||27===t.originalEvent.keyCode||("Focus Map"===e[0].title||e[0].classList.contains("mapml-popup-content"))&&i&&o)&&setTimeout(()=>{L.DomEvent.stop(t),a.closePopup(n),s.focus()},0)}function d(t){let e=t.originalEvent.path||t.originalEvent.composedPath();var i=9===t.originalEvent.keyCode,o=t.originalEvent.shiftKey;13===t.originalEvent.keyCode&&e[0].classList.contains("leaflet-popup-close-button")||27===t.originalEvent.keyCode?(L.DomEvent.stopPropagation(t),a._container.focus(),a.closePopup(n),27!==t.originalEvent.keyCode&&(a._popupClosed=!0)):i&&e[0].classList.contains("leaflet-popup-close-button")?a.closePopup(n):("Focus Map"===e[0].title||e[0].classList.contains("mapml-popup-content"))&&i&&o&&setTimeout(()=>{L.DomEvent.stop(t),a.closePopup(n),a._container.focus()},0)}n._navigationBar=o,n._content.appendChild(t),n._content.appendChild(o),i.focus(),s?(s.setAttribute("aria-expanded","true"),a.on("keydown",h)):a.on("keydown",d),a.on("popupclose",function t(e){e.popup===n&&(a.off("keydown",h),a.off("keydown",d),a.off("popupclose",t),s&&s.setAttribute("aria-expanded","false"))})}}),v=L.Layer.extend({onAdd:function(t){var e=t.getSize();(400<e.x||300<e.y)&&(this._container=L.DomUtil.create("table","mapml-debug",t._container),this._panel=A({className:"mapml-debug-panel",pane:this._container}),t.addLayer(this._panel)),this._grid=S({className:"mapml-debug-grid",pane:t._panes.mapPane,zIndex:400,tileSize:t.options.crs.options.crs.tile.bounds.max.x}),t.addLayer(this._grid),this._vectors=z({className:"mapml-debug-vectors",pane:t._panes.mapPane,toolPane:this._container}),t.addLayer(this._vectors)},onRemove:function(t){t.removeLayer(this._grid),t.removeLayer(this._vectors),this._panel&&(t.removeLayer(this._panel),L.DomUtil.remove(this._container))}}),E=L.Layer.extend({initialize:function(t){L.setOptions(this,t)},onAdd:function(t){this._title=L.DomUtil.create("caption","mapml-debug-banner",this.options.pane),this._title.innerHTML="Debug mode",t.debug={},t.debug._infoContainer=this._debugContainer=L.DomUtil.create("tbody","mapml-debug-panel",this.options.pane);var e=t.debug._infoContainer;t.debug._tileCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._tileMatrixCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._mapCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._tcrsCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._pcrsCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._gcrsCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),this._map.on("mousemove",this._updateCoords)},onRemove:function(){L.DomUtil.remove(this._title),this._debugContainer&&(L.DomUtil.remove(this._debugContainer),this._map.off("mousemove",this._updateCoords))},_updateCoords:function(r){if(!this.contextMenu._visible){let t=this.options.mapEl,e=t._map.project(r.latlng),i=t._map.options.crs.scale(+t.zoom),o=t._map.options.crs.transformation.untransform(e,i),n=t._map.options.crs.options.crs.tile.bounds.max.x,a=e.x%n,s=e.y%n;a<0&&(a+=n),s<0&&(s+=n),this.debug._tileCoord.innerHTML=`
       <th scope="row">tile: </th>
       <td>i: ${Math.trunc(a)}, </td>
       <td>j: ${Math.trunc(s)}</td>
@@ -24,10 +24,10 @@
       <th scope="row">pcrs: </th>
       <td>easting: ${o.x.toFixed(2)}, </td>
       <td>northing: ${o.y.toFixed(2)}</td>
-      `}}}),C=function(t){return new A(t)},E=L.GridLayer.extend({initialize:function(t){L.setOptions(this,t),L.GridLayer.prototype.initialize.call(this,this._map)},createTile:function(t){let e=L.DomUtil.create("div","mapml-debug-tile");return e.setAttribute("col",t.x),e.setAttribute("row",t.y),e.setAttribute("zoom",t.z),e.innerHTML=["col: "+t.x,"row: "+t.y,"zoom: "+t.z].join(", "),e.style.outline="1px dashed red",e}}),S=function(t){return new E(t)},T=L.LayerGroup.extend({initialize:function(t){L.setOptions(this,t),L.LayerGroup.prototype.initialize.call(this,this._map,t)},onAdd:function(t){t.on("overlayremove",this._mapLayerUpdate,this),t.on("overlayadd",this._mapLayerUpdate,this);var e=t.options.crs.transformation.transform(L.point(0,0),t.options.crs.scale(0));this._centerVector=L.circle(t.options.crs.pointToLatLng(e,0),{radius:250}),this._centerVector.bindTooltip("Projection Center"),this._addBounds(t)},onRemove:function(t){this.clearLayers()},_addBounds:function(t){let e=Object.keys(t._layers),i=t._layers,o=["#FF5733","#8DFF33","#3397FF","#E433FF","#F3FF33"],n=0;this.addLayer(this._centerVector);for(var a of e)if(i[a].layerBounds){var s=[i[a].layerBounds.min,L.point(i[a].layerBounds.max.x,i[a].layerBounds.min.y),i[a].layerBounds.max,L.point(i[a].layerBounds.min.x,i[a].layerBounds.max.y)];let t=I(s,{color:o[n%o.length],weight:2,opacity:1,fillOpacity:.01,fill:!0});i[a].options._leafletLayer&&t.bindTooltip(i[a].options._leafletLayer._title,{sticky:!0}),this.addLayer(t),n++}t.totalLayerBounds&&(t=[t.totalLayerBounds.min,L.point(t.totalLayerBounds.max.x,t.totalLayerBounds.min.y),t.totalLayerBounds.max,L.point(t.totalLayerBounds.min.x,t.totalLayerBounds.max.y)],t=I(t,{color:"#808080",weight:5,opacity:.5,fill:!1}),this.addLayer(t))},_mapLayerUpdate:function(t){this.clearLayers(),this._addBounds(t.target)}}),z=function(t){return new T(t)},k=L.Path.extend({options:{className:"mapml-debug-extent"},initialize:function(t,e){this._locations=t,L.setOptions(this,e)},_project:function(){this._rings=[];let e=this._map.options.crs.scale(this._map.getZoom()),i=this._map;for(let t=0;t<this._locations.length;t++){var o=i.options.crs.transformation.transform(this._locations[t],e);this._rings.push(L.point(o.x,o.y)._subtract(i.getPixelOrigin()))}this._parts=[this._rings]},_update:function(){this._map&&this._renderer._updatePoly(this,!0)}}),I=function(t,e){return new k(t,e)},P=L.Handler.extend({addHooks:function(){L.setOptions(this,{mapEl:this._map.options.mapEl}),L.DomEvent.on(this._map,"click",this._queryTopLayer,this),L.DomEvent.on(this._map,"keypress",this._queryTopLayerAtMapCenter,this)},removeHooks:function(){L.DomEvent.off(this._map,"click",this._queryTopLayer,this),L.DomEvent.on(this._map,"keypress",this._queryTopLayerAtMapCenter,this)},_getTopQueryableLayer:function(){for(var t=this.options.mapEl.layers,e=t.length-1;0<=e;e--){var i=t[e]._layer;if(t[e].checked&&i.queryable)return i}},_queryTopLayerAtMapCenter:function(t){setTimeout(()=>{!this._map.isFocused||this._map._popupClosed||" "!==t.originalEvent.key&&13!=+t.originalEvent.keyCode?delete this._map._popupClosed:this._map.fire("click",{latlng:this._map.getCenter(),layerPoint:this._map.latLngToLayerPoint(this._map.getCenter()),containerPoint:this._map.latLngToContainerPoint(this._map.getCenter())})},0)},_queryTopLayer:function(t){var e=this._getTopQueryableLayer();e&&this._query(t,e)},_query(e,l){function t(t){return r.transformation.untransform(t,r.scale(s))}function i(t){return r.unproject(r.transformation.untransform(t,r.scale(s)),s)}var o,n={},a=l.getQueryTemplates()[0],s=e.target.getZoom(),u=this._map,r=l.crs,m=u.options.crs.options.crs.tile.bounds.max.x,p=l._container,c={autoClose:!1,autoPan:!0,maxHeight:.5*u.getSize().y-50},h=r.latLngToPoint(e.latlng,s),d=h.divideBy(m).floor(),_=new L.Bounds(h.divideBy(m).floor().multiplyBy(m),h.divideBy(m).ceil().multiplyBy(m));for(o in n[a.query.tilei]=h.x.toFixed()-d.x*m,n[a.query.tilej]=h.y.toFixed()-d.y*m,n[a.query.mapi]=u.getSize().divideBy(2).x.toFixed(),n[a.query.mapj]=u.getSize().divideBy(2).y.toFixed(),n[a.query.pixelleft]=r.pointToLatLng(h,s).lng,n[a.query.pixeltop]=r.pointToLatLng(h,s).lat,n[a.query.pixelright]=r.pointToLatLng(h.add([1,1]),s).lng,n[a.query.pixelbottom]=r.pointToLatLng(h.add([1,1]),s).lat,n[a.query.column]=d.x,n[a.query.row]=d.y,n[a.query.x]=h.x.toFixed(),n[a.query.y]=h.y.toFixed(),n[a.query.easting]=t(h).x,n[a.query.northing]=t(h).y,n[a.query.longitude]=i(h).lng,n[a.query.latitude]=i(h).lat,n[a.query.zoom]=s,n[a.query.width]=u.getSize().x,n[a.query.height]=u.getSize().y,n[a.query.mapbottom]=t(h.add(u.getSize().divideBy(2))).y,n[a.query.mapleft]=t(h.subtract(u.getSize().divideBy(2))).x,n[a.query.maptop]=t(h.subtract(u.getSize().divideBy(2))).y,n[a.query.mapright]=t(h.add(u.getSize().divideBy(2))).x,n[a.query.tilebottom]=t(_.max).y,n[a.query.tileleft]=t(_.min).x,n[a.query.tiletop]=t(_.min).y,n[a.query.tileright]=t(_.max).x,a.query)["mapi","mapj","tilei","tilej","row","col","x","y","easting","northing","longitude","latitude","width","height","zoom","mapleft","mapright",",maptop","mapbottom","tileleft","tileright","tiletop","tilebottom","pixeltop","pixelbottom","pixelleft","pixelright"].indexOf(o)<0&&(n[o]=a.query[o]);let y=this._map.project(e.latlng),g=this._map.options.crs.scale(this._map.getZoom()),f=this._map.options.crs.transformation.untransform(y,g),x;a.layerBounds.contains(f)&&fetch(L.Util.template(a.template,n),{redirect:"follow"}).then(t=>{if(x=t.headers.get("Content-Type"),200<=t.status&&t.status<300)return t.text();throw new Error(t.status)}).then(t=>x.startsWith("text/mapml")?function(t,o){let e=new DOMParser,i=e.parseFromString(t,"application/xml");for(var n of i.querySelectorAll("map-feature"))if(!n.querySelector("map-geometry")){let t=document.createElement("map-geometry"),e=document.createElement("map-point"),i=document.createElement("map-coordinates");t.setAttribute("cs","gcrs"),i.innerHTML=o.lng+" "+o.lat,e.appendChild(i),t.appendChild(e),n.appendChild(t)}let a=M.mapMlFeatures(i,{renderer:M.featureRenderer(),pane:p,projection:u.options.projection,_leafletLayer:l,query:!0,static:!0});a.addTo(u);let s=L.DomUtil.create("div","mapml-popup-content"),r=L.DomUtil.create("iframe");r.style="border: none",r.srcdoc=i.querySelector("map-feature map-properties").innerHTML,r.setAttribute("sandbox","allow-same-origin allow-forms"),s.appendChild(r),l._totalFeatureCount=i.querySelectorAll("map-feature").length,l.bindPopup(s,c).openPopup(o),l.on("popupclose",function(){u.removeLayer(a)}),a.showPaginationFeature({i:0,popup:l._popup})}(t,e.latlng):function(t,e,i){let o=L.DomUtil.create("div","mapml-popup-content"),n=L.DomUtil.create("iframe");n.style="border: none",n.srcdoc=t,n.setAttribute("sandbox","allow-same-origin allow-forms"),o.appendChild(n),e.bindPopup(o,c).openPopup(i)}(t,l,e.latlng)).catch(t=>{console.log("Looks like there was a problem. Status: "+t.message)})}}),w=L.Handler.extend({_touchstart:L.Browser.msPointer?"MSPointerDown":L.Browser.pointer?"pointerdown":"touchstart",initialize:function(t){L.Handler.prototype.initialize.call(this,t),this._items=[{text:M.options.locale.cmBack+" (<kbd>B</kbd>)",callback:this._goBack},{text:M.options.locale.cmForward+" (<kbd>F</kbd>)",callback:this._goForward},{text:M.options.locale.cmReload+" (<kbd>R</kbd>)",callback:this._reload},{spacer:"-"},{text:M.options.locale.cmToggleControls+" (<kbd>T</kbd>)",callback:this._toggleControls},{text:M.options.locale.cmCopyCoords+" (<kbd>C</kbd>)<span></span>",callback:this._copyCoords,hideOnSelect:!1,popup:!0,submenu:[{text:"tile",callback:this._copyTile},{text:"tilematrix",callback:this._copyTileMatrix},{spacer:"-"},{text:"map",callback:this._copyMap},{spacer:"-"},{text:"tcrs",callback:this._copyTCRS},{text:"pcrs",callback:this._copyPCRS},{text:"gcrs",callback:this._copyGCRS},{spacer:"-"},{text:M.options.locale.cmCopyAll,callback:this._copyAllCoords}]},{text:M.options.locale.cmToggleDebug+" (<kbd>D</kbd>)",callback:this._toggleDebug},{text:M.options.locale.cmCopyMapML+" (<kbd>M</kbd>)",callback:this._copyMapML},{text:M.options.locale.cmViewSource+" (<kbd>V</kbd>)",callback:this._viewSource}],this._layerItems=[{text:M.options.locale.lmZoomToLayer+" (<kbd>Z</kbd>)",callback:this._zoomToLayer},{text:M.options.locale.lmCopyExtent+" (<kbd>C</kbd>)",callback:this._copyLayerExtent}],this._mapMenuVisible=!1,this._keyboardEvent=!1,this._container=L.DomUtil.create("div","mapml-contextmenu",t._container),this._container.setAttribute("hidden","");for(let t=0;t<6;t++)this._items[t].el=this._createItem(this._container,this._items[t]);this._coordMenu=L.DomUtil.create("div","mapml-contextmenu mapml-submenu",this._container),this._coordMenu.id="mapml-copy-submenu",this._coordMenu.setAttribute("hidden",""),this._clickEvent=null;for(let t=0;t<this._items[5].submenu.length;t++)this._createItem(this._coordMenu,this._items[5].submenu[t],t);this._items[6].el=this._createItem(this._container,this._items[6]),this._items[7].el=this._createItem(this._container,this._items[7]),this._items[8].el=this._createItem(this._container,this._items[8]),this._layerMenu=L.DomUtil.create("div","mapml-contextmenu mapml-layer-menu",t._container),this._layerMenu.setAttribute("hidden","");for(let t=0;t<this._layerItems.length;t++)this._createItem(this._layerMenu,this._layerItems[t]);L.DomEvent.on(this._container,"click",L.DomEvent.stop).on(this._container,"mousedown",L.DomEvent.stop).on(this._container,"dblclick",L.DomEvent.stop).on(this._container,"contextmenu",L.DomEvent.stop).on(this._layerMenu,"click",L.DomEvent.stop).on(this._layerMenu,"mousedown",L.DomEvent.stop).on(this._layerMenu,"dblclick",L.DomEvent.stop).on(this._layerMenu,"contextmenu",L.DomEvent.stop)},addHooks:function(){var t=this._map.getContainer();L.DomEvent.on(t,"mouseleave",this._hide,this).on(document,"keydown",this._onKeyDown,this),L.Browser.touch&&L.DomEvent.on(document,this._touchstart,this._hide,this),this._map.on({contextmenu:this._show,mousedown:this._hide,zoomstart:this._hide},this)},removeHooks:function(){var t=this._map.getContainer();L.DomEvent.off(t,"mouseleave",this._hide,this).off(document,"keydown",this._onKeyDown,this),L.Browser.touch&&L.DomEvent.off(document,this._touchstart,this._hide,this),this._map.off({contextmenu:this._show,mousedown:this._hide,zoomstart:this._hide},this)},_copyLayerExtent:function(t){let e=(t instanceof KeyboardEvent?this._map:this).contextMenu,i=e._layerClicked.layer._layerEl,o=i.extent.topLeft.pcrs,n=i.extent.bottomRight.pcrs;t=`<map-meta name="extent" content="top-left-easting=${o.horizontal}, top-left-northing=${o.vertical}, bottom-right-easting=${n.horizontal}, bottom-right-northing=${n.vertical}"></map-meta>`;e._copyData(t)},_zoomToLayer:function(t){let e=(t instanceof KeyboardEvent?this._map:this).contextMenu;e._layerClicked.layer._layerEl.focus()},_goForward:function(t){let e=(t instanceof KeyboardEvent?this._map:this).options.mapEl;e.forward()},_goBack:function(t){let e=(t instanceof KeyboardEvent?this._map:this).options.mapEl;e.back()},_reload:function(t){let e=(t instanceof KeyboardEvent?this._map:this).options.mapEl;e.reload()},_toggleControls:function(t){let e=(t instanceof KeyboardEvent?this._map:this).options.mapEl;e._toggleControls()},_copyMapML:function(t){let e=(t instanceof KeyboardEvent?this._map:this).contextMenu,i=(t instanceof KeyboardEvent?this._map:this).options.mapEl;e._copyData(i.outerHTML.replace(/<div class="mapml-web-map">.*?<\/div>|<style>\[is="web-map"].*?<\/style>|<style>mapml-viewer.*?<\/style>/gm,""))},_viewSource:function(t){let e=(t instanceof KeyboardEvent?this._map:this).options.mapEl;e.viewSource()},_toggleDebug:function(t){let e=(t instanceof KeyboardEvent?this._map:this).options.mapEl;e.toggleDebug()},_copyCoords:function(t){let e=this.contextMenu||this;e._showCoordMenu(t)},_copyData:function(t){const e=document.createElement("textarea");e.value=t,document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)},_copyGCRS:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent;this.contextMenu._copyData(`z:${e.zoom}, lon :${i.latlng.lng.toFixed(6)}, lat:`+i.latlng.lat.toFixed(6))},_copyTCRS:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent,o=e._map.project(i.latlng);this.contextMenu._copyData(`z:${e.zoom}, x:${o.x}, y:`+o.y)},_copyTileMatrix:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent,o=e._map.project(i.latlng),n=e._map.options.crs.options.crs.tile.bounds.max.x;this.contextMenu._copyData(`z:${e.zoom}, column:${Math.trunc(o.x/n)}, row:`+Math.trunc(o.y/n))},_copyPCRS:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent,o=e._map.project(i.latlng),n=e._map.options.crs.scale(+e.zoom),a=e._map.options.crs.transformation.untransform(o,n);this.contextMenu._copyData(`z:${e.zoom}, easting:${a.x.toFixed(2)}, northing:`+a.y.toFixed(2))},_copyTile:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent,o=e._map.options.crs.project(i.latlng),n=e._map.options.crs.options.crs.tile.bounds.max.x,a=o.x%n,s=o.y%n;a<0&&(a+=n),s<0&&(s+=n),this.contextMenu._copyData(`z:${e.zoom}, i:${Math.trunc(a)}, j:`+Math.trunc(s))},_copyMap:function(t){var e=this.options.mapEl,i=this.contextMenu._clickEvent;this.contextMenu._copyData(`z:${e.zoom}, i:${Math.trunc(i.containerPoint.x)}, j:`+Math.trunc(i.containerPoint.y))},_copyAllCoords:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent,o=e._map.project(i.latlng),n=e._map.options.crs.options.crs.tile.bounds.max.x,a=o.x%n,s=o.y%n,r=e._map.options.crs.scale(+e.zoom),l=e._map.options.crs.transformation.untransform(o,r);var u=`z:${e.zoom}
-`;u+=`tile: i:${Math.trunc(a)}, j:${Math.trunc(s)}
-`,u+=`tilematrix: column:${Math.trunc(o.x/n)}, row:${Math.trunc(o.y/n)}
-`,u+=`map: i:${Math.trunc(i.containerPoint.x)}, j:${Math.trunc(i.containerPoint.y)}
-`,u+=`tcrs: x:${Math.trunc(o.x)}, y:${Math.trunc(o.y)}
-`,u+=`pcrs: easting:${l.x.toFixed(2)}, northing:${l.y.toFixed(2)}
-`,u+=`gcrs: lon :${i.latlng.lng.toFixed(6)}, lat:`+i.latlng.lat.toFixed(6),this.contextMenu._copyData(u)},_createItem:function(t,e,i){if(e.spacer)return this._createSeparator(t,i);t=this._insertElementAt("button","mapml-contextmenu-item",t,i),i=this._createEventHandler(t,e.callback,e.context,e.hideOnSelect);return t.innerHTML=""+e.text,t.setAttribute("type","button"),t.classList.add("mapml-button"),e.popup&&(t.setAttribute("aria-haspopup","true"),t.setAttribute("aria-expanded","false"),t.setAttribute("aria-controls","mapml-copy-submenu")),L.DomEvent.on(t,"mouseover",this._onItemMouseOver,this).on(t,"mouseout",this._onItemMouseOut,this).on(t,"mousedown",L.DomEvent.stopPropagation).on(t,"click",i),L.Browser.touch&&L.DomEvent.on(t,this._touchstart,L.DomEvent.stopPropagation),L.Browser.pointer||L.DomEvent.on(t,"click",this._onItemMouseOut,this),{id:L.Util.stamp(t),el:t,callback:i}},_createSeparator:function(t,e){e=this._insertElementAt("div","mapml-contextmenu-separator",t,e);return{id:L.Util.stamp(e),el:e}},_createEventHandler:function(r,l,u,m){let p=this;return m=void 0===m||m,function(t){let e=p._map,i=p._showLocation.containerPoint,o=e.containerPointToLayerPoint(i),n=e.layerPointToLatLng(o),a=p._showLocation.relatedTarget,s={containerPoint:i,layerPoint:o,latlng:n,relatedTarget:a};m&&p._hide(),l&&l.call(u||e,s),p._map.fire("contextmenu.select",{contextmenu:p,el:r})}},_insertElementAt:function(t,e,i,o){let n,a=document.createElement(t);return a.className=e,void 0!==o&&(n=i.children[o]),n?i.insertBefore(a,n):i.appendChild(a),a},_show:function(t){this._mapMenuVisible&&this._hide();let e=(this._clickEvent=t).originalEvent.target;if(e.closest("fieldset")){if(e=e.closest("fieldset").querySelector("span"),!e.layer.validProjection)return;this._layerClicked=e,this._showAtPoint(t.containerPoint,t,this._layerMenu)}else(e.classList.contains("leaflet-container")||e.classList.contains("mapml-debug-extent")||"path"===e.tagName)&&(this._layerClicked=void 0,this._showAtPoint(t.containerPoint,t,this._container));0!==t.originalEvent.button&&-1!==t.originalEvent.button||(this._keyboardEvent=!0,this._layerClicked?(t=document.activeElement,this._elementInFocus=t.shadowRoot.activeElement,this._layerMenuTabs=1,this._layerMenu.firstChild.focus()):this._container.firstChild.focus())},_showAtPoint:function(t,e,i){var o;this._items.length&&(o=L.extend(e||{},{contextmenu:this}),this._showLocation={containerPoint:t},e&&e.relatedTarget&&(this._showLocation.relatedTarget=e.relatedTarget),this._setPosition(t,i),this._mapMenuVisible||(i.removeAttribute("hidden"),this._mapMenuVisible=!0),this._map.fire("contextmenu.show",o))},_hide:function(){this._mapMenuVisible&&(this._mapMenuVisible=!1,this._container.setAttribute("hidden",""),this._coordMenu.setAttribute("hidden",""),this._layerMenu.setAttribute("hidden",""),this._map.fire("contextmenu.hide",{contextmenu:this}),setTimeout(()=>this._map._container.focus(),0))},_setPosition:function(t,e){var i,o=this._map.getSize(),n=this._getElementSize(e);this._map.options.contextmenuAnchor&&(i=L.point(this._map.options.contextmenuAnchor),t=t.add(i)),(e._leaflet_pos=t).x+n.x>o.x?(e.style.left="auto",e.style.right=Math.min(Math.max(o.x-t.x,0),o.x-n.x-1)+"px"):(e.style.left=Math.max(t.x,0)+"px",e.style.right="auto"),t.y+n.y>o.y?(e.style.top="auto",e.style.bottom=Math.min(Math.max(o.y-t.y,0),o.y-n.y-1)+"px"):(e.style.top=Math.max(t.y,0)+"px",e.style.bottom="auto")},_getElementSize:function(t){let e=this._size;return e&&!this._sizeChanged||(e={},t.style.left="-999999px",t.style.right="auto",e.x=t.offsetWidth,e.y=t.offsetHeight,t.style.left="auto",this._sizeChanged=!1),e},_focusOnLayerControl:function(){this._mapMenuVisible=!1,delete this._layerMenuTabs,this._layerMenu.setAttribute("hidden",""),(this._elementInFocus||this._layerClicked.parentElement.firstChild).focus(),delete this._elementInFocus},_onKeyDown:function(t){if(this._mapMenuVisible){var e=t.keyCode,i=t.path||t.composedPath();switch(13===e&&t.preventDefault(),!this._layerMenuTabs||9!==e&&27!==e?16===e||9===e||!this._layerClicked&&67===e||i[0].innerText===M.options.locale.cmCopyCoords+" (C)"||this._hide():(t.shiftKey?--this._layerMenuTabs:this._layerMenuTabs+=1,0!==this._layerMenuTabs&&3!==this._layerMenuTabs&&27!==e||(L.DomEvent.stop(t),this._focusOnLayerControl())),e){case 13:case 32:this._map._container.parentNode.activeElement.parentNode.classList.contains("mapml-contextmenu")&&this._map._container.parentNode.activeElement.click();break;case 66:this._goBack(t);break;case 67:this._layerClicked?this._copyLayerExtent(t):this._copyCoords({latlng:this._map.getCenter()});break;case 68:this._toggleDebug(t);break;case 77:this._copyMapML(t);break;case 70:this._goForward(t);break;case 82:this._reload(t);break;case 84:this._toggleControls(t);break;case 86:this._viewSource(t);break;case 90:this._layerClicked&&this._zoomToLayer(t)}}},_showCoordMenu:function(t){let e=this._map.getSize(),i=this._clickEvent,o=this._coordMenu,n=this._items[5].el.el;n.setAttribute("aria-expanded","true"),o.removeAttribute("hidden"),i.containerPoint.x+160+80>e.x?(o.style.left="auto",o.style.right="160px"):(o.style.left="160px",o.style.right="auto"),i.containerPoint.y+160>e.y?(o.style.top="auto",o.style.bottom="20px"):(o.style.top="100px",o.style.bottom="auto"),this._keyboardEvent&&o.firstChild.focus()},_hideCoordMenu:function(t){if(!t.srcElement.parentElement.classList.contains("mapml-submenu")&&t.srcElement.innerText!==M.options.locale.cmCopyCoords+" (C)"){let t=this._coordMenu,e=this._items[5].el.el;e.setAttribute("aria-expanded","false"),t.setAttribute("hidden","")}},_onItemMouseOver:function(t){L.DomUtil.addClass(t.target||t.srcElement,"over"),t.srcElement.innerText===M.options.locale.cmCopyCoords+" (C)"&&this._showCoordMenu(t)},_onItemMouseOut:function(t){L.DomUtil.removeClass(t.target||t.srcElement,"over"),this._hideCoordMenu(t)}}),B=function(e,i){if(!e||!i)return{};let o=[],n=[],a=[],s=[],r=i.options.crs.options.crs.tile.bounds.max.y;for(let t=0;t<i.options.crs.options.resolutions.length;t++){var l=i.options.crs.scale(t),u=i.options.crs.transformation.transform(e.min,l),l=i.options.crs.transformation.transform(e.max,l);o.push({horizontal:u.x,vertical:l.y}),n.push({horizontal:l.x,vertical:u.y}),a.push({horizontal:o[t].horizontal/r,vertical:o[t].vertical/r}),s.push({horizontal:n[t].horizontal/r,vertical:n[t].vertical/r})}var t=i.options.crs.unproject(e.min),m=i.options.crs.unproject(e.max);let p={horizontal:t.lng,vertical:m.lat},c={horizontal:m.lng,vertical:t.lat},h={horizontal:e.min.x,vertical:e.max.y},d={horizontal:e.max.x,vertical:e.min.y};return{topLeft:{tcrs:o,tilematrix:a,gcrs:p,pcrs:h},bottomRight:{tcrs:n,tilematrix:s,gcrs:c,pcrs:d},projection:i.options.projection}},F=function(m){if(m){let e=m.values,t=m.projection||H,i=0,o=d,n=this[t].options.crs.tilematrix.bounds(0),a=this[t].options.resolutions.length-1,s=0,r=a,l=!1,u=0;for(let t=0;t<e.length;t++)switch(e[t].getAttribute("type")){case"zoom":s=+(e[t].hasAttribute("min")&&!isNaN(+e[t].getAttribute("min"))?e[t].getAttribute("min"):0),r=+(e[t].hasAttribute("max")&&!isNaN(+e[t].getAttribute("max"))?e[t].getAttribute("max"):a),i=+e[t].getAttribute("value");break;case"location":if(!e[t].getAttribute("max")||!e[t].getAttribute("min"))continue;var p=+e[t].getAttribute("max"),c=+e[t].getAttribute("min");switch(e[t].getAttribute("axis").toLowerCase()){case"x":case"longitude":case"column":case"easting":o=M.axisToCS(e[t].getAttribute("axis").toLowerCase()),n.min.x=c,n.max.x=p,u++;break;case"y":case"latitude":case"row":case"northing":o=M.axisToCS(e[t].getAttribute("axis").toLowerCase()),n.min.y=c,n.max.y=p,u++}}2<=u&&(l=!0);var h={minZoom:m.zoomBounds?.min&&!isNaN(+m.zoomBounds.min)?+m.zoomBounds.min:0,maxZoom:m.zoomBounds?.max&&!isNaN(+m.zoomBounds.max)?+m.zoomBounds.max:a,minNativeZoom:s,maxNativeZoom:r};return n=!l&&m.extentPCRSFallback&&m.extentPCRSFallback.bounds?m.extentPCRSFallback.bounds:l?this.boundsToPCRSBounds(n,i,t,o):this[t].options.crs.pcrs.bounds,{zoomBounds:h,bounds:n}}},q=function(t){try{switch(t.toLowerCase()){case"row":case"column":return"TILEMATRIX";case"i":case"j":return["MAP","TILE"];case"x":case"y":return"TCRS";case"latitude":case"longitude":return"GCRS";case"northing":case"easting":return"PCRS";default:return d}}catch(t){return}},D=function(t){try{switch(t.toLowerCase()){case"tilematrix":return["column","row"];case"map":case"tile":return["i","j"];case"tcrs":return["x","y"];case"gcrs":return["longitude","latitude"];case"pcrs":return["easting","northing"]}}catch(t){return}},N=function(t){try{switch(t.toLowerCase()){case"i":case"column":case"longitude":case"x":case"easting":return"x";case"row":case"j":case"latitude":case"y":case"northing":return"y";default:return}}catch(t){return}},R=function(t,e,i,o){if(t&&(e||0===e)&&Number.isFinite(+e)&&i&&o)switch(i="string"==typeof i?M[i]:i,o.toUpperCase()){case"PCRS":return t;case"TCRS":case"TILEMATRIX":var n=i.transformation.transform(t.min,i.scale(+e)),a=i.transformation.transform(t.max,i.scale(+e));if("TCRS"===o.toUpperCase())return L.bounds(n,a);var s=i.options.crs.tile.bounds.max.x;return L.bounds(L.point(n.x/s,n.y/s),L.point(a.x/s,a.y/s));case"GCRS":a=i.unproject(t.min),s=i.unproject(t.max);return L.bounds(L.point(a.lng,a.lat),L.point(s.lng,s.lat));default:return}},O=function(t,e,i,o){if(t&&(e||0===e)&&Number.isFinite(+e)&&o&&i){var n=(i="string"==typeof i?M[i]:i).options.crs.tile.bounds.max.x;switch(o.toUpperCase()){case"TILEMATRIX":return M.pixelToPCRSPoint(L.point(t.x*n,t.y*n),e,i);case"PCRS":return t;case"TCRS":return M.pixelToPCRSPoint(t,e,i);case"GCRS":return i.project(L.latLng(t.y,t.x));default:return}}},U=function(t,e,i){if(t&&(e||0===e)&&Number.isFinite(+e)&&i)return(i="string"==typeof i?M[i]:i).transformation.untransform(t,i.scale(e))},j=function(t,e,i,o){if(t&&t.max&&t.min&&(e||0===e)&&Number.isFinite(+e)&&i&&o)return i="string"==typeof i?M[i]:i,L.bounds(M.pointToPCRSPoint(t.min,e,i,o),M.pointToPCRSPoint(t.max,e,i,o))},Z=function(t,e,i){if(t&&t.max&&t.min&&(e||0===e)&&Number.isFinite(+e)&&i)return i="string"==typeof i?M[i]:i,L.bounds(M.pixelToPCRSPoint(t.min,e,i),M.pixelToPCRSPoint(t.max,e,i))},G=function(t){if(!t||t instanceof Object)return{};let e=t.split(/\s+/).join(""),i={},o=e.split(",");for(let t=0;t<o.length;t++){var n=o[t].split("=");2===n.length&&(i[n[0]]=n[1])}return""!==i&&1===o[0].split("=").length&&(i.content=o[0]),i},W=function(t){for(var e=1,i=[],o=t.split(",");e<o.length;e+=2)i.push([parseInt(o[e-1]),parseInt(o[e])]);return i},$=function(t,e,i){if(i instanceof Element&&t&&t.querySelector("map-link[rel=stylesheet],map-style")){if(e instanceof Element)e=e.getAttribute("href")?e.getAttribute("href"):document.URL;else if(!e||""===e||e instanceof Object)return;for(var o,n,a=[],s=t.querySelectorAll("map-link[rel=stylesheet],map-style"),r=0;r<s.length;r++)"MAP-LINK"===s[r].nodeName.toUpperCase()?(o=s[r].hasAttribute("href")?new URL(s[r].getAttribute("href"),e).href:null)&&(i.querySelector("link[href='"+o+"']")||((n=document.createElement("link")).setAttribute("href",o),n.setAttribute("rel","stylesheet"),a.push(n))):((n=document.createElement("style")).textContent=s[r].textContent,a.push(n));for(var l=a.length-1;0<=l;l--)i.insertAdjacentElement("afterbegin",a[l])}},K=function(t,e,i){var o=[];t.split(/\s+/gim).forEach(M.parseNumber,o),this.push(o)},Y=function(t,e,i){this.push(parseFloat(t))},Q=function(o,t){let n,i=!1,a,s=t._map,r;if("text/html"===o.type&&"_blank"!==o.target)o.target="_top";else if("text/html"!==o.type&&o.url.includes("#")){let t=o.url.split("#"),e=t[1].split(",");n={z:e[0]||0,lng:e[1]||0,lat:e[2]||0},i=!t[0],["/",".","#"].includes(o.url[0])&&(o.target="_self")}if(i)n&&!o.inPlace&&i&&(t._map.options.mapEl.zoomTo(+n.lat,+n.lng,+n.z),r&&(a.opacity=r));else{let i=!1;switch(a=document.createElement("layer-"),a.setAttribute("src",o.url),a.setAttribute("checked",""),o.target){case"_blank":"text/html"===o.type?window.open(o.url):(s.options.mapEl.appendChild(a),i=!0);break;case"_parent":for(var e of s.options.mapEl.querySelectorAll("layer-"))e._layer!==t&&s.options.mapEl.removeChild(e);s.options.mapEl.appendChild(a),s.options.mapEl.removeChild(t._layerEl),i=!0;break;case"_top":window.location.href=o.url;break;default:r=t._layerEl.opacity,t._layerEl.insertAdjacentElement("beforebegin",a),s.options.mapEl.removeChild(t._layerEl),i=!0}!o.inPlace&&i&&L.DomEvent.on(a,"extentload",function t(e){i&&["_parent","_self"].includes(o.target)&&1===a.parentElement.querySelectorAll("layer-").length&&(a.parentElement.projection=a._layer.getProjection()),a.extent&&(n?a.parentElement.zoomTo(+n.lat,+n.lng,+n.z):a.focus(),L.DomEvent.off(a,"extentload",t)),r&&(a.opacity=r),s.getContainer().focus()})}},X=function(t){var e=t._map.project(t._map.getCenter()),t=t._map.options.crs.options.crs.tile.bounds.max.y;return[Math.trunc(e.x/t),Math.trunc(e.y/t)]},J=L.Control.extend({options:{position:"topleft"},onAdd:function(t){var e=L.DomUtil.create("div","mapml-reload-button leaflet-bar");let i=L.DomUtil.create("button","mapml-reload-button",e);return i.innerHTML="<span aria-hidden='true'>&#x021BA</span>",i.title=M.options.locale.cmReload,i.setAttribute("type","button"),i.classList.add("mapml-button"),i.setAttribute("aria-label","Reload"),L.DomEvent.disableClickPropagation(i),L.DomEvent.on(i,"click",L.DomEvent.stop),L.DomEvent.on(i,"click",this._goReload,this),this._reloadButton=i,this._updateDisabled(),t.on("moveend",this._updateDisabled,this),e},onRemove:function(t){t.off("moveend",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_goReload:function(t){!this._disabled&&1<this._map.options.mapEl._history.length&&this._map.options.mapEl.reload()},_updateDisabled:function(){setTimeout(()=>{L.DomUtil.removeClass(this._reloadButton,"leaflet-disabled"),this._reloadButton.setAttribute("aria-disabled","false"),this._map&&(this._disabled||this._map.options.mapEl._history.length<=1)&&(L.DomUtil.addClass(this._reloadButton,"leaflet-disabled"),this._reloadButton.setAttribute("aria-disabled","true"))},0)}}),tt=L.Control.extend({options:{position:"topleft",title:{false:"View fullscreen",true:"Exit fullscreen"}},onAdd:function(t){var e=L.DomUtil.create("div","leaflet-control-fullscreen leaflet-bar leaflet-control");return this.link=L.DomUtil.create("a","leaflet-control-fullscreen-button leaflet-bar-part",e),this.link.href="#",this.link.setAttribute("role","button"),this._map=t,this._map.on("fullscreenchange",this._toggleTitle,this),this._toggleTitle(),L.DomEvent.on(this.link,"click",this._click,this),e},onRemove:function(t){t.off("fullscreenchange",this._toggleTitle,this)},_click:function(t){L.DomEvent.stopPropagation(t),L.DomEvent.preventDefault(t),this._map.toggleFullscreen(this.options)},_toggleTitle:function(){this.link.title=this.options.title[this._map.isFullscreen()]}});L.Map.include({isFullscreen:function(){return this._isFullscreen||!1},toggleFullscreen:function(t){var e=this.getContainer().getRootNode().host,e="DIV"===e.nodeName?e.parentElement:e;this.isFullscreen()?t&&t.pseudoFullscreen?this._disablePseudoFullscreen(e):document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.msExitFullscreen?document.msExitFullscreen():this._disablePseudoFullscreen(e):t&&t.pseudoFullscreen?this._enablePseudoFullscreen(e):e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):e.msRequestFullscreen?e.msRequestFullscreen():this._enablePseudoFullscreen(e)},_enablePseudoFullscreen:function(t){L.DomUtil.addClass(t,"leaflet-pseudo-fullscreen"),this._setFullscreen(!0),this.fire("fullscreenchange")},_disablePseudoFullscreen:function(t){L.DomUtil.removeClass(t,"leaflet-pseudo-fullscreen"),this._setFullscreen(!1),this.fire("fullscreenchange")},_setFullscreen:function(t){this._isFullscreen=t;var e=this.getContainer().getRootNode().host;t?L.DomUtil.addClass(e,"mapml-fullscreen-on"):L.DomUtil.removeClass(e,"mapml-fullscreen-on"),this.invalidateSize()},_onFullscreenChange:function(t){var e=document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement,i=this.getContainer().getRootNode().host,i="DIV"===i.nodeName?i.parentElement:i;e!==i||this._isFullscreen?e!==i&&this._isFullscreen&&(this._setFullscreen(!1),this.fire("fullscreenchange")):(this._setFullscreen(!0),this.fire("fullscreenchange"))}}),L.Map.mergeOptions({fullscreenControl:!1}),L.Map.addInitHook(function(){var t,e;this.options.fullscreenControl&&(this.fullscreenControl=new tt(this.options.fullscreenControl),this.addControl(this.fullscreenControl)),"onfullscreenchange"in document?t="fullscreenchange":"onmozfullscreenchange"in document?t="mozfullscreenchange":"onwebkitfullscreenchange"in document?t="webkitfullscreenchange":"onmsfullscreenchange"in document&&(t="MSFullscreenChange"),t&&(e=L.bind(this._onFullscreenChange,this),this.whenReady(function(){L.DomEvent.on(document,t,e)}),this.on("unload",function(){L.DomEvent.off(document,t,e)}))});function et(t){return new tt(t)}function it(t){return new lt(t)}function ot(t,e){return new ut(t,e)}function nt(t){return new mt(t)}function at(t,e){return new pt(t,e)}var st,rt,lt=L.Layer.extend({onAdd:function(t){this._container=L.DomUtil.create("div","mapml-crosshair",t._container),this._container.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 100 100"><g stroke="#fff" stroke-linecap="round" stroke-linejoin="round"><circle cx="50.028" cy="50.219" r="3.923" stroke-width="2" color="currentColor" overflow="visible"/><path stroke-width="3" d="M4.973 54.424h31.768a4.204 4.204 0 1 0 0-8.409H4.973A4.203 4.203 0 0 0 .77 50.22a4.203 4.203 0 0 0 4.204 4.205z" color="currentColor" overflow="visible"/><path stroke-width="3" d="M54.232 5.165a4.204 4.204 0 1 0-8.408 0v31.767a4.204 4.204 0 1 0 8.408 0V5.165z"/><path stroke-width="3" d="M99.288 50.22a4.204 4.204 0 0 0-4.204-4.205H63.317a4.204 4.204 0 1 0 0 8.409h31.767a4.205 4.205 0 0 0 4.204-4.205zM45.823 95.274a4.204 4.204 0 1 0 8.409 0V63.506a4.204 4.204 0 1 0-8.409 0v31.768z" color="currentColor" overflow="visible"/></g></svg>',t.isFocused=!1,this._isQueryable=!1,t.on("layerchange layeradd layerremove overlayremove",this._toggleEvents,this),t.on("popupopen",this._isMapFocused,this),L.DomEvent.on(t._container,"keydown keyup mousedown",this._isMapFocused,this),this._addOrRemoveCrosshair()},onRemove:function(t){t.off("layerchange layeradd layerremove overlayremove",this._toggleEvents),t.off("popupopen",this._isMapFocused),L.DomEvent.off(t._container,"keydown keyup mousedown",this._isMapFocused)},_toggleEvents:function(){this._hasQueryableLayer()?this._map.on("viewreset move moveend",this._addOrRemoveCrosshair,this):this._map.off("viewreset move moveend",this._addOrRemoveCrosshair,this),this._addOrRemoveCrosshair()},_addOrRemoveCrosshair:function(t){this._hasQueryableLayer()?this._container.removeAttribute("hidden"):this._container.setAttribute("hidden","")},_addOrRemoveMapOutline:function(t){var e=this._map._container;this._map.isFocused&&!this._outline?this._outline=L.DomUtil.create("div","mapml-outline",e):!this._map.isFocused&&this._outline&&(L.DomUtil.remove(this._outline),delete this._outline)},_hasQueryableLayer:function(){var t=this._map.options.mapEl.layers;if(this._map.isFocused)for(var e of t)if(e.checked&&e._layer.queryable)return!0;return!1},_isMapFocused:function(t){var e;this._map._container.parentNode.activeElement?((e=this._map._container.parentNode.activeElement.classList.contains("leaflet-container"))&&["keydown"].includes(t.type)&&t.shiftKey&&9===t.keyCode?this._map.isFocused=!1:this._map.isFocused=e&&["keyup","keydown"].includes(t.type),this._map.isFocused&&this._map.fire("mapkeyboardfocused"),this._addOrRemoveMapOutline(),this._addOrRemoveCrosshair()):this._map.isFocused=!1}}),ut=L.Path.extend({initialize:function(t,e){this.type=t.tagName.toUpperCase(),"MAP-POINT"!==this.type&&"MAP-MULTIPOINT"!==this.type||(e.fillOpacity=1),0<e.wrappers.length&&(e=Object.assign(this._convertWrappers(e.wrappers),e)),L.setOptions(this,e),this.group=this.options.group,this.options.interactive=this.options.link||this.options.properties&&this.options.onEachFeature,this._parts=[],this._markup=t,this.options.zoom=t.getAttribute("zoom")||this.options.nativeZoom,this._convertMarkup(),(t.querySelector("map-span")||t.querySelector("map-a"))&&this._generateOutlinePoints(),this.isClosed=this._isClosed()},attachLinkHandler:function(o,n,a){let s,i=document.createElement("div"),r=document.createElement("p"),l=!1;i.classList.add("mapml-link-preview"),i.appendChild(r),o.classList.add("map-a"),n.visited&&o.classList.add("map-a-visited"),L.DomEvent.on(o,"mousedown",t=>s={x:t.clientX,y:t.clientY},this),L.DomEvent.on(o,"mouseup",i=>{if(0===i.button){let t=!0,e=this.options._leafletLayer._layerEl.nextElementSibling;for(;e&&t;)e.tagName&&"LAYER-"===e.tagName.toUpperCase()&&(t=!(e.checked&&e._layer.queryable)),e=e.nextElementSibling;t&&s&&(L.DomEvent.stop(i),Math.sqrt(Math.pow(s.x-i.clientX,2)+Math.pow(s.y-i.clientY,2))<=5&&(n.visited=!0,o.setAttribute("stroke","#6c00a2"),o.classList.add("map-a-visited"),M.handleLink(n,a)))}},this),L.DomEvent.on(o,"keypress",t=>{L.DomEvent.stop(t),13!==t.keyCode&&32!==t.keyCode||(n.visited=!0,o.setAttribute("stroke","#6c00a2"),o.classList.add("map-a-visited"),M.handleLink(n,a))},this),L.DomEvent.on(o,"mouseenter keyup",t=>{if(t.target===t.currentTarget){l=!0;let t=document.createElement("a"),e=this._map.getContainer().clientWidth;for(t.href=n.url,r.innerHTML=t.href,this._map.getContainer().appendChild(i);r.clientWidth>e/2;)r.innerHTML=r.innerHTML.substring(0,r.innerHTML.length-5)+"...";setTimeout(()=>{l&&(r.innerHTML=t.href)},1e3)}},this),L.DomEvent.on(o,"mouseout keydown mousedown",t=>{t.target===t.currentTarget&&i.parentElement&&(l=!1,this._map.getContainer().removeChild(i))},this),L.DomEvent.on(a._map.getContainer(),"mouseout mouseenter click",t=>{i.parentElement&&(l=!1,this._map.getContainer().removeChild(i))},this)},_project:function(t,e=void 0,i=void 0){let o=t||this._map,n=e||o.getPixelOrigin(),a=void 0===i?o.getZoom():i;for(var s of this._parts){s.pixelRings=this._convertRing(s.rings,o,n,a);for(var r of s.subrings)r.pixelSubrings=this._convertRing([r],o,n,a)}if(this._outline){this.pixelOutline=[];for(var l of this._outline)this.pixelOutline=this.pixelOutline.concat(this._convertRing(l,o,n,a))}},_convertRing:function(t,e,i,o){let n=e.options.crs.scale(o),a=[];for(var s of t){let t=[];for(var r of s.points){r=e.options.crs.transformation.transform(r,n);t.push(L.point(r.x,r.y)._subtract(i).round())}a.push(t)}return a},_update:function(){this._map&&this._renderer._updateFeature(this)},_convertWrappers:function(i){if(i&&0!==i.length){let t="",e={};for(var o of i)if("MAP-A"!==o.tagName.toUpperCase()&&o.className)t+=o.className+" ";else if(!e.link&&o.getAttribute("href")){let t={};t.url=o.getAttribute("href"),o.hasAttribute("target")&&(t.target=o.getAttribute("target")),o.hasAttribute("type")&&(t.type=o.getAttribute("type")),o.hasAttribute("inplace")&&(t.inPlace=!0),e.link=t}return e.className=(t+" "+this.options.className).trim(),e}},_convertMarkup:function(){if(this._markup){var o,e=this._markup.attributes;this.featureAttributes={},this.options.link&&"MAP-A"===this._markup.parentElement.tagName.toUpperCase()&&"MAP-GEOMETRY"!==this._markup.parentElement.parentElement.tagName.toUpperCase()&&(this.featureAttributes.tabindex="0");for(let t=0;t<e.length;t++)this.featureAttributes[e[t].name]=e[t].value;let i=!0;for(o of this._markup.querySelectorAll("map-coordinates")){let t=[],e=[];if(this._coordinateToArrays(o,t,e,this.options.className),i||"MAP-POLYGON"!==this.type)if("MAP-MULTIPOINT"===this.type)for(var n of t[0].points.concat(e))this._parts.push({rings:[{points:[n]}],subrings:[],cls:(`${n.cls||""} `+(this.options.className||"")).trim()});else this._parts.push({rings:t,subrings:e,cls:(`${this.featureAttributes.class||""} `+(this.options.className||"")).trim()});else this._parts[0].rings.push(t[0]),0<e.length&&(this._parts[0].subrings=this._parts[0].subrings.concat(e));i=!1}}},_generateOutlinePoints:function(){if("MAP-MULTIPOINT"!==this.type&&"MAP-POINT"!==this.type&&"MAP-LINESTRING"!==this.type&&"MAP-MULTILINESTRING"!==this.type){this._outline=[];for(var t of this._markup.querySelectorAll("map-coordinates")){let i=t.childNodes,o=0,n=document.createElement("div");i.length;for(let t=0;t<i.length;t++)0===i[t].textContent.trim().length&&i[t].remove();for(var a of i){var s,r=[];if(!a.tagName){let t="",e=((o-1)%i.length+i.length)%i.length;i[e].tagName&&(s=i[e].textContent.trim().split(/\s+/),t+=`${s[s.length-2]} ${s[s.length-1]} `),t+=a.textContent,e=((o+1)%i.length+i.length)%i.length,i[e].tagName&&(a=i[e].textContent.trim().split(/\s+/),t+=`${a[0]} ${a[1]} `),n.innerHTML=t,this._coordinateToArrays(n,r,[],!0,this.featureAttributes.class||this.options.className),this._outline.push(r)}o++}}}},_coordinateToArrays:function(o,t,n,e=!0,a=void 0,s=[]){for(var i of o.children)this._coordinateToArrays(i,t,n,!1,i.getAttribute("class"),s.concat([i]));let r=o.textContent.replace(/(<([^>]+)>)/gi,""),l=r.match(/(\S+\s+\S+)/gim),u=[],m;for(var p of l){var c=[];p.split(/\s+/gim).forEach(M.parseNumber,c);c=M.pointToPCRSPoint(L.point(c),this.options.zoom,this.options.projection,this.options.nativeCS);u.push(c),m=m?m.extend(c):L.bounds(c,c)}if(this._bounds?(this._bounds.extend(m.min),this._bounds.extend(m.max)):this._bounds=m,e)t.push({points:u});else{let e={},i=o.attributes,t=this._convertWrappers(s);t.link&&(e.tabindex="0");for(let t=0;t<i.length;t++)"class"!==i[t].name&&(e[i[t].name]=i[t].value);n.unshift({points:u,center:m.getCenter(),cls:(`${a||""} `+(t.className||"")).trim(),attr:e,link:t.link,linkTarget:t.linkTarget,linkType:t.linkType})}},_isClosed:function(){switch(this.type){case"MAP-POLYGON":case"MAP-MULTIPOLYGON":case"MAP-POINT":case"MAP-MULTIPOINT":return!0;default:return!1}},getCenter:function(){return this._bounds?this._map.options.crs.unproject(this._bounds.getCenter()):null},getPCRSCenter:function(){return this._bounds.getCenter()}}),mt=L.SVG.extend({_initContainer:function(){L.SVG.prototype._initContainer.call(this),this._container.setAttribute("role","none presentation")},_initPath:function(e,t=!0){if(e._outline){let t=L.SVG.create("path");e.options.className&&L.DomUtil.addClass(t,e.featureAttributes.class||e.options.className),L.DomUtil.addClass(t,"mapml-feature-outline"),t.style.fill="none",e.outlinePath=t}for(var i of e._parts){if(i.rings&&(this._createPath(i,e.options.className,e.featureAttributes["aria-label"],e.options.interactive,e.featureAttributes),e.outlinePath&&(i.path.style.stroke="none")),i.subrings)for(var o of i.subrings)this._createPath(o,e.options.className,o.attr["aria-label"],void 0!==o.link,o.attr);this._updateStyle(e)}t&&(t=L.stamp(e),this._layers[t]=e)},_createPath:function(t,e,i,o=!1,n=void 0){let a=L.SVG.create("path");if(t.path=a,n)for(var[s,r]of Object.entries(n))"id"!==s&&"tabindex"!==s&&a.setAttribute(s,r);else i&&a.setAttribute("aria-label",i);(t.cls||e)&&L.DomUtil.addClass(a,t.cls||e),o&&L.DomUtil.addClass(a,"leaflet-interactive")},_addPath:function(t,e=void 0,i=!0){this._rootGroup||e||this._initContainer();let o=e||this._rootGroup,n=!1;i&&t.addInteractiveTarget(t.group);for(var a of t._parts){a.path&&t.group.appendChild(a.path),i&&(t.options.link&&t.attachLinkHandler(a.path,t.options.link,t.options._leafletLayer),t.addInteractiveTarget(a.path)),!n&&t.pixelOutline&&(t.group.appendChild(t.outlinePath),n=!0);for(var s of a.subrings)s.path&&(s.link&&(t.attachLinkHandler(s.path,s.link,t.options._leafletLayer),t.addInteractiveTarget(s.path)),t.group.appendChild(s.path))}o.appendChild(t.group)},_removePath:function(t){for(var e of t._parts){e.path&&(t.removeInteractiveTarget(e.path),L.DomUtil.remove(e.path));for(var i of e.subrings)i.path&&L.DomUtil.remove(i.path)}t.outlinePath&&L.DomUtil.remove(t.outlinePath),t.removeInteractiveTarget(t.group),L.DomUtil.remove(t.group),delete this._layers[L.stamp(t)]},_updateFeature:function(t){t.pixelOutline&&this._setPath(t.outlinePath,this.geometryToPath(t.pixelOutline,!1));for(var e of t._parts){this._setPath(e.path,this.geometryToPath(e.pixelRings,t.isClosed));for(var i of e.subrings)this._setPath(i.path,this.geometryToPath(i.pixelSubrings,!1))}},_pointToMarker:function(t){return`M${t.x} ${t.y} L${t.x-12.5} ${t.y-30} C${t.x-12.5} ${t.y-50}, ${t.x+12.5} ${t.y-50}, ${t.x+12.5} ${t.y-30} L${t.x} ${t.y}z`},_updateStyle:function(t){this._updatePathStyle(t.outlinePath,t,!1,!0);for(var e of t._parts){e.path&&this._updatePathStyle(e.path,t,!0);for(var i of e.subrings)i.path&&this._updatePathStyle(i.path,t)}},_updatePathStyle:function(t,e,i=!1,o=!1){var n,a;t&&e&&(n=e.options,a=e.isClosed,n.stroke&&(!a||o)||i&&!e.outlinePath?(t.setAttribute("stroke",n.color),t.setAttribute("stroke-opacity",n.opacity),t.setAttribute("stroke-width",n.weight),t.setAttribute("stroke-linecap",n.lineCap),t.setAttribute("stroke-linejoin",n.lineJoin),n.dashArray?t.setAttribute("stroke-dasharray",n.dashArray):t.removeAttribute("stroke-dasharray"),n.dashOffset?t.setAttribute("stroke-dashoffset",n.dashOffset):t.removeAttribute("stroke-dashoffset"),n.link&&(t.setAttribute("stroke",n.link.visited?"#6c00a2":"#0000EE"),t.setAttribute("stroke-opacity","1"),t.setAttribute("stroke-width","1px"),t.setAttribute("stroke-dasharray","none"))):t.setAttribute("stroke","none"),a&&!o?n.fill?t.setAttribute("fill",n.color):(t.setAttribute("fill",n.fillColor||n.color),t.setAttribute("fill-opacity",n.fillOpacity),t.setAttribute("fill-rule",n.fillRule||"evenodd")):t.setAttribute("fill","none"))},_setPath:function(t,e){t.setAttribute("d",e)},geometryToPath:function(t,e){let i="",o,n,a,s,r,l;for(o=0,a=t.length;o<a;o++){if(1===(r=t[o]).length)return this._pointToMarker(r[0]);for(n=0,s=r.length;n<s;n++)l=r[n],i+=(n?"L":"M")+l.x+" "+l.y;i+=e?"z":""}return i||"M0 0"}}),pt=L.FeatureGroup.extend({initialize:function(t,e){e.wrappers&&0<e.wrappers.length&&(e=Object.assign(M.Feature.prototype._convertWrappers(e.wrappers),e)),L.LayerGroup.prototype.initialize.call(this,t,e),(this.options.onEachFeature&&this.options.properties||this.options.link)&&(L.DomUtil.addClass(this.options.group,"leaflet-interactive"),L.DomEvent.on(this.options.group,"keyup keydown mousedown",this._handleFocus,this),e=t[Object.keys(t)[0]],1===t.length&&e.options.link&&(this.options.link=e.options.link),this.options.link?(M.Feature.prototype.attachLinkHandler.call(this,this.options.group,this.options.link,this.options._leafletLayer),this.options.group.setAttribute("role","link")):(this.options.group.setAttribute("aria-expanded","false"),this.options.group.setAttribute("role","button"),this.options.onEachFeature(this.options.properties,this),this.off("click",this._openPopup))),this.options.group.setAttribute("aria-label",this.options.accessibleTitle),this.options.featureID&&this.options.group.setAttribute("data-fid",this.options.featureID)},onAdd:function(t){L.LayerGroup.prototype.onAdd.call(this,t),this.updateInteraction()},updateInteraction:function(){let e=this._map||this.options._leafletLayer._map;for(var i in(this.options.onEachFeature&&this.options.properties||this.options.link)&&e.featureIndex.addToIndex(this,this.getPCRSCenter(),this.options.group),this._layers){let t=this._layers[i];for(var o of t._parts){t.featureAttributes&&t.featureAttributes.tabindex&&e.featureIndex.addToIndex(t,t.getPCRSCenter(),o.path);for(var n of o.subrings)n.attr&&n.attr.tabindex&&e.featureIndex.addToIndex(t,n.center,n.path)}}},_handleFocus:function(t){var e;9!==t.keyCode&&16!==t.keyCode||"keydown"!==t.type?[9,16,13,27].includes(t.keyCode)||(this._map.featureIndex.currentIndex=0,this._map.featureIndex.inBoundFeatures[0].path.focus()):(e=this._map.featureIndex.currentIndex,9===t.keyCode&&t.shiftKey?(e===this._map.featureIndex.inBoundFeatures.length-1&&this._map.featureIndex.inBoundFeatures[e].path.setAttribute("tabindex",-1),0!==e&&(L.DomEvent.stop(t),this._map.featureIndex.inBoundFeatures[e-1].path.focus(),this._map.featureIndex.currentIndex--)):9===t.keyCode&&(e!==this._map.featureIndex.inBoundFeatures.length-1?(L.DomEvent.stop(t),this._map.featureIndex.inBoundFeatures[e+1].path.focus(),this._map.featureIndex.currentIndex++):(this._map.featureIndex.inBoundFeatures[0].path.setAttribute("tabindex",-1),this._map.featureIndex.inBoundFeatures[e].path.setAttribute("tabindex",0)))),"G"===t.target.tagName.toUpperCase()&&(9!==t.keyCode&&16!==t.keyCode&&13!==t.keyCode||"keyup"!==t.type?13===t.keyCode||32===t.keyCode?(this.closeTooltip(),!this.options.link&&this.options.onEachFeature&&(L.DomEvent.stop(t),this.openPopup())):this.closeTooltip():this.openTooltip())},addLayer:function(t){!t.options.link&&t.options.interactive&&this.options.onEachFeature(this.options.properties,t),L.FeatureGroup.prototype.addLayer.call(this,t)},_previousFeature:function(t){L.DomEvent.stop(t),this._map.featureIndex.currentIndex=Math.max(this._map.featureIndex.currentIndex-1,0);let e=this._map.featureIndex.inBoundFeatures[this._map.featureIndex.currentIndex];e.path.focus(),this._map.closePopup()},_nextFeature:function(t){L.DomEvent.stop(t),this._map.featureIndex.currentIndex=Math.min(this._map.featureIndex.currentIndex+1,this._map.featureIndex.inBoundFeatures.length-1);let e=this._map.featureIndex.inBoundFeatures[this._map.featureIndex.currentIndex];e.path.focus(),this._map.closePopup()},getPCRSCenter:function(){let e;for(var i in this._layers){let t=this._layers[i];e?e.extend(t.getPCRSCenter()):e=L.bounds(t.getPCRSCenter(),t.getPCRSCenter())}return e.getCenter()}}),ct=L.Handler.extend({addHooks:function(){this._map.on({layeradd:this.totalBounds,layerremove:this.totalBounds}),this._map.options.mapEl.addEventListener("moveend",this.announceBounds),this._map.dragging._draggable.addEventListener("dragstart",this.dragged),this._map.options.mapEl.addEventListener("mapfocused",this.focusAnnouncement)},removeHooks:function(){this._map.off({layeradd:this.totalBounds,layerremove:this.totalBounds}),this._map.options.mapEl.removeEventListener("moveend",this.announceBounds),this._map.dragging._draggable.removeEventListener("dragstart",this.dragged),this._map.options.mapEl.removeEventListener("mapfocused",this.focusAnnouncement)},focusAnnouncement:function(){let n=this;setTimeout(function(){let t=(n.querySelector(".mapml-web-map")?n.querySelector(".mapml-web-map"):n).shadowRoot.querySelector(".leaflet-container");var e=n._map.getZoom(),i=M.gcrsToTileMatrix(n);let o=M.options.locale.amZoom+" "+e+" "+M.options.locale.amColumn+" "+i[0]+" "+M.options.locale.amRow+" "+i[1];e===n._map._layersMaxZoom?o=M.options.locale.amMaxZoom+" "+o:e===n._map._layersMinZoom&&(o=M.options.locale.amMinZoom+" "+o),t.setAttribute("aria-roledescription","region "+o),setTimeout(function(){t.removeAttribute("aria-roledescription")},2e3)},0)},announceBounds:function(){if(!(0<this._traversalCall)){var i=this._map.getZoom(),o=M.pixelToPCRSBounds(this._map.getPixelBounds(),i,this._map.options.projection);let t=!0;this._map.totalLayerBounds&&(t=i<=this._map._layersMaxZoom&&i>=this._map._layersMinZoom&&this._map.totalLayerBounds.overlaps(o));let e=(this.querySelector(".mapml-web-map")?this.querySelector(".mapml-web-map"):this).shadowRoot.querySelector(".mapml-screen-reader-output");var n,o=M.gcrsToTileMatrix(this),o=M.options.locale.amZoom+" "+i+" "+M.options.locale.amColumn+" "+o[0]+" "+M.options.locale.amRow+" "+o[1];t?(n=(this._history[this._historyIndex-1]?this._history[this._historyIndex-1]:this._history[this._historyIndex]).zoom,i===this._map._layersMaxZoom&&i!==n?e.innerText=M.options.locale.amMaxZoom+" "+o:i===this._map._layersMinZoom&&i!==n?e.innerText=M.options.locale.amMinZoom+" "+o:e.innerText=o):(n=this._history[this._historyIndex],o=this._history[this._historyIndex-1],this.back(),this._history.pop(),n.zoom!==o.zoom?e.innerText=M.options.locale.amZoomedOut:this._map.dragging._draggable.wasDragged?e.innerText=M.options.locale.amDraggedOut:n.x>o.x?e.innerText=M.options.locale.amEastBound:n.x<o.x?e.innerText=M.options.locale.amWestBound:n.y<o.y?e.innerText=M.options.locale.amNorthBound:n.y>o.y&&(e.innerText=M.options.locale.amSouthBound)),this._map.dragging._draggable.wasDragged=!1}},totalBounds:function(){let t=Object.keys(this._layers),i=L.bounds();t.forEach(t=>{var e;this._layers[t].layerBounds&&(i||(e=this._layers[t].layerBounds.getCenter(),i=L.bounds(e,e)),i.extend(this._layers[t].layerBounds.min),i.extend(this._layers[t].layerBounds.max))}),this.totalLayerBounds=i},dragged:function(){this.wasDragged=!0}}),ht=L.Handler.extend({initialize:function(t){L.Handler.prototype.initialize.call(this,t),this.inBoundFeatures=[],this.outBoundFeatures=[],this.currentIndex=0,this._mapPCRSBounds=M.pixelToPCRSBounds(t.getPixelBounds(),t.getZoom(),t.options.projection)},addHooks:function(){this._map.on("mapkeyboardfocused",this._updateMapBounds,this),this._map.on("mapkeyboardfocused",this._sortIndex,this)},removeHooks:function(){this._map.off("mapkeyboardfocused",this._updateMapBounds),this._map.off("mapkeyboardfocused",this._sortIndex)},addToIndex:function(t,e,i){var o=this._mapPCRSBounds.getCenter(),o=Math.sqrt(Math.pow(e.x-o.x,2)+Math.pow(e.y-o.y,2));let n=this._mapPCRSBounds.contains(e)?this.inBoundFeatures:this.outBoundFeatures;o={path:i,layer:t,center:e,dist:o};i.setAttribute("tabindex",-1),n.push(o);for(let t=n.length-1;0<t&&n[t].dist<n[t-1].dist;t--){var a=n[t];n[t]=n[t-1],n[t-1]=a}this._mapPCRSBounds.contains(e)?this.inBoundFeatures=n:this.outBoundFeatures=n},cleanIndex:function(){this.currentIndex=0,this.inBoundFeatures=this.inBoundFeatures.filter(t=>{var e=this._mapPCRSBounds.contains(t.center);return t.path.setAttribute("tabindex",-1),t.layer._map&&!e&&this.outBoundFeatures.push(t),t.layer._map&&e}),this.outBoundFeatures=this.outBoundFeatures.filter(t=>{var e=this._mapPCRSBounds.contains(t.center);return t.path.setAttribute("tabindex",-1),t.layer._map&&e&&this.inBoundFeatures.push(t),t.layer._map&&!e})},_sortIndex:function(){if(this.cleanIndex(),0!==this.inBoundFeatures.length){let n=this._mapPCRSBounds.getCenter();this.inBoundFeatures.sort(function(t,e){var i=t.center,o=e.center;return t.dist=Math.sqrt(Math.pow(i.x-n.x,2)+Math.pow(i.y-n.y,2)),e.dist=Math.sqrt(Math.pow(o.x-n.x,2)+Math.pow(o.y-n.y,2)),t.dist-e.dist}),this.inBoundFeatures[0].path.setAttribute("tabindex",0)}},_updateMapBounds:function(t){this._mapPCRSBounds=M.pixelToPCRSBounds(this._map.getPixelBounds(),this._map.getZoom(),this._map.options.projection)}}),dt={announceMovement:!1,locale:{cmBack:"Back",cmForward:"Forward",cmReload:"Reload",cmToggleControls:"Toggle Controls",cmCopyCoords:"Copy Coordinates",cmToggleDebug:"Toggle Debug Mode",cmCopyMapML:"Copy MapML",cmViewSource:"View Map Source",cmCopyAll:"All",lmZoomToLayer:"Zoom To Layer",lmCopyExtent:"Copy Extent",lcOpacity:"Opacity",btnZoomIn:"Zoom in",btnZoomOut:"Zoom out",btnFullScreen:"View fullscreen",amZoom:"zoom level",amColumn:"column",amRow:"row",amMaxZoom:"At maximum zoom level, zoom in disabled",amMinZoom:"At minimum zoom level, zoom out disabled",amZoomedOut:"Zoomed out of bounds, returning to",amDraggedOut:"Dragged out of bounds, returning to",amEastBound:"Reached east bound, panning east disabled",amWestBound:"Reached west bound, panning west disabled",amNorthBound:"Reached north bound, panning north disabled",amSouthBound:"Reached south bound, panning south disabled"}};L.Map.Keyboard.include({_onKeyDown:function(t){if(!t.altKey&&!t.metaKey){var e,i=t.keyCode,o=this._map;if(i in this._panKeys)o._panAnim&&o._panAnim._inProgress||(e=this._panKeys[i],t.shiftKey&&(e=L.point(e).multiplyBy(3)),t.ctrlKey&&(e=L.point(e).divideBy(5)),o.panBy(e),o.options.maxBounds&&o.panInsideBounds(o.options.maxBounds));else if(i in this._zoomKeys)(i in{187:187,107:107,61:61,171:171}&&o._layersMaxZoom!==o.getZoom()||i in{189:189,109:109,54:54,173:173}&&o._layersMinZoom!==o.getZoom())&&o.setZoom(o.getZoom()+(t.shiftKey?3:1)*this._zoomKeys[i]);else{if(27!==i||!o._popup||!o._popup.options.closeOnEscapeKey)return;o.closePopup()}L.DomEvent.stop(t)}}}),st=window,rt={},st.M=rt,function(){rt.detectImagePath=function(t){var e=L.DomUtil.create("div","leaflet-default-icon-path",t),i=L.DomUtil.getStyle(e,"background-image")||L.DomUtil.getStyle(e,"backgroundImage");return t.removeChild(e),i=null===i||0!==i.indexOf("url")?"":i.replace(/^url\(["']?/,"").replace(/marker-icon\.png["']?\)$/,"")},rt.mime="text/mapml";var t=st.document.head.querySelector("map-options");rt.options=dt,t&&(rt.options=Object.assign(rt.options,JSON.parse(t.innerHTML))),rt.WGS84=new L.Proj.CRS("EPSG:4326","+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs ",{origin:[-180,90],bounds:L.bounds([[-180,-90],[180,90]]),resolutions:[.703125,.3515625,.17578125,.087890625,.0439453125,.02197265625,.010986328125,.0054931640625,.00274658203125,.001373291015625,.0006866455078125,.0003433227539062,.0001716613769531,858306884766e-16,429153442383e-16,214576721191e-16,107288360596e-16,53644180298e-16,26822090149e-16,13411045074e-16,6.705522537e-7,3.352761269e-7],crs:{tcrs:{horizontal:{name:"x",min:0,max:t=>(rt.WGS84.options.bounds.getSize().x/rt.WGS84.options.resolutions[t]).toFixed()},vertical:{name:"y",min:0,max:t=>(rt.WGS84.options.bounds.getSize().y/rt.WGS84.options.resolutions[t]).toFixed()},bounds:t=>L.bounds([rt.WGS84.options.crs.tcrs.horizontal.min,rt.WGS84.options.crs.tcrs.vertical.min],[rt.WGS84.options.crs.tcrs.horizontal.max(t),rt.WGS84.options.crs.tcrs.vertical.max(t)])},pcrs:{horizontal:{name:"longitude",get min(){return rt.WGS84.options.crs.gcrs.horizontal.min},get max(){return rt.WGS84.options.crs.gcrs.horizontal.max}},vertical:{name:"latitude",get min(){return rt.WGS84.options.crs.gcrs.vertical.min},get max(){return rt.WGS84.options.crs.gcrs.vertical.max}},get bounds(){return rt.WGS84.options.bounds}},gcrs:{horizontal:{name:"longitude",min:-180,max:180},vertical:{name:"latitude",min:-90,max:90},get bounds(){return L.latLngBounds([rt.WGS84.options.crs.gcrs.vertical.min,rt.WGS84.options.crs.gcrs.horizontal.min],[rt.WGS84.options.crs.gcrs.vertical.max,rt.WGS84.options.crs.gcrs.horizontal.max])}},map:{horizontal:{name:"i",min:0,max:t=>t.getSize().x},vertical:{name:"j",min:0,max:t=>t.getSize().y},bounds:t=>L.bounds(L.point([0,0]),t.getSize())},tile:{horizontal:{name:"i",min:0,max:256},vertical:{name:"j",min:0,max:256},get bounds(){return L.bounds([rt.WGS84.options.crs.tile.horizontal.min,rt.WGS84.options.crs.tile.vertical.min],[rt.WGS84.options.crs.tile.horizontal.max,rt.WGS84.options.crs.tile.vertical.max])}},tilematrix:{horizontal:{name:"column",min:0,max:t=>(rt.WGS84.options.crs.tcrs.horizontal.max(t)/rt.WGS84.options.crs.tile.bounds.getSize().x).toFixed()},vertical:{name:"row",min:0,max:t=>(rt.WGS84.options.crs.tcrs.vertical.max(t)/rt.WGS84.options.crs.tile.bounds.getSize().y).toFixed()},bounds:t=>L.bounds([rt.WGS84.options.crs.tilematrix.horizontal.min,rt.WGS84.options.crs.tilematrix.vertical.min],[rt.WGS84.options.crs.tilematrix.horizontal.max(t),rt.WGS84.options.crs.tilematrix.vertical.max(t)])}}}),rt.CBMTILE=new L.Proj.CRS("EPSG:3978","+proj=lcc +lat_1=49 +lat_2=77 +lat_0=49 +lon_0=-95 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs",{origin:[-34655800,3931e4],bounds:L.bounds([[-34655800,-39e6],[1e7,3931e4]]),resolutions:[38364.660062653464,22489.62831258996,13229.193125052918,7937.5158750317505,4630.2175937685215,2645.8386250105837,1587.5031750063501,926.0435187537042,529.1677250021168,317.50063500127004,185.20870375074085,111.12522225044451,66.1459656252646,38.36466006265346,22.48962831258996,13.229193125052918,7.9375158750317505,4.6302175937685215,2.6458386250105836,1.5875031750063502,.9260435187537043,.5291677250021167,.31750063500127,.18520870375074083,.11112522225044451,.06614596562526459],crs:{tcrs:{horizontal:{name:"x",min:0,max:t=>(rt.CBMTILE.options.bounds.getSize().x/rt.CBMTILE.options.resolutions[t]).toFixed()},vertical:{name:"y",min:0,max:t=>(rt.CBMTILE.options.bounds.getSize().y/rt.CBMTILE.options.resolutions[t]).toFixed()},bounds:t=>L.bounds([rt.CBMTILE.options.crs.tcrs.horizontal.min,rt.CBMTILE.options.crs.tcrs.vertical.min],[rt.CBMTILE.options.crs.tcrs.horizontal.max(t),rt.CBMTILE.options.crs.tcrs.vertical.max(t)])},pcrs:{horizontal:{name:"easting",get min(){return rt.CBMTILE.options.bounds.min.x},get max(){return rt.CBMTILE.options.bounds.max.x}},vertical:{name:"northing",get min(){return rt.CBMTILE.options.bounds.min.y},get max(){return rt.CBMTILE.options.bounds.max.y}},get bounds(){return rt.CBMTILE.options.bounds}},gcrs:{horizontal:{name:"longitude",min:-141.01,max:-47.74},vertical:{name:"latitude",min:40.04,max:86.46},get bounds(){return L.latLngBounds([rt.CBMTILE.options.crs.gcrs.vertical.min,rt.CBMTILE.options.crs.gcrs.horizontal.min],[rt.CBMTILE.options.crs.gcrs.vertical.max,rt.CBMTILE.options.crs.gcrs.horizontal.max])}},map:{horizontal:{name:"i",min:0,max:t=>t.getSize().x},vertical:{name:"j",min:0,max:t=>t.getSize().y},bounds:t=>L.bounds(L.point([0,0]),t.getSize())},tile:{horizontal:{name:"i",min:0,max:256},vertical:{name:"j",min:0,max:256},get bounds(){return L.bounds([rt.CBMTILE.options.crs.tile.horizontal.min,rt.CBMTILE.options.crs.tile.vertical.min],[rt.CBMTILE.options.crs.tile.horizontal.max,rt.CBMTILE.options.crs.tile.vertical.max])}},tilematrix:{horizontal:{name:"column",min:0,max:t=>(rt.CBMTILE.options.crs.tcrs.horizontal.max(t)/rt.CBMTILE.options.crs.tile.bounds.getSize().x).toFixed()},vertical:{name:"row",min:0,max:t=>(rt.CBMTILE.options.crs.tcrs.vertical.max(t)/rt.CBMTILE.options.crs.tile.bounds.getSize().y).toFixed()},bounds:t=>L.bounds([0,0],[rt.CBMTILE.options.crs.tilematrix.horizontal.max(t),rt.CBMTILE.options.crs.tilematrix.vertical.max(t)])}}}),rt.APSTILE=new L.Proj.CRS("EPSG:5936","+proj=stere +lat_0=90 +lat_ts=50 +lon_0=-150 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m +no_defs",{origin:[-28567784.109255,32567784.109255],bounds:L.bounds([[-28567784.109254867,-28567784.109254755],[32567784.109255023,32567784.10925506]]),resolutions:[238810.813354,119405.406677,59702.7033384999,29851.3516692501,14925.675834625,7462.83791731252,3731.41895865639,1865.70947932806,932.854739664032,466.427369832148,233.213684916074,116.606842458037,58.3034212288862,29.1517106145754,14.5758553072877,7.28792765351156,3.64396382688807,1.82198191331174,.910990956788164,.45549547826179],crs:{tcrs:{horizontal:{name:"x",min:0,max:t=>(rt.APSTILE.options.bounds.getSize().x/rt.APSTILE.options.resolutions[t]).toFixed()},vertical:{name:"y",min:0,max:t=>(rt.APSTILE.options.bounds.getSize().y/rt.APSTILE.options.resolutions[t]).toFixed()},bounds:t=>L.bounds([rt.APSTILE.options.crs.tcrs.horizontal.min,rt.APSTILE.options.crs.tcrs.vertical.min],[rt.APSTILE.options.crs.tcrs.horizontal.max(t),rt.APSTILE.options.crs.tcrs.vertical.max(t)])},pcrs:{horizontal:{name:"easting",get min(){return rt.APSTILE.options.bounds.min.x},get max(){return rt.APSTILE.options.bounds.max.x}},vertical:{name:"northing",get min(){return rt.APSTILE.options.bounds.min.y},get max(){return rt.APSTILE.options.bounds.max.y}},get bounds(){return rt.APSTILE.options.bounds}},gcrs:{horizontal:{name:"longitude",min:-180,max:180},vertical:{name:"latitude",min:60,max:90},get bounds(){return L.latLngBounds([rt.APSTILE.options.crs.gcrs.vertical.min,rt.APSTILE.options.crs.gcrs.horizontal.min],[rt.APSTILE.options.crs.gcrs.vertical.max,rt.APSTILE.options.crs.gcrs.horizontal.max])}},map:{horizontal:{name:"i",min:0,max:t=>t.getSize().x},vertical:{name:"j",min:0,max:t=>t.getSize().y},bounds:t=>L.bounds(L.point([0,0]),t.getSize())},tile:{horizontal:{name:"i",min:0,max:256},vertical:{name:"j",min:0,max:256},get bounds(){return L.bounds([rt.APSTILE.options.crs.tile.horizontal.min,rt.APSTILE.options.crs.tile.vertical.min],[rt.APSTILE.options.crs.tile.horizontal.max,rt.APSTILE.options.crs.tile.vertical.max])}},tilematrix:{horizontal:{name:"column",min:0,max:t=>(rt.APSTILE.options.crs.tcrs.horizontal.max(t)/rt.APSTILE.options.crs.tile.bounds.getSize().x).toFixed()},vertical:{name:"row",min:0,max:t=>(rt.APSTILE.options.crs.tcrs.vertical.max(t)/rt.APSTILE.options.crs.tile.bounds.getSize().y).toFixed()},bounds:t=>L.bounds([0,0],[rt.APSTILE.options.crs.tilematrix.horizontal.max(t),rt.APSTILE.options.crs.tilematrix.vertical.max(t)])}}}),rt.OSMTILE=L.CRS.EPSG3857,L.setOptions(rt.OSMTILE,{origin:[-20037508.342787,20037508.342787],bounds:L.bounds([[-20037508.342787,-20037508.342787],[20037508.342787,20037508.342787]]),resolutions:[156543.0339,78271.51695,39135.758475,19567.8792375,9783.93961875,4891.969809375,2445.9849046875,1222.9924523438,611.49622617188,305.74811308594,152.87405654297,76.437028271484,38.218514135742,19.109257067871,9.5546285339355,4.7773142669678,2.3886571334839,1.1943285667419,.59716428337097,.29858214168549,.14929107084274,.074645535421371,.03732276771068573,.018661383855342866,.009330691927671433],crs:{tcrs:{horizontal:{name:"x",min:0,max:t=>(rt.OSMTILE.options.bounds.getSize().x/rt.OSMTILE.options.resolutions[t]).toFixed()},vertical:{name:"y",min:0,max:t=>(rt.OSMTILE.options.bounds.getSize().y/rt.OSMTILE.options.resolutions[t]).toFixed()},bounds:t=>L.bounds([rt.OSMTILE.options.crs.tcrs.horizontal.min,rt.OSMTILE.options.crs.tcrs.vertical.min],[rt.OSMTILE.options.crs.tcrs.horizontal.max(t),rt.OSMTILE.options.crs.tcrs.vertical.max(t)])},pcrs:{horizontal:{name:"easting",get min(){return rt.OSMTILE.options.bounds.min.x},get max(){return rt.OSMTILE.options.bounds.max.x}},vertical:{name:"northing",get min(){return rt.OSMTILE.options.bounds.min.y},get max(){return rt.OSMTILE.options.bounds.max.y}},get bounds(){return rt.OSMTILE.options.bounds}},gcrs:{horizontal:{name:"longitude",get min(){return rt.OSMTILE.unproject(rt.OSMTILE.options.bounds.min).lng},get max(){return rt.OSMTILE.unproject(rt.OSMTILE.options.bounds.max).lng}},vertical:{name:"latitude",get min(){return rt.OSMTILE.unproject(rt.OSMTILE.options.bounds.min).lat},get max(){return rt.OSMTILE.unproject(rt.OSMTILE.options.bounds.max).lat}},get bounds(){return L.latLngBounds([rt.OSMTILE.options.crs.gcrs.vertical.min,rt.OSMTILE.options.crs.gcrs.horizontal.min],[rt.OSMTILE.options.crs.gcrs.vertical.max,rt.OSMTILE.options.crs.gcrs.horizontal.max])}},map:{horizontal:{name:"i",min:0,max:t=>t.getSize().x},vertical:{name:"j",min:0,max:t=>t.getSize().y},bounds:t=>L.bounds(L.point([0,0]),t.getSize())},tile:{horizontal:{name:"i",min:0,max:256},vertical:{name:"j",min:0,max:256},get bounds(){return L.bounds([rt.OSMTILE.options.crs.tile.horizontal.min,rt.OSMTILE.options.crs.tile.vertical.min],[rt.OSMTILE.options.crs.tile.horizontal.max,rt.OSMTILE.options.crs.tile.vertical.max])}},tilematrix:{horizontal:{name:"column",min:0,max:t=>(rt.OSMTILE.options.crs.tcrs.horizontal.max(t)/rt.OSMTILE.options.crs.tile.bounds.getSize().x).toFixed()},vertical:{name:"row",min:0,max:t=>(rt.OSMTILE.options.crs.tcrs.vertical.max(t)/rt.OSMTILE.options.crs.tile.bounds.getSize().y).toFixed()},bounds:t=>L.bounds([0,0],[rt.OSMTILE.options.crs.tilematrix.horizontal.max(t),rt.OSMTILE.options.crs.tilematrix.vertical.max(t)])}}})}(),rt.handleLink=Q,rt.convertPCRSBounds=R,rt.axisToXY=N,rt.csToAxes=D,rt.convertAndFormatPCRS=B,rt.axisToCS=q,rt.parseNumber=Y,rt.extractInputBounds=F,rt.splitCoordinate=K,rt.boundsToPCRSBounds=j,rt.pixelToPCRSBounds=Z,rt.metaContentToObject=G,rt.coordsToArray=W,rt.parseStylesheetAsHTML=$,rt.pointToPCRSPoint=O,rt.pixelToPCRSPoint=U,rt.gcrsToTileMatrix=X,rt.QueryHandler=P,rt.ContextMenu=w,rt.AnnounceMovement=ct,rt.FeatureIndex=ht,L.Map.addInitHook("addHandler","query",rt.QueryHandler),L.Map.addInitHook("addHandler","contextMenu",rt.ContextMenu),L.Map.addInitHook("addHandler","announceMovement",rt.AnnounceMovement),L.Map.addInitHook("addHandler","featureIndex",rt.FeatureIndex),rt.MapMLLayer=b,rt.mapMLLayer=m,rt.ImageOverlay=x,rt.imageOverlay=u,rt.TemplatedImageLayer=f,rt.templatedImageLayer=l,rt.TemplatedFeaturesLayer=g,rt.templatedFeaturesLayer=r,rt.TemplatedLayer=y,rt.templatedLayer=s,rt.TemplatedTileLayer=_,rt.templatedTileLayer=a,rt.MapMLFeatures=h,rt.mapMlFeatures=n,rt.MapMLLayerControl=o,rt.mapMlLayerControl=e,rt.ReloadButton=J,rt.reloadButton=c,rt.FullscreenButton=tt,rt.fullscreenButton=et,rt.MapMLStaticTileLayer=i,rt.mapMLStaticTileLayer=t,rt.DebugOverlay=v,rt.debugOverlay=p,rt.Crosshair=lt,rt.crosshair=it,rt.Feature=ut,rt.feature=ot,rt.FeatureRenderer=mt,rt.featureRenderer=nt,rt.FeatureGroup=pt,rt.featureGroup=at}();
\ No newline at end of file
+      `}}}),A=function(t){return new E(t)},C=L.GridLayer.extend({initialize:function(t){L.setOptions(this,t),L.GridLayer.prototype.initialize.call(this,this._map)},createTile:function(t){let e=L.DomUtil.create("div","mapml-debug-tile");return e.setAttribute("col",t.x),e.setAttribute("row",t.y),e.setAttribute("zoom",t.z),e.innerHTML=["col: "+t.x,"row: "+t.y,"zoom: "+t.z].join(", "),e.style.outline="1px dashed red",e}}),S=function(t){return new C(t)},T=L.LayerGroup.extend({initialize:function(t){L.setOptions(this,t),L.LayerGroup.prototype.initialize.call(this,this._map,t)},onAdd:function(t){t.on("overlayremove",this._mapLayerUpdate,this),t.on("overlayadd",this._mapLayerUpdate,this);var e=t.options.crs.transformation.transform(L.point(0,0),t.options.crs.scale(0));this._centerVector=L.circle(t.options.crs.pointToLatLng(e,0),{radius:250}),this._centerVector.bindTooltip("Projection Center"),this._addBounds(t)},onRemove:function(t){this.clearLayers()},_addBounds:function(t){let e=Object.keys(t._layers),i=t._layers,o=["#FF5733","#8DFF33","#3397FF","#E433FF","#F3FF33"],n=0;this.addLayer(this._centerVector);for(var a of e)if(i[a].layerBounds||i[a].extentBounds){let t;t=i[a].layerBounds?[i[a].layerBounds.min,L.point(i[a].layerBounds.max.x,i[a].layerBounds.min.y),i[a].layerBounds.max,L.point(i[a].layerBounds.min.x,i[a].layerBounds.max.y)]:[i[a].extentBounds.min,L.point(i[a].extentBounds.max.x,i[a].extentBounds.min.y),i[a].extentBounds.max,L.point(i[a].extentBounds.min.x,i[a].extentBounds.max.y)];let e=I(t,{color:o[n%o.length],weight:2,opacity:1,fillOpacity:.01,fill:!0});i[a].options._leafletLayer&&e.bindTooltip(i[a].options._leafletLayer._title,{sticky:!0}),this.addLayer(e),n++}t.totalLayerBounds&&(t=[t.totalLayerBounds.min,L.point(t.totalLayerBounds.max.x,t.totalLayerBounds.min.y),t.totalLayerBounds.max,L.point(t.totalLayerBounds.min.x,t.totalLayerBounds.max.y)],t=I(t,{color:"#808080",weight:5,opacity:.5,fill:!1}),this.addLayer(t))},_mapLayerUpdate:function(t){this.clearLayers(),this._addBounds(t.target)}}),z=function(t){return new T(t)},k=L.Path.extend({options:{className:"mapml-debug-extent"},initialize:function(t,e){this._locations=t,L.setOptions(this,e)},_project:function(){this._rings=[];let e=this._map.options.crs.scale(this._map.getZoom()),i=this._map;for(let t=0;t<this._locations.length;t++){var o=i.options.crs.transformation.transform(this._locations[t],e);this._rings.push(L.point(o.x,o.y)._subtract(i.getPixelOrigin()))}this._parts=[this._rings]},_update:function(){this._map&&this._renderer._updatePoly(this,!0)}}),I=function(t,e){return new k(t,e)},w=L.Handler.extend({addHooks:function(){L.setOptions(this,{mapEl:this._map.options.mapEl}),L.DomEvent.on(this._map,"click",this._queryTopLayer,this),L.DomEvent.on(this._map,"keypress",this._queryTopLayerAtMapCenter,this)},removeHooks:function(){L.DomEvent.off(this._map,"click",this._queryTopLayer,this),L.DomEvent.on(this._map,"keypress",this._queryTopLayerAtMapCenter,this)},_getTopQueryableLayer:function(){for(var t=this.options.mapEl.layers,e=t.length-1;0<=e;e--){var i=t[e]._layer;if(t[e].checked&&i.queryable)return i}},_queryTopLayerAtMapCenter:function(t){setTimeout(()=>{!this._map.isFocused||this._map._popupClosed||" "!==t.originalEvent.key&&13!=+t.originalEvent.keyCode?delete this._map._popupClosed:this._map.fire("click",{latlng:this._map.getCenter(),layerPoint:this._map.latLngToLayerPoint(this._map.getCenter()),containerPoint:this._map.latLngToContainerPoint(this._map.getCenter())})},0)},_queryTopLayer:function(t){var e=this._getTopQueryableLayer();e&&(e._mapmlFeatures&&delete e._mapmlFeatures,this._query(t,e))},_query(a,s){function e(t){return n.transformation.untransform(t,n.scale(o))}function i(t){return n.unproject(n.transformation.untransform(t,n.scale(o)),o)}var o=a.target.getZoom(),r=this._map,n=s._extent.crs,l=r.options.crs.options.crs.tile.bounds.max.x,m=s._container,u={autoClose:!1,autoPan:!0,maxHeight:.5*r.getSize().y-50},p=n.latLngToPoint(a.latlng,o),c=p.divideBy(l).floor(),h=new L.Bounds(p.divideBy(l).floor().multiplyBy(l),p.divideBy(l).ceil().multiplyBy(l));let t=this._map.project(a.latlng),d=this._map.options.crs.scale(this._map.getZoom()),_=this._map.options.crs.transformation.untransform(t,d),y;function x(t,e,n){fetch(L.Util.template(t.template,e),{redirect:"follow"}).then(t=>{if(y=t.headers.get("Content-Type"),200<=t.status&&t.status<300)return t.text();throw new Error(t.status)}).then(o=>{if(!y.startsWith("text/mapml"))return function(t,e,i){let o=L.DomUtil.create("div","mapml-popup-content"),n=L.DomUtil.create("iframe");n.style="border: none",n.srcdoc=t,n.setAttribute("sandbox","allow-same-origin allow-forms"),o.appendChild(n),e.bindPopup(o,u).openPopup(i)}(o,s,a.latlng);{s._mapmlFeatures||(s._mapmlFeatures=[]);let t=new DOMParser,e=t.parseFromString(o,"application/xml"),i=Array.prototype.slice.call(e.querySelectorAll("map-feature"));if(i.length&&(s._mapmlFeatures=s._mapmlFeatures.concat(i)),e.features=s._mapmlFeatures,n)return function(t,o){for(var n of t.features)if(!n.querySelector("map-geometry")){let t=document.createElement("map-geometry"),e=document.createElement("map-point"),i=document.createElement("map-coordinates");t.setAttribute("cs","gcrs"),i.innerHTML=o.lng+" "+o.lat,e.appendChild(i),t.appendChild(e),n.appendChild(t)}let e=M.mapMlFeatures(t,{renderer:M.featureRenderer(),pane:m,projection:r.options.projection,_leafletLayer:s,query:!0,static:!0});e.addTo(r);let i=L.DomUtil.create("div","mapml-popup-content"),a=L.DomUtil.create("iframe");a.style="border: none",a.srcdoc=t.querySelector("map-feature map-properties").innerHTML,a.setAttribute("sandbox","allow-same-origin allow-forms"),i.appendChild(a),s._totalFeatureCount=t.features.length,s.bindPopup(i,u).openPopup(o),s.on("popupclose",function(){r.removeLayer(e)}),e.showPaginationFeature({i:0,popup:s._popup})}(e,a.latlng)}}).catch(t=>{console.log("Looks like there was a problem. Status: "+t.message)})}var g=s.getQueryTemplates(_);for(let t=0;t<g.length;t++){var f,b={},v=g[t];for(f in b[v.query.tilei]=p.x.toFixed()-c.x*l,b[v.query.tilej]=p.y.toFixed()-c.y*l,b[v.query.mapi]=r.getSize().divideBy(2).x.toFixed(),b[v.query.mapj]=r.getSize().divideBy(2).y.toFixed(),b[v.query.pixelleft]=n.pointToLatLng(p,o).lng,b[v.query.pixeltop]=n.pointToLatLng(p,o).lat,b[v.query.pixelright]=n.pointToLatLng(p.add([1,1]),o).lng,b[v.query.pixelbottom]=n.pointToLatLng(p.add([1,1]),o).lat,b[v.query.column]=c.x,b[v.query.row]=c.y,b[v.query.x]=p.x.toFixed(),b[v.query.y]=p.y.toFixed(),b[v.query.easting]=e(p).x,b[v.query.northing]=e(p).y,b[v.query.longitude]=i(p).lng,b[v.query.latitude]=i(p).lat,b[v.query.zoom]=o,b[v.query.width]=r.getSize().x,b[v.query.height]=r.getSize().y,b[v.query.mapbottom]=e(p.add(r.getSize().divideBy(2))).y,b[v.query.mapleft]=e(p.subtract(r.getSize().divideBy(2))).x,b[v.query.maptop]=e(p.subtract(r.getSize().divideBy(2))).y,b[v.query.mapright]=e(p.add(r.getSize().divideBy(2))).x,b[v.query.tilebottom]=e(h.max).y,b[v.query.tileleft]=e(h.min).x,b[v.query.tiletop]=e(h.min).y,b[v.query.tileright]=e(h.max).x,v.query)["mapi","mapj","tilei","tilej","row","col","x","y","easting","northing","longitude","latitude","width","height","zoom","mapleft","mapright",",maptop","mapbottom","tileleft","tileright","tiletop","tilebottom","pixeltop","pixelbottom","pixelleft","pixelright"].indexOf(f)<0&&(b[f]=v.query[f]);v.extentBounds.contains(_)&&x(v,b,t===g.length-1)}}}),F=L.Handler.extend({_touchstart:L.Browser.msPointer?"MSPointerDown":L.Browser.pointer?"pointerdown":"touchstart",initialize:function(t){L.Handler.prototype.initialize.call(this,t),this._items=[{text:M.options.locale.cmBack+" (<kbd>B</kbd>)",callback:this._goBack},{text:M.options.locale.cmForward+" (<kbd>F</kbd>)",callback:this._goForward},{text:M.options.locale.cmReload+" (<kbd>R</kbd>)",callback:this._reload},{spacer:"-"},{text:M.options.locale.cmToggleControls+" (<kbd>T</kbd>)",callback:this._toggleControls},{text:M.options.locale.cmCopyCoords+" (<kbd>C</kbd>)<span></span>",callback:this._copyCoords,hideOnSelect:!1,popup:!0,submenu:[{text:"tile",callback:this._copyTile},{text:"tilematrix",callback:this._copyTileMatrix},{spacer:"-"},{text:"map",callback:this._copyMap},{spacer:"-"},{text:"tcrs",callback:this._copyTCRS},{text:"pcrs",callback:this._copyPCRS},{text:"gcrs",callback:this._copyGCRS},{spacer:"-"},{text:M.options.locale.cmCopyAll,callback:this._copyAllCoords}]},{text:M.options.locale.cmToggleDebug+" (<kbd>D</kbd>)",callback:this._toggleDebug},{text:M.options.locale.cmCopyMapML+" (<kbd>M</kbd>)",callback:this._copyMapML},{text:M.options.locale.cmViewSource+" (<kbd>V</kbd>)",callback:this._viewSource}],this._layerItems=[{text:M.options.locale.lmZoomToLayer+" (<kbd>Z</kbd>)",callback:this._zoomToLayer},{text:M.options.locale.lmCopyExtent+" (<kbd>C</kbd>)",callback:this._copyLayerExtent}],this._mapMenuVisible=!1,this._keyboardEvent=!1,this._container=L.DomUtil.create("div","mapml-contextmenu",t._container),this._container.setAttribute("hidden","");for(let t=0;t<6;t++)this._items[t].el=this._createItem(this._container,this._items[t]);this._coordMenu=L.DomUtil.create("div","mapml-contextmenu mapml-submenu",this._container),this._coordMenu.id="mapml-copy-submenu",this._coordMenu.setAttribute("hidden",""),this._clickEvent=null;for(let t=0;t<this._items[5].submenu.length;t++)this._createItem(this._coordMenu,this._items[5].submenu[t],t);this._items[6].el=this._createItem(this._container,this._items[6]),this._items[7].el=this._createItem(this._container,this._items[7]),this._items[8].el=this._createItem(this._container,this._items[8]),this._layerMenu=L.DomUtil.create("div","mapml-contextmenu mapml-layer-menu",t._container),this._layerMenu.setAttribute("hidden","");for(let t=0;t<this._layerItems.length;t++)this._createItem(this._layerMenu,this._layerItems[t]);L.DomEvent.on(this._container,"click",L.DomEvent.stop).on(this._container,"mousedown",L.DomEvent.stop).on(this._container,"dblclick",L.DomEvent.stop).on(this._container,"contextmenu",L.DomEvent.stop).on(this._layerMenu,"click",L.DomEvent.stop).on(this._layerMenu,"mousedown",L.DomEvent.stop).on(this._layerMenu,"dblclick",L.DomEvent.stop).on(this._layerMenu,"contextmenu",L.DomEvent.stop)},addHooks:function(){var t=this._map.getContainer();L.DomEvent.on(t,"mouseleave",this._hide,this).on(document,"keydown",this._onKeyDown,this),L.Browser.touch&&L.DomEvent.on(document,this._touchstart,this._hide,this),this._map.on({contextmenu:this._show,mousedown:this._hide,zoomstart:this._hide},this)},removeHooks:function(){var t=this._map.getContainer();L.DomEvent.off(t,"mouseleave",this._hide,this).off(document,"keydown",this._onKeyDown,this),L.Browser.touch&&L.DomEvent.off(document,this._touchstart,this._hide,this),this._map.off({contextmenu:this._show,mousedown:this._hide,zoomstart:this._hide},this)},_copyLayerExtent:function(t){let e=(t instanceof KeyboardEvent?this._map:this).contextMenu,i=e._layerClicked.layer._layerEl,o=i.extent.topLeft.pcrs,n=i.extent.bottomRight.pcrs;t=`<map-meta name="extent" content="top-left-easting=${o.horizontal}, top-left-northing=${o.vertical}, bottom-right-easting=${n.horizontal}, bottom-right-northing=${n.vertical}"></map-meta>`;e._copyData(t)},_zoomToLayer:function(t){let e=(t instanceof KeyboardEvent?this._map:this).contextMenu;e._layerClicked.layer._layerEl.focus()},_goForward:function(t){let e=(t instanceof KeyboardEvent?this._map:this).options.mapEl;e.forward()},_goBack:function(t){let e=(t instanceof KeyboardEvent?this._map:this).options.mapEl;e.back()},_reload:function(t){let e=(t instanceof KeyboardEvent?this._map:this).options.mapEl;e.reload()},_toggleControls:function(t){let e=(t instanceof KeyboardEvent?this._map:this).options.mapEl;e._toggleControls()},_copyMapML:function(t){let e=(t instanceof KeyboardEvent?this._map:this).contextMenu,i=(t instanceof KeyboardEvent?this._map:this).options.mapEl;e._copyData(i.outerHTML.replace(/<div class="mapml-web-map">.*?<\/div>|<style>\[is="web-map"].*?<\/style>|<style>mapml-viewer.*?<\/style>/gm,""))},_viewSource:function(t){let e=(t instanceof KeyboardEvent?this._map:this).options.mapEl;e.viewSource()},_toggleDebug:function(t){let e=(t instanceof KeyboardEvent?this._map:this).options.mapEl;e.toggleDebug()},_copyCoords:function(t){let e=this.contextMenu||this;e._showCoordMenu(t)},_copyData:function(t){const e=document.createElement("textarea");e.value=t,document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)},_copyGCRS:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent;this.contextMenu._copyData(`z:${e.zoom}, lon :${i.latlng.lng.toFixed(6)}, lat:`+i.latlng.lat.toFixed(6))},_copyTCRS:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent,o=e._map.project(i.latlng);this.contextMenu._copyData(`z:${e.zoom}, x:${o.x}, y:`+o.y)},_copyTileMatrix:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent,o=e._map.project(i.latlng),n=e._map.options.crs.options.crs.tile.bounds.max.x;this.contextMenu._copyData(`z:${e.zoom}, column:${Math.trunc(o.x/n)}, row:`+Math.trunc(o.y/n))},_copyPCRS:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent,o=e._map.project(i.latlng),n=e._map.options.crs.scale(+e.zoom),a=e._map.options.crs.transformation.untransform(o,n);this.contextMenu._copyData(`z:${e.zoom}, easting:${a.x.toFixed(2)}, northing:`+a.y.toFixed(2))},_copyTile:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent,o=e._map.options.crs.project(i.latlng),n=e._map.options.crs.options.crs.tile.bounds.max.x,a=o.x%n,s=o.y%n;a<0&&(a+=n),s<0&&(s+=n),this.contextMenu._copyData(`z:${e.zoom}, i:${Math.trunc(a)}, j:`+Math.trunc(s))},_copyMap:function(t){var e=this.options.mapEl,i=this.contextMenu._clickEvent;this.contextMenu._copyData(`z:${e.zoom}, i:${Math.trunc(i.containerPoint.x)}, j:`+Math.trunc(i.containerPoint.y))},_copyAllCoords:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent,o=e._map.project(i.latlng),n=e._map.options.crs.options.crs.tile.bounds.max.x,a=o.x%n,s=o.y%n,r=e._map.options.crs.scale(+e.zoom),l=e._map.options.crs.transformation.untransform(o,r);var m=`z:${e.zoom}
+`;m+=`tile: i:${Math.trunc(a)}, j:${Math.trunc(s)}
+`,m+=`tilematrix: column:${Math.trunc(o.x/n)}, row:${Math.trunc(o.y/n)}
+`,m+=`map: i:${Math.trunc(i.containerPoint.x)}, j:${Math.trunc(i.containerPoint.y)}
+`,m+=`tcrs: x:${Math.trunc(o.x)}, y:${Math.trunc(o.y)}
+`,m+=`pcrs: easting:${l.x.toFixed(2)}, northing:${l.y.toFixed(2)}
+`,m+=`gcrs: lon :${i.latlng.lng.toFixed(6)}, lat:`+i.latlng.lat.toFixed(6),this.contextMenu._copyData(m)},_createItem:function(t,e,i){if(e.spacer)return this._createSeparator(t,i);t=this._insertElementAt("button","mapml-contextmenu-item",t,i),i=this._createEventHandler(t,e.callback,e.context,e.hideOnSelect);return t.innerHTML=""+e.text,t.setAttribute("type","button"),t.classList.add("mapml-button"),e.popup&&(t.setAttribute("aria-haspopup","true"),t.setAttribute("aria-expanded","false"),t.setAttribute("aria-controls","mapml-copy-submenu")),L.DomEvent.on(t,"mouseover",this._onItemMouseOver,this).on(t,"mouseout",this._onItemMouseOut,this).on(t,"mousedown",L.DomEvent.stopPropagation).on(t,"click",i),L.Browser.touch&&L.DomEvent.on(t,this._touchstart,L.DomEvent.stopPropagation),L.Browser.pointer||L.DomEvent.on(t,"click",this._onItemMouseOut,this),{id:L.Util.stamp(t),el:t,callback:i}},_createSeparator:function(t,e){e=this._insertElementAt("div","mapml-contextmenu-separator",t,e);return{id:L.Util.stamp(e),el:e}},_createEventHandler:function(r,l,m,u){let p=this;return u=void 0===u||u,function(t){let e=p._map,i=p._showLocation.containerPoint,o=e.containerPointToLayerPoint(i),n=e.layerPointToLatLng(o),a=p._showLocation.relatedTarget,s={containerPoint:i,layerPoint:o,latlng:n,relatedTarget:a};u&&p._hide(),l&&l.call(m||e,s),p._map.fire("contextmenu.select",{contextmenu:p,el:r})}},_insertElementAt:function(t,e,i,o){let n,a=document.createElement(t);return a.className=e,void 0!==o&&(n=i.children[o]),n?i.insertBefore(a,n):i.appendChild(a),a},_show:function(t){this._mapMenuVisible&&this._hide();let e=(this._clickEvent=t).originalEvent.target;if(e.closest("fieldset")){if(e=e.closest("fieldset"),e=("mapml-layer-extent"===e.className?e.closest("fieldset").parentNode.parentNode.parentNode:e).querySelector("span"),!e.layer.validProjection)return;this._layerClicked=e,this._showAtPoint(t.containerPoint,t,this._layerMenu)}else(e.classList.contains("leaflet-container")||e.classList.contains("mapml-debug-extent")||"path"===e.tagName)&&(this._layerClicked=void 0,this._showAtPoint(t.containerPoint,t,this._container));0!==t.originalEvent.button&&-1!==t.originalEvent.button||(this._keyboardEvent=!0,this._layerClicked?(t=document.activeElement,this._elementInFocus=t.shadowRoot.activeElement,this._layerMenuTabs=1,this._layerMenu.firstChild.focus()):this._container.firstChild.focus())},_showAtPoint:function(t,e,i){var o;this._items.length&&(o=L.extend(e||{},{contextmenu:this}),this._showLocation={containerPoint:t},e&&e.relatedTarget&&(this._showLocation.relatedTarget=e.relatedTarget),this._setPosition(t,i),this._mapMenuVisible||(i.removeAttribute("hidden"),this._mapMenuVisible=!0),this._map.fire("contextmenu.show",o))},_hide:function(){this._mapMenuVisible&&(this._mapMenuVisible=!1,this._container.setAttribute("hidden",""),this._coordMenu.setAttribute("hidden",""),this._layerMenu.setAttribute("hidden",""),this._map.fire("contextmenu.hide",{contextmenu:this}),setTimeout(()=>this._map._container.focus(),0))},_setPosition:function(t,e){var i,o=this._map.getSize(),n=this._getElementSize(e);this._map.options.contextmenuAnchor&&(i=L.point(this._map.options.contextmenuAnchor),t=t.add(i)),(e._leaflet_pos=t).x+n.x>o.x?(e.style.left="auto",e.style.right=Math.min(Math.max(o.x-t.x,0),o.x-n.x-1)+"px"):(e.style.left=Math.max(t.x,0)+"px",e.style.right="auto"),t.y+n.y>o.y?(e.style.top="auto",e.style.bottom=Math.min(Math.max(o.y-t.y,0),o.y-n.y-1)+"px"):(e.style.top=Math.max(t.y,0)+"px",e.style.bottom="auto")},_getElementSize:function(t){let e=this._size;return e&&!this._sizeChanged||(e={},t.style.left="-999999px",t.style.right="auto",e.x=t.offsetWidth,e.y=t.offsetHeight,t.style.left="auto",this._sizeChanged=!1),e},_focusOnLayerControl:function(){this._mapMenuVisible=!1,delete this._layerMenuTabs,this._layerMenu.setAttribute("hidden",""),(this._elementInFocus||this._layerClicked.parentElement.firstChild).focus(),delete this._elementInFocus},_onKeyDown:function(t){if(this._mapMenuVisible){var e=t.keyCode,i=t.path||t.composedPath();switch(13===e&&t.preventDefault(),!this._layerMenuTabs||9!==e&&27!==e?16===e||9===e||!this._layerClicked&&67===e||i[0].innerText===M.options.locale.cmCopyCoords+" (C)"||this._hide():(t.shiftKey?--this._layerMenuTabs:this._layerMenuTabs+=1,0!==this._layerMenuTabs&&3!==this._layerMenuTabs&&27!==e||(L.DomEvent.stop(t),this._focusOnLayerControl())),e){case 13:case 32:this._map._container.parentNode.activeElement.parentNode.classList.contains("mapml-contextmenu")&&this._map._container.parentNode.activeElement.click();break;case 66:this._goBack(t);break;case 67:this._layerClicked?this._copyLayerExtent(t):this._copyCoords({latlng:this._map.getCenter()});break;case 68:this._toggleDebug(t);break;case 77:this._copyMapML(t);break;case 70:this._goForward(t);break;case 82:this._reload(t);break;case 84:this._toggleControls(t);break;case 86:this._viewSource(t);break;case 90:this._layerClicked&&this._zoomToLayer(t)}}},_showCoordMenu:function(t){let e=this._map.getSize(),i=this._clickEvent,o=this._coordMenu,n=this._items[5].el.el;n.setAttribute("aria-expanded","true"),o.removeAttribute("hidden"),i.containerPoint.x+160+80>e.x?(o.style.left="auto",o.style.right="160px"):(o.style.left="160px",o.style.right="auto"),i.containerPoint.y+160>e.y?(o.style.top="auto",o.style.bottom="20px"):(o.style.top="100px",o.style.bottom="auto"),this._keyboardEvent&&o.firstChild.focus()},_hideCoordMenu:function(t){if(!t.srcElement.parentElement.classList.contains("mapml-submenu")&&t.srcElement.innerText!==M.options.locale.cmCopyCoords+" (C)"){let t=this._coordMenu,e=this._items[5].el.el;e.setAttribute("aria-expanded","false"),t.setAttribute("hidden","")}},_onItemMouseOver:function(t){L.DomUtil.addClass(t.target||t.srcElement,"over"),t.srcElement.innerText===M.options.locale.cmCopyCoords+" (C)"&&this._showCoordMenu(t)},_onItemMouseOut:function(t){L.DomUtil.removeClass(t.target||t.srcElement,"over"),this._hideCoordMenu(t)}}),D=function(e,i){if(!e||!i)return{};let o=[],n=[],a=[],s=[],r=i.options.crs.options.crs.tile.bounds.max.y;for(let t=0;t<i.options.crs.options.resolutions.length;t++){var l=i.options.crs.scale(t),m=i.options.crs.transformation.transform(e.min,l),l=i.options.crs.transformation.transform(e.max,l);o.push({horizontal:m.x,vertical:l.y}),n.push({horizontal:l.x,vertical:m.y}),a.push({horizontal:o[t].horizontal/r,vertical:o[t].vertical/r}),s.push({horizontal:n[t].horizontal/r,vertical:n[t].vertical/r})}var t=i.options.crs.unproject(e.min),u=i.options.crs.unproject(e.max);let p={horizontal:t.lng,vertical:u.lat},c={horizontal:u.lng,vertical:t.lat},h={horizontal:e.min.x,vertical:e.max.y},d={horizontal:e.max.x,vertical:e.min.y};return{topLeft:{tcrs:o,tilematrix:a,gcrs:p,pcrs:h},bottomRight:{tcrs:n,tilematrix:s,gcrs:c,pcrs:d},projection:i.options.projection}},N=function(u){if(u){let e=u.values,t=u.projection||B,i=0,o=d,n=this[t].options.crs.tilematrix.bounds(0),a=this[t].options.resolutions.length-1,s=0,r=a,l=!1,m=0;for(let t=0;t<e.length;t++)switch(e[t].getAttribute("type")){case"zoom":s=+(e[t].hasAttribute("min")&&!isNaN(+e[t].getAttribute("min"))?e[t].getAttribute("min"):0),r=+(e[t].hasAttribute("max")&&!isNaN(+e[t].getAttribute("max"))?e[t].getAttribute("max"):a),i=+e[t].getAttribute("value");break;case"location":if(!e[t].getAttribute("max")||!e[t].getAttribute("min"))continue;var p=+e[t].getAttribute("max"),c=+e[t].getAttribute("min");switch(e[t].getAttribute("axis").toLowerCase()){case"x":case"longitude":case"column":case"easting":o=M.axisToCS(e[t].getAttribute("axis").toLowerCase()),n.min.x=c,n.max.x=p,m++;break;case"y":case"latitude":case"row":case"northing":o=M.axisToCS(e[t].getAttribute("axis").toLowerCase()),n.min.y=c,n.max.y=p,m++}}2<=m&&(l=!0);var h={minZoom:u.zoomBounds?.min&&!isNaN(+u.zoomBounds.min)?+u.zoomBounds.min:0,maxZoom:u.zoomBounds?.max&&!isNaN(+u.zoomBounds.max)?+u.zoomBounds.max:a,minNativeZoom:s,maxNativeZoom:r};return n=!l&&u.extentPCRSFallback&&u.extentPCRSFallback.bounds?u.extentPCRSFallback.bounds:l?this.boundsToPCRSBounds(n,i,t,o):this[t].options.crs.pcrs.bounds,{zoomBounds:h,bounds:n}}},q=function(t){try{switch(t.toLowerCase()){case"row":case"column":return"TILEMATRIX";case"i":case"j":return["MAP","TILE"];case"x":case"y":return"TCRS";case"latitude":case"longitude":return"GCRS";case"northing":case"easting":return"PCRS";default:return d}}catch(t){return}},R=function(t){try{switch(t.toLowerCase()){case"tilematrix":return["column","row"];case"map":case"tile":return["i","j"];case"tcrs":return["x","y"];case"gcrs":return["longitude","latitude"];case"pcrs":return["easting","northing"]}}catch(t){return}},O=function(t){try{switch(t.toLowerCase()){case"i":case"column":case"longitude":case"x":case"easting":return"x";case"row":case"j":case"latitude":case"y":case"northing":return"y";default:return}}catch(t){return}},Z=function(t,e,i,o){if(t&&(e||0===e)&&Number.isFinite(+e)&&i&&o)switch(i="string"==typeof i?M[i]:i,o.toUpperCase()){case"PCRS":return t;case"TCRS":case"TILEMATRIX":var n=i.transformation.transform(t.min,i.scale(+e)),a=i.transformation.transform(t.max,i.scale(+e));if("TCRS"===o.toUpperCase())return L.bounds(n,a);var s=i.options.crs.tile.bounds.max.x;return L.bounds(L.point(n.x/s,n.y/s),L.point(a.x/s,a.y/s));case"GCRS":a=i.unproject(t.min),s=i.unproject(t.max);return L.bounds(L.point(a.lng,a.lat),L.point(s.lng,s.lat));default:return}},U=function(t,e,i,o){if(t&&(e||0===e)&&Number.isFinite(+e)&&o&&i){var n=(i="string"==typeof i?M[i]:i).options.crs.tile.bounds.max.x;switch(o.toUpperCase()){case"TILEMATRIX":return M.pixelToPCRSPoint(L.point(t.x*n,t.y*n),e,i);case"PCRS":return t;case"TCRS":return M.pixelToPCRSPoint(t,e,i);case"GCRS":return i.project(L.latLng(t.y,t.x));default:return}}},j=function(t,e,i){if(t&&(e||0===e)&&Number.isFinite(+e)&&i)return(i="string"==typeof i?M[i]:i).transformation.untransform(t,i.scale(e))},G=function(t,e,i,o){if(t&&t.max&&t.min&&(e||0===e)&&Number.isFinite(+e)&&i&&o)return i="string"==typeof i?M[i]:i,L.bounds(M.pointToPCRSPoint(t.min,e,i,o),M.pointToPCRSPoint(t.max,e,i,o))},H=function(t,e,i){if(t&&t.max&&t.min&&(e||0===e)&&Number.isFinite(+e)&&i)return i="string"==typeof i?M[i]:i,L.bounds(M.pixelToPCRSPoint(t.min,e,i),M.pixelToPCRSPoint(t.max,e,i))},V=function(t){if(!t||t instanceof Object)return{};let e=t.split(/\s+/).join(""),i={},o=e.split(",");for(let t=0;t<o.length;t++){var n=o[t].split("=");2===n.length&&(i[n[0]]=n[1])}return""!==i&&1===o[0].split("=").length&&(i.content=o[0]),i},$=function(t){for(var e=1,i=[],o=t.split(",");e<o.length;e+=2)i.push([parseInt(o[e-1]),parseInt(o[e])]);return i},W=function(t,e,i){if(i instanceof Element&&t&&t.querySelector("map-link[rel=stylesheet],map-style")){if(e instanceof Element)e=e.getAttribute("href")?e.getAttribute("href"):document.URL;else if(!e||""===e||e instanceof Object)return;for(var o,n,a=[],s=t.querySelectorAll("map-link[rel=stylesheet],map-style"),r=0;r<s.length;r++)"MAP-LINK"===s[r].nodeName.toUpperCase()?(o=s[r].hasAttribute("href")?new URL(s[r].getAttribute("href"),e).href:null)&&(i.querySelector("link[href='"+o+"']")||((n=document.createElement("link")).setAttribute("href",o),n.setAttribute("rel","stylesheet"),a.push(n))):((n=document.createElement("style")).textContent=s[r].textContent,a.push(n));for(var l=a.length-1;0<=l;l--)i.insertAdjacentElement("afterbegin",a[l])}},K=function(t,e,i){var o=[];t.split(/\s+/gim).forEach(M.parseNumber,o),this.push(o)},Y=function(t,e,i){this.push(parseFloat(t))},Q=function(o,t){let n,i=!1,a,s=t._map,r;if("text/html"===o.type&&"_blank"!==o.target)o.target="_top";else if("text/html"!==o.type&&o.url.includes("#")){let t=o.url.split("#"),e=t[1].split(",");n={z:e[0]||0,lng:e[1]||0,lat:e[2]||0},i=!t[0],["/",".","#"].includes(o.url[0])&&(o.target="_self")}if(i)n&&!o.inPlace&&i&&(t._map.options.mapEl.zoomTo(+n.lat,+n.lng,+n.z),r&&(a.opacity=r));else{let i=!1;switch(a=document.createElement("layer-"),a.setAttribute("src",o.url),a.setAttribute("checked",""),o.target){case"_blank":"text/html"===o.type?window.open(o.url):(s.options.mapEl.appendChild(a),i=!0);break;case"_parent":for(var e of s.options.mapEl.querySelectorAll("layer-"))e._layer!==t&&s.options.mapEl.removeChild(e);s.options.mapEl.appendChild(a),s.options.mapEl.removeChild(t._layerEl),i=!0;break;case"_top":window.location.href=o.url;break;default:r=t._layerEl.opacity,t._layerEl.insertAdjacentElement("beforebegin",a),s.options.mapEl.removeChild(t._layerEl),i=!0}!o.inPlace&&i&&L.DomEvent.on(a,"extentload",function t(e){i&&["_parent","_self"].includes(o.target)&&1===a.parentElement.querySelectorAll("layer-").length&&(a.parentElement.projection=a._layer.getProjection()),a.extent&&(n?a.parentElement.zoomTo(+n.lat,+n.lng,+n.z):a.focus(),L.DomEvent.off(a,"extentload",t)),r&&(a.opacity=r),s.getContainer().focus()})}},X=function(t){var e=t._map.project(t._map.getCenter()),t=t._map.options.crs.options.crs.tile.bounds.max.y;return[Math.trunc(e.x/t),Math.trunc(e.y/t)]},J=L.Control.extend({options:{position:"topleft"},onAdd:function(t){var e=L.DomUtil.create("div","mapml-reload-button leaflet-bar");let i=L.DomUtil.create("button","mapml-reload-button",e);return i.innerHTML="<span aria-hidden='true'>&#x021BA</span>",i.title=M.options.locale.cmReload,i.setAttribute("type","button"),i.classList.add("mapml-button"),i.setAttribute("aria-label","Reload"),L.DomEvent.disableClickPropagation(i),L.DomEvent.on(i,"click",L.DomEvent.stop),L.DomEvent.on(i,"click",this._goReload,this),this._reloadButton=i,this._updateDisabled(),t.on("moveend",this._updateDisabled,this),e},onRemove:function(t){t.off("moveend",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_goReload:function(t){!this._disabled&&1<this._map.options.mapEl._history.length&&this._map.options.mapEl.reload()},_updateDisabled:function(){setTimeout(()=>{L.DomUtil.removeClass(this._reloadButton,"leaflet-disabled"),this._reloadButton.setAttribute("aria-disabled","false"),this._map&&(this._disabled||this._map.options.mapEl._history.length<=1)&&(L.DomUtil.addClass(this._reloadButton,"leaflet-disabled"),this._reloadButton.setAttribute("aria-disabled","true"))},0)}}),tt=L.Control.extend({options:{position:"topleft",title:{false:"View fullscreen",true:"Exit fullscreen"}},onAdd:function(t){var e=L.DomUtil.create("div","leaflet-control-fullscreen leaflet-bar leaflet-control");return this.link=L.DomUtil.create("a","leaflet-control-fullscreen-button leaflet-bar-part",e),this.link.href="#",this.link.setAttribute("role","button"),this._map=t,this._map.on("fullscreenchange",this._toggleTitle,this),this._toggleTitle(),L.DomEvent.on(this.link,"click",this._click,this),e},onRemove:function(t){t.off("fullscreenchange",this._toggleTitle,this)},_click:function(t){L.DomEvent.stopPropagation(t),L.DomEvent.preventDefault(t),this._map.toggleFullscreen(this.options)},_toggleTitle:function(){this.link.title=this.options.title[this._map.isFullscreen()]}});L.Map.include({isFullscreen:function(){return this._isFullscreen||!1},toggleFullscreen:function(t){var e=this.getContainer().getRootNode().host,e="DIV"===e.nodeName?e.parentElement:e;this.isFullscreen()?t&&t.pseudoFullscreen?this._disablePseudoFullscreen(e):document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.msExitFullscreen?document.msExitFullscreen():this._disablePseudoFullscreen(e):t&&t.pseudoFullscreen?this._enablePseudoFullscreen(e):e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):e.msRequestFullscreen?e.msRequestFullscreen():this._enablePseudoFullscreen(e)},_enablePseudoFullscreen:function(t){L.DomUtil.addClass(t,"leaflet-pseudo-fullscreen"),this._setFullscreen(!0),this.fire("fullscreenchange")},_disablePseudoFullscreen:function(t){L.DomUtil.removeClass(t,"leaflet-pseudo-fullscreen"),this._setFullscreen(!1),this.fire("fullscreenchange")},_setFullscreen:function(t){this._isFullscreen=t;var e=this.getContainer().getRootNode().host;t?L.DomUtil.addClass(e,"mapml-fullscreen-on"):L.DomUtil.removeClass(e,"mapml-fullscreen-on"),this.invalidateSize()},_onFullscreenChange:function(t){var e=document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement,i=this.getContainer().getRootNode().host,i="DIV"===i.nodeName?i.parentElement:i;e!==i||this._isFullscreen?e!==i&&this._isFullscreen&&(this._setFullscreen(!1),this.fire("fullscreenchange")):(this._setFullscreen(!0),this.fire("fullscreenchange"))}}),L.Map.mergeOptions({fullscreenControl:!1}),L.Map.addInitHook(function(){var t,e;this.options.fullscreenControl&&(this.fullscreenControl=new tt(this.options.fullscreenControl),this.addControl(this.fullscreenControl)),"onfullscreenchange"in document?t="fullscreenchange":"onmozfullscreenchange"in document?t="mozfullscreenchange":"onwebkitfullscreenchange"in document?t="webkitfullscreenchange":"onmsfullscreenchange"in document&&(t="MSFullscreenChange"),t&&(e=L.bind(this._onFullscreenChange,this),this.whenReady(function(){L.DomEvent.on(document,t,e)}),this.on("unload",function(){L.DomEvent.off(document,t,e)}))});function et(t){return new tt(t)}function it(t){return new lt(t)}function ot(t,e){return new mt(t,e)}function nt(t){return new ut(t)}function at(t,e){return new pt(t,e)}var st,rt,lt=L.Layer.extend({onAdd:function(t){this._container=L.DomUtil.create("div","mapml-crosshair",t._container),this._container.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 100 100"><g stroke="#fff" stroke-linecap="round" stroke-linejoin="round"><circle cx="50.028" cy="50.219" r="3.923" stroke-width="2" color="currentColor" overflow="visible"/><path stroke-width="3" d="M4.973 54.424h31.768a4.204 4.204 0 1 0 0-8.409H4.973A4.203 4.203 0 0 0 .77 50.22a4.203 4.203 0 0 0 4.204 4.205z" color="currentColor" overflow="visible"/><path stroke-width="3" d="M54.232 5.165a4.204 4.204 0 1 0-8.408 0v31.767a4.204 4.204 0 1 0 8.408 0V5.165z"/><path stroke-width="3" d="M99.288 50.22a4.204 4.204 0 0 0-4.204-4.205H63.317a4.204 4.204 0 1 0 0 8.409h31.767a4.205 4.205 0 0 0 4.204-4.205zM45.823 95.274a4.204 4.204 0 1 0 8.409 0V63.506a4.204 4.204 0 1 0-8.409 0v31.768z" color="currentColor" overflow="visible"/></g></svg>',t.isFocused=!1,this._isQueryable=!1,t.on("layerchange layeradd layerremove overlayremove",this._toggleEvents,this),t.on("popupopen",this._isMapFocused,this),L.DomEvent.on(t._container,"keydown keyup mousedown",this._isMapFocused,this),this._addOrRemoveCrosshair()},onRemove:function(t){t.off("layerchange layeradd layerremove overlayremove",this._toggleEvents),t.off("popupopen",this._isMapFocused),L.DomEvent.off(t._container,"keydown keyup mousedown",this._isMapFocused)},_toggleEvents:function(){this._hasQueryableLayer()?this._map.on("viewreset move moveend",this._addOrRemoveCrosshair,this):this._map.off("viewreset move moveend",this._addOrRemoveCrosshair,this),this._addOrRemoveCrosshair()},_addOrRemoveCrosshair:function(t){this._hasQueryableLayer()?this._container.removeAttribute("hidden"):this._container.setAttribute("hidden","")},_addOrRemoveMapOutline:function(t){var e=this._map._container;this._map.isFocused&&!this._outline?this._outline=L.DomUtil.create("div","mapml-outline",e):!this._map.isFocused&&this._outline&&(L.DomUtil.remove(this._outline),delete this._outline)},_hasQueryableLayer:function(){var t=this._map.options.mapEl.layers;if(this._map.isFocused)for(var e of t)if(e.checked&&e._layer.queryable)return!0;return!1},_isMapFocused:function(t){var e;this._map._container.parentNode.activeElement?((e=this._map._container.parentNode.activeElement.classList.contains("leaflet-container"))&&["keydown"].includes(t.type)&&t.shiftKey&&9===t.keyCode?this._map.isFocused=!1:this._map.isFocused=e&&["keyup","keydown"].includes(t.type),this._map.isFocused&&this._map.fire("mapkeyboardfocused"),this._addOrRemoveMapOutline(),this._addOrRemoveCrosshair()):this._map.isFocused=!1}}),mt=L.Path.extend({initialize:function(t,e){this.type=t.tagName.toUpperCase(),"MAP-POINT"!==this.type&&"MAP-MULTIPOINT"!==this.type||(e.fillOpacity=1),0<e.wrappers.length&&(e=Object.assign(this._convertWrappers(e.wrappers),e)),L.setOptions(this,e),this.group=this.options.group,this.options.interactive=this.options.link||this.options.properties&&this.options.onEachFeature,this._parts=[],this._markup=t,this.options.zoom=t.getAttribute("zoom")||this.options.nativeZoom,this._convertMarkup(),(t.querySelector("map-span")||t.querySelector("map-a"))&&this._generateOutlinePoints(),this.isClosed=this._isClosed()},attachLinkHandler:function(o,n,a){let s,i=document.createElement("div"),r=document.createElement("p"),l=!1;i.classList.add("mapml-link-preview"),i.appendChild(r),o.classList.add("map-a"),n.visited&&o.classList.add("map-a-visited"),L.DomEvent.on(o,"mousedown",t=>s={x:t.clientX,y:t.clientY},this),L.DomEvent.on(o,"mouseup",i=>{if(0===i.button){let t=!0,e=this.options._leafletLayer._layerEl.nextElementSibling;for(;e&&t;)e.tagName&&"LAYER-"===e.tagName.toUpperCase()&&(t=!(e.checked&&e._layer.queryable)),e=e.nextElementSibling;t&&s&&(L.DomEvent.stop(i),Math.sqrt(Math.pow(s.x-i.clientX,2)+Math.pow(s.y-i.clientY,2))<=5&&(n.visited=!0,o.setAttribute("stroke","#6c00a2"),o.classList.add("map-a-visited"),M.handleLink(n,a)))}},this),L.DomEvent.on(o,"keypress",t=>{L.DomEvent.stop(t),13!==t.keyCode&&32!==t.keyCode||(n.visited=!0,o.setAttribute("stroke","#6c00a2"),o.classList.add("map-a-visited"),M.handleLink(n,a))},this),L.DomEvent.on(o,"mouseenter keyup",t=>{if(t.target===t.currentTarget){l=!0;let t=document.createElement("a"),e=this._map.getContainer().clientWidth;for(t.href=n.url,r.innerHTML=t.href,this._map.getContainer().appendChild(i);r.clientWidth>e/2;)r.innerHTML=r.innerHTML.substring(0,r.innerHTML.length-5)+"...";setTimeout(()=>{l&&(r.innerHTML=t.href)},1e3)}},this),L.DomEvent.on(o,"mouseout keydown mousedown",t=>{t.target===t.currentTarget&&i.parentElement&&(l=!1,this._map.getContainer().removeChild(i))},this),L.DomEvent.on(a._map.getContainer(),"mouseout mouseenter click",t=>{i.parentElement&&(l=!1,this._map.getContainer().removeChild(i))},this)},_project:function(t,e=void 0,i=void 0){let o=t||this._map,n=e||o.getPixelOrigin(),a=void 0===i?o.getZoom():i;for(var s of this._parts){s.pixelRings=this._convertRing(s.rings,o,n,a);for(var r of s.subrings)r.pixelSubrings=this._convertRing([r],o,n,a)}if(this._outline){this.pixelOutline=[];for(var l of this._outline)this.pixelOutline=this.pixelOutline.concat(this._convertRing(l,o,n,a))}},_convertRing:function(t,e,i,o){let n=e.options.crs.scale(o),a=[];for(var s of t){let t=[];for(var r of s.points){r=e.options.crs.transformation.transform(r,n);t.push(L.point(r.x,r.y)._subtract(i).round())}a.push(t)}return a},_update:function(){this._map&&this._renderer._updateFeature(this)},_convertWrappers:function(i){if(i&&0!==i.length){let t="",e={};for(var o of i)if("MAP-A"!==o.tagName.toUpperCase()&&o.className)t+=o.className+" ";else if(!e.link&&o.getAttribute("href")){let t={};t.url=o.getAttribute("href"),o.hasAttribute("target")&&(t.target=o.getAttribute("target")),o.hasAttribute("type")&&(t.type=o.getAttribute("type")),o.hasAttribute("inplace")&&(t.inPlace=!0),e.link=t}return e.className=(t+" "+this.options.className).trim(),e}},_convertMarkup:function(){if(this._markup){var o,e=this._markup.attributes;this.featureAttributes={},this.options.link&&"MAP-A"===this._markup.parentElement.tagName.toUpperCase()&&"MAP-GEOMETRY"!==this._markup.parentElement.parentElement.tagName.toUpperCase()&&(this.featureAttributes.tabindex="0");for(let t=0;t<e.length;t++)this.featureAttributes[e[t].name]=e[t].value;let i=!0;for(o of this._markup.querySelectorAll("map-coordinates")){let t=[],e=[];if(this._coordinateToArrays(o,t,e,this.options.className),i||"MAP-POLYGON"!==this.type)if("MAP-MULTIPOINT"===this.type)for(var n of t[0].points.concat(e))this._parts.push({rings:[{points:[n]}],subrings:[],cls:(`${n.cls||""} `+(this.options.className||"")).trim()});else this._parts.push({rings:t,subrings:e,cls:(`${this.featureAttributes.class||""} `+(this.options.className||"")).trim()});else this._parts[0].rings.push(t[0]),0<e.length&&(this._parts[0].subrings=this._parts[0].subrings.concat(e));i=!1}}},_generateOutlinePoints:function(){if("MAP-MULTIPOINT"!==this.type&&"MAP-POINT"!==this.type&&"MAP-LINESTRING"!==this.type&&"MAP-MULTILINESTRING"!==this.type){this._outline=[];for(var t of this._markup.querySelectorAll("map-coordinates")){let i=t.childNodes,o=0,n=document.createElement("div");i.length;for(let t=0;t<i.length;t++)0===i[t].textContent.trim().length&&i[t].remove();for(var a of i){var s,r=[];if(!a.tagName){let t="",e=((o-1)%i.length+i.length)%i.length;i[e].tagName&&(s=i[e].textContent.trim().split(/\s+/),t+=`${s[s.length-2]} ${s[s.length-1]} `),t+=a.textContent,e=((o+1)%i.length+i.length)%i.length,i[e].tagName&&(a=i[e].textContent.trim().split(/\s+/),t+=`${a[0]} ${a[1]} `),n.innerHTML=t,this._coordinateToArrays(n,r,[],!0,this.featureAttributes.class||this.options.className),this._outline.push(r)}o++}}}},_coordinateToArrays:function(o,t,n,e=!0,a=void 0,s=[]){for(var i of o.children)this._coordinateToArrays(i,t,n,!1,i.getAttribute("class"),s.concat([i]));let r=o.textContent.replace(/(<([^>]+)>)/gi,""),l=r.match(/(\S+\s+\S+)/gim),m=[],u;for(var p of l){var c=[];p.split(/\s+/gim).forEach(M.parseNumber,c);c=M.pointToPCRSPoint(L.point(c),this.options.zoom,this.options.projection,this.options.nativeCS);m.push(c),u=u?u.extend(c):L.bounds(c,c)}if(this._bounds?(this._bounds.extend(u.min),this._bounds.extend(u.max)):this._bounds=u,e)t.push({points:m});else{let e={},i=o.attributes,t=this._convertWrappers(s);t.link&&(e.tabindex="0");for(let t=0;t<i.length;t++)"class"!==i[t].name&&(e[i[t].name]=i[t].value);n.unshift({points:m,center:u.getCenter(),cls:(`${a||""} `+(t.className||"")).trim(),attr:e,link:t.link,linkTarget:t.linkTarget,linkType:t.linkType})}},_isClosed:function(){switch(this.type){case"MAP-POLYGON":case"MAP-MULTIPOLYGON":case"MAP-POINT":case"MAP-MULTIPOINT":return!0;default:return!1}},getCenter:function(){return this._bounds?this._map.options.crs.unproject(this._bounds.getCenter()):null},getPCRSCenter:function(){return this._bounds.getCenter()}}),ut=L.SVG.extend({_initContainer:function(){L.SVG.prototype._initContainer.call(this),this._container.setAttribute("role","none presentation")},_initPath:function(e,t=!0){if(e._outline){let t=L.SVG.create("path");e.options.className&&L.DomUtil.addClass(t,e.featureAttributes.class||e.options.className),L.DomUtil.addClass(t,"mapml-feature-outline"),t.style.fill="none",e.outlinePath=t}for(var i of e._parts){if(i.rings&&(this._createPath(i,e.options.className,e.featureAttributes["aria-label"],e.options.interactive,e.featureAttributes),e.outlinePath&&(i.path.style.stroke="none")),i.subrings)for(var o of i.subrings)this._createPath(o,e.options.className,o.attr["aria-label"],void 0!==o.link,o.attr);this._updateStyle(e)}t&&(t=L.stamp(e),this._layers[t]=e)},_createPath:function(t,e,i,o=!1,n=void 0){let a=L.SVG.create("path");if(t.path=a,n)for(var[s,r]of Object.entries(n))"id"!==s&&"tabindex"!==s&&a.setAttribute(s,r);else i&&a.setAttribute("aria-label",i);(t.cls||e)&&L.DomUtil.addClass(a,t.cls||e),o&&L.DomUtil.addClass(a,"leaflet-interactive")},_addPath:function(t,e=void 0,i=!0){this._rootGroup||e||this._initContainer();let o=e||this._rootGroup,n=!1;i&&t.addInteractiveTarget(t.group);for(var a of t._parts){a.path&&t.group.appendChild(a.path),i&&(t.options.link&&t.attachLinkHandler(a.path,t.options.link,t.options._leafletLayer),t.addInteractiveTarget(a.path)),!n&&t.pixelOutline&&(t.group.appendChild(t.outlinePath),n=!0);for(var s of a.subrings)s.path&&(s.link&&(t.attachLinkHandler(s.path,s.link,t.options._leafletLayer),t.addInteractiveTarget(s.path)),t.group.appendChild(s.path))}o.appendChild(t.group)},_removePath:function(t){for(var e of t._parts){e.path&&(t.removeInteractiveTarget(e.path),L.DomUtil.remove(e.path));for(var i of e.subrings)i.path&&L.DomUtil.remove(i.path)}t.outlinePath&&L.DomUtil.remove(t.outlinePath),t.removeInteractiveTarget(t.group),L.DomUtil.remove(t.group),delete this._layers[L.stamp(t)]},_updateFeature:function(t){t.pixelOutline&&this._setPath(t.outlinePath,this.geometryToPath(t.pixelOutline,!1));for(var e of t._parts){this._setPath(e.path,this.geometryToPath(e.pixelRings,t.isClosed));for(var i of e.subrings)this._setPath(i.path,this.geometryToPath(i.pixelSubrings,!1))}},_pointToMarker:function(t){return`M${t.x} ${t.y} L${t.x-12.5} ${t.y-30} C${t.x-12.5} ${t.y-50}, ${t.x+12.5} ${t.y-50}, ${t.x+12.5} ${t.y-30} L${t.x} ${t.y}z`},_updateStyle:function(t){this._updatePathStyle(t.outlinePath,t,!1,!0);for(var e of t._parts){e.path&&this._updatePathStyle(e.path,t,!0);for(var i of e.subrings)i.path&&this._updatePathStyle(i.path,t)}},_updatePathStyle:function(t,e,i=!1,o=!1){var n,a;t&&e&&(n=e.options,a=e.isClosed,n.stroke&&(!a||o)||i&&!e.outlinePath?(t.setAttribute("stroke",n.color),t.setAttribute("stroke-opacity",n.opacity),t.setAttribute("stroke-width",n.weight),t.setAttribute("stroke-linecap",n.lineCap),t.setAttribute("stroke-linejoin",n.lineJoin),n.dashArray?t.setAttribute("stroke-dasharray",n.dashArray):t.removeAttribute("stroke-dasharray"),n.dashOffset?t.setAttribute("stroke-dashoffset",n.dashOffset):t.removeAttribute("stroke-dashoffset"),n.link&&(t.setAttribute("stroke",n.link.visited?"#6c00a2":"#0000EE"),t.setAttribute("stroke-opacity","1"),t.setAttribute("stroke-width","1px"),t.setAttribute("stroke-dasharray","none"))):t.setAttribute("stroke","none"),a&&!o?n.fill?t.setAttribute("fill",n.color):(t.setAttribute("fill",n.fillColor||n.color),t.setAttribute("fill-opacity",n.fillOpacity),t.setAttribute("fill-rule",n.fillRule||"evenodd")):t.setAttribute("fill","none"))},_setPath:function(t,e){t.setAttribute("d",e)},geometryToPath:function(t,e){let i="",o,n,a,s,r,l;for(o=0,a=t.length;o<a;o++){if(1===(r=t[o]).length)return this._pointToMarker(r[0]);for(n=0,s=r.length;n<s;n++)l=r[n],i+=(n?"L":"M")+l.x+" "+l.y;i+=e?"z":""}return i||"M0 0"}}),pt=L.FeatureGroup.extend({initialize:function(t,e){e.wrappers&&0<e.wrappers.length&&(e=Object.assign(M.Feature.prototype._convertWrappers(e.wrappers),e)),L.LayerGroup.prototype.initialize.call(this,t,e),(this.options.onEachFeature&&this.options.properties||this.options.link)&&(L.DomUtil.addClass(this.options.group,"leaflet-interactive"),L.DomEvent.on(this.options.group,"keyup keydown mousedown",this._handleFocus,this),e=t[Object.keys(t)[0]],1===t.length&&e.options.link&&(this.options.link=e.options.link),this.options.link?(M.Feature.prototype.attachLinkHandler.call(this,this.options.group,this.options.link,this.options._leafletLayer),this.options.group.setAttribute("role","link")):(this.options.group.setAttribute("aria-expanded","false"),this.options.group.setAttribute("role","button"),this.options.onEachFeature(this.options.properties,this),this.off("click",this._openPopup))),this.options.group.setAttribute("aria-label",this.options.accessibleTitle),this.options.featureID&&this.options.group.setAttribute("data-fid",this.options.featureID)},onAdd:function(t){L.LayerGroup.prototype.onAdd.call(this,t),this.updateInteraction()},updateInteraction:function(){let e=this._map||this.options._leafletLayer._map;for(var i in(this.options.onEachFeature&&this.options.properties||this.options.link)&&e.featureIndex.addToIndex(this,this.getPCRSCenter(),this.options.group),this._layers){let t=this._layers[i];for(var o of t._parts){t.featureAttributes&&t.featureAttributes.tabindex&&e.featureIndex.addToIndex(t,t.getPCRSCenter(),o.path);for(var n of o.subrings)n.attr&&n.attr.tabindex&&e.featureIndex.addToIndex(t,n.center,n.path)}}},_handleFocus:function(t){var e;9!==t.keyCode&&16!==t.keyCode||"keydown"!==t.type?[9,16,13,27].includes(t.keyCode)||(this._map.featureIndex.currentIndex=0,this._map.featureIndex.inBoundFeatures[0].path.focus()):(e=this._map.featureIndex.currentIndex,9===t.keyCode&&t.shiftKey?(e===this._map.featureIndex.inBoundFeatures.length-1&&this._map.featureIndex.inBoundFeatures[e].path.setAttribute("tabindex",-1),0!==e&&(L.DomEvent.stop(t),this._map.featureIndex.inBoundFeatures[e-1].path.focus(),this._map.featureIndex.currentIndex--)):9===t.keyCode&&(e!==this._map.featureIndex.inBoundFeatures.length-1?(L.DomEvent.stop(t),this._map.featureIndex.inBoundFeatures[e+1].path.focus(),this._map.featureIndex.currentIndex++):(this._map.featureIndex.inBoundFeatures[0].path.setAttribute("tabindex",-1),this._map.featureIndex.inBoundFeatures[e].path.setAttribute("tabindex",0)))),"G"===t.target.tagName.toUpperCase()&&(9!==t.keyCode&&16!==t.keyCode&&13!==t.keyCode||"keyup"!==t.type?13===t.keyCode||32===t.keyCode?(this.closeTooltip(),!this.options.link&&this.options.onEachFeature&&(L.DomEvent.stop(t),this.openPopup())):this.closeTooltip():this.openTooltip())},addLayer:function(t){!t.options.link&&t.options.interactive&&this.options.onEachFeature(this.options.properties,t),L.FeatureGroup.prototype.addLayer.call(this,t)},_previousFeature:function(t){L.DomEvent.stop(t),this._map.featureIndex.currentIndex=Math.max(this._map.featureIndex.currentIndex-1,0);let e=this._map.featureIndex.inBoundFeatures[this._map.featureIndex.currentIndex];e.path.focus(),this._map.closePopup()},_nextFeature:function(t){L.DomEvent.stop(t),this._map.featureIndex.currentIndex=Math.min(this._map.featureIndex.currentIndex+1,this._map.featureIndex.inBoundFeatures.length-1);let e=this._map.featureIndex.inBoundFeatures[this._map.featureIndex.currentIndex];e.path.focus(),this._map.closePopup()},getPCRSCenter:function(){let e;for(var i in this._layers){let t=this._layers[i];e?e.extend(t.getPCRSCenter()):e=L.bounds(t.getPCRSCenter(),t.getPCRSCenter())}return e.getCenter()}}),ct=L.Handler.extend({addHooks:function(){this._map.on({layeradd:this.totalBounds,layerremove:this.totalBounds}),this._map.options.mapEl.addEventListener("moveend",this.announceBounds),this._map.dragging._draggable.addEventListener("dragstart",this.dragged),this._map.options.mapEl.addEventListener("mapfocused",this.focusAnnouncement)},removeHooks:function(){this._map.off({layeradd:this.totalBounds,layerremove:this.totalBounds}),this._map.options.mapEl.removeEventListener("moveend",this.announceBounds),this._map.dragging._draggable.removeEventListener("dragstart",this.dragged),this._map.options.mapEl.removeEventListener("mapfocused",this.focusAnnouncement)},focusAnnouncement:function(){let n=this;setTimeout(function(){let t=(n.querySelector(".mapml-web-map")?n.querySelector(".mapml-web-map"):n).shadowRoot.querySelector(".leaflet-container");var e=n._map.getZoom(),i=M.gcrsToTileMatrix(n);let o=M.options.locale.amZoom+" "+e+" "+M.options.locale.amColumn+" "+i[0]+" "+M.options.locale.amRow+" "+i[1];e===n._map._layersMaxZoom?o=M.options.locale.amMaxZoom+" "+o:e===n._map._layersMinZoom&&(o=M.options.locale.amMinZoom+" "+o),t.setAttribute("aria-roledescription","region "+o),setTimeout(function(){t.removeAttribute("aria-roledescription")},2e3)},0)},announceBounds:function(){if(!(0<this._traversalCall)){var i=this._map.getZoom(),o=M.pixelToPCRSBounds(this._map.getPixelBounds(),i,this._map.options.projection);let t=!0;this._map.totalLayerBounds&&(t=i<=this._map._layersMaxZoom&&i>=this._map._layersMinZoom&&this._map.totalLayerBounds.overlaps(o));let e=(this.querySelector(".mapml-web-map")?this.querySelector(".mapml-web-map"):this).shadowRoot.querySelector(".mapml-screen-reader-output");var n,o=M.gcrsToTileMatrix(this),o=M.options.locale.amZoom+" "+i+" "+M.options.locale.amColumn+" "+o[0]+" "+M.options.locale.amRow+" "+o[1];t?(n=(this._history[this._historyIndex-1]?this._history[this._historyIndex-1]:this._history[this._historyIndex]).zoom,i===this._map._layersMaxZoom&&i!==n?e.innerText=M.options.locale.amMaxZoom+" "+o:i===this._map._layersMinZoom&&i!==n?e.innerText=M.options.locale.amMinZoom+" "+o:e.innerText=o):(n=this._history[this._historyIndex],o=this._history[this._historyIndex-1],this.back(),this._history.pop(),n.zoom!==o.zoom?e.innerText=M.options.locale.amZoomedOut:this._map.dragging._draggable.wasDragged?e.innerText=M.options.locale.amDraggedOut:n.x>o.x?e.innerText=M.options.locale.amEastBound:n.x<o.x?e.innerText=M.options.locale.amWestBound:n.y<o.y?e.innerText=M.options.locale.amNorthBound:n.y>o.y&&(e.innerText=M.options.locale.amSouthBound)),this._map.dragging._draggable.wasDragged=!1}},totalBounds:function(){let t=Object.keys(this._layers),i=L.bounds();t.forEach(t=>{var e;this._layers[t].layerBounds&&(i||(e=this._layers[t].layerBounds.getCenter(),i=L.bounds(e,e)),i.extend(this._layers[t].layerBounds.min),i.extend(this._layers[t].layerBounds.max))}),this.totalLayerBounds=i},dragged:function(){this.wasDragged=!0}}),ht=L.Handler.extend({initialize:function(t){L.Handler.prototype.initialize.call(this,t),this.inBoundFeatures=[],this.outBoundFeatures=[],this.currentIndex=0,this._mapPCRSBounds=M.pixelToPCRSBounds(t.getPixelBounds(),t.getZoom(),t.options.projection)},addHooks:function(){this._map.on("mapkeyboardfocused",this._updateMapBounds,this),this._map.on("mapkeyboardfocused",this._sortIndex,this)},removeHooks:function(){this._map.off("mapkeyboardfocused",this._updateMapBounds),this._map.off("mapkeyboardfocused",this._sortIndex)},addToIndex:function(t,e,i){var o=this._mapPCRSBounds.getCenter(),o=Math.sqrt(Math.pow(e.x-o.x,2)+Math.pow(e.y-o.y,2));let n=this._mapPCRSBounds.contains(e)?this.inBoundFeatures:this.outBoundFeatures;o={path:i,layer:t,center:e,dist:o};i.setAttribute("tabindex",-1),n.push(o);for(let t=n.length-1;0<t&&n[t].dist<n[t-1].dist;t--){var a=n[t];n[t]=n[t-1],n[t-1]=a}this._mapPCRSBounds.contains(e)?this.inBoundFeatures=n:this.outBoundFeatures=n},cleanIndex:function(){this.currentIndex=0,this.inBoundFeatures=this.inBoundFeatures.filter(t=>{var e=this._mapPCRSBounds.contains(t.center);return t.path.setAttribute("tabindex",-1),t.layer._map&&!e&&this.outBoundFeatures.push(t),t.layer._map&&e}),this.outBoundFeatures=this.outBoundFeatures.filter(t=>{var e=this._mapPCRSBounds.contains(t.center);return t.path.setAttribute("tabindex",-1),t.layer._map&&e&&this.inBoundFeatures.push(t),t.layer._map&&!e})},_sortIndex:function(){if(this.cleanIndex(),0!==this.inBoundFeatures.length){let n=this._mapPCRSBounds.getCenter();this.inBoundFeatures.sort(function(t,e){var i=t.center,o=e.center;return t.dist=Math.sqrt(Math.pow(i.x-n.x,2)+Math.pow(i.y-n.y,2)),e.dist=Math.sqrt(Math.pow(o.x-n.x,2)+Math.pow(o.y-n.y,2)),t.dist-e.dist}),this.inBoundFeatures[0].path.setAttribute("tabindex",0)}},_updateMapBounds:function(t){this._mapPCRSBounds=M.pixelToPCRSBounds(this._map.getPixelBounds(),this._map.getZoom(),this._map.options.projection)}}),dt={announceMovement:!1,locale:{cmBack:"Back",cmForward:"Forward",cmReload:"Reload",cmToggleControls:"Toggle Controls",cmCopyCoords:"Copy Coordinates",cmToggleDebug:"Toggle Debug Mode",cmCopyMapML:"Copy MapML",cmViewSource:"View Map Source",cmCopyAll:"All",lmZoomToLayer:"Zoom To Layer",lmCopyExtent:"Copy Extent",lcOpacity:"Opacity",btnZoomIn:"Zoom in",btnZoomOut:"Zoom out",btnFullScreen:"View fullscreen",amZoom:"zoom level",amColumn:"column",amRow:"row",amMaxZoom:"At maximum zoom level, zoom in disabled",amMinZoom:"At minimum zoom level, zoom out disabled",amZoomedOut:"Zoomed out of bounds, returning to",amDraggedOut:"Dragged out of bounds, returning to",amEastBound:"Reached east bound, panning east disabled",amWestBound:"Reached west bound, panning west disabled",amNorthBound:"Reached north bound, panning north disabled",amSouthBound:"Reached south bound, panning south disabled"}};L.Map.Keyboard.include({_onKeyDown:function(t){if(!t.altKey&&!t.metaKey){var e,i=t.keyCode,o=this._map;if(i in this._panKeys)o._panAnim&&o._panAnim._inProgress||(e=this._panKeys[i],t.shiftKey&&(e=L.point(e).multiplyBy(3)),t.ctrlKey&&(e=L.point(e).divideBy(5)),o.panBy(e),o.options.maxBounds&&o.panInsideBounds(o.options.maxBounds));else if(i in this._zoomKeys)(i in{187:187,107:107,61:61,171:171}&&o._layersMaxZoom!==o.getZoom()||i in{189:189,109:109,54:54,173:173}&&o._layersMinZoom!==o.getZoom())&&o.setZoom(o.getZoom()+(t.shiftKey?3:1)*this._zoomKeys[i]);else{if(27!==i||!o._popup||!o._popup.options.closeOnEscapeKey)return;o.closePopup()}L.DomEvent.stop(t)}}}),st=window,rt={},st.M=rt,function(){rt.detectImagePath=function(t){var e=L.DomUtil.create("div","leaflet-default-icon-path",t),i=L.DomUtil.getStyle(e,"background-image")||L.DomUtil.getStyle(e,"backgroundImage");return t.removeChild(e),i=null===i||0!==i.indexOf("url")?"":i.replace(/^url\(["']?/,"").replace(/marker-icon\.png["']?\)$/,"")},rt.mime="text/mapml";var t=st.document.head.querySelector("map-options");rt.options=dt,t&&(rt.options=Object.assign(rt.options,JSON.parse(t.innerHTML))),rt.WGS84=new L.Proj.CRS("EPSG:4326","+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs ",{origin:[-180,90],bounds:L.bounds([[-180,-90],[180,90]]),resolutions:[.703125,.3515625,.17578125,.087890625,.0439453125,.02197265625,.010986328125,.0054931640625,.00274658203125,.001373291015625,.0006866455078125,.0003433227539062,.0001716613769531,858306884766e-16,429153442383e-16,214576721191e-16,107288360596e-16,53644180298e-16,26822090149e-16,13411045074e-16,6.705522537e-7,3.352761269e-7],crs:{tcrs:{horizontal:{name:"x",min:0,max:t=>(rt.WGS84.options.bounds.getSize().x/rt.WGS84.options.resolutions[t]).toFixed()},vertical:{name:"y",min:0,max:t=>(rt.WGS84.options.bounds.getSize().y/rt.WGS84.options.resolutions[t]).toFixed()},bounds:t=>L.bounds([rt.WGS84.options.crs.tcrs.horizontal.min,rt.WGS84.options.crs.tcrs.vertical.min],[rt.WGS84.options.crs.tcrs.horizontal.max(t),rt.WGS84.options.crs.tcrs.vertical.max(t)])},pcrs:{horizontal:{name:"longitude",get min(){return rt.WGS84.options.crs.gcrs.horizontal.min},get max(){return rt.WGS84.options.crs.gcrs.horizontal.max}},vertical:{name:"latitude",get min(){return rt.WGS84.options.crs.gcrs.vertical.min},get max(){return rt.WGS84.options.crs.gcrs.vertical.max}},get bounds(){return rt.WGS84.options.bounds}},gcrs:{horizontal:{name:"longitude",min:-180,max:180},vertical:{name:"latitude",min:-90,max:90},get bounds(){return L.latLngBounds([rt.WGS84.options.crs.gcrs.vertical.min,rt.WGS84.options.crs.gcrs.horizontal.min],[rt.WGS84.options.crs.gcrs.vertical.max,rt.WGS84.options.crs.gcrs.horizontal.max])}},map:{horizontal:{name:"i",min:0,max:t=>t.getSize().x},vertical:{name:"j",min:0,max:t=>t.getSize().y},bounds:t=>L.bounds(L.point([0,0]),t.getSize())},tile:{horizontal:{name:"i",min:0,max:256},vertical:{name:"j",min:0,max:256},get bounds(){return L.bounds([rt.WGS84.options.crs.tile.horizontal.min,rt.WGS84.options.crs.tile.vertical.min],[rt.WGS84.options.crs.tile.horizontal.max,rt.WGS84.options.crs.tile.vertical.max])}},tilematrix:{horizontal:{name:"column",min:0,max:t=>(rt.WGS84.options.crs.tcrs.horizontal.max(t)/rt.WGS84.options.crs.tile.bounds.getSize().x).toFixed()},vertical:{name:"row",min:0,max:t=>(rt.WGS84.options.crs.tcrs.vertical.max(t)/rt.WGS84.options.crs.tile.bounds.getSize().y).toFixed()},bounds:t=>L.bounds([rt.WGS84.options.crs.tilematrix.horizontal.min,rt.WGS84.options.crs.tilematrix.vertical.min],[rt.WGS84.options.crs.tilematrix.horizontal.max(t),rt.WGS84.options.crs.tilematrix.vertical.max(t)])}}}),rt.CBMTILE=new L.Proj.CRS("EPSG:3978","+proj=lcc +lat_1=49 +lat_2=77 +lat_0=49 +lon_0=-95 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs",{origin:[-34655800,3931e4],bounds:L.bounds([[-34655800,-39e6],[1e7,3931e4]]),resolutions:[38364.660062653464,22489.62831258996,13229.193125052918,7937.5158750317505,4630.2175937685215,2645.8386250105837,1587.5031750063501,926.0435187537042,529.1677250021168,317.50063500127004,185.20870375074085,111.12522225044451,66.1459656252646,38.36466006265346,22.48962831258996,13.229193125052918,7.9375158750317505,4.6302175937685215,2.6458386250105836,1.5875031750063502,.9260435187537043,.5291677250021167,.31750063500127,.18520870375074083,.11112522225044451,.06614596562526459],crs:{tcrs:{horizontal:{name:"x",min:0,max:t=>(rt.CBMTILE.options.bounds.getSize().x/rt.CBMTILE.options.resolutions[t]).toFixed()},vertical:{name:"y",min:0,max:t=>(rt.CBMTILE.options.bounds.getSize().y/rt.CBMTILE.options.resolutions[t]).toFixed()},bounds:t=>L.bounds([rt.CBMTILE.options.crs.tcrs.horizontal.min,rt.CBMTILE.options.crs.tcrs.vertical.min],[rt.CBMTILE.options.crs.tcrs.horizontal.max(t),rt.CBMTILE.options.crs.tcrs.vertical.max(t)])},pcrs:{horizontal:{name:"easting",get min(){return rt.CBMTILE.options.bounds.min.x},get max(){return rt.CBMTILE.options.bounds.max.x}},vertical:{name:"northing",get min(){return rt.CBMTILE.options.bounds.min.y},get max(){return rt.CBMTILE.options.bounds.max.y}},get bounds(){return rt.CBMTILE.options.bounds}},gcrs:{horizontal:{name:"longitude",min:-141.01,max:-47.74},vertical:{name:"latitude",min:40.04,max:86.46},get bounds(){return L.latLngBounds([rt.CBMTILE.options.crs.gcrs.vertical.min,rt.CBMTILE.options.crs.gcrs.horizontal.min],[rt.CBMTILE.options.crs.gcrs.vertical.max,rt.CBMTILE.options.crs.gcrs.horizontal.max])}},map:{horizontal:{name:"i",min:0,max:t=>t.getSize().x},vertical:{name:"j",min:0,max:t=>t.getSize().y},bounds:t=>L.bounds(L.point([0,0]),t.getSize())},tile:{horizontal:{name:"i",min:0,max:256},vertical:{name:"j",min:0,max:256},get bounds(){return L.bounds([rt.CBMTILE.options.crs.tile.horizontal.min,rt.CBMTILE.options.crs.tile.vertical.min],[rt.CBMTILE.options.crs.tile.horizontal.max,rt.CBMTILE.options.crs.tile.vertical.max])}},tilematrix:{horizontal:{name:"column",min:0,max:t=>(rt.CBMTILE.options.crs.tcrs.horizontal.max(t)/rt.CBMTILE.options.crs.tile.bounds.getSize().x).toFixed()},vertical:{name:"row",min:0,max:t=>(rt.CBMTILE.options.crs.tcrs.vertical.max(t)/rt.CBMTILE.options.crs.tile.bounds.getSize().y).toFixed()},bounds:t=>L.bounds([0,0],[rt.CBMTILE.options.crs.tilematrix.horizontal.max(t),rt.CBMTILE.options.crs.tilematrix.vertical.max(t)])}}}),rt.APSTILE=new L.Proj.CRS("EPSG:5936","+proj=stere +lat_0=90 +lat_ts=50 +lon_0=-150 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m +no_defs",{origin:[-28567784.109255,32567784.109255],bounds:L.bounds([[-28567784.109254867,-28567784.109254755],[32567784.109255023,32567784.10925506]]),resolutions:[238810.813354,119405.406677,59702.7033384999,29851.3516692501,14925.675834625,7462.83791731252,3731.41895865639,1865.70947932806,932.854739664032,466.427369832148,233.213684916074,116.606842458037,58.3034212288862,29.1517106145754,14.5758553072877,7.28792765351156,3.64396382688807,1.82198191331174,.910990956788164,.45549547826179],crs:{tcrs:{horizontal:{name:"x",min:0,max:t=>(rt.APSTILE.options.bounds.getSize().x/rt.APSTILE.options.resolutions[t]).toFixed()},vertical:{name:"y",min:0,max:t=>(rt.APSTILE.options.bounds.getSize().y/rt.APSTILE.options.resolutions[t]).toFixed()},bounds:t=>L.bounds([rt.APSTILE.options.crs.tcrs.horizontal.min,rt.APSTILE.options.crs.tcrs.vertical.min],[rt.APSTILE.options.crs.tcrs.horizontal.max(t),rt.APSTILE.options.crs.tcrs.vertical.max(t)])},pcrs:{horizontal:{name:"easting",get min(){return rt.APSTILE.options.bounds.min.x},get max(){return rt.APSTILE.options.bounds.max.x}},vertical:{name:"northing",get min(){return rt.APSTILE.options.bounds.min.y},get max(){return rt.APSTILE.options.bounds.max.y}},get bounds(){return rt.APSTILE.options.bounds}},gcrs:{horizontal:{name:"longitude",min:-180,max:180},vertical:{name:"latitude",min:60,max:90},get bounds(){return L.latLngBounds([rt.APSTILE.options.crs.gcrs.vertical.min,rt.APSTILE.options.crs.gcrs.horizontal.min],[rt.APSTILE.options.crs.gcrs.vertical.max,rt.APSTILE.options.crs.gcrs.horizontal.max])}},map:{horizontal:{name:"i",min:0,max:t=>t.getSize().x},vertical:{name:"j",min:0,max:t=>t.getSize().y},bounds:t=>L.bounds(L.point([0,0]),t.getSize())},tile:{horizontal:{name:"i",min:0,max:256},vertical:{name:"j",min:0,max:256},get bounds(){return L.bounds([rt.APSTILE.options.crs.tile.horizontal.min,rt.APSTILE.options.crs.tile.vertical.min],[rt.APSTILE.options.crs.tile.horizontal.max,rt.APSTILE.options.crs.tile.vertical.max])}},tilematrix:{horizontal:{name:"column",min:0,max:t=>(rt.APSTILE.options.crs.tcrs.horizontal.max(t)/rt.APSTILE.options.crs.tile.bounds.getSize().x).toFixed()},vertical:{name:"row",min:0,max:t=>(rt.APSTILE.options.crs.tcrs.vertical.max(t)/rt.APSTILE.options.crs.tile.bounds.getSize().y).toFixed()},bounds:t=>L.bounds([0,0],[rt.APSTILE.options.crs.tilematrix.horizontal.max(t),rt.APSTILE.options.crs.tilematrix.vertical.max(t)])}}}),rt.OSMTILE=L.CRS.EPSG3857,L.setOptions(rt.OSMTILE,{origin:[-20037508.342787,20037508.342787],bounds:L.bounds([[-20037508.342787,-20037508.342787],[20037508.342787,20037508.342787]]),resolutions:[156543.0339,78271.51695,39135.758475,19567.8792375,9783.93961875,4891.969809375,2445.9849046875,1222.9924523438,611.49622617188,305.74811308594,152.87405654297,76.437028271484,38.218514135742,19.109257067871,9.5546285339355,4.7773142669678,2.3886571334839,1.1943285667419,.59716428337097,.29858214168549,.14929107084274,.074645535421371,.03732276771068573,.018661383855342866,.009330691927671433],crs:{tcrs:{horizontal:{name:"x",min:0,max:t=>(rt.OSMTILE.options.bounds.getSize().x/rt.OSMTILE.options.resolutions[t]).toFixed()},vertical:{name:"y",min:0,max:t=>(rt.OSMTILE.options.bounds.getSize().y/rt.OSMTILE.options.resolutions[t]).toFixed()},bounds:t=>L.bounds([rt.OSMTILE.options.crs.tcrs.horizontal.min,rt.OSMTILE.options.crs.tcrs.vertical.min],[rt.OSMTILE.options.crs.tcrs.horizontal.max(t),rt.OSMTILE.options.crs.tcrs.vertical.max(t)])},pcrs:{horizontal:{name:"easting",get min(){return rt.OSMTILE.options.bounds.min.x},get max(){return rt.OSMTILE.options.bounds.max.x}},vertical:{name:"northing",get min(){return rt.OSMTILE.options.bounds.min.y},get max(){return rt.OSMTILE.options.bounds.max.y}},get bounds(){return rt.OSMTILE.options.bounds}},gcrs:{horizontal:{name:"longitude",get min(){return rt.OSMTILE.unproject(rt.OSMTILE.options.bounds.min).lng},get max(){return rt.OSMTILE.unproject(rt.OSMTILE.options.bounds.max).lng}},vertical:{name:"latitude",get min(){return rt.OSMTILE.unproject(rt.OSMTILE.options.bounds.min).lat},get max(){return rt.OSMTILE.unproject(rt.OSMTILE.options.bounds.max).lat}},get bounds(){return L.latLngBounds([rt.OSMTILE.options.crs.gcrs.vertical.min,rt.OSMTILE.options.crs.gcrs.horizontal.min],[rt.OSMTILE.options.crs.gcrs.vertical.max,rt.OSMTILE.options.crs.gcrs.horizontal.max])}},map:{horizontal:{name:"i",min:0,max:t=>t.getSize().x},vertical:{name:"j",min:0,max:t=>t.getSize().y},bounds:t=>L.bounds(L.point([0,0]),t.getSize())},tile:{horizontal:{name:"i",min:0,max:256},vertical:{name:"j",min:0,max:256},get bounds(){return L.bounds([rt.OSMTILE.options.crs.tile.horizontal.min,rt.OSMTILE.options.crs.tile.vertical.min],[rt.OSMTILE.options.crs.tile.horizontal.max,rt.OSMTILE.options.crs.tile.vertical.max])}},tilematrix:{horizontal:{name:"column",min:0,max:t=>(rt.OSMTILE.options.crs.tcrs.horizontal.max(t)/rt.OSMTILE.options.crs.tile.bounds.getSize().x).toFixed()},vertical:{name:"row",min:0,max:t=>(rt.OSMTILE.options.crs.tcrs.vertical.max(t)/rt.OSMTILE.options.crs.tile.bounds.getSize().y).toFixed()},bounds:t=>L.bounds([0,0],[rt.OSMTILE.options.crs.tilematrix.horizontal.max(t),rt.OSMTILE.options.crs.tilematrix.vertical.max(t)])}}})}(),rt.handleLink=Q,rt.convertPCRSBounds=Z,rt.axisToXY=O,rt.csToAxes=R,rt.convertAndFormatPCRS=D,rt.axisToCS=q,rt.parseNumber=Y,rt.extractInputBounds=N,rt.splitCoordinate=K,rt.boundsToPCRSBounds=G,rt.pixelToPCRSBounds=H,rt.metaContentToObject=V,rt.coordsToArray=$,rt.parseStylesheetAsHTML=W,rt.pointToPCRSPoint=U,rt.pixelToPCRSPoint=j,rt.gcrsToTileMatrix=X,rt.QueryHandler=w,rt.ContextMenu=F,rt.AnnounceMovement=ct,rt.FeatureIndex=ht,L.Map.addInitHook("addHandler","query",rt.QueryHandler),L.Map.addInitHook("addHandler","contextMenu",rt.ContextMenu),L.Map.addInitHook("addHandler","announceMovement",rt.AnnounceMovement),L.Map.addInitHook("addHandler","featureIndex",rt.FeatureIndex),rt.MapMLLayer=b,rt.mapMLLayer=u,rt.ImageOverlay=f,rt.imageOverlay=m,rt.TemplatedImageLayer=g,rt.templatedImageLayer=l,rt.TemplatedFeaturesLayer=x,rt.templatedFeaturesLayer=r,rt.TemplatedLayer=y,rt.templatedLayer=s,rt.TemplatedTileLayer=_,rt.templatedTileLayer=a,rt.MapMLFeatures=h,rt.mapMlFeatures=n,rt.MapMLLayerControl=o,rt.mapMlLayerControl=e,rt.ReloadButton=J,rt.reloadButton=c,rt.FullscreenButton=tt,rt.fullscreenButton=et,rt.MapMLStaticTileLayer=i,rt.mapMLStaticTileLayer=t,rt.DebugOverlay=v,rt.debugOverlay=p,rt.Crosshair=lt,rt.crosshair=it,rt.Feature=mt,rt.feature=ot,rt.FeatureRenderer=ut,rt.featureRenderer=nt,rt.FeatureGroup=pt,rt.featureGroup=at}();
\ No newline at end of file

From 4ac3c21130edcac8d5d14cdc48ce9f9b173039e6 Mon Sep 17 00:00:00 2001
From: Peter Rushforth <peter.rushforth@gmail.com>
Date: Wed, 12 Jan 2022 11:27:20 -0500
Subject: [PATCH 4/4] Share restaurants across examples. Add tabindex to
 building part example.

Update RTL experiment to use shared restaurants.mapml
---
 i18n/rtl/index.html                           |    21 +-
 i18n/rtl/restaurants.mapml                    |   386 -
 index.html                                    |     1 +
 linking/features/sportsplex.mapml             |     2 +-
 multiple-extents/dist/images/layers-2x.png    |   Bin 1259 -> 0 bytes
 multiple-extents/dist/images/layers.png       |   Bin 696 -> 0 bytes
 .../dist/images/marker-icon-2x.png            |   Bin 2464 -> 0 bytes
 multiple-extents/dist/images/marker-icon.png  |   Bin 1466 -> 0 bytes
 .../dist/images/marker-shadow.png             |   Bin 618 -> 0 bytes
 multiple-extents/dist/index.html              |    79 -
 multiple-extents/dist/layer.js                |   368 -
 multiple-extents/dist/leaflet-src.js          | 14062 ----------------
 multiple-extents/dist/map-area.js             |   176 -
 multiple-extents/dist/mapml-viewer.js         |   756 -
 multiple-extents/dist/mapml.css               |     5 -
 multiple-extents/dist/mapml.js                |  7055 --------
 multiple-extents/dist/mapml.min.js            |     3 -
 multiple-extents/dist/proj4-src.js            |  6602 --------
 multiple-extents/dist/proj4leaflet.js         |   272 -
 multiple-extents/dist/web-map.js              |   815 -
 multiple-extents/index.html                   |   145 +-
 multiple-extents/spearfish.mapml              |    81 +
 screenreader/closest-restaurants/index.html   |     2 +-
 .../feature-index/dist/images/layers-2x.png   |   Bin 1259 -> 0 bytes
 .../feature-index/dist/images/layers.png      |   Bin 696 -> 0 bytes
 .../dist/images/marker-icon-2x.png            |   Bin 2464 -> 0 bytes
 .../feature-index/dist/images/marker-icon.png |   Bin 1466 -> 0 bytes
 .../dist/images/marker-shadow.png             |   Bin 618 -> 0 bytes
 screenreader/feature-index/dist/index.html    |    79 -
 screenreader/feature-index/dist/layer.js      |   359 -
 .../feature-index/dist/leaflet-src.js         | 14062 ----------------
 screenreader/feature-index/dist/map-area.js   |   176 -
 .../feature-index/dist/mapml-viewer.js        |   755 -
 screenreader/feature-index/dist/mapml.css     |     5 -
 screenreader/feature-index/dist/mapml.js      |  6742 --------
 screenreader/feature-index/dist/mapml.min.js  |     3 -
 screenreader/feature-index/dist/proj4-src.js  |  6602 --------
 .../feature-index/dist/proj4leaflet.js        |   272 -
 screenreader/feature-index/dist/web-map.js    |   815 -
 screenreader/feature-index/index.html         |    16 -
 screenreader/feature-index/restaurants.mapml  |   387 -
 screenreader/restaurants/index.html           |    17 +-
 screenreader/restaurants/restaurants.mapml    |   387 -
 .../restaurants/african.mapml                 |     0
 .../restaurants/asian.mapml                   |     0
 .../restaurants/cajun.mapml                   |     0
 .../restaurants/indian.mapml                  |     0
 .../restaurants/italian.mapml                 |     0
 .../restaurants/mexican.mapml                 |     0
 .../restaurants/restaurants.mapml             |     0
 50 files changed, 237 insertions(+), 61271 deletions(-)
 delete mode 100644 i18n/rtl/restaurants.mapml
 delete mode 100644 multiple-extents/dist/images/layers-2x.png
 delete mode 100644 multiple-extents/dist/images/layers.png
 delete mode 100644 multiple-extents/dist/images/marker-icon-2x.png
 delete mode 100644 multiple-extents/dist/images/marker-icon.png
 delete mode 100644 multiple-extents/dist/images/marker-shadow.png
 delete mode 100644 multiple-extents/dist/index.html
 delete mode 100644 multiple-extents/dist/layer.js
 delete mode 100644 multiple-extents/dist/leaflet-src.js
 delete mode 100644 multiple-extents/dist/map-area.js
 delete mode 100644 multiple-extents/dist/mapml-viewer.js
 delete mode 100644 multiple-extents/dist/mapml.css
 delete mode 100644 multiple-extents/dist/mapml.js
 delete mode 100644 multiple-extents/dist/mapml.min.js
 delete mode 100644 multiple-extents/dist/proj4-src.js
 delete mode 100644 multiple-extents/dist/proj4leaflet.js
 delete mode 100644 multiple-extents/dist/web-map.js
 create mode 100644 multiple-extents/spearfish.mapml
 delete mode 100644 screenreader/feature-index/dist/images/layers-2x.png
 delete mode 100644 screenreader/feature-index/dist/images/layers.png
 delete mode 100644 screenreader/feature-index/dist/images/marker-icon-2x.png
 delete mode 100644 screenreader/feature-index/dist/images/marker-icon.png
 delete mode 100644 screenreader/feature-index/dist/images/marker-shadow.png
 delete mode 100644 screenreader/feature-index/dist/index.html
 delete mode 100644 screenreader/feature-index/dist/layer.js
 delete mode 100644 screenreader/feature-index/dist/leaflet-src.js
 delete mode 100644 screenreader/feature-index/dist/map-area.js
 delete mode 100644 screenreader/feature-index/dist/mapml-viewer.js
 delete mode 100644 screenreader/feature-index/dist/mapml.css
 delete mode 100644 screenreader/feature-index/dist/mapml.js
 delete mode 100644 screenreader/feature-index/dist/mapml.min.js
 delete mode 100644 screenreader/feature-index/dist/proj4-src.js
 delete mode 100644 screenreader/feature-index/dist/proj4leaflet.js
 delete mode 100644 screenreader/feature-index/dist/web-map.js
 delete mode 100644 screenreader/feature-index/index.html
 delete mode 100644 screenreader/feature-index/restaurants.mapml
 delete mode 100644 screenreader/restaurants/restaurants.mapml
 rename {screenreader/closest-restaurants => shared}/restaurants/african.mapml (100%)
 rename {screenreader/closest-restaurants => shared}/restaurants/asian.mapml (100%)
 rename {screenreader/closest-restaurants => shared}/restaurants/cajun.mapml (100%)
 rename {screenreader/closest-restaurants => shared}/restaurants/indian.mapml (100%)
 rename {screenreader/closest-restaurants => shared}/restaurants/italian.mapml (100%)
 rename {screenreader/closest-restaurants => shared}/restaurants/mexican.mapml (100%)
 rename {screenreader/closest-restaurants => shared}/restaurants/restaurants.mapml (100%)

diff --git a/i18n/rtl/index.html b/i18n/rtl/index.html
index 462875e..0475deb 100644
--- a/i18n/rtl/index.html
+++ b/i18n/rtl/index.html
@@ -8,9 +8,24 @@
     <link rel="stylesheet" href="../../global.css">
   </head>
   <body>
-    <mapml-viewer dir="rtl" projection="CBMTILE" zoom="17" lat="45.4069740362364" lon="-75.70155300710053" controls>
-      <layer- label="CBMT" src="https://geogratis.gc.ca/mapml/en/cbmtile/cbmt/" checked></layer->
-      <layer- label="Ottawa Restaurants" src="restaurants.mapml" checked></layer->
+    <mapml-viewer dir="rtl" projection="OSMTILE" zoom="15" lat="45.4069740362364" lon="-75.70155300710053" controls>
+      <layer- label="CBMT" src="https://geogratis.gc.ca/mapml/en/osmtile/cbmt/" checked></layer->
+      <layer- id="restaurant" label="Ottawa Restaurants" checked>
+        <map-meta name="cs" content="gcrs" ></map-meta>
+        <map-meta name="extent" content="top-left-easting=-8433179, top-left-northing=5689316, bottom-right-easting=-8420968, bottom-right-northing=5683139"></map-meta>
+        <map-extent units="OSMTILE">
+           <map-select id="restaurants" name="cusine">
+              <map-option value="restaurants" selected>All cuisines</map-option>
+              <map-option value="african">African</map-option>
+              <map-option value="asian">Asian</map-option>
+              <map-option value="cajun">Cajun</map-option>
+              <map-option value="indian">Indian</map-option>
+              <map-option value="italian">Italian</map-option>
+              <map-option value="mexican">Mexican</map-option>
+            </map-select>
+            <map-link tref="../../shared/restaurants/{cusine}.mapml" rel="features"/>
+          </map-extent>
+      </layer->
     </mapml-viewer>
   </body>
 </html>
diff --git a/i18n/rtl/restaurants.mapml b/i18n/rtl/restaurants.mapml
deleted file mode 100644
index 7d147e4..0000000
--- a/i18n/rtl/restaurants.mapml
+++ /dev/null
@@ -1,386 +0,0 @@
-<mapml- xmlns="http://www.w3.org/1999/xhtml">
-    <map-head>
-        <map-title>Restaurants</map-title>
-        <map-meta charset="utf-8" ></map-meta>
-        <map-meta content="text/mapml" http-equiv="Content-Type" ></map-meta>
-        <map-link rel="license" href="http://opendatacommons.org/licenses/odbl/1-0/" title="© OpenStreetMap and contributors" />
-        <map-meta name="projection" content="CBMTILE"></map-meta>
-        <map-meta name="zoom" content="min=0,max=22,value=3" ></map-meta>
-        <map-meta name="cs" content="gcrs" ></map-meta>
-        <map-meta name="extent" content="top-left-easting=1509080.1964270622,top-left-northing=-169400.558801122,bottom-right-easting=1512094.3357886747,bottom-right-northing=-172702.5654051304" ></map-meta>
-    </map-head>
-    <map-body>
-        <map-feature id="restaurant_map-point.77" class="restaurant_map-point">
-          <map-featurecaption>Hung Sum Restaurant</map-featurecaption>
-            <map-geometry>
-                <map-point>
-                        <map-coordinates>-75.71543400037297 45.40819502909854</map-coordinates>
-                </map-point>
-            </map-geometry>
-            <map-properties>
-                <table>
-                    <thead>
-                        <tr>
-                            <th role="columnheader" scope="col">Property name</th>
-                            <th role="columnheader" scope="col">Property value</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <tr>
-                            <th scope="row">amenity</th>
-                            <td itemprop="amenity">restaurant</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">name</th>
-                            <td itemprop="name">Hung Sum Restaurant</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_stree</th>
-                            <td itemprop="addr_stree">Somerset Street West</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_house</th>
-                            <td itemprop="addr_house">939</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">cuisine</th>
-                            <td itemprop="cuisine">chinese</td>
-                        </tr>
-                    </tbody>
-                </table>
-            </map-properties>
-        </map-feature>
-        <map-feature id="restaurant_map-point.2" class="restaurant_map-point">
-          <map-featurecaption>Big Daddy's</map-featurecaption>
-            <map-geometry>
-                <map-point>
-                  <map-coordinates>-75.6902755031953 45.41868067160079</map-coordinates>
-                </map-point>
-            </map-geometry>
-            <map-properties>
-                <table>
-                    <thead>
-                        <tr>
-                            <th role="columnheader" scope="col">Property name</th>
-                            <th role="columnheader" scope="col">Property value</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <tr>
-                            <th scope="row">amenity</th>
-                            <td itemprop="amenity">restaurant</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">name</th>
-                            <td itemprop="name">Big Daddy's</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_stree</th>
-                            <td itemprop="addr_stree">Cooper Street</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_house</th>
-                            <td itemprop="addr_house">180</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">cuisine</th>
-                            <td itemprop="cuisine">seafood</td>
-                        </tr>
-                    </tbody>
-                </table>
-            </map-properties>
-        </map-feature>
-        <map-feature id="restaurant_map-point.9" class="restaurant_map-point">
-          <map-featurecaption>Hareg Cafe &amp; Variety</map-featurecaption>
-            <map-geometry>
-              <map-point>
-                <map-coordinates>-75.69108408413759 45.407905135087496</map-coordinates>
-              </map-point>
-            </map-geometry>
-            <map-properties>
-                <table>
-                    <thead>
-                        <tr>
-                            <th role="columnheader" scope="col">Property name</th>
-                            <th role="columnheader" scope="col">Property value</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <tr>
-                            <th scope="row">amenity</th>
-                            <td itemprop="amenity">restaurant</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">name</th>
-                            <td itemprop="name">Hareg Cafe &amp; Variety</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_stree</th>
-                            <td itemprop="addr_stree">Bank Street</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_house</th>
-                            <td itemprop="addr_house">587</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">cuisine</th>
-                            <td itemprop="cuisine">african</td>
-                        </tr>
-                    </tbody>
-                </table>
-            </map-properties>
-        </map-feature>
-        <map-feature id="restaurant_map-point.13" class="restaurant_map-point">
-          <map-featurecaption>Phucket Royal</map-featurecaption>
-            <map-geometry>
-              <map-point>
-                <map-coordinates>-75.70786179432208 45.410746385011166</map-coordinates>
-              </map-point>
-            </map-geometry>
-            <map-properties>
-                <table>
-                    <thead>
-                        <tr>
-                            <th role="columnheader" scope="col">Property name</th>
-                            <th role="columnheader" scope="col">Property value</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <tr>
-                            <th scope="row">amenity</th>
-                            <td itemprop="amenity">restaurant</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">name</th>
-                            <td itemprop="name">Phucket Royal</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_stree</th>
-                            <td itemprop="addr_stree">Somerset Street West</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_house</th>
-                            <td itemprop="addr_house">713</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">cuisine</th>
-                            <td itemprop="cuisine">thai</td>
-                        </tr>
-                    </tbody>
-                </table>
-            </map-properties>
-        </map-feature>
-        <map-feature id="restaurant_map-point.18" class="restaurant_map-point">
-          <map-featurecaption>Sushi 88</map-featurecaption>
-            <map-geometry>
-              <map-point>
-                <map-coordinates>-75.70642921479893 45.41108327733854</map-coordinates>
-              </map-point>
-            </map-geometry>
-            <map-properties>
-                <table>
-                    <thead>
-                        <tr>
-                            <th role="columnheader" scope="col">Property name</th>
-                            <th role="columnheader" scope="col">Property value</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <tr>
-                            <th scope="row">amenity</th>
-                            <td itemprop="amenity">restaurant</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">name</th>
-                            <td itemprop="name">Sushi 88</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_stree</th>
-                            <td itemprop="addr_stree">Somerset Street West</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_house</th>
-                            <td itemprop="addr_house">690 B</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">cuisine</th>
-                            <td itemprop="cuisine">sushi</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">website</th>
-                            <td itemprop="website" />
-                        </tr>
-                        <tr>
-                            <th scope="row">phone</th>
-                            <td itemprop="phone">+1-613-233-3288</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">wheelchair</th>
-                            <td itemprop="wheelchair">no</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_postc</th>
-                            <td itemprop="addr_postc">K1R 6P4</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">outdoor_se</th>
-                            <td itemprop="outdoor_se">no</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">takeaway</th>
-                            <td itemprop="takeaway">yes</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">delivery</th>
-                            <td itemprop="delivery">no</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">internet_a</th>
-                            <td itemprop="internet_a">no</td>
-                        </tr>
-                    </tbody>
-                </table>
-            </map-properties>
-        </map-feature>
-        <map-feature id="restaurant_polygon.2" class="restaurant_polygon">
-          <map-featurecaption>Banditos</map-featurecaption>
-            <map-geometry>
-              <map-point>
-                  <map-coordinates>-75.689609 45.405803</map-coordinates>
-              </map-point>
-            </map-geometry>
-            <map-properties>
-                <table>
-                    <thead>
-                        <tr>
-                            <th role="columnheader" scope="col">Property name</th>
-                            <th role="columnheader" scope="col">Property value</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <tr>
-                            <th scope="row">addr_house</th>
-                            <td itemprop="addr_house">683</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_stree</th>
-                            <td itemprop="addr_stree">Bank Street</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">amenity</th>
-                            <td itemprop="amenity">restaurant</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">building</th>
-                            <td itemprop="building">commercial</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">name</th>
-                            <td itemprop="name">Banditos</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">cuisine</th>
-                            <td itemprop="cuisine">mexican</td>
-                        </tr>
-                    </tbody>
-                </table>
-            </map-properties>
-        </map-feature>
-        <map-feature id="restaurant_polygon.7" class="restaurant_polygon">
-          <map-featurecaption>India Palace</map-featurecaption>
-            <map-geometry>
-              <map-point>
-                  <map-coordinates>-75.7019048 45.4191548</map-coordinates>
-              </map-point>
-            </map-geometry>
-            <map-properties>
-                <table>
-                    <thead>
-                        <tr>
-                            <th role="columnheader" scope="col">Property name</th>
-                            <th role="columnheader" scope="col">Property value</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <tr>
-                            <th scope="row">addr_house</th>
-                            <td itemprop="addr_house">292</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_stree</th>
-                            <td itemprop="addr_stree">Albert Street</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">amenity</th>
-                            <td itemprop="amenity">restaurant</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">building</th>
-                            <td itemprop="building">yes</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">name</th>
-                            <td itemprop="name">India Palace</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">cuisine</th>
-                            <td itemprop="cuisine">indian</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">website</th>
-                            <td itemprop="website">http://www.indiapalace.ca</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">phone</th>
-                            <td itemprop="phone">+1-613-234-5433</td>
-                        </tr>
-                    </tbody>
-                </table>
-            </map-properties>
-        </map-feature>
-        <map-feature id="restaurant_polygon.20" class="restaurant_polygon">
-          <map-featurecaption>The Prescott</map-featurecaption>
-            <map-geometry>
-              <map-point>
-                  <map-coordinates>-75.7093517 45.4005727</map-coordinates>
-              </map-point>
-            </map-geometry>
-            <map-properties>
-                <table>
-                    <thead>
-                        <tr>
-                            <th role="columnheader" scope="col">Property name</th>
-                            <th role="columnheader" scope="col">Property value</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <tr>
-                            <th scope="row">addr_house</th>
-                            <td itemprop="addr_house">379</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_stree</th>
-                            <td itemprop="addr_stree">Preston Street</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">amenity</th>
-                            <td itemprop="amenity">restaurant</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">building</th>
-                            <td itemprop="building">retail</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">name</th>
-                            <td itemprop="name">The Prescott</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">website</th>
-                            <td itemprop="website"><a href="http://www.theprescott.com/">The Prescott</a></td>
-                        </tr>
-                    </tbody>
-                </table>
-            </map-properties>
-        </map-feature>
-    </map-body>
-</mapml->
diff --git a/index.html b/index.html
index e574f85..f822505 100644
--- a/index.html
+++ b/index.html
@@ -93,6 +93,7 @@ <h2>Styling</h2>
       <h2>Miscellaneous</h2>
       <ul class="example">
         <li>Snow and Ice Probability: <a href="datacube/">Time Dimension &lt;select&gt;</a></li>
+        <li><a href="multiple-extents/">Multiple &lt;map-extent&gt; elements in a layer</a></li>
       </ul>
     </section>
   </body>
diff --git a/linking/features/sportsplex.mapml b/linking/features/sportsplex.mapml
index 886d7a8..8faa030 100644
--- a/linking/features/sportsplex.mapml
+++ b/linking/features/sportsplex.mapml
@@ -3549,7 +3549,7 @@
                     <map-polygon>
                       <map-coordinates>
                         1510099.2 -181123.3 1510100.4 -181122.9 1510101.1 -181122.7 1510101.1 -181122.8 1510101.4 -181122.7 1510101.4 -181122.5 1510101.3 -181122.3 1510103.8 -181121.6 
-                        <map-span class="door leaflet-interactive" aria-label="door" style="stroke: yellow; stroke-width: 4px">1510104.9 -181125.0 1510105.20 -181126</map-span> 1510106.1 -181129.0 1510107.1 -181132.3 1510104.1 -181133.3 1510102.0 -181132.1 1510099.2 -181123.3</map-coordinates>
+                        <map-span class="door leaflet-interactive" tabindex="0" aria-label="door" style="stroke: yellow; stroke-width: 4px">1510104.9 -181125.0 1510105.20 -181126</map-span> 1510106.1 -181129.0 1510107.1 -181132.3 1510104.1 -181133.3 1510102.0 -181132.1 1510099.2 -181123.3</map-coordinates>
                     </map-polygon>
                     <map-polygon>
                         <map-coordinates>1510108.2 -181118.9 1510109.7 -181123.4 1510104.9 -181124.9 1510103.9 -181121.5 1510105.3 -181121.0 1510105.4 -181121.4 1510105.7 -181121.3 1510105.3 -181119.8 1510108.2 -181118.9</map-coordinates>
diff --git a/multiple-extents/dist/images/layers-2x.png b/multiple-extents/dist/images/layers-2x.png
deleted file mode 100644
index 200c333dca9652ac4cba004d609e5af4eee168c1..0000000000000000000000000000000000000000
GIT binary patch
diff --git a/multiple-extents/dist/images/layers.png b/multiple-extents/dist/images/layers.png
deleted file mode 100644
index 1a72e5784b2b456eac5d7670738db80697af3377..0000000000000000000000000000000000000000
GIT binary patch
diff --git a/multiple-extents/dist/images/marker-icon-2x.png b/multiple-extents/dist/images/marker-icon-2x.png
deleted file mode 100644
index 88f9e501888c9c6cb29ad340d9a888627dd1b6d8..0000000000000000000000000000000000000000
GIT binary patch
diff --git a/multiple-extents/dist/images/marker-icon.png b/multiple-extents/dist/images/marker-icon.png
deleted file mode 100644
index 950edf24677ded147df13b26f91baa2b0fa70513..0000000000000000000000000000000000000000
GIT binary patch
diff --git a/multiple-extents/dist/images/marker-shadow.png b/multiple-extents/dist/images/marker-shadow.png
deleted file mode 100644
index 9fd2979532a19a15b824ce763c76e04a8dafadfb..0000000000000000000000000000000000000000
GIT binary patch
diff --git a/multiple-extents/dist/index.html b/multiple-extents/dist/index.html
deleted file mode 100644
index 753657e..0000000
--- a/multiple-extents/dist/index.html
+++ /dev/null
@@ -1,79 +0,0 @@
-<!doctype html>
-<html lang="en">
-  <head>
-    <meta charset="utf-8">
-    <meta name="viewport" content="width=device-width,initial-scale=1">
-    <title>index-map.html</title>
-    <script type="module" src="dist/mapml-viewer.js"></script>
-     <style> 
-       html, 
-       body { 
-         height: 100%; 
-       } 
-       * { 
-         margin: 0; 
-         padding: 0; 
-       } 
-        
-       /* Specifying the `:defined` selector is recommended to style the map 
-       element, such that styles don't apply when fallback content is in use 
-       (e.g. when scripting is disabled or when custom/built-in elements isn't 
-       supported in the browser). */ 
-       mapml-viewer:defined { 
-         /* Responsive map. */ 
-          max-width: 100%;  
-          
-         /* Full viewport. */ 
-          width: 100%;  
-          height: 100%;  
-          
-         /* Remove default (native-like) border. */ 
-         border: none;
-         
-         vertical-align: middle;
-       } 
-        
-       /* Pre-style to avoid FOUC of inline layer- and fallback content. */ 
-       mapml-viewer:not(:defined) > * { 
-         display: none; 
-       } 
-       
-       /* Pre-style to avoid Layout Shift. */
-       mapml-viewer:not(:defined) {
-         display: inline-block;
-         contain: size;
-         contain-intrinsic-size: 304px 154px;
-       }
-       
-       /* Ensure inline layer content is hidden if custom/built-in elements isn't 
-       supported, or if javascript is disabled. This needs to be defined separately 
-       from the above, because the `:not(:defined)` selector invalidates the entire 
-       declaration in browsers that do not support it. */ 
-       layer- { 
-         display: none; 
-       } 
-     </style> 
-     <noscript> 
-       <style> 
-         /* Ensure fallback content (children of the map element) is displayed if 
-         custom/built-in elements is supported but javascript is disabled. */ 
-         mapml-viewer:not(:defined) > :not(layer-) { 
-           display: initial; 
-         } 
-         
-         /* "Reset" the properties used to pre-style (to avoid Layout Shift) if
-         custom/built-in elements is supported but javascript is disabled. */
-         mapml-viewer:not(:defined) {
-           display: initial;
-           contain: initial;
-           contain-intrinsic-size: initial;
-         }
-       </style> 
-     </noscript> 
-  </head>
-  <body>
-    <mapml-viewer projection="CBMTILE" zoom="2" lat="45" lon="-90" controls>
-      <layer- label="CBMT" src="https://geogratis.gc.ca/mapml/en/cbmtile/cbmt/" checked></layer->
-    </mapml-viewer>
-  </body>
-</html>
diff --git a/multiple-extents/dist/layer.js b/multiple-extents/dist/layer.js
deleted file mode 100644
index 566494e..0000000
--- a/multiple-extents/dist/layer.js
+++ /dev/null
@@ -1,368 +0,0 @@
-import './leaflet-src.js';  // a lightly modified version of Leaflet for use as browser module
-import './proj4-src.js';        // modified version of proj4; could be stripped down for mapml
-import './proj4leaflet.js'; // not modified, seems to adapt proj4 for leaflet use. 
-import './mapml.js';       // modified URI to make the function a property of window scope (possibly a bad thing to do).
-
-export class MapLayer extends HTMLElement {
-  static get observedAttributes() {
-    return ['src', 'label', 'checked', 'hidden'];
-  }
-  get src() {
-    return this.hasAttribute('src')?this.getAttribute('src'):'';
-  }
-
-  set src(val) {
-    if (val) {
-      this.setAttribute('src', val);
-      if (this._layer) {
-        let oldOpacity = this.opacity;
-        // go through the same sequence as if the layer had been removed from
-        // the DOM and re-attached with a new URL source.
-        this.disconnectedCallback();
-        var base = this.baseURI ? this.baseURI : document.baseURI;
-        this._layer = M.mapMLLayer(val ? (new URL(val, base)).href: null, this);
-        this._layer.on('extentload', this._onLayerExtentLoad, this);
-        this._setUpEvents();
-        if (this.parentNode) {
-          this.connectedCallback();
-        }
-        this.opacity = oldOpacity;
-      }
-    }
-  }
-  get label() {
-    return this.hasAttribute('label')?this.getAttribute('label'):'';
-  }
-  set label(val) {
-    if (val) {
-      this.setAttribute('label',val);
-    }
-  }
-  get checked() {
-    return this.hasAttribute('checked');
-  }
-  
-  set checked(val) {
-    if (val) {
-      this.setAttribute('checked', '');
-    } else {
-      this.removeAttribute('checked');
-    }
-  }
-  
-  get hidden() {
-    return this.hasAttribute('hidden');
-  }
-
-  set hidden(val) {
-    if (val) {
-      this.setAttribute('hidden', '');
-    } else {
-      this.removeAttribute('hidden');
-    }
-  }
-
-  get opacity(){
-    return this._layer._container.style.opacity || this._layer.options.opacity;
-  }
-
-  set opacity(val) {
-    if(+val > 1 || +val < 0) return;
-    this._layer.changeOpacity(val);
-  }
-
-  constructor() {
-    // Always call super first in constructor
-    super();
-  }
-  disconnectedCallback() {
-//    console.log('Custom map element removed from page.');
-    // if the map-layer node is removed from the dom, the layer should be
-    // removed from the map and the layer control 
-
-    // this is moved up here so that the layer control doesn't respond
-    // to the layer being removed with the _onLayerChange execution
-    // that is set up in _attached:
-    if(this.hasAttribute("data-moving")) return;
-    this._removeEvents();
-    if (this._layer._map) {
-      this._layer._map.removeLayer(this._layer);
-    }
-
-    if (this._layerControl && !this.hidden) {
-      this._layerControl.removeLayer(this._layer);
-    }
-  }
-  connectedCallback() {
-    //creates listener that waits for createmap event, this allows for delayed builds of maps
-    //this allows a safeguard for the case where loading a custom TCRS takes longer than loading mapml-viewer.js/web-map.js
-    if(this.hasAttribute("data-moving")) return;
-    this.parentNode.addEventListener('createmap', ()=>{
-      this._ready();
-      // if the map has been attached, set this layer up wrt Leaflet map
-      if (this.parentNode._map) {
-          this._attachedToMap();
-      }
-      if (this._layerControl && !this.hidden) {
-        this._layerControl.addOrUpdateOverlay(this._layer, this.label);
-      }
-    }, {once:true}); //listener stops listening after event occurs once
-    //if map is already created then dispatch createmap event, allowing layer to be built
-    if(this.parentNode._map)this.parentNode.dispatchEvent(new CustomEvent('createmap'));
-  }
-  adoptedCallback() {
-//    console.log('Custom map element moved to new page.');
-  }
-  attributeChangedCallback(name, oldValue, newValue) {
-    switch(name) {
-      case 'label': 
-        if (oldValue !== newValue) {
-          this.dispatchEvent(new CustomEvent('labelchanged', {detail: 
-            {target: this}}));
-        }
-      break;
-      case 'checked': 
-        if (this._layer) {
-          if (typeof newValue === "string") {
-            this.parentElement._map.addLayer(this._layer);
-          } else {
-            this._layer._removeExtents(this.parentElement._map);
-            this.parentElement._map.removeLayer(this._layer);
-          }
-          this.dispatchEvent(new Event("change", { bubbles: true }));
-        }
-      break;
-    case 'hidden':
-      var map = this.parentElement && this.parentElement._map;
-      if (map && this.parentElement.controls) {
-          if (typeof newValue === "string") {
-              if (this._layer) {
-                this.parentElement._layerControl.removeLayer(this._layer);
-              }
-          } else {
-              this._layerControl = this.parentElement._layerControl;
-              this._layerControl.addOrUpdateOverlay(this._layer, this.label);
-              this._validateDisabled();
-          }
-      }
-      break;
-    }
-  }
-  _onLayerExtentLoad(e) {
-    // the mapml document associated to this layer can in theory contain many
-    // link[@rel=legend] elements with different @type or other attributes;
-    // currently only support a single link, don't care about type, lang etc.
-    // TODO: add support for full LayerLegend object, and > one link.
-    if (this._layer._legendUrl) {
-      this.legendLinks = 
-        [{ type: 'application/octet-stream',
-           href: this._layer._legendUrl,
-           rel: 'legend',
-           lang: null,
-           hreflang: null,
-           sizes: null }];
-    }
-    if (this._layer._title) {
-      this.label = this._layer._title;
-    }
-    // make sure local content layer has the chance to set its extent properly
-    // which is important for the layer control and the disabled property
-    if (this._layer._map) {
-      this._layer.fire('attached', this._layer);
-    }
-    // TODO ensure the controls in this._layerControl contain 'live' controls
-    // which control the layer, not potentially the previous style / src
-    if (this._layerControl) {
-      this._layerControl.addOrUpdateOverlay(this._layer, this.label);
-    }
-    if (!this._layer.error) {
-      // re-use 'loadedmetadata' event from HTMLMediaElement inteface, applied
-      // to MapML extent as metadata
-      // https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/loadedmetadata_event
-      this.dispatchEvent(new CustomEvent('loadedmetadata', {detail: 
-                {target: this}}));
-    } else {
-      this.dispatchEvent(new CustomEvent('error', {detail: 
-                {target: this}}));
-    }
-  }
-  _validateDisabled() {
-    setTimeout(() => {
-      let layer = this._layer, map = layer._map;
-      if (map) {
-        let count = 0, total=0, layerTypes = ["_staticTileLayer","_imageLayer","_mapmlvectors","_templatedLayer"];
-        if(layer.validProjection){
-          for(let j = 0 ;j<layerTypes.length;j++){
-            let type = layerTypes[j];
-            if(this.checked && layer[type]){
-              if(type === "_templatedLayer"){
-                for(let i =0;i<layer._extent._mapExtents.length;i++){
-                  for(let j = 0; j < layer._extent._mapExtents[i].templatedLayer._templates.length; j++){
-                    if(layer._extent._mapExtents[i].templatedLayer._templates[j].rel ==="query") continue;
-                    total++;
-                    layer._extent._mapExtents[i].removeAttribute("disabled");
-                    layer._extent._mapExtents[i].disabled = false;
-                    if(!(layer._extent._mapExtents[i].templatedLayer._templates[j].layer.isVisible)){
-                      count++;
-                      layer._extent._mapExtents[i].setAttribute("disabled", "");
-                      layer._extent._mapExtents[i].disabled = true;
-                    }
-                  }  
-                }
-              } else {
-                total++;
-                  if(!(layer[type].isVisible))count++;
-              }
-            }
-          }
-        } else{
-          count = 1;
-          total = 1;
-        }
-
-        if(count === total && count !== 0){
-          this.setAttribute("disabled", ""); //set a disabled attribute on the layer element
-          this.disabled = true;
-        } else {
-          //might be better not to disable the layer controls, might want to deselect layer even when its out of bounds
-          this.removeAttribute("disabled");
-          this.disabled = false;
-        }
-        map.fire("validate");
-      }
-    }, 0);
-  }
-  _onLayerChange() {
-    if (this._layer._map) {
-     // can't disable observers, have to set a flag telling it where
-     // the 'event' comes from: either the api or a user click/tap
-     // may not be necessary -> this._apiToggleChecked = false;
-     this.checked = this._layer._map.hasLayer(this._layer);
-    }
-  }
-  _ready() {
-    // the layer might not be attached to a map
-    // so we need a way for non-src based layers to establish what their
-    // zoom range, extent and projection are.  meta elements in content to
-    // allow the author to provide this explicitly are one way, they will
-    // be parsed from the second parameter here
-    // IE 11 did not have a value for this.baseURI for some reason
-    var base = this.baseURI ? this.baseURI : document.baseURI;
-    this._layer = M.mapMLLayer(this.src ? (new URL(this.src, base)).href: null, this, {mapprojection:this.parentElement._map.options.projection});
-    this._layer.on('extentload', this._onLayerExtentLoad, this);
-    this._setUpEvents();
-  }
-  _attachedToMap() {
-    // set i to the position of this layer element in the set of layers
-    var i = 0, position = 1;
-    for (var nodes = this.parentNode.children;i < nodes.length;i++) {
-      if (this.parentNode.children[i].nodeName === "LAYER-") {
-        if (this.parentNode.children[i] === this) {
-          position = i + 1;
-        } else if (this.parentNode.children[i]._layer) {
-          this.parentNode.children[i]._layer.setZIndex(i+1);
-        }
-      }
-    }
-    var proj = this.parentNode.projection ? this.parentNode.projection : "OSMTILE";
-    L.setOptions(this._layer, {zIndex: position, mapprojection: proj, opacity: window.getComputedStyle(this).opacity});
-    // make sure the Leaflet layer has a reference to the map
-    this._layer._map = this.parentNode._map;
-    // notify the layer that it is attached to a map (layer._map)
-    this._layer.fire('attached');
-
-    if (this.checked) {
-      this._layer.addTo(this._layer._map);
-    }
-    
-    // add the handler which toggles the 'checked' property based on the
-    // user checking/unchecking the layer from the layer control
-    // this must be done *after* the layer is actually added to the map
-    this._layer.on('add remove', this._onLayerChange,  this);
-    this._layer.on('add remove extentload', this._validateDisabled,  this);
-
-    // if controls option is enabled, insert the layer into the overlays array
-    if (this.parentNode._layerControl && !this.hidden) {
-      this._layerControl = this.parentNode._layerControl;
-      this._layerControl.addOrUpdateOverlay(this._layer, this.label);
-    }
-    // toggle the this.disabled attribute depending on whether the layer
-    // is: same prj as map, within view/zoom of map
-    this._layer._map.on('moveend', this._validateDisabled,  this);
-    this._layer._map.on('checkdisabled', this._validateDisabled, this);
-    // this is necessary to get the layer control to compare the layer
-    // extents with the map extent & zoom, but it needs to be rethought TODO
-    // for one thing, layers which are checked by the author before 
-    // adding to the map are displayed despite that they are not visible
-    // See issue #26
-//        this._layer._map.fire('moveend');
-  }
-  _removeEvents() {
-    if (this._layer) {
-      this._layer.off('loadstart', false, this);
-      this._layer.off('changestyle', false, this);
-      this._layer.off('add remove', this._onLayerChange,  this);
-    }
-  }
-  _setUpEvents() {
-    this._layer.on('loadstart', 
-        function () {
-            this.dispatchEvent(new CustomEvent('loadstart', {detail: 
-              {target: this}}));
-        }, this);      
-    this._layer.on('changestyle',
-        function(e) {
-          this.src = e.src;
-          this.dispatchEvent(new CustomEvent('changestyle', {detail: 
-              {target: this}}));
-        },this);
-    this._layer.on('changeprojection',
-        function(e) {
-          this.src = e.href;
-          this.dispatchEvent(new CustomEvent('changeprojection', {detail: 
-              {target: this}}));
-        },this);
-  }
-  focus(){
-    if(!this.extent) return;
-    let map = this._layer._map,
-      tL = this.extent.topLeft.pcrs,
-      bR = this.extent.bottomRight.pcrs,
-      layerBounds = L.bounds(L.point(tL.horizontal, tL.vertical), L.point(bR.horizontal, bR.vertical)),
-      center = map.options.crs.unproject(layerBounds.getCenter(true)),
-      newZoom = map.getZoom();
-
-    let maxZoom = this.extent.zoom.maxZoom, minZoom = this.extent.zoom.minZoom;
-
-    let scale = map.options.crs.scale(newZoom),
-      mapCenterTCRS = map.options.crs.transformation.transform(layerBounds.getCenter(true), scale);
-
-    let mapHalf = map.getSize().divideBy(2),
-      mapTlNew = mapCenterTCRS.subtract(mapHalf).round(),
-      mapBrNew = mapCenterTCRS.add(mapHalf).round();
-
-    let mapTlPCRSNew = M.pixelToPCRSPoint(mapTlNew, newZoom, map.options.projection),
-      mapBrPCRSNew = M.pixelToPCRSPoint(mapBrNew, newZoom, map.options.projection);
-
-    let mapPCRS = L.bounds(mapTlPCRSNew, mapBrPCRSNew);
-
-    let zOffset = mapPCRS.contains(layerBounds) ? 1 : -1;
-
-    while((zOffset === -1 && !(mapPCRS.contains(layerBounds)) && (newZoom - 1) >= minZoom)  ||
-          (zOffset === 1 && mapPCRS.contains(layerBounds) && (newZoom + 1) <= maxZoom)) {
-      newZoom += zOffset;
-
-      scale = map.options.crs.scale(newZoom);
-      mapCenterTCRS = map.options.crs.transformation.transform(layerBounds.getCenter(true), scale);
-
-      mapTlNew = mapCenterTCRS.subtract(mapHalf).round();
-      mapBrNew = mapCenterTCRS.add(mapHalf).round();
-      mapTlPCRSNew = M.pixelToPCRSPoint(mapTlNew, newZoom, map.options.projection);
-      mapBrPCRSNew = M.pixelToPCRSPoint(mapBrNew, newZoom, map.options.projection);
-
-      mapPCRS = L.bounds(mapTlPCRSNew, mapBrPCRSNew);
-    }
-    if(zOffset === 1 && newZoom - 1 >= 0) newZoom--;
-    map.setView(center, newZoom, {animate: false});
-  }
-}
diff --git a/multiple-extents/dist/leaflet-src.js b/multiple-extents/dist/leaflet-src.js
deleted file mode 100644
index 503e5fc..0000000
--- a/multiple-extents/dist/leaflet-src.js
+++ /dev/null
@@ -1,14062 +0,0 @@
-/* @preserve
- * Leaflet 1.7.1, a JS library for interactive maps. http://leafletjs.com
- * (c) 2010-2019 Vladimir Agafonkin, (c) 2010-2011 CloudMade
- */
-
-(function (global, factory) {
-  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
-  typeof define === 'function' && define.amd ? define(['exports'], factory) :
-  (factory((global.L = {})));
-}(window, (function (exports) { 'use strict';
-
-  var version = "1.7.1";
-
-  /*
-   * @namespace Util
-   *
-   * Various utility functions, used by Leaflet internally.
-   */
-
-  // @function extend(dest: Object, src?: Object): Object
-  // Merges the properties of the `src` object (or multiple objects) into `dest` object and returns the latter. Has an `L.extend` shortcut.
-  function extend(dest) {
-  	var i, j, len, src;
-
-  	for (j = 1, len = arguments.length; j < len; j++) {
-  		src = arguments[j];
-  		for (i in src) {
-  			dest[i] = src[i];
-  		}
-  	}
-  	return dest;
-  }
-
-  // @function create(proto: Object, properties?: Object): Object
-  // Compatibility polyfill for [Object.create](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/create)
-  var create = Object.create || (function () {
-  	function F() {}
-  	return function (proto) {
-  		F.prototype = proto;
-  		return new F();
-  	};
-  })();
-
-  // @function bind(fn: Function, …): Function
-  // Returns a new function bound to the arguments passed, like [Function.prototype.bind](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function/bind).
-  // Has a `L.bind()` shortcut.
-  function bind(fn, obj) {
-  	var slice = Array.prototype.slice;
-
-  	if (fn.bind) {
-  		return fn.bind.apply(fn, slice.call(arguments, 1));
-  	}
-
-  	var args = slice.call(arguments, 2);
-
-  	return function () {
-  		return fn.apply(obj, args.length ? args.concat(slice.call(arguments)) : arguments);
-  	};
-  }
-
-  // @property lastId: Number
-  // Last unique ID used by [`stamp()`](#util-stamp)
-  var lastId = 0;
-
-  // @function stamp(obj: Object): Number
-  // Returns the unique ID of an object, assigning it one if it doesn't have it.
-  function stamp(obj) {
-  	/*eslint-disable */
-  	obj._leaflet_id = obj._leaflet_id || ++lastId;
-  	return obj._leaflet_id;
-  	/* eslint-enable */
-  }
-
-  // @function throttle(fn: Function, time: Number, context: Object): Function
-  // Returns a function which executes function `fn` with the given scope `context`
-  // (so that the `this` keyword refers to `context` inside `fn`'s code). The function
-  // `fn` will be called no more than one time per given amount of `time`. The arguments
-  // received by the bound function will be any arguments passed when binding the
-  // function, followed by any arguments passed when invoking the bound function.
-  // Has an `L.throttle` shortcut.
-  function throttle(fn, time, context) {
-  	var lock, args, wrapperFn, later;
-
-  	later = function () {
-  		// reset lock and call if queued
-  		lock = false;
-  		if (args) {
-  			wrapperFn.apply(context, args);
-  			args = false;
-  		}
-  	};
-
-  	wrapperFn = function () {
-  		if (lock) {
-  			// called too soon, queue to call later
-  			args = arguments;
-
-  		} else {
-  			// call and lock until later
-  			fn.apply(context, arguments);
-  			setTimeout(later, time);
-  			lock = true;
-  		}
-  	};
-
-  	return wrapperFn;
-  }
-
-  // @function wrapNum(num: Number, range: Number[], includeMax?: Boolean): Number
-  // Returns the number `num` modulo `range` in such a way so it lies within
-  // `range[0]` and `range[1]`. The returned value will be always smaller than
-  // `range[1]` unless `includeMax` is set to `true`.
-  function wrapNum(x, range, includeMax) {
-  	var max = range[1],
-  	    min = range[0],
-  	    d = max - min;
-  	return x === max && includeMax ? x : ((x - min) % d + d) % d + min;
-  }
-
-  // @function falseFn(): Function
-  // Returns a function which always returns `false`.
-  function falseFn() { return false; }
-
-  // @function formatNum(num: Number, digits?: Number): Number
-  // Returns the number `num` rounded to `digits` decimals, or to 6 decimals by default.
-  function formatNum(num, digits) {
-  	var pow = Math.pow(10, (digits === undefined ? 6 : digits));
-  	return Math.round(num * pow) / pow;
-  }
-
-  // @function trim(str: String): String
-  // Compatibility polyfill for [String.prototype.trim](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim)
-  function trim(str) {
-  	return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, '');
-  }
-
-  // @function splitWords(str: String): String[]
-  // Trims and splits the string on whitespace and returns the array of parts.
-  function splitWords(str) {
-  	return trim(str).split(/\s+/);
-  }
-
-  // @function setOptions(obj: Object, options: Object): Object
-  // Merges the given properties to the `options` of the `obj` object, returning the resulting options. See `Class options`. Has an `L.setOptions` shortcut.
-  function setOptions(obj, options) {
-  	if (!Object.prototype.hasOwnProperty.call(obj, 'options')) {
-  		obj.options = obj.options ? create(obj.options) : {};
-  	}
-  	for (var i in options) {
-  		obj.options[i] = options[i];
-  	}
-  	return obj.options;
-  }
-
-  // @function getParamString(obj: Object, existingUrl?: String, uppercase?: Boolean): String
-  // Converts an object into a parameter URL string, e.g. `{a: "foo", b: "bar"}`
-  // translates to `'?a=foo&b=bar'`. If `existingUrl` is set, the parameters will
-  // be appended at the end. If `uppercase` is `true`, the parameter names will
-  // be uppercased (e.g. `'?A=foo&B=bar'`)
-  function getParamString(obj, existingUrl, uppercase) {
-  	var params = [];
-  	for (var i in obj) {
-  		params.push(encodeURIComponent(uppercase ? i.toUpperCase() : i) + '=' + encodeURIComponent(obj[i]));
-  	}
-  	return ((!existingUrl || existingUrl.indexOf('?') === -1) ? '?' : '&') + params.join('&');
-  }
-
-  var templateRe = /\{ *([\w_-]+) *\}/g;
-
-  // @function template(str: String, data: Object): String
-  // Simple templating facility, accepts a template string of the form `'Hello {a}, {b}'`
-  // and a data object like `{a: 'foo', b: 'bar'}`, returns evaluated string
-  // `('Hello foo, bar')`. You can also specify functions instead of strings for
-  // data values — they will be evaluated passing `data` as an argument.
-  function template(str, data) {
-  	return str.replace(templateRe, function (str, key) {
-  		var value = data[key];
-
-  		if (value === undefined) {
-  			throw new Error('No value provided for variable ' + str);
-
-  		} else if (typeof value === 'function') {
-  			value = value(data);
-  		}
-  		return value;
-  	});
-  }
-
-  // @function isArray(obj): Boolean
-  // Compatibility polyfill for [Array.isArray](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray)
-  var isArray = Array.isArray || function (obj) {
-  	return (Object.prototype.toString.call(obj) === '[object Array]');
-  };
-
-  // @function indexOf(array: Array, el: Object): Number
-  // Compatibility polyfill for [Array.prototype.indexOf](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf)
-  function indexOf(array, el) {
-  	for (var i = 0; i < array.length; i++) {
-  		if (array[i] === el) { return i; }
-  	}
-  	return -1;
-  }
-
-  // @property emptyImageUrl: String
-  // Data URI string containing a base64-encoded empty GIF image.
-  // Used as a hack to free memory from unused images on WebKit-powered
-  // mobile devices (by setting image `src` to this string).
-  var emptyImageUrl = 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=';
-
-  // inspired by http://paulirish.com/2011/requestanimationframe-for-smart-animating/
-
-  function getPrefixed(name) {
-  	return window['webkit' + name] || window['moz' + name] || window['ms' + name];
-  }
-
-  var lastTime = 0;
-
-  // fallback for IE 7-8
-  function timeoutDefer(fn) {
-  	var time = +new Date(),
-  	    timeToCall = Math.max(0, 16 - (time - lastTime));
-
-  	lastTime = time + timeToCall;
-  	return window.setTimeout(fn, timeToCall);
-  }
-
-  var requestFn = window.requestAnimationFrame || getPrefixed('RequestAnimationFrame') || timeoutDefer;
-  var cancelFn = window.cancelAnimationFrame || getPrefixed('CancelAnimationFrame') ||
-  		getPrefixed('CancelRequestAnimationFrame') || function (id) { window.clearTimeout(id); };
-
-  // @function requestAnimFrame(fn: Function, context?: Object, immediate?: Boolean): Number
-  // Schedules `fn` to be executed when the browser repaints. `fn` is bound to
-  // `context` if given. When `immediate` is set, `fn` is called immediately if
-  // the browser doesn't have native support for
-  // [`window.requestAnimationFrame`](https://developer.mozilla.org/docs/Web/API/window/requestAnimationFrame),
-  // otherwise it's delayed. Returns a request ID that can be used to cancel the request.
-  function requestAnimFrame(fn, context, immediate) {
-  	if (immediate && requestFn === timeoutDefer) {
-  		fn.call(context);
-  	} else {
-  		return requestFn.call(window, bind(fn, context));
-  	}
-  }
-
-  // @function cancelAnimFrame(id: Number): undefined
-  // Cancels a previous `requestAnimFrame`. See also [window.cancelAnimationFrame](https://developer.mozilla.org/docs/Web/API/window/cancelAnimationFrame).
-  function cancelAnimFrame(id) {
-  	if (id) {
-  		cancelFn.call(window, id);
-  	}
-  }
-
-  var Util = ({
-    extend: extend,
-    create: create,
-    bind: bind,
-    lastId: lastId,
-    stamp: stamp,
-    throttle: throttle,
-    wrapNum: wrapNum,
-    falseFn: falseFn,
-    formatNum: formatNum,
-    trim: trim,
-    splitWords: splitWords,
-    setOptions: setOptions,
-    getParamString: getParamString,
-    template: template,
-    isArray: isArray,
-    indexOf: indexOf,
-    emptyImageUrl: emptyImageUrl,
-    requestFn: requestFn,
-    cancelFn: cancelFn,
-    requestAnimFrame: requestAnimFrame,
-    cancelAnimFrame: cancelAnimFrame
-  });
-
-  // @class Class
-  // @aka L.Class
-
-  // @section
-  // @uninheritable
-
-  // Thanks to John Resig and Dean Edwards for inspiration!
-
-  function Class() {}
-
-  Class.extend = function (props) {
-
-  	// @function extend(props: Object): Function
-  	// [Extends the current class](#class-inheritance) given the properties to be included.
-  	// Returns a Javascript function that is a class constructor (to be called with `new`).
-  	var NewClass = function () {
-
-  		// call the constructor
-  		if (this.initialize) {
-  			this.initialize.apply(this, arguments);
-  		}
-
-  		// call all constructor hooks
-  		this.callInitHooks();
-  	};
-
-  	var parentProto = NewClass.__super__ = this.prototype;
-
-  	var proto = create(parentProto);
-  	proto.constructor = NewClass;
-
-  	NewClass.prototype = proto;
-
-  	// inherit parent's statics
-  	for (var i in this) {
-  		if (Object.prototype.hasOwnProperty.call(this, i) && i !== 'prototype' && i !== '__super__') {
-  			NewClass[i] = this[i];
-  		}
-  	}
-
-  	// mix static properties into the class
-  	if (props.statics) {
-  		extend(NewClass, props.statics);
-  		delete props.statics;
-  	}
-
-  	// mix includes into the prototype
-  	if (props.includes) {
-  		checkDeprecatedMixinEvents(props.includes);
-  		extend.apply(null, [proto].concat(props.includes));
-  		delete props.includes;
-  	}
-
-  	// merge options
-  	if (proto.options) {
-  		props.options = extend(create(proto.options), props.options);
-  	}
-
-  	// mix given properties into the prototype
-  	extend(proto, props);
-
-  	proto._initHooks = [];
-
-  	// add method for calling all hooks
-  	proto.callInitHooks = function () {
-
-  		if (this._initHooksCalled) { return; }
-
-  		if (parentProto.callInitHooks) {
-  			parentProto.callInitHooks.call(this);
-  		}
-
-  		this._initHooksCalled = true;
-
-  		for (var i = 0, len = proto._initHooks.length; i < len; i++) {
-  			proto._initHooks[i].call(this);
-  		}
-  	};
-
-  	return NewClass;
-  };
-
-
-  // @function include(properties: Object): this
-  // [Includes a mixin](#class-includes) into the current class.
-  Class.include = function (props) {
-  	extend(this.prototype, props);
-  	return this;
-  };
-
-  // @function mergeOptions(options: Object): this
-  // [Merges `options`](#class-options) into the defaults of the class.
-  Class.mergeOptions = function (options) {
-  	extend(this.prototype.options, options);
-  	return this;
-  };
-
-  // @function addInitHook(fn: Function): this
-  // Adds a [constructor hook](#class-constructor-hooks) to the class.
-  Class.addInitHook = function (fn) { // (Function) || (String, args...)
-  	var args = Array.prototype.slice.call(arguments, 1);
-
-  	var init = typeof fn === 'function' ? fn : function () {
-  		this[fn].apply(this, args);
-  	};
-
-  	this.prototype._initHooks = this.prototype._initHooks || [];
-  	this.prototype._initHooks.push(init);
-  	return this;
-  };
-
-  function checkDeprecatedMixinEvents(includes) {
-  	if (typeof L === 'undefined' || !L || !L.Mixin) { return; }
-
-  	includes = isArray(includes) ? includes : [includes];
-
-  	for (var i = 0; i < includes.length; i++) {
-  		if (includes[i] === L.Mixin.Events) {
-  			console.warn('Deprecated include of L.Mixin.Events: ' +
-  				'this property will be removed in future releases, ' +
-  				'please inherit from L.Evented instead.', new Error().stack);
-  		}
-  	}
-  }
-
-  /*
-   * @class Evented
-   * @aka L.Evented
-   * @inherits Class
-   *
-   * A set of methods shared between event-powered classes (like `Map` and `Marker`). Generally, events allow you to execute some function when something happens with an object (e.g. the user clicks on the map, causing the map to fire `'click'` event).
-   *
-   * @example
-   *
-   * ```js
-   * map.on('click', function(e) {
-   * 	alert(e.latlng);
-   * } );
-   * ```
-   *
-   * Leaflet deals with event listeners by reference, so if you want to add a listener and then remove it, define it as a function:
-   *
-   * ```js
-   * function onClick(e) { ... }
-   *
-   * map.on('click', onClick);
-   * map.off('click', onClick);
-   * ```
-   */
-
-  var Events = {
-  	/* @method on(type: String, fn: Function, context?: Object): this
-  	 * Adds a listener function (`fn`) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. `'click dblclick'`).
-  	 *
-  	 * @alternative
-  	 * @method on(eventMap: Object): this
-  	 * Adds a set of type/listener pairs, e.g. `{click: onClick, mousemove: onMouseMove}`
-  	 */
-  	on: function (types, fn, context) {
-
-  		// types can be a map of types/handlers
-  		if (typeof types === 'object') {
-  			for (var type in types) {
-  				// we don't process space-separated events here for performance;
-  				// it's a hot path since Layer uses the on(obj) syntax
-  				this._on(type, types[type], fn);
-  			}
-
-  		} else {
-  			// types can be a string of space-separated words
-  			types = splitWords(types);
-
-  			for (var i = 0, len = types.length; i < len; i++) {
-  				this._on(types[i], fn, context);
-  			}
-  		}
-
-  		return this;
-  	},
-
-  	/* @method off(type: String, fn?: Function, context?: Object): this
-  	 * Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to `on`, you must pass the same context to `off` in order to remove the listener.
-  	 *
-  	 * @alternative
-  	 * @method off(eventMap: Object): this
-  	 * Removes a set of type/listener pairs.
-  	 *
-  	 * @alternative
-  	 * @method off: this
-  	 * Removes all listeners to all events on the object. This includes implicitly attached events.
-  	 */
-  	off: function (types, fn, context) {
-
-  		if (!types) {
-  			// clear all listeners if called without arguments
-  			delete this._events;
-
-  		} else if (typeof types === 'object') {
-  			for (var type in types) {
-  				this._off(type, types[type], fn);
-  			}
-
-  		} else {
-  			types = splitWords(types);
-
-  			for (var i = 0, len = types.length; i < len; i++) {
-  				this._off(types[i], fn, context);
-  			}
-  		}
-
-  		return this;
-  	},
-
-  	// attach listener (without syntactic sugar now)
-  	_on: function (type, fn, context) {
-  		this._events = this._events || {};
-
-  		/* get/init listeners for type */
-  		var typeListeners = this._events[type];
-  		if (!typeListeners) {
-  			typeListeners = [];
-  			this._events[type] = typeListeners;
-  		}
-
-  		if (context === this) {
-  			// Less memory footprint.
-  			context = undefined;
-  		}
-  		var newListener = {fn: fn, ctx: context},
-  		    listeners = typeListeners;
-
-  		// check if fn already there
-  		for (var i = 0, len = listeners.length; i < len; i++) {
-  			if (listeners[i].fn === fn && listeners[i].ctx === context) {
-  				return;
-  			}
-  		}
-
-  		listeners.push(newListener);
-  	},
-
-  	_off: function (type, fn, context) {
-  		var listeners,
-  		    i,
-  		    len;
-
-  		if (!this._events) { return; }
-
-  		listeners = this._events[type];
-
-  		if (!listeners) {
-  			return;
-  		}
-
-  		if (!fn) {
-  			// Set all removed listeners to noop so they are not called if remove happens in fire
-  			for (i = 0, len = listeners.length; i < len; i++) {
-  				listeners[i].fn = falseFn;
-  			}
-  			// clear all listeners for a type if function isn't specified
-  			delete this._events[type];
-  			return;
-  		}
-
-  		if (context === this) {
-  			context = undefined;
-  		}
-
-  		if (listeners) {
-
-  			// find fn and remove it
-  			for (i = 0, len = listeners.length; i < len; i++) {
-  				var l = listeners[i];
-  				if (l.ctx !== context) { continue; }
-  				if (l.fn === fn) {
-
-  					// set the removed listener to noop so that's not called if remove happens in fire
-  					l.fn = falseFn;
-
-  					if (this._firingCount) {
-  						/* copy array in case events are being fired */
-  						this._events[type] = listeners = listeners.slice();
-  					}
-  					listeners.splice(i, 1);
-
-  					return;
-  				}
-  			}
-  		}
-  	},
-
-  	// @method fire(type: String, data?: Object, propagate?: Boolean): this
-  	// Fires an event of the specified type. You can optionally provide an data
-  	// object — the first argument of the listener function will contain its
-  	// properties. The event can optionally be propagated to event parents.
-  	fire: function (type, data, propagate) {
-  		if (!this.listens(type, propagate)) { return this; }
-
-  		var event = extend({}, data, {
-  			type: type,
-  			target: this,
-  			sourceTarget: data && data.sourceTarget || this
-  		});
-
-  		if (this._events) {
-  			var listeners = this._events[type];
-
-  			if (listeners) {
-  				this._firingCount = (this._firingCount + 1) || 1;
-  				for (var i = 0, len = listeners.length; i < len; i++) {
-  					var l = listeners[i];
-  					l.fn.call(l.ctx || this, event);
-  				}
-
-  				this._firingCount--;
-  			}
-  		}
-
-  		if (propagate) {
-  			// propagate the event to parents (set with addEventParent)
-  			this._propagateEvent(event);
-  		}
-
-  		return this;
-  	},
-
-  	// @method listens(type: String): Boolean
-  	// Returns `true` if a particular event type has any listeners attached to it.
-  	listens: function (type, propagate) {
-  		var listeners = this._events && this._events[type];
-  		if (listeners && listeners.length) { return true; }
-
-  		if (propagate) {
-  			// also check parents for listeners if event propagates
-  			for (var id in this._eventParents) {
-  				if (this._eventParents[id].listens(type, propagate)) { return true; }
-  			}
-  		}
-  		return false;
-  	},
-
-  	// @method once(…): this
-  	// Behaves as [`on(…)`](#evented-on), except the listener will only get fired once and then removed.
-  	once: function (types, fn, context) {
-
-  		if (typeof types === 'object') {
-  			for (var type in types) {
-  				this.once(type, types[type], fn);
-  			}
-  			return this;
-  		}
-
-  		var handler = bind(function () {
-  			this
-  			    .off(types, fn, context)
-  			    .off(types, handler, context);
-  		}, this);
-
-  		// add a listener that's executed once and removed after that
-  		return this
-  		    .on(types, fn, context)
-  		    .on(types, handler, context);
-  	},
-
-  	// @method addEventParent(obj: Evented): this
-  	// Adds an event parent - an `Evented` that will receive propagated events
-  	addEventParent: function (obj) {
-  		this._eventParents = this._eventParents || {};
-  		this._eventParents[stamp(obj)] = obj;
-  		return this;
-  	},
-
-  	// @method removeEventParent(obj: Evented): this
-  	// Removes an event parent, so it will stop receiving propagated events
-  	removeEventParent: function (obj) {
-  		if (this._eventParents) {
-  			delete this._eventParents[stamp(obj)];
-  		}
-  		return this;
-  	},
-
-  	_propagateEvent: function (e) {
-  		for (var id in this._eventParents) {
-  			this._eventParents[id].fire(e.type, extend({
-  				layer: e.target,
-  				propagatedFrom: e.target
-  			}, e), true);
-  		}
-  	}
-  };
-
-  // aliases; we should ditch those eventually
-
-  // @method addEventListener(…): this
-  // Alias to [`on(…)`](#evented-on)
-  Events.addEventListener = Events.on;
-
-  // @method removeEventListener(…): this
-  // Alias to [`off(…)`](#evented-off)
-
-  // @method clearAllEventListeners(…): this
-  // Alias to [`off()`](#evented-off)
-  Events.removeEventListener = Events.clearAllEventListeners = Events.off;
-
-  // @method addOneTimeEventListener(…): this
-  // Alias to [`once(…)`](#evented-once)
-  Events.addOneTimeEventListener = Events.once;
-
-  // @method fireEvent(…): this
-  // Alias to [`fire(…)`](#evented-fire)
-  Events.fireEvent = Events.fire;
-
-  // @method hasEventListeners(…): Boolean
-  // Alias to [`listens(…)`](#evented-listens)
-  Events.hasEventListeners = Events.listens;
-
-  var Evented = Class.extend(Events);
-
-  /*
-   * @class Point
-   * @aka L.Point
-   *
-   * Represents a point with `x` and `y` coordinates in pixels.
-   *
-   * @example
-   *
-   * ```js
-   * var point = L.point(200, 300);
-   * ```
-   *
-   * All Leaflet methods and options that accept `Point` objects also accept them in a simple Array form (unless noted otherwise), so these lines are equivalent:
-   *
-   * ```js
-   * map.panBy([200, 300]);
-   * map.panBy(L.point(200, 300));
-   * ```
-   *
-   * Note that `Point` does not inherit from Leaflet's `Class` object,
-   * which means new classes can't inherit from it, and new methods
-   * can't be added to it with the `include` function.
-   */
-
-  function Point(x, y, round) {
-  	// @property x: Number; The `x` coordinate of the point
-  	this.x = (round ? Math.round(x) : x);
-  	// @property y: Number; The `y` coordinate of the point
-  	this.y = (round ? Math.round(y) : y);
-  }
-
-  var trunc = Math.trunc || function (v) {
-  	return v > 0 ? Math.floor(v) : Math.ceil(v);
-  };
-
-  Point.prototype = {
-
-  	// @method clone(): Point
-  	// Returns a copy of the current point.
-  	clone: function () {
-  		return new Point(this.x, this.y);
-  	},
-
-  	// @method add(otherPoint: Point): Point
-  	// Returns the result of addition of the current and the given points.
-  	add: function (point) {
-  		// non-destructive, returns a new point
-  		return this.clone()._add(toPoint(point));
-  	},
-
-  	_add: function (point) {
-  		// destructive, used directly for performance in situations where it's safe to modify existing point
-  		this.x += point.x;
-  		this.y += point.y;
-  		return this;
-  	},
-
-  	// @method subtract(otherPoint: Point): Point
-  	// Returns the result of subtraction of the given point from the current.
-  	subtract: function (point) {
-  		return this.clone()._subtract(toPoint(point));
-  	},
-
-  	_subtract: function (point) {
-  		this.x -= point.x;
-  		this.y -= point.y;
-  		return this;
-  	},
-
-  	// @method divideBy(num: Number): Point
-  	// Returns the result of division of the current point by the given number.
-  	divideBy: function (num) {
-  		return this.clone()._divideBy(num);
-  	},
-
-  	_divideBy: function (num) {
-  		this.x /= num;
-  		this.y /= num;
-  		return this;
-  	},
-
-  	// @method multiplyBy(num: Number): Point
-  	// Returns the result of multiplication of the current point by the given number.
-  	multiplyBy: function (num) {
-  		return this.clone()._multiplyBy(num);
-  	},
-
-  	_multiplyBy: function (num) {
-  		this.x *= num;
-  		this.y *= num;
-  		return this;
-  	},
-
-  	// @method scaleBy(scale: Point): Point
-  	// Multiply each coordinate of the current point by each coordinate of
-  	// `scale`. In linear algebra terms, multiply the point by the
-  	// [scaling matrix](https://en.wikipedia.org/wiki/Scaling_%28geometry%29#Matrix_representation)
-  	// defined by `scale`.
-  	scaleBy: function (point) {
-  		return new Point(this.x * point.x, this.y * point.y);
-  	},
-
-  	// @method unscaleBy(scale: Point): Point
-  	// Inverse of `scaleBy`. Divide each coordinate of the current point by
-  	// each coordinate of `scale`.
-  	unscaleBy: function (point) {
-  		return new Point(this.x / point.x, this.y / point.y);
-  	},
-
-  	// @method round(): Point
-  	// Returns a copy of the current point with rounded coordinates.
-  	round: function () {
-  		return this.clone()._round();
-  	},
-
-  	_round: function () {
-  		this.x = Math.round(this.x);
-  		this.y = Math.round(this.y);
-  		return this;
-  	},
-
-  	// @method floor(): Point
-  	// Returns a copy of the current point with floored coordinates (rounded down).
-  	floor: function () {
-  		return this.clone()._floor();
-  	},
-
-  	_floor: function () {
-  		this.x = Math.floor(this.x);
-  		this.y = Math.floor(this.y);
-  		return this;
-  	},
-
-  	// @method ceil(): Point
-  	// Returns a copy of the current point with ceiled coordinates (rounded up).
-  	ceil: function () {
-  		return this.clone()._ceil();
-  	},
-
-  	_ceil: function () {
-  		this.x = Math.ceil(this.x);
-  		this.y = Math.ceil(this.y);
-  		return this;
-  	},
-
-  	// @method trunc(): Point
-  	// Returns a copy of the current point with truncated coordinates (rounded towards zero).
-  	trunc: function () {
-  		return this.clone()._trunc();
-  	},
-
-  	_trunc: function () {
-  		this.x = trunc(this.x);
-  		this.y = trunc(this.y);
-  		return this;
-  	},
-
-  	// @method distanceTo(otherPoint: Point): Number
-  	// Returns the cartesian distance between the current and the given points.
-  	distanceTo: function (point) {
-  		point = toPoint(point);
-
-  		var x = point.x - this.x,
-  		    y = point.y - this.y;
-
-  		return Math.sqrt(x * x + y * y);
-  	},
-
-  	// @method equals(otherPoint: Point): Boolean
-  	// Returns `true` if the given point has the same coordinates.
-  	equals: function (point) {
-  		point = toPoint(point);
-
-  		return point.x === this.x &&
-  		       point.y === this.y;
-  	},
-
-  	// @method contains(otherPoint: Point): Boolean
-  	// Returns `true` if both coordinates of the given point are less than the corresponding current point coordinates (in absolute values).
-  	contains: function (point) {
-  		point = toPoint(point);
-
-  		return Math.abs(point.x) <= Math.abs(this.x) &&
-  		       Math.abs(point.y) <= Math.abs(this.y);
-  	},
-
-  	// @method toString(): String
-  	// Returns a string representation of the point for debugging purposes.
-  	toString: function () {
-  		return 'Point(' +
-  		        formatNum(this.x) + ', ' +
-  		        formatNum(this.y) + ')';
-  	}
-  };
-
-  // @factory L.point(x: Number, y: Number, round?: Boolean)
-  // Creates a Point object with the given `x` and `y` coordinates. If optional `round` is set to true, rounds the `x` and `y` values.
-
-  // @alternative
-  // @factory L.point(coords: Number[])
-  // Expects an array of the form `[x, y]` instead.
-
-  // @alternative
-  // @factory L.point(coords: Object)
-  // Expects a plain object of the form `{x: Number, y: Number}` instead.
-  function toPoint(x, y, round) {
-  	if (x instanceof Point) {
-  		return x;
-  	}
-  	if (isArray(x)) {
-  		return new Point(x[0], x[1]);
-  	}
-  	if (x === undefined || x === null) {
-  		return x;
-  	}
-  	if (typeof x === 'object' && 'x' in x && 'y' in x) {
-  		return new Point(x.x, x.y);
-  	}
-  	return new Point(x, y, round);
-  }
-
-  /*
-   * @class Bounds
-   * @aka L.Bounds
-   *
-   * Represents a rectangular area in pixel coordinates.
-   *
-   * @example
-   *
-   * ```js
-   * var p1 = L.point(10, 10),
-   * p2 = L.point(40, 60),
-   * bounds = L.bounds(p1, p2);
-   * ```
-   *
-   * All Leaflet methods that accept `Bounds` objects also accept them in a simple Array form (unless noted otherwise), so the bounds example above can be passed like this:
-   *
-   * ```js
-   * otherBounds.intersects([[10, 10], [40, 60]]);
-   * ```
-   *
-   * Note that `Bounds` does not inherit from Leaflet's `Class` object,
-   * which means new classes can't inherit from it, and new methods
-   * can't be added to it with the `include` function.
-   */
-
-  function Bounds(a, b) {
-  	if (!a) { return; }
-
-  	var points = b ? [a, b] : a;
-
-  	for (var i = 0, len = points.length; i < len; i++) {
-  		this.extend(points[i]);
-  	}
-  }
-
-  Bounds.prototype = {
-  	// @method extend(point: Point): this
-  	// Extends the bounds to contain the given point.
-  	extend: function (point) { // (Point)
-  		point = toPoint(point);
-
-  		// @property min: Point
-  		// The top left corner of the rectangle.
-  		// @property max: Point
-  		// The bottom right corner of the rectangle.
-  		if (!this.min && !this.max) {
-  			this.min = point.clone();
-  			this.max = point.clone();
-  		} else {
-  			this.min.x = Math.min(point.x, this.min.x);
-  			this.max.x = Math.max(point.x, this.max.x);
-  			this.min.y = Math.min(point.y, this.min.y);
-  			this.max.y = Math.max(point.y, this.max.y);
-  		}
-  		return this;
-  	},
-
-  	// @method getCenter(round?: Boolean): Point
-  	// Returns the center point of the bounds.
-  	getCenter: function (round) {
-  		return new Point(
-  		        (this.min.x + this.max.x) / 2,
-  		        (this.min.y + this.max.y) / 2, round);
-  	},
-
-  	// @method getBottomLeft(): Point
-  	// Returns the bottom-left point of the bounds.
-  	getBottomLeft: function () {
-  		return new Point(this.min.x, this.max.y);
-  	},
-
-  	// @method getTopRight(): Point
-  	// Returns the top-right point of the bounds.
-  	getTopRight: function () { // -> Point
-  		return new Point(this.max.x, this.min.y);
-  	},
-
-  	// @method getTopLeft(): Point
-  	// Returns the top-left point of the bounds (i.e. [`this.min`](#bounds-min)).
-  	getTopLeft: function () {
-  		return this.min; // left, top
-  	},
-
-  	// @method getBottomRight(): Point
-  	// Returns the bottom-right point of the bounds (i.e. [`this.max`](#bounds-max)).
-  	getBottomRight: function () {
-  		return this.max; // right, bottom
-  	},
-
-  	// @method getSize(): Point
-  	// Returns the size of the given bounds
-  	getSize: function () {
-  		return this.max.subtract(this.min);
-  	},
-
-  	// @method contains(otherBounds: Bounds): Boolean
-  	// Returns `true` if the rectangle contains the given one.
-  	// @alternative
-  	// @method contains(point: Point): Boolean
-  	// Returns `true` if the rectangle contains the given point.
-  	contains: function (obj) {
-  		var min, max;
-
-  		if (typeof obj[0] === 'number' || obj instanceof Point) {
-  			obj = toPoint(obj);
-  		} else {
-  			obj = toBounds(obj);
-  		}
-
-  		if (obj instanceof Bounds) {
-  			min = obj.min;
-  			max = obj.max;
-  		} else {
-  			min = max = obj;
-  		}
-
-  		return (min.x >= this.min.x) &&
-  		       (max.x <= this.max.x) &&
-  		       (min.y >= this.min.y) &&
-  		       (max.y <= this.max.y);
-  	},
-
-  	// @method intersects(otherBounds: Bounds): Boolean
-  	// Returns `true` if the rectangle intersects the given bounds. Two bounds
-  	// intersect if they have at least one point in common.
-  	intersects: function (bounds) { // (Bounds) -> Boolean
-  		bounds = toBounds(bounds);
-
-  		var min = this.min,
-  		    max = this.max,
-  		    min2 = bounds.min,
-  		    max2 = bounds.max,
-  		    xIntersects = (max2.x >= min.x) && (min2.x <= max.x),
-  		    yIntersects = (max2.y >= min.y) && (min2.y <= max.y);
-
-  		return xIntersects && yIntersects;
-  	},
-
-  	// @method overlaps(otherBounds: Bounds): Boolean
-  	// Returns `true` if the rectangle overlaps the given bounds. Two bounds
-  	// overlap if their intersection is an area.
-  	overlaps: function (bounds) { // (Bounds) -> Boolean
-  		bounds = toBounds(bounds);
-
-  		var min = this.min,
-  		    max = this.max,
-  		    min2 = bounds.min,
-  		    max2 = bounds.max,
-  		    xOverlaps = (max2.x > min.x) && (min2.x < max.x),
-  		    yOverlaps = (max2.y > min.y) && (min2.y < max.y);
-
-  		return xOverlaps && yOverlaps;
-  	},
-
-  	isValid: function () {
-  		return !!(this.min && this.max);
-  	}
-  };
-
-
-  // @factory L.bounds(corner1: Point, corner2: Point)
-  // Creates a Bounds object from two corners coordinate pairs.
-  // @alternative
-  // @factory L.bounds(points: Point[])
-  // Creates a Bounds object from the given array of points.
-  function toBounds(a, b) {
-  	if (!a || a instanceof Bounds) {
-  		return a;
-  	}
-  	return new Bounds(a, b);
-  }
-
-  /*
-   * @class LatLngBounds
-   * @aka L.LatLngBounds
-   *
-   * Represents a rectangular geographical area on a map.
-   *
-   * @example
-   *
-   * ```js
-   * var corner1 = L.latLng(40.712, -74.227),
-   * corner2 = L.latLng(40.774, -74.125),
-   * bounds = L.latLngBounds(corner1, corner2);
-   * ```
-   *
-   * All Leaflet methods that accept LatLngBounds objects also accept them in a simple Array form (unless noted otherwise), so the bounds example above can be passed like this:
-   *
-   * ```js
-   * map.fitBounds([
-   * 	[40.712, -74.227],
-   * 	[40.774, -74.125]
-   * ]);
-   * ```
-   *
-   * Caution: if the area crosses the antimeridian (often confused with the International Date Line), you must specify corners _outside_ the [-180, 180] degrees longitude range.
-   *
-   * Note that `LatLngBounds` does not inherit from Leaflet's `Class` object,
-   * which means new classes can't inherit from it, and new methods
-   * can't be added to it with the `include` function.
-   */
-
-  function LatLngBounds(corner1, corner2) { // (LatLng, LatLng) or (LatLng[])
-  	if (!corner1) { return; }
-
-  	var latlngs = corner2 ? [corner1, corner2] : corner1;
-
-  	for (var i = 0, len = latlngs.length; i < len; i++) {
-  		this.extend(latlngs[i]);
-  	}
-  }
-
-  LatLngBounds.prototype = {
-
-  	// @method extend(latlng: LatLng): this
-  	// Extend the bounds to contain the given point
-
-  	// @alternative
-  	// @method extend(otherBounds: LatLngBounds): this
-  	// Extend the bounds to contain the given bounds
-  	extend: function (obj) {
-  		var sw = this._southWest,
-  		    ne = this._northEast,
-  		    sw2, ne2;
-
-  		if (obj instanceof LatLng) {
-  			sw2 = obj;
-  			ne2 = obj;
-
-  		} else if (obj instanceof LatLngBounds) {
-  			sw2 = obj._southWest;
-  			ne2 = obj._northEast;
-
-  			if (!sw2 || !ne2) { return this; }
-
-  		} else {
-  			return obj ? this.extend(toLatLng(obj) || toLatLngBounds(obj)) : this;
-  		}
-
-  		if (!sw && !ne) {
-  			this._southWest = new LatLng(sw2.lat, sw2.lng);
-  			this._northEast = new LatLng(ne2.lat, ne2.lng);
-  		} else {
-  			sw.lat = Math.min(sw2.lat, sw.lat);
-  			sw.lng = Math.min(sw2.lng, sw.lng);
-  			ne.lat = Math.max(ne2.lat, ne.lat);
-  			ne.lng = Math.max(ne2.lng, ne.lng);
-  		}
-
-  		return this;
-  	},
-
-  	// @method pad(bufferRatio: Number): LatLngBounds
-  	// Returns bounds created by extending or retracting the current bounds by a given ratio in each direction.
-  	// For example, a ratio of 0.5 extends the bounds by 50% in each direction.
-  	// Negative values will retract the bounds.
-  	pad: function (bufferRatio) {
-  		var sw = this._southWest,
-  		    ne = this._northEast,
-  		    heightBuffer = Math.abs(sw.lat - ne.lat) * bufferRatio,
-  		    widthBuffer = Math.abs(sw.lng - ne.lng) * bufferRatio;
-
-  		return new LatLngBounds(
-  		        new LatLng(sw.lat - heightBuffer, sw.lng - widthBuffer),
-  		        new LatLng(ne.lat + heightBuffer, ne.lng + widthBuffer));
-  	},
-
-  	// @method getCenter(): LatLng
-  	// Returns the center point of the bounds.
-  	getCenter: function () {
-  		return new LatLng(
-  		        (this._southWest.lat + this._northEast.lat) / 2,
-  		        (this._southWest.lng + this._northEast.lng) / 2);
-  	},
-
-  	// @method getSouthWest(): LatLng
-  	// Returns the south-west point of the bounds.
-  	getSouthWest: function () {
-  		return this._southWest;
-  	},
-
-  	// @method getNorthEast(): LatLng
-  	// Returns the north-east point of the bounds.
-  	getNorthEast: function () {
-  		return this._northEast;
-  	},
-
-  	// @method getNorthWest(): LatLng
-  	// Returns the north-west point of the bounds.
-  	getNorthWest: function () {
-  		return new LatLng(this.getNorth(), this.getWest());
-  	},
-
-  	// @method getSouthEast(): LatLng
-  	// Returns the south-east point of the bounds.
-  	getSouthEast: function () {
-  		return new LatLng(this.getSouth(), this.getEast());
-  	},
-
-  	// @method getWest(): Number
-  	// Returns the west longitude of the bounds
-  	getWest: function () {
-  		return this._southWest.lng;
-  	},
-
-  	// @method getSouth(): Number
-  	// Returns the south latitude of the bounds
-  	getSouth: function () {
-  		return this._southWest.lat;
-  	},
-
-  	// @method getEast(): Number
-  	// Returns the east longitude of the bounds
-  	getEast: function () {
-  		return this._northEast.lng;
-  	},
-
-  	// @method getNorth(): Number
-  	// Returns the north latitude of the bounds
-  	getNorth: function () {
-  		return this._northEast.lat;
-  	},
-
-  	// @method contains(otherBounds: LatLngBounds): Boolean
-  	// Returns `true` if the rectangle contains the given one.
-
-  	// @alternative
-  	// @method contains (latlng: LatLng): Boolean
-  	// Returns `true` if the rectangle contains the given point.
-  	contains: function (obj) { // (LatLngBounds) or (LatLng) -> Boolean
-  		if (typeof obj[0] === 'number' || obj instanceof LatLng || 'lat' in obj) {
-  			obj = toLatLng(obj);
-  		} else {
-  			obj = toLatLngBounds(obj);
-  		}
-
-  		var sw = this._southWest,
-  		    ne = this._northEast,
-  		    sw2, ne2;
-
-  		if (obj instanceof LatLngBounds) {
-  			sw2 = obj.getSouthWest();
-  			ne2 = obj.getNorthEast();
-  		} else {
-  			sw2 = ne2 = obj;
-  		}
-
-  		return (sw2.lat >= sw.lat) && (ne2.lat <= ne.lat) &&
-  		       (sw2.lng >= sw.lng) && (ne2.lng <= ne.lng);
-  	},
-
-  	// @method intersects(otherBounds: LatLngBounds): Boolean
-  	// Returns `true` if the rectangle intersects the given bounds. Two bounds intersect if they have at least one point in common.
-  	intersects: function (bounds) {
-  		bounds = toLatLngBounds(bounds);
-
-  		var sw = this._southWest,
-  		    ne = this._northEast,
-  		    sw2 = bounds.getSouthWest(),
-  		    ne2 = bounds.getNorthEast(),
-
-  		    latIntersects = (ne2.lat >= sw.lat) && (sw2.lat <= ne.lat),
-  		    lngIntersects = (ne2.lng >= sw.lng) && (sw2.lng <= ne.lng);
-
-  		return latIntersects && lngIntersects;
-  	},
-
-  	// @method overlaps(otherBounds: LatLngBounds): Boolean
-  	// Returns `true` if the rectangle overlaps the given bounds. Two bounds overlap if their intersection is an area.
-  	overlaps: function (bounds) {
-  		bounds = toLatLngBounds(bounds);
-
-  		var sw = this._southWest,
-  		    ne = this._northEast,
-  		    sw2 = bounds.getSouthWest(),
-  		    ne2 = bounds.getNorthEast(),
-
-  		    latOverlaps = (ne2.lat > sw.lat) && (sw2.lat < ne.lat),
-  		    lngOverlaps = (ne2.lng > sw.lng) && (sw2.lng < ne.lng);
-
-  		return latOverlaps && lngOverlaps;
-  	},
-
-  	// @method toBBoxString(): String
-  	// Returns a string with bounding box coordinates in a 'southwest_lng,southwest_lat,northeast_lng,northeast_lat' format. Useful for sending requests to web services that return geo data.
-  	toBBoxString: function () {
-  		return [this.getWest(), this.getSouth(), this.getEast(), this.getNorth()].join(',');
-  	},
-
-  	// @method equals(otherBounds: LatLngBounds, maxMargin?: Number): Boolean
-  	// Returns `true` if the rectangle is equivalent (within a small margin of error) to the given bounds. The margin of error can be overridden by setting `maxMargin` to a small number.
-  	equals: function (bounds, maxMargin) {
-  		if (!bounds) { return false; }
-
-  		bounds = toLatLngBounds(bounds);
-
-  		return this._southWest.equals(bounds.getSouthWest(), maxMargin) &&
-  		       this._northEast.equals(bounds.getNorthEast(), maxMargin);
-  	},
-
-  	// @method isValid(): Boolean
-  	// Returns `true` if the bounds are properly initialized.
-  	isValid: function () {
-  		return !!(this._southWest && this._northEast);
-  	}
-  };
-
-  // TODO International date line?
-
-  // @factory L.latLngBounds(corner1: LatLng, corner2: LatLng)
-  // Creates a `LatLngBounds` object by defining two diagonally opposite corners of the rectangle.
-
-  // @alternative
-  // @factory L.latLngBounds(latlngs: LatLng[])
-  // Creates a `LatLngBounds` object defined by the geographical points it contains. Very useful for zooming the map to fit a particular set of locations with [`fitBounds`](#map-fitbounds).
-  function toLatLngBounds(a, b) {
-  	if (a instanceof LatLngBounds) {
-  		return a;
-  	}
-  	return new LatLngBounds(a, b);
-  }
-
-  /* @class LatLng
-   * @aka L.LatLng
-   *
-   * Represents a geographical point with a certain latitude and longitude.
-   *
-   * @example
-   *
-   * ```
-   * var latlng = L.latLng(50.5, 30.5);
-   * ```
-   *
-   * All Leaflet methods that accept LatLng objects also accept them in a simple Array form and simple object form (unless noted otherwise), so these lines are equivalent:
-   *
-   * ```
-   * map.panTo([50, 30]);
-   * map.panTo({lon: 30, lat: 50});
-   * map.panTo({lat: 50, lng: 30});
-   * map.panTo(L.latLng(50, 30));
-   * ```
-   *
-   * Note that `LatLng` does not inherit from Leaflet's `Class` object,
-   * which means new classes can't inherit from it, and new methods
-   * can't be added to it with the `include` function.
-   */
-
-  function LatLng(lat, lng, alt) {
-  	if (isNaN(lat) || isNaN(lng)) {
-  		throw new Error('Invalid LatLng object: (' + lat + ', ' + lng + ')');
-  	}
-
-  	// @property lat: Number
-  	// Latitude in degrees
-  	this.lat = +lat;
-
-  	// @property lng: Number
-  	// Longitude in degrees
-  	this.lng = +lng;
-
-  	// @property alt: Number
-  	// Altitude in meters (optional)
-  	if (alt !== undefined) {
-  		this.alt = +alt;
-  	}
-  }
-
-  LatLng.prototype = {
-  	// @method equals(otherLatLng: LatLng, maxMargin?: Number): Boolean
-  	// Returns `true` if the given `LatLng` point is at the same position (within a small margin of error). The margin of error can be overridden by setting `maxMargin` to a small number.
-  	equals: function (obj, maxMargin) {
-  		if (!obj) { return false; }
-
-  		obj = toLatLng(obj);
-
-  		var margin = Math.max(
-  		        Math.abs(this.lat - obj.lat),
-  		        Math.abs(this.lng - obj.lng));
-
-  		return margin <= (maxMargin === undefined ? 1.0E-9 : maxMargin);
-  	},
-
-  	// @method toString(): String
-  	// Returns a string representation of the point (for debugging purposes).
-  	toString: function (precision) {
-  		return 'LatLng(' +
-  		        formatNum(this.lat, precision) + ', ' +
-  		        formatNum(this.lng, precision) + ')';
-  	},
-
-  	// @method distanceTo(otherLatLng: LatLng): Number
-  	// Returns the distance (in meters) to the given `LatLng` calculated using the [Spherical Law of Cosines](https://en.wikipedia.org/wiki/Spherical_law_of_cosines).
-  	distanceTo: function (other) {
-  		return Earth.distance(this, toLatLng(other));
-  	},
-
-  	// @method wrap(): LatLng
-  	// Returns a new `LatLng` object with the longitude wrapped so it's always between -180 and +180 degrees.
-  	wrap: function () {
-  		return Earth.wrapLatLng(this);
-  	},
-
-  	// @method toBounds(sizeInMeters: Number): LatLngBounds
-  	// Returns a new `LatLngBounds` object in which each boundary is `sizeInMeters/2` meters apart from the `LatLng`.
-  	toBounds: function (sizeInMeters) {
-  		var latAccuracy = 180 * sizeInMeters / 40075017,
-  		    lngAccuracy = latAccuracy / Math.cos((Math.PI / 180) * this.lat);
-
-  		return toLatLngBounds(
-  		        [this.lat - latAccuracy, this.lng - lngAccuracy],
-  		        [this.lat + latAccuracy, this.lng + lngAccuracy]);
-  	},
-
-  	clone: function () {
-  		return new LatLng(this.lat, this.lng, this.alt);
-  	}
-  };
-
-
-
-  // @factory L.latLng(latitude: Number, longitude: Number, altitude?: Number): LatLng
-  // Creates an object representing a geographical point with the given latitude and longitude (and optionally altitude).
-
-  // @alternative
-  // @factory L.latLng(coords: Array): LatLng
-  // Expects an array of the form `[Number, Number]` or `[Number, Number, Number]` instead.
-
-  // @alternative
-  // @factory L.latLng(coords: Object): LatLng
-  // Expects an plain object of the form `{lat: Number, lng: Number}` or `{lat: Number, lng: Number, alt: Number}` instead.
-
-  function toLatLng(a, b, c) {
-  	if (a instanceof LatLng) {
-  		return a;
-  	}
-  	if (isArray(a) && typeof a[0] !== 'object') {
-  		if (a.length === 3) {
-  			return new LatLng(a[0], a[1], a[2]);
-  		}
-  		if (a.length === 2) {
-  			return new LatLng(a[0], a[1]);
-  		}
-  		return null;
-  	}
-  	if (a === undefined || a === null) {
-  		return a;
-  	}
-  	if (typeof a === 'object' && 'lat' in a) {
-  		return new LatLng(a.lat, 'lng' in a ? a.lng : a.lon, a.alt);
-  	}
-  	if (b === undefined) {
-  		return null;
-  	}
-  	return new LatLng(a, b, c);
-  }
-
-  /*
-   * @namespace CRS
-   * @crs L.CRS.Base
-   * Object that defines coordinate reference systems for projecting
-   * geographical points into pixel (screen) coordinates and back (and to
-   * coordinates in other units for [WMS](https://en.wikipedia.org/wiki/Web_Map_Service) services). See
-   * [spatial reference system](http://en.wikipedia.org/wiki/Coordinate_reference_system).
-   *
-   * Leaflet defines the most usual CRSs by default. If you want to use a
-   * CRS not defined by default, take a look at the
-   * [Proj4Leaflet](https://github.com/kartena/Proj4Leaflet) plugin.
-   *
-   * Note that the CRS instances do not inherit from Leaflet's `Class` object,
-   * and can't be instantiated. Also, new classes can't inherit from them,
-   * and methods can't be added to them with the `include` function.
-   */
-
-  var CRS = {
-  	// @method latLngToPoint(latlng: LatLng, zoom: Number): Point
-  	// Projects geographical coordinates into pixel coordinates for a given zoom.
-  	latLngToPoint: function (latlng, zoom) {
-  		var projectedPoint = this.projection.project(latlng),
-  		    scale = this.scale(zoom);
-
-  		return this.transformation._transform(projectedPoint, scale);
-  	},
-
-  	// @method pointToLatLng(point: Point, zoom: Number): LatLng
-  	// The inverse of `latLngToPoint`. Projects pixel coordinates on a given
-  	// zoom into geographical coordinates.
-  	pointToLatLng: function (point, zoom) {
-  		var scale = this.scale(zoom),
-  		    untransformedPoint = this.transformation.untransform(point, scale);
-
-  		return this.projection.unproject(untransformedPoint);
-  	},
-
-  	// @method project(latlng: LatLng): Point
-  	// Projects geographical coordinates into coordinates in units accepted for
-  	// this CRS (e.g. meters for EPSG:3857, for passing it to WMS services).
-  	project: function (latlng) {
-  		return this.projection.project(latlng);
-  	},
-
-  	// @method unproject(point: Point): LatLng
-  	// Given a projected coordinate returns the corresponding LatLng.
-  	// The inverse of `project`.
-  	unproject: function (point) {
-  		return this.projection.unproject(point);
-  	},
-
-  	// @method scale(zoom: Number): Number
-  	// Returns the scale used when transforming projected coordinates into
-  	// pixel coordinates for a particular zoom. For example, it returns
-  	// `256 * 2^zoom` for Mercator-based CRS.
-  	scale: function (zoom) {
-  		return 256 * Math.pow(2, zoom);
-  	},
-
-  	// @method zoom(scale: Number): Number
-  	// Inverse of `scale()`, returns the zoom level corresponding to a scale
-  	// factor of `scale`.
-  	zoom: function (scale) {
-  		return Math.log(scale / 256) / Math.LN2;
-  	},
-
-  	// @method getProjectedBounds(zoom: Number): Bounds
-  	// Returns the projection's bounds scaled and transformed for the provided `zoom`.
-  	getProjectedBounds: function (zoom) {
-  		if (this.infinite) { return null; }
-
-  		var b = this.projection.bounds,
-  		    s = this.scale(zoom),
-  		    min = this.transformation.transform(b.min, s),
-  		    max = this.transformation.transform(b.max, s);
-
-  		return new Bounds(min, max);
-  	},
-
-  	// @method distance(latlng1: LatLng, latlng2: LatLng): Number
-  	// Returns the distance between two geographical coordinates.
-
-  	// @property code: String
-  	// Standard code name of the CRS passed into WMS services (e.g. `'EPSG:3857'`)
-  	//
-  	// @property wrapLng: Number[]
-  	// An array of two numbers defining whether the longitude (horizontal) coordinate
-  	// axis wraps around a given range and how. Defaults to `[-180, 180]` in most
-  	// geographical CRSs. If `undefined`, the longitude axis does not wrap around.
-  	//
-  	// @property wrapLat: Number[]
-  	// Like `wrapLng`, but for the latitude (vertical) axis.
-
-  	// wrapLng: [min, max],
-  	// wrapLat: [min, max],
-
-  	// @property infinite: Boolean
-  	// If true, the coordinate space will be unbounded (infinite in both axes)
-  	infinite: false,
-
-  	// @method wrapLatLng(latlng: LatLng): LatLng
-  	// Returns a `LatLng` where lat and lng has been wrapped according to the
-  	// CRS's `wrapLat` and `wrapLng` properties, if they are outside the CRS's bounds.
-  	wrapLatLng: function (latlng) {
-  		var lng = this.wrapLng ? wrapNum(latlng.lng, this.wrapLng, true) : latlng.lng,
-  		    lat = this.wrapLat ? wrapNum(latlng.lat, this.wrapLat, true) : latlng.lat,
-  		    alt = latlng.alt;
-
-  		return new LatLng(lat, lng, alt);
-  	},
-
-  	// @method wrapLatLngBounds(bounds: LatLngBounds): LatLngBounds
-  	// Returns a `LatLngBounds` with the same size as the given one, ensuring
-  	// that its center is within the CRS's bounds.
-  	// Only accepts actual `L.LatLngBounds` instances, not arrays.
-  	wrapLatLngBounds: function (bounds) {
-  		var center = bounds.getCenter(),
-  		    newCenter = this.wrapLatLng(center),
-  		    latShift = center.lat - newCenter.lat,
-  		    lngShift = center.lng - newCenter.lng;
-
-  		if (latShift === 0 && lngShift === 0) {
-  			return bounds;
-  		}
-
-  		var sw = bounds.getSouthWest(),
-  		    ne = bounds.getNorthEast(),
-  		    newSw = new LatLng(sw.lat - latShift, sw.lng - lngShift),
-  		    newNe = new LatLng(ne.lat - latShift, ne.lng - lngShift);
-
-  		return new LatLngBounds(newSw, newNe);
-  	}
-  };
-
-  /*
-   * @namespace CRS
-   * @crs L.CRS.Earth
-   *
-   * Serves as the base for CRS that are global such that they cover the earth.
-   * Can only be used as the base for other CRS and cannot be used directly,
-   * since it does not have a `code`, `projection` or `transformation`. `distance()` returns
-   * meters.
-   */
-
-  var Earth = extend({}, CRS, {
-  	wrapLng: [-180, 180],
-
-  	// Mean Earth Radius, as recommended for use by
-  	// the International Union of Geodesy and Geophysics,
-  	// see http://rosettacode.org/wiki/Haversine_formula
-  	R: 6371000,
-
-  	// distance between two geographical points using spherical law of cosines approximation
-  	distance: function (latlng1, latlng2) {
-  		var rad = Math.PI / 180,
-  		    lat1 = latlng1.lat * rad,
-  		    lat2 = latlng2.lat * rad,
-  		    sinDLat = Math.sin((latlng2.lat - latlng1.lat) * rad / 2),
-  		    sinDLon = Math.sin((latlng2.lng - latlng1.lng) * rad / 2),
-  		    a = sinDLat * sinDLat + Math.cos(lat1) * Math.cos(lat2) * sinDLon * sinDLon,
-  		    c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
-  		return this.R * c;
-  	}
-  });
-
-  /*
-   * @namespace Projection
-   * @projection L.Projection.SphericalMercator
-   *
-   * Spherical Mercator projection — the most common projection for online maps,
-   * used by almost all free and commercial tile providers. Assumes that Earth is
-   * a sphere. Used by the `EPSG:3857` CRS.
-   */
-
-  var earthRadius = 6378137;
-
-  var SphericalMercator = {
-
-  	R: earthRadius,
-  	MAX_LATITUDE: 85.0511287798,
-
-  	project: function (latlng) {
-  		var d = Math.PI / 180,
-  		    max = this.MAX_LATITUDE,
-  		    lat = Math.max(Math.min(max, latlng.lat), -max),
-  		    sin = Math.sin(lat * d);
-
-  		return new Point(
-  			this.R * latlng.lng * d,
-  			this.R * Math.log((1 + sin) / (1 - sin)) / 2);
-  	},
-
-  	unproject: function (point) {
-  		var d = 180 / Math.PI;
-
-  		return new LatLng(
-  			(2 * Math.atan(Math.exp(point.y / this.R)) - (Math.PI / 2)) * d,
-  			point.x * d / this.R);
-  	},
-
-  	bounds: (function () {
-  		var d = earthRadius * Math.PI;
-  		return new Bounds([-d, -d], [d, d]);
-  	})()
-  };
-
-  /*
-   * @class Transformation
-   * @aka L.Transformation
-   *
-   * Represents an affine transformation: a set of coefficients `a`, `b`, `c`, `d`
-   * for transforming a point of a form `(x, y)` into `(a*x + b, c*y + d)` and doing
-   * the reverse. Used by Leaflet in its projections code.
-   *
-   * @example
-   *
-   * ```js
-   * var transformation = L.transformation(2, 5, -1, 10),
-   * 	p = L.point(1, 2),
-   * 	p2 = transformation.transform(p), //  L.point(7, 8)
-   * 	p3 = transformation.untransform(p2); //  L.point(1, 2)
-   * ```
-   */
-
-
-  // factory new L.Transformation(a: Number, b: Number, c: Number, d: Number)
-  // Creates a `Transformation` object with the given coefficients.
-  function Transformation(a, b, c, d) {
-  	if (isArray(a)) {
-  		// use array properties
-  		this._a = a[0];
-  		this._b = a[1];
-  		this._c = a[2];
-  		this._d = a[3];
-  		return;
-  	}
-  	this._a = a;
-  	this._b = b;
-  	this._c = c;
-  	this._d = d;
-  }
-
-  Transformation.prototype = {
-  	// @method transform(point: Point, scale?: Number): Point
-  	// Returns a transformed point, optionally multiplied by the given scale.
-  	// Only accepts actual `L.Point` instances, not arrays.
-  	transform: function (point, scale) { // (Point, Number) -> Point
-  		return this._transform(point.clone(), scale);
-  	},
-
-  	// destructive transform (faster)
-  	_transform: function (point, scale) {
-  		scale = scale || 1;
-  		point.x = scale * (this._a * point.x + this._b);
-  		point.y = scale * (this._c * point.y + this._d);
-  		return point;
-  	},
-
-  	// @method untransform(point: Point, scale?: Number): Point
-  	// Returns the reverse transformation of the given point, optionally divided
-  	// by the given scale. Only accepts actual `L.Point` instances, not arrays.
-  	untransform: function (point, scale) {
-  		scale = scale || 1;
-  		return new Point(
-  		        (point.x / scale - this._b) / this._a,
-  		        (point.y / scale - this._d) / this._c);
-  	}
-  };
-
-  // factory L.transformation(a: Number, b: Number, c: Number, d: Number)
-
-  // @factory L.transformation(a: Number, b: Number, c: Number, d: Number)
-  // Instantiates a Transformation object with the given coefficients.
-
-  // @alternative
-  // @factory L.transformation(coefficients: Array): Transformation
-  // Expects an coefficients array of the form
-  // `[a: Number, b: Number, c: Number, d: Number]`.
-
-  function toTransformation(a, b, c, d) {
-  	return new Transformation(a, b, c, d);
-  }
-
-  /*
-   * @namespace CRS
-   * @crs L.CRS.EPSG3857
-   *
-   * The most common CRS for online maps, used by almost all free and commercial
-   * tile providers. Uses Spherical Mercator projection. Set in by default in
-   * Map's `crs` option.
-   */
-
-  var EPSG3857 = extend({}, Earth, {
-  	code: 'EPSG:3857',
-  	projection: SphericalMercator,
-
-  	transformation: (function () {
-  		var scale = 0.5 / (Math.PI * SphericalMercator.R);
-  		return toTransformation(scale, 0.5, -scale, 0.5);
-  	}())
-  });
-
-  var EPSG900913 = extend({}, EPSG3857, {
-  	code: 'EPSG:900913'
-  });
-
-  // @namespace SVG; @section
-  // There are several static functions which can be called without instantiating L.SVG:
-
-  // @function create(name: String): SVGElement
-  // Returns a instance of [SVGElement](https://developer.mozilla.org/docs/Web/API/SVGElement),
-  // corresponding to the class name passed. For example, using 'line' will return
-  // an instance of [SVGLineElement](https://developer.mozilla.org/docs/Web/API/SVGLineElement).
-  function svgCreate(name) {
-  	return document.createElementNS('http://www.w3.org/2000/svg', name);
-  }
-
-  // @function pointsToPath(rings: Point[], closed: Boolean): String
-  // Generates a SVG path string for multiple rings, with each ring turning
-  // into "M..L..L.." instructions
-  function pointsToPath(rings, closed) {
-  	var str = '',
-  	i, j, len, len2, points, p;
-
-  	for (i = 0, len = rings.length; i < len; i++) {
-  		points = rings[i];
-
-  		for (j = 0, len2 = points.length; j < len2; j++) {
-  			p = points[j];
-  			str += (j ? 'L' : 'M') + p.x + ' ' + p.y;
-  		}
-
-  		// closes the ring for polygons; "x" is VML syntax
-  		str += closed ? (svg ? 'z' : 'x') : '';
-  	}
-
-  	// SVG complains about empty path strings
-  	return str || 'M0 0';
-  }
-
-  /*
-   * @namespace Browser
-   * @aka L.Browser
-   *
-   * A namespace with static properties for browser/feature detection used by Leaflet internally.
-   *
-   * @example
-   *
-   * ```js
-   * if (L.Browser.ielt9) {
-   *   alert('Upgrade your browser, dude!');
-   * }
-   * ```
-   */
-
-  var style$1 = document.documentElement.style;
-
-  // @property ie: Boolean; `true` for all Internet Explorer versions (not Edge).
-  var ie = 'ActiveXObject' in window;
-
-  // @property ielt9: Boolean; `true` for Internet Explorer versions less than 9.
-  var ielt9 = ie && !document.addEventListener;
-
-  // @property edge: Boolean; `true` for the Edge web browser.
-  var edge = 'msLaunchUri' in navigator && !('documentMode' in document);
-
-  // @property webkit: Boolean;
-  // `true` for webkit-based browsers like Chrome and Safari (including mobile versions).
-  var webkit = userAgentContains('webkit');
-
-  // @property android: Boolean
-  // `true` for any browser running on an Android platform.
-  var android = userAgentContains('android');
-
-  // @property android23: Boolean; `true` for browsers running on Android 2 or Android 3.
-  var android23 = userAgentContains('android 2') || userAgentContains('android 3');
-
-  /* See https://stackoverflow.com/a/17961266 for details on detecting stock Android */
-  var webkitVer = parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1], 10); // also matches AppleWebKit
-  // @property androidStock: Boolean; `true` for the Android stock browser (i.e. not Chrome)
-  var androidStock = android && userAgentContains('Google') && webkitVer < 537 && !('AudioNode' in window);
-
-  // @property opera: Boolean; `true` for the Opera browser
-  var opera = !!window.opera;
-
-  // @property chrome: Boolean; `true` for the Chrome browser.
-  var chrome = !edge && userAgentContains('chrome');
-
-  // @property gecko: Boolean; `true` for gecko-based browsers like Firefox.
-  var gecko = userAgentContains('gecko') && !webkit && !opera && !ie;
-
-  // @property safari: Boolean; `true` for the Safari browser.
-  var safari = !chrome && userAgentContains('safari');
-
-  var phantom = userAgentContains('phantom');
-
-  // @property opera12: Boolean
-  // `true` for the Opera browser supporting CSS transforms (version 12 or later).
-  var opera12 = 'OTransition' in style$1;
-
-  // @property win: Boolean; `true` when the browser is running in a Windows platform
-  var win = navigator.platform.indexOf('Win') === 0;
-
-  // @property ie3d: Boolean; `true` for all Internet Explorer versions supporting CSS transforms.
-  var ie3d = ie && ('transition' in style$1);
-
-  // @property webkit3d: Boolean; `true` for webkit-based browsers supporting CSS transforms.
-  var webkit3d = ('WebKitCSSMatrix' in window) && ('m11' in new window.WebKitCSSMatrix()) && !android23;
-
-  // @property gecko3d: Boolean; `true` for gecko-based browsers supporting CSS transforms.
-  var gecko3d = 'MozPerspective' in style$1;
-
-  // @property any3d: Boolean
-  // `true` for all browsers supporting CSS transforms.
-  var any3d = !window.L_DISABLE_3D && (ie3d || webkit3d || gecko3d) && !opera12 && !phantom;
-
-  // @property mobile: Boolean; `true` for all browsers running in a mobile device.
-  var mobile = typeof orientation !== 'undefined' || userAgentContains('mobile');
-
-  // @property mobileWebkit: Boolean; `true` for all webkit-based browsers in a mobile device.
-  var mobileWebkit = mobile && webkit;
-
-  // @property mobileWebkit3d: Boolean
-  // `true` for all webkit-based browsers in a mobile device supporting CSS transforms.
-  var mobileWebkit3d = mobile && webkit3d;
-
-  // @property msPointer: Boolean
-  // `true` for browsers implementing the Microsoft touch events model (notably IE10).
-  var msPointer = !window.PointerEvent && window.MSPointerEvent;
-
-  // @property pointer: Boolean
-  // `true` for all browsers supporting [pointer events](https://msdn.microsoft.com/en-us/library/dn433244%28v=vs.85%29.aspx).
-  var pointer = !!(window.PointerEvent || msPointer);
-
-  // @property touch: Boolean
-  // `true` for all browsers supporting [touch events](https://developer.mozilla.org/docs/Web/API/Touch_events).
-  // This does not necessarily mean that the browser is running in a computer with
-  // a touchscreen, it only means that the browser is capable of understanding
-  // touch events.
-  var touch = !window.L_NO_TOUCH && (pointer || 'ontouchstart' in window ||
-  		(window.DocumentTouch && document instanceof window.DocumentTouch));
-
-  // @property mobileOpera: Boolean; `true` for the Opera browser in a mobile device.
-  var mobileOpera = mobile && opera;
-
-  // @property mobileGecko: Boolean
-  // `true` for gecko-based browsers running in a mobile device.
-  var mobileGecko = mobile && gecko;
-
-  // @property retina: Boolean
-  // `true` for browsers on a high-resolution "retina" screen or on any screen when browser's display zoom is more than 100%.
-  var retina = (window.devicePixelRatio || (window.screen.deviceXDPI / window.screen.logicalXDPI)) > 1;
-
-  // @property passiveEvents: Boolean
-  // `true` for browsers that support passive events.
-  var passiveEvents = (function () {
-  	var supportsPassiveOption = false;
-  	try {
-  		var opts = Object.defineProperty({}, 'passive', {
-  			get: function () { // eslint-disable-line getter-return
-  				supportsPassiveOption = true;
-  			}
-  		});
-  		window.addEventListener('testPassiveEventSupport', falseFn, opts);
-  		window.removeEventListener('testPassiveEventSupport', falseFn, opts);
-  	} catch (e) {
-  		// Errors can safely be ignored since this is only a browser support test.
-  	}
-  	return supportsPassiveOption;
-  }());
-
-  // @property canvas: Boolean
-  // `true` when the browser supports [`<canvas>`](https://developer.mozilla.org/docs/Web/API/Canvas_API).
-  var canvas = (function () {
-  	return !!document.createElement('canvas').getContext;
-  }());
-
-  // @property svg: Boolean
-  // `true` when the browser supports [SVG](https://developer.mozilla.org/docs/Web/SVG).
-  var svg = !!(document.createElementNS && svgCreate('svg').createSVGRect);
-
-  // @property vml: Boolean
-  // `true` if the browser supports [VML](https://en.wikipedia.org/wiki/Vector_Markup_Language).
-  var vml = !svg && (function () {
-  	try {
-  		var div = document.createElement('div');
-  		div.innerHTML = '<v:shape adj="1"/>';
-
-  		var shape = div.firstChild;
-  		shape.style.behavior = 'url(#default#VML)';
-
-  		return shape && (typeof shape.adj === 'object');
-
-  	} catch (e) {
-  		return false;
-  	}
-  }());
-
-
-  function userAgentContains(str) {
-  	return navigator.userAgent.toLowerCase().indexOf(str) >= 0;
-  }
-
-  var Browser = ({
-    ie: ie,
-    ielt9: ielt9,
-    edge: edge,
-    webkit: webkit,
-    android: android,
-    android23: android23,
-    androidStock: androidStock,
-    opera: opera,
-    chrome: chrome,
-    gecko: gecko,
-    safari: safari,
-    phantom: phantom,
-    opera12: opera12,
-    win: win,
-    ie3d: ie3d,
-    webkit3d: webkit3d,
-    gecko3d: gecko3d,
-    any3d: any3d,
-    mobile: mobile,
-    mobileWebkit: mobileWebkit,
-    mobileWebkit3d: mobileWebkit3d,
-    msPointer: msPointer,
-    pointer: pointer,
-    touch: touch,
-    mobileOpera: mobileOpera,
-    mobileGecko: mobileGecko,
-    retina: retina,
-    passiveEvents: passiveEvents,
-    canvas: canvas,
-    svg: svg,
-    vml: vml
-  });
-
-  /*
-   * Extends L.DomEvent to provide touch support for Internet Explorer and Windows-based devices.
-   */
-
-
-  var POINTER_DOWN =   msPointer ? 'MSPointerDown'   : 'pointerdown';
-  var POINTER_MOVE =   msPointer ? 'MSPointerMove'   : 'pointermove';
-  var POINTER_UP =     msPointer ? 'MSPointerUp'     : 'pointerup';
-  var POINTER_CANCEL = msPointer ? 'MSPointerCancel' : 'pointercancel';
-
-  var _pointers = {};
-  var _pointerDocListener = false;
-
-  // Provides a touch events wrapper for (ms)pointer events.
-  // ref http://www.w3.org/TR/pointerevents/ https://www.w3.org/Bugs/Public/show_bug.cgi?id=22890
-
-  function addPointerListener(obj, type, handler, id) {
-  	if (type === 'touchstart') {
-  		_addPointerStart(obj, handler, id);
-
-  	} else if (type === 'touchmove') {
-  		_addPointerMove(obj, handler, id);
-
-  	} else if (type === 'touchend') {
-  		_addPointerEnd(obj, handler, id);
-  	}
-
-  	return this;
-  }
-
-  function removePointerListener(obj, type, id) {
-  	var handler = obj['_leaflet_' + type + id];
-
-  	if (type === 'touchstart') {
-  		obj.removeEventListener(POINTER_DOWN, handler, false);
-
-  	} else if (type === 'touchmove') {
-  		obj.removeEventListener(POINTER_MOVE, handler, false);
-
-  	} else if (type === 'touchend') {
-  		obj.removeEventListener(POINTER_UP, handler, false);
-  		obj.removeEventListener(POINTER_CANCEL, handler, false);
-  	}
-
-  	return this;
-  }
-
-  function _addPointerStart(obj, handler, id) {
-  	var onDown = bind(function (e) {
-  		// IE10 specific: MsTouch needs preventDefault. See #2000
-  		if (e.MSPOINTER_TYPE_TOUCH && e.pointerType === e.MSPOINTER_TYPE_TOUCH) {
-  			preventDefault(e);
-  		}
-
-  		_handlePointer(e, handler);
-  	});
-
-  	obj['_leaflet_touchstart' + id] = onDown;
-  	obj.addEventListener(POINTER_DOWN, onDown, false);
-
-  	// need to keep track of what pointers and how many are active to provide e.touches emulation
-  	if (!_pointerDocListener) {
-  		// we listen document as any drags that end by moving the touch off the screen get fired there
-  		document.addEventListener(POINTER_DOWN, _globalPointerDown, true);
-  		document.addEventListener(POINTER_MOVE, _globalPointerMove, true);
-  		document.addEventListener(POINTER_UP, _globalPointerUp, true);
-  		document.addEventListener(POINTER_CANCEL, _globalPointerUp, true);
-
-  		_pointerDocListener = true;
-  	}
-  }
-
-  function _globalPointerDown(e) {
-  	_pointers[e.pointerId] = e;
-  }
-
-  function _globalPointerMove(e) {
-  	if (_pointers[e.pointerId]) {
-  		_pointers[e.pointerId] = e;
-  	}
-  }
-
-  function _globalPointerUp(e) {
-  	delete _pointers[e.pointerId];
-  }
-
-  function _handlePointer(e, handler) {
-  	e.touches = [];
-  	for (var i in _pointers) {
-  		e.touches.push(_pointers[i]);
-  	}
-  	e.changedTouches = [e];
-
-  	handler(e);
-  }
-
-  function _addPointerMove(obj, handler, id) {
-  	var onMove = function (e) {
-  		// don't fire touch moves when mouse isn't down
-  		if ((e.pointerType === (e.MSPOINTER_TYPE_MOUSE || 'mouse')) && e.buttons === 0) {
-  			return;
-  		}
-
-  		_handlePointer(e, handler);
-  	};
-
-  	obj['_leaflet_touchmove' + id] = onMove;
-  	obj.addEventListener(POINTER_MOVE, onMove, false);
-  }
-
-  function _addPointerEnd(obj, handler, id) {
-  	var onUp = function (e) {
-  		_handlePointer(e, handler);
-  	};
-
-  	obj['_leaflet_touchend' + id] = onUp;
-  	obj.addEventListener(POINTER_UP, onUp, false);
-  	obj.addEventListener(POINTER_CANCEL, onUp, false);
-  }
-
-  /*
-   * Extends the event handling code with double tap support for mobile browsers.
-   */
-
-  var _touchstart = msPointer ? 'MSPointerDown' : pointer ? 'pointerdown' : 'touchstart';
-  var _touchend = msPointer ? 'MSPointerUp' : pointer ? 'pointerup' : 'touchend';
-  var _pre = '_leaflet_';
-
-  // inspired by Zepto touch code by Thomas Fuchs
-  function addDoubleTapListener(obj, handler, id) {
-  	var last, touch$$1,
-  	    doubleTap = false,
-  	    delay = 250;
-
-  	function onTouchStart(e) {
-
-  		if (pointer) {
-  			if (!e.isPrimary) { return; }
-  			if (e.pointerType === 'mouse') { return; } // mouse fires native dblclick
-  		} else if (e.touches.length > 1) {
-  			return;
-  		}
-
-  		var now = Date.now(),
-  		    delta = now - (last || now);
-
-  		touch$$1 = e.touches ? e.touches[0] : e;
-  		doubleTap = (delta > 0 && delta <= delay);
-  		last = now;
-  	}
-
-  	function onTouchEnd(e) {
-  		if (doubleTap && !touch$$1.cancelBubble) {
-  			if (pointer) {
-  				if (e.pointerType === 'mouse') { return; }
-  				// work around .type being readonly with MSPointer* events
-  				var newTouch = {},
-  				    prop, i;
-
-  				for (i in touch$$1) {
-  					prop = touch$$1[i];
-  					newTouch[i] = prop && prop.bind ? prop.bind(touch$$1) : prop;
-  				}
-  				touch$$1 = newTouch;
-  			}
-  			touch$$1.type = 'dblclick';
-  			touch$$1.button = 0;
-  			handler(touch$$1);
-  			last = null;
-  		}
-  	}
-
-  	obj[_pre + _touchstart + id] = onTouchStart;
-  	obj[_pre + _touchend + id] = onTouchEnd;
-  	obj[_pre + 'dblclick' + id] = handler;
-
-  	obj.addEventListener(_touchstart, onTouchStart, passiveEvents ? {passive: false} : false);
-  	obj.addEventListener(_touchend, onTouchEnd, passiveEvents ? {passive: false} : false);
-
-  	// On some platforms (notably, chrome<55 on win10 + touchscreen + mouse),
-  	// the browser doesn't fire touchend/pointerup events but does fire
-  	// native dblclicks. See #4127.
-  	// Edge 14 also fires native dblclicks, but only for pointerType mouse, see #5180.
-  	obj.addEventListener('dblclick', handler, false);
-
-  	return this;
-  }
-
-  function removeDoubleTapListener(obj, id) {
-  	var touchstart = obj[_pre + _touchstart + id],
-  	    touchend = obj[_pre + _touchend + id],
-  	    dblclick = obj[_pre + 'dblclick' + id];
-
-  	obj.removeEventListener(_touchstart, touchstart, passiveEvents ? {passive: false} : false);
-  	obj.removeEventListener(_touchend, touchend, passiveEvents ? {passive: false} : false);
-  	obj.removeEventListener('dblclick', dblclick, false);
-
-  	return this;
-  }
-
-  /*
-   * @namespace DomUtil
-   *
-   * Utility functions to work with the [DOM](https://developer.mozilla.org/docs/Web/API/Document_Object_Model)
-   * tree, used by Leaflet internally.
-   *
-   * Most functions expecting or returning a `HTMLElement` also work for
-   * SVG elements. The only difference is that classes refer to CSS classes
-   * in HTML and SVG classes in SVG.
-   */
-
-
-  // @property TRANSFORM: String
-  // Vendor-prefixed transform style name (e.g. `'webkitTransform'` for WebKit).
-  var TRANSFORM = testProp(
-  	['transform', 'webkitTransform', 'OTransform', 'MozTransform', 'msTransform']);
-
-  // webkitTransition comes first because some browser versions that drop vendor prefix don't do
-  // the same for the transitionend event, in particular the Android 4.1 stock browser
-
-  // @property TRANSITION: String
-  // Vendor-prefixed transition style name.
-  var TRANSITION = testProp(
-  	['webkitTransition', 'transition', 'OTransition', 'MozTransition', 'msTransition']);
-
-  // @property TRANSITION_END: String
-  // Vendor-prefixed transitionend event name.
-  var TRANSITION_END =
-  	TRANSITION === 'webkitTransition' || TRANSITION === 'OTransition' ? TRANSITION + 'End' : 'transitionend';
-
-
-  // @function get(id: String|HTMLElement): HTMLElement
-  // Returns an element given its DOM id, or returns the element itself
-  // if it was passed directly.
-  function get(id) {
-  	return typeof id === 'string' ? document.getElementById(id) : id;
-  }
-
-  // @function getStyle(el: HTMLElement, styleAttrib: String): String
-  // Returns the value for a certain style attribute on an element,
-  // including computed values or values set through CSS.
-  function getStyle(el, style) {
-  	var value = el.style[style] || (el.currentStyle && el.currentStyle[style]);
-
-  	if ((!value || value === 'auto') && document.defaultView) {
-  		var css = document.defaultView.getComputedStyle(el, null);
-  		value = css ? css[style] : null;
-  	}
-  	return value === 'auto' ? null : value;
-  }
-
-  // @function create(tagName: String, className?: String, container?: HTMLElement): HTMLElement
-  // Creates an HTML element with `tagName`, sets its class to `className`, and optionally appends it to `container` element.
-  function create$1(tagName, className, container) {
-  	var el = document.createElement(tagName);
-  	el.className = className || '';
-
-  	if (container) {
-  		container.appendChild(el);
-  	}
-  	return el;
-  }
-
-  // @function remove(el: HTMLElement)
-  // Removes `el` from its parent element
-  function remove(el) {
-  	var parent = el.parentNode;
-  	if (parent) {
-  		parent.removeChild(el);
-  	}
-  }
-
-  // @function empty(el: HTMLElement)
-  // Removes all of `el`'s children elements from `el`
-  function empty(el) {
-  	while (el.firstChild) {
-  		el.removeChild(el.firstChild);
-  	}
-  }
-
-  // @function toFront(el: HTMLElement)
-  // Makes `el` the last child of its parent, so it renders in front of the other children.
-  function toFront(el) {
-  	var parent = el.parentNode;
-  	if (parent && parent.lastChild !== el) {
-  		parent.appendChild(el);
-  	}
-  }
-
-  // @function toBack(el: HTMLElement)
-  // Makes `el` the first child of its parent, so it renders behind the other children.
-  function toBack(el) {
-  	var parent = el.parentNode;
-  	if (parent && parent.firstChild !== el) {
-  		parent.insertBefore(el, parent.firstChild);
-  	}
-  }
-
-  // @function hasClass(el: HTMLElement, name: String): Boolean
-  // Returns `true` if the element's class attribute contains `name`.
-  function hasClass(el, name) {
-  	if (el.classList !== undefined) {
-  		return el.classList.contains(name);
-  	}
-  	var className = getClass(el);
-  	return className.length > 0 && new RegExp('(^|\\s)' + name + '(\\s|$)').test(className);
-  }
-
-  // @function addClass(el: HTMLElement, name: String)
-  // Adds `name` to the element's class attribute.
-  function addClass(el, name) {
-  	if (el.classList !== undefined) {
-  		var classes = splitWords(name);
-  		for (var i = 0, len = classes.length; i < len; i++) {
-  			el.classList.add(classes[i]);
-  		}
-  	} else if (!hasClass(el, name)) {
-  		var className = getClass(el);
-  		setClass(el, (className ? className + ' ' : '') + name);
-  	}
-  }
-
-  // @function removeClass(el: HTMLElement, name: String)
-  // Removes `name` from the element's class attribute.
-  function removeClass(el, name) {
-  	if (el.classList !== undefined) {
-  		el.classList.remove(name);
-  	} else {
-  		setClass(el, trim((' ' + getClass(el) + ' ').replace(' ' + name + ' ', ' ')));
-  	}
-  }
-
-  // @function setClass(el: HTMLElement, name: String)
-  // Sets the element's class.
-  function setClass(el, name) {
-  	if (el.className.baseVal === undefined) {
-  		el.className = name;
-  	} else {
-  		// in case of SVG element
-  		el.className.baseVal = name;
-  	}
-  }
-
-  // @function getClass(el: HTMLElement): String
-  // Returns the element's class.
-  function getClass(el) {
-  	// Check if the element is an SVGElementInstance and use the correspondingElement instead
-  	// (Required for linked SVG elements in IE11.)
-  	if (el.correspondingElement) {
-  		el = el.correspondingElement;
-  	}
-  	return el.className.baseVal === undefined ? el.className : el.className.baseVal;
-  }
-
-  // @function setOpacity(el: HTMLElement, opacity: Number)
-  // Set the opacity of an element (including old IE support).
-  // `opacity` must be a number from `0` to `1`.
-  function setOpacity(el, value) {
-  	if ('opacity' in el.style) {
-  		el.style.opacity = value;
-  	} else if ('filter' in el.style) {
-  		_setOpacityIE(el, value);
-  	}
-  }
-
-  function _setOpacityIE(el, value) {
-  	var filter = false,
-  	    filterName = 'DXImageTransform.Microsoft.Alpha';
-
-  	// filters collection throws an error if we try to retrieve a filter that doesn't exist
-  	try {
-  		filter = el.filters.item(filterName);
-  	} catch (e) {
-  		// don't set opacity to 1 if we haven't already set an opacity,
-  		// it isn't needed and breaks transparent pngs.
-  		if (value === 1) { return; }
-  	}
-
-  	value = Math.round(value * 100);
-
-  	if (filter) {
-  		filter.Enabled = (value !== 100);
-  		filter.Opacity = value;
-  	} else {
-  		el.style.filter += ' progid:' + filterName + '(opacity=' + value + ')';
-  	}
-  }
-
-  // @function testProp(props: String[]): String|false
-  // Goes through the array of style names and returns the first name
-  // that is a valid style name for an element. If no such name is found,
-  // it returns false. Useful for vendor-prefixed styles like `transform`.
-  function testProp(props) {
-  	var style = document.documentElement.style;
-
-  	for (var i = 0; i < props.length; i++) {
-  		if (props[i] in style) {
-  			return props[i];
-  		}
-  	}
-  	return false;
-  }
-
-  // @function setTransform(el: HTMLElement, offset: Point, scale?: Number)
-  // Resets the 3D CSS transform of `el` so it is translated by `offset` pixels
-  // and optionally scaled by `scale`. Does not have an effect if the
-  // browser doesn't support 3D CSS transforms.
-  function setTransform(el, offset, scale) {
-  	var pos = offset || new Point(0, 0);
-
-  	el.style[TRANSFORM] =
-  		(ie3d ?
-  			'translate(' + pos.x + 'px,' + pos.y + 'px)' :
-  			'translate3d(' + pos.x + 'px,' + pos.y + 'px,0)') +
-  		(scale ? ' scale(' + scale + ')' : '');
-  }
-
-  // @function setPosition(el: HTMLElement, position: Point)
-  // Sets the position of `el` to coordinates specified by `position`,
-  // using CSS translate or top/left positioning depending on the browser
-  // (used by Leaflet internally to position its layers).
-  function setPosition(el, point) {
-
-  	/*eslint-disable */
-  	el._leaflet_pos = point;
-  	/* eslint-enable */
-
-  	if (any3d) {
-  		setTransform(el, point);
-  	} else {
-  		el.style.left = point.x + 'px';
-  		el.style.top = point.y + 'px';
-  	}
-  }
-
-  // @function getPosition(el: HTMLElement): Point
-  // Returns the coordinates of an element previously positioned with setPosition.
-  function getPosition(el) {
-  	// this method is only used for elements previously positioned using setPosition,
-  	// so it's safe to cache the position for performance
-
-  	return el._leaflet_pos || new Point(0, 0);
-  }
-
-  // @function disableTextSelection()
-  // Prevents the user from generating `selectstart` DOM events, usually generated
-  // when the user drags the mouse through a page with text. Used internally
-  // by Leaflet to override the behaviour of any click-and-drag interaction on
-  // the map. Affects drag interactions on the whole document.
-
-  // @function enableTextSelection()
-  // Cancels the effects of a previous [`L.DomUtil.disableTextSelection`](#domutil-disabletextselection).
-  var disableTextSelection;
-  var enableTextSelection;
-  var _userSelect;
-  if ('onselectstart' in document) {
-  	disableTextSelection = function () {
-  		on(window, 'selectstart', preventDefault);
-  	};
-  	enableTextSelection = function () {
-  		off(window, 'selectstart', preventDefault);
-  	};
-  } else {
-  	var userSelectProperty = testProp(
-  		['userSelect', 'WebkitUserSelect', 'OUserSelect', 'MozUserSelect', 'msUserSelect']);
-
-  	disableTextSelection = function () {
-  		if (userSelectProperty) {
-  			var style = document.documentElement.style;
-  			_userSelect = style[userSelectProperty];
-  			style[userSelectProperty] = 'none';
-  		}
-  	};
-  	enableTextSelection = function () {
-  		if (userSelectProperty) {
-  			document.documentElement.style[userSelectProperty] = _userSelect;
-  			_userSelect = undefined;
-  		}
-  	};
-  }
-
-  // @function disableImageDrag()
-  // As [`L.DomUtil.disableTextSelection`](#domutil-disabletextselection), but
-  // for `dragstart` DOM events, usually generated when the user drags an image.
-  function disableImageDrag() {
-  	on(window, 'dragstart', preventDefault);
-  }
-
-  // @function enableImageDrag()
-  // Cancels the effects of a previous [`L.DomUtil.disableImageDrag`](#domutil-disabletextselection).
-  function enableImageDrag() {
-  	off(window, 'dragstart', preventDefault);
-  }
-
-  var _outlineElement, _outlineStyle;
-  // @function preventOutline(el: HTMLElement)
-  // Makes the [outline](https://developer.mozilla.org/docs/Web/CSS/outline)
-  // of the element `el` invisible. Used internally by Leaflet to prevent
-  // focusable elements from displaying an outline when the user performs a
-  // drag interaction on them.
-  function preventOutline(element) {
-  	while (element.tabIndex === -1) {
-  		element = element.parentNode;
-  	}
-  	if (!element.style) { return; }
-  	restoreOutline();
-  	_outlineElement = element;
-  	_outlineStyle = element.style.outline;
-  	element.style.outline = 'none';
-  	on(window, 'keydown', restoreOutline);
-  }
-
-  // @function restoreOutline()
-  // Cancels the effects of a previous [`L.DomUtil.preventOutline`]().
-  function restoreOutline() {
-  	if (!_outlineElement) { return; }
-  	_outlineElement.style.outline = _outlineStyle;
-  	_outlineElement = undefined;
-  	_outlineStyle = undefined;
-  	off(window, 'keydown', restoreOutline);
-  }
-
-  // @function getSizedParentNode(el: HTMLElement): HTMLElement
-  // Finds the closest parent node which size (width and height) is not null.
-  function getSizedParentNode(element) {
-  	do {
-  		element = element.parentNode;
-  	} while ((!element.offsetWidth || !element.offsetHeight) && element !== document.body);
-  	return element;
-  }
-
-  // @function getScale(el: HTMLElement): Object
-  // Computes the CSS scale currently applied on the element.
-  // Returns an object with `x` and `y` members as horizontal and vertical scales respectively,
-  // and `boundingClientRect` as the result of [`getBoundingClientRect()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect).
-  function getScale(element) {
-  	var rect = element.getBoundingClientRect(); // Read-only in old browsers.
-
-  	return {
-  		x: rect.width / element.offsetWidth || 1,
-  		y: rect.height / element.offsetHeight || 1,
-  		boundingClientRect: rect
-  	};
-  }
-
-  var DomUtil = ({
-    TRANSFORM: TRANSFORM,
-    TRANSITION: TRANSITION,
-    TRANSITION_END: TRANSITION_END,
-    get: get,
-    getStyle: getStyle,
-    create: create$1,
-    remove: remove,
-    empty: empty,
-    toFront: toFront,
-    toBack: toBack,
-    hasClass: hasClass,
-    addClass: addClass,
-    removeClass: removeClass,
-    setClass: setClass,
-    getClass: getClass,
-    setOpacity: setOpacity,
-    testProp: testProp,
-    setTransform: setTransform,
-    setPosition: setPosition,
-    getPosition: getPosition,
-    disableTextSelection: disableTextSelection,
-    enableTextSelection: enableTextSelection,
-    disableImageDrag: disableImageDrag,
-    enableImageDrag: enableImageDrag,
-    preventOutline: preventOutline,
-    restoreOutline: restoreOutline,
-    getSizedParentNode: getSizedParentNode,
-    getScale: getScale
-  });
-
-  /*
-   * @namespace DomEvent
-   * Utility functions to work with the [DOM events](https://developer.mozilla.org/docs/Web/API/Event), used by Leaflet internally.
-   */
-
-  // Inspired by John Resig, Dean Edwards and YUI addEvent implementations.
-
-  // @function on(el: HTMLElement, types: String, fn: Function, context?: Object): this
-  // Adds a listener function (`fn`) to a particular DOM event type of the
-  // element `el`. You can optionally specify the context of the listener
-  // (object the `this` keyword will point to). You can also pass several
-  // space-separated types (e.g. `'click dblclick'`).
-
-  // @alternative
-  // @function on(el: HTMLElement, eventMap: Object, context?: Object): this
-  // Adds a set of type/listener pairs, e.g. `{click: onClick, mousemove: onMouseMove}`
-  function on(obj, types, fn, context) {
-
-  	if (typeof types === 'object') {
-  		for (var type in types) {
-  			addOne(obj, type, types[type], fn);
-  		}
-  	} else {
-  		types = splitWords(types);
-
-  		for (var i = 0, len = types.length; i < len; i++) {
-  			addOne(obj, types[i], fn, context);
-  		}
-  	}
-
-  	return this;
-  }
-
-  var eventsKey = '_leaflet_events';
-
-  // @function off(el: HTMLElement, types: String, fn: Function, context?: Object): this
-  // Removes a previously added listener function.
-  // Note that if you passed a custom context to on, you must pass the same
-  // context to `off` in order to remove the listener.
-
-  // @alternative
-  // @function off(el: HTMLElement, eventMap: Object, context?: Object): this
-  // Removes a set of type/listener pairs, e.g. `{click: onClick, mousemove: onMouseMove}`
-  function off(obj, types, fn, context) {
-
-  	if (typeof types === 'object') {
-  		for (var type in types) {
-  			removeOne(obj, type, types[type], fn);
-  		}
-  	} else if (types) {
-  		types = splitWords(types);
-
-  		for (var i = 0, len = types.length; i < len; i++) {
-  			removeOne(obj, types[i], fn, context);
-  		}
-  	} else {
-  		for (var j in obj[eventsKey]) {
-  			removeOne(obj, j, obj[eventsKey][j]);
-  		}
-  		delete obj[eventsKey];
-  	}
-
-  	return this;
-  }
-
-  function browserFiresNativeDblClick() {
-  	// See https://github.com/w3c/pointerevents/issues/171
-  	if (pointer) {
-  		return !(edge || safari);
-  	}
-  }
-
-  var mouseSubst = {
-  	mouseenter: 'mouseover',
-  	mouseleave: 'mouseout',
-  	wheel: !('onwheel' in window) && 'mousewheel'
-  };
-
-  function addOne(obj, type, fn, context) {
-  	var id = type + stamp(fn) + (context ? '_' + stamp(context) : '');
-
-  	if (obj[eventsKey] && obj[eventsKey][id]) { return this; }
-
-  	var handler = function (e) {
-  		return fn.call(context || obj, e || window.event);
-  	};
-
-  	var originalHandler = handler;
-
-  	if (pointer && type.indexOf('touch') === 0) {
-  		// Needs DomEvent.Pointer.js
-  		addPointerListener(obj, type, handler, id);
-
-  	} else if (touch && (type === 'dblclick') && !browserFiresNativeDblClick()) {
-  		addDoubleTapListener(obj, handler, id);
-
-  	} else if ('addEventListener' in obj) {
-
-  		if (type === 'touchstart' || type === 'touchmove' || type === 'wheel' ||  type === 'mousewheel') {
-  			obj.addEventListener(mouseSubst[type] || type, handler, passiveEvents ? {passive: false} : false);
-
-  		} else if (type === 'mouseenter' || type === 'mouseleave') {
-  			handler = function (e) {
-  				e = e || window.event;
-  				if (isExternalTarget(obj, e)) {
-  					originalHandler(e);
-  				}
-  			};
-  			obj.addEventListener(mouseSubst[type], handler, false);
-
-  		} else {
-  			obj.addEventListener(type, originalHandler, false);
-  		}
-
-  	} else if ('attachEvent' in obj) {
-  		obj.attachEvent('on' + type, handler);
-  	}
-
-  	obj[eventsKey] = obj[eventsKey] || {};
-  	obj[eventsKey][id] = handler;
-  }
-
-  function removeOne(obj, type, fn, context) {
-
-  	var id = type + stamp(fn) + (context ? '_' + stamp(context) : ''),
-  	    handler = obj[eventsKey] && obj[eventsKey][id];
-
-  	if (!handler) { return this; }
-
-  	if (pointer && type.indexOf('touch') === 0) {
-  		removePointerListener(obj, type, id);
-
-  	} else if (touch && (type === 'dblclick') && !browserFiresNativeDblClick()) {
-  		removeDoubleTapListener(obj, id);
-
-  	} else if ('removeEventListener' in obj) {
-
-  		obj.removeEventListener(mouseSubst[type] || type, handler, false);
-
-  	} else if ('detachEvent' in obj) {
-  		obj.detachEvent('on' + type, handler);
-  	}
-
-  	obj[eventsKey][id] = null;
-  }
-
-  // @function stopPropagation(ev: DOMEvent): this
-  // Stop the given event from propagation to parent elements. Used inside the listener functions:
-  // ```js
-  // L.DomEvent.on(div, 'click', function (ev) {
-  // 	L.DomEvent.stopPropagation(ev);
-  // });
-  // ```
-  function stopPropagation(e) {
-
-  	if (e.stopPropagation) {
-  		e.stopPropagation();
-  	} else if (e.originalEvent) {  // In case of Leaflet event.
-  		e.originalEvent._stopped = true;
-  	} else {
-  		e.cancelBubble = true;
-  	}
-  	skipped(e);
-
-  	return this;
-  }
-
-  // @function disableScrollPropagation(el: HTMLElement): this
-  // Adds `stopPropagation` to the element's `'wheel'` events (plus browser variants).
-  function disableScrollPropagation(el) {
-  	addOne(el, 'wheel', stopPropagation);
-  	return this;
-  }
-
-  // @function disableClickPropagation(el: HTMLElement): this
-  // Adds `stopPropagation` to the element's `'click'`, `'doubleclick'`,
-  // `'mousedown'` and `'touchstart'` events (plus browser variants).
-  function disableClickPropagation(el) {
-  	on(el, 'mousedown touchstart dblclick', stopPropagation);
-  	addOne(el, 'click', fakeStop);
-  	return this;
-  }
-
-  // @function preventDefault(ev: DOMEvent): this
-  // Prevents the default action of the DOM Event `ev` from happening (such as
-  // following a link in the href of the a element, or doing a POST request
-  // with page reload when a `<form>` is submitted).
-  // Use it inside listener functions.
-  function preventDefault(e) {
-  	if (e.preventDefault) {
-  		e.preventDefault();
-  	} else {
-  		e.returnValue = false;
-  	}
-  	return this;
-  }
-
-  // @function stop(ev: DOMEvent): this
-  // Does `stopPropagation` and `preventDefault` at the same time.
-  function stop(e) {
-  	preventDefault(e);
-  	stopPropagation(e);
-  	return this;
-  }
-
-  // @function getMousePosition(ev: DOMEvent, container?: HTMLElement): Point
-  // Gets normalized mouse position from a DOM event relative to the
-  // `container` (border excluded) or to the whole page if not specified.
-  function getMousePosition(e, container) {
-  	if (!container) {
-  		return new Point(e.clientX, e.clientY);
-  	}
-
-  	var scale = getScale(container),
-  	    offset = scale.boundingClientRect; // left and top  values are in page scale (like the event clientX/Y)
-
-  	return new Point(
-  		// offset.left/top values are in page scale (like clientX/Y),
-  		// whereas clientLeft/Top (border width) values are the original values (before CSS scale applies).
-  		(e.clientX - offset.left) / scale.x - container.clientLeft,
-  		(e.clientY - offset.top) / scale.y - container.clientTop
-  	);
-  }
-
-  // Chrome on Win scrolls double the pixels as in other platforms (see #4538),
-  // and Firefox scrolls device pixels, not CSS pixels
-  var wheelPxFactor =
-  	(win && chrome) ? 2 * window.devicePixelRatio :
-  	gecko ? window.devicePixelRatio : 1;
-
-  // @function getWheelDelta(ev: DOMEvent): Number
-  // Gets normalized wheel delta from a wheel DOM event, in vertical
-  // pixels scrolled (negative if scrolling down).
-  // Events from pointing devices without precise scrolling are mapped to
-  // a best guess of 60 pixels.
-  function getWheelDelta(e) {
-  	return (edge) ? e.wheelDeltaY / 2 : // Don't trust window-geometry-based delta
-  	       (e.deltaY && e.deltaMode === 0) ? -e.deltaY / wheelPxFactor : // Pixels
-  	       (e.deltaY && e.deltaMode === 1) ? -e.deltaY * 20 : // Lines
-  	       (e.deltaY && e.deltaMode === 2) ? -e.deltaY * 60 : // Pages
-  	       (e.deltaX || e.deltaZ) ? 0 :	// Skip horizontal/depth wheel events
-  	       e.wheelDelta ? (e.wheelDeltaY || e.wheelDelta) / 2 : // Legacy IE pixels
-  	       (e.detail && Math.abs(e.detail) < 32765) ? -e.detail * 20 : // Legacy Moz lines
-  	       e.detail ? e.detail / -32765 * 60 : // Legacy Moz pages
-  	       0;
-  }
-
-  var skipEvents = {};
-
-  function fakeStop(e) {
-  	// fakes stopPropagation by setting a special event flag, checked/reset with skipped(e)
-  	skipEvents[e.type] = true;
-  }
-
-  function skipped(e) {
-  	var events = skipEvents[e.type];
-  	// reset when checking, as it's only used in map container and propagates outside of the map
-  	skipEvents[e.type] = false;
-  	return events;
-  }
-
-  // check if element really left/entered the event target (for mouseenter/mouseleave)
-  function isExternalTarget(el, e) {
-
-  	var related = e.relatedTarget;
-
-  	if (!related) { return true; }
-
-  	try {
-  		while (related && (related !== el)) {
-  			related = related.parentNode;
-  		}
-  	} catch (err) {
-  		return false;
-  	}
-  	return (related !== el);
-  }
-
-  var DomEvent = ({
-    on: on,
-    off: off,
-    stopPropagation: stopPropagation,
-    disableScrollPropagation: disableScrollPropagation,
-    disableClickPropagation: disableClickPropagation,
-    preventDefault: preventDefault,
-    stop: stop,
-    getMousePosition: getMousePosition,
-    getWheelDelta: getWheelDelta,
-    fakeStop: fakeStop,
-    skipped: skipped,
-    isExternalTarget: isExternalTarget,
-    addListener: on,
-    removeListener: off
-  });
-
-  /*
-   * @class PosAnimation
-   * @aka L.PosAnimation
-   * @inherits Evented
-   * Used internally for panning animations, utilizing CSS3 Transitions for modern browsers and a timer fallback for IE6-9.
-   *
-   * @example
-   * ```js
-   * var fx = new L.PosAnimation();
-   * fx.run(el, [300, 500], 0.5);
-   * ```
-   *
-   * @constructor L.PosAnimation()
-   * Creates a `PosAnimation` object.
-   *
-   */
-
-  var PosAnimation = Evented.extend({
-
-  	// @method run(el: HTMLElement, newPos: Point, duration?: Number, easeLinearity?: Number)
-  	// Run an animation of a given element to a new position, optionally setting
-  	// duration in seconds (`0.25` by default) and easing linearity factor (3rd
-  	// argument of the [cubic bezier curve](http://cubic-bezier.com/#0,0,.5,1),
-  	// `0.5` by default).
-  	run: function (el, newPos, duration, easeLinearity) {
-  		this.stop();
-
-  		this._el = el;
-  		this._inProgress = true;
-  		this._duration = duration || 0.25;
-  		this._easeOutPower = 1 / Math.max(easeLinearity || 0.5, 0.2);
-
-  		this._startPos = getPosition(el);
-  		this._offset = newPos.subtract(this._startPos);
-  		this._startTime = +new Date();
-
-  		// @event start: Event
-  		// Fired when the animation starts
-  		this.fire('start');
-
-  		this._animate();
-  	},
-
-  	// @method stop()
-  	// Stops the animation (if currently running).
-  	stop: function () {
-  		if (!this._inProgress) { return; }
-
-  		this._step(true);
-  		this._complete();
-  	},
-
-  	_animate: function () {
-  		// animation loop
-  		this._animId = requestAnimFrame(this._animate, this);
-  		this._step();
-  	},
-
-  	_step: function (round) {
-  		var elapsed = (+new Date()) - this._startTime,
-  		    duration = this._duration * 1000;
-
-  		if (elapsed < duration) {
-  			this._runFrame(this._easeOut(elapsed / duration), round);
-  		} else {
-  			this._runFrame(1);
-  			this._complete();
-  		}
-  	},
-
-  	_runFrame: function (progress, round) {
-  		var pos = this._startPos.add(this._offset.multiplyBy(progress));
-  		if (round) {
-  			pos._round();
-  		}
-  		setPosition(this._el, pos);
-
-  		// @event step: Event
-  		// Fired continuously during the animation.
-  		this.fire('step');
-  	},
-
-  	_complete: function () {
-  		cancelAnimFrame(this._animId);
-
-  		this._inProgress = false;
-  		// @event end: Event
-  		// Fired when the animation ends.
-  		this.fire('end');
-  	},
-
-  	_easeOut: function (t) {
-  		return 1 - Math.pow(1 - t, this._easeOutPower);
-  	}
-  });
-
-  /*
-   * @class Map
-   * @aka L.Map
-   * @inherits Evented
-   *
-   * The central class of the API — it is used to create a map on a page and manipulate it.
-   *
-   * @example
-   *
-   * ```js
-   * // initialize the map on the "map" div with a given center and zoom
-   * var map = L.map('map', {
-   * 	center: [51.505, -0.09],
-   * 	zoom: 13
-   * });
-   * ```
-   *
-   */
-
-  var Map = Evented.extend({
-
-  	options: {
-  		// @section Map State Options
-  		// @option crs: CRS = L.CRS.EPSG3857
-  		// The [Coordinate Reference System](#crs) to use. Don't change this if you're not
-  		// sure what it means.
-  		crs: EPSG3857,
-
-  		// @option center: LatLng = undefined
-  		// Initial geographic center of the map
-  		center: undefined,
-
-  		// @option zoom: Number = undefined
-  		// Initial map zoom level
-  		zoom: undefined,
-
-  		// @option minZoom: Number = *
-  		// Minimum zoom level of the map.
-  		// If not specified and at least one `GridLayer` or `TileLayer` is in the map,
-  		// the lowest of their `minZoom` options will be used instead.
-  		minZoom: undefined,
-
-  		// @option maxZoom: Number = *
-  		// Maximum zoom level of the map.
-  		// If not specified and at least one `GridLayer` or `TileLayer` is in the map,
-  		// the highest of their `maxZoom` options will be used instead.
-  		maxZoom: undefined,
-
-  		// @option layers: Layer[] = []
-  		// Array of layers that will be added to the map initially
-  		layers: [],
-
-  		// @option maxBounds: LatLngBounds = null
-  		// When this option is set, the map restricts the view to the given
-  		// geographical bounds, bouncing the user back if the user tries to pan
-  		// outside the view. To set the restriction dynamically, use
-  		// [`setMaxBounds`](#map-setmaxbounds) method.
-  		maxBounds: undefined,
-
-  		// @option renderer: Renderer = *
-  		// The default method for drawing vector layers on the map. `L.SVG`
-  		// or `L.Canvas` by default depending on browser support.
-  		renderer: undefined,
-
-
-  		// @section Animation Options
-  		// @option zoomAnimation: Boolean = true
-  		// Whether the map zoom animation is enabled. By default it's enabled
-  		// in all browsers that support CSS3 Transitions except Android.
-  		zoomAnimation: true,
-
-  		// @option zoomAnimationThreshold: Number = 4
-  		// Won't animate zoom if the zoom difference exceeds this value.
-  		zoomAnimationThreshold: 4,
-
-  		// @option fadeAnimation: Boolean = true
-  		// Whether the tile fade animation is enabled. By default it's enabled
-  		// in all browsers that support CSS3 Transitions except Android.
-  		fadeAnimation: true,
-
-  		// @option markerZoomAnimation: Boolean = true
-  		// Whether markers animate their zoom with the zoom animation, if disabled
-  		// they will disappear for the length of the animation. By default it's
-  		// enabled in all browsers that support CSS3 Transitions except Android.
-  		markerZoomAnimation: true,
-
-  		// @option transform3DLimit: Number = 2^23
-  		// Defines the maximum size of a CSS translation transform. The default
-  		// value should not be changed unless a web browser positions layers in
-  		// the wrong place after doing a large `panBy`.
-  		transform3DLimit: 8388608, // Precision limit of a 32-bit float
-
-  		// @section Interaction Options
-  		// @option zoomSnap: Number = 1
-  		// Forces the map's zoom level to always be a multiple of this, particularly
-  		// right after a [`fitBounds()`](#map-fitbounds) or a pinch-zoom.
-  		// By default, the zoom level snaps to the nearest integer; lower values
-  		// (e.g. `0.5` or `0.1`) allow for greater granularity. A value of `0`
-  		// means the zoom level will not be snapped after `fitBounds` or a pinch-zoom.
-  		zoomSnap: 1,
-
-  		// @option zoomDelta: Number = 1
-  		// Controls how much the map's zoom level will change after a
-  		// [`zoomIn()`](#map-zoomin), [`zoomOut()`](#map-zoomout), pressing `+`
-  		// or `-` on the keyboard, or using the [zoom controls](#control-zoom).
-  		// Values smaller than `1` (e.g. `0.5`) allow for greater granularity.
-  		zoomDelta: 1,
-
-  		// @option trackResize: Boolean = true
-  		// Whether the map automatically handles browser window resize to update itself.
-  		trackResize: true
-  	},
-
-  	initialize: function (id, options) { // (HTMLElement or String, Object)
-  		options = setOptions(this, options);
-
-  		// Make sure to assign internal flags at the beginning,
-  		// to avoid inconsistent state in some edge cases.
-  		this._handlers = [];
-  		this._layers = {};
-  		this._zoomBoundLayers = {};
-  		this._sizeChanged = true;
-
-  		this._initContainer(id);
-  		this._initLayout();
-
-  		// hack for https://github.com/Leaflet/Leaflet/issues/1980
-  		this._onResize = bind(this._onResize, this);
-
-  		this._initEvents();
-
-  		if (options.maxBounds) {
-  			this.setMaxBounds(options.maxBounds);
-  		}
-
-  		if (options.zoom !== undefined) {
-  			this._zoom = this._limitZoom(options.zoom);
-  		}
-
-  		if (options.center && options.zoom !== undefined) {
-  			this.setView(toLatLng(options.center), options.zoom, {reset: true});
-  		}
-
-  		this.callInitHooks();
-
-  		// don't animate on browsers without hardware-accelerated transitions or old Android/Opera
-  		this._zoomAnimated = TRANSITION && any3d && !mobileOpera &&
-  				this.options.zoomAnimation;
-
-  		// zoom transitions run with the same duration for all layers, so if one of transitionend events
-  		// happens after starting zoom animation (propagating to the map pane), we know that it ended globally
-  		if (this._zoomAnimated) {
-  			this._createAnimProxy();
-  			on(this._proxy, TRANSITION_END, this._catchTransitionEnd, this);
-  		}
-
-  		this._addLayers(this.options.layers);
-  	},
-
-
-  	// @section Methods for modifying map state
-
-  	// @method setView(center: LatLng, zoom: Number, options?: Zoom/pan options): this
-  	// Sets the view of the map (geographical center and zoom) with the given
-  	// animation options.
-  	setView: function (center, zoom, options) {
-
-  		zoom = zoom === undefined ? this._zoom : this._limitZoom(zoom);
-  		center = this._limitCenter(toLatLng(center), zoom, this.options.maxBounds);
-  		options = options || {};
-
-  		this._stop();
-
-  		if (this._loaded && !options.reset && options !== true) {
-
-  			if (options.animate !== undefined) {
-  				options.zoom = extend({animate: options.animate}, options.zoom);
-  				options.pan = extend({animate: options.animate, duration: options.duration}, options.pan);
-  			}
-
-  			// try animating pan or zoom
-  			var moved = (this._zoom !== zoom) ?
-  				this._tryAnimatedZoom && this._tryAnimatedZoom(center, zoom, options.zoom) :
-  				this._tryAnimatedPan(center, options.pan);
-
-  			if (moved) {
-  				// prevent resize handler call, the view will refresh after animation anyway
-  				clearTimeout(this._sizeTimer);
-  				return this;
-  			}
-  		}
-
-  		// animation didn't start, just reset the map view
-  		this._resetView(center, zoom);
-
-  		return this;
-  	},
-
-  	// @method setZoom(zoom: Number, options?: Zoom/pan options): this
-  	// Sets the zoom of the map.
-  	setZoom: function (zoom, options) {
-  		if (!this._loaded) {
-  			this._zoom = zoom;
-  			return this;
-  		}
-  		return this.setView(this.getCenter(), zoom, {zoom: options});
-  	},
-
-  	// @method zoomIn(delta?: Number, options?: Zoom options): this
-  	// Increases the zoom of the map by `delta` ([`zoomDelta`](#map-zoomdelta) by default).
-  	zoomIn: function (delta, options) {
-  		delta = delta || (any3d ? this.options.zoomDelta : 1);
-  		return this.setZoom(this._zoom + delta, options);
-  	},
-
-  	// @method zoomOut(delta?: Number, options?: Zoom options): this
-  	// Decreases the zoom of the map by `delta` ([`zoomDelta`](#map-zoomdelta) by default).
-  	zoomOut: function (delta, options) {
-  		delta = delta || (any3d ? this.options.zoomDelta : 1);
-  		return this.setZoom(this._zoom - delta, options);
-  	},
-
-  	// @method setZoomAround(latlng: LatLng, zoom: Number, options: Zoom options): this
-  	// Zooms the map while keeping a specified geographical point on the map
-  	// stationary (e.g. used internally for scroll zoom and double-click zoom).
-  	// @alternative
-  	// @method setZoomAround(offset: Point, zoom: Number, options: Zoom options): this
-  	// Zooms the map while keeping a specified pixel on the map (relative to the top-left corner) stationary.
-  	setZoomAround: function (latlng, zoom, options) {
-  		var scale = this.getZoomScale(zoom),
-  		    viewHalf = this.getSize().divideBy(2),
-  		    containerPoint = latlng instanceof Point ? latlng : this.latLngToContainerPoint(latlng),
-
-  		    centerOffset = containerPoint.subtract(viewHalf).multiplyBy(1 - 1 / scale),
-  		    newCenter = this.containerPointToLatLng(viewHalf.add(centerOffset));
-
-  		return this.setView(newCenter, zoom, {zoom: options});
-  	},
-
-  	_getBoundsCenterZoom: function (bounds, options) {
-
-  		options = options || {};
-  		bounds = bounds.getBounds ? bounds.getBounds() : toLatLngBounds(bounds);
-
-  		var paddingTL = toPoint(options.paddingTopLeft || options.padding || [0, 0]),
-  		    paddingBR = toPoint(options.paddingBottomRight || options.padding || [0, 0]),
-
-  		    zoom = this.getBoundsZoom(bounds, false, paddingTL.add(paddingBR));
-
-  		zoom = (typeof options.maxZoom === 'number') ? Math.min(options.maxZoom, zoom) : zoom;
-
-  		if (zoom === Infinity) {
-  			return {
-  				center: bounds.getCenter(),
-  				zoom: zoom
-  			};
-  		}
-
-  		var paddingOffset = paddingBR.subtract(paddingTL).divideBy(2),
-
-  		    swPoint = this.project(bounds.getSouthWest(), zoom),
-  		    nePoint = this.project(bounds.getNorthEast(), zoom),
-  		    center = this.unproject(swPoint.add(nePoint).divideBy(2).add(paddingOffset), zoom);
-
-  		return {
-  			center: center,
-  			zoom: zoom
-  		};
-  	},
-
-  	// @method fitBounds(bounds: LatLngBounds, options?: fitBounds options): this
-  	// Sets a map view that contains the given geographical bounds with the
-  	// maximum zoom level possible.
-  	fitBounds: function (bounds, options) {
-
-  		bounds = toLatLngBounds(bounds);
-
-  		if (!bounds.isValid()) {
-  			throw new Error('Bounds are not valid.');
-  		}
-
-  		var target = this._getBoundsCenterZoom(bounds, options);
-  		return this.setView(target.center, target.zoom, options);
-  	},
-
-  	// @method fitWorld(options?: fitBounds options): this
-  	// Sets a map view that mostly contains the whole world with the maximum
-  	// zoom level possible.
-  	fitWorld: function (options) {
-  		return this.fitBounds([[-90, -180], [90, 180]], options);
-  	},
-
-  	// @method panTo(latlng: LatLng, options?: Pan options): this
-  	// Pans the map to a given center.
-  	panTo: function (center, options) { // (LatLng)
-  		return this.setView(center, this._zoom, {pan: options});
-  	},
-
-  	// @method panBy(offset: Point, options?: Pan options): this
-  	// Pans the map by a given number of pixels (animated).
-  	panBy: function (offset, options) {
-  		offset = toPoint(offset).round();
-  		options = options || {};
-
-  		if (!offset.x && !offset.y) {
-  			return this.fire('moveend');
-  		}
-  		// If we pan too far, Chrome gets issues with tiles
-  		// and makes them disappear or appear in the wrong place (slightly offset) #2602
-  		if (options.animate !== true && !this.getSize().contains(offset)) {
-  			this._resetView(this.unproject(this.project(this.getCenter()).add(offset)), this.getZoom());
-  			return this;
-  		}
-
-  		if (!this._panAnim) {
-  			this._panAnim = new PosAnimation();
-
-  			this._panAnim.on({
-  				'step': this._onPanTransitionStep,
-  				'end': this._onPanTransitionEnd
-  			}, this);
-  		}
-
-  		// don't fire movestart if animating inertia
-  		if (!options.noMoveStart) {
-  			this.fire('movestart');
-  		}
-
-  		// animate pan unless animate: false specified
-  		if (options.animate !== false) {
-  			addClass(this._mapPane, 'leaflet-pan-anim');
-
-  			var newPos = this._getMapPanePos().subtract(offset).round();
-  			this._panAnim.run(this._mapPane, newPos, options.duration || 0.25, options.easeLinearity);
-  		} else {
-  			this._rawPanBy(offset);
-  			this.fire('move').fire('moveend');
-  		}
-
-  		return this;
-  	},
-
-  	// @method flyTo(latlng: LatLng, zoom?: Number, options?: Zoom/pan options): this
-  	// Sets the view of the map (geographical center and zoom) performing a smooth
-  	// pan-zoom animation.
-  	flyTo: function (targetCenter, targetZoom, options) {
-
-  		options = options || {};
-  		if (options.animate === false || !any3d) {
-  			return this.setView(targetCenter, targetZoom, options);
-  		}
-
-  		this._stop();
-
-  		var from = this.project(this.getCenter()),
-  		    to = this.project(targetCenter),
-  		    size = this.getSize(),
-  		    startZoom = this._zoom;
-
-  		targetCenter = toLatLng(targetCenter);
-  		targetZoom = targetZoom === undefined ? startZoom : targetZoom;
-
-  		var w0 = Math.max(size.x, size.y),
-  		    w1 = w0 * this.getZoomScale(startZoom, targetZoom),
-  		    u1 = (to.distanceTo(from)) || 1,
-  		    rho = 1.42,
-  		    rho2 = rho * rho;
-
-  		function r(i) {
-  			var s1 = i ? -1 : 1,
-  			    s2 = i ? w1 : w0,
-  			    t1 = w1 * w1 - w0 * w0 + s1 * rho2 * rho2 * u1 * u1,
-  			    b1 = 2 * s2 * rho2 * u1,
-  			    b = t1 / b1,
-  			    sq = Math.sqrt(b * b + 1) - b;
-
-  			    // workaround for floating point precision bug when sq = 0, log = -Infinite,
-  			    // thus triggering an infinite loop in flyTo
-  			    var log = sq < 0.000000001 ? -18 : Math.log(sq);
-
-  			return log;
-  		}
-
-  		function sinh(n) { return (Math.exp(n) - Math.exp(-n)) / 2; }
-  		function cosh(n) { return (Math.exp(n) + Math.exp(-n)) / 2; }
-  		function tanh(n) { return sinh(n) / cosh(n); }
-
-  		var r0 = r(0);
-
-  		function w(s) { return w0 * (cosh(r0) / cosh(r0 + rho * s)); }
-  		function u(s) { return w0 * (cosh(r0) * tanh(r0 + rho * s) - sinh(r0)) / rho2; }
-
-  		function easeOut(t) { return 1 - Math.pow(1 - t, 1.5); }
-
-  		var start = Date.now(),
-  		    S = (r(1) - r0) / rho,
-  		    duration = options.duration ? 1000 * options.duration : 1000 * S * 0.8;
-
-  		function frame() {
-  			var t = (Date.now() - start) / duration,
-  			    s = easeOut(t) * S;
-
-  			if (t <= 1) {
-  				this._flyToFrame = requestAnimFrame(frame, this);
-
-  				this._move(
-  					this.unproject(from.add(to.subtract(from).multiplyBy(u(s) / u1)), startZoom),
-  					this.getScaleZoom(w0 / w(s), startZoom),
-  					{flyTo: true});
-
-  			} else {
-  				this
-  					._move(targetCenter, targetZoom)
-  					._moveEnd(true);
-  			}
-  		}
-
-  		this._moveStart(true, options.noMoveStart);
-
-  		frame.call(this);
-  		return this;
-  	},
-
-  	// @method flyToBounds(bounds: LatLngBounds, options?: fitBounds options): this
-  	// Sets the view of the map with a smooth animation like [`flyTo`](#map-flyto),
-  	// but takes a bounds parameter like [`fitBounds`](#map-fitbounds).
-  	flyToBounds: function (bounds, options) {
-  		var target = this._getBoundsCenterZoom(bounds, options);
-  		return this.flyTo(target.center, target.zoom, options);
-  	},
-
-  	// @method setMaxBounds(bounds: LatLngBounds): this
-  	// Restricts the map view to the given bounds (see the [maxBounds](#map-maxbounds) option).
-  	setMaxBounds: function (bounds) {
-  		bounds = toLatLngBounds(bounds);
-
-  		if (!bounds.isValid()) {
-  			this.options.maxBounds = null;
-  			return this.off('moveend', this._panInsideMaxBounds);
-  		} else if (this.options.maxBounds) {
-  			this.off('moveend', this._panInsideMaxBounds);
-  		}
-
-  		this.options.maxBounds = bounds;
-
-  		if (this._loaded) {
-  			this._panInsideMaxBounds();
-  		}
-
-  		return this.on('moveend', this._panInsideMaxBounds);
-  	},
-
-  	// @method setMinZoom(zoom: Number): this
-  	// Sets the lower limit for the available zoom levels (see the [minZoom](#map-minzoom) option).
-  	setMinZoom: function (zoom) {
-  		var oldZoom = this.options.minZoom;
-  		this.options.minZoom = zoom;
-
-  		if (this._loaded && oldZoom !== zoom) {
-  			this.fire('zoomlevelschange');
-
-  			if (this.getZoom() < this.options.minZoom) {
-  				return this.setZoom(zoom);
-  			}
-  		}
-
-  		return this;
-  	},
-
-  	// @method setMaxZoom(zoom: Number): this
-  	// Sets the upper limit for the available zoom levels (see the [maxZoom](#map-maxzoom) option).
-  	setMaxZoom: function (zoom) {
-  		var oldZoom = this.options.maxZoom;
-  		this.options.maxZoom = zoom;
-
-  		if (this._loaded && oldZoom !== zoom) {
-  			this.fire('zoomlevelschange');
-
-  			if (this.getZoom() > this.options.maxZoom) {
-  				return this.setZoom(zoom);
-  			}
-  		}
-
-  		return this;
-  	},
-
-  	// @method panInsideBounds(bounds: LatLngBounds, options?: Pan options): this
-  	// Pans the map to the closest view that would lie inside the given bounds (if it's not already), controlling the animation using the options specific, if any.
-  	panInsideBounds: function (bounds, options) {
-  		this._enforcingBounds = true;
-  		var center = this.getCenter(),
-  		    newCenter = this._limitCenter(center, this._zoom, toLatLngBounds(bounds));
-
-  		if (!center.equals(newCenter)) {
-  			this.panTo(newCenter, options);
-  		}
-
-  		this._enforcingBounds = false;
-  		return this;
-  	},
-
-  	// @method panInside(latlng: LatLng, options?: options): this
-  	// Pans the map the minimum amount to make the `latlng` visible. Use
-  	// `padding`, `paddingTopLeft` and `paddingTopRight` options to fit
-  	// the display to more restricted bounds, like [`fitBounds`](#map-fitbounds).
-  	// If `latlng` is already within the (optionally padded) display bounds,
-  	// the map will not be panned.
-  	panInside: function (latlng, options) {
-  		options = options || {};
-
-  		var paddingTL = toPoint(options.paddingTopLeft || options.padding || [0, 0]),
-  		    paddingBR = toPoint(options.paddingBottomRight || options.padding || [0, 0]),
-  		    center = this.getCenter(),
-  		    pixelCenter = this.project(center),
-  		    pixelPoint = this.project(latlng),
-  		    pixelBounds = this.getPixelBounds(),
-  		    halfPixelBounds = pixelBounds.getSize().divideBy(2),
-  		    paddedBounds = toBounds([pixelBounds.min.add(paddingTL), pixelBounds.max.subtract(paddingBR)]);
-
-  		if (!paddedBounds.contains(pixelPoint)) {
-  			this._enforcingBounds = true;
-  			var diff = pixelCenter.subtract(pixelPoint),
-  			    newCenter = toPoint(pixelPoint.x + diff.x, pixelPoint.y + diff.y);
-
-  			if (pixelPoint.x < paddedBounds.min.x || pixelPoint.x > paddedBounds.max.x) {
-  				newCenter.x = pixelCenter.x - diff.x;
-  				if (diff.x > 0) {
-  					newCenter.x += halfPixelBounds.x - paddingTL.x;
-  				} else {
-  					newCenter.x -= halfPixelBounds.x - paddingBR.x;
-  				}
-  			}
-  			if (pixelPoint.y < paddedBounds.min.y || pixelPoint.y > paddedBounds.max.y) {
-  				newCenter.y = pixelCenter.y - diff.y;
-  				if (diff.y > 0) {
-  					newCenter.y += halfPixelBounds.y - paddingTL.y;
-  				} else {
-  					newCenter.y -= halfPixelBounds.y - paddingBR.y;
-  				}
-  			}
-  			this.panTo(this.unproject(newCenter), options);
-  			this._enforcingBounds = false;
-  		}
-  		return this;
-  	},
-
-  	// @method invalidateSize(options: Zoom/pan options): this
-  	// Checks if the map container size changed and updates the map if so —
-  	// call it after you've changed the map size dynamically, also animating
-  	// pan by default. If `options.pan` is `false`, panning will not occur.
-  	// If `options.debounceMoveend` is `true`, it will delay `moveend` event so
-  	// that it doesn't happen often even if the method is called many
-  	// times in a row.
-
-  	// @alternative
-  	// @method invalidateSize(animate: Boolean): this
-  	// Checks if the map container size changed and updates the map if so —
-  	// call it after you've changed the map size dynamically, also animating
-  	// pan by default.
-  	invalidateSize: function (options) {
-  		if (!this._loaded) { return this; }
-
-  		options = extend({
-  			animate: false,
-  			pan: true
-  		}, options === true ? {animate: true} : options);
-
-  		var oldSize = this.getSize();
-  		this._sizeChanged = true;
-  		this._lastCenter = null;
-
-  		var newSize = this.getSize(),
-  		    oldCenter = oldSize.divideBy(2).round(),
-  		    newCenter = newSize.divideBy(2).round(),
-  		    offset = oldCenter.subtract(newCenter);
-
-  		if (!offset.x && !offset.y) { return this; }
-
-  		if (options.animate && options.pan) {
-  			this.panBy(offset);
-
-  		} else {
-  			if (options.pan) {
-  				this._rawPanBy(offset);
-  			}
-
-  			this.fire('move');
-
-  			if (options.debounceMoveend) {
-  				clearTimeout(this._sizeTimer);
-  				this._sizeTimer = setTimeout(bind(this.fire, this, 'moveend'), 200);
-  			} else {
-  				this.fire('moveend');
-  			}
-  		}
-
-  		// @section Map state change events
-  		// @event resize: ResizeEvent
-  		// Fired when the map is resized.
-  		return this.fire('resize', {
-  			oldSize: oldSize,
-  			newSize: newSize
-  		});
-  	},
-
-  	// @section Methods for modifying map state
-  	// @method stop(): this
-  	// Stops the currently running `panTo` or `flyTo` animation, if any.
-  	stop: function () {
-  		this.setZoom(this._limitZoom(this._zoom));
-  		if (!this.options.zoomSnap) {
-  			this.fire('viewreset');
-  		}
-  		return this._stop();
-  	},
-
-  	// @section Geolocation methods
-  	// @method locate(options?: Locate options): this
-  	// Tries to locate the user using the Geolocation API, firing a [`locationfound`](#map-locationfound)
-  	// event with location data on success or a [`locationerror`](#map-locationerror) event on failure,
-  	// and optionally sets the map view to the user's location with respect to
-  	// detection accuracy (or to the world view if geolocation failed).
-  	// Note that, if your page doesn't use HTTPS, this method will fail in
-  	// modern browsers ([Chrome 50 and newer](https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-powerful-features-on-insecure-origins))
-  	// See `Locate options` for more details.
-  	locate: function (options) {
-
-  		options = this._locateOptions = extend({
-  			timeout: 10000,
-  			watch: false
-  			// setView: false
-  			// maxZoom: <Number>
-  			// maximumAge: 0
-  			// enableHighAccuracy: false
-  		}, options);
-
-  		if (!('geolocation' in navigator)) {
-  			this._handleGeolocationError({
-  				code: 0,
-  				message: 'Geolocation not supported.'
-  			});
-  			return this;
-  		}
-
-  		var onResponse = bind(this._handleGeolocationResponse, this),
-  		    onError = bind(this._handleGeolocationError, this);
-
-  		if (options.watch) {
-  			this._locationWatchId =
-  			        navigator.geolocation.watchPosition(onResponse, onError, options);
-  		} else {
-  			navigator.geolocation.getCurrentPosition(onResponse, onError, options);
-  		}
-  		return this;
-  	},
-
-  	// @method stopLocate(): this
-  	// Stops watching location previously initiated by `map.locate({watch: true})`
-  	// and aborts resetting the map view if map.locate was called with
-  	// `{setView: true}`.
-  	stopLocate: function () {
-  		if (navigator.geolocation && navigator.geolocation.clearWatch) {
-  			navigator.geolocation.clearWatch(this._locationWatchId);
-  		}
-  		if (this._locateOptions) {
-  			this._locateOptions.setView = false;
-  		}
-  		return this;
-  	},
-
-  	_handleGeolocationError: function (error) {
-  		var c = error.code,
-  		    message = error.message ||
-  		            (c === 1 ? 'permission denied' :
-  		            (c === 2 ? 'position unavailable' : 'timeout'));
-
-  		if (this._locateOptions.setView && !this._loaded) {
-  			this.fitWorld();
-  		}
-
-  		// @section Location events
-  		// @event locationerror: ErrorEvent
-  		// Fired when geolocation (using the [`locate`](#map-locate) method) failed.
-  		this.fire('locationerror', {
-  			code: c,
-  			message: 'Geolocation error: ' + message + '.'
-  		});
-  	},
-
-  	_handleGeolocationResponse: function (pos) {
-  		var lat = pos.coords.latitude,
-  		    lng = pos.coords.longitude,
-  		    latlng = new LatLng(lat, lng),
-  		    bounds = latlng.toBounds(pos.coords.accuracy * 2),
-  		    options = this._locateOptions;
-
-  		if (options.setView) {
-  			var zoom = this.getBoundsZoom(bounds);
-  			this.setView(latlng, options.maxZoom ? Math.min(zoom, options.maxZoom) : zoom);
-  		}
-
-  		var data = {
-  			latlng: latlng,
-  			bounds: bounds,
-  			timestamp: pos.timestamp
-  		};
-
-  		for (var i in pos.coords) {
-  			if (typeof pos.coords[i] === 'number') {
-  				data[i] = pos.coords[i];
-  			}
-  		}
-
-  		// @event locationfound: LocationEvent
-  		// Fired when geolocation (using the [`locate`](#map-locate) method)
-  		// went successfully.
-  		this.fire('locationfound', data);
-  	},
-
-  	// TODO Appropriate docs section?
-  	// @section Other Methods
-  	// @method addHandler(name: String, HandlerClass: Function): this
-  	// Adds a new `Handler` to the map, given its name and constructor function.
-  	addHandler: function (name, HandlerClass) {
-  		if (!HandlerClass) { return this; }
-
-  		var handler = this[name] = new HandlerClass(this);
-
-  		this._handlers.push(handler);
-
-  		if (this.options[name]) {
-  			handler.enable();
-  		}
-
-  		return this;
-  	},
-
-  	// @method remove(): this
-  	// Destroys the map and clears all related event listeners.
-  	remove: function () {
-
-  		this._initEvents(true);
-  		this.off('moveend', this._panInsideMaxBounds);
-
-  		if (this._containerId !== this._container._leaflet_id) {
-  			throw new Error('Map container is being reused by another instance');
-  		}
-
-  		try {
-  			// throws error in IE6-8
-  			delete this._container._leaflet_id;
-  			delete this._containerId;
-  		} catch (e) {
-  			/*eslint-disable */
-  			this._container._leaflet_id = undefined;
-  			/* eslint-enable */
-  			this._containerId = undefined;
-  		}
-
-  		if (this._locationWatchId !== undefined) {
-  			this.stopLocate();
-  		}
-
-  		this._stop();
-
-  		remove(this._mapPane);
-
-  		if (this._clearControlPos) {
-  			this._clearControlPos();
-  		}
-  		if (this._resizeRequest) {
-  			cancelAnimFrame(this._resizeRequest);
-  			this._resizeRequest = null;
-  		}
-
-  		this._clearHandlers();
-
-  		if (this._loaded) {
-  			// @section Map state change events
-  			// @event unload: Event
-  			// Fired when the map is destroyed with [remove](#map-remove) method.
-  			this.fire('unload');
-  		}
-
-  		var i;
-  		for (i in this._layers) {
-  			this._layers[i].remove();
-  		}
-  		for (i in this._panes) {
-  			remove(this._panes[i]);
-  		}
-
-  		this._layers = [];
-  		this._panes = [];
-  		delete this._mapPane;
-  		delete this._renderer;
-
-  		return this;
-  	},
-
-  	// @section Other Methods
-  	// @method createPane(name: String, container?: HTMLElement): HTMLElement
-  	// Creates a new [map pane](#map-pane) with the given name if it doesn't exist already,
-  	// then returns it. The pane is created as a child of `container`, or
-  	// as a child of the main map pane if not set.
-  	createPane: function (name, container) {
-  		var className = 'leaflet-pane' + (name ? ' leaflet-' + name.replace('Pane', '') + '-pane' : ''),
-  		    pane = create$1('div', className, container || this._mapPane);
-
-  		if (name) {
-  			this._panes[name] = pane;
-  		}
-  		return pane;
-  	},
-
-  	// @section Methods for Getting Map State
-
-  	// @method getCenter(): LatLng
-  	// Returns the geographical center of the map view
-  	getCenter: function () {
-  		this._checkIfLoaded();
-
-  		if (this._lastCenter && !this._moved()) {
-  			return this._lastCenter;
-  		}
-  		return this.layerPointToLatLng(this._getCenterLayerPoint());
-  	},
-
-  	// @method getZoom(): Number
-  	// Returns the current zoom level of the map view
-  	getZoom: function () {
-  		return this._zoom;
-  	},
-
-  	// @method getBounds(): LatLngBounds
-  	// Returns the geographical bounds visible in the current map view
-  	getBounds: function () {
-  		var bounds = this.getPixelBounds(),
-  		    sw = this.unproject(bounds.getBottomLeft()),
-  		    ne = this.unproject(bounds.getTopRight());
-
-  		return new LatLngBounds(sw, ne);
-  	},
-
-  	// @method getMinZoom(): Number
-  	// Returns the minimum zoom level of the map (if set in the `minZoom` option of the map or of any layers), or `0` by default.
-  	getMinZoom: function () {
-  		return this.options.minZoom === undefined ? this._layersMinZoom || 0 : this.options.minZoom;
-  	},
-
-  	// @method getMaxZoom(): Number
-  	// Returns the maximum zoom level of the map (if set in the `maxZoom` option of the map or of any layers).
-  	getMaxZoom: function () {
-  		return this.options.maxZoom === undefined ?
-  			(this._layersMaxZoom === undefined ? Infinity : this._layersMaxZoom) :
-  			this.options.maxZoom;
-  	},
-
-  	// @method getBoundsZoom(bounds: LatLngBounds, inside?: Boolean, padding?: Point): Number
-  	// Returns the maximum zoom level on which the given bounds fit to the map
-  	// view in its entirety. If `inside` (optional) is set to `true`, the method
-  	// instead returns the minimum zoom level on which the map view fits into
-  	// the given bounds in its entirety.
-  	getBoundsZoom: function (bounds, inside, padding) { // (LatLngBounds[, Boolean, Point]) -> Number
-  		bounds = toLatLngBounds(bounds);
-  		padding = toPoint(padding || [0, 0]);
-
-  		var zoom = this.getZoom() || 0,
-  		    min = this.getMinZoom(),
-  		    max = this.getMaxZoom(),
-  		    nw = bounds.getNorthWest(),
-  		    se = bounds.getSouthEast(),
-  		    size = this.getSize().subtract(padding),
-  		    boundsSize = toBounds(this.project(se, zoom), this.project(nw, zoom)).getSize(),
-  		    snap = any3d ? this.options.zoomSnap : 1,
-  		    scalex = size.x / boundsSize.x,
-  		    scaley = size.y / boundsSize.y,
-  		    scale = inside ? Math.max(scalex, scaley) : Math.min(scalex, scaley);
-
-  		zoom = this.getScaleZoom(scale, zoom);
-
-  		if (snap) {
-  			zoom = Math.round(zoom / (snap / 100)) * (snap / 100); // don't jump if within 1% of a snap level
-  			zoom = inside ? Math.ceil(zoom / snap) * snap : Math.floor(zoom / snap) * snap;
-  		}
-
-  		return Math.max(min, Math.min(max, zoom));
-  	},
-
-  	// @method getSize(): Point
-  	// Returns the current size of the map container (in pixels).
-  	getSize: function () {
-  		if (!this._size || this._sizeChanged) {
-  			this._size = new Point(
-  				this._container.clientWidth || 0,
-  				this._container.clientHeight || 0);
-
-  			this._sizeChanged = false;
-  		}
-  		return this._size.clone();
-  	},
-
-  	// @method getPixelBounds(): Bounds
-  	// Returns the bounds of the current map view in projected pixel
-  	// coordinates (sometimes useful in layer and overlay implementations).
-  	getPixelBounds: function (center, zoom) {
-  		var topLeftPoint = this._getTopLeftPoint(center, zoom);
-  		return new Bounds(topLeftPoint, topLeftPoint.add(this.getSize()));
-  	},
-
-  	// TODO: Check semantics - isn't the pixel origin the 0,0 coord relative to
-  	// the map pane? "left point of the map layer" can be confusing, specially
-  	// since there can be negative offsets.
-  	// @method getPixelOrigin(): Point
-  	// Returns the projected pixel coordinates of the top left point of
-  	// the map layer (useful in custom layer and overlay implementations).
-  	getPixelOrigin: function () {
-  		this._checkIfLoaded();
-  		return this._pixelOrigin;
-  	},
-
-  	// @method getPixelWorldBounds(zoom?: Number): Bounds
-  	// Returns the world's bounds in pixel coordinates for zoom level `zoom`.
-  	// If `zoom` is omitted, the map's current zoom level is used.
-  	getPixelWorldBounds: function (zoom) {
-  		return this.options.crs.getProjectedBounds(zoom === undefined ? this.getZoom() : zoom);
-  	},
-
-  	// @section Other Methods
-
-  	// @method getPane(pane: String|HTMLElement): HTMLElement
-  	// Returns a [map pane](#map-pane), given its name or its HTML element (its identity).
-  	getPane: function (pane) {
-  		return typeof pane === 'string' ? this._panes[pane] : pane;
-  	},
-
-  	// @method getPanes(): Object
-  	// Returns a plain object containing the names of all [panes](#map-pane) as keys and
-  	// the panes as values.
-  	getPanes: function () {
-  		return this._panes;
-  	},
-
-  	// @method getContainer: HTMLElement
-  	// Returns the HTML element that contains the map.
-  	getContainer: function () {
-  		return this._container;
-  	},
-
-
-  	// @section Conversion Methods
-
-  	// @method getZoomScale(toZoom: Number, fromZoom: Number): Number
-  	// Returns the scale factor to be applied to a map transition from zoom level
-  	// `fromZoom` to `toZoom`. Used internally to help with zoom animations.
-  	getZoomScale: function (toZoom, fromZoom) {
-  		// TODO replace with universal implementation after refactoring projections
-  		var crs = this.options.crs;
-  		fromZoom = fromZoom === undefined ? this._zoom : fromZoom;
-  		return crs.scale(toZoom) / crs.scale(fromZoom);
-  	},
-
-  	// @method getScaleZoom(scale: Number, fromZoom: Number): Number
-  	// Returns the zoom level that the map would end up at, if it is at `fromZoom`
-  	// level and everything is scaled by a factor of `scale`. Inverse of
-  	// [`getZoomScale`](#map-getZoomScale).
-  	getScaleZoom: function (scale, fromZoom) {
-  		var crs = this.options.crs;
-  		fromZoom = fromZoom === undefined ? this._zoom : fromZoom;
-  		var zoom = crs.zoom(scale * crs.scale(fromZoom));
-  		return isNaN(zoom) ? Infinity : zoom;
-  	},
-
-  	// @method project(latlng: LatLng, zoom: Number): Point
-  	// Projects a geographical coordinate `LatLng` according to the projection
-  	// of the map's CRS, then scales it according to `zoom` and the CRS's
-  	// `Transformation`. The result is pixel coordinate relative to
-  	// the CRS origin.
-  	project: function (latlng, zoom) {
-  		zoom = zoom === undefined ? this._zoom : zoom;
-  		return this.options.crs.latLngToPoint(toLatLng(latlng), zoom);
-  	},
-
-  	// @method unproject(point: Point, zoom: Number): LatLng
-  	// Inverse of [`project`](#map-project).
-  	unproject: function (point, zoom) {
-  		zoom = zoom === undefined ? this._zoom : zoom;
-  		return this.options.crs.pointToLatLng(toPoint(point), zoom);
-  	},
-
-  	// @method layerPointToLatLng(point: Point): LatLng
-  	// Given a pixel coordinate relative to the [origin pixel](#map-getpixelorigin),
-  	// returns the corresponding geographical coordinate (for the current zoom level).
-  	layerPointToLatLng: function (point) {
-  		var projectedPoint = toPoint(point).add(this.getPixelOrigin());
-  		return this.unproject(projectedPoint);
-  	},
-
-  	// @method latLngToLayerPoint(latlng: LatLng): Point
-  	// Given a geographical coordinate, returns the corresponding pixel coordinate
-  	// relative to the [origin pixel](#map-getpixelorigin).
-  	latLngToLayerPoint: function (latlng) {
-  		var projectedPoint = this.project(toLatLng(latlng))._round();
-  		return projectedPoint._subtract(this.getPixelOrigin());
-  	},
-
-  	// @method wrapLatLng(latlng: LatLng): LatLng
-  	// Returns a `LatLng` where `lat` and `lng` has been wrapped according to the
-  	// map's CRS's `wrapLat` and `wrapLng` properties, if they are outside the
-  	// CRS's bounds.
-  	// By default this means longitude is wrapped around the dateline so its
-  	// value is between -180 and +180 degrees.
-  	wrapLatLng: function (latlng) {
-  		return this.options.crs.wrapLatLng(toLatLng(latlng));
-  	},
-
-  	// @method wrapLatLngBounds(bounds: LatLngBounds): LatLngBounds
-  	// Returns a `LatLngBounds` with the same size as the given one, ensuring that
-  	// its center is within the CRS's bounds.
-  	// By default this means the center longitude is wrapped around the dateline so its
-  	// value is between -180 and +180 degrees, and the majority of the bounds
-  	// overlaps the CRS's bounds.
-  	wrapLatLngBounds: function (latlng) {
-  		return this.options.crs.wrapLatLngBounds(toLatLngBounds(latlng));
-  	},
-
-  	// @method distance(latlng1: LatLng, latlng2: LatLng): Number
-  	// Returns the distance between two geographical coordinates according to
-  	// the map's CRS. By default this measures distance in meters.
-  	distance: function (latlng1, latlng2) {
-  		return this.options.crs.distance(toLatLng(latlng1), toLatLng(latlng2));
-  	},
-
-  	// @method containerPointToLayerPoint(point: Point): Point
-  	// Given a pixel coordinate relative to the map container, returns the corresponding
-  	// pixel coordinate relative to the [origin pixel](#map-getpixelorigin).
-  	containerPointToLayerPoint: function (point) { // (Point)
-  		return toPoint(point).subtract(this._getMapPanePos());
-  	},
-
-  	// @method layerPointToContainerPoint(point: Point): Point
-  	// Given a pixel coordinate relative to the [origin pixel](#map-getpixelorigin),
-  	// returns the corresponding pixel coordinate relative to the map container.
-  	layerPointToContainerPoint: function (point) { // (Point)
-  		return toPoint(point).add(this._getMapPanePos());
-  	},
-
-  	// @method containerPointToLatLng(point: Point): LatLng
-  	// Given a pixel coordinate relative to the map container, returns
-  	// the corresponding geographical coordinate (for the current zoom level).
-  	containerPointToLatLng: function (point) {
-  		var layerPoint = this.containerPointToLayerPoint(toPoint(point));
-  		return this.layerPointToLatLng(layerPoint);
-  	},
-
-  	// @method latLngToContainerPoint(latlng: LatLng): Point
-  	// Given a geographical coordinate, returns the corresponding pixel coordinate
-  	// relative to the map container.
-  	latLngToContainerPoint: function (latlng) {
-  		return this.layerPointToContainerPoint(this.latLngToLayerPoint(toLatLng(latlng)));
-  	},
-
-  	// @method mouseEventToContainerPoint(ev: MouseEvent): Point
-  	// Given a MouseEvent object, returns the pixel coordinate relative to the
-  	// map container where the event took place.
-  	mouseEventToContainerPoint: function (e) {
-  		return getMousePosition(e, this._container);
-  	},
-
-  	// @method mouseEventToLayerPoint(ev: MouseEvent): Point
-  	// Given a MouseEvent object, returns the pixel coordinate relative to
-  	// the [origin pixel](#map-getpixelorigin) where the event took place.
-  	mouseEventToLayerPoint: function (e) {
-  		return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(e));
-  	},
-
-  	// @method mouseEventToLatLng(ev: MouseEvent): LatLng
-  	// Given a MouseEvent object, returns geographical coordinate where the
-  	// event took place.
-  	mouseEventToLatLng: function (e) { // (MouseEvent)
-  		return this.layerPointToLatLng(this.mouseEventToLayerPoint(e));
-  	},
-
-
-  	// map initialization methods
-
-  	_initContainer: function (id) {
-  		var container = this._container = get(id);
-
-  		if (!container) {
-  			throw new Error('Map container not found.');
-  		} else if (container._leaflet_id) {
-  			throw new Error('Map container is already initialized.');
-  		}
-
-  		on(container, 'scroll', this._onScroll, this);
-  		this._containerId = stamp(container);
-  	},
-
-  	_initLayout: function () {
-  		var container = this._container;
-
-  		this._fadeAnimated = this.options.fadeAnimation && any3d;
-
-  		addClass(container, 'leaflet-container' +
-  			(touch ? ' leaflet-touch' : '') +
-  			(retina ? ' leaflet-retina' : '') +
-  			(ielt9 ? ' leaflet-oldie' : '') +
-  			(safari ? ' leaflet-safari' : '') +
-  			(this._fadeAnimated ? ' leaflet-fade-anim' : ''));
-
-  		var position = getStyle(container, 'position');
-
-  		if (position !== 'absolute' && position !== 'relative' && position !== 'fixed') {
-  			container.style.position = 'relative';
-  		}
-
-  		this._initPanes();
-
-  		if (this._initControlPos) {
-  			this._initControlPos();
-  		}
-  	},
-
-  	_initPanes: function () {
-  		var panes = this._panes = {};
-  		this._paneRenderers = {};
-
-  		// @section
-  		//
-  		// Panes are DOM elements used to control the ordering of layers on the map. You
-  		// can access panes with [`map.getPane`](#map-getpane) or
-  		// [`map.getPanes`](#map-getpanes) methods. New panes can be created with the
-  		// [`map.createPane`](#map-createpane) method.
-  		//
-  		// Every map has the following default panes that differ only in zIndex.
-  		//
-  		// @pane mapPane: HTMLElement = 'auto'
-  		// Pane that contains all other map panes
-
-  		this._mapPane = this.createPane('mapPane', this._container);
-  		setPosition(this._mapPane, new Point(0, 0));
-
-  		// @pane tilePane: HTMLElement = 200
-  		// Pane for `GridLayer`s and `TileLayer`s
-  		this.createPane('tilePane');
-  		// @pane overlayPane: HTMLElement = 400
-  		// Pane for overlay shadows (e.g. `Marker` shadows)
-  		this.createPane('shadowPane');
-  		// @pane shadowPane: HTMLElement = 500
-  		// Pane for vectors (`Path`s, like `Polyline`s and `Polygon`s), `ImageOverlay`s and `VideoOverlay`s
-  		this.createPane('overlayPane');
-  		// @pane markerPane: HTMLElement = 600
-  		// Pane for `Icon`s of `Marker`s
-  		this.createPane('markerPane');
-  		// @pane tooltipPane: HTMLElement = 650
-  		// Pane for `Tooltip`s.
-  		this.createPane('tooltipPane');
-  		// @pane popupPane: HTMLElement = 700
-  		// Pane for `Popup`s.
-  		this.createPane('popupPane');
-
-  		if (!this.options.markerZoomAnimation) {
-  			addClass(panes.markerPane, 'leaflet-zoom-hide');
-  			addClass(panes.shadowPane, 'leaflet-zoom-hide');
-  		}
-  	},
-
-
-  	// private methods that modify map state
-
-  	// @section Map state change events
-  	_resetView: function (center, zoom) {
-  		setPosition(this._mapPane, new Point(0, 0));
-
-  		var loading = !this._loaded;
-  		this._loaded = true;
-  		zoom = this._limitZoom(zoom);
-
-  		this.fire('viewprereset');
-
-  		var zoomChanged = this._zoom !== zoom;
-  		this
-  			._moveStart(zoomChanged, false)
-  			._move(center, zoom)
-  			._moveEnd(zoomChanged);
-
-  		// @event viewreset: Event
-  		// Fired when the map needs to redraw its content (this usually happens
-  		// on map zoom or load). Very useful for creating custom overlays.
-  		this.fire('viewreset');
-
-  		// @event load: Event
-  		// Fired when the map is initialized (when its center and zoom are set
-  		// for the first time).
-  		if (loading) {
-  			this.fire('load');
-  		}
-  	},
-
-  	_moveStart: function (zoomChanged, noMoveStart) {
-  		// @event zoomstart: Event
-  		// Fired when the map zoom is about to change (e.g. before zoom animation).
-  		// @event movestart: Event
-  		// Fired when the view of the map starts changing (e.g. user starts dragging the map).
-  		if (zoomChanged) {
-  			this.fire('zoomstart');
-  		}
-  		if (!noMoveStart) {
-  			this.fire('movestart');
-  		}
-  		return this;
-  	},
-
-  	_move: function (center, zoom, data) {
-  		if (zoom === undefined) {
-  			zoom = this._zoom;
-  		}
-  		var zoomChanged = this._zoom !== zoom;
-
-  		this._zoom = zoom;
-  		this._lastCenter = center;
-  		this._pixelOrigin = this._getNewPixelOrigin(center);
-
-  		// @event zoom: Event
-  		// Fired repeatedly during any change in zoom level, including zoom
-  		// and fly animations.
-  		if (zoomChanged || (data && data.pinch)) {	// Always fire 'zoom' if pinching because #3530
-  			this.fire('zoom', data);
-  		}
-
-  		// @event move: Event
-  		// Fired repeatedly during any movement of the map, including pan and
-  		// fly animations.
-  		return this.fire('move', data);
-  	},
-
-  	_moveEnd: function (zoomChanged) {
-  		// @event zoomend: Event
-  		// Fired when the map has changed, after any animations.
-  		if (zoomChanged) {
-  			this.fire('zoomend');
-  		}
-
-  		// @event moveend: Event
-  		// Fired when the center of the map stops changing (e.g. user stopped
-  		// dragging the map).
-  		return this.fire('moveend');
-  	},
-
-  	_stop: function () {
-  		cancelAnimFrame(this._flyToFrame);
-  		if (this._panAnim) {
-  			this._panAnim.stop();
-  		}
-  		return this;
-  	},
-
-  	_rawPanBy: function (offset) {
-  		setPosition(this._mapPane, this._getMapPanePos().subtract(offset));
-  	},
-
-  	_getZoomSpan: function () {
-  		return this.getMaxZoom() - this.getMinZoom();
-  	},
-
-  	_panInsideMaxBounds: function () {
-  		if (!this._enforcingBounds) {
-  			this.panInsideBounds(this.options.maxBounds);
-  		}
-  	},
-
-  	_checkIfLoaded: function () {
-  		if (!this._loaded) {
-  			throw new Error('Set map center and zoom first.');
-  		}
-  	},
-
-  	// DOM event handling
-
-  	// @section Interaction events
-  	_initEvents: function (remove$$1) {
-  		this._targets = {};
-  		this._targets[stamp(this._container)] = this;
-
-  		var onOff = remove$$1 ? off : on;
-
-  		// @event click: MouseEvent
-  		// Fired when the user clicks (or taps) the map.
-  		// @event dblclick: MouseEvent
-  		// Fired when the user double-clicks (or double-taps) the map.
-  		// @event mousedown: MouseEvent
-  		// Fired when the user pushes the mouse button on the map.
-  		// @event mouseup: MouseEvent
-  		// Fired when the user releases the mouse button on the map.
-  		// @event mouseover: MouseEvent
-  		// Fired when the mouse enters the map.
-  		// @event mouseout: MouseEvent
-  		// Fired when the mouse leaves the map.
-  		// @event mousemove: MouseEvent
-  		// Fired while the mouse moves over the map.
-  		// @event contextmenu: MouseEvent
-  		// Fired when the user pushes the right mouse button on the map, prevents
-  		// default browser context menu from showing if there are listeners on
-  		// this event. Also fired on mobile when the user holds a single touch
-  		// for a second (also called long press).
-  		// @event keypress: KeyboardEvent
-  		// Fired when the user presses a key from the keyboard that produces a character value while the map is focused.
-  		// @event keydown: KeyboardEvent
-  		// Fired when the user presses a key from the keyboard while the map is focused. Unlike the `keypress` event,
-  		// the `keydown` event is fired for keys that produce a character value and for keys
-  		// that do not produce a character value.
-  		// @event keyup: KeyboardEvent
-  		// Fired when the user releases a key from the keyboard while the map is focused.
-  		onOff(this._container, 'click dblclick mousedown mouseup ' +
-  			'mouseover mouseout mousemove contextmenu keypress keydown keyup', this._handleDOMEvent, this);
-
-  		if (this.options.trackResize) {
-  			onOff(window, 'resize', this._onResize, this);
-  		}
-
-  		if (any3d && this.options.transform3DLimit) {
-  			(remove$$1 ? this.off : this.on).call(this, 'moveend', this._onMoveEnd);
-  		}
-  	},
-
-  	_onResize: function () {
-  		cancelAnimFrame(this._resizeRequest);
-  		this._resizeRequest = requestAnimFrame(
-  		        function () { this.invalidateSize({debounceMoveend: true}); }, this);
-  	},
-
-  	_onScroll: function () {
-  		this._container.scrollTop  = 0;
-  		this._container.scrollLeft = 0;
-  	},
-
-  	_onMoveEnd: function () {
-  		var pos = this._getMapPanePos();
-  		if (Math.max(Math.abs(pos.x), Math.abs(pos.y)) >= this.options.transform3DLimit) {
-  			// https://bugzilla.mozilla.org/show_bug.cgi?id=1203873 but Webkit also have
-  			// a pixel offset on very high values, see: http://jsfiddle.net/dg6r5hhb/
-  			this._resetView(this.getCenter(), this.getZoom());
-  		}
-  	},
-
-  	_findEventTargets: function (e, type) {
-  		var targets = [],
-  		    target,
-  		    isHover = type === 'mouseout' || type === 'mouseover',
-  		    src = e.target || e.srcElement,
-  		    dragging = false;
-
-  		while (src) {
-  			target = this._targets[stamp(src)];
-  			if (target && (type === 'click' || type === 'preclick') && !e._simulated && this._draggableMoved(target)) {
-  				// Prevent firing click after you just dragged an object.
-  				dragging = true;
-  				break;
-  			}
-  			if (target && target.listens(type, true)) {
-  				if (isHover && !isExternalTarget(src, e)) { break; }
-  				targets.push(target);
-  				if (isHover) { break; }
-  			}
-  			if (src === this._container) { break; }
-  			src = src.parentNode;
-  		}
-  		if (!targets.length && !dragging && !isHover && isExternalTarget(src, e)) {
-  			targets = [this];
-  		}
-  		return targets;
-  	},
-
-  	_handleDOMEvent: function (e) {
-  		if (!this._loaded || skipped(e)) { return; }
-
-  		var type = e.type;
-
-  		if (type === 'mousedown' || type === 'keypress' || type === 'keyup' || type === 'keydown') {
-  			// prevents outline when clicking on keyboard-focusable element
-  			preventOutline(e.target || e.srcElement);
-  		}
-
-  		this._fireDOMEvent(e, type);
-  	},
-
-  	_mouseEvents: ['click', 'dblclick', 'mouseover', 'mouseout', 'contextmenu'],
-
-  	_fireDOMEvent: function (e, type, targets) {
-
-  		if (e.type === 'click') {
-  			// Fire a synthetic 'preclick' event which propagates up (mainly for closing popups).
-  			// @event preclick: MouseEvent
-  			// Fired before mouse click on the map (sometimes useful when you
-  			// want something to happen on click before any existing click
-  			// handlers start running).
-  			var synth = extend({}, e);
-  			synth.type = 'preclick';
-  			this._fireDOMEvent(synth, synth.type, targets);
-  		}
-
-  		if (e._stopped) { return; }
-
-  		// Find the layer the event is propagating from and its parents.
-  		targets = (targets || []).concat(this._findEventTargets(e, type));
-
-  		if (!targets.length) { return; }
-
-  		var target = targets[0];
-  		if (type === 'contextmenu' && target.listens(type, true)) {
-  			preventDefault(e);
-  		}
-
-  		var data = {
-  			originalEvent: e
-  		};
-
-  		if (e.type !== 'keypress' && e.type !== 'keydown' && e.type !== 'keyup') {
-  			var isMarker = target.getLatLng && (!target._radius || target._radius <= 10);
-  			data.containerPoint = isMarker ?
-  				this.latLngToContainerPoint(target.getLatLng()) : this.mouseEventToContainerPoint(e);
-  			data.layerPoint = this.containerPointToLayerPoint(data.containerPoint);
-  			data.latlng = isMarker ? target.getLatLng() : this.layerPointToLatLng(data.layerPoint);
-  		}
-
-  		for (var i = 0; i < targets.length; i++) {
-  			targets[i].fire(type, data, true);
-  			if (data.originalEvent._stopped ||
-  				(targets[i].options.bubblingMouseEvents === false && indexOf(this._mouseEvents, type) !== -1)) { return; }
-  		}
-  	},
-
-  	_draggableMoved: function (obj) {
-  		obj = obj.dragging && obj.dragging.enabled() ? obj : this;
-  		return (obj.dragging && obj.dragging.moved()) || (this.boxZoom && this.boxZoom.moved());
-  	},
-
-  	_clearHandlers: function () {
-  		for (var i = 0, len = this._handlers.length; i < len; i++) {
-  			this._handlers[i].disable();
-  		}
-  	},
-
-  	// @section Other Methods
-
-  	// @method whenReady(fn: Function, context?: Object): this
-  	// Runs the given function `fn` when the map gets initialized with
-  	// a view (center and zoom) and at least one layer, or immediately
-  	// if it's already initialized, optionally passing a function context.
-  	whenReady: function (callback, context) {
-  		if (this._loaded) {
-  			callback.call(context || this, {target: this});
-  		} else {
-  			this.on('load', callback, context);
-  		}
-  		return this;
-  	},
-
-
-  	// private methods for getting map state
-
-  	_getMapPanePos: function () {
-  		return getPosition(this._mapPane) || new Point(0, 0);
-  	},
-
-  	_moved: function () {
-  		var pos = this._getMapPanePos();
-  		return pos && !pos.equals([0, 0]);
-  	},
-
-  	_getTopLeftPoint: function (center, zoom) {
-  		var pixelOrigin = center && zoom !== undefined ?
-  			this._getNewPixelOrigin(center, zoom) :
-  			this.getPixelOrigin();
-  		return pixelOrigin.subtract(this._getMapPanePos());
-  	},
-
-  	_getNewPixelOrigin: function (center, zoom) {
-  		var viewHalf = this.getSize()._divideBy(2);
-  		return this.project(center, zoom)._subtract(viewHalf)._add(this._getMapPanePos())._round();
-  	},
-
-  	_latLngToNewLayerPoint: function (latlng, zoom, center) {
-  		var topLeft = this._getNewPixelOrigin(center, zoom);
-  		return this.project(latlng, zoom)._subtract(topLeft);
-  	},
-
-  	_latLngBoundsToNewLayerBounds: function (latLngBounds, zoom, center) {
-  		var topLeft = this._getNewPixelOrigin(center, zoom);
-  		return toBounds([
-  			this.project(latLngBounds.getSouthWest(), zoom)._subtract(topLeft),
-  			this.project(latLngBounds.getNorthWest(), zoom)._subtract(topLeft),
-  			this.project(latLngBounds.getSouthEast(), zoom)._subtract(topLeft),
-  			this.project(latLngBounds.getNorthEast(), zoom)._subtract(topLeft)
-  		]);
-  	},
-
-  	// layer point of the current center
-  	_getCenterLayerPoint: function () {
-  		return this.containerPointToLayerPoint(this.getSize()._divideBy(2));
-  	},
-
-  	// offset of the specified place to the current center in pixels
-  	_getCenterOffset: function (latlng) {
-  		return this.latLngToLayerPoint(latlng).subtract(this._getCenterLayerPoint());
-  	},
-
-  	// adjust center for view to get inside bounds
-  	_limitCenter: function (center, zoom, bounds) {
-
-  		if (!bounds) { return center; }
-
-  		var centerPoint = this.project(center, zoom),
-  		    viewHalf = this.getSize().divideBy(2),
-  		    viewBounds = new Bounds(centerPoint.subtract(viewHalf), centerPoint.add(viewHalf)),
-  		    offset = this._getBoundsOffset(viewBounds, bounds, zoom);
-
-  		// If offset is less than a pixel, ignore.
-  		// This prevents unstable projections from getting into
-  		// an infinite loop of tiny offsets.
-  		if (offset.round().equals([0, 0])) {
-  			return center;
-  		}
-
-  		return this.unproject(centerPoint.add(offset), zoom);
-  	},
-
-  	// adjust offset for view to get inside bounds
-  	_limitOffset: function (offset, bounds) {
-  		if (!bounds) { return offset; }
-
-  		var viewBounds = this.getPixelBounds(),
-  		    newBounds = new Bounds(viewBounds.min.add(offset), viewBounds.max.add(offset));
-
-  		return offset.add(this._getBoundsOffset(newBounds, bounds));
-  	},
-
-  	// returns offset needed for pxBounds to get inside maxBounds at a specified zoom
-  	_getBoundsOffset: function (pxBounds, maxBounds, zoom) {
-  		var projectedMaxBounds = toBounds(
-  		        this.project(maxBounds.getNorthEast(), zoom),
-  		        this.project(maxBounds.getSouthWest(), zoom)
-  		    ),
-  		    minOffset = projectedMaxBounds.min.subtract(pxBounds.min),
-  		    maxOffset = projectedMaxBounds.max.subtract(pxBounds.max),
-
-  		    dx = this._rebound(minOffset.x, -maxOffset.x),
-  		    dy = this._rebound(minOffset.y, -maxOffset.y);
-
-  		return new Point(dx, dy);
-  	},
-
-  	_rebound: function (left, right) {
-  		return left + right > 0 ?
-  			Math.round(left - right) / 2 :
-  			Math.max(0, Math.ceil(left)) - Math.max(0, Math.floor(right));
-  	},
-
-  	_limitZoom: function (zoom) {
-  		var min = this.getMinZoom(),
-  		    max = this.getMaxZoom(),
-  		    snap = any3d ? this.options.zoomSnap : 1;
-  		if (snap) {
-  			zoom = Math.round(zoom / snap) * snap;
-  		}
-  		return Math.max(min, Math.min(max, zoom));
-  	},
-
-  	_onPanTransitionStep: function () {
-  		this.fire('move');
-  	},
-
-  	_onPanTransitionEnd: function () {
-  		removeClass(this._mapPane, 'leaflet-pan-anim');
-  		this.fire('moveend');
-  	},
-
-  	_tryAnimatedPan: function (center, options) {
-  		// difference between the new and current centers in pixels
-  		var offset = this._getCenterOffset(center)._trunc();
-
-  		// don't animate too far unless animate: true specified in options
-  		if ((options && options.animate) !== true && !this.getSize().contains(offset)) { return false; }
-
-  		this.panBy(offset, options);
-
-  		return true;
-  	},
-
-  	_createAnimProxy: function () {
-
-  		var proxy = this._proxy = create$1('div', 'leaflet-proxy leaflet-zoom-animated');
-  		this._panes.mapPane.appendChild(proxy);
-
-  		this.on('zoomanim', function (e) {
-  			var prop = TRANSFORM,
-  			    transform = this._proxy.style[prop];
-
-  			setTransform(this._proxy, this.project(e.center, e.zoom), this.getZoomScale(e.zoom, 1));
-
-  			// workaround for case when transform is the same and so transitionend event is not fired
-  			if (transform === this._proxy.style[prop] && this._animatingZoom) {
-  				this._onZoomTransitionEnd();
-  			}
-  		}, this);
-
-  		this.on('load moveend', this._animMoveEnd, this);
-
-  		this._on('unload', this._destroyAnimProxy, this);
-  	},
-
-  	_destroyAnimProxy: function () {
-  		remove(this._proxy);
-  		this.off('load moveend', this._animMoveEnd, this);
-  		delete this._proxy;
-  	},
-
-  	_animMoveEnd: function () {
-  		var c = this.getCenter(),
-  		    z = this.getZoom();
-  		setTransform(this._proxy, this.project(c, z), this.getZoomScale(z, 1));
-  	},
-
-  	_catchTransitionEnd: function (e) {
-  		if (this._animatingZoom && e.propertyName.indexOf('transform') >= 0) {
-  			this._onZoomTransitionEnd();
-  		}
-  	},
-
-  	_nothingToAnimate: function () {
-  		return !this._container.getElementsByClassName('leaflet-zoom-animated').length;
-  	},
-
-  	_tryAnimatedZoom: function (center, zoom, options) {
-
-  		if (this._animatingZoom) { return true; }
-
-  		options = options || {};
-
-  		// don't animate if disabled, not supported or zoom difference is too large
-  		if (!this._zoomAnimated || options.animate === false || this._nothingToAnimate() ||
-  		        Math.abs(zoom - this._zoom) > this.options.zoomAnimationThreshold) { return false; }
-
-  		// offset is the pixel coords of the zoom origin relative to the current center
-  		var scale = this.getZoomScale(zoom),
-  		    offset = this._getCenterOffset(center)._divideBy(1 - 1 / scale);
-
-  		// don't animate if the zoom origin isn't within one screen from the current center, unless forced
-  		if (options.animate !== true && !this.getSize().contains(offset)) { return false; }
-
-  		requestAnimFrame(function () {
-  			this
-  			    ._moveStart(true, false)
-  			    ._animateZoom(center, zoom, true);
-  		}, this);
-
-  		return true;
-  	},
-
-  	_animateZoom: function (center, zoom, startAnim, noUpdate) {
-  		if (!this._mapPane) { return; }
-
-  		if (startAnim) {
-  			this._animatingZoom = true;
-
-  			// remember what center/zoom to set after animation
-  			this._animateToCenter = center;
-  			this._animateToZoom = zoom;
-
-  			addClass(this._mapPane, 'leaflet-zoom-anim');
-  		}
-
-  		// @section Other Events
-  		// @event zoomanim: ZoomAnimEvent
-  		// Fired at least once per zoom animation. For continuous zoom, like pinch zooming, fired once per frame during zoom.
-  		this.fire('zoomanim', {
-  			center: center,
-  			zoom: zoom,
-  			noUpdate: noUpdate
-  		});
-
-  		// Work around webkit not firing 'transitionend', see https://github.com/Leaflet/Leaflet/issues/3689, 2693
-  		setTimeout(bind(this._onZoomTransitionEnd, this), 250);
-  	},
-
-  	_onZoomTransitionEnd: function () {
-  		if (!this._animatingZoom) { return; }
-
-  		if (this._mapPane) {
-  			removeClass(this._mapPane, 'leaflet-zoom-anim');
-  		}
-
-  		this._animatingZoom = false;
-
-  		this._move(this._animateToCenter, this._animateToZoom);
-
-  		// This anim frame should prevent an obscure iOS webkit tile loading race condition.
-  		requestAnimFrame(function () {
-  			this._moveEnd(true);
-  		}, this);
-  	}
-  });
-
-  // @section
-
-  // @factory L.map(id: String, options?: Map options)
-  // Instantiates a map object given the DOM ID of a `<div>` element
-  // and optionally an object literal with `Map options`.
-  //
-  // @alternative
-  // @factory L.map(el: HTMLElement, options?: Map options)
-  // Instantiates a map object given an instance of a `<div>` HTML element
-  // and optionally an object literal with `Map options`.
-  function createMap(id, options) {
-  	return new Map(id, options);
-  }
-
-  /*
-   * @class Control
-   * @aka L.Control
-   * @inherits Class
-   *
-   * L.Control is a base class for implementing map controls. Handles positioning.
-   * All other controls extend from this class.
-   */
-
-  var Control = Class.extend({
-  	// @section
-  	// @aka Control options
-  	options: {
-  		// @option position: String = 'topright'
-  		// The position of the control (one of the map corners). Possible values are `'topleft'`,
-  		// `'topright'`, `'bottomleft'` or `'bottomright'`
-  		position: 'topright'
-  	},
-
-  	initialize: function (options) {
-  		setOptions(this, options);
-  	},
-
-  	/* @section
-  	 * Classes extending L.Control will inherit the following methods:
-  	 *
-  	 * @method getPosition: string
-  	 * Returns the position of the control.
-  	 */
-  	getPosition: function () {
-  		return this.options.position;
-  	},
-
-  	// @method setPosition(position: string): this
-  	// Sets the position of the control.
-  	setPosition: function (position) {
-  		var map = this._map;
-
-  		if (map) {
-  			map.removeControl(this);
-  		}
-
-  		this.options.position = position;
-
-  		if (map) {
-  			map.addControl(this);
-  		}
-
-  		return this;
-  	},
-
-  	// @method getContainer: HTMLElement
-  	// Returns the HTMLElement that contains the control.
-  	getContainer: function () {
-  		return this._container;
-  	},
-
-  	// @method addTo(map: Map): this
-  	// Adds the control to the given map.
-  	addTo: function (map) {
-  		this.remove();
-  		this._map = map;
-
-  		var container = this._container = this.onAdd(map),
-  		    pos = this.getPosition(),
-  		    corner = map._controlCorners[pos];
-
-  		addClass(container, 'leaflet-control');
-
-  		if (pos.indexOf('bottom') !== -1) {
-  			corner.insertBefore(container, corner.firstChild);
-  		} else {
-  			corner.appendChild(container);
-  		}
-
-  		this._map.on('unload', this.remove, this);
-
-  		return this;
-  	},
-
-  	// @method remove: this
-  	// Removes the control from the map it is currently active on.
-  	remove: function () {
-  		if (!this._map) {
-  			return this;
-  		}
-
-  		remove(this._container);
-
-  		if (this.onRemove) {
-  			this.onRemove(this._map);
-  		}
-
-  		this._map.off('unload', this.remove, this);
-  		this._map = null;
-
-  		return this;
-  	},
-
-  	_refocusOnMap: function (e) {
-  		// if map exists and event is not a keyboard event
-  		if (this._map && e && e.screenX > 0 && e.screenY > 0) {
-  			this._map.getContainer().focus();
-  		}
-  	}
-  });
-
-  var control = function (options) {
-  	return new Control(options);
-  };
-
-  /* @section Extension methods
-   * @uninheritable
-   *
-   * Every control should extend from `L.Control` and (re-)implement the following methods.
-   *
-   * @method onAdd(map: Map): HTMLElement
-   * Should return the container DOM element for the control and add listeners on relevant map events. Called on [`control.addTo(map)`](#control-addTo).
-   *
-   * @method onRemove(map: Map)
-   * Optional method. Should contain all clean up code that removes the listeners previously added in [`onAdd`](#control-onadd). Called on [`control.remove()`](#control-remove).
-   */
-
-  /* @namespace Map
-   * @section Methods for Layers and Controls
-   */
-  Map.include({
-  	// @method addControl(control: Control): this
-  	// Adds the given control to the map
-  	addControl: function (control) {
-  		control.addTo(this);
-  		return this;
-  	},
-
-  	// @method removeControl(control: Control): this
-  	// Removes the given control from the map
-  	removeControl: function (control) {
-  		control.remove();
-  		return this;
-  	},
-
-  	_initControlPos: function () {
-  		var corners = this._controlCorners = {},
-  		    l = 'leaflet-',
-  		    container = this._controlContainer =
-  		            create$1('div', l + 'control-container', this._container);
-
-  		function createCorner(vSide, hSide) {
-  			var className = l + vSide + ' ' + l + hSide;
-
-  			corners[vSide + hSide] = create$1('div', className, container);
-  		}
-
-  		createCorner('top', 'left');
-  		createCorner('top', 'right');
-  		createCorner('bottom', 'left');
-  		createCorner('bottom', 'right');
-  	},
-
-  	_clearControlPos: function () {
-  		for (var i in this._controlCorners) {
-  			remove(this._controlCorners[i]);
-  		}
-  		remove(this._controlContainer);
-  		delete this._controlCorners;
-  		delete this._controlContainer;
-  	}
-  });
-
-  /*
-   * @class Control.Layers
-   * @aka L.Control.Layers
-   * @inherits Control
-   *
-   * The layers control gives users the ability to switch between different base layers and switch overlays on/off (check out the [detailed example](http://leafletjs.com/examples/layers-control/)). Extends `Control`.
-   *
-   * @example
-   *
-   * ```js
-   * var baseLayers = {
-   * 	"Mapbox": mapbox,
-   * 	"OpenStreetMap": osm
-   * };
-   *
-   * var overlays = {
-   * 	"Marker": marker,
-   * 	"Roads": roadsLayer
-   * };
-   *
-   * L.control.layers(baseLayers, overlays).addTo(map);
-   * ```
-   *
-   * The `baseLayers` and `overlays` parameters are object literals with layer names as keys and `Layer` objects as values:
-   *
-   * ```js
-   * {
-   *     "<someName1>": layer1,
-   *     "<someName2>": layer2
-   * }
-   * ```
-   *
-   * The layer names can contain HTML, which allows you to add additional styling to the items:
-   *
-   * ```js
-   * {"<img src='my-layer-icon' /> <span class='my-layer-item'>My Layer</span>": myLayer}
-   * ```
-   */
-
-  var Layers = Control.extend({
-  	// @section
-  	// @aka Control.Layers options
-  	options: {
-  		// @option collapsed: Boolean = true
-  		// If `true`, the control will be collapsed into an icon and expanded on mouse hover or touch.
-  		collapsed: true,
-  		position: 'topright',
-
-  		// @option autoZIndex: Boolean = true
-  		// If `true`, the control will assign zIndexes in increasing order to all of its layers so that the order is preserved when switching them on/off.
-  		autoZIndex: true,
-
-  		// @option hideSingleBase: Boolean = false
-  		// If `true`, the base layers in the control will be hidden when there is only one.
-  		hideSingleBase: false,
-
-  		// @option sortLayers: Boolean = false
-  		// Whether to sort the layers. When `false`, layers will keep the order
-  		// in which they were added to the control.
-  		sortLayers: false,
-
-  		// @option sortFunction: Function = *
-  		// A [compare function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/sort)
-  		// that will be used for sorting the layers, when `sortLayers` is `true`.
-  		// The function receives both the `L.Layer` instances and their names, as in
-  		// `sortFunction(layerA, layerB, nameA, nameB)`.
-  		// By default, it sorts layers alphabetically by their name.
-  		sortFunction: function (layerA, layerB, nameA, nameB) {
-  			return nameA < nameB ? -1 : (nameB < nameA ? 1 : 0);
-  		}
-  	},
-
-  	initialize: function (baseLayers, overlays, options) {
-  		setOptions(this, options);
-
-  		this._layerControlInputs = [];
-  		this._layers = [];
-  		this._lastZIndex = 0;
-  		this._handlingClick = false;
-
-  		for (var i in baseLayers) {
-  			this._addLayer(baseLayers[i], i);
-  		}
-
-  		for (i in overlays) {
-  			this._addLayer(overlays[i], i, true);
-  		}
-  	},
-
-  	onAdd: function (map) {
-  		this._initLayout();
-  		this._update();
-
-  		this._map = map;
-  		map.on('zoomend', this._checkDisabledLayers, this);
-
-  		for (var i = 0; i < this._layers.length; i++) {
-  			this._layers[i].layer.on('add remove', this._onLayerChange, this);
-  		}
-
-  		return this._container;
-  	},
-
-  	addTo: function (map) {
-  		Control.prototype.addTo.call(this, map);
-  		// Trigger expand after Layers Control has been inserted into DOM so that is now has an actual height.
-  		return this._expandIfNotCollapsed();
-  	},
-
-  	onRemove: function () {
-  		this._map.off('zoomend', this._checkDisabledLayers, this);
-
-  		for (var i = 0; i < this._layers.length; i++) {
-  			this._layers[i].layer.off('add remove', this._onLayerChange, this);
-  		}
-  	},
-
-  	// @method addBaseLayer(layer: Layer, name: String): this
-  	// Adds a base layer (radio button entry) with the given name to the control.
-  	addBaseLayer: function (layer, name) {
-  		this._addLayer(layer, name);
-  		return (this._map) ? this._update() : this;
-  	},
-
-  	// @method addOverlay(layer: Layer, name: String): this
-  	// Adds an overlay (checkbox entry) with the given name to the control.
-  	addOverlay: function (layer, name) {
-  		this._addLayer(layer, name, true);
-  		return (this._map) ? this._update() : this;
-  	},
-
-  	// @method removeLayer(layer: Layer): this
-  	// Remove the given layer from the control.
-  	removeLayer: function (layer) {
-  		layer.off('add remove', this._onLayerChange, this);
-
-  		var obj = this._getLayer(stamp(layer));
-  		if (obj) {
-  			this._layers.splice(this._layers.indexOf(obj), 1);
-  		}
-  		return (this._map) ? this._update() : this;
-  	},
-
-  	// @method expand(): this
-  	// Expand the control container if collapsed.
-  	expand: function () {
-  		addClass(this._container, 'leaflet-control-layers-expanded');
-  		this._section.style.height = null;
-  		var acceptableHeight = this._map.getSize().y - (this._container.offsetTop + 50);
-  		if (acceptableHeight < this._section.clientHeight) {
-  			addClass(this._section, 'leaflet-control-layers-scrollbar');
-  			this._section.style.height = acceptableHeight + 'px';
-  		} else {
-  			removeClass(this._section, 'leaflet-control-layers-scrollbar');
-  		}
-  		this._checkDisabledLayers();
-  		return this;
-  	},
-
-  	// @method collapse(): this
-  	// Collapse the control container if expanded.
-  	collapse: function () {
-  		removeClass(this._container, 'leaflet-control-layers-expanded');
-  		return this;
-  	},
-
-  	_initLayout: function () {
-  		var className = 'leaflet-control-layers',
-  		    container = this._container = create$1('div', className),
-  		    collapsed = this.options.collapsed;
-
-  		// makes this work on IE touch devices by stopping it from firing a mouseout event when the touch is released
-  		container.setAttribute('aria-haspopup', true);
-
-  		disableClickPropagation(container);
-  		disableScrollPropagation(container);
-
-  		var section = this._section = create$1('section', className + '-list');
-
-  		if (collapsed) {
-  			this._map.on('click', this.collapse, this);
-
-  			if (!android) {
-  				on(container, {
-  					mouseenter: this.expand,
-  					mouseleave: this.collapse
-  				}, this);
-  			}
-  		}
-
-  		var link = this._layersLink = create$1('a', className + '-toggle', container);
-  		link.href = '#';
-  		link.title = 'Layers';
-
-  		if (touch) {
-  			on(link, 'click', stop);
-  			on(link, 'click', this.expand, this);
-  		} else {
-  			on(link, 'focus', this.expand, this);
-  		}
-
-  		if (!collapsed) {
-  			this.expand();
-  		}
-
-  		this._baseLayersList = create$1('div', className + '-base', section);
-  		this._separator = create$1('div', className + '-separator', section);
-  		this._overlaysList = create$1('div', className + '-overlays', section);
-
-  		container.appendChild(section);
-  	},
-
-  	_getLayer: function (id) {
-  		for (var i = 0; i < this._layers.length; i++) {
-
-  			if (this._layers[i] && stamp(this._layers[i].layer) === id) {
-  				return this._layers[i];
-  			}
-  		}
-  	},
-
-  	_addLayer: function (layer, name, overlay) {
-  		if (this._map) {
-  			layer.on('add remove', this._onLayerChange, this);
-  		}
-
-  		this._layers.push({
-  			layer: layer,
-  			name: name,
-  			overlay: overlay
-  		});
-
-  		if (this.options.sortLayers) {
-  			this._layers.sort(bind(function (a, b) {
-  				return this.options.sortFunction(a.layer, b.layer, a.name, b.name);
-  			}, this));
-  		}
-
-  		if (this.options.autoZIndex && layer.setZIndex) {
-  			this._lastZIndex++;
-  			layer.setZIndex(this._lastZIndex);
-  		}
-
-  		this._expandIfNotCollapsed();
-  	},
-
-  	_update: function () {
-  		if (!this._container) { return this; }
-
-  		empty(this._baseLayersList);
-  		empty(this._overlaysList);
-
-  		this._layerControlInputs = [];
-  		var baseLayersPresent, overlaysPresent, i, obj, baseLayersCount = 0;
-
-  		for (i = 0; i < this._layers.length; i++) {
-  			obj = this._layers[i];
-  			this._addItem(obj);
-  			overlaysPresent = overlaysPresent || obj.overlay;
-  			baseLayersPresent = baseLayersPresent || !obj.overlay;
-  			baseLayersCount += !obj.overlay ? 1 : 0;
-  		}
-
-  		// Hide base layers section if there's only one layer.
-  		if (this.options.hideSingleBase) {
-  			baseLayersPresent = baseLayersPresent && baseLayersCount > 1;
-  			this._baseLayersList.style.display = baseLayersPresent ? '' : 'none';
-  		}
-
-  		this._separator.style.display = overlaysPresent && baseLayersPresent ? '' : 'none';
-
-  		return this;
-  	},
-
-  	_onLayerChange: function (e) {
-  		if (!this._handlingClick) {
-  			this._update();
-  		}
-
-  		var obj = this._getLayer(stamp(e.target));
-
-  		// @namespace Map
-  		// @section Layer events
-  		// @event baselayerchange: LayersControlEvent
-  		// Fired when the base layer is changed through the [layers control](#control-layers).
-  		// @event overlayadd: LayersControlEvent
-  		// Fired when an overlay is selected through the [layers control](#control-layers).
-  		// @event overlayremove: LayersControlEvent
-  		// Fired when an overlay is deselected through the [layers control](#control-layers).
-  		// @namespace Control.Layers
-  		var type = obj.overlay ?
-  			(e.type === 'add' ? 'overlayadd' : 'overlayremove') :
-  			(e.type === 'add' ? 'baselayerchange' : null);
-
-  		if (type) {
-  			this._map.fire(type, obj);
-  		}
-  	},
-
-  	// IE7 bugs out if you create a radio dynamically, so you have to do it this hacky way (see http://bit.ly/PqYLBe)
-  	_createRadioElement: function (name, checked) {
-
-  		var radioHtml = '<input type="radio" class="leaflet-control-layers-selector" name="' +
-  				name + '"' + (checked ? ' checked="checked"' : '') + '/>';
-
-  		var radioFragment = document.createElement('div');
-  		radioFragment.innerHTML = radioHtml;
-
-  		return radioFragment.firstChild;
-  	},
-
-  	_addItem: function (obj) {
-  		var label = document.createElement('label'),
-  		    checked = this._map.hasLayer(obj.layer),
-  		    input;
-
-  		if (obj.overlay) {
-  			input = document.createElement('input');
-  			input.type = 'checkbox';
-  			input.className = 'leaflet-control-layers-selector';
-  			input.defaultChecked = checked;
-  		} else {
-  			input = this._createRadioElement('leaflet-base-layers_' + stamp(this), checked);
-  		}
-
-  		this._layerControlInputs.push(input);
-  		input.layerId = stamp(obj.layer);
-
-  		on(input, 'click', this._onInputClick, this);
-
-  		var name = document.createElement('span');
-  		name.innerHTML = ' ' + obj.name;
-
-  		// Helps from preventing layer control flicker when checkboxes are disabled
-  		// https://github.com/Leaflet/Leaflet/issues/2771
-  		var holder = document.createElement('div');
-
-  		label.appendChild(holder);
-  		holder.appendChild(input);
-  		holder.appendChild(name);
-
-  		var container = obj.overlay ? this._overlaysList : this._baseLayersList;
-  		container.appendChild(label);
-
-  		this._checkDisabledLayers();
-  		return label;
-  	},
-
-  	_onInputClick: function () {
-  		var inputs = this._layerControlInputs,
-  		    input, layer;
-  		var addedLayers = [],
-  		    removedLayers = [];
-
-  		this._handlingClick = true;
-
-  		for (var i = inputs.length - 1; i >= 0; i--) {
-  			input = inputs[i];
-  			layer = this._getLayer(input.layerId).layer;
-
-  			if (input.checked) {
-  				addedLayers.push(layer);
-  			} else if (!input.checked) {
-  				removedLayers.push(layer);
-  			}
-  		}
-
-  		// Bugfix issue 2318: Should remove all old layers before readding new ones
-  		for (i = 0; i < removedLayers.length; i++) {
-  			if (this._map.hasLayer(removedLayers[i])) {
-  				this._map.removeLayer(removedLayers[i]);
-  			}
-  		}
-  		for (i = 0; i < addedLayers.length; i++) {
-  			if (!this._map.hasLayer(addedLayers[i])) {
-  				this._map.addLayer(addedLayers[i]);
-  			}
-  		}
-
-  		this._handlingClick = false;
-
-  		this._refocusOnMap();
-  	},
-
-  	_checkDisabledLayers: function () {
-  		var inputs = this._layerControlInputs,
-  		    input,
-  		    layer,
-  		    zoom = this._map.getZoom();
-
-  		for (var i = inputs.length - 1; i >= 0; i--) {
-  			input = inputs[i];
-  			layer = this._getLayer(input.layerId).layer;
-  			input.disabled = (layer.options.minZoom !== undefined && zoom < layer.options.minZoom) ||
-  			                 (layer.options.maxZoom !== undefined && zoom > layer.options.maxZoom);
-
-  		}
-  	},
-
-  	_expandIfNotCollapsed: function () {
-  		if (this._map && !this.options.collapsed) {
-  			this.expand();
-  		}
-  		return this;
-  	},
-
-  	_expand: function () {
-  		// Backward compatibility, remove me in 1.1.
-  		return this.expand();
-  	},
-
-  	_collapse: function () {
-  		// Backward compatibility, remove me in 1.1.
-  		return this.collapse();
-  	}
-
-  });
-
-
-  // @factory L.control.layers(baselayers?: Object, overlays?: Object, options?: Control.Layers options)
-  // Creates a layers control with the given layers. Base layers will be switched with radio buttons, while overlays will be switched with checkboxes. Note that all base layers should be passed in the base layers object, but only one should be added to the map during map instantiation.
-  var layers = function (baseLayers, overlays, options) {
-  	return new Layers(baseLayers, overlays, options);
-  };
-
-  /*
-   * @class Control.Zoom
-   * @aka L.Control.Zoom
-   * @inherits Control
-   *
-   * A basic zoom control with two buttons (zoom in and zoom out). It is put on the map by default unless you set its [`zoomControl` option](#map-zoomcontrol) to `false`. Extends `Control`.
-   */
-
-  var Zoom = Control.extend({
-  	// @section
-  	// @aka Control.Zoom options
-  	options: {
-  		position: 'topleft',
-
-  		// @option zoomInText: String = '+'
-  		// The text set on the 'zoom in' button.
-  		zoomInText: '+',
-
-  		// @option zoomInTitle: String = 'Zoom in'
-  		// The title set on the 'zoom in' button.
-  		zoomInTitle: 'Zoom in',
-
-  		// @option zoomOutText: String = '&#x2212;'
-  		// The text set on the 'zoom out' button.
-  		zoomOutText: '&#x2212;',
-
-  		// @option zoomOutTitle: String = 'Zoom out'
-  		// The title set on the 'zoom out' button.
-  		zoomOutTitle: 'Zoom out'
-  	},
-
-  	onAdd: function (map) {
-  		var zoomName = 'leaflet-control-zoom',
-  		    container = create$1('div', zoomName + ' leaflet-bar'),
-  		    options = this.options;
-
-  		this._zoomInButton  = this._createButton(options.zoomInText, options.zoomInTitle,
-  		        zoomName + '-in',  container, this._zoomIn);
-  		this._zoomOutButton = this._createButton(options.zoomOutText, options.zoomOutTitle,
-  		        zoomName + '-out', container, this._zoomOut);
-
-  		this._updateDisabled();
-  		map.on('zoomend zoomlevelschange', this._updateDisabled, this);
-
-  		return container;
-  	},
-
-  	onRemove: function (map) {
-  		map.off('zoomend zoomlevelschange', this._updateDisabled, this);
-  	},
-
-  	disable: function () {
-  		this._disabled = true;
-  		this._updateDisabled();
-  		return this;
-  	},
-
-  	enable: function () {
-  		this._disabled = false;
-  		this._updateDisabled();
-  		return this;
-  	},
-
-  	_zoomIn: function (e) {
-  		if (!this._disabled && this._map._zoom < this._map.getMaxZoom()) {
-  			this._map.zoomIn(this._map.options.zoomDelta * (e.shiftKey ? 3 : 1));
-  		}
-  	},
-
-  	_zoomOut: function (e) {
-  		if (!this._disabled && this._map._zoom > this._map.getMinZoom()) {
-  			this._map.zoomOut(this._map.options.zoomDelta * (e.shiftKey ? 3 : 1));
-  		}
-  	},
-
-  	_createButton: function (html, title, className, container, fn) {
-  		var link = create$1('a', className, container);
-  		link.innerHTML = html;
-  		link.href = '#';
-  		link.title = title;
-
-  		/*
-  		 * Will force screen readers like VoiceOver to read this as "Zoom in - button"
-  		 */
-  		link.setAttribute('role', 'button');
-  		link.setAttribute('aria-label', title);
-
-  		disableClickPropagation(link);
-  		on(link, 'click', stop);
-  		on(link, 'click', fn, this);
-  		on(link, 'click', this._refocusOnMap, this);
-
-  		return link;
-  	},
-
-  	_updateDisabled: function () {
-  		var map = this._map,
-  		    className = 'leaflet-disabled';
-
-  		removeClass(this._zoomInButton, className);
-  		removeClass(this._zoomOutButton, className);
-
-  		if (this._disabled || map._zoom === map.getMinZoom()) {
-  			addClass(this._zoomOutButton, className);
-  		}
-  		if (this._disabled || map._zoom === map.getMaxZoom()) {
-  			addClass(this._zoomInButton, className);
-  		}
-  	}
-  });
-
-  // @namespace Map
-  // @section Control options
-  // @option zoomControl: Boolean = true
-  // Whether a [zoom control](#control-zoom) is added to the map by default.
-  Map.mergeOptions({
-  	zoomControl: true
-  });
-
-  Map.addInitHook(function () {
-  	if (this.options.zoomControl) {
-  		// @section Controls
-  		// @property zoomControl: Control.Zoom
-  		// The default zoom control (only available if the
-  		// [`zoomControl` option](#map-zoomcontrol) was `true` when creating the map).
-  		this.zoomControl = new Zoom();
-  		this.addControl(this.zoomControl);
-  	}
-  });
-
-  // @namespace Control.Zoom
-  // @factory L.control.zoom(options: Control.Zoom options)
-  // Creates a zoom control
-  var zoom = function (options) {
-  	return new Zoom(options);
-  };
-
-  /*
-   * @class Control.Scale
-   * @aka L.Control.Scale
-   * @inherits Control
-   *
-   * A simple scale control that shows the scale of the current center of screen in metric (m/km) and imperial (mi/ft) systems. Extends `Control`.
-   *
-   * @example
-   *
-   * ```js
-   * L.control.scale().addTo(map);
-   * ```
-   */
-
-  var Scale = Control.extend({
-  	// @section
-  	// @aka Control.Scale options
-  	options: {
-  		position: 'bottomleft',
-
-  		// @option maxWidth: Number = 100
-  		// Maximum width of the control in pixels. The width is set dynamically to show round values (e.g. 100, 200, 500).
-  		maxWidth: 100,
-
-  		// @option metric: Boolean = True
-  		// Whether to show the metric scale line (m/km).
-  		metric: true,
-
-  		// @option imperial: Boolean = True
-  		// Whether to show the imperial scale line (mi/ft).
-  		imperial: true
-
-  		// @option updateWhenIdle: Boolean = false
-  		// If `true`, the control is updated on [`moveend`](#map-moveend), otherwise it's always up-to-date (updated on [`move`](#map-move)).
-  	},
-
-  	onAdd: function (map) {
-  		var className = 'leaflet-control-scale',
-  		    container = create$1('div', className),
-  		    options = this.options;
-
-  		this._addScales(options, className + '-line', container);
-
-  		map.on(options.updateWhenIdle ? 'moveend' : 'move', this._update, this);
-  		map.whenReady(this._update, this);
-
-  		return container;
-  	},
-
-  	onRemove: function (map) {
-  		map.off(this.options.updateWhenIdle ? 'moveend' : 'move', this._update, this);
-  	},
-
-  	_addScales: function (options, className, container) {
-  		if (options.metric) {
-  			this._mScale = create$1('div', className, container);
-  		}
-  		if (options.imperial) {
-  			this._iScale = create$1('div', className, container);
-  		}
-  	},
-
-  	_update: function () {
-  		var map = this._map,
-  		    y = map.getSize().y / 2;
-
-  		var maxMeters = map.distance(
-  			map.containerPointToLatLng([0, y]),
-  			map.containerPointToLatLng([this.options.maxWidth, y]));
-
-  		this._updateScales(maxMeters);
-  	},
-
-  	_updateScales: function (maxMeters) {
-  		if (this.options.metric && maxMeters) {
-  			this._updateMetric(maxMeters);
-  		}
-  		if (this.options.imperial && maxMeters) {
-  			this._updateImperial(maxMeters);
-  		}
-  	},
-
-  	_updateMetric: function (maxMeters) {
-  		var meters = this._getRoundNum(maxMeters),
-  		    label = meters < 1000 ? meters + ' m' : (meters / 1000) + ' km';
-
-  		this._updateScale(this._mScale, label, meters / maxMeters);
-  	},
-
-  	_updateImperial: function (maxMeters) {
-  		var maxFeet = maxMeters * 3.2808399,
-  		    maxMiles, miles, feet;
-
-  		if (maxFeet > 5280) {
-  			maxMiles = maxFeet / 5280;
-  			miles = this._getRoundNum(maxMiles);
-  			this._updateScale(this._iScale, miles + ' mi', miles / maxMiles);
-
-  		} else {
-  			feet = this._getRoundNum(maxFeet);
-  			this._updateScale(this._iScale, feet + ' ft', feet / maxFeet);
-  		}
-  	},
-
-  	_updateScale: function (scale, text, ratio) {
-  		scale.style.width = Math.round(this.options.maxWidth * ratio) + 'px';
-  		scale.innerHTML = text;
-  	},
-
-  	_getRoundNum: function (num) {
-  		var pow10 = Math.pow(10, (Math.floor(num) + '').length - 1),
-  		    d = num / pow10;
-
-  		d = d >= 10 ? 10 :
-  		    d >= 5 ? 5 :
-  		    d >= 3 ? 3 :
-  		    d >= 2 ? 2 : 1;
-
-  		return pow10 * d;
-  	}
-  });
-
-
-  // @factory L.control.scale(options?: Control.Scale options)
-  // Creates an scale control with the given options.
-  var scale = function (options) {
-  	return new Scale(options);
-  };
-
-  /*
-   * @class Control.Attribution
-   * @aka L.Control.Attribution
-   * @inherits Control
-   *
-   * The attribution control allows you to display attribution data in a small text box on a map. It is put on the map by default unless you set its [`attributionControl` option](#map-attributioncontrol) to `false`, and it fetches attribution texts from layers with the [`getAttribution` method](#layer-getattribution) automatically. Extends Control.
-   */
-
-  var Attribution = Control.extend({
-  	// @section
-  	// @aka Control.Attribution options
-  	options: {
-  		position: 'bottomright',
-
-  		// @option prefix: String = 'Leaflet'
-  		// The HTML text shown before the attributions. Pass `false` to disable.
-  		prefix: '<a href="https://leafletjs.com" title="A JS library for interactive maps">Leaflet</a>'
-  	},
-
-  	initialize: function (options) {
-  		setOptions(this, options);
-
-  		this._attributions = {};
-  	},
-
-  	onAdd: function (map) {
-  		map.attributionControl = this;
-  		this._container = create$1('div', 'leaflet-control-attribution');
-  		disableClickPropagation(this._container);
-
-  		// TODO ugly, refactor
-  		for (var i in map._layers) {
-  			if (map._layers[i].getAttribution) {
-  				this.addAttribution(map._layers[i].getAttribution());
-  			}
-  		}
-
-  		this._update();
-
-  		return this._container;
-  	},
-
-  	// @method setPrefix(prefix: String): this
-  	// Sets the text before the attributions.
-  	setPrefix: function (prefix) {
-  		this.options.prefix = prefix;
-  		this._update();
-  		return this;
-  	},
-
-  	// @method addAttribution(text: String): this
-  	// Adds an attribution text (e.g. `'Vector data &copy; Mapbox'`).
-  	addAttribution: function (text) {
-  		if (!text) { return this; }
-
-  		if (!this._attributions[text]) {
-  			this._attributions[text] = 0;
-  		}
-  		this._attributions[text]++;
-
-  		this._update();
-
-  		return this;
-  	},
-
-  	// @method removeAttribution(text: String): this
-  	// Removes an attribution text.
-  	removeAttribution: function (text) {
-  		if (!text) { return this; }
-
-  		if (this._attributions[text]) {
-  			this._attributions[text]--;
-  			this._update();
-  		}
-
-  		return this;
-  	},
-
-  	_update: function () {
-  		if (!this._map) { return; }
-
-  		var attribs = [];
-
-  		for (var i in this._attributions) {
-  			if (this._attributions[i]) {
-  				attribs.push(i);
-  			}
-  		}
-
-  		var prefixAndAttribs = [];
-
-  		if (this.options.prefix) {
-  			prefixAndAttribs.push(this.options.prefix);
-  		}
-  		if (attribs.length) {
-  			prefixAndAttribs.push(attribs.join(', '));
-  		}
-
-  		this._container.innerHTML = prefixAndAttribs.join(' | ');
-  	}
-  });
-
-  // @namespace Map
-  // @section Control options
-  // @option attributionControl: Boolean = true
-  // Whether a [attribution control](#control-attribution) is added to the map by default.
-  Map.mergeOptions({
-  	attributionControl: true
-  });
-
-  Map.addInitHook(function () {
-  	if (this.options.attributionControl) {
-  		new Attribution().addTo(this);
-  	}
-  });
-
-  // @namespace Control.Attribution
-  // @factory L.control.attribution(options: Control.Attribution options)
-  // Creates an attribution control.
-  var attribution = function (options) {
-  	return new Attribution(options);
-  };
-
-  Control.Layers = Layers;
-  Control.Zoom = Zoom;
-  Control.Scale = Scale;
-  Control.Attribution = Attribution;
-
-  control.layers = layers;
-  control.zoom = zoom;
-  control.scale = scale;
-  control.attribution = attribution;
-
-  /*
-  	L.Handler is a base class for handler classes that are used internally to inject
-  	interaction features like dragging to classes like Map and Marker.
-  */
-
-  // @class Handler
-  // @aka L.Handler
-  // Abstract class for map interaction handlers
-
-  var Handler = Class.extend({
-  	initialize: function (map) {
-  		this._map = map;
-  	},
-
-  	// @method enable(): this
-  	// Enables the handler
-  	enable: function () {
-  		if (this._enabled) { return this; }
-
-  		this._enabled = true;
-  		this.addHooks();
-  		return this;
-  	},
-
-  	// @method disable(): this
-  	// Disables the handler
-  	disable: function () {
-  		if (!this._enabled) { return this; }
-
-  		this._enabled = false;
-  		this.removeHooks();
-  		return this;
-  	},
-
-  	// @method enabled(): Boolean
-  	// Returns `true` if the handler is enabled
-  	enabled: function () {
-  		return !!this._enabled;
-  	}
-
-  	// @section Extension methods
-  	// Classes inheriting from `Handler` must implement the two following methods:
-  	// @method addHooks()
-  	// Called when the handler is enabled, should add event hooks.
-  	// @method removeHooks()
-  	// Called when the handler is disabled, should remove the event hooks added previously.
-  });
-
-  // @section There is static function which can be called without instantiating L.Handler:
-  // @function addTo(map: Map, name: String): this
-  // Adds a new Handler to the given map with the given name.
-  Handler.addTo = function (map, name) {
-  	map.addHandler(name, this);
-  	return this;
-  };
-
-  var Mixin = {Events: Events};
-
-  /*
-   * @class Draggable
-   * @aka L.Draggable
-   * @inherits Evented
-   *
-   * A class for making DOM elements draggable (including touch support).
-   * Used internally for map and marker dragging. Only works for elements
-   * that were positioned with [`L.DomUtil.setPosition`](#domutil-setposition).
-   *
-   * @example
-   * ```js
-   * var draggable = new L.Draggable(elementToDrag);
-   * draggable.enable();
-   * ```
-   */
-
-  var START = touch ? 'touchstart mousedown' : 'mousedown';
-  var END = {
-  	mousedown: 'mouseup',
-  	touchstart: 'touchend',
-  	pointerdown: 'touchend',
-  	MSPointerDown: 'touchend'
-  };
-  var MOVE = {
-  	mousedown: 'mousemove',
-  	touchstart: 'touchmove',
-  	pointerdown: 'touchmove',
-  	MSPointerDown: 'touchmove'
-  };
-
-
-  var Draggable = Evented.extend({
-
-  	options: {
-  		// @section
-  		// @aka Draggable options
-  		// @option clickTolerance: Number = 3
-  		// The max number of pixels a user can shift the mouse pointer during a click
-  		// for it to be considered a valid click (as opposed to a mouse drag).
-  		clickTolerance: 3
-  	},
-
-  	// @constructor L.Draggable(el: HTMLElement, dragHandle?: HTMLElement, preventOutline?: Boolean, options?: Draggable options)
-  	// Creates a `Draggable` object for moving `el` when you start dragging the `dragHandle` element (equals `el` itself by default).
-  	initialize: function (element, dragStartTarget, preventOutline$$1, options) {
-  		setOptions(this, options);
-
-  		this._element = element;
-  		this._dragStartTarget = dragStartTarget || element;
-  		this._preventOutline = preventOutline$$1;
-  	},
-
-  	// @method enable()
-  	// Enables the dragging ability
-  	enable: function () {
-  		if (this._enabled) { return; }
-
-  		on(this._dragStartTarget, START, this._onDown, this);
-
-  		this._enabled = true;
-  	},
-
-  	// @method disable()
-  	// Disables the dragging ability
-  	disable: function () {
-  		if (!this._enabled) { return; }
-
-  		// If we're currently dragging this draggable,
-  		// disabling it counts as first ending the drag.
-  		if (Draggable._dragging === this) {
-  			this.finishDrag();
-  		}
-
-  		off(this._dragStartTarget, START, this._onDown, this);
-
-  		this._enabled = false;
-  		this._moved = false;
-  	},
-
-  	_onDown: function (e) {
-  		// Ignore simulated events, since we handle both touch and
-  		// mouse explicitly; otherwise we risk getting duplicates of
-  		// touch events, see #4315.
-  		// Also ignore the event if disabled; this happens in IE11
-  		// under some circumstances, see #3666.
-  		if (e._simulated || !this._enabled) { return; }
-
-  		this._moved = false;
-
-  		if (hasClass(this._element, 'leaflet-zoom-anim')) { return; }
-
-  		if (Draggable._dragging || e.shiftKey || ((e.which !== 1) && (e.button !== 1) && !e.touches)) { return; }
-  		Draggable._dragging = this;  // Prevent dragging multiple objects at once.
-
-  		if (this._preventOutline) {
-  			preventOutline(this._element);
-  		}
-
-  		disableImageDrag();
-  		disableTextSelection();
-
-  		if (this._moving) { return; }
-
-  		// @event down: Event
-  		// Fired when a drag is about to start.
-  		this.fire('down');
-
-  		var first = e.touches ? e.touches[0] : e,
-  		    sizedParent = getSizedParentNode(this._element);
-
-  		this._startPoint = new Point(first.clientX, first.clientY);
-
-  		// Cache the scale, so that we can continuously compensate for it during drag (_onMove).
-  		this._parentScale = getScale(sizedParent);
-
-  		on(document, MOVE[e.type], this._onMove, this);
-  		on(document, END[e.type], this._onUp, this);
-  	},
-
-  	_onMove: function (e) {
-  		// Ignore simulated events, since we handle both touch and
-  		// mouse explicitly; otherwise we risk getting duplicates of
-  		// touch events, see #4315.
-  		// Also ignore the event if disabled; this happens in IE11
-  		// under some circumstances, see #3666.
-  		if (e._simulated || !this._enabled) { return; }
-
-  		if (e.touches && e.touches.length > 1) {
-  			this._moved = true;
-  			return;
-  		}
-
-  		var first = (e.touches && e.touches.length === 1 ? e.touches[0] : e),
-  		    offset = new Point(first.clientX, first.clientY)._subtract(this._startPoint);
-
-  		if (!offset.x && !offset.y) { return; }
-  		if (Math.abs(offset.x) + Math.abs(offset.y) < this.options.clickTolerance) { return; }
-
-  		// We assume that the parent container's position, border and scale do not change for the duration of the drag.
-  		// Therefore there is no need to account for the position and border (they are eliminated by the subtraction)
-  		// and we can use the cached value for the scale.
-  		offset.x /= this._parentScale.x;
-  		offset.y /= this._parentScale.y;
-
-  		preventDefault(e);
-
-  		if (!this._moved) {
-  			// @event dragstart: Event
-  			// Fired when a drag starts
-  			this.fire('dragstart');
-
-  			this._moved = true;
-  			this._startPos = getPosition(this._element).subtract(offset);
-
-  			addClass(document.body, 'leaflet-dragging');
-
-  			this._lastTarget = e.target || e.srcElement;
-  			// IE and Edge do not give the <use> element, so fetch it
-  			// if necessary
-  			if (window.SVGElementInstance && this._lastTarget instanceof window.SVGElementInstance) {
-  				this._lastTarget = this._lastTarget.correspondingUseElement;
-  			}
-  			addClass(this._lastTarget, 'leaflet-drag-target');
-  		}
-
-  		this._newPos = this._startPos.add(offset);
-  		this._moving = true;
-
-  		cancelAnimFrame(this._animRequest);
-  		this._lastEvent = e;
-  		this._animRequest = requestAnimFrame(this._updatePosition, this, true);
-  	},
-
-  	_updatePosition: function () {
-  		var e = {originalEvent: this._lastEvent};
-
-  		// @event predrag: Event
-  		// Fired continuously during dragging *before* each corresponding
-  		// update of the element's position.
-  		this.fire('predrag', e);
-  		setPosition(this._element, this._newPos);
-
-  		// @event drag: Event
-  		// Fired continuously during dragging.
-  		this.fire('drag', e);
-  	},
-
-  	_onUp: function (e) {
-  		// Ignore simulated events, since we handle both touch and
-  		// mouse explicitly; otherwise we risk getting duplicates of
-  		// touch events, see #4315.
-  		// Also ignore the event if disabled; this happens in IE11
-  		// under some circumstances, see #3666.
-  		if (e._simulated || !this._enabled) { return; }
-  		this.finishDrag();
-  	},
-
-  	finishDrag: function () {
-  		removeClass(document.body, 'leaflet-dragging');
-
-  		if (this._lastTarget) {
-  			removeClass(this._lastTarget, 'leaflet-drag-target');
-  			this._lastTarget = null;
-  		}
-
-  		for (var i in MOVE) {
-  			off(document, MOVE[i], this._onMove, this);
-  			off(document, END[i], this._onUp, this);
-  		}
-
-  		enableImageDrag();
-  		enableTextSelection();
-
-  		if (this._moved && this._moving) {
-  			// ensure drag is not fired after dragend
-  			cancelAnimFrame(this._animRequest);
-
-  			// @event dragend: DragEndEvent
-  			// Fired when the drag ends.
-  			this.fire('dragend', {
-  				distance: this._newPos.distanceTo(this._startPos)
-  			});
-  		}
-
-  		this._moving = false;
-  		Draggable._dragging = false;
-  	}
-
-  });
-
-  /*
-   * @namespace LineUtil
-   *
-   * Various utility functions for polyline points processing, used by Leaflet internally to make polylines lightning-fast.
-   */
-
-  // Simplify polyline with vertex reduction and Douglas-Peucker simplification.
-  // Improves rendering performance dramatically by lessening the number of points to draw.
-
-  // @function simplify(points: Point[], tolerance: Number): Point[]
-  // Dramatically reduces the number of points in a polyline while retaining
-  // its shape and returns a new array of simplified points, using the
-  // [Douglas-Peucker algorithm](http://en.wikipedia.org/wiki/Douglas-Peucker_algorithm).
-  // Used for a huge performance boost when processing/displaying Leaflet polylines for
-  // each zoom level and also reducing visual noise. tolerance affects the amount of
-  // simplification (lesser value means higher quality but slower and with more points).
-  // Also released as a separated micro-library [Simplify.js](http://mourner.github.com/simplify-js/).
-  function simplify(points, tolerance) {
-  	if (!tolerance || !points.length) {
-  		return points.slice();
-  	}
-
-  	var sqTolerance = tolerance * tolerance;
-
-  	    // stage 1: vertex reduction
-  	    points = _reducePoints(points, sqTolerance);
-
-  	    // stage 2: Douglas-Peucker simplification
-  	    points = _simplifyDP(points, sqTolerance);
-
-  	return points;
-  }
-
-  // @function pointToSegmentDistance(p: Point, p1: Point, p2: Point): Number
-  // Returns the distance between point `p` and segment `p1` to `p2`.
-  function pointToSegmentDistance(p, p1, p2) {
-  	return Math.sqrt(_sqClosestPointOnSegment(p, p1, p2, true));
-  }
-
-  // @function closestPointOnSegment(p: Point, p1: Point, p2: Point): Number
-  // Returns the closest point from a point `p` on a segment `p1` to `p2`.
-  function closestPointOnSegment(p, p1, p2) {
-  	return _sqClosestPointOnSegment(p, p1, p2);
-  }
-
-  // Douglas-Peucker simplification, see http://en.wikipedia.org/wiki/Douglas-Peucker_algorithm
-  function _simplifyDP(points, sqTolerance) {
-
-  	var len = points.length,
-  	    ArrayConstructor = typeof Uint8Array !== undefined + '' ? Uint8Array : Array,
-  	    markers = new ArrayConstructor(len);
-
-  	    markers[0] = markers[len - 1] = 1;
-
-  	_simplifyDPStep(points, markers, sqTolerance, 0, len - 1);
-
-  	var i,
-  	    newPoints = [];
-
-  	for (i = 0; i < len; i++) {
-  		if (markers[i]) {
-  			newPoints.push(points[i]);
-  		}
-  	}
-
-  	return newPoints;
-  }
-
-  function _simplifyDPStep(points, markers, sqTolerance, first, last) {
-
-  	var maxSqDist = 0,
-  	index, i, sqDist;
-
-  	for (i = first + 1; i <= last - 1; i++) {
-  		sqDist = _sqClosestPointOnSegment(points[i], points[first], points[last], true);
-
-  		if (sqDist > maxSqDist) {
-  			index = i;
-  			maxSqDist = sqDist;
-  		}
-  	}
-
-  	if (maxSqDist > sqTolerance) {
-  		markers[index] = 1;
-
-  		_simplifyDPStep(points, markers, sqTolerance, first, index);
-  		_simplifyDPStep(points, markers, sqTolerance, index, last);
-  	}
-  }
-
-  // reduce points that are too close to each other to a single point
-  function _reducePoints(points, sqTolerance) {
-  	var reducedPoints = [points[0]];
-
-  	for (var i = 1, prev = 0, len = points.length; i < len; i++) {
-  		if (_sqDist(points[i], points[prev]) > sqTolerance) {
-  			reducedPoints.push(points[i]);
-  			prev = i;
-  		}
-  	}
-  	if (prev < len - 1) {
-  		reducedPoints.push(points[len - 1]);
-  	}
-  	return reducedPoints;
-  }
-
-  var _lastCode;
-
-  // @function clipSegment(a: Point, b: Point, bounds: Bounds, useLastCode?: Boolean, round?: Boolean): Point[]|Boolean
-  // Clips the segment a to b by rectangular bounds with the
-  // [Cohen-Sutherland algorithm](https://en.wikipedia.org/wiki/Cohen%E2%80%93Sutherland_algorithm)
-  // (modifying the segment points directly!). Used by Leaflet to only show polyline
-  // points that are on the screen or near, increasing performance.
-  function clipSegment(a, b, bounds, useLastCode, round) {
-  	var codeA = useLastCode ? _lastCode : _getBitCode(a, bounds),
-  	    codeB = _getBitCode(b, bounds),
-
-  	    codeOut, p, newCode;
-
-  	    // save 2nd code to avoid calculating it on the next segment
-  	    _lastCode = codeB;
-
-  	while (true) {
-  		// if a,b is inside the clip window (trivial accept)
-  		if (!(codeA | codeB)) {
-  			return [a, b];
-  		}
-
-  		// if a,b is outside the clip window (trivial reject)
-  		if (codeA & codeB) {
-  			return false;
-  		}
-
-  		// other cases
-  		codeOut = codeA || codeB;
-  		p = _getEdgeIntersection(a, b, codeOut, bounds, round);
-  		newCode = _getBitCode(p, bounds);
-
-  		if (codeOut === codeA) {
-  			a = p;
-  			codeA = newCode;
-  		} else {
-  			b = p;
-  			codeB = newCode;
-  		}
-  	}
-  }
-
-  function _getEdgeIntersection(a, b, code, bounds, round) {
-  	var dx = b.x - a.x,
-  	    dy = b.y - a.y,
-  	    min = bounds.min,
-  	    max = bounds.max,
-  	    x, y;
-
-  	if (code & 8) { // top
-  		x = a.x + dx * (max.y - a.y) / dy;
-  		y = max.y;
-
-  	} else if (code & 4) { // bottom
-  		x = a.x + dx * (min.y - a.y) / dy;
-  		y = min.y;
-
-  	} else if (code & 2) { // right
-  		x = max.x;
-  		y = a.y + dy * (max.x - a.x) / dx;
-
-  	} else if (code & 1) { // left
-  		x = min.x;
-  		y = a.y + dy * (min.x - a.x) / dx;
-  	}
-
-  	return new Point(x, y, round);
-  }
-
-  function _getBitCode(p, bounds) {
-  	var code = 0;
-
-  	if (p.x < bounds.min.x) { // left
-  		code |= 1;
-  	} else if (p.x > bounds.max.x) { // right
-  		code |= 2;
-  	}
-
-  	if (p.y < bounds.min.y) { // bottom
-  		code |= 4;
-  	} else if (p.y > bounds.max.y) { // top
-  		code |= 8;
-  	}
-
-  	return code;
-  }
-
-  // square distance (to avoid unnecessary Math.sqrt calls)
-  function _sqDist(p1, p2) {
-  	var dx = p2.x - p1.x,
-  	    dy = p2.y - p1.y;
-  	return dx * dx + dy * dy;
-  }
-
-  // return closest point on segment or distance to that point
-  function _sqClosestPointOnSegment(p, p1, p2, sqDist) {
-  	var x = p1.x,
-  	    y = p1.y,
-  	    dx = p2.x - x,
-  	    dy = p2.y - y,
-  	    dot = dx * dx + dy * dy,
-  	    t;
-
-  	if (dot > 0) {
-  		t = ((p.x - x) * dx + (p.y - y) * dy) / dot;
-
-  		if (t > 1) {
-  			x = p2.x;
-  			y = p2.y;
-  		} else if (t > 0) {
-  			x += dx * t;
-  			y += dy * t;
-  		}
-  	}
-
-  	dx = p.x - x;
-  	dy = p.y - y;
-
-  	return sqDist ? dx * dx + dy * dy : new Point(x, y);
-  }
-
-
-  // @function isFlat(latlngs: LatLng[]): Boolean
-  // Returns true if `latlngs` is a flat array, false is nested.
-  function isFlat(latlngs) {
-  	return !isArray(latlngs[0]) || (typeof latlngs[0][0] !== 'object' && typeof latlngs[0][0] !== 'undefined');
-  }
-
-  function _flat(latlngs) {
-  	console.warn('Deprecated use of _flat, please use L.LineUtil.isFlat instead.');
-  	return isFlat(latlngs);
-  }
-
-  var LineUtil = ({
-    simplify: simplify,
-    pointToSegmentDistance: pointToSegmentDistance,
-    closestPointOnSegment: closestPointOnSegment,
-    clipSegment: clipSegment,
-    _getEdgeIntersection: _getEdgeIntersection,
-    _getBitCode: _getBitCode,
-    _sqClosestPointOnSegment: _sqClosestPointOnSegment,
-    isFlat: isFlat,
-    _flat: _flat
-  });
-
-  /*
-   * @namespace PolyUtil
-   * Various utility functions for polygon geometries.
-   */
-
-  /* @function clipPolygon(points: Point[], bounds: Bounds, round?: Boolean): Point[]
-   * Clips the polygon geometry defined by the given `points` by the given bounds (using the [Sutherland-Hodgman algorithm](https://en.wikipedia.org/wiki/Sutherland%E2%80%93Hodgman_algorithm)).
-   * Used by Leaflet to only show polygon points that are on the screen or near, increasing
-   * performance. Note that polygon points needs different algorithm for clipping
-   * than polyline, so there's a separate method for it.
-   */
-  function clipPolygon(points, bounds, round) {
-  	var clippedPoints,
-  	    edges = [1, 4, 2, 8],
-  	    i, j, k,
-  	    a, b,
-  	    len, edge, p;
-
-  	for (i = 0, len = points.length; i < len; i++) {
-  		points[i]._code = _getBitCode(points[i], bounds);
-  	}
-
-  	// for each edge (left, bottom, right, top)
-  	for (k = 0; k < 4; k++) {
-  		edge = edges[k];
-  		clippedPoints = [];
-
-  		for (i = 0, len = points.length, j = len - 1; i < len; j = i++) {
-  			a = points[i];
-  			b = points[j];
-
-  			// if a is inside the clip window
-  			if (!(a._code & edge)) {
-  				// if b is outside the clip window (a->b goes out of screen)
-  				if (b._code & edge) {
-  					p = _getEdgeIntersection(b, a, edge, bounds, round);
-  					p._code = _getBitCode(p, bounds);
-  					clippedPoints.push(p);
-  				}
-  				clippedPoints.push(a);
-
-  			// else if b is inside the clip window (a->b enters the screen)
-  			} else if (!(b._code & edge)) {
-  				p = _getEdgeIntersection(b, a, edge, bounds, round);
-  				p._code = _getBitCode(p, bounds);
-  				clippedPoints.push(p);
-  			}
-  		}
-  		points = clippedPoints;
-  	}
-
-  	return points;
-  }
-
-  var PolyUtil = ({
-    clipPolygon: clipPolygon
-  });
-
-  /*
-   * @namespace Projection
-   * @section
-   * Leaflet comes with a set of already defined Projections out of the box:
-   *
-   * @projection L.Projection.LonLat
-   *
-   * Equirectangular, or Plate Carree projection — the most simple projection,
-   * mostly used by GIS enthusiasts. Directly maps `x` as longitude, and `y` as
-   * latitude. Also suitable for flat worlds, e.g. game maps. Used by the
-   * `EPSG:4326` and `Simple` CRS.
-   */
-
-  var LonLat = {
-  	project: function (latlng) {
-  		return new Point(latlng.lng, latlng.lat);
-  	},
-
-  	unproject: function (point) {
-  		return new LatLng(point.y, point.x);
-  	},
-
-  	bounds: new Bounds([-180, -90], [180, 90])
-  };
-
-  /*
-   * @namespace Projection
-   * @projection L.Projection.Mercator
-   *
-   * Elliptical Mercator projection — more complex than Spherical Mercator. Assumes that Earth is an ellipsoid. Used by the EPSG:3395 CRS.
-   */
-
-  var Mercator = {
-  	R: 6378137,
-  	R_MINOR: 6356752.314245179,
-
-  	bounds: new Bounds([-20037508.34279, -15496570.73972], [20037508.34279, 18764656.23138]),
-
-  	project: function (latlng) {
-  		var d = Math.PI / 180,
-  		    r = this.R,
-  		    y = latlng.lat * d,
-  		    tmp = this.R_MINOR / r,
-  		    e = Math.sqrt(1 - tmp * tmp),
-  		    con = e * Math.sin(y);
-
-  		var ts = Math.tan(Math.PI / 4 - y / 2) / Math.pow((1 - con) / (1 + con), e / 2);
-  		y = -r * Math.log(Math.max(ts, 1E-10));
-
-  		return new Point(latlng.lng * d * r, y);
-  	},
-
-  	unproject: function (point) {
-  		var d = 180 / Math.PI,
-  		    r = this.R,
-  		    tmp = this.R_MINOR / r,
-  		    e = Math.sqrt(1 - tmp * tmp),
-  		    ts = Math.exp(-point.y / r),
-  		    phi = Math.PI / 2 - 2 * Math.atan(ts);
-
-  		for (var i = 0, dphi = 0.1, con; i < 15 && Math.abs(dphi) > 1e-7; i++) {
-  			con = e * Math.sin(phi);
-  			con = Math.pow((1 - con) / (1 + con), e / 2);
-  			dphi = Math.PI / 2 - 2 * Math.atan(ts * con) - phi;
-  			phi += dphi;
-  		}
-
-  		return new LatLng(phi * d, point.x * d / r);
-  	}
-  };
-
-  /*
-   * @class Projection
-
-   * An object with methods for projecting geographical coordinates of the world onto
-   * a flat surface (and back). See [Map projection](http://en.wikipedia.org/wiki/Map_projection).
-
-   * @property bounds: Bounds
-   * The bounds (specified in CRS units) where the projection is valid
-
-   * @method project(latlng: LatLng): Point
-   * Projects geographical coordinates into a 2D point.
-   * Only accepts actual `L.LatLng` instances, not arrays.
-
-   * @method unproject(point: Point): LatLng
-   * The inverse of `project`. Projects a 2D point into a geographical location.
-   * Only accepts actual `L.Point` instances, not arrays.
-
-   * Note that the projection instances do not inherit from Leaflet's `Class` object,
-   * and can't be instantiated. Also, new classes can't inherit from them,
-   * and methods can't be added to them with the `include` function.
-
-   */
-
-  var index = ({
-    LonLat: LonLat,
-    Mercator: Mercator,
-    SphericalMercator: SphericalMercator
-  });
-
-  /*
-   * @namespace CRS
-   * @crs L.CRS.EPSG3395
-   *
-   * Rarely used by some commercial tile providers. Uses Elliptical Mercator projection.
-   */
-  var EPSG3395 = extend({}, Earth, {
-  	code: 'EPSG:3395',
-  	projection: Mercator,
-
-  	transformation: (function () {
-  		var scale = 0.5 / (Math.PI * Mercator.R);
-  		return toTransformation(scale, 0.5, -scale, 0.5);
-  	}())
-  });
-
-  /*
-   * @namespace CRS
-   * @crs L.CRS.EPSG4326
-   *
-   * A common CRS among GIS enthusiasts. Uses simple Equirectangular projection.
-   *
-   * Leaflet 1.0.x complies with the [TMS coordinate scheme for EPSG:4326](https://wiki.osgeo.org/wiki/Tile_Map_Service_Specification#global-geodetic),
-   * which is a breaking change from 0.7.x behaviour.  If you are using a `TileLayer`
-   * with this CRS, ensure that there are two 256x256 pixel tiles covering the
-   * whole earth at zoom level zero, and that the tile coordinate origin is (-180,+90),
-   * or (-180,-90) for `TileLayer`s with [the `tms` option](#tilelayer-tms) set.
-   */
-
-  var EPSG4326 = extend({}, Earth, {
-  	code: 'EPSG:4326',
-  	projection: LonLat,
-  	transformation: toTransformation(1 / 180, 1, -1 / 180, 0.5)
-  });
-
-  /*
-   * @namespace CRS
-   * @crs L.CRS.Simple
-   *
-   * A simple CRS that maps longitude and latitude into `x` and `y` directly.
-   * May be used for maps of flat surfaces (e.g. game maps). Note that the `y`
-   * axis should still be inverted (going from bottom to top). `distance()` returns
-   * simple euclidean distance.
-   */
-
-  var Simple = extend({}, CRS, {
-  	projection: LonLat,
-  	transformation: toTransformation(1, 0, -1, 0),
-
-  	scale: function (zoom) {
-  		return Math.pow(2, zoom);
-  	},
-
-  	zoom: function (scale) {
-  		return Math.log(scale) / Math.LN2;
-  	},
-
-  	distance: function (latlng1, latlng2) {
-  		var dx = latlng2.lng - latlng1.lng,
-  		    dy = latlng2.lat - latlng1.lat;
-
-  		return Math.sqrt(dx * dx + dy * dy);
-  	},
-
-  	infinite: true
-  });
-
-  CRS.Earth = Earth;
-  CRS.EPSG3395 = EPSG3395;
-  CRS.EPSG3857 = EPSG3857;
-  CRS.EPSG900913 = EPSG900913;
-  CRS.EPSG4326 = EPSG4326;
-  CRS.Simple = Simple;
-
-  /*
-   * @class Layer
-   * @inherits Evented
-   * @aka L.Layer
-   * @aka ILayer
-   *
-   * A set of methods from the Layer base class that all Leaflet layers use.
-   * Inherits all methods, options and events from `L.Evented`.
-   *
-   * @example
-   *
-   * ```js
-   * var layer = L.marker(latlng).addTo(map);
-   * layer.addTo(map);
-   * layer.remove();
-   * ```
-   *
-   * @event add: Event
-   * Fired after the layer is added to a map
-   *
-   * @event remove: Event
-   * Fired after the layer is removed from a map
-   */
-
-
-  var Layer = Evented.extend({
-
-  	// Classes extending `L.Layer` will inherit the following options:
-  	options: {
-  		// @option pane: String = 'overlayPane'
-  		// By default the layer will be added to the map's [overlay pane](#map-overlaypane). Overriding this option will cause the layer to be placed on another pane by default.
-  		pane: 'overlayPane',
-
-  		// @option attribution: String = null
-  		// String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
-  		attribution: null,
-
-  		bubblingMouseEvents: true
-  	},
-
-  	/* @section
-  	 * Classes extending `L.Layer` will inherit the following methods:
-  	 *
-  	 * @method addTo(map: Map|LayerGroup): this
-  	 * Adds the layer to the given map or layer group.
-  	 */
-  	addTo: function (map) {
-  		map.addLayer(this);
-  		return this;
-  	},
-
-  	// @method remove: this
-  	// Removes the layer from the map it is currently active on.
-  	remove: function () {
-  		return this.removeFrom(this._map || this._mapToAdd);
-  	},
-
-  	// @method removeFrom(map: Map): this
-  	// Removes the layer from the given map
-  	//
-  	// @alternative
-  	// @method removeFrom(group: LayerGroup): this
-  	// Removes the layer from the given `LayerGroup`
-  	removeFrom: function (obj) {
-  		if (obj) {
-  			obj.removeLayer(this);
-  		}
-  		return this;
-  	},
-
-  	// @method getPane(name? : String): HTMLElement
-  	// Returns the `HTMLElement` representing the named pane on the map. If `name` is omitted, returns the pane for this layer.
-  	getPane: function (name) {
-  		return this._map.getPane(name ? (this.options[name] || name) : this.options.pane);
-  	},
-
-  	addInteractiveTarget: function (targetEl) {
-  		this._map._targets[stamp(targetEl)] = this;
-  		return this;
-  	},
-
-  	removeInteractiveTarget: function (targetEl) {
-  		delete this._map._targets[stamp(targetEl)];
-  		return this;
-  	},
-
-  	// @method getAttribution: String
-  	// Used by the `attribution control`, returns the [attribution option](#gridlayer-attribution).
-  	getAttribution: function () {
-  		return this.options.attribution;
-  	},
-
-  	_layerAdd: function (e) {
-  		var map = e.target;
-
-  		// check in case layer gets added and then removed before the map is ready
-  		if (!map.hasLayer(this)) { return; }
-
-  		this._map = map;
-  		this._zoomAnimated = map._zoomAnimated;
-
-  		if (this.getEvents) {
-  			var events = this.getEvents();
-  			map.on(events, this);
-  			this.once('remove', function () {
-  				map.off(events, this);
-  			}, this);
-  		}
-
-  		this.onAdd(map);
-
-  		if (this.getAttribution && map.attributionControl) {
-  			map.attributionControl.addAttribution(this.getAttribution());
-  		}
-
-  		this.fire('add');
-  		map.fire('layeradd', {layer: this});
-  	}
-  });
-
-  /* @section Extension methods
-   * @uninheritable
-   *
-   * Every layer should extend from `L.Layer` and (re-)implement the following methods.
-   *
-   * @method onAdd(map: Map): this
-   * Should contain code that creates DOM elements for the layer, adds them to `map panes` where they should belong and puts listeners on relevant map events. Called on [`map.addLayer(layer)`](#map-addlayer).
-   *
-   * @method onRemove(map: Map): this
-   * Should contain all clean up code that removes the layer's elements from the DOM and removes listeners previously added in [`onAdd`](#layer-onadd). Called on [`map.removeLayer(layer)`](#map-removelayer).
-   *
-   * @method getEvents(): Object
-   * This optional method should return an object like `{ viewreset: this._reset }` for [`addEventListener`](#evented-addeventlistener). The event handlers in this object will be automatically added and removed from the map with your layer.
-   *
-   * @method getAttribution(): String
-   * This optional method should return a string containing HTML to be shown on the `Attribution control` whenever the layer is visible.
-   *
-   * @method beforeAdd(map: Map): this
-   * Optional method. Called on [`map.addLayer(layer)`](#map-addlayer), before the layer is added to the map, before events are initialized, without waiting until the map is in a usable state. Use for early initialization only.
-   */
-
-
-  /* @namespace Map
-   * @section Layer events
-   *
-   * @event layeradd: LayerEvent
-   * Fired when a new layer is added to the map.
-   *
-   * @event layerremove: LayerEvent
-   * Fired when some layer is removed from the map
-   *
-   * @section Methods for Layers and Controls
-   */
-  Map.include({
-  	// @method addLayer(layer: Layer): this
-  	// Adds the given layer to the map
-  	addLayer: function (layer) {
-  		if (!layer._layerAdd) {
-  			throw new Error('The provided object is not a Layer.');
-  		}
-
-  		var id = stamp(layer);
-  		if (this._layers[id]) { return this; }
-  		this._layers[id] = layer;
-
-  		layer._mapToAdd = this;
-
-  		if (layer.beforeAdd) {
-  			layer.beforeAdd(this);
-  		}
-
-  		this.whenReady(layer._layerAdd, layer);
-
-  		return this;
-  	},
-
-  	// @method removeLayer(layer: Layer): this
-  	// Removes the given layer from the map.
-  	removeLayer: function (layer) {
-  		var id = stamp(layer);
-
-  		if (!this._layers[id]) { return this; }
-
-  		if (this._loaded) {
-  			layer.onRemove(this);
-  		}
-
-  		if (layer.getAttribution && this.attributionControl) {
-  			this.attributionControl.removeAttribution(layer.getAttribution());
-  		}
-
-  		delete this._layers[id];
-
-  		if (this._loaded) {
-  			this.fire('layerremove', {layer: layer});
-  			layer.fire('remove');
-  		}
-
-  		layer._map = layer._mapToAdd = null;
-
-  		return this;
-  	},
-
-  	// @method hasLayer(layer: Layer): Boolean
-  	// Returns `true` if the given layer is currently added to the map
-  	hasLayer: function (layer) {
-  		return !!layer && (stamp(layer) in this._layers);
-  	},
-
-  	/* @method eachLayer(fn: Function, context?: Object): this
-  	 * Iterates over the layers of the map, optionally specifying context of the iterator function.
-  	 * ```
-  	 * map.eachLayer(function(layer){
-  	 *     layer.bindPopup('Hello');
-  	 * });
-  	 * ```
-  	 */
-  	eachLayer: function (method, context) {
-  		for (var i in this._layers) {
-  			method.call(context, this._layers[i]);
-  		}
-  		return this;
-  	},
-
-  	_addLayers: function (layers) {
-  		layers = layers ? (isArray(layers) ? layers : [layers]) : [];
-
-  		for (var i = 0, len = layers.length; i < len; i++) {
-  			this.addLayer(layers[i]);
-  		}
-  	},
-
-  	_addZoomLimit: function (layer) {
-  		if (isNaN(layer.options.maxZoom) || !isNaN(layer.options.minZoom)) {
-  			this._zoomBoundLayers[stamp(layer)] = layer;
-  			this._updateZoomLevels();
-  		}
-  	},
-
-  	_removeZoomLimit: function (layer) {
-  		var id = stamp(layer);
-
-  		if (this._zoomBoundLayers[id]) {
-  			delete this._zoomBoundLayers[id];
-  			this._updateZoomLevels();
-  		}
-  	},
-
-  	_updateZoomLevels: function () {
-  		var minZoom = Infinity,
-  		    maxZoom = -Infinity,
-  		    oldZoomSpan = this._getZoomSpan();
-
-  		for (var i in this._zoomBoundLayers) {
-  			var options = this._zoomBoundLayers[i].options;
-
-  			minZoom = options.minZoom === undefined ? minZoom : Math.min(minZoom, options.minZoom);
-  			maxZoom = options.maxZoom === undefined ? maxZoom : Math.max(maxZoom, options.maxZoom);
-  		}
-
-  		this._layersMaxZoom = maxZoom === -Infinity ? undefined : maxZoom;
-  		this._layersMinZoom = minZoom === Infinity ? undefined : minZoom;
-
-  		// @section Map state change events
-  		// @event zoomlevelschange: Event
-  		// Fired when the number of zoomlevels on the map is changed due
-  		// to adding or removing a layer.
-  		if (oldZoomSpan !== this._getZoomSpan()) {
-  			this.fire('zoomlevelschange');
-  		}
-
-  		if (this.options.maxZoom === undefined && this._layersMaxZoom && this.getZoom() > this._layersMaxZoom) {
-  			this.setZoom(this._layersMaxZoom);
-  		}
-  		if (this.options.minZoom === undefined && this._layersMinZoom && this.getZoom() < this._layersMinZoom) {
-  			this.setZoom(this._layersMinZoom);
-  		}
-  	}
-  });
-
-  /*
-   * @class LayerGroup
-   * @aka L.LayerGroup
-   * @inherits Layer
-   *
-   * Used to group several layers and handle them as one. If you add it to the map,
-   * any layers added or removed from the group will be added/removed on the map as
-   * well. Extends `Layer`.
-   *
-   * @example
-   *
-   * ```js
-   * L.layerGroup([marker1, marker2])
-   * 	.addLayer(polyline)
-   * 	.addTo(map);
-   * ```
-   */
-
-  var LayerGroup = Layer.extend({
-
-  	initialize: function (layers, options) {
-  		setOptions(this, options);
-
-  		this._layers = {};
-
-  		var i, len;
-
-  		if (layers) {
-  			for (i = 0, len = layers.length; i < len; i++) {
-  				this.addLayer(layers[i]);
-  			}
-  		}
-  	},
-
-  	// @method addLayer(layer: Layer): this
-  	// Adds the given layer to the group.
-  	addLayer: function (layer) {
-  		var id = this.getLayerId(layer);
-
-  		this._layers[id] = layer;
-
-  		if (this._map) {
-  			this._map.addLayer(layer);
-  		}
-
-  		return this;
-  	},
-
-  	// @method removeLayer(layer: Layer): this
-  	// Removes the given layer from the group.
-  	// @alternative
-  	// @method removeLayer(id: Number): this
-  	// Removes the layer with the given internal ID from the group.
-  	removeLayer: function (layer) {
-  		var id = layer in this._layers ? layer : this.getLayerId(layer);
-
-  		if (this._map && this._layers[id]) {
-  			this._map.removeLayer(this._layers[id]);
-  		}
-
-  		delete this._layers[id];
-
-  		return this;
-  	},
-
-  	// @method hasLayer(layer: Layer): Boolean
-  	// Returns `true` if the given layer is currently added to the group.
-  	// @alternative
-  	// @method hasLayer(id: Number): Boolean
-  	// Returns `true` if the given internal ID is currently added to the group.
-  	hasLayer: function (layer) {
-  		if (!layer) { return false; }
-  		var layerId = typeof layer === 'number' ? layer : this.getLayerId(layer);
-  		return layerId in this._layers;
-  	},
-
-  	// @method clearLayers(): this
-  	// Removes all the layers from the group.
-  	clearLayers: function () {
-  		return this.eachLayer(this.removeLayer, this);
-  	},
-
-  	// @method invoke(methodName: String, …): this
-  	// Calls `methodName` on every layer contained in this group, passing any
-  	// additional parameters. Has no effect if the layers contained do not
-  	// implement `methodName`.
-  	invoke: function (methodName) {
-  		var args = Array.prototype.slice.call(arguments, 1),
-  		    i, layer;
-
-  		for (i in this._layers) {
-  			layer = this._layers[i];
-
-  			if (layer[methodName]) {
-  				layer[methodName].apply(layer, args);
-  			}
-  		}
-
-  		return this;
-  	},
-
-  	onAdd: function (map) {
-  		this.eachLayer(map.addLayer, map);
-  	},
-
-  	onRemove: function (map) {
-  		this.eachLayer(map.removeLayer, map);
-  	},
-
-  	// @method eachLayer(fn: Function, context?: Object): this
-  	// Iterates over the layers of the group, optionally specifying context of the iterator function.
-  	// ```js
-  	// group.eachLayer(function (layer) {
-  	// 	layer.bindPopup('Hello');
-  	// });
-  	// ```
-  	eachLayer: function (method, context) {
-  		for (var i in this._layers) {
-  			method.call(context, this._layers[i]);
-  		}
-  		return this;
-  	},
-
-  	// @method getLayer(id: Number): Layer
-  	// Returns the layer with the given internal ID.
-  	getLayer: function (id) {
-  		return this._layers[id];
-  	},
-
-  	// @method getLayers(): Layer[]
-  	// Returns an array of all the layers added to the group.
-  	getLayers: function () {
-  		var layers = [];
-  		this.eachLayer(layers.push, layers);
-  		return layers;
-  	},
-
-  	// @method setZIndex(zIndex: Number): this
-  	// Calls `setZIndex` on every layer contained in this group, passing the z-index.
-  	setZIndex: function (zIndex) {
-  		return this.invoke('setZIndex', zIndex);
-  	},
-
-  	// @method getLayerId(layer: Layer): Number
-  	// Returns the internal ID for a layer
-  	getLayerId: function (layer) {
-  		return stamp(layer);
-  	}
-  });
-
-
-  // @factory L.layerGroup(layers?: Layer[], options?: Object)
-  // Create a layer group, optionally given an initial set of layers and an `options` object.
-  var layerGroup = function (layers, options) {
-  	return new LayerGroup(layers, options);
-  };
-
-  /*
-   * @class FeatureGroup
-   * @aka L.FeatureGroup
-   * @inherits LayerGroup
-   *
-   * Extended `LayerGroup` that makes it easier to do the same thing to all its member layers:
-   *  * [`bindPopup`](#layer-bindpopup) binds a popup to all of the layers at once (likewise with [`bindTooltip`](#layer-bindtooltip))
-   *  * Events are propagated to the `FeatureGroup`, so if the group has an event
-   * handler, it will handle events from any of the layers. This includes mouse events
-   * and custom events.
-   *  * Has `layeradd` and `layerremove` events
-   *
-   * @example
-   *
-   * ```js
-   * L.featureGroup([marker1, marker2, polyline])
-   * 	.bindPopup('Hello world!')
-   * 	.on('click', function() { alert('Clicked on a member of the group!'); })
-   * 	.addTo(map);
-   * ```
-   */
-
-  var FeatureGroup = LayerGroup.extend({
-
-  	addLayer: function (layer) {
-  		if (this.hasLayer(layer)) {
-  			return this;
-  		}
-
-  		layer.addEventParent(this);
-
-  		LayerGroup.prototype.addLayer.call(this, layer);
-
-  		// @event layeradd: LayerEvent
-  		// Fired when a layer is added to this `FeatureGroup`
-  		return this.fire('layeradd', {layer: layer});
-  	},
-
-  	removeLayer: function (layer) {
-  		if (!this.hasLayer(layer)) {
-  			return this;
-  		}
-  		if (layer in this._layers) {
-  			layer = this._layers[layer];
-  		}
-
-  		layer.removeEventParent(this);
-
-  		LayerGroup.prototype.removeLayer.call(this, layer);
-
-  		// @event layerremove: LayerEvent
-  		// Fired when a layer is removed from this `FeatureGroup`
-  		return this.fire('layerremove', {layer: layer});
-  	},
-
-  	// @method setStyle(style: Path options): this
-  	// Sets the given path options to each layer of the group that has a `setStyle` method.
-  	setStyle: function (style) {
-  		return this.invoke('setStyle', style);
-  	},
-
-  	// @method bringToFront(): this
-  	// Brings the layer group to the top of all other layers
-  	bringToFront: function () {
-  		return this.invoke('bringToFront');
-  	},
-
-  	// @method bringToBack(): this
-  	// Brings the layer group to the back of all other layers
-  	bringToBack: function () {
-  		return this.invoke('bringToBack');
-  	},
-
-  	// @method getBounds(): LatLngBounds
-  	// Returns the LatLngBounds of the Feature Group (created from bounds and coordinates of its children).
-  	getBounds: function () {
-  		var bounds = new LatLngBounds();
-
-  		for (var id in this._layers) {
-  			var layer = this._layers[id];
-  			bounds.extend(layer.getBounds ? layer.getBounds() : layer.getLatLng());
-  		}
-  		return bounds;
-  	}
-  });
-
-  // @factory L.featureGroup(layers?: Layer[], options?: Object)
-  // Create a feature group, optionally given an initial set of layers and an `options` object.
-  var featureGroup = function (layers, options) {
-  	return new FeatureGroup(layers, options);
-  };
-
-  /*
-   * @class Icon
-   * @aka L.Icon
-   *
-   * Represents an icon to provide when creating a marker.
-   *
-   * @example
-   *
-   * ```js
-   * var myIcon = L.icon({
-   *     iconUrl: 'my-icon.png',
-   *     iconRetinaUrl: 'my-icon@2x.png',
-   *     iconSize: [38, 95],
-   *     iconAnchor: [22, 94],
-   *     popupAnchor: [-3, -76],
-   *     shadowUrl: 'my-icon-shadow.png',
-   *     shadowRetinaUrl: 'my-icon-shadow@2x.png',
-   *     shadowSize: [68, 95],
-   *     shadowAnchor: [22, 94]
-   * });
-   *
-   * L.marker([50.505, 30.57], {icon: myIcon}).addTo(map);
-   * ```
-   *
-   * `L.Icon.Default` extends `L.Icon` and is the blue icon Leaflet uses for markers by default.
-   *
-   */
-
-  var Icon = Class.extend({
-
-  	/* @section
-  	 * @aka Icon options
-  	 *
-  	 * @option iconUrl: String = null
-  	 * **(required)** The URL to the icon image (absolute or relative to your script path).
-  	 *
-  	 * @option iconRetinaUrl: String = null
-  	 * The URL to a retina sized version of the icon image (absolute or relative to your
-  	 * script path). Used for Retina screen devices.
-  	 *
-  	 * @option iconSize: Point = null
-  	 * Size of the icon image in pixels.
-  	 *
-  	 * @option iconAnchor: Point = null
-  	 * The coordinates of the "tip" of the icon (relative to its top left corner). The icon
-  	 * will be aligned so that this point is at the marker's geographical location. Centered
-  	 * by default if size is specified, also can be set in CSS with negative margins.
-  	 *
-  	 * @option popupAnchor: Point = [0, 0]
-  	 * The coordinates of the point from which popups will "open", relative to the icon anchor.
-  	 *
-  	 * @option tooltipAnchor: Point = [0, 0]
-  	 * The coordinates of the point from which tooltips will "open", relative to the icon anchor.
-  	 *
-  	 * @option shadowUrl: String = null
-  	 * The URL to the icon shadow image. If not specified, no shadow image will be created.
-  	 *
-  	 * @option shadowRetinaUrl: String = null
-  	 *
-  	 * @option shadowSize: Point = null
-  	 * Size of the shadow image in pixels.
-  	 *
-  	 * @option shadowAnchor: Point = null
-  	 * The coordinates of the "tip" of the shadow (relative to its top left corner) (the same
-  	 * as iconAnchor if not specified).
-  	 *
-  	 * @option className: String = ''
-  	 * A custom class name to assign to both icon and shadow images. Empty by default.
-  	 */
-
-  	options: {
-  		popupAnchor: [0, 0],
-  		tooltipAnchor: [0, 0]
-  	},
-
-  	initialize: function (options) {
-  		setOptions(this, options);
-  	},
-
-  	// @method createIcon(oldIcon?: HTMLElement): HTMLElement
-  	// Called internally when the icon has to be shown, returns a `<img>` HTML element
-  	// styled according to the options.
-  	createIcon: function (oldIcon) {
-  		return this._createIcon('icon', oldIcon);
-  	},
-
-  	// @method createShadow(oldIcon?: HTMLElement): HTMLElement
-  	// As `createIcon`, but for the shadow beneath it.
-  	createShadow: function (oldIcon) {
-  		return this._createIcon('shadow', oldIcon);
-  	},
-
-  	_createIcon: function (name, oldIcon) {
-  		var src = this._getIconUrl(name);
-
-  		if (!src) {
-  			if (name === 'icon') {
-  				throw new Error('iconUrl not set in Icon options (see the docs).');
-  			}
-  			return null;
-  		}
-
-  		var img = this._createImg(src, oldIcon && oldIcon.tagName === 'IMG' ? oldIcon : null);
-  		this._setIconStyles(img, name);
-
-  		return img;
-  	},
-
-  	_setIconStyles: function (img, name) {
-  		var options = this.options;
-  		var sizeOption = options[name + 'Size'];
-
-  		if (typeof sizeOption === 'number') {
-  			sizeOption = [sizeOption, sizeOption];
-  		}
-
-  		var size = toPoint(sizeOption),
-  		    anchor = toPoint(name === 'shadow' && options.shadowAnchor || options.iconAnchor ||
-  		            size && size.divideBy(2, true));
-
-  		img.className = 'leaflet-marker-' + name + ' ' + (options.className || '');
-
-  		if (anchor) {
-  			img.style.marginLeft = (-anchor.x) + 'px';
-  			img.style.marginTop  = (-anchor.y) + 'px';
-  		}
-
-  		if (size) {
-  			img.style.width  = size.x + 'px';
-  			img.style.height = size.y + 'px';
-  		}
-  	},
-
-  	_createImg: function (src, el) {
-  		el = el || document.createElement('img');
-  		el.src = src;
-  		return el;
-  	},
-
-  	_getIconUrl: function (name) {
-  		return retina && this.options[name + 'RetinaUrl'] || this.options[name + 'Url'];
-  	}
-  });
-
-
-  // @factory L.icon(options: Icon options)
-  // Creates an icon instance with the given options.
-  function icon(options) {
-  	return new Icon(options);
-  }
-
-  /*
-   * @miniclass Icon.Default (Icon)
-   * @aka L.Icon.Default
-   * @section
-   *
-   * A trivial subclass of `Icon`, represents the icon to use in `Marker`s when
-   * no icon is specified. Points to the blue marker image distributed with Leaflet
-   * releases.
-   *
-   * In order to customize the default icon, just change the properties of `L.Icon.Default.prototype.options`
-   * (which is a set of `Icon options`).
-   *
-   * If you want to _completely_ replace the default icon, override the
-   * `L.Marker.prototype.options.icon` with your own icon instead.
-   */
-
-  var IconDefault = Icon.extend({
-
-  	options: {
-  		iconUrl:       'marker-icon.png',
-  		iconRetinaUrl: 'marker-icon-2x.png',
-  		shadowUrl:     'marker-shadow.png',
-  		iconSize:    [25, 41],
-  		iconAnchor:  [12, 41],
-  		popupAnchor: [1, -34],
-  		tooltipAnchor: [16, -28],
-  		shadowSize:  [41, 41]
-  	},
-
-  	_getIconUrl: function (name) {
-  		if (!IconDefault.imagePath) {	// Deprecated, backwards-compatibility only
-  			IconDefault.imagePath = this._detectIconPath();
-  		}
-
-  		// @option imagePath: String
-  		// `Icon.Default` will try to auto-detect the location of the
-  		// blue icon images. If you are placing these images in a non-standard
-  		// way, set this option to point to the right path.
-  		return (this.options.imagePath || IconDefault.imagePath) + Icon.prototype._getIconUrl.call(this, name);
-  	},
-
-  	_detectIconPath: function () {
-  		var el = create$1('div',  'leaflet-default-icon-path', document.body);
-  		var path = getStyle(el, 'background-image') ||
-  		           getStyle(el, 'backgroundImage');	// IE8
-
-  		document.body.removeChild(el);
-
-  		if (path === null || path.indexOf('url') !== 0) {
-  			path = '';
-  		} else {
-  			path = path.replace(/^url\(["']?/, '').replace(/marker-icon\.png["']?\)$/, '');
-  		}
-
-  		return path;
-  	}
-  });
-
-  /*
-   * L.Handler.MarkerDrag is used internally by L.Marker to make the markers draggable.
-   */
-
-
-  /* @namespace Marker
-   * @section Interaction handlers
-   *
-   * Interaction handlers are properties of a marker instance that allow you to control interaction behavior in runtime, enabling or disabling certain features such as dragging (see `Handler` methods). Example:
-   *
-   * ```js
-   * marker.dragging.disable();
-   * ```
-   *
-   * @property dragging: Handler
-   * Marker dragging handler (by both mouse and touch). Only valid when the marker is on the map (Otherwise set [`marker.options.draggable`](#marker-draggable)).
-   */
-
-  var MarkerDrag = Handler.extend({
-  	initialize: function (marker) {
-  		this._marker = marker;
-  	},
-
-  	addHooks: function () {
-  		var icon = this._marker._icon;
-
-  		if (!this._draggable) {
-  			this._draggable = new Draggable(icon, icon, true);
-  		}
-
-  		this._draggable.on({
-  			dragstart: this._onDragStart,
-  			predrag: this._onPreDrag,
-  			drag: this._onDrag,
-  			dragend: this._onDragEnd
-  		}, this).enable();
-
-  		addClass(icon, 'leaflet-marker-draggable');
-  	},
-
-  	removeHooks: function () {
-  		this._draggable.off({
-  			dragstart: this._onDragStart,
-  			predrag: this._onPreDrag,
-  			drag: this._onDrag,
-  			dragend: this._onDragEnd
-  		}, this).disable();
-
-  		if (this._marker._icon) {
-  			removeClass(this._marker._icon, 'leaflet-marker-draggable');
-  		}
-  	},
-
-  	moved: function () {
-  		return this._draggable && this._draggable._moved;
-  	},
-
-  	_adjustPan: function (e) {
-  		var marker = this._marker,
-  		    map = marker._map,
-  		    speed = this._marker.options.autoPanSpeed,
-  		    padding = this._marker.options.autoPanPadding,
-  		    iconPos = getPosition(marker._icon),
-  		    bounds = map.getPixelBounds(),
-  		    origin = map.getPixelOrigin();
-
-  		var panBounds = toBounds(
-  			bounds.min._subtract(origin).add(padding),
-  			bounds.max._subtract(origin).subtract(padding)
-  		);
-
-  		if (!panBounds.contains(iconPos)) {
-  			// Compute incremental movement
-  			var movement = toPoint(
-  				(Math.max(panBounds.max.x, iconPos.x) - panBounds.max.x) / (bounds.max.x - panBounds.max.x) -
-  				(Math.min(panBounds.min.x, iconPos.x) - panBounds.min.x) / (bounds.min.x - panBounds.min.x),
-
-  				(Math.max(panBounds.max.y, iconPos.y) - panBounds.max.y) / (bounds.max.y - panBounds.max.y) -
-  				(Math.min(panBounds.min.y, iconPos.y) - panBounds.min.y) / (bounds.min.y - panBounds.min.y)
-  			).multiplyBy(speed);
-
-  			map.panBy(movement, {animate: false});
-
-  			this._draggable._newPos._add(movement);
-  			this._draggable._startPos._add(movement);
-
-  			setPosition(marker._icon, this._draggable._newPos);
-  			this._onDrag(e);
-
-  			this._panRequest = requestAnimFrame(this._adjustPan.bind(this, e));
-  		}
-  	},
-
-  	_onDragStart: function () {
-  		// @section Dragging events
-  		// @event dragstart: Event
-  		// Fired when the user starts dragging the marker.
-
-  		// @event movestart: Event
-  		// Fired when the marker starts moving (because of dragging).
-
-  		this._oldLatLng = this._marker.getLatLng();
-
-  		// When using ES6 imports it could not be set when `Popup` was not imported as well
-  		this._marker.closePopup && this._marker.closePopup();
-
-  		this._marker
-  			.fire('movestart')
-  			.fire('dragstart');
-  	},
-
-  	_onPreDrag: function (e) {
-  		if (this._marker.options.autoPan) {
-  			cancelAnimFrame(this._panRequest);
-  			this._panRequest = requestAnimFrame(this._adjustPan.bind(this, e));
-  		}
-  	},
-
-  	_onDrag: function (e) {
-  		var marker = this._marker,
-  		    shadow = marker._shadow,
-  		    iconPos = getPosition(marker._icon),
-  		    latlng = marker._map.layerPointToLatLng(iconPos);
-
-  		// update shadow position
-  		if (shadow) {
-  			setPosition(shadow, iconPos);
-  		}
-
-  		marker._latlng = latlng;
-  		e.latlng = latlng;
-  		e.oldLatLng = this._oldLatLng;
-
-  		// @event drag: Event
-  		// Fired repeatedly while the user drags the marker.
-  		marker
-  		    .fire('move', e)
-  		    .fire('drag', e);
-  	},
-
-  	_onDragEnd: function (e) {
-  		// @event dragend: DragEndEvent
-  		// Fired when the user stops dragging the marker.
-
-  		 cancelAnimFrame(this._panRequest);
-
-  		// @event moveend: Event
-  		// Fired when the marker stops moving (because of dragging).
-  		delete this._oldLatLng;
-  		this._marker
-  		    .fire('moveend')
-  		    .fire('dragend', e);
-  	}
-  });
-
-  /*
-   * @class Marker
-   * @inherits Interactive layer
-   * @aka L.Marker
-   * L.Marker is used to display clickable/draggable icons on the map. Extends `Layer`.
-   *
-   * @example
-   *
-   * ```js
-   * L.marker([50.5, 30.5]).addTo(map);
-   * ```
-   */
-
-  var Marker = Layer.extend({
-
-  	// @section
-  	// @aka Marker options
-  	options: {
-  		// @option icon: Icon = *
-  		// Icon instance to use for rendering the marker.
-  		// See [Icon documentation](#L.Icon) for details on how to customize the marker icon.
-  		// If not specified, a common instance of `L.Icon.Default` is used.
-  		icon: new IconDefault(),
-
-  		// Option inherited from "Interactive layer" abstract class
-  		interactive: true,
-
-  		// @option keyboard: Boolean = true
-  		// Whether the marker can be tabbed to with a keyboard and clicked by pressing enter.
-  		keyboard: true,
-
-  		// @option title: String = ''
-  		// Text for the browser tooltip that appear on marker hover (no tooltip by default).
-  		title: '',
-
-  		// @option alt: String = ''
-  		// Text for the `alt` attribute of the icon image (useful for accessibility).
-  		alt: '',
-
-  		// @option zIndexOffset: Number = 0
-  		// By default, marker images zIndex is set automatically based on its latitude. Use this option if you want to put the marker on top of all others (or below), specifying a high value like `1000` (or high negative value, respectively).
-  		zIndexOffset: 0,
-
-  		// @option opacity: Number = 1.0
-  		// The opacity of the marker.
-  		opacity: 1,
-
-  		// @option riseOnHover: Boolean = false
-  		// If `true`, the marker will get on top of others when you hover the mouse over it.
-  		riseOnHover: false,
-
-  		// @option riseOffset: Number = 250
-  		// The z-index offset used for the `riseOnHover` feature.
-  		riseOffset: 250,
-
-  		// @option pane: String = 'markerPane'
-  		// `Map pane` where the markers icon will be added.
-  		pane: 'markerPane',
-
-  		// @option shadowPane: String = 'shadowPane'
-  		// `Map pane` where the markers shadow will be added.
-  		shadowPane: 'shadowPane',
-
-  		// @option bubblingMouseEvents: Boolean = false
-  		// When `true`, a mouse event on this marker will trigger the same event on the map
-  		// (unless [`L.DomEvent.stopPropagation`](#domevent-stoppropagation) is used).
-  		bubblingMouseEvents: false,
-
-  		// @section Draggable marker options
-  		// @option draggable: Boolean = false
-  		// Whether the marker is draggable with mouse/touch or not.
-  		draggable: false,
-
-  		// @option autoPan: Boolean = false
-  		// Whether to pan the map when dragging this marker near its edge or not.
-  		autoPan: false,
-
-  		// @option autoPanPadding: Point = Point(50, 50)
-  		// Distance (in pixels to the left/right and to the top/bottom) of the
-  		// map edge to start panning the map.
-  		autoPanPadding: [50, 50],
-
-  		// @option autoPanSpeed: Number = 10
-  		// Number of pixels the map should pan by.
-  		autoPanSpeed: 10
-  	},
-
-  	/* @section
-  	 *
-  	 * In addition to [shared layer methods](#Layer) like `addTo()` and `remove()` and [popup methods](#Popup) like bindPopup() you can also use the following methods:
-  	 */
-
-  	initialize: function (latlng, options) {
-  		setOptions(this, options);
-  		this._latlng = toLatLng(latlng);
-  	},
-
-  	onAdd: function (map) {
-  		this._zoomAnimated = this._zoomAnimated && map.options.markerZoomAnimation;
-
-  		if (this._zoomAnimated) {
-  			map.on('zoomanim', this._animateZoom, this);
-  		}
-
-  		this._initIcon();
-  		this.update();
-  	},
-
-  	onRemove: function (map) {
-  		if (this.dragging && this.dragging.enabled()) {
-  			this.options.draggable = true;
-  			this.dragging.removeHooks();
-  		}
-  		delete this.dragging;
-
-  		if (this._zoomAnimated) {
-  			map.off('zoomanim', this._animateZoom, this);
-  		}
-
-  		this._removeIcon();
-  		this._removeShadow();
-  	},
-
-  	getEvents: function () {
-  		return {
-  			zoom: this.update,
-  			viewreset: this.update
-  		};
-  	},
-
-  	// @method getLatLng: LatLng
-  	// Returns the current geographical position of the marker.
-  	getLatLng: function () {
-  		return this._latlng;
-  	},
-
-  	// @method setLatLng(latlng: LatLng): this
-  	// Changes the marker position to the given point.
-  	setLatLng: function (latlng) {
-  		var oldLatLng = this._latlng;
-  		this._latlng = toLatLng(latlng);
-  		this.update();
-
-  		// @event move: Event
-  		// Fired when the marker is moved via [`setLatLng`](#marker-setlatlng) or by [dragging](#marker-dragging). Old and new coordinates are included in event arguments as `oldLatLng`, `latlng`.
-  		return this.fire('move', {oldLatLng: oldLatLng, latlng: this._latlng});
-  	},
-
-  	// @method setZIndexOffset(offset: Number): this
-  	// Changes the [zIndex offset](#marker-zindexoffset) of the marker.
-  	setZIndexOffset: function (offset) {
-  		this.options.zIndexOffset = offset;
-  		return this.update();
-  	},
-
-  	// @method getIcon: Icon
-  	// Returns the current icon used by the marker
-  	getIcon: function () {
-  		return this.options.icon;
-  	},
-
-  	// @method setIcon(icon: Icon): this
-  	// Changes the marker icon.
-  	setIcon: function (icon) {
-
-  		this.options.icon = icon;
-
-  		if (this._map) {
-  			this._initIcon();
-  			this.update();
-  		}
-
-  		if (this._popup) {
-  			this.bindPopup(this._popup, this._popup.options);
-  		}
-
-  		return this;
-  	},
-
-  	getElement: function () {
-  		return this._icon;
-  	},
-
-  	update: function () {
-
-  		if (this._icon && this._map) {
-  			var pos = this._map.latLngToLayerPoint(this._latlng).round();
-  			this._setPos(pos);
-  		}
-
-  		return this;
-  	},
-
-  	_initIcon: function () {
-  		var options = this.options,
-  		    classToAdd = 'leaflet-zoom-' + (this._zoomAnimated ? 'animated' : 'hide');
-
-  		var icon = options.icon.createIcon(this._icon),
-  		    addIcon = false;
-
-  		// if we're not reusing the icon, remove the old one and init new one
-  		if (icon !== this._icon) {
-  			if (this._icon) {
-  				this._removeIcon();
-  			}
-  			addIcon = true;
-
-  			if (options.title) {
-  				icon.title = options.title;
-  			}
-
-  			if (icon.tagName === 'IMG') {
-  				icon.alt = options.alt || '';
-  			}
-  		}
-
-  		addClass(icon, classToAdd);
-
-  		if (options.keyboard) {
-  			icon.tabIndex = '0';
-  		}
-
-  		this._icon = icon;
-
-  		if (options.riseOnHover) {
-  			this.on({
-  				mouseover: this._bringToFront,
-  				mouseout: this._resetZIndex
-  			});
-  		}
-
-  		var newShadow = options.icon.createShadow(this._shadow),
-  		    addShadow = false;
-
-  		if (newShadow !== this._shadow) {
-  			this._removeShadow();
-  			addShadow = true;
-  		}
-
-  		if (newShadow) {
-  			addClass(newShadow, classToAdd);
-  			newShadow.alt = '';
-  		}
-  		this._shadow = newShadow;
-
-
-  		if (options.opacity < 1) {
-  			this._updateOpacity();
-  		}
-
-
-  		if (addIcon) {
-  			this.getPane().appendChild(this._icon);
-  		}
-  		this._initInteraction();
-  		if (newShadow && addShadow) {
-  			this.getPane(options.shadowPane).appendChild(this._shadow);
-  		}
-  	},
-
-  	_removeIcon: function () {
-  		if (this.options.riseOnHover) {
-  			this.off({
-  				mouseover: this._bringToFront,
-  				mouseout: this._resetZIndex
-  			});
-  		}
-
-  		remove(this._icon);
-  		this.removeInteractiveTarget(this._icon);
-
-  		this._icon = null;
-  	},
-
-  	_removeShadow: function () {
-  		if (this._shadow) {
-  			remove(this._shadow);
-  		}
-  		this._shadow = null;
-  	},
-
-  	_setPos: function (pos) {
-
-  		if (this._icon) {
-  			setPosition(this._icon, pos);
-  		}
-
-  		if (this._shadow) {
-  			setPosition(this._shadow, pos);
-  		}
-
-  		this._zIndex = pos.y + this.options.zIndexOffset;
-
-  		this._resetZIndex();
-  	},
-
-  	_updateZIndex: function (offset) {
-  		if (this._icon) {
-  			this._icon.style.zIndex = this._zIndex + offset;
-  		}
-  	},
-
-  	_animateZoom: function (opt) {
-  		var pos = this._map._latLngToNewLayerPoint(this._latlng, opt.zoom, opt.center).round();
-
-  		this._setPos(pos);
-  	},
-
-  	_initInteraction: function () {
-
-  		if (!this.options.interactive) { return; }
-
-  		addClass(this._icon, 'leaflet-interactive');
-
-  		this.addInteractiveTarget(this._icon);
-
-  		if (MarkerDrag) {
-  			var draggable = this.options.draggable;
-  			if (this.dragging) {
-  				draggable = this.dragging.enabled();
-  				this.dragging.disable();
-  			}
-
-  			this.dragging = new MarkerDrag(this);
-
-  			if (draggable) {
-  				this.dragging.enable();
-  			}
-  		}
-  	},
-
-  	// @method setOpacity(opacity: Number): this
-  	// Changes the opacity of the marker.
-  	setOpacity: function (opacity) {
-  		this.options.opacity = opacity;
-  		if (this._map) {
-  			this._updateOpacity();
-  		}
-
-  		return this;
-  	},
-
-  	_updateOpacity: function () {
-  		var opacity = this.options.opacity;
-
-  		if (this._icon) {
-  			setOpacity(this._icon, opacity);
-  		}
-
-  		if (this._shadow) {
-  			setOpacity(this._shadow, opacity);
-  		}
-  	},
-
-  	_bringToFront: function () {
-  		this._updateZIndex(this.options.riseOffset);
-  	},
-
-  	_resetZIndex: function () {
-  		this._updateZIndex(0);
-  	},
-
-  	_getPopupAnchor: function () {
-  		return this.options.icon.options.popupAnchor;
-  	},
-
-  	_getTooltipAnchor: function () {
-  		return this.options.icon.options.tooltipAnchor;
-  	}
-  });
-
-
-  // factory L.marker(latlng: LatLng, options? : Marker options)
-
-  // @factory L.marker(latlng: LatLng, options? : Marker options)
-  // Instantiates a Marker object given a geographical point and optionally an options object.
-  function marker(latlng, options) {
-  	return new Marker(latlng, options);
-  }
-
-  /*
-   * @class Path
-   * @aka L.Path
-   * @inherits Interactive layer
-   *
-   * An abstract class that contains options and constants shared between vector
-   * overlays (Polygon, Polyline, Circle). Do not use it directly. Extends `Layer`.
-   */
-
-  var Path = Layer.extend({
-
-  	// @section
-  	// @aka Path options
-  	options: {
-  		// @option stroke: Boolean = true
-  		// Whether to draw stroke along the path. Set it to `false` to disable borders on polygons or circles.
-  		stroke: true,
-
-  		// @option color: String = '#3388ff'
-  		// Stroke color
-  		color: '#3388ff',
-
-  		// @option weight: Number = 3
-  		// Stroke width in pixels
-  		weight: 3,
-
-  		// @option opacity: Number = 1.0
-  		// Stroke opacity
-  		opacity: 1,
-
-  		// @option lineCap: String= 'round'
-  		// A string that defines [shape to be used at the end](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-linecap) of the stroke.
-  		lineCap: 'round',
-
-  		// @option lineJoin: String = 'round'
-  		// A string that defines [shape to be used at the corners](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-linejoin) of the stroke.
-  		lineJoin: 'round',
-
-  		// @option dashArray: String = null
-  		// A string that defines the stroke [dash pattern](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-dasharray). Doesn't work on `Canvas`-powered layers in [some old browsers](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/setLineDash#Browser_compatibility).
-  		dashArray: null,
-
-  		// @option dashOffset: String = null
-  		// A string that defines the [distance into the dash pattern to start the dash](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-dashoffset). Doesn't work on `Canvas`-powered layers in [some old browsers](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/setLineDash#Browser_compatibility).
-  		dashOffset: null,
-
-  		// @option fill: Boolean = depends
-  		// Whether to fill the path with color. Set it to `false` to disable filling on polygons or circles.
-  		fill: false,
-
-  		// @option fillColor: String = *
-  		// Fill color. Defaults to the value of the [`color`](#path-color) option
-  		fillColor: null,
-
-  		// @option fillOpacity: Number = 0.2
-  		// Fill opacity.
-  		fillOpacity: 0.2,
-
-  		// @option fillRule: String = 'evenodd'
-  		// A string that defines [how the inside of a shape](https://developer.mozilla.org/docs/Web/SVG/Attribute/fill-rule) is determined.
-  		fillRule: 'evenodd',
-
-  		// className: '',
-
-  		// Option inherited from "Interactive layer" abstract class
-  		interactive: true,
-
-  		// @option bubblingMouseEvents: Boolean = true
-  		// When `true`, a mouse event on this path will trigger the same event on the map
-  		// (unless [`L.DomEvent.stopPropagation`](#domevent-stoppropagation) is used).
-  		bubblingMouseEvents: true
-  	},
-
-  	beforeAdd: function (map) {
-  		// Renderer is set here because we need to call renderer.getEvents
-  		// before this.getEvents.
-  		this._renderer = map.getRenderer(this);
-  	},
-
-  	onAdd: function () {
-  		this._renderer._initPath(this);
-  		this._reset();
-  		this._renderer._addPath(this);
-  	},
-
-  	onRemove: function () {
-  		this._renderer._removePath(this);
-  	},
-
-  	// @method redraw(): this
-  	// Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
-  	redraw: function () {
-  		if (this._map) {
-  			this._renderer._updatePath(this);
-  		}
-  		return this;
-  	},
-
-  	// @method setStyle(style: Path options): this
-  	// Changes the appearance of a Path based on the options in the `Path options` object.
-  	setStyle: function (style) {
-  		setOptions(this, style);
-  		if (this._renderer) {
-  			this._renderer._updateStyle(this);
-  			if (this.options.stroke && style && Object.prototype.hasOwnProperty.call(style, 'weight')) {
-  				this._updateBounds();
-  			}
-  		}
-  		return this;
-  	},
-
-  	// @method bringToFront(): this
-  	// Brings the layer to the top of all path layers.
-  	bringToFront: function () {
-  		if (this._renderer) {
-  			this._renderer._bringToFront(this);
-  		}
-  		return this;
-  	},
-
-  	// @method bringToBack(): this
-  	// Brings the layer to the bottom of all path layers.
-  	bringToBack: function () {
-  		if (this._renderer) {
-  			this._renderer._bringToBack(this);
-  		}
-  		return this;
-  	},
-
-  	getElement: function () {
-  		return this._path;
-  	},
-
-  	_reset: function () {
-  		// defined in child classes
-  		this._project();
-  		this._update();
-  	},
-
-  	_clickTolerance: function () {
-  		// used when doing hit detection for Canvas layers
-  		return (this.options.stroke ? this.options.weight / 2 : 0) + this._renderer.options.tolerance;
-  	}
-  });
-
-  /*
-   * @class CircleMarker
-   * @aka L.CircleMarker
-   * @inherits Path
-   *
-   * A circle of a fixed size with radius specified in pixels. Extends `Path`.
-   */
-
-  var CircleMarker = Path.extend({
-
-  	// @section
-  	// @aka CircleMarker options
-  	options: {
-  		fill: true,
-
-  		// @option radius: Number = 10
-  		// Radius of the circle marker, in pixels
-  		radius: 10
-  	},
-
-  	initialize: function (latlng, options) {
-  		setOptions(this, options);
-  		this._latlng = toLatLng(latlng);
-  		this._radius = this.options.radius;
-  	},
-
-  	// @method setLatLng(latLng: LatLng): this
-  	// Sets the position of a circle marker to a new location.
-  	setLatLng: function (latlng) {
-  		var oldLatLng = this._latlng;
-  		this._latlng = toLatLng(latlng);
-  		this.redraw();
-
-  		// @event move: Event
-  		// Fired when the marker is moved via [`setLatLng`](#circlemarker-setlatlng). Old and new coordinates are included in event arguments as `oldLatLng`, `latlng`.
-  		return this.fire('move', {oldLatLng: oldLatLng, latlng: this._latlng});
-  	},
-
-  	// @method getLatLng(): LatLng
-  	// Returns the current geographical position of the circle marker
-  	getLatLng: function () {
-  		return this._latlng;
-  	},
-
-  	// @method setRadius(radius: Number): this
-  	// Sets the radius of a circle marker. Units are in pixels.
-  	setRadius: function (radius) {
-  		this.options.radius = this._radius = radius;
-  		return this.redraw();
-  	},
-
-  	// @method getRadius(): Number
-  	// Returns the current radius of the circle
-  	getRadius: function () {
-  		return this._radius;
-  	},
-
-  	setStyle : function (options) {
-  		var radius = options && options.radius || this._radius;
-  		Path.prototype.setStyle.call(this, options);
-  		this.setRadius(radius);
-  		return this;
-  	},
-
-  	_project: function () {
-  		this._point = this._map.latLngToLayerPoint(this._latlng);
-  		this._updateBounds();
-  	},
-
-  	_updateBounds: function () {
-  		var r = this._radius,
-  		    r2 = this._radiusY || r,
-  		    w = this._clickTolerance(),
-  		    p = [r + w, r2 + w];
-  		this._pxBounds = new Bounds(this._point.subtract(p), this._point.add(p));
-  	},
-
-  	_update: function () {
-  		if (this._map) {
-  			this._updatePath();
-  		}
-  	},
-
-  	_updatePath: function () {
-  		this._renderer._updateCircle(this);
-  	},
-
-  	_empty: function () {
-  		return this._radius && !this._renderer._bounds.intersects(this._pxBounds);
-  	},
-
-  	// Needed by the `Canvas` renderer for interactivity
-  	_containsPoint: function (p) {
-  		return p.distanceTo(this._point) <= this._radius + this._clickTolerance();
-  	}
-  });
-
-
-  // @factory L.circleMarker(latlng: LatLng, options?: CircleMarker options)
-  // Instantiates a circle marker object given a geographical point, and an optional options object.
-  function circleMarker(latlng, options) {
-  	return new CircleMarker(latlng, options);
-  }
-
-  /*
-   * @class Circle
-   * @aka L.Circle
-   * @inherits CircleMarker
-   *
-   * A class for drawing circle overlays on a map. Extends `CircleMarker`.
-   *
-   * It's an approximation and starts to diverge from a real circle closer to poles (due to projection distortion).
-   *
-   * @example
-   *
-   * ```js
-   * L.circle([50.5, 30.5], {radius: 200}).addTo(map);
-   * ```
-   */
-
-  var Circle = CircleMarker.extend({
-
-  	initialize: function (latlng, options, legacyOptions) {
-  		if (typeof options === 'number') {
-  			// Backwards compatibility with 0.7.x factory (latlng, radius, options?)
-  			options = extend({}, legacyOptions, {radius: options});
-  		}
-  		setOptions(this, options);
-  		this._latlng = toLatLng(latlng);
-
-  		if (isNaN(this.options.radius)) { throw new Error('Circle radius cannot be NaN'); }
-
-  		// @section
-  		// @aka Circle options
-  		// @option radius: Number; Radius of the circle, in meters.
-  		this._mRadius = this.options.radius;
-  	},
-
-  	// @method setRadius(radius: Number): this
-  	// Sets the radius of a circle. Units are in meters.
-  	setRadius: function (radius) {
-  		this._mRadius = radius;
-  		return this.redraw();
-  	},
-
-  	// @method getRadius(): Number
-  	// Returns the current radius of a circle. Units are in meters.
-  	getRadius: function () {
-  		return this._mRadius;
-  	},
-
-  	// @method getBounds(): LatLngBounds
-  	// Returns the `LatLngBounds` of the path.
-  	getBounds: function () {
-  		var half = [this._radius, this._radiusY || this._radius];
-
-  		return new LatLngBounds(
-  			this._map.layerPointToLatLng(this._point.subtract(half)),
-  			this._map.layerPointToLatLng(this._point.add(half)));
-  	},
-
-  	setStyle: Path.prototype.setStyle,
-
-  	_project: function () {
-
-  		var lng = this._latlng.lng,
-  		    lat = this._latlng.lat,
-  		    map = this._map,
-  		    crs = map.options.crs;
-
-  		if (crs.distance === Earth.distance) {
-  			var d = Math.PI / 180,
-  			    latR = (this._mRadius / Earth.R) / d,
-  			    top = map.project([lat + latR, lng]),
-  			    bottom = map.project([lat - latR, lng]),
-  			    p = top.add(bottom).divideBy(2),
-  			    lat2 = map.unproject(p).lat,
-  			    lngR = Math.acos((Math.cos(latR * d) - Math.sin(lat * d) * Math.sin(lat2 * d)) /
-  			            (Math.cos(lat * d) * Math.cos(lat2 * d))) / d;
-
-  			if (isNaN(lngR) || lngR === 0) {
-  				lngR = latR / Math.cos(Math.PI / 180 * lat); // Fallback for edge case, #2425
-  			}
-
-  			this._point = p.subtract(map.getPixelOrigin());
-  			this._radius = isNaN(lngR) ? 0 : p.x - map.project([lat2, lng - lngR]).x;
-  			this._radiusY = p.y - top.y;
-
-  		} else {
-  			var latlng2 = crs.unproject(crs.project(this._latlng).subtract([this._mRadius, 0]));
-
-  			this._point = map.latLngToLayerPoint(this._latlng);
-  			this._radius = this._point.x - map.latLngToLayerPoint(latlng2).x;
-  		}
-
-  		this._updateBounds();
-  	}
-  });
-
-  // @factory L.circle(latlng: LatLng, options?: Circle options)
-  // Instantiates a circle object given a geographical point, and an options object
-  // which contains the circle radius.
-  // @alternative
-  // @factory L.circle(latlng: LatLng, radius: Number, options?: Circle options)
-  // Obsolete way of instantiating a circle, for compatibility with 0.7.x code.
-  // Do not use in new applications or plugins.
-  function circle(latlng, options, legacyOptions) {
-  	return new Circle(latlng, options, legacyOptions);
-  }
-
-  /*
-   * @class Polyline
-   * @aka L.Polyline
-   * @inherits Path
-   *
-   * A class for drawing polyline overlays on a map. Extends `Path`.
-   *
-   * @example
-   *
-   * ```js
-   * // create a red polyline from an array of LatLng points
-   * var latlngs = [
-   * 	[45.51, -122.68],
-   * 	[37.77, -122.43],
-   * 	[34.04, -118.2]
-   * ];
-   *
-   * var polyline = L.polyline(latlngs, {color: 'red'}).addTo(map);
-   *
-   * // zoom the map to the polyline
-   * map.fitBounds(polyline.getBounds());
-   * ```
-   *
-   * You can also pass a multi-dimensional array to represent a `MultiPolyline` shape:
-   *
-   * ```js
-   * // create a red polyline from an array of arrays of LatLng points
-   * var latlngs = [
-   * 	[[45.51, -122.68],
-   * 	 [37.77, -122.43],
-   * 	 [34.04, -118.2]],
-   * 	[[40.78, -73.91],
-   * 	 [41.83, -87.62],
-   * 	 [32.76, -96.72]]
-   * ];
-   * ```
-   */
-
-
-  var Polyline = Path.extend({
-
-  	// @section
-  	// @aka Polyline options
-  	options: {
-  		// @option smoothFactor: Number = 1.0
-  		// How much to simplify the polyline on each zoom level. More means
-  		// better performance and smoother look, and less means more accurate representation.
-  		smoothFactor: 1.0,
-
-  		// @option noClip: Boolean = false
-  		// Disable polyline clipping.
-  		noClip: false
-  	},
-
-  	initialize: function (latlngs, options) {
-  		setOptions(this, options);
-  		this._setLatLngs(latlngs);
-  	},
-
-  	// @method getLatLngs(): LatLng[]
-  	// Returns an array of the points in the path, or nested arrays of points in case of multi-polyline.
-  	getLatLngs: function () {
-  		return this._latlngs;
-  	},
-
-  	// @method setLatLngs(latlngs: LatLng[]): this
-  	// Replaces all the points in the polyline with the given array of geographical points.
-  	setLatLngs: function (latlngs) {
-  		this._setLatLngs(latlngs);
-  		return this.redraw();
-  	},
-
-  	// @method isEmpty(): Boolean
-  	// Returns `true` if the Polyline has no LatLngs.
-  	isEmpty: function () {
-  		return !this._latlngs.length;
-  	},
-
-  	// @method closestLayerPoint(p: Point): Point
-  	// Returns the point closest to `p` on the Polyline.
-  	closestLayerPoint: function (p) {
-  		var minDistance = Infinity,
-  		    minPoint = null,
-  		    closest = _sqClosestPointOnSegment,
-  		    p1, p2;
-
-  		for (var j = 0, jLen = this._parts.length; j < jLen; j++) {
-  			var points = this._parts[j];
-
-  			for (var i = 1, len = points.length; i < len; i++) {
-  				p1 = points[i - 1];
-  				p2 = points[i];
-
-  				var sqDist = closest(p, p1, p2, true);
-
-  				if (sqDist < minDistance) {
-  					minDistance = sqDist;
-  					minPoint = closest(p, p1, p2);
-  				}
-  			}
-  		}
-  		if (minPoint) {
-  			minPoint.distance = Math.sqrt(minDistance);
-  		}
-  		return minPoint;
-  	},
-
-  	// @method getCenter(): LatLng
-  	// Returns the center ([centroid](http://en.wikipedia.org/wiki/Centroid)) of the polyline.
-  	getCenter: function () {
-  		// throws error when not yet added to map as this center calculation requires projected coordinates
-  		if (!this._map) {
-  			throw new Error('Must add layer to map before using getCenter()');
-  		}
-
-  		var i, halfDist, segDist, dist, p1, p2, ratio,
-  		    points = this._rings[0],
-  		    len = points.length;
-
-  		if (!len) { return null; }
-
-  		// polyline centroid algorithm; only uses the first ring if there are multiple
-
-  		for (i = 0, halfDist = 0; i < len - 1; i++) {
-  			halfDist += points[i].distanceTo(points[i + 1]) / 2;
-  		}
-
-  		// The line is so small in the current view that all points are on the same pixel.
-  		if (halfDist === 0) {
-  			return this._map.layerPointToLatLng(points[0]);
-  		}
-
-  		for (i = 0, dist = 0; i < len - 1; i++) {
-  			p1 = points[i];
-  			p2 = points[i + 1];
-  			segDist = p1.distanceTo(p2);
-  			dist += segDist;
-
-  			if (dist > halfDist) {
-  				ratio = (dist - halfDist) / segDist;
-  				return this._map.layerPointToLatLng([
-  					p2.x - ratio * (p2.x - p1.x),
-  					p2.y - ratio * (p2.y - p1.y)
-  				]);
-  			}
-  		}
-  	},
-
-  	// @method getBounds(): LatLngBounds
-  	// Returns the `LatLngBounds` of the path.
-  	getBounds: function () {
-  		return this._bounds;
-  	},
-
-  	// @method addLatLng(latlng: LatLng, latlngs?: LatLng[]): this
-  	// Adds a given point to the polyline. By default, adds to the first ring of
-  	// the polyline in case of a multi-polyline, but can be overridden by passing
-  	// a specific ring as a LatLng array (that you can earlier access with [`getLatLngs`](#polyline-getlatlngs)).
-  	addLatLng: function (latlng, latlngs) {
-  		latlngs = latlngs || this._defaultShape();
-  		latlng = toLatLng(latlng);
-  		latlngs.push(latlng);
-  		this._bounds.extend(latlng);
-  		return this.redraw();
-  	},
-
-  	_setLatLngs: function (latlngs) {
-  		this._bounds = new LatLngBounds();
-  		this._latlngs = this._convertLatLngs(latlngs);
-  	},
-
-  	_defaultShape: function () {
-  		return isFlat(this._latlngs) ? this._latlngs : this._latlngs[0];
-  	},
-
-  	// recursively convert latlngs input into actual LatLng instances; calculate bounds along the way
-  	_convertLatLngs: function (latlngs) {
-  		var result = [],
-  		    flat = isFlat(latlngs);
-
-  		for (var i = 0, len = latlngs.length; i < len; i++) {
-  			if (flat) {
-  				result[i] = toLatLng(latlngs[i]);
-  				this._bounds.extend(result[i]);
-  			} else {
-  				result[i] = this._convertLatLngs(latlngs[i]);
-  			}
-  		}
-
-  		return result;
-  	},
-
-  	_project: function () {
-  		var pxBounds = new Bounds();
-  		this._rings = [];
-  		this._projectLatlngs(this._latlngs, this._rings, pxBounds);
-
-  		if (this._bounds.isValid() && pxBounds.isValid()) {
-  			this._rawPxBounds = pxBounds;
-  			this._updateBounds();
-  		}
-  	},
-
-  	_updateBounds: function () {
-  		var w = this._clickTolerance(),
-  		    p = new Point(w, w);
-  		this._pxBounds = new Bounds([
-  			this._rawPxBounds.min.subtract(p),
-  			this._rawPxBounds.max.add(p)
-  		]);
-  	},
-
-  	// recursively turns latlngs into a set of rings with projected coordinates
-  	_projectLatlngs: function (latlngs, result, projectedBounds) {
-  		var flat = latlngs[0] instanceof LatLng,
-  		    len = latlngs.length,
-  		    i, ring;
-
-  		if (flat) {
-  			ring = [];
-  			for (i = 0; i < len; i++) {
-  				ring[i] = this._map.latLngToLayerPoint(latlngs[i]);
-  				projectedBounds.extend(ring[i]);
-  			}
-  			result.push(ring);
-  		} else {
-  			for (i = 0; i < len; i++) {
-  				this._projectLatlngs(latlngs[i], result, projectedBounds);
-  			}
-  		}
-  	},
-
-  	// clip polyline by renderer bounds so that we have less to render for performance
-  	_clipPoints: function () {
-  		var bounds = this._renderer._bounds;
-
-  		this._parts = [];
-  		if (!this._pxBounds || !this._pxBounds.intersects(bounds)) {
-  			return;
-  		}
-
-  		if (this.options.noClip) {
-  			this._parts = this._rings;
-  			return;
-  		}
-
-  		var parts = this._parts,
-  		    i, j, k, len, len2, segment, points;
-
-  		for (i = 0, k = 0, len = this._rings.length; i < len; i++) {
-  			points = this._rings[i];
-
-  			for (j = 0, len2 = points.length; j < len2 - 1; j++) {
-  				segment = clipSegment(points[j], points[j + 1], bounds, j, true);
-
-  				if (!segment) { continue; }
-
-  				parts[k] = parts[k] || [];
-  				parts[k].push(segment[0]);
-
-  				// if segment goes out of screen, or it's the last one, it's the end of the line part
-  				if ((segment[1] !== points[j + 1]) || (j === len2 - 2)) {
-  					parts[k].push(segment[1]);
-  					k++;
-  				}
-  			}
-  		}
-  	},
-
-  	// simplify each clipped part of the polyline for performance
-  	_simplifyPoints: function () {
-  		var parts = this._parts,
-  		    tolerance = this.options.smoothFactor;
-
-  		for (var i = 0, len = parts.length; i < len; i++) {
-  			parts[i] = simplify(parts[i], tolerance);
-  		}
-  	},
-
-  	_update: function () {
-  		if (!this._map) { return; }
-
-  		this._clipPoints();
-  		this._simplifyPoints();
-  		this._updatePath();
-  	},
-
-  	_updatePath: function () {
-  		this._renderer._updatePoly(this);
-  	},
-
-  	// Needed by the `Canvas` renderer for interactivity
-  	_containsPoint: function (p, closed) {
-  		var i, j, k, len, len2, part,
-  		    w = this._clickTolerance();
-
-  		if (!this._pxBounds || !this._pxBounds.contains(p)) { return false; }
-
-  		// hit detection for polylines
-  		for (i = 0, len = this._parts.length; i < len; i++) {
-  			part = this._parts[i];
-
-  			for (j = 0, len2 = part.length, k = len2 - 1; j < len2; k = j++) {
-  				if (!closed && (j === 0)) { continue; }
-
-  				if (pointToSegmentDistance(p, part[k], part[j]) <= w) {
-  					return true;
-  				}
-  			}
-  		}
-  		return false;
-  	}
-  });
-
-  // @factory L.polyline(latlngs: LatLng[], options?: Polyline options)
-  // Instantiates a polyline object given an array of geographical points and
-  // optionally an options object. You can create a `Polyline` object with
-  // multiple separate lines (`MultiPolyline`) by passing an array of arrays
-  // of geographic points.
-  function polyline(latlngs, options) {
-  	return new Polyline(latlngs, options);
-  }
-
-  // Retrocompat. Allow plugins to support Leaflet versions before and after 1.1.
-  Polyline._flat = _flat;
-
-  /*
-   * @class Polygon
-   * @aka L.Polygon
-   * @inherits Polyline
-   *
-   * A class for drawing polygon overlays on a map. Extends `Polyline`.
-   *
-   * Note that points you pass when creating a polygon shouldn't have an additional last point equal to the first one — it's better to filter out such points.
-   *
-   *
-   * @example
-   *
-   * ```js
-   * // create a red polygon from an array of LatLng points
-   * var latlngs = [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]];
-   *
-   * var polygon = L.polygon(latlngs, {color: 'red'}).addTo(map);
-   *
-   * // zoom the map to the polygon
-   * map.fitBounds(polygon.getBounds());
-   * ```
-   *
-   * You can also pass an array of arrays of latlngs, with the first array representing the outer shape and the other arrays representing holes in the outer shape:
-   *
-   * ```js
-   * var latlngs = [
-   *   [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring
-   *   [[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole
-   * ];
-   * ```
-   *
-   * Additionally, you can pass a multi-dimensional array to represent a MultiPolygon shape.
-   *
-   * ```js
-   * var latlngs = [
-   *   [ // first polygon
-   *     [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring
-   *     [[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole
-   *   ],
-   *   [ // second polygon
-   *     [[41, -111.03],[45, -111.04],[45, -104.05],[41, -104.05]]
-   *   ]
-   * ];
-   * ```
-   */
-
-  var Polygon = Polyline.extend({
-
-  	options: {
-  		fill: true
-  	},
-
-  	isEmpty: function () {
-  		return !this._latlngs.length || !this._latlngs[0].length;
-  	},
-
-  	getCenter: function () {
-  		// throws error when not yet added to map as this center calculation requires projected coordinates
-  		if (!this._map) {
-  			throw new Error('Must add layer to map before using getCenter()');
-  		}
-
-  		var i, j, p1, p2, f, area, x, y, center,
-  		    points = this._rings[0],
-  		    len = points.length;
-
-  		if (!len) { return null; }
-
-  		// polygon centroid algorithm; only uses the first ring if there are multiple
-
-  		area = x = y = 0;
-
-  		for (i = 0, j = len - 1; i < len; j = i++) {
-  			p1 = points[i];
-  			p2 = points[j];
-
-  			f = p1.y * p2.x - p2.y * p1.x;
-  			x += (p1.x + p2.x) * f;
-  			y += (p1.y + p2.y) * f;
-  			area += f * 3;
-  		}
-
-  		if (area === 0) {
-  			// Polygon is so small that all points are on same pixel.
-  			center = points[0];
-  		} else {
-  			center = [x / area, y / area];
-  		}
-  		return this._map.layerPointToLatLng(center);
-  	},
-
-  	_convertLatLngs: function (latlngs) {
-  		var result = Polyline.prototype._convertLatLngs.call(this, latlngs),
-  		    len = result.length;
-
-  		// remove last point if it equals first one
-  		if (len >= 2 && result[0] instanceof LatLng && result[0].equals(result[len - 1])) {
-  			result.pop();
-  		}
-  		return result;
-  	},
-
-  	_setLatLngs: function (latlngs) {
-  		Polyline.prototype._setLatLngs.call(this, latlngs);
-  		if (isFlat(this._latlngs)) {
-  			this._latlngs = [this._latlngs];
-  		}
-  	},
-
-  	_defaultShape: function () {
-  		return isFlat(this._latlngs[0]) ? this._latlngs[0] : this._latlngs[0][0];
-  	},
-
-  	_clipPoints: function () {
-  		// polygons need a different clipping algorithm so we redefine that
-
-  		var bounds = this._renderer._bounds,
-  		    w = this.options.weight,
-  		    p = new Point(w, w);
-
-  		// increase clip padding by stroke width to avoid stroke on clip edges
-  		bounds = new Bounds(bounds.min.subtract(p), bounds.max.add(p));
-
-  		this._parts = [];
-  		if (!this._pxBounds || !this._pxBounds.intersects(bounds)) {
-  			return;
-  		}
-
-  		if (this.options.noClip) {
-  			this._parts = this._rings;
-  			return;
-  		}
-
-  		for (var i = 0, len = this._rings.length, clipped; i < len; i++) {
-  			clipped = clipPolygon(this._rings[i], bounds, true);
-  			if (clipped.length) {
-  				this._parts.push(clipped);
-  			}
-  		}
-  	},
-
-  	_updatePath: function () {
-  		this._renderer._updatePoly(this, true);
-  	},
-
-  	// Needed by the `Canvas` renderer for interactivity
-  	_containsPoint: function (p) {
-  		var inside = false,
-  		    part, p1, p2, i, j, k, len, len2;
-
-  		if (!this._pxBounds || !this._pxBounds.contains(p)) { return false; }
-
-  		// ray casting algorithm for detecting if point is in polygon
-  		for (i = 0, len = this._parts.length; i < len; i++) {
-  			part = this._parts[i];
-
-  			for (j = 0, len2 = part.length, k = len2 - 1; j < len2; k = j++) {
-  				p1 = part[j];
-  				p2 = part[k];
-
-  				if (((p1.y > p.y) !== (p2.y > p.y)) && (p.x < (p2.x - p1.x) * (p.y - p1.y) / (p2.y - p1.y) + p1.x)) {
-  					inside = !inside;
-  				}
-  			}
-  		}
-
-  		// also check if it's on polygon stroke
-  		return inside || Polyline.prototype._containsPoint.call(this, p, true);
-  	}
-
-  });
-
-
-  // @factory L.polygon(latlngs: LatLng[], options?: Polyline options)
-  function polygon(latlngs, options) {
-  	return new Polygon(latlngs, options);
-  }
-
-  /*
-   * @class GeoJSON
-   * @aka L.GeoJSON
-   * @inherits FeatureGroup
-   *
-   * Represents a GeoJSON object or an array of GeoJSON objects. Allows you to parse
-   * GeoJSON data and display it on the map. Extends `FeatureGroup`.
-   *
-   * @example
-   *
-   * ```js
-   * L.geoJSON(data, {
-   * 	style: function (feature) {
-   * 		return {color: feature.properties.color};
-   * 	}
-   * }).bindPopup(function (layer) {
-   * 	return layer.feature.properties.description;
-   * }).addTo(map);
-   * ```
-   */
-
-  var GeoJSON = FeatureGroup.extend({
-
-  	/* @section
-  	 * @aka GeoJSON options
-  	 *
-  	 * @option pointToLayer: Function = *
-  	 * A `Function` defining how GeoJSON points spawn Leaflet layers. It is internally
-  	 * called when data is added, passing the GeoJSON point feature and its `LatLng`.
-  	 * The default is to spawn a default `Marker`:
-  	 * ```js
-  	 * function(geoJsonPoint, latlng) {
-  	 * 	return L.marker(latlng);
-  	 * }
-  	 * ```
-  	 *
-  	 * @option style: Function = *
-  	 * A `Function` defining the `Path options` for styling GeoJSON lines and polygons,
-  	 * called internally when data is added.
-  	 * The default value is to not override any defaults:
-  	 * ```js
-  	 * function (geoJsonFeature) {
-  	 * 	return {}
-  	 * }
-  	 * ```
-  	 *
-  	 * @option onEachFeature: Function = *
-  	 * A `Function` that will be called once for each created `Feature`, after it has
-  	 * been created and styled. Useful for attaching events and popups to features.
-  	 * The default is to do nothing with the newly created layers:
-  	 * ```js
-  	 * function (feature, layer) {}
-  	 * ```
-  	 *
-  	 * @option filter: Function = *
-  	 * A `Function` that will be used to decide whether to include a feature or not.
-  	 * The default is to include all features:
-  	 * ```js
-  	 * function (geoJsonFeature) {
-  	 * 	return true;
-  	 * }
-  	 * ```
-  	 * Note: dynamically changing the `filter` option will have effect only on newly
-  	 * added data. It will _not_ re-evaluate already included features.
-  	 *
-  	 * @option coordsToLatLng: Function = *
-  	 * A `Function` that will be used for converting GeoJSON coordinates to `LatLng`s.
-  	 * The default is the `coordsToLatLng` static method.
-  	 *
-  	 * @option markersInheritOptions: Boolean = false
-  	 * Whether default Markers for "Point" type Features inherit from group options.
-  	 */
-
-  	initialize: function (geojson, options) {
-  		setOptions(this, options);
-
-  		this._layers = {};
-
-  		if (geojson) {
-  			this.addData(geojson);
-  		}
-  	},
-
-  	// @method addData( <GeoJSON> data ): this
-  	// Adds a GeoJSON object to the layer.
-  	addData: function (geojson) {
-  		var features = isArray(geojson) ? geojson : geojson.features,
-  		    i, len, feature;
-
-  		if (features) {
-  			for (i = 0, len = features.length; i < len; i++) {
-  				// only add this if geometry or geometries are set and not null
-  				feature = features[i];
-  				if (feature.geometries || feature.geometry || feature.features || feature.coordinates) {
-  					this.addData(feature);
-  				}
-  			}
-  			return this;
-  		}
-
-  		var options = this.options;
-
-  		if (options.filter && !options.filter(geojson)) { return this; }
-
-  		var layer = geometryToLayer(geojson, options);
-  		if (!layer) {
-  			return this;
-  		}
-  		layer.feature = asFeature(geojson);
-
-  		layer.defaultOptions = layer.options;
-  		this.resetStyle(layer);
-
-  		if (options.onEachFeature) {
-  			options.onEachFeature(geojson, layer);
-  		}
-
-  		return this.addLayer(layer);
-  	},
-
-  	// @method resetStyle( <Path> layer? ): this
-  	// Resets the given vector layer's style to the original GeoJSON style, useful for resetting style after hover events.
-  	// If `layer` is omitted, the style of all features in the current layer is reset.
-  	resetStyle: function (layer) {
-  		if (layer === undefined) {
-  			return this.eachLayer(this.resetStyle, this);
-  		}
-  		// reset any custom styles
-  		layer.options = extend({}, layer.defaultOptions);
-  		this._setLayerStyle(layer, this.options.style);
-  		return this;
-  	},
-
-  	// @method setStyle( <Function> style ): this
-  	// Changes styles of GeoJSON vector layers with the given style function.
-  	setStyle: function (style) {
-  		return this.eachLayer(function (layer) {
-  			this._setLayerStyle(layer, style);
-  		}, this);
-  	},
-
-  	_setLayerStyle: function (layer, style) {
-  		if (layer.setStyle) {
-  			if (typeof style === 'function') {
-  				style = style(layer.feature);
-  			}
-  			layer.setStyle(style);
-  		}
-  	}
-  });
-
-  // @section
-  // There are several static functions which can be called without instantiating L.GeoJSON:
-
-  // @function geometryToLayer(featureData: Object, options?: GeoJSON options): Layer
-  // Creates a `Layer` from a given GeoJSON feature. Can use a custom
-  // [`pointToLayer`](#geojson-pointtolayer) and/or [`coordsToLatLng`](#geojson-coordstolatlng)
-  // functions if provided as options.
-  function geometryToLayer(geojson, options) {
-
-  	var geometry = geojson.type === 'Feature' ? geojson.geometry : geojson,
-  	    coords = geometry ? geometry.coordinates : null,
-  	    layers = [],
-  	    pointToLayer = options && options.pointToLayer,
-  	    _coordsToLatLng = options && options.coordsToLatLng || coordsToLatLng,
-  	    latlng, latlngs, i, len;
-
-  	if (!coords && !geometry) {
-  		return null;
-  	}
-
-  	switch (geometry.type) {
-  	case 'Point':
-  		latlng = _coordsToLatLng(coords);
-  		return _pointToLayer(pointToLayer, geojson, latlng, options);
-
-  	case 'MultiPoint':
-  		for (i = 0, len = coords.length; i < len; i++) {
-  			latlng = _coordsToLatLng(coords[i]);
-  			layers.push(_pointToLayer(pointToLayer, geojson, latlng, options));
-  		}
-  		return new FeatureGroup(layers);
-
-  	case 'LineString':
-  	case 'MultiLineString':
-  		latlngs = coordsToLatLngs(coords, geometry.type === 'LineString' ? 0 : 1, _coordsToLatLng);
-  		return new Polyline(latlngs, options);
-
-  	case 'Polygon':
-  	case 'MultiPolygon':
-  		latlngs = coordsToLatLngs(coords, geometry.type === 'Polygon' ? 1 : 2, _coordsToLatLng);
-  		return new Polygon(latlngs, options);
-
-  	case 'GeometryCollection':
-  		for (i = 0, len = geometry.geometries.length; i < len; i++) {
-  			var layer = geometryToLayer({
-  				geometry: geometry.geometries[i],
-  				type: 'Feature',
-  				properties: geojson.properties
-  			}, options);
-
-  			if (layer) {
-  				layers.push(layer);
-  			}
-  		}
-  		return new FeatureGroup(layers);
-
-  	default:
-  		throw new Error('Invalid GeoJSON object.');
-  	}
-  }
-
-  function _pointToLayer(pointToLayerFn, geojson, latlng, options) {
-  	return pointToLayerFn ?
-  		pointToLayerFn(geojson, latlng) :
-  		new Marker(latlng, options && options.markersInheritOptions && options);
-  }
-
-  // @function coordsToLatLng(coords: Array): LatLng
-  // Creates a `LatLng` object from an array of 2 numbers (longitude, latitude)
-  // or 3 numbers (longitude, latitude, altitude) used in GeoJSON for points.
-  function coordsToLatLng(coords) {
-  	return new LatLng(coords[1], coords[0], coords[2]);
-  }
-
-  // @function coordsToLatLngs(coords: Array, levelsDeep?: Number, coordsToLatLng?: Function): Array
-  // Creates a multidimensional array of `LatLng`s from a GeoJSON coordinates array.
-  // `levelsDeep` specifies the nesting level (0 is for an array of points, 1 for an array of arrays of points, etc., 0 by default).
-  // Can use a custom [`coordsToLatLng`](#geojson-coordstolatlng) function.
-  function coordsToLatLngs(coords, levelsDeep, _coordsToLatLng) {
-  	var latlngs = [];
-
-  	for (var i = 0, len = coords.length, latlng; i < len; i++) {
-  		latlng = levelsDeep ?
-  			coordsToLatLngs(coords[i], levelsDeep - 1, _coordsToLatLng) :
-  			(_coordsToLatLng || coordsToLatLng)(coords[i]);
-
-  		latlngs.push(latlng);
-  	}
-
-  	return latlngs;
-  }
-
-  // @function latLngToCoords(latlng: LatLng, precision?: Number): Array
-  // Reverse of [`coordsToLatLng`](#geojson-coordstolatlng)
-  function latLngToCoords(latlng, precision) {
-  	precision = typeof precision === 'number' ? precision : 6;
-  	return latlng.alt !== undefined ?
-  		[formatNum(latlng.lng, precision), formatNum(latlng.lat, precision), formatNum(latlng.alt, precision)] :
-  		[formatNum(latlng.lng, precision), formatNum(latlng.lat, precision)];
-  }
-
-  // @function latLngsToCoords(latlngs: Array, levelsDeep?: Number, closed?: Boolean): Array
-  // Reverse of [`coordsToLatLngs`](#geojson-coordstolatlngs)
-  // `closed` determines whether the first point should be appended to the end of the array to close the feature, only used when `levelsDeep` is 0. False by default.
-  function latLngsToCoords(latlngs, levelsDeep, closed, precision) {
-  	var coords = [];
-
-  	for (var i = 0, len = latlngs.length; i < len; i++) {
-  		coords.push(levelsDeep ?
-  			latLngsToCoords(latlngs[i], levelsDeep - 1, closed, precision) :
-  			latLngToCoords(latlngs[i], precision));
-  	}
-
-  	if (!levelsDeep && closed) {
-  		coords.push(coords[0]);
-  	}
-
-  	return coords;
-  }
-
-  function getFeature(layer, newGeometry) {
-  	return layer.feature ?
-  		extend({}, layer.feature, {geometry: newGeometry}) :
-  		asFeature(newGeometry);
-  }
-
-  // @function asFeature(geojson: Object): Object
-  // Normalize GeoJSON geometries/features into GeoJSON features.
-  function asFeature(geojson) {
-  	if (geojson.type === 'Feature' || geojson.type === 'FeatureCollection') {
-  		return geojson;
-  	}
-
-  	return {
-  		type: 'Feature',
-  		properties: {},
-  		geometry: geojson
-  	};
-  }
-
-  var PointToGeoJSON = {
-  	toGeoJSON: function (precision) {
-  		return getFeature(this, {
-  			type: 'Point',
-  			coordinates: latLngToCoords(this.getLatLng(), precision)
-  		});
-  	}
-  };
-
-  // @namespace Marker
-  // @section Other methods
-  // @method toGeoJSON(precision?: Number): Object
-  // `precision` is the number of decimal places for coordinates.
-  // The default value is 6 places.
-  // Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the marker (as a GeoJSON `Point` Feature).
-  Marker.include(PointToGeoJSON);
-
-  // @namespace CircleMarker
-  // @method toGeoJSON(precision?: Number): Object
-  // `precision` is the number of decimal places for coordinates.
-  // The default value is 6 places.
-  // Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the circle marker (as a GeoJSON `Point` Feature).
-  Circle.include(PointToGeoJSON);
-  CircleMarker.include(PointToGeoJSON);
-
-
-  // @namespace Polyline
-  // @method toGeoJSON(precision?: Number): Object
-  // `precision` is the number of decimal places for coordinates.
-  // The default value is 6 places.
-  // Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the polyline (as a GeoJSON `LineString` or `MultiLineString` Feature).
-  Polyline.include({
-  	toGeoJSON: function (precision) {
-  		var multi = !isFlat(this._latlngs);
-
-  		var coords = latLngsToCoords(this._latlngs, multi ? 1 : 0, false, precision);
-
-  		return getFeature(this, {
-  			type: (multi ? 'Multi' : '') + 'LineString',
-  			coordinates: coords
-  		});
-  	}
-  });
-
-  // @namespace Polygon
-  // @method toGeoJSON(precision?: Number): Object
-  // `precision` is the number of decimal places for coordinates.
-  // The default value is 6 places.
-  // Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the polygon (as a GeoJSON `Polygon` or `MultiPolygon` Feature).
-  Polygon.include({
-  	toGeoJSON: function (precision) {
-  		var holes = !isFlat(this._latlngs),
-  		    multi = holes && !isFlat(this._latlngs[0]);
-
-  		var coords = latLngsToCoords(this._latlngs, multi ? 2 : holes ? 1 : 0, true, precision);
-
-  		if (!holes) {
-  			coords = [coords];
-  		}
-
-  		return getFeature(this, {
-  			type: (multi ? 'Multi' : '') + 'Polygon',
-  			coordinates: coords
-  		});
-  	}
-  });
-
-
-  // @namespace LayerGroup
-  LayerGroup.include({
-  	toMultiPoint: function (precision) {
-  		var coords = [];
-
-  		this.eachLayer(function (layer) {
-  			coords.push(layer.toGeoJSON(precision).geometry.coordinates);
-  		});
-
-  		return getFeature(this, {
-  			type: 'MultiPoint',
-  			coordinates: coords
-  		});
-  	},
-
-  	// @method toGeoJSON(precision?: Number): Object
-  	// `precision` is the number of decimal places for coordinates.
-  	// The default value is 6 places.
-  	// Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the layer group (as a GeoJSON `FeatureCollection`, `GeometryCollection`, or `MultiPoint`).
-  	toGeoJSON: function (precision) {
-
-  		var type = this.feature && this.feature.geometry && this.feature.geometry.type;
-
-  		if (type === 'MultiPoint') {
-  			return this.toMultiPoint(precision);
-  		}
-
-  		var isGeometryCollection = type === 'GeometryCollection',
-  		    jsons = [];
-
-  		this.eachLayer(function (layer) {
-  			if (layer.toGeoJSON) {
-  				var json = layer.toGeoJSON(precision);
-  				if (isGeometryCollection) {
-  					jsons.push(json.geometry);
-  				} else {
-  					var feature = asFeature(json);
-  					// Squash nested feature collections
-  					if (feature.type === 'FeatureCollection') {
-  						jsons.push.apply(jsons, feature.features);
-  					} else {
-  						jsons.push(feature);
-  					}
-  				}
-  			}
-  		});
-
-  		if (isGeometryCollection) {
-  			return getFeature(this, {
-  				geometries: jsons,
-  				type: 'GeometryCollection'
-  			});
-  		}
-
-  		return {
-  			type: 'FeatureCollection',
-  			features: jsons
-  		};
-  	}
-  });
-
-  // @namespace GeoJSON
-  // @factory L.geoJSON(geojson?: Object, options?: GeoJSON options)
-  // Creates a GeoJSON layer. Optionally accepts an object in
-  // [GeoJSON format](https://tools.ietf.org/html/rfc7946) to display on the map
-  // (you can alternatively add it later with `addData` method) and an `options` object.
-  function geoJSON(geojson, options) {
-  	return new GeoJSON(geojson, options);
-  }
-
-  // Backward compatibility.
-  var geoJson = geoJSON;
-
-  /*
-   * @class ImageOverlay
-   * @aka L.ImageOverlay
-   * @inherits Interactive layer
-   *
-   * Used to load and display a single image over specific bounds of the map. Extends `Layer`.
-   *
-   * @example
-   *
-   * ```js
-   * var imageUrl = 'http://www.lib.utexas.edu/maps/historical/newark_nj_1922.jpg',
-   * 	imageBounds = [[40.712216, -74.22655], [40.773941, -74.12544]];
-   * L.imageOverlay(imageUrl, imageBounds).addTo(map);
-   * ```
-   */
-
-  var ImageOverlay = Layer.extend({
-
-  	// @section
-  	// @aka ImageOverlay options
-  	options: {
-  		// @option opacity: Number = 1.0
-  		// The opacity of the image overlay.
-  		opacity: 1,
-
-  		// @option alt: String = ''
-  		// Text for the `alt` attribute of the image (useful for accessibility).
-  		alt: '',
-
-  		// @option interactive: Boolean = false
-  		// If `true`, the image overlay will emit [mouse events](#interactive-layer) when clicked or hovered.
-  		interactive: false,
-
-  		// @option crossOrigin: Boolean|String = false
-  		// Whether the crossOrigin attribute will be added to the image.
-  		// If a String is provided, the image will have its crossOrigin attribute set to the String provided. This is needed if you want to access image pixel data.
-  		// Refer to [CORS Settings](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes) for valid String values.
-  		crossOrigin: false,
-
-  		// @option errorOverlayUrl: String = ''
-  		// URL to the overlay image to show in place of the overlay that failed to load.
-  		errorOverlayUrl: '',
-
-  		// @option zIndex: Number = 1
-  		// The explicit [zIndex](https://developer.mozilla.org/docs/Web/CSS/CSS_Positioning/Understanding_z_index) of the overlay layer.
-  		zIndex: 1,
-
-  		// @option className: String = ''
-  		// A custom class name to assign to the image. Empty by default.
-  		className: ''
-  	},
-
-  	initialize: function (url, bounds, options) { // (String, LatLngBounds, Object)
-  		this._url = url;
-  		this._bounds = toLatLngBounds(bounds);
-
-  		setOptions(this, options);
-  	},
-
-  	onAdd: function () {
-  		if (!this._image) {
-  			this._initImage();
-
-  			if (this.options.opacity < 1) {
-  				this._updateOpacity();
-  			}
-  		}
-
-  		if (this.options.interactive) {
-  			addClass(this._image, 'leaflet-interactive');
-  			this.addInteractiveTarget(this._image);
-  		}
-
-  		this.getPane().appendChild(this._image);
-  		this._reset();
-  	},
-
-  	onRemove: function () {
-  		remove(this._image);
-  		if (this.options.interactive) {
-  			this.removeInteractiveTarget(this._image);
-  		}
-  	},
-
-  	// @method setOpacity(opacity: Number): this
-  	// Sets the opacity of the overlay.
-  	setOpacity: function (opacity) {
-  		this.options.opacity = opacity;
-
-  		if (this._image) {
-  			this._updateOpacity();
-  		}
-  		return this;
-  	},
-
-  	setStyle: function (styleOpts) {
-  		if (styleOpts.opacity) {
-  			this.setOpacity(styleOpts.opacity);
-  		}
-  		return this;
-  	},
-
-  	// @method bringToFront(): this
-  	// Brings the layer to the top of all overlays.
-  	bringToFront: function () {
-  		if (this._map) {
-  			toFront(this._image);
-  		}
-  		return this;
-  	},
-
-  	// @method bringToBack(): this
-  	// Brings the layer to the bottom of all overlays.
-  	bringToBack: function () {
-  		if (this._map) {
-  			toBack(this._image);
-  		}
-  		return this;
-  	},
-
-  	// @method setUrl(url: String): this
-  	// Changes the URL of the image.
-  	setUrl: function (url) {
-  		this._url = url;
-
-  		if (this._image) {
-  			this._image.src = url;
-  		}
-  		return this;
-  	},
-
-  	// @method setBounds(bounds: LatLngBounds): this
-  	// Update the bounds that this ImageOverlay covers
-  	setBounds: function (bounds) {
-  		this._bounds = toLatLngBounds(bounds);
-
-  		if (this._map) {
-  			this._reset();
-  		}
-  		return this;
-  	},
-
-  	getEvents: function () {
-  		var events = {
-  			zoom: this._reset,
-  			viewreset: this._reset
-  		};
-
-  		if (this._zoomAnimated) {
-  			events.zoomanim = this._animateZoom;
-  		}
-
-  		return events;
-  	},
-
-  	// @method setZIndex(value: Number): this
-  	// Changes the [zIndex](#imageoverlay-zindex) of the image overlay.
-  	setZIndex: function (value) {
-  		this.options.zIndex = value;
-  		this._updateZIndex();
-  		return this;
-  	},
-
-  	// @method getBounds(): LatLngBounds
-  	// Get the bounds that this ImageOverlay covers
-  	getBounds: function () {
-  		return this._bounds;
-  	},
-
-  	// @method getElement(): HTMLElement
-  	// Returns the instance of [`HTMLImageElement`](https://developer.mozilla.org/docs/Web/API/HTMLImageElement)
-  	// used by this overlay.
-  	getElement: function () {
-  		return this._image;
-  	},
-
-  	_initImage: function () {
-  		var wasElementSupplied = this._url.tagName === 'IMG';
-  		var img = this._image = wasElementSupplied ? this._url : create$1('img');
-
-  		addClass(img, 'leaflet-image-layer');
-  		if (this._zoomAnimated) { addClass(img, 'leaflet-zoom-animated'); }
-  		if (this.options.className) { addClass(img, this.options.className); }
-
-  		img.onselectstart = falseFn;
-  		img.onmousemove = falseFn;
-
-  		// @event load: Event
-  		// Fired when the ImageOverlay layer has loaded its image
-  		img.onload = bind(this.fire, this, 'load');
-  		img.onerror = bind(this._overlayOnError, this, 'error');
-
-  		if (this.options.crossOrigin || this.options.crossOrigin === '') {
-  			img.crossOrigin = this.options.crossOrigin === true ? '' : this.options.crossOrigin;
-  		}
-
-  		if (this.options.zIndex) {
-  			this._updateZIndex();
-  		}
-
-  		if (wasElementSupplied) {
-  			this._url = img.src;
-  			return;
-  		}
-
-  		img.src = this._url;
-  		img.alt = this.options.alt;
-  	},
-
-  	_animateZoom: function (e) {
-  		var scale = this._map.getZoomScale(e.zoom),
-  		    offset = this._map._latLngBoundsToNewLayerBounds(this._bounds, e.zoom, e.center).min;
-
-  		setTransform(this._image, offset, scale);
-  	},
-
-  	_reset: function () {
-  		var image = this._image,
-  		    bounds = new Bounds(
-  		        this._map.latLngToLayerPoint(this._bounds.getNorthWest()),
-  		        this._map.latLngToLayerPoint(this._bounds.getSouthEast())),
-  		    size = bounds.getSize();
-
-  		setPosition(image, bounds.min);
-
-  		image.style.width  = size.x + 'px';
-  		image.style.height = size.y + 'px';
-  	},
-
-  	_updateOpacity: function () {
-  		setOpacity(this._image, this.options.opacity);
-  	},
-
-  	_updateZIndex: function () {
-  		if (this._image && this.options.zIndex !== undefined && this.options.zIndex !== null) {
-  			this._image.style.zIndex = this.options.zIndex;
-  		}
-  	},
-
-  	_overlayOnError: function () {
-  		// @event error: Event
-  		// Fired when the ImageOverlay layer fails to load its image
-  		this.fire('error');
-
-  		var errorUrl = this.options.errorOverlayUrl;
-  		if (errorUrl && this._url !== errorUrl) {
-  			this._url = errorUrl;
-  			this._image.src = errorUrl;
-  		}
-  	}
-  });
-
-  // @factory L.imageOverlay(imageUrl: String, bounds: LatLngBounds, options?: ImageOverlay options)
-  // Instantiates an image overlay object given the URL of the image and the
-  // geographical bounds it is tied to.
-  var imageOverlay = function (url, bounds, options) {
-  	return new ImageOverlay(url, bounds, options);
-  };
-
-  /*
-   * @class VideoOverlay
-   * @aka L.VideoOverlay
-   * @inherits ImageOverlay
-   *
-   * Used to load and display a video player over specific bounds of the map. Extends `ImageOverlay`.
-   *
-   * A video overlay uses the [`<video>`](https://developer.mozilla.org/docs/Web/HTML/Element/video)
-   * HTML5 element.
-   *
-   * @example
-   *
-   * ```js
-   * var videoUrl = 'https://www.mapbox.com/bites/00188/patricia_nasa.webm',
-   * 	videoBounds = [[ 32, -130], [ 13, -100]];
-   * L.videoOverlay(videoUrl, videoBounds ).addTo(map);
-   * ```
-   */
-
-  var VideoOverlay = ImageOverlay.extend({
-
-  	// @section
-  	// @aka VideoOverlay options
-  	options: {
-  		// @option autoplay: Boolean = true
-  		// Whether the video starts playing automatically when loaded.
-  		autoplay: true,
-
-  		// @option loop: Boolean = true
-  		// Whether the video will loop back to the beginning when played.
-  		loop: true,
-
-  		// @option keepAspectRatio: Boolean = true
-  		// Whether the video will save aspect ratio after the projection.
-  		// Relevant for supported browsers. Browser compatibility- https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit
-  		keepAspectRatio: true,
-
-  		// @option muted: Boolean = false
-  		// Whether the video starts on mute when loaded.
-  		muted: false
-  	},
-
-  	_initImage: function () {
-  		var wasElementSupplied = this._url.tagName === 'VIDEO';
-  		var vid = this._image = wasElementSupplied ? this._url : create$1('video');
-
-  		addClass(vid, 'leaflet-image-layer');
-  		if (this._zoomAnimated) { addClass(vid, 'leaflet-zoom-animated'); }
-  		if (this.options.className) { addClass(vid, this.options.className); }
-
-  		vid.onselectstart = falseFn;
-  		vid.onmousemove = falseFn;
-
-  		// @event load: Event
-  		// Fired when the video has finished loading the first frame
-  		vid.onloadeddata = bind(this.fire, this, 'load');
-
-  		if (wasElementSupplied) {
-  			var sourceElements = vid.getElementsByTagName('source');
-  			var sources = [];
-  			for (var j = 0; j < sourceElements.length; j++) {
-  				sources.push(sourceElements[j].src);
-  			}
-
-  			this._url = (sourceElements.length > 0) ? sources : [vid.src];
-  			return;
-  		}
-
-  		if (!isArray(this._url)) { this._url = [this._url]; }
-
-  		if (!this.options.keepAspectRatio && Object.prototype.hasOwnProperty.call(vid.style, 'objectFit')) {
-  			vid.style['objectFit'] = 'fill';
-  		}
-  		vid.autoplay = !!this.options.autoplay;
-  		vid.loop = !!this.options.loop;
-  		vid.muted = !!this.options.muted;
-  		for (var i = 0; i < this._url.length; i++) {
-  			var source = create$1('source');
-  			source.src = this._url[i];
-  			vid.appendChild(source);
-  		}
-  	}
-
-  	// @method getElement(): HTMLVideoElement
-  	// Returns the instance of [`HTMLVideoElement`](https://developer.mozilla.org/docs/Web/API/HTMLVideoElement)
-  	// used by this overlay.
-  });
-
-
-  // @factory L.videoOverlay(video: String|Array|HTMLVideoElement, bounds: LatLngBounds, options?: VideoOverlay options)
-  // Instantiates an image overlay object given the URL of the video (or array of URLs, or even a video element) and the
-  // geographical bounds it is tied to.
-
-  function videoOverlay(video, bounds, options) {
-  	return new VideoOverlay(video, bounds, options);
-  }
-
-  /*
-   * @class SVGOverlay
-   * @aka L.SVGOverlay
-   * @inherits ImageOverlay
-   *
-   * Used to load, display and provide DOM access to an SVG file over specific bounds of the map. Extends `ImageOverlay`.
-   *
-   * An SVG overlay uses the [`<svg>`](https://developer.mozilla.org/docs/Web/SVG/Element/svg) element.
-   *
-   * @example
-   *
-   * ```js
-   * var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
-   * svgElement.setAttribute('xmlns', "http://www.w3.org/2000/svg");
-   * svgElement.setAttribute('viewBox', "0 0 200 200");
-   * svgElement.innerHTML = '<rect width="200" height="200"/><rect x="75" y="23" width="50" height="50" style="fill:red"/><rect x="75" y="123" width="50" height="50" style="fill:#0013ff"/>';
-   * var svgElementBounds = [ [ 32, -130 ], [ 13, -100 ] ];
-   * L.svgOverlay(svgElement, svgElementBounds).addTo(map);
-   * ```
-   */
-
-  var SVGOverlay = ImageOverlay.extend({
-  	_initImage: function () {
-  		var el = this._image = this._url;
-
-  		addClass(el, 'leaflet-image-layer');
-  		if (this._zoomAnimated) { addClass(el, 'leaflet-zoom-animated'); }
-  		if (this.options.className) { addClass(el, this.options.className); }
-
-  		el.onselectstart = falseFn;
-  		el.onmousemove = falseFn;
-  	}
-
-  	// @method getElement(): SVGElement
-  	// Returns the instance of [`SVGElement`](https://developer.mozilla.org/docs/Web/API/SVGElement)
-  	// used by this overlay.
-  });
-
-
-  // @factory L.svgOverlay(svg: String|SVGElement, bounds: LatLngBounds, options?: SVGOverlay options)
-  // Instantiates an image overlay object given an SVG element and the geographical bounds it is tied to.
-  // A viewBox attribute is required on the SVG element to zoom in and out properly.
-
-  function svgOverlay(el, bounds, options) {
-  	return new SVGOverlay(el, bounds, options);
-  }
-
-  /*
-   * @class DivOverlay
-   * @inherits Layer
-   * @aka L.DivOverlay
-   * Base model for L.Popup and L.Tooltip. Inherit from it for custom popup like plugins.
-   */
-
-  // @namespace DivOverlay
-  var DivOverlay = Layer.extend({
-
-  	// @section
-  	// @aka DivOverlay options
-  	options: {
-  		// @option offset: Point = Point(0, 7)
-  		// The offset of the popup position. Useful to control the anchor
-  		// of the popup when opening it on some overlays.
-  		offset: [0, 7],
-
-  		// @option className: String = ''
-  		// A custom CSS class name to assign to the popup.
-  		className: '',
-
-  		// @option pane: String = 'popupPane'
-  		// `Map pane` where the popup will be added.
-  		pane: 'popupPane'
-  	},
-
-  	initialize: function (options, source) {
-  		setOptions(this, options);
-
-  		this._source = source;
-  	},
-
-  	onAdd: function (map) {
-  		this._zoomAnimated = map._zoomAnimated;
-
-  		if (!this._container) {
-  			this._initLayout();
-  		}
-
-  		if (map._fadeAnimated) {
-  			setOpacity(this._container, 0);
-  		}
-
-  		clearTimeout(this._removeTimeout);
-  		this.getPane().appendChild(this._container);
-  		this.update();
-
-  		if (map._fadeAnimated) {
-  			setOpacity(this._container, 1);
-  		}
-
-  		this.bringToFront();
-  	},
-
-  	onRemove: function (map) {
-  		if (map._fadeAnimated) {
-  			setOpacity(this._container, 0);
-  			this._removeTimeout = setTimeout(bind(remove, undefined, this._container), 200);
-  		} else {
-  			remove(this._container);
-  		}
-  	},
-
-  	// @namespace Popup
-  	// @method getLatLng: LatLng
-  	// Returns the geographical point of popup.
-  	getLatLng: function () {
-  		return this._latlng;
-  	},
-
-  	// @method setLatLng(latlng: LatLng): this
-  	// Sets the geographical point where the popup will open.
-  	setLatLng: function (latlng) {
-  		this._latlng = toLatLng(latlng);
-  		if (this._map) {
-  			this._updatePosition();
-  			this._adjustPan();
-  		}
-  		return this;
-  	},
-
-  	// @method getContent: String|HTMLElement
-  	// Returns the content of the popup.
-  	getContent: function () {
-  		return this._content;
-  	},
-
-  	// @method setContent(htmlContent: String|HTMLElement|Function): this
-  	// Sets the HTML content of the popup. If a function is passed the source layer will be passed to the function. The function should return a `String` or `HTMLElement` to be used in the popup.
-  	setContent: function (content) {
-  		this._content = content;
-  		this.update();
-  		return this;
-  	},
-
-  	// @method getElement: String|HTMLElement
-  	// Returns the HTML container of the popup.
-  	getElement: function () {
-  		return this._container;
-  	},
-
-  	// @method update: null
-  	// Updates the popup content, layout and position. Useful for updating the popup after something inside changed, e.g. image loaded.
-  	update: function () {
-  		if (!this._map) { return; }
-
-  		this._container.style.visibility = 'hidden';
-
-  		this._updateContent();
-  		this._updateLayout();
-  		this._updatePosition();
-
-  		this._container.style.visibility = '';
-
-  		this._adjustPan();
-  	},
-
-  	getEvents: function () {
-  		var events = {
-  			zoom: this._updatePosition,
-  			viewreset: this._updatePosition
-  		};
-
-  		if (this._zoomAnimated) {
-  			events.zoomanim = this._animateZoom;
-  		}
-  		return events;
-  	},
-
-  	// @method isOpen: Boolean
-  	// Returns `true` when the popup is visible on the map.
-  	isOpen: function () {
-  		return !!this._map && this._map.hasLayer(this);
-  	},
-
-  	// @method bringToFront: this
-  	// Brings this popup in front of other popups (in the same map pane).
-  	bringToFront: function () {
-  		if (this._map) {
-  			toFront(this._container);
-  		}
-  		return this;
-  	},
-
-  	// @method bringToBack: this
-  	// Brings this popup to the back of other popups (in the same map pane).
-  	bringToBack: function () {
-  		if (this._map) {
-  			toBack(this._container);
-  		}
-  		return this;
-  	},
-
-  	_prepareOpen: function (parent, layer, latlng) {
-  		if (!(layer instanceof Layer)) {
-  			latlng = layer;
-  			layer = parent;
-  		}
-
-  		if (layer instanceof FeatureGroup) {
-  			for (var id in parent._layers) {
-  				layer = parent._layers[id];
-  				break;
-  			}
-  		}
-
-  		if (!latlng) {
-  			if (layer.getCenter) {
-  				latlng = layer.getCenter();
-  			} else if (layer.getLatLng) {
-  				latlng = layer.getLatLng();
-  			} else {
-  				throw new Error('Unable to get source layer LatLng.');
-  			}
-  		}
-
-  		// set overlay source to this layer
-  		this._source = layer;
-
-  		// update the overlay (content, layout, ect...)
-  		this.update();
-
-  		return latlng;
-  	},
-
-  	_updateContent: function () {
-  		if (!this._content) { return; }
-
-  		var node = this._contentNode;
-  		var content = (typeof this._content === 'function') ? this._content(this._source || this) : this._content;
-
-  		if (typeof content === 'string') {
-  			node.innerHTML = content;
-  		} else {
-  			while (node.hasChildNodes()) {
-  				node.removeChild(node.firstChild);
-  			}
-  			node.appendChild(content);
-  		}
-  		this.fire('contentupdate');
-  	},
-
-  	_updatePosition: function () {
-  		if (!this._map) { return; }
-
-  		var pos = this._map.latLngToLayerPoint(this._latlng),
-  		    offset = toPoint(this.options.offset),
-  		    anchor = this._getAnchor();
-
-  		if (this._zoomAnimated) {
-  			setPosition(this._container, pos.add(anchor));
-  		} else {
-  			offset = offset.add(pos).add(anchor);
-  		}
-
-  		var bottom = this._containerBottom = -offset.y,
-  		    left = this._containerLeft = -Math.round(this._containerWidth / 2) + offset.x;
-
-  		// bottom position the popup in case the height of the popup changes (images loading etc)
-  		this._container.style.bottom = bottom + 'px';
-  		this._container.style.left = left + 'px';
-  	},
-
-  	_getAnchor: function () {
-  		return [0, 0];
-  	}
-
-  });
-
-  /*
-   * @class Popup
-   * @inherits DivOverlay
-   * @aka L.Popup
-   * Used to open popups in certain places of the map. Use [Map.openPopup](#map-openpopup) to
-   * open popups while making sure that only one popup is open at one time
-   * (recommended for usability), or use [Map.addLayer](#map-addlayer) to open as many as you want.
-   *
-   * @example
-   *
-   * If you want to just bind a popup to marker click and then open it, it's really easy:
-   *
-   * ```js
-   * marker.bindPopup(popupContent).openPopup();
-   * ```
-   * Path overlays like polylines also have a `bindPopup` method.
-   * Here's a more complicated way to open a popup on a map:
-   *
-   * ```js
-   * var popup = L.popup()
-   * 	.setLatLng(latlng)
-   * 	.setContent('<p>Hello world!<br />This is a nice popup.</p>')
-   * 	.openOn(map);
-   * ```
-   */
-
-
-  // @namespace Popup
-  var Popup = DivOverlay.extend({
-
-  	// @section
-  	// @aka Popup options
-  	options: {
-  		// @option maxWidth: Number = 300
-  		// Max width of the popup, in pixels.
-  		maxWidth: 300,
-
-  		// @option minWidth: Number = 50
-  		// Min width of the popup, in pixels.
-  		minWidth: 50,
-
-  		// @option maxHeight: Number = null
-  		// If set, creates a scrollable container of the given height
-  		// inside a popup if its content exceeds it.
-  		maxHeight: null,
-
-  		// @option autoPan: Boolean = true
-  		// Set it to `false` if you don't want the map to do panning animation
-  		// to fit the opened popup.
-  		autoPan: true,
-
-  		// @option autoPanPaddingTopLeft: Point = null
-  		// The margin between the popup and the top left corner of the map
-  		// view after autopanning was performed.
-  		autoPanPaddingTopLeft: null,
-
-  		// @option autoPanPaddingBottomRight: Point = null
-  		// The margin between the popup and the bottom right corner of the map
-  		// view after autopanning was performed.
-  		autoPanPaddingBottomRight: null,
-
-  		// @option autoPanPadding: Point = Point(5, 5)
-  		// Equivalent of setting both top left and bottom right autopan padding to the same value.
-  		autoPanPadding: [5, 5],
-
-  		// @option keepInView: Boolean = false
-  		// Set it to `true` if you want to prevent users from panning the popup
-  		// off of the screen while it is open.
-  		keepInView: false,
-
-  		// @option closeButton: Boolean = true
-  		// Controls the presence of a close button in the popup.
-  		closeButton: true,
-
-  		// @option autoClose: Boolean = true
-  		// Set it to `false` if you want to override the default behavior of
-  		// the popup closing when another popup is opened.
-  		autoClose: true,
-
-  		// @option closeOnEscapeKey: Boolean = true
-  		// Set it to `false` if you want to override the default behavior of
-  		// the ESC key for closing of the popup.
-  		closeOnEscapeKey: true,
-
-  		// @option closeOnClick: Boolean = *
-  		// Set it if you want to override the default behavior of the popup closing when user clicks
-  		// on the map. Defaults to the map's [`closePopupOnClick`](#map-closepopuponclick) option.
-
-  		// @option className: String = ''
-  		// A custom CSS class name to assign to the popup.
-  		className: ''
-  	},
-
-  	// @namespace Popup
-  	// @method openOn(map: Map): this
-  	// Adds the popup to the map and closes the previous one. The same as `map.openPopup(popup)`.
-  	openOn: function (map) {
-  		map.openPopup(this);
-  		return this;
-  	},
-
-  	onAdd: function (map) {
-  		DivOverlay.prototype.onAdd.call(this, map);
-
-  		// @namespace Map
-  		// @section Popup events
-  		// @event popupopen: PopupEvent
-  		// Fired when a popup is opened in the map
-  		map.fire('popupopen', {popup: this});
-
-  		if (this._source) {
-  			// @namespace Layer
-  			// @section Popup events
-  			// @event popupopen: PopupEvent
-  			// Fired when a popup bound to this layer is opened
-  			this._source.fire('popupopen', {popup: this}, true);
-  			// For non-path layers, we toggle the popup when clicking
-  			// again the layer, so prevent the map to reopen it.
-  			if (!(this._source instanceof Path)) {
-  				this._source.on('preclick', stopPropagation);
-  			}
-  		}
-  	},
-
-  	onRemove: function (map) {
-  		DivOverlay.prototype.onRemove.call(this, map);
-
-  		// @namespace Map
-  		// @section Popup events
-  		// @event popupclose: PopupEvent
-  		// Fired when a popup in the map is closed
-  		map.fire('popupclose', {popup: this});
-
-  		if (this._source) {
-  			// @namespace Layer
-  			// @section Popup events
-  			// @event popupclose: PopupEvent
-  			// Fired when a popup bound to this layer is closed
-  			this._source.fire('popupclose', {popup: this}, true);
-  			if (!(this._source instanceof Path)) {
-  				this._source.off('preclick', stopPropagation);
-  			}
-  		}
-  	},
-
-  	getEvents: function () {
-  		var events = DivOverlay.prototype.getEvents.call(this);
-
-  		if (this.options.closeOnClick !== undefined ? this.options.closeOnClick : this._map.options.closePopupOnClick) {
-  			events.preclick = this._close;
-  		}
-
-  		if (this.options.keepInView) {
-  			events.moveend = this._adjustPan;
-  		}
-
-  		return events;
-  	},
-
-  	_close: function () {
-  		if (this._map) {
-  			this._map.closePopup(this);
-  		}
-  	},
-
-  	_initLayout: function () {
-  		var prefix = 'leaflet-popup',
-  		    container = this._container = create$1('div',
-  			prefix + ' ' + (this.options.className || '') +
-  			' leaflet-zoom-animated');
-
-  		var wrapper = this._wrapper = create$1('div', prefix + '-content-wrapper', container);
-  		this._contentNode = create$1('div', prefix + '-content', wrapper);
-
-  		disableClickPropagation(container);
-  		disableScrollPropagation(this._contentNode);
-  		on(container, 'contextmenu', stopPropagation);
-
-  		this._tipContainer = create$1('div', prefix + '-tip-container', container);
-  		this._tip = create$1('div', prefix + '-tip', this._tipContainer);
-
-  		if (this.options.closeButton) {
-  			var closeButton = this._closeButton = create$1('a', prefix + '-close-button', container);
-  			closeButton.href = '#close';
-  			closeButton.innerHTML = '&#215;';
-
-  			on(closeButton, 'click', this._onCloseButtonClick, this);
-  		}
-  	},
-
-  	_updateLayout: function () {
-  		var container = this._contentNode,
-  		    style = container.style;
-
-  		style.width = '';
-  		style.whiteSpace = 'nowrap';
-
-  		var width = container.offsetWidth;
-  		width = Math.min(width, this.options.maxWidth);
-  		width = Math.max(width, this.options.minWidth);
-
-  		style.width = (width + 1) + 'px';
-  		style.whiteSpace = '';
-
-  		style.height = '';
-
-  		var height = container.offsetHeight,
-  		    maxHeight = this.options.maxHeight,
-  		    scrolledClass = 'leaflet-popup-scrolled';
-
-  		if (maxHeight && height > maxHeight) {
-  			style.height = maxHeight + 'px';
-  			addClass(container, scrolledClass);
-  		} else {
-  			removeClass(container, scrolledClass);
-  		}
-
-  		this._containerWidth = this._container.offsetWidth;
-  	},
-
-  	_animateZoom: function (e) {
-  		var pos = this._map._latLngToNewLayerPoint(this._latlng, e.zoom, e.center),
-  		    anchor = this._getAnchor();
-  		setPosition(this._container, pos.add(anchor));
-  	},
-
-  	_adjustPan: function () {
-  		if (!this.options.autoPan) { return; }
-  		if (this._map._panAnim) { this._map._panAnim.stop(); }
-
-  		var map = this._map,
-  		    marginBottom = parseInt(getStyle(this._container, 'marginBottom'), 10) || 0,
-  		    containerHeight = this._container.offsetHeight + marginBottom,
-  		    containerWidth = this._containerWidth,
-  		    layerPos = new Point(this._containerLeft, -containerHeight - this._containerBottom);
-
-  		layerPos._add(getPosition(this._container));
-
-  		var containerPos = map.layerPointToContainerPoint(layerPos),
-  		    padding = toPoint(this.options.autoPanPadding),
-  		    paddingTL = toPoint(this.options.autoPanPaddingTopLeft || padding),
-  		    paddingBR = toPoint(this.options.autoPanPaddingBottomRight || padding),
-  		    size = map.getSize(),
-  		    dx = 0,
-  		    dy = 0;
-
-  		if (containerPos.x + containerWidth + paddingBR.x > size.x) { // right
-  			dx = containerPos.x + containerWidth - size.x + paddingBR.x;
-  		}
-  		if (containerPos.x - dx - paddingTL.x < 0) { // left
-  			dx = containerPos.x - paddingTL.x;
-  		}
-  		if (containerPos.y + containerHeight + paddingBR.y > size.y) { // bottom
-  			dy = containerPos.y + containerHeight - size.y + paddingBR.y;
-  		}
-  		if (containerPos.y - dy - paddingTL.y < 0) { // top
-  			dy = containerPos.y - paddingTL.y;
-  		}
-
-  		// @namespace Map
-  		// @section Popup events
-  		// @event autopanstart: Event
-  		// Fired when the map starts autopanning when opening a popup.
-  		if (dx || dy) {
-  			map
-  			    .fire('autopanstart')
-  			    .panBy([dx, dy]);
-  		}
-  	},
-
-  	_onCloseButtonClick: function (e) {
-  		this._close();
-  		stop(e);
-  	},
-
-  	_getAnchor: function () {
-  		// Where should we anchor the popup on the source layer?
-  		return toPoint(this._source && this._source._getPopupAnchor ? this._source._getPopupAnchor() : [0, 0]);
-  	}
-
-  });
-
-  // @namespace Popup
-  // @factory L.popup(options?: Popup options, source?: Layer)
-  // Instantiates a `Popup` object given an optional `options` object that describes its appearance and location and an optional `source` object that is used to tag the popup with a reference to the Layer to which it refers.
-  var popup = function (options, source) {
-  	return new Popup(options, source);
-  };
-
-
-  /* @namespace Map
-   * @section Interaction Options
-   * @option closePopupOnClick: Boolean = true
-   * Set it to `false` if you don't want popups to close when user clicks the map.
-   */
-  Map.mergeOptions({
-  	closePopupOnClick: true
-  });
-
-
-  // @namespace Map
-  // @section Methods for Layers and Controls
-  Map.include({
-  	// @method openPopup(popup: Popup): this
-  	// Opens the specified popup while closing the previously opened (to make sure only one is opened at one time for usability).
-  	// @alternative
-  	// @method openPopup(content: String|HTMLElement, latlng: LatLng, options?: Popup options): this
-  	// Creates a popup with the specified content and options and opens it in the given point on a map.
-  	openPopup: function (popup, latlng, options) {
-  		if (!(popup instanceof Popup)) {
-  			popup = new Popup(options).setContent(popup);
-  		}
-
-  		if (latlng) {
-  			popup.setLatLng(latlng);
-  		}
-
-  		if (this.hasLayer(popup)) {
-  			return this;
-  		}
-
-  		if (this._popup && this._popup.options.autoClose) {
-  			this.closePopup();
-  		}
-
-  		this._popup = popup;
-  		return this.addLayer(popup);
-  	},
-
-  	// @method closePopup(popup?: Popup): this
-  	// Closes the popup previously opened with [openPopup](#map-openpopup) (or the given one).
-  	closePopup: function (popup) {
-  		if (!popup || popup === this._popup) {
-  			popup = this._popup;
-  			this._popup = null;
-  		}
-  		if (popup) {
-  			this.removeLayer(popup);
-  		}
-  		return this;
-  	}
-  });
-
-  /*
-   * @namespace Layer
-   * @section Popup methods example
-   *
-   * All layers share a set of methods convenient for binding popups to it.
-   *
-   * ```js
-   * var layer = L.Polygon(latlngs).bindPopup('Hi There!').addTo(map);
-   * layer.openPopup();
-   * layer.closePopup();
-   * ```
-   *
-   * Popups will also be automatically opened when the layer is clicked on and closed when the layer is removed from the map or another popup is opened.
-   */
-
-  // @section Popup methods
-  Layer.include({
-
-  	// @method bindPopup(content: String|HTMLElement|Function|Popup, options?: Popup options): this
-  	// Binds a popup to the layer with the passed `content` and sets up the
-  	// necessary event listeners. If a `Function` is passed it will receive
-  	// the layer as the first argument and should return a `String` or `HTMLElement`.
-  	bindPopup: function (content, options) {
-
-  		if (content instanceof Popup) {
-  			setOptions(content, options);
-  			this._popup = content;
-  			content._source = this;
-  		} else {
-  			if (!this._popup || options) {
-  				this._popup = new Popup(options, this);
-  			}
-  			this._popup.setContent(content);
-  		}
-
-  		if (!this._popupHandlersAdded) {
-  			this.on({
-  				click: this._openPopup,
-  				keypress: this._onKeyPress,
-  				remove: this.closePopup,
-  				move: this._movePopup
-  			});
-  			this._popupHandlersAdded = true;
-  		}
-
-  		return this;
-  	},
-
-  	// @method unbindPopup(): this
-  	// Removes the popup previously bound with `bindPopup`.
-  	unbindPopup: function () {
-  		if (this._popup) {
-  			this.off({
-  				click: this._openPopup,
-  				keypress: this._onKeyPress,
-  				remove: this.closePopup,
-  				move: this._movePopup
-  			});
-  			this._popupHandlersAdded = false;
-  			this._popup = null;
-  		}
-  		return this;
-  	},
-
-  	// @method openPopup(latlng?: LatLng): this
-  	// Opens the bound popup at the specified `latlng` or at the default popup anchor if no `latlng` is passed.
-  	openPopup: function (layer, latlng) {
-  		if (this._popup && this._map) {
-  			latlng = this._popup._prepareOpen(this, layer, latlng);
-
-  			// open the popup on the map
-  			this._map.openPopup(this._popup, latlng);
-  		}
-
-  		return this;
-  	},
-
-  	// @method closePopup(): this
-  	// Closes the popup bound to this layer if it is open.
-  	closePopup: function () {
-  		if (this._popup) {
-  			this._popup._close();
-  		}
-  		return this;
-  	},
-
-  	// @method togglePopup(): this
-  	// Opens or closes the popup bound to this layer depending on its current state.
-  	togglePopup: function (target) {
-  		if (this._popup) {
-  			if (this._popup._map) {
-  				this.closePopup();
-  			} else {
-  				this.openPopup(target);
-  			}
-  		}
-  		return this;
-  	},
-
-  	// @method isPopupOpen(): boolean
-  	// Returns `true` if the popup bound to this layer is currently open.
-  	isPopupOpen: function () {
-  		return (this._popup ? this._popup.isOpen() : false);
-  	},
-
-  	// @method setPopupContent(content: String|HTMLElement|Popup): this
-  	// Sets the content of the popup bound to this layer.
-  	setPopupContent: function (content) {
-  		if (this._popup) {
-  			this._popup.setContent(content);
-  		}
-  		return this;
-  	},
-
-  	// @method getPopup(): Popup
-  	// Returns the popup bound to this layer.
-  	getPopup: function () {
-  		return this._popup;
-  	},
-
-  	_openPopup: function (e) {
-  		var layer = e.layer || e.target;
-
-  		if (!this._popup) {
-  			return;
-  		}
-
-  		if (!this._map) {
-  			return;
-  		}
-
-  		// prevent map click
-  		stop(e);
-
-  		// if this inherits from Path its a vector and we can just
-  		// open the popup at the new location
-  		if (layer instanceof Path) {
-  			this.openPopup(e.layer || e.target, e.latlng);
-  			return;
-  		}
-
-  		// otherwise treat it like a marker and figure out
-  		// if we should toggle it open/closed
-  		if (this._map.hasLayer(this._popup) && this._popup._source === layer) {
-  			this.closePopup();
-  		} else {
-  			this.openPopup(layer, e.latlng);
-  		}
-  	},
-
-  	_movePopup: function (e) {
-  		this._popup.setLatLng(e.latlng);
-  	},
-
-  	_onKeyPress: function (e) {
-  		if (e.originalEvent.keyCode === 13) {
-  			this._openPopup(e);
-  		}
-  	}
-  });
-
-  /*
-   * @class Tooltip
-   * @inherits DivOverlay
-   * @aka L.Tooltip
-   * Used to display small texts on top of map layers.
-   *
-   * @example
-   *
-   * ```js
-   * marker.bindTooltip("my tooltip text").openTooltip();
-   * ```
-   * Note about tooltip offset. Leaflet takes two options in consideration
-   * for computing tooltip offsetting:
-   * - the `offset` Tooltip option: it defaults to [0, 0], and it's specific to one tooltip.
-   *   Add a positive x offset to move the tooltip to the right, and a positive y offset to
-   *   move it to the bottom. Negatives will move to the left and top.
-   * - the `tooltipAnchor` Icon option: this will only be considered for Marker. You
-   *   should adapt this value if you use a custom icon.
-   */
-
-
-  // @namespace Tooltip
-  var Tooltip = DivOverlay.extend({
-
-  	// @section
-  	// @aka Tooltip options
-  	options: {
-  		// @option pane: String = 'tooltipPane'
-  		// `Map pane` where the tooltip will be added.
-  		pane: 'tooltipPane',
-
-  		// @option offset: Point = Point(0, 0)
-  		// Optional offset of the tooltip position.
-  		offset: [0, 0],
-
-  		// @option direction: String = 'auto'
-  		// Direction where to open the tooltip. Possible values are: `right`, `left`,
-  		// `top`, `bottom`, `center`, `auto`.
-  		// `auto` will dynamically switch between `right` and `left` according to the tooltip
-  		// position on the map.
-  		direction: 'auto',
-
-  		// @option permanent: Boolean = false
-  		// Whether to open the tooltip permanently or only on mouseover.
-  		permanent: false,
-
-  		// @option sticky: Boolean = false
-  		// If true, the tooltip will follow the mouse instead of being fixed at the feature center.
-  		sticky: false,
-
-  		// @option interactive: Boolean = false
-  		// If true, the tooltip will listen to the feature events.
-  		interactive: false,
-
-  		// @option opacity: Number = 0.9
-  		// Tooltip container opacity.
-  		opacity: 0.9
-  	},
-
-  	onAdd: function (map) {
-  		DivOverlay.prototype.onAdd.call(this, map);
-  		this.setOpacity(this.options.opacity);
-
-  		// @namespace Map
-  		// @section Tooltip events
-  		// @event tooltipopen: TooltipEvent
-  		// Fired when a tooltip is opened in the map.
-  		map.fire('tooltipopen', {tooltip: this});
-
-  		if (this._source) {
-  			// @namespace Layer
-  			// @section Tooltip events
-  			// @event tooltipopen: TooltipEvent
-  			// Fired when a tooltip bound to this layer is opened.
-  			this._source.fire('tooltipopen', {tooltip: this}, true);
-  		}
-  	},
-
-  	onRemove: function (map) {
-  		DivOverlay.prototype.onRemove.call(this, map);
-
-  		// @namespace Map
-  		// @section Tooltip events
-  		// @event tooltipclose: TooltipEvent
-  		// Fired when a tooltip in the map is closed.
-  		map.fire('tooltipclose', {tooltip: this});
-
-  		if (this._source) {
-  			// @namespace Layer
-  			// @section Tooltip events
-  			// @event tooltipclose: TooltipEvent
-  			// Fired when a tooltip bound to this layer is closed.
-  			this._source.fire('tooltipclose', {tooltip: this}, true);
-  		}
-  	},
-
-  	getEvents: function () {
-  		var events = DivOverlay.prototype.getEvents.call(this);
-
-  		if (touch && !this.options.permanent) {
-  			events.preclick = this._close;
-  		}
-
-  		return events;
-  	},
-
-  	_close: function () {
-  		if (this._map) {
-  			this._map.closeTooltip(this);
-  		}
-  	},
-
-  	_initLayout: function () {
-  		var prefix = 'leaflet-tooltip',
-  		    className = prefix + ' ' + (this.options.className || '') + ' leaflet-zoom-' + (this._zoomAnimated ? 'animated' : 'hide');
-
-  		this._contentNode = this._container = create$1('div', className);
-  	},
-
-  	_updateLayout: function () {},
-
-  	_adjustPan: function () {},
-
-  	_setPosition: function (pos) {
-  		var subX, subY,
-  		    map = this._map,
-  		    container = this._container,
-  		    centerPoint = map.latLngToContainerPoint(map.getCenter()),
-  		    tooltipPoint = map.layerPointToContainerPoint(pos),
-  		    direction = this.options.direction,
-  		    tooltipWidth = container.offsetWidth,
-  		    tooltipHeight = container.offsetHeight,
-  		    offset = toPoint(this.options.offset),
-  		    anchor = this._getAnchor();
-
-  		if (direction === 'top') {
-  			subX = tooltipWidth / 2;
-  			subY = tooltipHeight;
-  		} else if (direction === 'bottom') {
-  			subX = tooltipWidth / 2;
-  			subY = 0;
-  		} else if (direction === 'center') {
-  			subX = tooltipWidth / 2;
-  			subY = tooltipHeight / 2;
-  		} else if (direction === 'right') {
-  			subX = 0;
-  			subY = tooltipHeight / 2;
-  		} else if (direction === 'left') {
-  			subX = tooltipWidth;
-  			subY = tooltipHeight / 2;
-  		} else if (tooltipPoint.x < centerPoint.x) {
-  			direction = 'right';
-  			subX = 0;
-  			subY = tooltipHeight / 2;
-  		} else {
-  			direction = 'left';
-  			subX = tooltipWidth + (offset.x + anchor.x) * 2;
-  			subY = tooltipHeight / 2;
-  		}
-
-  		pos = pos.subtract(toPoint(subX, subY, true)).add(offset).add(anchor);
-
-  		removeClass(container, 'leaflet-tooltip-right');
-  		removeClass(container, 'leaflet-tooltip-left');
-  		removeClass(container, 'leaflet-tooltip-top');
-  		removeClass(container, 'leaflet-tooltip-bottom');
-  		addClass(container, 'leaflet-tooltip-' + direction);
-  		setPosition(container, pos);
-  	},
-
-  	_updatePosition: function () {
-  		var pos = this._map.latLngToLayerPoint(this._latlng);
-  		this._setPosition(pos);
-  	},
-
-  	setOpacity: function (opacity) {
-  		this.options.opacity = opacity;
-
-  		if (this._container) {
-  			setOpacity(this._container, opacity);
-  		}
-  	},
-
-  	_animateZoom: function (e) {
-  		var pos = this._map._latLngToNewLayerPoint(this._latlng, e.zoom, e.center);
-  		this._setPosition(pos);
-  	},
-
-  	_getAnchor: function () {
-  		// Where should we anchor the tooltip on the source layer?
-  		return toPoint(this._source && this._source._getTooltipAnchor && !this.options.sticky ? this._source._getTooltipAnchor() : [0, 0]);
-  	}
-
-  });
-
-  // @namespace Tooltip
-  // @factory L.tooltip(options?: Tooltip options, source?: Layer)
-  // Instantiates a Tooltip object given an optional `options` object that describes its appearance and location and an optional `source` object that is used to tag the tooltip with a reference to the Layer to which it refers.
-  var tooltip = function (options, source) {
-  	return new Tooltip(options, source);
-  };
-
-  // @namespace Map
-  // @section Methods for Layers and Controls
-  Map.include({
-
-  	// @method openTooltip(tooltip: Tooltip): this
-  	// Opens the specified tooltip.
-  	// @alternative
-  	// @method openTooltip(content: String|HTMLElement, latlng: LatLng, options?: Tooltip options): this
-  	// Creates a tooltip with the specified content and options and open it.
-  	openTooltip: function (tooltip, latlng, options) {
-  		if (!(tooltip instanceof Tooltip)) {
-  			tooltip = new Tooltip(options).setContent(tooltip);
-  		}
-
-  		if (latlng) {
-  			tooltip.setLatLng(latlng);
-  		}
-
-  		if (this.hasLayer(tooltip)) {
-  			return this;
-  		}
-
-  		return this.addLayer(tooltip);
-  	},
-
-  	// @method closeTooltip(tooltip?: Tooltip): this
-  	// Closes the tooltip given as parameter.
-  	closeTooltip: function (tooltip) {
-  		if (tooltip) {
-  			this.removeLayer(tooltip);
-  		}
-  		return this;
-  	}
-
-  });
-
-  /*
-   * @namespace Layer
-   * @section Tooltip methods example
-   *
-   * All layers share a set of methods convenient for binding tooltips to it.
-   *
-   * ```js
-   * var layer = L.Polygon(latlngs).bindTooltip('Hi There!').addTo(map);
-   * layer.openTooltip();
-   * layer.closeTooltip();
-   * ```
-   */
-
-  // @section Tooltip methods
-  Layer.include({
-
-  	// @method bindTooltip(content: String|HTMLElement|Function|Tooltip, options?: Tooltip options): this
-  	// Binds a tooltip to the layer with the passed `content` and sets up the
-  	// necessary event listeners. If a `Function` is passed it will receive
-  	// the layer as the first argument and should return a `String` or `HTMLElement`.
-  	bindTooltip: function (content, options) {
-
-  		if (content instanceof Tooltip) {
-  			setOptions(content, options);
-  			this._tooltip = content;
-  			content._source = this;
-  		} else {
-  			if (!this._tooltip || options) {
-  				this._tooltip = new Tooltip(options, this);
-  			}
-  			this._tooltip.setContent(content);
-
-  		}
-
-  		this._initTooltipInteractions();
-
-  		if (this._tooltip.options.permanent && this._map && this._map.hasLayer(this)) {
-  			this.openTooltip();
-  		}
-
-  		return this;
-  	},
-
-  	// @method unbindTooltip(): this
-  	// Removes the tooltip previously bound with `bindTooltip`.
-  	unbindTooltip: function () {
-  		if (this._tooltip) {
-  			this._initTooltipInteractions(true);
-  			this.closeTooltip();
-  			this._tooltip = null;
-  		}
-  		return this;
-  	},
-
-  	_initTooltipInteractions: function (remove$$1) {
-  		if (!remove$$1 && this._tooltipHandlersAdded) { return; }
-  		var onOff = remove$$1 ? 'off' : 'on',
-  		    events = {
-  			remove: this.closeTooltip,
-  			move: this._moveTooltip
-  		    };
-  		if (!this._tooltip.options.permanent) {
-  			events.mouseover = this._openTooltip;
-  			events.mouseout = this.closeTooltip;
-  			if (this._tooltip.options.sticky) {
-  				events.mousemove = this._moveTooltip;
-  			}
-  			if (touch) {
-  				events.click = this._openTooltip;
-  			}
-  		} else {
-  			events.add = this._openTooltip;
-  		}
-  		this[onOff](events);
-  		this._tooltipHandlersAdded = !remove$$1;
-  	},
-
-  	// @method openTooltip(latlng?: LatLng): this
-  	// Opens the bound tooltip at the specified `latlng` or at the default tooltip anchor if no `latlng` is passed.
-  	openTooltip: function (layer, latlng) {
-  		if (this._tooltip && this._map) {
-  			latlng = this._tooltip._prepareOpen(this, layer, latlng);
-
-  			// open the tooltip on the map
-  			this._map.openTooltip(this._tooltip, latlng);
-
-  			// Tooltip container may not be defined if not permanent and never
-  			// opened.
-  			if (this._tooltip.options.interactive && this._tooltip._container) {
-  				addClass(this._tooltip._container, 'leaflet-clickable');
-  				this.addInteractiveTarget(this._tooltip._container);
-  			}
-  		}
-
-  		return this;
-  	},
-
-  	// @method closeTooltip(): this
-  	// Closes the tooltip bound to this layer if it is open.
-  	closeTooltip: function () {
-  		if (this._tooltip) {
-  			this._tooltip._close();
-  			if (this._tooltip.options.interactive && this._tooltip._container) {
-  				removeClass(this._tooltip._container, 'leaflet-clickable');
-  				this.removeInteractiveTarget(this._tooltip._container);
-  			}
-  		}
-  		return this;
-  	},
-
-  	// @method toggleTooltip(): this
-  	// Opens or closes the tooltip bound to this layer depending on its current state.
-  	toggleTooltip: function (target) {
-  		if (this._tooltip) {
-  			if (this._tooltip._map) {
-  				this.closeTooltip();
-  			} else {
-  				this.openTooltip(target);
-  			}
-  		}
-  		return this;
-  	},
-
-  	// @method isTooltipOpen(): boolean
-  	// Returns `true` if the tooltip bound to this layer is currently open.
-  	isTooltipOpen: function () {
-  		return this._tooltip.isOpen();
-  	},
-
-  	// @method setTooltipContent(content: String|HTMLElement|Tooltip): this
-  	// Sets the content of the tooltip bound to this layer.
-  	setTooltipContent: function (content) {
-  		if (this._tooltip) {
-  			this._tooltip.setContent(content);
-  		}
-  		return this;
-  	},
-
-  	// @method getTooltip(): Tooltip
-  	// Returns the tooltip bound to this layer.
-  	getTooltip: function () {
-  		return this._tooltip;
-  	},
-
-  	_openTooltip: function (e) {
-  		var layer = e.layer || e.target;
-
-  		if (!this._tooltip || !this._map) {
-  			return;
-  		}
-  		this.openTooltip(layer, this._tooltip.options.sticky ? e.latlng : undefined);
-  	},
-
-  	_moveTooltip: function (e) {
-  		var latlng = e.latlng, containerPoint, layerPoint;
-  		if (this._tooltip.options.sticky && e.originalEvent) {
-  			containerPoint = this._map.mouseEventToContainerPoint(e.originalEvent);
-  			layerPoint = this._map.containerPointToLayerPoint(containerPoint);
-  			latlng = this._map.layerPointToLatLng(layerPoint);
-  		}
-  		this._tooltip.setLatLng(latlng);
-  	}
-  });
-
-  /*
-   * @class DivIcon
-   * @aka L.DivIcon
-   * @inherits Icon
-   *
-   * Represents a lightweight icon for markers that uses a simple `<div>`
-   * element instead of an image. Inherits from `Icon` but ignores the `iconUrl` and shadow options.
-   *
-   * @example
-   * ```js
-   * var myIcon = L.divIcon({className: 'my-div-icon'});
-   * // you can set .my-div-icon styles in CSS
-   *
-   * L.marker([50.505, 30.57], {icon: myIcon}).addTo(map);
-   * ```
-   *
-   * By default, it has a 'leaflet-div-icon' CSS class and is styled as a little white square with a shadow.
-   */
-
-  var DivIcon = Icon.extend({
-  	options: {
-  		// @section
-  		// @aka DivIcon options
-  		iconSize: [12, 12], // also can be set through CSS
-
-  		// iconAnchor: (Point),
-  		// popupAnchor: (Point),
-
-  		// @option html: String|HTMLElement = ''
-  		// Custom HTML code to put inside the div element, empty by default. Alternatively,
-  		// an instance of `HTMLElement`.
-  		html: false,
-
-  		// @option bgPos: Point = [0, 0]
-  		// Optional relative position of the background, in pixels
-  		bgPos: null,
-
-  		className: 'leaflet-div-icon'
-  	},
-
-  	createIcon: function (oldIcon) {
-  		var div = (oldIcon && oldIcon.tagName === 'DIV') ? oldIcon : document.createElement('div'),
-  		    options = this.options;
-
-  		if (options.html instanceof Element) {
-  			empty(div);
-  			div.appendChild(options.html);
-  		} else {
-  			div.innerHTML = options.html !== false ? options.html : '';
-  		}
-
-  		if (options.bgPos) {
-  			var bgPos = toPoint(options.bgPos);
-  			div.style.backgroundPosition = (-bgPos.x) + 'px ' + (-bgPos.y) + 'px';
-  		}
-  		this._setIconStyles(div, 'icon');
-
-  		return div;
-  	},
-
-  	createShadow: function () {
-  		return null;
-  	}
-  });
-
-  // @factory L.divIcon(options: DivIcon options)
-  // Creates a `DivIcon` instance with the given options.
-  function divIcon(options) {
-  	return new DivIcon(options);
-  }
-
-  Icon.Default = IconDefault;
-
-  /*
-   * @class GridLayer
-   * @inherits Layer
-   * @aka L.GridLayer
-   *
-   * Generic class for handling a tiled grid of HTML elements. This is the base class for all tile layers and replaces `TileLayer.Canvas`.
-   * GridLayer can be extended to create a tiled grid of HTML elements like `<canvas>`, `<img>` or `<div>`. GridLayer will handle creating and animating these DOM elements for you.
-   *
-   *
-   * @section Synchronous usage
-   * @example
-   *
-   * To create a custom layer, extend GridLayer and implement the `createTile()` method, which will be passed a `Point` object with the `x`, `y`, and `z` (zoom level) coordinates to draw your tile.
-   *
-   * ```js
-   * var CanvasLayer = L.GridLayer.extend({
-   *     createTile: function(coords){
-   *         // create a <canvas> element for drawing
-   *         var tile = L.DomUtil.create('canvas', 'leaflet-tile');
-   *
-   *         // setup tile width and height according to the options
-   *         var size = this.getTileSize();
-   *         tile.width = size.x;
-   *         tile.height = size.y;
-   *
-   *         // get a canvas context and draw something on it using coords.x, coords.y and coords.z
-   *         var ctx = tile.getContext('2d');
-   *
-   *         // return the tile so it can be rendered on screen
-   *         return tile;
-   *     }
-   * });
-   * ```
-   *
-   * @section Asynchronous usage
-   * @example
-   *
-   * Tile creation can also be asynchronous, this is useful when using a third-party drawing library. Once the tile is finished drawing it can be passed to the `done()` callback.
-   *
-   * ```js
-   * var CanvasLayer = L.GridLayer.extend({
-   *     createTile: function(coords, done){
-   *         var error;
-   *
-   *         // create a <canvas> element for drawing
-   *         var tile = L.DomUtil.create('canvas', 'leaflet-tile');
-   *
-   *         // setup tile width and height according to the options
-   *         var size = this.getTileSize();
-   *         tile.width = size.x;
-   *         tile.height = size.y;
-   *
-   *         // draw something asynchronously and pass the tile to the done() callback
-   *         setTimeout(function() {
-   *             done(error, tile);
-   *         }, 1000);
-   *
-   *         return tile;
-   *     }
-   * });
-   * ```
-   *
-   * @section
-   */
-
-
-  var GridLayer = Layer.extend({
-
-  	// @section
-  	// @aka GridLayer options
-  	options: {
-  		// @option tileSize: Number|Point = 256
-  		// Width and height of tiles in the grid. Use a number if width and height are equal, or `L.point(width, height)` otherwise.
-  		tileSize: 256,
-
-  		// @option opacity: Number = 1.0
-  		// Opacity of the tiles. Can be used in the `createTile()` function.
-  		opacity: 1,
-
-  		// @option updateWhenIdle: Boolean = (depends)
-  		// Load new tiles only when panning ends.
-  		// `true` by default on mobile browsers, in order to avoid too many requests and keep smooth navigation.
-  		// `false` otherwise in order to display new tiles _during_ panning, since it is easy to pan outside the
-  		// [`keepBuffer`](#gridlayer-keepbuffer) option in desktop browsers.
-  		updateWhenIdle: mobile,
-
-  		// @option updateWhenZooming: Boolean = true
-  		// By default, a smooth zoom animation (during a [touch zoom](#map-touchzoom) or a [`flyTo()`](#map-flyto)) will update grid layers every integer zoom level. Setting this option to `false` will update the grid layer only when the smooth animation ends.
-  		updateWhenZooming: true,
-
-  		// @option updateInterval: Number = 200
-  		// Tiles will not update more than once every `updateInterval` milliseconds when panning.
-  		updateInterval: 200,
-
-  		// @option zIndex: Number = 1
-  		// The explicit zIndex of the tile layer.
-  		zIndex: 1,
-
-  		// @option bounds: LatLngBounds = undefined
-  		// If set, tiles will only be loaded inside the set `LatLngBounds`.
-  		bounds: null,
-
-  		// @option minZoom: Number = 0
-  		// The minimum zoom level down to which this layer will be displayed (inclusive).
-  		minZoom: 0,
-
-  		// @option maxZoom: Number = undefined
-  		// The maximum zoom level up to which this layer will be displayed (inclusive).
-  		maxZoom: undefined,
-
-  		// @option maxNativeZoom: Number = undefined
-  		// Maximum zoom number the tile source has available. If it is specified,
-  		// the tiles on all zoom levels higher than `maxNativeZoom` will be loaded
-  		// from `maxNativeZoom` level and auto-scaled.
-  		maxNativeZoom: undefined,
-
-  		// @option minNativeZoom: Number = undefined
-  		// Minimum zoom number the tile source has available. If it is specified,
-  		// the tiles on all zoom levels lower than `minNativeZoom` will be loaded
-  		// from `minNativeZoom` level and auto-scaled.
-  		minNativeZoom: undefined,
-
-  		// @option noWrap: Boolean = false
-  		// Whether the layer is wrapped around the antimeridian. If `true`, the
-  		// GridLayer will only be displayed once at low zoom levels. Has no
-  		// effect when the [map CRS](#map-crs) doesn't wrap around. Can be used
-  		// in combination with [`bounds`](#gridlayer-bounds) to prevent requesting
-  		// tiles outside the CRS limits.
-  		noWrap: false,
-
-  		// @option pane: String = 'tilePane'
-  		// `Map pane` where the grid layer will be added.
-  		pane: 'tilePane',
-
-  		// @option className: String = ''
-  		// A custom class name to assign to the tile layer. Empty by default.
-  		className: '',
-
-  		// @option keepBuffer: Number = 2
-  		// When panning the map, keep this many rows and columns of tiles before unloading them.
-  		keepBuffer: 2
-  	},
-
-  	initialize: function (options) {
-  		setOptions(this, options);
-  	},
-
-  	onAdd: function () {
-  		this._initContainer();
-
-  		this._levels = {};
-  		this._tiles = {};
-
-  		this._resetView();
-  		this._update();
-  	},
-
-  	beforeAdd: function (map) {
-  		map._addZoomLimit(this);
-  	},
-
-  	onRemove: function (map) {
-  		this._removeAllTiles();
-  		remove(this._container);
-  		map._removeZoomLimit(this);
-  		this._container = null;
-  		this._tileZoom = undefined;
-  	},
-
-  	// @method bringToFront: this
-  	// Brings the tile layer to the top of all tile layers.
-  	bringToFront: function () {
-  		if (this._map) {
-  			toFront(this._container);
-  			this._setAutoZIndex(Math.max);
-  		}
-  		return this;
-  	},
-
-  	// @method bringToBack: this
-  	// Brings the tile layer to the bottom of all tile layers.
-  	bringToBack: function () {
-  		if (this._map) {
-  			toBack(this._container);
-  			this._setAutoZIndex(Math.min);
-  		}
-  		return this;
-  	},
-
-  	// @method getContainer: HTMLElement
-  	// Returns the HTML element that contains the tiles for this layer.
-  	getContainer: function () {
-  		return this._container;
-  	},
-
-  	// @method setOpacity(opacity: Number): this
-  	// Changes the [opacity](#gridlayer-opacity) of the grid layer.
-  	setOpacity: function (opacity) {
-  		this.options.opacity = opacity;
-  		this._updateOpacity();
-  		return this;
-  	},
-
-  	// @method setZIndex(zIndex: Number): this
-  	// Changes the [zIndex](#gridlayer-zindex) of the grid layer.
-  	setZIndex: function (zIndex) {
-  		this.options.zIndex = zIndex;
-  		this._updateZIndex();
-
-  		return this;
-  	},
-
-  	// @method isLoading: Boolean
-  	// Returns `true` if any tile in the grid layer has not finished loading.
-  	isLoading: function () {
-  		return this._loading;
-  	},
-
-  	// @method redraw: this
-  	// Causes the layer to clear all the tiles and request them again.
-  	redraw: function () {
-  		if (this._map) {
-  			this._removeAllTiles();
-  			this._update();
-  		}
-  		return this;
-  	},
-
-  	getEvents: function () {
-  		var events = {
-  			viewprereset: this._invalidateAll,
-  			viewreset: this._resetView,
-  			zoom: this._resetView,
-  			moveend: this._onMoveEnd
-  		};
-
-  		if (!this.options.updateWhenIdle) {
-  			// update tiles on move, but not more often than once per given interval
-  			if (!this._onMove) {
-  				this._onMove = throttle(this._onMoveEnd, this.options.updateInterval, this);
-  			}
-
-  			events.move = this._onMove;
-  		}
-
-  		if (this._zoomAnimated) {
-  			events.zoomanim = this._animateZoom;
-  		}
-
-  		return events;
-  	},
-
-  	// @section Extension methods
-  	// Layers extending `GridLayer` shall reimplement the following method.
-  	// @method createTile(coords: Object, done?: Function): HTMLElement
-  	// Called only internally, must be overridden by classes extending `GridLayer`.
-  	// Returns the `HTMLElement` corresponding to the given `coords`. If the `done` callback
-  	// is specified, it must be called when the tile has finished loading and drawing.
-  	createTile: function () {
-  		return document.createElement('div');
-  	},
-
-  	// @section
-  	// @method getTileSize: Point
-  	// Normalizes the [tileSize option](#gridlayer-tilesize) into a point. Used by the `createTile()` method.
-  	getTileSize: function () {
-  		var s = this.options.tileSize;
-  		return s instanceof Point ? s : new Point(s, s);
-  	},
-
-  	_updateZIndex: function () {
-  		if (this._container && this.options.zIndex !== undefined && this.options.zIndex !== null) {
-  			this._container.style.zIndex = this.options.zIndex;
-  		}
-  	},
-
-  	_setAutoZIndex: function (compare) {
-  		// go through all other layers of the same pane, set zIndex to max + 1 (front) or min - 1 (back)
-
-  		var layers = this.getPane().children,
-  		    edgeZIndex = -compare(-Infinity, Infinity); // -Infinity for max, Infinity for min
-
-  		for (var i = 0, len = layers.length, zIndex; i < len; i++) {
-
-  			zIndex = layers[i].style.zIndex;
-
-  			if (layers[i] !== this._container && zIndex) {
-  				edgeZIndex = compare(edgeZIndex, +zIndex);
-  			}
-  		}
-
-  		if (isFinite(edgeZIndex)) {
-  			this.options.zIndex = edgeZIndex + compare(-1, 1);
-  			this._updateZIndex();
-  		}
-  	},
-
-  	_updateOpacity: function () {
-  		if (!this._map) { return; }
-
-  		// IE doesn't inherit filter opacity properly, so we're forced to set it on tiles
-  		if (ielt9) { return; }
-
-  		setOpacity(this._container, this.options.opacity);
-
-  		var now = +new Date(),
-  		    nextFrame = false,
-  		    willPrune = false;
-
-  		for (var key in this._tiles) {
-  			var tile = this._tiles[key];
-  			if (!tile.current || !tile.loaded) { continue; }
-
-  			var fade = Math.min(1, (now - tile.loaded) / 200);
-
-  			setOpacity(tile.el, fade);
-  			if (fade < 1) {
-  				nextFrame = true;
-  			} else {
-  				if (tile.active) {
-  					willPrune = true;
-  				} else {
-  					this._onOpaqueTile(tile);
-  				}
-  				tile.active = true;
-  			}
-  		}
-
-  		if (willPrune && !this._noPrune) { this._pruneTiles(); }
-
-  		if (nextFrame) {
-  			cancelAnimFrame(this._fadeFrame);
-  			this._fadeFrame = requestAnimFrame(this._updateOpacity, this);
-  		}
-  	},
-
-  	_onOpaqueTile: falseFn,
-
-  	_initContainer: function () {
-  		if (this._container) { return; }
-
-  		this._container = create$1('div', 'leaflet-layer ' + (this.options.className || ''));
-  		this._updateZIndex();
-
-  		if (this.options.opacity < 1) {
-  			this._updateOpacity();
-  		}
-
-  		this.getPane().appendChild(this._container);
-  	},
-
-  	_updateLevels: function () {
-
-  		var zoom = this._tileZoom,
-  		    maxZoom = this.options.maxZoom;
-
-  		if (zoom === undefined) { return undefined; }
-
-  		for (var z in this._levels) {
-  			z = Number(z);
-  			if (this._levels[z].el.children.length || z === zoom) {
-  				this._levels[z].el.style.zIndex = maxZoom - Math.abs(zoom - z);
-  				this._onUpdateLevel(z);
-  			} else {
-  				remove(this._levels[z].el);
-  				this._removeTilesAtZoom(z);
-  				this._onRemoveLevel(z);
-  				delete this._levels[z];
-  			}
-  		}
-
-  		var level = this._levels[zoom],
-  		    map = this._map;
-
-  		if (!level) {
-  			level = this._levels[zoom] = {};
-
-  			level.el = create$1('div', 'leaflet-tile-container leaflet-zoom-animated', this._container);
-  			level.el.style.zIndex = maxZoom;
-
-  			level.origin = map.project(map.unproject(map.getPixelOrigin()), zoom).round();
-  			level.zoom = zoom;
-
-  			this._setZoomTransform(level, map.getCenter(), map.getZoom());
-
-  			// force the browser to consider the newly added element for transition
-  			falseFn(level.el.offsetWidth);
-
-  			this._onCreateLevel(level);
-  		}
-
-  		this._level = level;
-
-  		return level;
-  	},
-
-  	_onUpdateLevel: falseFn,
-
-  	_onRemoveLevel: falseFn,
-
-  	_onCreateLevel: falseFn,
-
-  	_pruneTiles: function () {
-  		if (!this._map) {
-  			return;
-  		}
-
-  		var key, tile;
-
-  		var zoom = this._map.getZoom();
-  		if (zoom > this.options.maxZoom ||
-  			zoom < this.options.minZoom) {
-  			this._removeAllTiles();
-  			return;
-  		}
-
-  		for (key in this._tiles) {
-  			tile = this._tiles[key];
-  			tile.retain = tile.current;
-  		}
-
-  		for (key in this._tiles) {
-  			tile = this._tiles[key];
-  			if (tile.current && !tile.active) {
-  				var coords = tile.coords;
-  				if (!this._retainParent(coords.x, coords.y, coords.z, coords.z - 5)) {
-  					this._retainChildren(coords.x, coords.y, coords.z, coords.z + 2);
-  				}
-  			}
-  		}
-
-  		for (key in this._tiles) {
-  			if (!this._tiles[key].retain) {
-  				this._removeTile(key);
-  			}
-  		}
-  	},
-
-  	_removeTilesAtZoom: function (zoom) {
-  		for (var key in this._tiles) {
-  			if (this._tiles[key].coords.z !== zoom) {
-  				continue;
-  			}
-  			this._removeTile(key);
-  		}
-  	},
-
-  	_removeAllTiles: function () {
-  		for (var key in this._tiles) {
-  			this._removeTile(key);
-  		}
-  	},
-
-  	_invalidateAll: function () {
-  		for (var z in this._levels) {
-  			remove(this._levels[z].el);
-  			this._onRemoveLevel(Number(z));
-  			delete this._levels[z];
-  		}
-  		this._removeAllTiles();
-
-  		this._tileZoom = undefined;
-  	},
-
-  	_retainParent: function (x, y, z, minZoom) {
-  		var x2 = Math.floor(x / 2),
-  		    y2 = Math.floor(y / 2),
-  		    z2 = z - 1,
-  		    coords2 = new Point(+x2, +y2);
-  		coords2.z = +z2;
-
-  		var key = this._tileCoordsToKey(coords2),
-  		    tile = this._tiles[key];
-
-  		if (tile && tile.active) {
-  			tile.retain = true;
-  			return true;
-
-  		} else if (tile && tile.loaded) {
-  			tile.retain = true;
-  		}
-
-  		if (z2 > minZoom) {
-  			return this._retainParent(x2, y2, z2, minZoom);
-  		}
-
-  		return false;
-  	},
-
-  	_retainChildren: function (x, y, z, maxZoom) {
-
-  		for (var i = 2 * x; i < 2 * x + 2; i++) {
-  			for (var j = 2 * y; j < 2 * y + 2; j++) {
-
-  				var coords = new Point(i, j);
-  				coords.z = z + 1;
-
-  				var key = this._tileCoordsToKey(coords),
-  				    tile = this._tiles[key];
-
-  				if (tile && tile.active) {
-  					tile.retain = true;
-  					continue;
-
-  				} else if (tile && tile.loaded) {
-  					tile.retain = true;
-  				}
-
-  				if (z + 1 < maxZoom) {
-  					this._retainChildren(i, j, z + 1, maxZoom);
-  				}
-  			}
-  		}
-  	},
-
-  	_resetView: function (e) {
-  		var animating = e && (e.pinch || e.flyTo);
-  		this._setView(this._map.getCenter(), this._map.getZoom(), animating, animating);
-  	},
-
-  	_animateZoom: function (e) {
-  		this._setView(e.center, e.zoom, true, e.noUpdate);
-  	},
-
-  	_clampZoom: function (zoom) {
-  		var options = this.options;
-
-  		if (undefined !== options.minNativeZoom && zoom < options.minNativeZoom) {
-  			return options.minNativeZoom;
-  		}
-
-  		if (undefined !== options.maxNativeZoom && options.maxNativeZoom < zoom) {
-  			return options.maxNativeZoom;
-  		}
-
-  		return zoom;
-  	},
-
-  	_setView: function (center, zoom, noPrune, noUpdate) {
-  		var tileZoom = Math.round(zoom);
-  		if ((this.options.maxZoom !== undefined && tileZoom > this.options.maxZoom) ||
-  		    (this.options.minZoom !== undefined && tileZoom < this.options.minZoom)) {
-  			tileZoom = undefined;
-  		} else {
-  			tileZoom = this._clampZoom(tileZoom);
-  		}
-
-  		var tileZoomChanged = this.options.updateWhenZooming && (tileZoom !== this._tileZoom);
-
-  		if (!noUpdate || tileZoomChanged) {
-
-  			this._tileZoom = tileZoom;
-
-  			if (this._abortLoading) {
-  				this._abortLoading();
-  			}
-
-  			this._updateLevels();
-  			this._resetGrid();
-
-  			if (tileZoom !== undefined) {
-  				this._update(center);
-  			}
-
-  			if (!noPrune) {
-  				this._pruneTiles();
-  			}
-
-  			// Flag to prevent _updateOpacity from pruning tiles during
-  			// a zoom anim or a pinch gesture
-  			this._noPrune = !!noPrune;
-  		}
-
-  		this._setZoomTransforms(center, zoom);
-  	},
-
-  	_setZoomTransforms: function (center, zoom) {
-  		for (var i in this._levels) {
-  			this._setZoomTransform(this._levels[i], center, zoom);
-  		}
-  	},
-
-  	_setZoomTransform: function (level, center, zoom) {
-  		var scale = this._map.getZoomScale(zoom, level.zoom),
-  		    translate = level.origin.multiplyBy(scale)
-  		        .subtract(this._map._getNewPixelOrigin(center, zoom)).round();
-
-  		if (any3d) {
-  			setTransform(level.el, translate, scale);
-  		} else {
-  			setPosition(level.el, translate);
-  		}
-  	},
-
-  	_resetGrid: function () {
-  		var map = this._map,
-  		    crs = map.options.crs,
-  		    tileSize = this._tileSize = this.getTileSize(),
-  		    tileZoom = this._tileZoom;
-
-  		var bounds = this._map.getPixelWorldBounds(this._tileZoom);
-  		if (bounds) {
-  			this._globalTileRange = this._pxBoundsToTileRange(bounds);
-  		}
-
-  		this._wrapX = crs.wrapLng && !this.options.noWrap && [
-  			Math.floor(map.project([0, crs.wrapLng[0]], tileZoom).x / tileSize.x),
-  			Math.ceil(map.project([0, crs.wrapLng[1]], tileZoom).x / tileSize.y)
-  		];
-  		this._wrapY = crs.wrapLat && !this.options.noWrap && [
-  			Math.floor(map.project([crs.wrapLat[0], 0], tileZoom).y / tileSize.x),
-  			Math.ceil(map.project([crs.wrapLat[1], 0], tileZoom).y / tileSize.y)
-  		];
-  	},
-
-  	_onMoveEnd: function () {
-  		if (!this._map || this._map._animatingZoom) { return; }
-
-  		this._update();
-  	},
-
-  	_getTiledPixelBounds: function (center) {
-  		var map = this._map,
-  		    mapZoom = map._animatingZoom ? Math.max(map._animateToZoom, map.getZoom()) : map.getZoom(),
-  		    scale = map.getZoomScale(mapZoom, this._tileZoom),
-  		    pixelCenter = map.project(center, this._tileZoom).floor(),
-  		    halfSize = map.getSize().divideBy(scale * 2);
-
-  		return new Bounds(pixelCenter.subtract(halfSize), pixelCenter.add(halfSize));
-  	},
-
-  	// Private method to load tiles in the grid's active zoom level according to map bounds
-  	_update: function (center) {
-  		var map = this._map;
-  		if (!map) { return; }
-  		var zoom = this._clampZoom(map.getZoom());
-
-  		if (center === undefined) { center = map.getCenter(); }
-  		if (this._tileZoom === undefined) { return; }	// if out of minzoom/maxzoom
-
-  		var pixelBounds = this._getTiledPixelBounds(center),
-  		    tileRange = this._pxBoundsToTileRange(pixelBounds),
-  		    tileCenter = tileRange.getCenter(),
-  		    queue = [],
-  		    margin = this.options.keepBuffer,
-  		    noPruneRange = new Bounds(tileRange.getBottomLeft().subtract([margin, -margin]),
-  		                              tileRange.getTopRight().add([margin, -margin]));
-
-  		// Sanity check: panic if the tile range contains Infinity somewhere.
-  		if (!(isFinite(tileRange.min.x) &&
-  		      isFinite(tileRange.min.y) &&
-  		      isFinite(tileRange.max.x) &&
-  		      isFinite(tileRange.max.y))) { throw new Error('Attempted to load an infinite number of tiles'); }
-
-  		for (var key in this._tiles) {
-  			var c = this._tiles[key].coords;
-  			if (c.z !== this._tileZoom || !noPruneRange.contains(new Point(c.x, c.y))) {
-  				this._tiles[key].current = false;
-  			}
-  		}
-
-  		// _update just loads more tiles. If the tile zoom level differs too much
-  		// from the map's, let _setView reset levels and prune old tiles.
-  		if (Math.abs(zoom - this._tileZoom) > 1) { this._setView(center, zoom); return; }
-
-  		// create a queue of coordinates to load tiles from
-  		for (var j = tileRange.min.y; j <= tileRange.max.y; j++) {
-  			for (var i = tileRange.min.x; i <= tileRange.max.x; i++) {
-  				var coords = new Point(i, j);
-  				coords.z = this._tileZoom;
-
-  				if (!this._isValidTile(coords)) { continue; }
-
-  				var tile = this._tiles[this._tileCoordsToKey(coords)];
-  				if (tile) {
-  					tile.current = true;
-  				} else {
-  					queue.push(coords);
-  				}
-  			}
-  		}
-
-  		// sort tile queue to load tiles in order of their distance to center
-  		queue.sort(function (a, b) {
-  			return a.distanceTo(tileCenter) - b.distanceTo(tileCenter);
-  		});
-
-  		if (queue.length !== 0) {
-  			// if it's the first batch of tiles to load
-  			if (!this._loading) {
-  				this._loading = true;
-  				// @event loading: Event
-  				// Fired when the grid layer starts loading tiles.
-  				this.fire('loading');
-  			}
-
-  			// create DOM fragment to append tiles in one batch
-  			var fragment = document.createDocumentFragment();
-
-  			for (i = 0; i < queue.length; i++) {
-  				this._addTile(queue[i], fragment);
-  			}
-
-  			this._level.el.appendChild(fragment);
-  		}
-  	},
-
-  	_isValidTile: function (coords) {
-  		var crs = this._map.options.crs;
-
-  		if (!crs.infinite) {
-  			// don't load tile if it's out of bounds and not wrapped
-  			var bounds = this._globalTileRange;
-  			if ((!crs.wrapLng && (coords.x < bounds.min.x || coords.x > bounds.max.x)) ||
-  			    (!crs.wrapLat && (coords.y < bounds.min.y || coords.y > bounds.max.y))) { return false; }
-  		}
-
-  		if (!this.options.bounds) { return true; }
-
-  		// don't load tile if it doesn't intersect the bounds in options
-  		var tileBounds = this._tileCoordsToBounds(coords);
-  		return toLatLngBounds(this.options.bounds).overlaps(tileBounds);
-  	},
-
-  	_keyToBounds: function (key) {
-  		return this._tileCoordsToBounds(this._keyToTileCoords(key));
-  	},
-
-  	_tileCoordsToNwSe: function (coords) {
-  		var map = this._map,
-  		    tileSize = this.getTileSize(),
-  		    nwPoint = coords.scaleBy(tileSize),
-  		    sePoint = nwPoint.add(tileSize),
-  		    nw = map.unproject(nwPoint, coords.z),
-  		    se = map.unproject(sePoint, coords.z);
-  		return [nw, se];
-  	},
-
-  	// converts tile coordinates to its geographical bounds
-  	_tileCoordsToBounds: function (coords) {
-  		var bp = this._tileCoordsToNwSe(coords),
-  		    bounds = new LatLngBounds(bp[0], bp[1]);
-
-  		if (!this.options.noWrap) {
-  			bounds = this._map.wrapLatLngBounds(bounds);
-  		}
-  		return bounds;
-  	},
-  	// converts tile coordinates to key for the tile cache
-  	_tileCoordsToKey: function (coords) {
-  		return coords.x + ':' + coords.y + ':' + coords.z;
-  	},
-
-  	// converts tile cache key to coordinates
-  	_keyToTileCoords: function (key) {
-  		var k = key.split(':'),
-  		    coords = new Point(+k[0], +k[1]);
-  		coords.z = +k[2];
-  		return coords;
-  	},
-
-  	_removeTile: function (key) {
-  		var tile = this._tiles[key];
-  		if (!tile) { return; }
-
-  		remove(tile.el);
-
-  		delete this._tiles[key];
-
-  		// @event tileunload: TileEvent
-  		// Fired when a tile is removed (e.g. when a tile goes off the screen).
-  		this.fire('tileunload', {
-  			tile: tile.el,
-  			coords: this._keyToTileCoords(key)
-  		});
-  	},
-
-  	_initTile: function (tile) {
-  		addClass(tile, 'leaflet-tile');
-
-  		var tileSize = this.getTileSize();
-  		tile.style.width = tileSize.x + 'px';
-  		tile.style.height = tileSize.y + 'px';
-
-  		tile.onselectstart = falseFn;
-  		tile.onmousemove = falseFn;
-
-  		// update opacity on tiles in IE7-8 because of filter inheritance problems
-  		if (ielt9 && this.options.opacity < 1) {
-  			setOpacity(tile, this.options.opacity);
-  		}
-
-  		// without this hack, tiles disappear after zoom on Chrome for Android
-  		// https://github.com/Leaflet/Leaflet/issues/2078
-  		if (android && !android23) {
-  			tile.style.WebkitBackfaceVisibility = 'hidden';
-  		}
-  	},
-
-  	_addTile: function (coords, container) {
-  		var tilePos = this._getTilePos(coords),
-  		    key = this._tileCoordsToKey(coords);
-
-  		var tile = this.createTile(this._wrapCoords(coords), bind(this._tileReady, this, coords));
-
-  		this._initTile(tile);
-
-  		// if createTile is defined with a second argument ("done" callback),
-  		// we know that tile is async and will be ready later; otherwise
-  		if (this.createTile.length < 2) {
-  			// mark tile as ready, but delay one frame for opacity animation to happen
-  			requestAnimFrame(bind(this._tileReady, this, coords, null, tile));
-  		}
-
-  		setPosition(tile, tilePos);
-
-  		// save tile in cache
-  		this._tiles[key] = {
-  			el: tile,
-  			coords: coords,
-  			current: true
-  		};
-
-  		container.appendChild(tile);
-  		// @event tileloadstart: TileEvent
-  		// Fired when a tile is requested and starts loading.
-  		this.fire('tileloadstart', {
-  			tile: tile,
-  			coords: coords
-  		});
-  	},
-
-  	_tileReady: function (coords, err, tile) {
-  		if (err) {
-  			// @event tileerror: TileErrorEvent
-  			// Fired when there is an error loading a tile.
-  			this.fire('tileerror', {
-  				error: err,
-  				tile: tile,
-  				coords: coords
-  			});
-  		}
-
-  		var key = this._tileCoordsToKey(coords);
-
-  		tile = this._tiles[key];
-  		if (!tile) { return; }
-
-  		tile.loaded = +new Date();
-  		if (this._map._fadeAnimated) {
-  			setOpacity(tile.el, 0);
-  			cancelAnimFrame(this._fadeFrame);
-  			this._fadeFrame = requestAnimFrame(this._updateOpacity, this);
-  		} else {
-  			tile.active = true;
-  			this._pruneTiles();
-  		}
-
-  		if (!err) {
-  			addClass(tile.el, 'leaflet-tile-loaded');
-
-  			// @event tileload: TileEvent
-  			// Fired when a tile loads.
-  			this.fire('tileload', {
-  				tile: tile.el,
-  				coords: coords
-  			});
-  		}
-
-  		if (this._noTilesToLoad()) {
-  			this._loading = false;
-  			// @event load: Event
-  			// Fired when the grid layer loaded all visible tiles.
-  			this.fire('load');
-
-  			if (ielt9 || !this._map._fadeAnimated) {
-  				requestAnimFrame(this._pruneTiles, this);
-  			} else {
-  				// Wait a bit more than 0.2 secs (the duration of the tile fade-in)
-  				// to trigger a pruning.
-  				setTimeout(bind(this._pruneTiles, this), 250);
-  			}
-  		}
-  	},
-
-  	_getTilePos: function (coords) {
-  		return coords.scaleBy(this.getTileSize()).subtract(this._level.origin);
-  	},
-
-  	_wrapCoords: function (coords) {
-  		var newCoords = new Point(
-  			this._wrapX ? wrapNum(coords.x, this._wrapX) : coords.x,
-  			this._wrapY ? wrapNum(coords.y, this._wrapY) : coords.y);
-  		newCoords.z = coords.z;
-  		return newCoords;
-  	},
-
-  	_pxBoundsToTileRange: function (bounds) {
-  		var tileSize = this.getTileSize();
-  		return new Bounds(
-  			bounds.min.unscaleBy(tileSize).floor(),
-  			bounds.max.unscaleBy(tileSize).ceil().subtract([1, 1]));
-  	},
-
-  	_noTilesToLoad: function () {
-  		for (var key in this._tiles) {
-  			if (!this._tiles[key].loaded) { return false; }
-  		}
-  		return true;
-  	}
-  });
-
-  // @factory L.gridLayer(options?: GridLayer options)
-  // Creates a new instance of GridLayer with the supplied options.
-  function gridLayer(options) {
-  	return new GridLayer(options);
-  }
-
-  /*
-   * @class TileLayer
-   * @inherits GridLayer
-   * @aka L.TileLayer
-   * Used to load and display tile layers on the map. Note that most tile servers require attribution, which you can set under `Layer`. Extends `GridLayer`.
-   *
-   * @example
-   *
-   * ```js
-   * L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png?{foo}', {foo: 'bar', attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>'}).addTo(map);
-   * ```
-   *
-   * @section URL template
-   * @example
-   *
-   * A string of the following form:
-   *
-   * ```
-   * 'http://{s}.somedomain.com/blabla/{z}/{x}/{y}{r}.png'
-   * ```
-   *
-   * `{s}` means one of the available subdomains (used sequentially to help with browser parallel requests per domain limitation; subdomain values are specified in options; `a`, `b` or `c` by default, can be omitted), `{z}` — zoom level, `{x}` and `{y}` — tile coordinates. `{r}` can be used to add "&commat;2x" to the URL to load retina tiles.
-   *
-   * You can use custom keys in the template, which will be [evaluated](#util-template) from TileLayer options, like this:
-   *
-   * ```
-   * L.tileLayer('http://{s}.somedomain.com/{foo}/{z}/{x}/{y}.png', {foo: 'bar'});
-   * ```
-   */
-
-
-  var TileLayer = GridLayer.extend({
-
-  	// @section
-  	// @aka TileLayer options
-  	options: {
-  		// @option minZoom: Number = 0
-  		// The minimum zoom level down to which this layer will be displayed (inclusive).
-  		minZoom: 0,
-
-  		// @option maxZoom: Number = 18
-  		// The maximum zoom level up to which this layer will be displayed (inclusive).
-  		maxZoom: 18,
-
-  		// @option subdomains: String|String[] = 'abc'
-  		// Subdomains of the tile service. Can be passed in the form of one string (where each letter is a subdomain name) or an array of strings.
-  		subdomains: 'abc',
-
-  		// @option errorTileUrl: String = ''
-  		// URL to the tile image to show in place of the tile that failed to load.
-  		errorTileUrl: '',
-
-  		// @option zoomOffset: Number = 0
-  		// The zoom number used in tile URLs will be offset with this value.
-  		zoomOffset: 0,
-
-  		// @option tms: Boolean = false
-  		// If `true`, inverses Y axis numbering for tiles (turn this on for [TMS](https://en.wikipedia.org/wiki/Tile_Map_Service) services).
-  		tms: false,
-
-  		// @option zoomReverse: Boolean = false
-  		// If set to true, the zoom number used in tile URLs will be reversed (`maxZoom - zoom` instead of `zoom`)
-  		zoomReverse: false,
-
-  		// @option detectRetina: Boolean = false
-  		// If `true` and user is on a retina display, it will request four tiles of half the specified size and a bigger zoom level in place of one to utilize the high resolution.
-  		detectRetina: false,
-
-  		// @option crossOrigin: Boolean|String = false
-  		// Whether the crossOrigin attribute will be added to the tiles.
-  		// If a String is provided, all tiles will have their crossOrigin attribute set to the String provided. This is needed if you want to access tile pixel data.
-  		// Refer to [CORS Settings](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes) for valid String values.
-  		crossOrigin: false
-  	},
-
-  	initialize: function (url, options) {
-
-  		this._url = url;
-
-  		options = setOptions(this, options);
-
-  		// detecting retina displays, adjusting tileSize and zoom levels
-  		if (options.detectRetina && retina && options.maxZoom > 0) {
-
-  			options.tileSize = Math.floor(options.tileSize / 2);
-
-  			if (!options.zoomReverse) {
-  				options.zoomOffset++;
-  				options.maxZoom--;
-  			} else {
-  				options.zoomOffset--;
-  				options.minZoom++;
-  			}
-
-  			options.minZoom = Math.max(0, options.minZoom);
-  		}
-
-  		if (typeof options.subdomains === 'string') {
-  			options.subdomains = options.subdomains.split('');
-  		}
-
-  		// for https://github.com/Leaflet/Leaflet/issues/137
-  		if (!android) {
-  			this.on('tileunload', this._onTileRemove);
-  		}
-  	},
-
-  	// @method setUrl(url: String, noRedraw?: Boolean): this
-  	// Updates the layer's URL template and redraws it (unless `noRedraw` is set to `true`).
-  	// If the URL does not change, the layer will not be redrawn unless
-  	// the noRedraw parameter is set to false.
-  	setUrl: function (url, noRedraw) {
-  		if (this._url === url && noRedraw === undefined) {
-  			noRedraw = true;
-  		}
-
-  		this._url = url;
-
-  		if (!noRedraw) {
-  			this.redraw();
-  		}
-  		return this;
-  	},
-
-  	// @method createTile(coords: Object, done?: Function): HTMLElement
-  	// Called only internally, overrides GridLayer's [`createTile()`](#gridlayer-createtile)
-  	// to return an `<img>` HTML element with the appropriate image URL given `coords`. The `done`
-  	// callback is called when the tile has been loaded.
-  	createTile: function (coords, done) {
-  		var tile = document.createElement('img');
-
-  		on(tile, 'load', bind(this._tileOnLoad, this, done, tile));
-  		on(tile, 'error', bind(this._tileOnError, this, done, tile));
-
-  		if (this.options.crossOrigin || this.options.crossOrigin === '') {
-  			tile.crossOrigin = this.options.crossOrigin === true ? '' : this.options.crossOrigin;
-  		}
-
-  		/*
-  		 Alt tag is set to empty string to keep screen readers from reading URL and for compliance reasons
-  		 http://www.w3.org/TR/WCAG20-TECHS/H67
-  		*/
-  		tile.alt = '';
-
-  		/*
-  		 Set role="presentation" to force screen readers to ignore this
-  		 https://www.w3.org/TR/wai-aria/roles#textalternativecomputation
-  		*/
-  		tile.setAttribute('role', 'presentation');
-
-  		tile.src = this.getTileUrl(coords);
-
-  		return tile;
-  	},
-
-  	// @section Extension methods
-  	// @uninheritable
-  	// Layers extending `TileLayer` might reimplement the following method.
-  	// @method getTileUrl(coords: Object): String
-  	// Called only internally, returns the URL for a tile given its coordinates.
-  	// Classes extending `TileLayer` can override this function to provide custom tile URL naming schemes.
-  	getTileUrl: function (coords) {
-  		var data = {
-  			r: retina ? '@2x' : '',
-  			s: this._getSubdomain(coords),
-  			x: coords.x,
-  			y: coords.y,
-  			z: this._getZoomForUrl()
-  		};
-  		if (this._map && !this._map.options.crs.infinite) {
-  			var invertedY = this._globalTileRange.max.y - coords.y;
-  			if (this.options.tms) {
-  				data['y'] = invertedY;
-  			}
-  			data['-y'] = invertedY;
-  		}
-
-  		return template(this._url, extend(data, this.options));
-  	},
-
-  	_tileOnLoad: function (done, tile) {
-  		// For https://github.com/Leaflet/Leaflet/issues/3332
-  		if (ielt9) {
-  			setTimeout(bind(done, this, null, tile), 0);
-  		} else {
-  			done(null, tile);
-  		}
-  	},
-
-  	_tileOnError: function (done, tile, e) {
-  		var errorUrl = this.options.errorTileUrl;
-  		if (errorUrl && tile.getAttribute('src') !== errorUrl) {
-  			tile.src = errorUrl;
-  		}
-  		done(e, tile);
-  	},
-
-  	_onTileRemove: function (e) {
-  		e.tile.onload = null;
-  	},
-
-  	_getZoomForUrl: function () {
-  		var zoom = this._tileZoom,
-  		maxZoom = this.options.maxZoom,
-  		zoomReverse = this.options.zoomReverse,
-  		zoomOffset = this.options.zoomOffset;
-
-  		if (zoomReverse) {
-  			zoom = maxZoom - zoom;
-  		}
-
-  		return zoom + zoomOffset;
-  	},
-
-  	_getSubdomain: function (tilePoint) {
-  		var index = Math.abs(tilePoint.x + tilePoint.y) % this.options.subdomains.length;
-  		return this.options.subdomains[index];
-  	},
-
-  	// stops loading all tiles in the background layer
-  	_abortLoading: function () {
-  		var i, tile;
-  		for (i in this._tiles) {
-  			if (this._tiles[i].coords.z !== this._tileZoom) {
-  				tile = this._tiles[i].el;
-
-  				tile.onload = falseFn;
-  				tile.onerror = falseFn;
-
-  				if (!tile.complete) {
-  					tile.src = emptyImageUrl;
-  					remove(tile);
-  					delete this._tiles[i];
-  				}
-  			}
-  		}
-  	},
-
-  	_removeTile: function (key) {
-  		var tile = this._tiles[key];
-  		if (!tile) { return; }
-
-  		// Cancels any pending http requests associated with the tile
-  		// unless we're on Android's stock browser,
-  		// see https://github.com/Leaflet/Leaflet/issues/137
-  		if (!androidStock) {
-  			tile.el.setAttribute('src', emptyImageUrl);
-  		}
-
-  		return GridLayer.prototype._removeTile.call(this, key);
-  	},
-
-  	_tileReady: function (coords, err, tile) {
-  		if (!this._map || (tile && tile.getAttribute('src') === emptyImageUrl)) {
-  			return;
-  		}
-
-  		return GridLayer.prototype._tileReady.call(this, coords, err, tile);
-  	}
-  });
-
-
-  // @factory L.tilelayer(urlTemplate: String, options?: TileLayer options)
-  // Instantiates a tile layer object given a `URL template` and optionally an options object.
-
-  function tileLayer(url, options) {
-  	return new TileLayer(url, options);
-  }
-
-  /*
-   * @class TileLayer.WMS
-   * @inherits TileLayer
-   * @aka L.TileLayer.WMS
-   * Used to display [WMS](https://en.wikipedia.org/wiki/Web_Map_Service) services as tile layers on the map. Extends `TileLayer`.
-   *
-   * @example
-   *
-   * ```js
-   * var nexrad = L.tileLayer.wms("http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi", {
-   * 	layers: 'nexrad-n0r-900913',
-   * 	format: 'image/png',
-   * 	transparent: true,
-   * 	attribution: "Weather data © 2012 IEM Nexrad"
-   * });
-   * ```
-   */
-
-  var TileLayerWMS = TileLayer.extend({
-
-  	// @section
-  	// @aka TileLayer.WMS options
-  	// If any custom options not documented here are used, they will be sent to the
-  	// WMS server as extra parameters in each request URL. This can be useful for
-  	// [non-standard vendor WMS parameters](http://docs.geoserver.org/stable/en/user/services/wms/vendor.html).
-  	defaultWmsParams: {
-  		service: 'WMS',
-  		request: 'GetMap',
-
-  		// @option layers: String = ''
-  		// **(required)** Comma-separated list of WMS layers to show.
-  		layers: '',
-
-  		// @option styles: String = ''
-  		// Comma-separated list of WMS styles.
-  		styles: '',
-
-  		// @option format: String = 'image/jpeg'
-  		// WMS image format (use `'image/png'` for layers with transparency).
-  		format: 'image/jpeg',
-
-  		// @option transparent: Boolean = false
-  		// If `true`, the WMS service will return images with transparency.
-  		transparent: false,
-
-  		// @option version: String = '1.1.1'
-  		// Version of the WMS service to use
-  		version: '1.1.1'
-  	},
-
-  	options: {
-  		// @option crs: CRS = null
-  		// Coordinate Reference System to use for the WMS requests, defaults to
-  		// map CRS. Don't change this if you're not sure what it means.
-  		crs: null,
-
-  		// @option uppercase: Boolean = false
-  		// If `true`, WMS request parameter keys will be uppercase.
-  		uppercase: false
-  	},
-
-  	initialize: function (url, options) {
-
-  		this._url = url;
-
-  		var wmsParams = extend({}, this.defaultWmsParams);
-
-  		// all keys that are not TileLayer options go to WMS params
-  		for (var i in options) {
-  			if (!(i in this.options)) {
-  				wmsParams[i] = options[i];
-  			}
-  		}
-
-  		options = setOptions(this, options);
-
-  		var realRetina = options.detectRetina && retina ? 2 : 1;
-  		var tileSize = this.getTileSize();
-  		wmsParams.width = tileSize.x * realRetina;
-  		wmsParams.height = tileSize.y * realRetina;
-
-  		this.wmsParams = wmsParams;
-  	},
-
-  	onAdd: function (map) {
-
-  		this._crs = this.options.crs || map.options.crs;
-  		this._wmsVersion = parseFloat(this.wmsParams.version);
-
-  		var projectionKey = this._wmsVersion >= 1.3 ? 'crs' : 'srs';
-  		this.wmsParams[projectionKey] = this._crs.code;
-
-  		TileLayer.prototype.onAdd.call(this, map);
-  	},
-
-  	getTileUrl: function (coords) {
-
-  		var tileBounds = this._tileCoordsToNwSe(coords),
-  		    crs = this._crs,
-  		    bounds = toBounds(crs.project(tileBounds[0]), crs.project(tileBounds[1])),
-  		    min = bounds.min,
-  		    max = bounds.max,
-  		    bbox = (this._wmsVersion >= 1.3 && this._crs === EPSG4326 ?
-  		    [min.y, min.x, max.y, max.x] :
-  		    [min.x, min.y, max.x, max.y]).join(','),
-  		    url = TileLayer.prototype.getTileUrl.call(this, coords);
-  		return url +
-  			getParamString(this.wmsParams, url, this.options.uppercase) +
-  			(this.options.uppercase ? '&BBOX=' : '&bbox=') + bbox;
-  	},
-
-  	// @method setParams(params: Object, noRedraw?: Boolean): this
-  	// Merges an object with the new parameters and re-requests tiles on the current screen (unless `noRedraw` was set to true).
-  	setParams: function (params, noRedraw) {
-
-  		extend(this.wmsParams, params);
-
-  		if (!noRedraw) {
-  			this.redraw();
-  		}
-
-  		return this;
-  	}
-  });
-
-
-  // @factory L.tileLayer.wms(baseUrl: String, options: TileLayer.WMS options)
-  // Instantiates a WMS tile layer object given a base URL of the WMS service and a WMS parameters/options object.
-  function tileLayerWMS(url, options) {
-  	return new TileLayerWMS(url, options);
-  }
-
-  TileLayer.WMS = TileLayerWMS;
-  tileLayer.wms = tileLayerWMS;
-
-  /*
-   * @class Renderer
-   * @inherits Layer
-   * @aka L.Renderer
-   *
-   * Base class for vector renderer implementations (`SVG`, `Canvas`). Handles the
-   * DOM container of the renderer, its bounds, and its zoom animation.
-   *
-   * A `Renderer` works as an implicit layer group for all `Path`s - the renderer
-   * itself can be added or removed to the map. All paths use a renderer, which can
-   * be implicit (the map will decide the type of renderer and use it automatically)
-   * or explicit (using the [`renderer`](#path-renderer) option of the path).
-   *
-   * Do not use this class directly, use `SVG` and `Canvas` instead.
-   *
-   * @event update: Event
-   * Fired when the renderer updates its bounds, center and zoom, for example when
-   * its map has moved
-   */
-
-  var Renderer = Layer.extend({
-
-  	// @section
-  	// @aka Renderer options
-  	options: {
-  		// @option padding: Number = 0.1
-  		// How much to extend the clip area around the map view (relative to its size)
-  		// e.g. 0.1 would be 10% of map view in each direction
-  		padding: 0.1,
-
-  		// @option tolerance: Number = 0
-  		// How much to extend click tolerance round a path/object on the map
-  		tolerance : 0
-  	},
-
-  	initialize: function (options) {
-  		setOptions(this, options);
-  		stamp(this);
-  		this._layers = this._layers || {};
-  	},
-
-  	onAdd: function () {
-  		if (!this._container) {
-  			this._initContainer(); // defined by renderer implementations
-
-  			if (this._zoomAnimated) {
-  				addClass(this._container, 'leaflet-zoom-animated');
-  			}
-  		}
-
-  		this.getPane().appendChild(this._container);
-  		this._update();
-  		this.on('update', this._updatePaths, this);
-  	},
-
-  	onRemove: function () {
-  		this.off('update', this._updatePaths, this);
-  		this._destroyContainer();
-  	},
-
-  	getEvents: function () {
-  		var events = {
-  			viewreset: this._reset,
-  			zoom: this._onZoom,
-  			moveend: this._update,
-  			zoomend: this._onZoomEnd
-  		};
-  		if (this._zoomAnimated) {
-  			events.zoomanim = this._onAnimZoom;
-  		}
-  		return events;
-  	},
-
-  	_onAnimZoom: function (ev) {
-  		this._updateTransform(ev.center, ev.zoom);
-  	},
-
-  	_onZoom: function () {
-  		this._updateTransform(this._map.getCenter(), this._map.getZoom());
-  	},
-
-  	_updateTransform: function (center, zoom) {
-  		var scale = this._map.getZoomScale(zoom, this._zoom),
-  		    position = getPosition(this._container),
-  		    viewHalf = this._map.getSize().multiplyBy(0.5 + this.options.padding),
-  		    currentCenterPoint = this._map.project(this._center, zoom),
-  		    destCenterPoint = this._map.project(center, zoom),
-  		    centerOffset = destCenterPoint.subtract(currentCenterPoint),
-
-  		    topLeftOffset = viewHalf.multiplyBy(-scale).add(position).add(viewHalf).subtract(centerOffset);
-
-  		if (any3d) {
-  			setTransform(this._container, topLeftOffset, scale);
-  		} else {
-  			setPosition(this._container, topLeftOffset);
-  		}
-  	},
-
-  	_reset: function () {
-  		this._update();
-  		this._updateTransform(this._center, this._zoom);
-
-  		for (var id in this._layers) {
-  			this._layers[id]._reset();
-  		}
-  	},
-
-  	_onZoomEnd: function () {
-  		for (var id in this._layers) {
-  			this._layers[id]._project();
-  		}
-  	},
-
-  	_updatePaths: function () {
-  		for (var id in this._layers) {
-  			this._layers[id]._update();
-  		}
-  	},
-
-  	_update: function () {
-  		// Update pixel bounds of renderer container (for positioning/sizing/clipping later)
-  		// Subclasses are responsible of firing the 'update' event.
-  		var p = this.options.padding,
-  		    size = this._map.getSize(),
-  		    min = this._map.containerPointToLayerPoint(size.multiplyBy(-p)).round();
-
-  		this._bounds = new Bounds(min, min.add(size.multiplyBy(1 + p * 2)).round());
-
-  		this._center = this._map.getCenter();
-  		this._zoom = this._map.getZoom();
-  	}
-  });
-
-  /*
-   * @class Canvas
-   * @inherits Renderer
-   * @aka L.Canvas
-   *
-   * Allows vector layers to be displayed with [`<canvas>`](https://developer.mozilla.org/docs/Web/API/Canvas_API).
-   * Inherits `Renderer`.
-   *
-   * Due to [technical limitations](http://caniuse.com/#search=canvas), Canvas is not
-   * available in all web browsers, notably IE8, and overlapping geometries might
-   * not display properly in some edge cases.
-   *
-   * @example
-   *
-   * Use Canvas by default for all paths in the map:
-   *
-   * ```js
-   * var map = L.map('map', {
-   * 	renderer: L.canvas()
-   * });
-   * ```
-   *
-   * Use a Canvas renderer with extra padding for specific vector geometries:
-   *
-   * ```js
-   * var map = L.map('map');
-   * var myRenderer = L.canvas({ padding: 0.5 });
-   * var line = L.polyline( coordinates, { renderer: myRenderer } );
-   * var circle = L.circle( center, { renderer: myRenderer } );
-   * ```
-   */
-
-  var Canvas = Renderer.extend({
-  	getEvents: function () {
-  		var events = Renderer.prototype.getEvents.call(this);
-  		events.viewprereset = this._onViewPreReset;
-  		return events;
-  	},
-
-  	_onViewPreReset: function () {
-  		// Set a flag so that a viewprereset+moveend+viewreset only updates&redraws once
-  		this._postponeUpdatePaths = true;
-  	},
-
-  	onAdd: function () {
-  		Renderer.prototype.onAdd.call(this);
-
-  		// Redraw vectors since canvas is cleared upon removal,
-  		// in case of removing the renderer itself from the map.
-  		this._draw();
-  	},
-
-  	_initContainer: function () {
-  		var container = this._container = document.createElement('canvas');
-
-  		on(container, 'mousemove', this._onMouseMove, this);
-  		on(container, 'click dblclick mousedown mouseup contextmenu', this._onClick, this);
-  		on(container, 'mouseout', this._handleMouseOut, this);
-
-  		this._ctx = container.getContext('2d');
-  	},
-
-  	_destroyContainer: function () {
-  		cancelAnimFrame(this._redrawRequest);
-  		delete this._ctx;
-  		remove(this._container);
-  		off(this._container);
-  		delete this._container;
-  	},
-
-  	_updatePaths: function () {
-  		if (this._postponeUpdatePaths) { return; }
-
-  		var layer;
-  		this._redrawBounds = null;
-  		for (var id in this._layers) {
-  			layer = this._layers[id];
-  			layer._update();
-  		}
-  		this._redraw();
-  	},
-
-  	_update: function () {
-  		if (this._map._animatingZoom && this._bounds) { return; }
-
-  		Renderer.prototype._update.call(this);
-
-  		var b = this._bounds,
-  		    container = this._container,
-  		    size = b.getSize(),
-  		    m = retina ? 2 : 1;
-
-  		setPosition(container, b.min);
-
-  		// set canvas size (also clearing it); use double size on retina
-  		container.width = m * size.x;
-  		container.height = m * size.y;
-  		container.style.width = size.x + 'px';
-  		container.style.height = size.y + 'px';
-
-  		if (retina) {
-  			this._ctx.scale(2, 2);
-  		}
-
-  		// translate so we use the same path coordinates after canvas element moves
-  		this._ctx.translate(-b.min.x, -b.min.y);
-
-  		// Tell paths to redraw themselves
-  		this.fire('update');
-  	},
-
-  	_reset: function () {
-  		Renderer.prototype._reset.call(this);
-
-  		if (this._postponeUpdatePaths) {
-  			this._postponeUpdatePaths = false;
-  			this._updatePaths();
-  		}
-  	},
-
-  	_initPath: function (layer) {
-  		this._updateDashArray(layer);
-  		this._layers[stamp(layer)] = layer;
-
-  		var order = layer._order = {
-  			layer: layer,
-  			prev: this._drawLast,
-  			next: null
-  		};
-  		if (this._drawLast) { this._drawLast.next = order; }
-  		this._drawLast = order;
-  		this._drawFirst = this._drawFirst || this._drawLast;
-  	},
-
-  	_addPath: function (layer) {
-  		this._requestRedraw(layer);
-  	},
-
-  	_removePath: function (layer) {
-  		var order = layer._order;
-  		var next = order.next;
-  		var prev = order.prev;
-
-  		if (next) {
-  			next.prev = prev;
-  		} else {
-  			this._drawLast = prev;
-  		}
-  		if (prev) {
-  			prev.next = next;
-  		} else {
-  			this._drawFirst = next;
-  		}
-
-  		delete layer._order;
-
-  		delete this._layers[stamp(layer)];
-
-  		this._requestRedraw(layer);
-  	},
-
-  	_updatePath: function (layer) {
-  		// Redraw the union of the layer's old pixel
-  		// bounds and the new pixel bounds.
-  		this._extendRedrawBounds(layer);
-  		layer._project();
-  		layer._update();
-  		// The redraw will extend the redraw bounds
-  		// with the new pixel bounds.
-  		this._requestRedraw(layer);
-  	},
-
-  	_updateStyle: function (layer) {
-  		this._updateDashArray(layer);
-  		this._requestRedraw(layer);
-  	},
-
-  	_updateDashArray: function (layer) {
-  		if (typeof layer.options.dashArray === 'string') {
-  			var parts = layer.options.dashArray.split(/[, ]+/),
-  			    dashArray = [],
-  			    dashValue,
-  			    i;
-  			for (i = 0; i < parts.length; i++) {
-  				dashValue = Number(parts[i]);
-  				// Ignore dash array containing invalid lengths
-  				if (isNaN(dashValue)) { return; }
-  				dashArray.push(dashValue);
-  			}
-  			layer.options._dashArray = dashArray;
-  		} else {
-  			layer.options._dashArray = layer.options.dashArray;
-  		}
-  	},
-
-  	_requestRedraw: function (layer) {
-  		if (!this._map) { return; }
-
-  		this._extendRedrawBounds(layer);
-  		this._redrawRequest = this._redrawRequest || requestAnimFrame(this._redraw, this);
-  	},
-
-  	_extendRedrawBounds: function (layer) {
-  		if (layer._pxBounds) {
-  			var padding = (layer.options.weight || 0) + 1;
-  			this._redrawBounds = this._redrawBounds || new Bounds();
-  			this._redrawBounds.extend(layer._pxBounds.min.subtract([padding, padding]));
-  			this._redrawBounds.extend(layer._pxBounds.max.add([padding, padding]));
-  		}
-  	},
-
-  	_redraw: function () {
-  		this._redrawRequest = null;
-
-  		if (this._redrawBounds) {
-  			this._redrawBounds.min._floor();
-  			this._redrawBounds.max._ceil();
-  		}
-
-  		this._clear(); // clear layers in redraw bounds
-  		this._draw(); // draw layers
-
-  		this._redrawBounds = null;
-  	},
-
-  	_clear: function () {
-  		var bounds = this._redrawBounds;
-  		if (bounds) {
-  			var size = bounds.getSize();
-  			this._ctx.clearRect(bounds.min.x, bounds.min.y, size.x, size.y);
-  		} else {
-  			this._ctx.save();
-  			this._ctx.setTransform(1, 0, 0, 1, 0, 0);
-  			this._ctx.clearRect(0, 0, this._container.width, this._container.height);
-  			this._ctx.restore();
-  		}
-  	},
-
-  	_draw: function () {
-  		var layer, bounds = this._redrawBounds;
-  		this._ctx.save();
-  		if (bounds) {
-  			var size = bounds.getSize();
-  			this._ctx.beginPath();
-  			this._ctx.rect(bounds.min.x, bounds.min.y, size.x, size.y);
-  			this._ctx.clip();
-  		}
-
-  		this._drawing = true;
-
-  		for (var order = this._drawFirst; order; order = order.next) {
-  			layer = order.layer;
-  			if (!bounds || (layer._pxBounds && layer._pxBounds.intersects(bounds))) {
-  				layer._updatePath();
-  			}
-  		}
-
-  		this._drawing = false;
-
-  		this._ctx.restore();  // Restore state before clipping.
-  	},
-
-  	_updatePoly: function (layer, closed) {
-  		if (!this._drawing) { return; }
-
-  		var i, j, len2, p,
-  		    parts = layer._parts,
-  		    len = parts.length,
-  		    ctx = this._ctx;
-
-  		if (!len) { return; }
-
-  		ctx.beginPath();
-
-  		for (i = 0; i < len; i++) {
-  			for (j = 0, len2 = parts[i].length; j < len2; j++) {
-  				p = parts[i][j];
-  				ctx[j ? 'lineTo' : 'moveTo'](p.x, p.y);
-  			}
-  			if (closed) {
-  				ctx.closePath();
-  			}
-  		}
-
-  		this._fillStroke(ctx, layer);
-
-  		// TODO optimization: 1 fill/stroke for all features with equal style instead of 1 for each feature
-  	},
-
-  	_updateCircle: function (layer) {
-
-  		if (!this._drawing || layer._empty()) { return; }
-
-  		var p = layer._point,
-  		    ctx = this._ctx,
-  		    r = Math.max(Math.round(layer._radius), 1),
-  		    s = (Math.max(Math.round(layer._radiusY), 1) || r) / r;
-
-  		if (s !== 1) {
-  			ctx.save();
-  			ctx.scale(1, s);
-  		}
-
-  		ctx.beginPath();
-  		ctx.arc(p.x, p.y / s, r, 0, Math.PI * 2, false);
-
-  		if (s !== 1) {
-  			ctx.restore();
-  		}
-
-  		this._fillStroke(ctx, layer);
-  	},
-
-  	_fillStroke: function (ctx, layer) {
-  		var options = layer.options;
-
-  		if (options.fill) {
-  			ctx.globalAlpha = options.fillOpacity;
-  			ctx.fillStyle = options.fillColor || options.color;
-  			ctx.fill(options.fillRule || 'evenodd');
-  		}
-
-  		if (options.stroke && options.weight !== 0) {
-  			if (ctx.setLineDash) {
-  				ctx.setLineDash(layer.options && layer.options._dashArray || []);
-  			}
-  			ctx.globalAlpha = options.opacity;
-  			ctx.lineWidth = options.weight;
-  			ctx.strokeStyle = options.color;
-  			ctx.lineCap = options.lineCap;
-  			ctx.lineJoin = options.lineJoin;
-  			ctx.stroke();
-  		}
-  	},
-
-  	// Canvas obviously doesn't have mouse events for individual drawn objects,
-  	// so we emulate that by calculating what's under the mouse on mousemove/click manually
-
-  	_onClick: function (e) {
-  		var point = this._map.mouseEventToLayerPoint(e), layer, clickedLayer;
-
-  		for (var order = this._drawFirst; order; order = order.next) {
-  			layer = order.layer;
-  			if (layer.options.interactive && layer._containsPoint(point)) {
-  				if (!(e.type === 'click' || e.type !== 'preclick') || !this._map._draggableMoved(layer)) {
-  					clickedLayer = layer;
-  				}
-  			}
-  		}
-  		if (clickedLayer)  {
-  			fakeStop(e);
-  			this._fireEvent([clickedLayer], e);
-  		}
-  	},
-
-  	_onMouseMove: function (e) {
-  		if (!this._map || this._map.dragging.moving() || this._map._animatingZoom) { return; }
-
-  		var point = this._map.mouseEventToLayerPoint(e);
-  		this._handleMouseHover(e, point);
-  	},
-
-
-  	_handleMouseOut: function (e) {
-  		var layer = this._hoveredLayer;
-  		if (layer) {
-  			// if we're leaving the layer, fire mouseout
-  			removeClass(this._container, 'leaflet-interactive');
-  			this._fireEvent([layer], e, 'mouseout');
-  			this._hoveredLayer = null;
-  			this._mouseHoverThrottled = false;
-  		}
-  	},
-
-  	_handleMouseHover: function (e, point) {
-  		if (this._mouseHoverThrottled) {
-  			return;
-  		}
-
-  		var layer, candidateHoveredLayer;
-
-  		for (var order = this._drawFirst; order; order = order.next) {
-  			layer = order.layer;
-  			if (layer.options.interactive && layer._containsPoint(point)) {
-  				candidateHoveredLayer = layer;
-  			}
-  		}
-
-  		if (candidateHoveredLayer !== this._hoveredLayer) {
-  			this._handleMouseOut(e);
-
-  			if (candidateHoveredLayer) {
-  				addClass(this._container, 'leaflet-interactive'); // change cursor
-  				this._fireEvent([candidateHoveredLayer], e, 'mouseover');
-  				this._hoveredLayer = candidateHoveredLayer;
-  			}
-  		}
-
-  		if (this._hoveredLayer) {
-  			this._fireEvent([this._hoveredLayer], e);
-  		}
-
-  		this._mouseHoverThrottled = true;
-  		setTimeout(bind(function () {
-  			this._mouseHoverThrottled = false;
-  		}, this), 32);
-  	},
-
-  	_fireEvent: function (layers, e, type) {
-  		this._map._fireDOMEvent(e, type || e.type, layers);
-  	},
-
-  	_bringToFront: function (layer) {
-  		var order = layer._order;
-
-  		if (!order) { return; }
-
-  		var next = order.next;
-  		var prev = order.prev;
-
-  		if (next) {
-  			next.prev = prev;
-  		} else {
-  			// Already last
-  			return;
-  		}
-  		if (prev) {
-  			prev.next = next;
-  		} else if (next) {
-  			// Update first entry unless this is the
-  			// single entry
-  			this._drawFirst = next;
-  		}
-
-  		order.prev = this._drawLast;
-  		this._drawLast.next = order;
-
-  		order.next = null;
-  		this._drawLast = order;
-
-  		this._requestRedraw(layer);
-  	},
-
-  	_bringToBack: function (layer) {
-  		var order = layer._order;
-
-  		if (!order) { return; }
-
-  		var next = order.next;
-  		var prev = order.prev;
-
-  		if (prev) {
-  			prev.next = next;
-  		} else {
-  			// Already first
-  			return;
-  		}
-  		if (next) {
-  			next.prev = prev;
-  		} else if (prev) {
-  			// Update last entry unless this is the
-  			// single entry
-  			this._drawLast = prev;
-  		}
-
-  		order.prev = null;
-
-  		order.next = this._drawFirst;
-  		this._drawFirst.prev = order;
-  		this._drawFirst = order;
-
-  		this._requestRedraw(layer);
-  	}
-  });
-
-  // @factory L.canvas(options?: Renderer options)
-  // Creates a Canvas renderer with the given options.
-  function canvas$1(options) {
-  	return canvas ? new Canvas(options) : null;
-  }
-
-  /*
-   * Thanks to Dmitry Baranovsky and his Raphael library for inspiration!
-   */
-
-
-  var vmlCreate = (function () {
-  	try {
-  		document.namespaces.add('lvml', 'urn:schemas-microsoft-com:vml');
-  		return function (name) {
-  			return document.createElement('<lvml:' + name + ' class="lvml">');
-  		};
-  	} catch (e) {
-  		return function (name) {
-  			return document.createElement('<' + name + ' xmlns="urn:schemas-microsoft.com:vml" class="lvml">');
-  		};
-  	}
-  })();
-
-
-  /*
-   * @class SVG
-   *
-   *
-   * VML was deprecated in 2012, which means VML functionality exists only for backwards compatibility
-   * with old versions of Internet Explorer.
-   */
-
-  // mixin to redefine some SVG methods to handle VML syntax which is similar but with some differences
-  var vmlMixin = {
-
-  	_initContainer: function () {
-  		this._container = create$1('div', 'leaflet-vml-container');
-  	},
-
-  	_update: function () {
-  		if (this._map._animatingZoom) { return; }
-  		Renderer.prototype._update.call(this);
-  		this.fire('update');
-  	},
-
-  	_initPath: function (layer) {
-  		var container = layer._container = vmlCreate('shape');
-
-  		addClass(container, 'leaflet-vml-shape ' + (this.options.className || ''));
-
-  		container.coordsize = '1 1';
-
-  		layer._path = vmlCreate('path');
-  		container.appendChild(layer._path);
-
-  		this._updateStyle(layer);
-  		this._layers[stamp(layer)] = layer;
-  	},
-
-  	_addPath: function (layer) {
-  		var container = layer._container;
-  		this._container.appendChild(container);
-
-  		if (layer.options.interactive) {
-  			layer.addInteractiveTarget(container);
-  		}
-  	},
-
-  	_removePath: function (layer) {
-  		var container = layer._container;
-  		remove(container);
-  		layer.removeInteractiveTarget(container);
-  		delete this._layers[stamp(layer)];
-  	},
-
-  	_updateStyle: function (layer) {
-  		var stroke = layer._stroke,
-  		    fill = layer._fill,
-  		    options = layer.options,
-  		    container = layer._container;
-
-  		container.stroked = !!options.stroke;
-  		container.filled = !!options.fill;
-
-  		if (options.stroke) {
-  			if (!stroke) {
-  				stroke = layer._stroke = vmlCreate('stroke');
-  			}
-  			container.appendChild(stroke);
-  			stroke.weight = options.weight + 'px';
-  			stroke.color = options.color;
-  			stroke.opacity = options.opacity;
-
-  			if (options.dashArray) {
-  				stroke.dashStyle = isArray(options.dashArray) ?
-  				    options.dashArray.join(' ') :
-  				    options.dashArray.replace(/( *, *)/g, ' ');
-  			} else {
-  				stroke.dashStyle = '';
-  			}
-  			stroke.endcap = options.lineCap.replace('butt', 'flat');
-  			stroke.joinstyle = options.lineJoin;
-
-  		} else if (stroke) {
-  			container.removeChild(stroke);
-  			layer._stroke = null;
-  		}
-
-  		if (options.fill) {
-  			if (!fill) {
-  				fill = layer._fill = vmlCreate('fill');
-  			}
-  			container.appendChild(fill);
-  			fill.color = options.fillColor || options.color;
-  			fill.opacity = options.fillOpacity;
-
-  		} else if (fill) {
-  			container.removeChild(fill);
-  			layer._fill = null;
-  		}
-  	},
-
-  	_updateCircle: function (layer) {
-  		var p = layer._point.round(),
-  		    r = Math.round(layer._radius),
-  		    r2 = Math.round(layer._radiusY || r);
-
-  		this._setPath(layer, layer._empty() ? 'M0 0' :
-  			'AL ' + p.x + ',' + p.y + ' ' + r + ',' + r2 + ' 0,' + (65535 * 360));
-  	},
-
-  	_setPath: function (layer, path) {
-  		layer._path.v = path;
-  	},
-
-  	_bringToFront: function (layer) {
-  		toFront(layer._container);
-  	},
-
-  	_bringToBack: function (layer) {
-  		toBack(layer._container);
-  	}
-  };
-
-  var create$2 = vml ? vmlCreate : svgCreate;
-
-  /*
-   * @class SVG
-   * @inherits Renderer
-   * @aka L.SVG
-   *
-   * Allows vector layers to be displayed with [SVG](https://developer.mozilla.org/docs/Web/SVG).
-   * Inherits `Renderer`.
-   *
-   * Due to [technical limitations](http://caniuse.com/#search=svg), SVG is not
-   * available in all web browsers, notably Android 2.x and 3.x.
-   *
-   * Although SVG is not available on IE7 and IE8, these browsers support
-   * [VML](https://en.wikipedia.org/wiki/Vector_Markup_Language)
-   * (a now deprecated technology), and the SVG renderer will fall back to VML in
-   * this case.
-   *
-   * @example
-   *
-   * Use SVG by default for all paths in the map:
-   *
-   * ```js
-   * var map = L.map('map', {
-   * 	renderer: L.svg()
-   * });
-   * ```
-   *
-   * Use a SVG renderer with extra padding for specific vector geometries:
-   *
-   * ```js
-   * var map = L.map('map');
-   * var myRenderer = L.svg({ padding: 0.5 });
-   * var line = L.polyline( coordinates, { renderer: myRenderer } );
-   * var circle = L.circle( center, { renderer: myRenderer } );
-   * ```
-   */
-
-  var SVG = Renderer.extend({
-
-  	getEvents: function () {
-  		var events = Renderer.prototype.getEvents.call(this);
-  		events.zoomstart = this._onZoomStart;
-  		return events;
-  	},
-
-  	_initContainer: function () {
-  		this._container = create$2('svg');
-
-  		// makes it possible to click through svg root; we'll reset it back in individual paths
-  		this._container.setAttribute('pointer-events', 'none');
-
-  		this._rootGroup = create$2('g');
-  		this._container.appendChild(this._rootGroup);
-  	},
-
-  	_destroyContainer: function () {
-  		remove(this._container);
-  		off(this._container);
-  		delete this._container;
-  		delete this._rootGroup;
-  		delete this._svgSize;
-  	},
-
-  	_onZoomStart: function () {
-  		// Drag-then-pinch interactions might mess up the center and zoom.
-  		// In this case, the easiest way to prevent this is re-do the renderer
-  		//   bounds and padding when the zooming starts.
-  		this._update();
-  	},
-
-  	_update: function () {
-  		if (this._map._animatingZoom && this._bounds) { return; }
-
-  		Renderer.prototype._update.call(this);
-
-  		var b = this._bounds,
-  		    size = b.getSize(),
-  		    container = this._container;
-
-  		// set size of svg-container if changed
-  		if (!this._svgSize || !this._svgSize.equals(size)) {
-  			this._svgSize = size;
-  			container.setAttribute('width', size.x);
-  			container.setAttribute('height', size.y);
-  		}
-
-  		// movement: update container viewBox so that we don't have to change coordinates of individual layers
-  		setPosition(container, b.min);
-  		container.setAttribute('viewBox', [b.min.x, b.min.y, size.x, size.y].join(' '));
-
-  		this.fire('update');
-  	},
-
-  	// methods below are called by vector layers implementations
-
-  	_initPath: function (layer) {
-  		var path = layer._path = create$2('path');
-
-  		// @namespace Path
-  		// @option className: String = null
-  		// Custom class name set on an element. Only for SVG renderer.
-  		if (layer.options.className) {
-  			addClass(path, layer.options.className);
-  		}
-
-  		if (layer.options.interactive) {
-  			addClass(path, 'leaflet-interactive');
-  		}
-
-  		this._updateStyle(layer);
-  		this._layers[stamp(layer)] = layer;
-  	},
-
-  	_addPath: function (layer) {
-  		if (!this._rootGroup) { this._initContainer(); }
-  		this._rootGroup.appendChild(layer._path);
-  		layer.addInteractiveTarget(layer._path);
-  	},
-
-  	_removePath: function (layer) {
-  		remove(layer._path);
-  		layer.removeInteractiveTarget(layer._path);
-  		delete this._layers[stamp(layer)];
-  	},
-
-  	_updatePath: function (layer) {
-  		layer._project();
-  		layer._update();
-  	},
-
-  	_updateStyle: function (layer) {
-  		var path = layer._path,
-  		    options = layer.options;
-
-  		if (!path) { return; }
-
-  		if (options.stroke) {
-  			path.setAttribute('stroke', options.color);
-  			path.setAttribute('stroke-opacity', options.opacity);
-  			path.setAttribute('stroke-width', options.weight);
-  			path.setAttribute('stroke-linecap', options.lineCap);
-  			path.setAttribute('stroke-linejoin', options.lineJoin);
-
-  			if (options.dashArray) {
-  				path.setAttribute('stroke-dasharray', options.dashArray);
-  			} else {
-  				path.removeAttribute('stroke-dasharray');
-  			}
-
-  			if (options.dashOffset) {
-  				path.setAttribute('stroke-dashoffset', options.dashOffset);
-  			} else {
-  				path.removeAttribute('stroke-dashoffset');
-  			}
-  		} else {
-  			path.setAttribute('stroke', 'none');
-  		}
-
-  		if (options.fill) {
-  			path.setAttribute('fill', options.fillColor || options.color);
-  			path.setAttribute('fill-opacity', options.fillOpacity);
-  			path.setAttribute('fill-rule', options.fillRule || 'evenodd');
-  		} else {
-  			path.setAttribute('fill', 'none');
-  		}
-  	},
-
-  	_updatePoly: function (layer, closed) {
-  		this._setPath(layer, pointsToPath(layer._parts, closed));
-  	},
-
-  	_updateCircle: function (layer) {
-  		var p = layer._point,
-  		    r = Math.max(Math.round(layer._radius), 1),
-  		    r2 = Math.max(Math.round(layer._radiusY), 1) || r,
-  		    arc = 'a' + r + ',' + r2 + ' 0 1,0 ';
-
-  		// drawing a circle with two half-arcs
-  		var d = layer._empty() ? 'M0 0' :
-  			'M' + (p.x - r) + ',' + p.y +
-  			arc + (r * 2) + ',0 ' +
-  			arc + (-r * 2) + ',0 ';
-
-  		this._setPath(layer, d);
-  	},
-
-  	_setPath: function (layer, path) {
-  		layer._path.setAttribute('d', path);
-  	},
-
-  	// SVG does not have the concept of zIndex so we resort to changing the DOM order of elements
-  	_bringToFront: function (layer) {
-  		toFront(layer._path);
-  	},
-
-  	_bringToBack: function (layer) {
-  		toBack(layer._path);
-  	}
-  });
-
-  if (vml) {
-  	SVG.include(vmlMixin);
-  }
-
-  // @namespace SVG
-  // @factory L.svg(options?: Renderer options)
-  // Creates a SVG renderer with the given options.
-  function svg$1(options) {
-  	return svg || vml ? new SVG(options) : null;
-  }
-
-  Map.include({
-  	// @namespace Map; @method getRenderer(layer: Path): Renderer
-  	// Returns the instance of `Renderer` that should be used to render the given
-  	// `Path`. It will ensure that the `renderer` options of the map and paths
-  	// are respected, and that the renderers do exist on the map.
-  	getRenderer: function (layer) {
-  		// @namespace Path; @option renderer: Renderer
-  		// Use this specific instance of `Renderer` for this path. Takes
-  		// precedence over the map's [default renderer](#map-renderer).
-  		var renderer = layer.options.renderer || this._getPaneRenderer(layer.options.pane) || this.options.renderer || this._renderer;
-
-  		if (!renderer) {
-  			renderer = this._renderer = this._createRenderer();
-  		}
-
-  		if (!this.hasLayer(renderer)) {
-  			this.addLayer(renderer);
-  		}
-  		return renderer;
-  	},
-
-  	_getPaneRenderer: function (name) {
-  		if (name === 'overlayPane' || name === undefined) {
-  			return false;
-  		}
-
-  		var renderer = this._paneRenderers[name];
-  		if (renderer === undefined) {
-  			renderer = this._createRenderer({pane: name});
-  			this._paneRenderers[name] = renderer;
-  		}
-  		return renderer;
-  	},
-
-  	_createRenderer: function (options) {
-  		// @namespace Map; @option preferCanvas: Boolean = false
-  		// Whether `Path`s should be rendered on a `Canvas` renderer.
-  		// By default, all `Path`s are rendered in a `SVG` renderer.
-  		return (this.options.preferCanvas && canvas$1(options)) || svg$1(options);
-  	}
-  });
-
-  /*
-   * L.Rectangle extends Polygon and creates a rectangle when passed a LatLngBounds object.
-   */
-
-  /*
-   * @class Rectangle
-   * @aka L.Rectangle
-   * @inherits Polygon
-   *
-   * A class for drawing rectangle overlays on a map. Extends `Polygon`.
-   *
-   * @example
-   *
-   * ```js
-   * // define rectangle geographical bounds
-   * var bounds = [[54.559322, -5.767822], [56.1210604, -3.021240]];
-   *
-   * // create an orange rectangle
-   * L.rectangle(bounds, {color: "#ff7800", weight: 1}).addTo(map);
-   *
-   * // zoom the map to the rectangle bounds
-   * map.fitBounds(bounds);
-   * ```
-   *
-   */
-
-
-  var Rectangle = Polygon.extend({
-  	initialize: function (latLngBounds, options) {
-  		Polygon.prototype.initialize.call(this, this._boundsToLatLngs(latLngBounds), options);
-  	},
-
-  	// @method setBounds(latLngBounds: LatLngBounds): this
-  	// Redraws the rectangle with the passed bounds.
-  	setBounds: function (latLngBounds) {
-  		return this.setLatLngs(this._boundsToLatLngs(latLngBounds));
-  	},
-
-  	_boundsToLatLngs: function (latLngBounds) {
-  		latLngBounds = toLatLngBounds(latLngBounds);
-  		return [
-  			latLngBounds.getSouthWest(),
-  			latLngBounds.getNorthWest(),
-  			latLngBounds.getNorthEast(),
-  			latLngBounds.getSouthEast()
-  		];
-  	}
-  });
-
-
-  // @factory L.rectangle(latLngBounds: LatLngBounds, options?: Polyline options)
-  function rectangle(latLngBounds, options) {
-  	return new Rectangle(latLngBounds, options);
-  }
-
-  SVG.create = create$2;
-  SVG.pointsToPath = pointsToPath;
-
-  GeoJSON.geometryToLayer = geometryToLayer;
-  GeoJSON.coordsToLatLng = coordsToLatLng;
-  GeoJSON.coordsToLatLngs = coordsToLatLngs;
-  GeoJSON.latLngToCoords = latLngToCoords;
-  GeoJSON.latLngsToCoords = latLngsToCoords;
-  GeoJSON.getFeature = getFeature;
-  GeoJSON.asFeature = asFeature;
-
-  /*
-   * L.Handler.BoxZoom is used to add shift-drag zoom interaction to the map
-   * (zoom to a selected bounding box), enabled by default.
-   */
-
-  // @namespace Map
-  // @section Interaction Options
-  Map.mergeOptions({
-  	// @option boxZoom: Boolean = true
-  	// Whether the map can be zoomed to a rectangular area specified by
-  	// dragging the mouse while pressing the shift key.
-  	boxZoom: true
-  });
-
-  var BoxZoom = Handler.extend({
-  	initialize: function (map) {
-  		this._map = map;
-  		this._container = map._container;
-  		this._pane = map._panes.overlayPane;
-  		this._resetStateTimeout = 0;
-  		map.on('unload', this._destroy, this);
-  	},
-
-  	addHooks: function () {
-  		on(this._container, 'mousedown', this._onMouseDown, this);
-  	},
-
-  	removeHooks: function () {
-  		off(this._container, 'mousedown', this._onMouseDown, this);
-  	},
-
-  	moved: function () {
-  		return this._moved;
-  	},
-
-  	_destroy: function () {
-  		remove(this._pane);
-  		delete this._pane;
-  	},
-
-  	_resetState: function () {
-  		this._resetStateTimeout = 0;
-  		this._moved = false;
-  	},
-
-  	_clearDeferredResetState: function () {
-  		if (this._resetStateTimeout !== 0) {
-  			clearTimeout(this._resetStateTimeout);
-  			this._resetStateTimeout = 0;
-  		}
-  	},
-
-  	_onMouseDown: function (e) {
-  		if (!e.shiftKey || ((e.which !== 1) && (e.button !== 1))) { return false; }
-
-  		// Clear the deferred resetState if it hasn't executed yet, otherwise it
-  		// will interrupt the interaction and orphan a box element in the container.
-  		this._clearDeferredResetState();
-  		this._resetState();
-
-  		disableTextSelection();
-  		disableImageDrag();
-
-  		this._startPoint = this._map.mouseEventToContainerPoint(e);
-
-  		on(document, {
-  			contextmenu: stop,
-  			mousemove: this._onMouseMove,
-  			mouseup: this._onMouseUp,
-  			keydown: this._onKeyDown
-  		}, this);
-  	},
-
-  	_onMouseMove: function (e) {
-  		if (!this._moved) {
-  			this._moved = true;
-
-  			this._box = create$1('div', 'leaflet-zoom-box', this._container);
-  			addClass(this._container, 'leaflet-crosshair');
-
-  			this._map.fire('boxzoomstart');
-  		}
-
-  		this._point = this._map.mouseEventToContainerPoint(e);
-
-  		var bounds = new Bounds(this._point, this._startPoint),
-  		    size = bounds.getSize();
-
-  		setPosition(this._box, bounds.min);
-
-  		this._box.style.width  = size.x + 'px';
-  		this._box.style.height = size.y + 'px';
-  	},
-
-  	_finish: function () {
-  		if (this._moved) {
-  			remove(this._box);
-  			removeClass(this._container, 'leaflet-crosshair');
-  		}
-
-  		enableTextSelection();
-  		enableImageDrag();
-
-  		off(document, {
-  			contextmenu: stop,
-  			mousemove: this._onMouseMove,
-  			mouseup: this._onMouseUp,
-  			keydown: this._onKeyDown
-  		}, this);
-  	},
-
-  	_onMouseUp: function (e) {
-  		if ((e.which !== 1) && (e.button !== 1)) { return; }
-
-  		this._finish();
-
-  		if (!this._moved) { return; }
-  		// Postpone to next JS tick so internal click event handling
-  		// still see it as "moved".
-  		this._clearDeferredResetState();
-  		this._resetStateTimeout = setTimeout(bind(this._resetState, this), 0);
-
-  		var bounds = new LatLngBounds(
-  		        this._map.containerPointToLatLng(this._startPoint),
-  		        this._map.containerPointToLatLng(this._point));
-
-  		this._map
-  			.fitBounds(bounds)
-  			.fire('boxzoomend', {boxZoomBounds: bounds});
-  	},
-
-  	_onKeyDown: function (e) {
-  		if (e.keyCode === 27) {
-  			this._finish();
-  		}
-  	}
-  });
-
-  // @section Handlers
-  // @property boxZoom: Handler
-  // Box (shift-drag with mouse) zoom handler.
-  Map.addInitHook('addHandler', 'boxZoom', BoxZoom);
-
-  /*
-   * L.Handler.DoubleClickZoom is used to handle double-click zoom on the map, enabled by default.
-   */
-
-  // @namespace Map
-  // @section Interaction Options
-
-  Map.mergeOptions({
-  	// @option doubleClickZoom: Boolean|String = true
-  	// Whether the map can be zoomed in by double clicking on it and
-  	// zoomed out by double clicking while holding shift. If passed
-  	// `'center'`, double-click zoom will zoom to the center of the
-  	//  view regardless of where the mouse was.
-  	doubleClickZoom: true
-  });
-
-  var DoubleClickZoom = Handler.extend({
-  	addHooks: function () {
-  		this._map.on('dblclick', this._onDoubleClick, this);
-  	},
-
-  	removeHooks: function () {
-  		this._map.off('dblclick', this._onDoubleClick, this);
-  	},
-
-  	_onDoubleClick: function (e) {
-  		var map = this._map,
-  		    oldZoom = map.getZoom(),
-  		    delta = map.options.zoomDelta,
-  		    zoom = e.originalEvent.shiftKey ? oldZoom - delta : oldZoom + delta;
-
-  		if (map.options.doubleClickZoom === 'center') {
-  			map.setZoom(zoom);
-  		} else {
-  			map.setZoomAround(e.containerPoint, zoom);
-  		}
-  	}
-  });
-
-  // @section Handlers
-  //
-  // Map properties include interaction handlers that allow you to control
-  // interaction behavior in runtime, enabling or disabling certain features such
-  // as dragging or touch zoom (see `Handler` methods). For example:
-  //
-  // ```js
-  // map.doubleClickZoom.disable();
-  // ```
-  //
-  // @property doubleClickZoom: Handler
-  // Double click zoom handler.
-  Map.addInitHook('addHandler', 'doubleClickZoom', DoubleClickZoom);
-
-  /*
-   * L.Handler.MapDrag is used to make the map draggable (with panning inertia), enabled by default.
-   */
-
-  // @namespace Map
-  // @section Interaction Options
-  Map.mergeOptions({
-  	// @option dragging: Boolean = true
-  	// Whether the map be draggable with mouse/touch or not.
-  	dragging: true,
-
-  	// @section Panning Inertia Options
-  	// @option inertia: Boolean = *
-  	// If enabled, panning of the map will have an inertia effect where
-  	// the map builds momentum while dragging and continues moving in
-  	// the same direction for some time. Feels especially nice on touch
-  	// devices. Enabled by default unless running on old Android devices.
-  	inertia: !android23,
-
-  	// @option inertiaDeceleration: Number = 3000
-  	// The rate with which the inertial movement slows down, in pixels/second².
-  	inertiaDeceleration: 3400, // px/s^2
-
-  	// @option inertiaMaxSpeed: Number = Infinity
-  	// Max speed of the inertial movement, in pixels/second.
-  	inertiaMaxSpeed: Infinity, // px/s
-
-  	// @option easeLinearity: Number = 0.2
-  	easeLinearity: 0.2,
-
-  	// TODO refactor, move to CRS
-  	// @option worldCopyJump: Boolean = false
-  	// With this option enabled, the map tracks when you pan to another "copy"
-  	// of the world and seamlessly jumps to the original one so that all overlays
-  	// like markers and vector layers are still visible.
-  	worldCopyJump: false,
-
-  	// @option maxBoundsViscosity: Number = 0.0
-  	// If `maxBounds` is set, this option will control how solid the bounds
-  	// are when dragging the map around. The default value of `0.0` allows the
-  	// user to drag outside the bounds at normal speed, higher values will
-  	// slow down map dragging outside bounds, and `1.0` makes the bounds fully
-  	// solid, preventing the user from dragging outside the bounds.
-  	maxBoundsViscosity: 0.0
-  });
-
-  var Drag = Handler.extend({
-  	addHooks: function () {
-  		if (!this._draggable) {
-  			var map = this._map;
-
-  			this._draggable = new Draggable(map._mapPane, map._container);
-
-  			this._draggable.on({
-  				dragstart: this._onDragStart,
-  				drag: this._onDrag,
-  				dragend: this._onDragEnd
-  			}, this);
-
-  			this._draggable.on('predrag', this._onPreDragLimit, this);
-  			if (map.options.worldCopyJump) {
-  				this._draggable.on('predrag', this._onPreDragWrap, this);
-  				map.on('zoomend', this._onZoomEnd, this);
-
-  				map.whenReady(this._onZoomEnd, this);
-  			}
-  		}
-  		addClass(this._map._container, 'leaflet-grab leaflet-touch-drag');
-  		this._draggable.enable();
-  		this._positions = [];
-  		this._times = [];
-  	},
-
-  	removeHooks: function () {
-  		removeClass(this._map._container, 'leaflet-grab');
-  		removeClass(this._map._container, 'leaflet-touch-drag');
-  		this._draggable.disable();
-  	},
-
-  	moved: function () {
-  		return this._draggable && this._draggable._moved;
-  	},
-
-  	moving: function () {
-  		return this._draggable && this._draggable._moving;
-  	},
-
-  	_onDragStart: function () {
-  		var map = this._map;
-
-  		map._stop();
-  		if (this._map.options.maxBounds && this._map.options.maxBoundsViscosity) {
-  			var bounds = toLatLngBounds(this._map.options.maxBounds);
-
-  			this._offsetLimit = toBounds(
-  				this._map.latLngToContainerPoint(bounds.getNorthWest()).multiplyBy(-1),
-  				this._map.latLngToContainerPoint(bounds.getSouthEast()).multiplyBy(-1)
-  					.add(this._map.getSize()));
-
-  			this._viscosity = Math.min(1.0, Math.max(0.0, this._map.options.maxBoundsViscosity));
-  		} else {
-  			this._offsetLimit = null;
-  		}
-
-  		map
-  		    .fire('movestart')
-  		    .fire('dragstart');
-
-  		if (map.options.inertia) {
-  			this._positions = [];
-  			this._times = [];
-  		}
-  	},
-
-  	_onDrag: function (e) {
-  		if (this._map.options.inertia) {
-  			var time = this._lastTime = +new Date(),
-  			    pos = this._lastPos = this._draggable._absPos || this._draggable._newPos;
-
-  			this._positions.push(pos);
-  			this._times.push(time);
-
-  			this._prunePositions(time);
-  		}
-
-  		this._map
-  		    .fire('move', e)
-  		    .fire('drag', e);
-  	},
-
-  	_prunePositions: function (time) {
-  		while (this._positions.length > 1 && time - this._times[0] > 50) {
-  			this._positions.shift();
-  			this._times.shift();
-  		}
-  	},
-
-  	_onZoomEnd: function () {
-  		var pxCenter = this._map.getSize().divideBy(2),
-  		    pxWorldCenter = this._map.latLngToLayerPoint([0, 0]);
-
-  		this._initialWorldOffset = pxWorldCenter.subtract(pxCenter).x;
-  		this._worldWidth = this._map.getPixelWorldBounds().getSize().x;
-  	},
-
-  	_viscousLimit: function (value, threshold) {
-  		return value - (value - threshold) * this._viscosity;
-  	},
-
-  	_onPreDragLimit: function () {
-  		if (!this._viscosity || !this._offsetLimit) { return; }
-
-  		var offset = this._draggable._newPos.subtract(this._draggable._startPos);
-
-  		var limit = this._offsetLimit;
-  		if (offset.x < limit.min.x) { offset.x = this._viscousLimit(offset.x, limit.min.x); }
-  		if (offset.y < limit.min.y) { offset.y = this._viscousLimit(offset.y, limit.min.y); }
-  		if (offset.x > limit.max.x) { offset.x = this._viscousLimit(offset.x, limit.max.x); }
-  		if (offset.y > limit.max.y) { offset.y = this._viscousLimit(offset.y, limit.max.y); }
-
-  		this._draggable._newPos = this._draggable._startPos.add(offset);
-  	},
-
-  	_onPreDragWrap: function () {
-  		// TODO refactor to be able to adjust map pane position after zoom
-  		var worldWidth = this._worldWidth,
-  		    halfWidth = Math.round(worldWidth / 2),
-  		    dx = this._initialWorldOffset,
-  		    x = this._draggable._newPos.x,
-  		    newX1 = (x - halfWidth + dx) % worldWidth + halfWidth - dx,
-  		    newX2 = (x + halfWidth + dx) % worldWidth - halfWidth - dx,
-  		    newX = Math.abs(newX1 + dx) < Math.abs(newX2 + dx) ? newX1 : newX2;
-
-  		this._draggable._absPos = this._draggable._newPos.clone();
-  		this._draggable._newPos.x = newX;
-  	},
-
-  	_onDragEnd: function (e) {
-  		var map = this._map,
-  		    options = map.options,
-
-  		    noInertia = !options.inertia || this._times.length < 2;
-
-  		map.fire('dragend', e);
-
-  		if (noInertia) {
-  			map.fire('moveend');
-
-  		} else {
-  			this._prunePositions(+new Date());
-
-  			var direction = this._lastPos.subtract(this._positions[0]),
-  			    duration = (this._lastTime - this._times[0]) / 1000,
-  			    ease = options.easeLinearity,
-
-  			    speedVector = direction.multiplyBy(ease / duration),
-  			    speed = speedVector.distanceTo([0, 0]),
-
-  			    limitedSpeed = Math.min(options.inertiaMaxSpeed, speed),
-  			    limitedSpeedVector = speedVector.multiplyBy(limitedSpeed / speed),
-
-  			    decelerationDuration = limitedSpeed / (options.inertiaDeceleration * ease),
-  			    offset = limitedSpeedVector.multiplyBy(-decelerationDuration / 2).round();
-
-  			if (!offset.x && !offset.y) {
-  				map.fire('moveend');
-
-  			} else {
-  				offset = map._limitOffset(offset, map.options.maxBounds);
-
-  				requestAnimFrame(function () {
-  					map.panBy(offset, {
-  						duration: decelerationDuration,
-  						easeLinearity: ease,
-  						noMoveStart: true,
-  						animate: true
-  					});
-  				});
-  			}
-  		}
-  	}
-  });
-
-  // @section Handlers
-  // @property dragging: Handler
-  // Map dragging handler (by both mouse and touch).
-  Map.addInitHook('addHandler', 'dragging', Drag);
-
-  /*
-   * L.Map.Keyboard is handling keyboard interaction with the map, enabled by default.
-   */
-
-  // @namespace Map
-  // @section Keyboard Navigation Options
-  Map.mergeOptions({
-  	// @option keyboard: Boolean = true
-  	// Makes the map focusable and allows users to navigate the map with keyboard
-  	// arrows and `+`/`-` keys.
-  	keyboard: true,
-
-  	// @option keyboardPanDelta: Number = 80
-  	// Amount of pixels to pan when pressing an arrow key.
-  	keyboardPanDelta: 80
-  });
-
-  var Keyboard = Handler.extend({
-
-  	keyCodes: {
-  		left:    [37],
-  		right:   [39],
-  		down:    [40],
-  		up:      [38],
-  		zoomIn:  [187, 107, 61, 171],
-  		zoomOut: [189, 109, 54, 173]
-  	},
-
-  	initialize: function (map) {
-  		this._map = map;
-
-  		this._setPanDelta(map.options.keyboardPanDelta);
-  		this._setZoomDelta(map.options.zoomDelta);
-  	},
-
-  	addHooks: function () {
-  		var container = this._map._container;
-
-  		// make the container focusable by tabbing
-  		if (container.tabIndex <= 0) {
-  			container.tabIndex = '0';
-  		}
-
-  		on(container, {
-  			focus: this._onFocus,
-  			blur: this._onBlur,
-  			mousedown: this._onMouseDown
-  		}, this);
-
-  		this._map.on({
-  			focus: this._addHooks,
-  			blur: this._removeHooks
-  		}, this);
-  	},
-
-  	removeHooks: function () {
-  		this._removeHooks();
-
-  		off(this._map._container, {
-  			focus: this._onFocus,
-  			blur: this._onBlur,
-  			mousedown: this._onMouseDown
-  		}, this);
-
-  		this._map.off({
-  			focus: this._addHooks,
-  			blur: this._removeHooks
-  		}, this);
-  	},
-
-  	_onMouseDown: function () {
-  		if (this._focused) { return; }
-
-  		var body = document.body,
-  		    docEl = document.documentElement,
-  		    top = body.scrollTop || docEl.scrollTop,
-  		    left = body.scrollLeft || docEl.scrollLeft;
-
-  		this._map._container.focus();
-
-  		window.scrollTo(left, top);
-  	},
-
-  	_onFocus: function () {
-  		this._focused = true;
-  		this._map.fire('focus');
-  	},
-
-  	_onBlur: function () {
-  		this._focused = false;
-  		this._map.fire('blur');
-  	},
-
-  	_setPanDelta: function (panDelta) {
-  		var keys = this._panKeys = {},
-  		    codes = this.keyCodes,
-  		    i, len;
-
-  		for (i = 0, len = codes.left.length; i < len; i++) {
-  			keys[codes.left[i]] = [-1 * panDelta, 0];
-  		}
-  		for (i = 0, len = codes.right.length; i < len; i++) {
-  			keys[codes.right[i]] = [panDelta, 0];
-  		}
-  		for (i = 0, len = codes.down.length; i < len; i++) {
-  			keys[codes.down[i]] = [0, panDelta];
-  		}
-  		for (i = 0, len = codes.up.length; i < len; i++) {
-  			keys[codes.up[i]] = [0, -1 * panDelta];
-  		}
-  	},
-
-  	_setZoomDelta: function (zoomDelta) {
-  		var keys = this._zoomKeys = {},
-  		    codes = this.keyCodes,
-  		    i, len;
-
-  		for (i = 0, len = codes.zoomIn.length; i < len; i++) {
-  			keys[codes.zoomIn[i]] = zoomDelta;
-  		}
-  		for (i = 0, len = codes.zoomOut.length; i < len; i++) {
-  			keys[codes.zoomOut[i]] = -zoomDelta;
-  		}
-  	},
-
-  	_addHooks: function () {
-  		on(document, 'keydown', this._onKeyDown, this);
-  	},
-
-  	_removeHooks: function () {
-  		off(document, 'keydown', this._onKeyDown, this);
-  	},
-
-  	_onKeyDown: function (e) {
-  		if (e.altKey || e.ctrlKey || e.metaKey) { return; }
-
-  		var key = e.keyCode,
-  		    map = this._map,
-  		    offset;
-
-  		if (key in this._panKeys) {
-  			if (!map._panAnim || !map._panAnim._inProgress) {
-  				offset = this._panKeys[key];
-  				if (e.shiftKey) {
-  					offset = toPoint(offset).multiplyBy(3);
-  				}
-
-  				map.panBy(offset);
-
-  				if (map.options.maxBounds) {
-  					map.panInsideBounds(map.options.maxBounds);
-  				}
-  			}
-  		} else if (key in this._zoomKeys) {
-  			map.setZoom(map.getZoom() + (e.shiftKey ? 3 : 1) * this._zoomKeys[key]);
-
-  		} else if (key === 27 && map._popup && map._popup.options.closeOnEscapeKey) {
-  			map.closePopup();
-
-  		} else {
-  			return;
-  		}
-
-  		stop(e);
-  	}
-  });
-
-  // @section Handlers
-  // @section Handlers
-  // @property keyboard: Handler
-  // Keyboard navigation handler.
-  Map.addInitHook('addHandler', 'keyboard', Keyboard);
-
-  /*
-   * L.Handler.ScrollWheelZoom is used by L.Map to enable mouse scroll wheel zoom on the map.
-   */
-
-  // @namespace Map
-  // @section Interaction Options
-  Map.mergeOptions({
-  	// @section Mouse wheel options
-  	// @option scrollWheelZoom: Boolean|String = true
-  	// Whether the map can be zoomed by using the mouse wheel. If passed `'center'`,
-  	// it will zoom to the center of the view regardless of where the mouse was.
-  	scrollWheelZoom: true,
-
-  	// @option wheelDebounceTime: Number = 40
-  	// Limits the rate at which a wheel can fire (in milliseconds). By default
-  	// user can't zoom via wheel more often than once per 40 ms.
-  	wheelDebounceTime: 40,
-
-  	// @option wheelPxPerZoomLevel: Number = 60
-  	// How many scroll pixels (as reported by [L.DomEvent.getWheelDelta](#domevent-getwheeldelta))
-  	// mean a change of one full zoom level. Smaller values will make wheel-zooming
-  	// faster (and vice versa).
-  	wheelPxPerZoomLevel: 60
-  });
-
-  var ScrollWheelZoom = Handler.extend({
-  	addHooks: function () {
-  		on(this._map._container, 'wheel', this._onWheelScroll, this);
-
-  		this._delta = 0;
-  	},
-
-  	removeHooks: function () {
-  		off(this._map._container, 'wheel', this._onWheelScroll, this);
-  	},
-
-  	_onWheelScroll: function (e) {
-  		var delta = getWheelDelta(e);
-
-  		var debounce = this._map.options.wheelDebounceTime;
-
-  		this._delta += delta;
-  		this._lastMousePos = this._map.mouseEventToContainerPoint(e);
-
-  		if (!this._startTime) {
-  			this._startTime = +new Date();
-  		}
-
-  		var left = Math.max(debounce - (+new Date() - this._startTime), 0);
-
-  		clearTimeout(this._timer);
-  		this._timer = setTimeout(bind(this._performZoom, this), left);
-
-  		stop(e);
-  	},
-
-  	_performZoom: function () {
-  		var map = this._map,
-  		    zoom = map.getZoom(),
-  		    snap = this._map.options.zoomSnap || 0;
-
-  		map._stop(); // stop panning and fly animations if any
-
-  		// map the delta with a sigmoid function to -4..4 range leaning on -1..1
-  		var d2 = this._delta / (this._map.options.wheelPxPerZoomLevel * 4),
-  		    d3 = 4 * Math.log(2 / (1 + Math.exp(-Math.abs(d2)))) / Math.LN2,
-  		    d4 = snap ? Math.ceil(d3 / snap) * snap : d3,
-  		    delta = map._limitZoom(zoom + (this._delta > 0 ? d4 : -d4)) - zoom;
-
-  		this._delta = 0;
-  		this._startTime = null;
-
-  		if (!delta) { return; }
-
-  		if (map.options.scrollWheelZoom === 'center') {
-  			map.setZoom(zoom + delta);
-  		} else {
-  			map.setZoomAround(this._lastMousePos, zoom + delta);
-  		}
-  	}
-  });
-
-  // @section Handlers
-  // @property scrollWheelZoom: Handler
-  // Scroll wheel zoom handler.
-  Map.addInitHook('addHandler', 'scrollWheelZoom', ScrollWheelZoom);
-
-  /*
-   * L.Map.Tap is used to enable mobile hacks like quick taps and long hold.
-   */
-
-  // @namespace Map
-  // @section Interaction Options
-  Map.mergeOptions({
-  	// @section Touch interaction options
-  	// @option tap: Boolean = true
-  	// Enables mobile hacks for supporting instant taps (fixing 200ms click
-  	// delay on iOS/Android) and touch holds (fired as `contextmenu` events).
-  	tap: true,
-
-  	// @option tapTolerance: Number = 15
-  	// The max number of pixels a user can shift his finger during touch
-  	// for it to be considered a valid tap.
-  	tapTolerance: 15
-  });
-
-  var Tap = Handler.extend({
-  	addHooks: function () {
-  		on(this._map._container, 'touchstart', this._onDown, this);
-  	},
-
-  	removeHooks: function () {
-  		off(this._map._container, 'touchstart', this._onDown, this);
-  	},
-
-  	_onDown: function (e) {
-  		if (!e.touches) { return; }
-
-  		preventDefault(e);
-
-  		this._fireClick = true;
-
-  		// don't simulate click or track longpress if more than 1 touch
-  		if (e.touches.length > 1) {
-  			this._fireClick = false;
-  			clearTimeout(this._holdTimeout);
-  			return;
-  		}
-
-  		var first = e.touches[0],
-  		    el = first.target;
-
-  		this._startPos = this._newPos = new Point(first.clientX, first.clientY);
-
-  		// if touching a link, highlight it
-  		if (el.tagName && el.tagName.toLowerCase() === 'a') {
-  			addClass(el, 'leaflet-active');
-  		}
-
-  		// simulate long hold but setting a timeout
-  		this._holdTimeout = setTimeout(bind(function () {
-  			if (this._isTapValid()) {
-  				this._fireClick = false;
-  				this._onUp();
-  				this._simulateEvent('contextmenu', first);
-  			}
-  		}, this), 1000);
-
-  		this._simulateEvent('mousedown', first);
-
-  		on(document, {
-  			touchmove: this._onMove,
-  			touchend: this._onUp
-  		}, this);
-  	},
-
-  	_onUp: function (e) {
-  		clearTimeout(this._holdTimeout);
-
-  		off(document, {
-  			touchmove: this._onMove,
-  			touchend: this._onUp
-  		}, this);
-
-  		if (this._fireClick && e && e.changedTouches) {
-
-  			var first = e.changedTouches[0],
-  			    el = first.target;
-
-  			if (el && el.tagName && el.tagName.toLowerCase() === 'a') {
-  				removeClass(el, 'leaflet-active');
-  			}
-
-  			this._simulateEvent('mouseup', first);
-
-  			// simulate click if the touch didn't move too much
-  			if (this._isTapValid()) {
-  				this._simulateEvent('click', first);
-  			}
-  		}
-  	},
-
-  	_isTapValid: function () {
-  		return this._newPos.distanceTo(this._startPos) <= this._map.options.tapTolerance;
-  	},
-
-  	_onMove: function (e) {
-  		var first = e.touches[0];
-  		this._newPos = new Point(first.clientX, first.clientY);
-  		this._simulateEvent('mousemove', first);
-  	},
-
-  	_simulateEvent: function (type, e) {
-  		var simulatedEvent = document.createEvent('MouseEvents');
-
-  		simulatedEvent._simulated = true;
-  		e.target._simulatedClick = true;
-
-  		simulatedEvent.initMouseEvent(
-  		        type, true, true, window, 1,
-  		        e.screenX, e.screenY,
-  		        e.clientX, e.clientY,
-  		        false, false, false, false, 0, null);
-
-  		e.target.dispatchEvent(simulatedEvent);
-  	}
-  });
-
-  // @section Handlers
-  // @property tap: Handler
-  // Mobile touch hacks (quick tap and touch hold) handler.
-  if (touch && (!pointer || safari)) {
-  	Map.addInitHook('addHandler', 'tap', Tap);
-  }
-
-  /*
-   * L.Handler.TouchZoom is used by L.Map to add pinch zoom on supported mobile browsers.
-   */
-
-  // @namespace Map
-  // @section Interaction Options
-  Map.mergeOptions({
-  	// @section Touch interaction options
-  	// @option touchZoom: Boolean|String = *
-  	// Whether the map can be zoomed by touch-dragging with two fingers. If
-  	// passed `'center'`, it will zoom to the center of the view regardless of
-  	// where the touch events (fingers) were. Enabled for touch-capable web
-  	// browsers except for old Androids.
-  	touchZoom: touch && !android23,
-
-  	// @option bounceAtZoomLimits: Boolean = true
-  	// Set it to false if you don't want the map to zoom beyond min/max zoom
-  	// and then bounce back when pinch-zooming.
-  	bounceAtZoomLimits: true
-  });
-
-  var TouchZoom = Handler.extend({
-  	addHooks: function () {
-  		addClass(this._map._container, 'leaflet-touch-zoom');
-  		on(this._map._container, 'touchstart', this._onTouchStart, this);
-  	},
-
-  	removeHooks: function () {
-  		removeClass(this._map._container, 'leaflet-touch-zoom');
-  		off(this._map._container, 'touchstart', this._onTouchStart, this);
-  	},
-
-  	_onTouchStart: function (e) {
-  		var map = this._map;
-  		if (!e.touches || e.touches.length !== 2 || map._animatingZoom || this._zooming) { return; }
-
-  		var p1 = map.mouseEventToContainerPoint(e.touches[0]),
-  		    p2 = map.mouseEventToContainerPoint(e.touches[1]);
-
-  		this._centerPoint = map.getSize()._divideBy(2);
-  		this._startLatLng = map.containerPointToLatLng(this._centerPoint);
-  		if (map.options.touchZoom !== 'center') {
-  			this._pinchStartLatLng = map.containerPointToLatLng(p1.add(p2)._divideBy(2));
-  		}
-
-  		this._startDist = p1.distanceTo(p2);
-  		this._startZoom = map.getZoom();
-
-  		this._moved = false;
-  		this._zooming = true;
-
-  		map._stop();
-
-  		on(document, 'touchmove', this._onTouchMove, this);
-  		on(document, 'touchend', this._onTouchEnd, this);
-
-  		preventDefault(e);
-  	},
-
-  	_onTouchMove: function (e) {
-  		if (!e.touches || e.touches.length !== 2 || !this._zooming) { return; }
-
-  		var map = this._map,
-  		    p1 = map.mouseEventToContainerPoint(e.touches[0]),
-  		    p2 = map.mouseEventToContainerPoint(e.touches[1]),
-  		    scale = p1.distanceTo(p2) / this._startDist;
-
-  		this._zoom = map.getScaleZoom(scale, this._startZoom);
-
-  		if (!map.options.bounceAtZoomLimits && (
-  			(this._zoom < map.getMinZoom() && scale < 1) ||
-  			(this._zoom > map.getMaxZoom() && scale > 1))) {
-  			this._zoom = map._limitZoom(this._zoom);
-  		}
-
-  		if (map.options.touchZoom === 'center') {
-  			this._center = this._startLatLng;
-  			if (scale === 1) { return; }
-  		} else {
-  			// Get delta from pinch to center, so centerLatLng is delta applied to initial pinchLatLng
-  			var delta = p1._add(p2)._divideBy(2)._subtract(this._centerPoint);
-  			if (scale === 1 && delta.x === 0 && delta.y === 0) { return; }
-  			this._center = map.unproject(map.project(this._pinchStartLatLng, this._zoom).subtract(delta), this._zoom);
-  		}
-
-  		if (!this._moved) {
-  			map._moveStart(true, false);
-  			this._moved = true;
-  		}
-
-  		cancelAnimFrame(this._animRequest);
-
-  		var moveFn = bind(map._move, map, this._center, this._zoom, {pinch: true, round: false});
-  		this._animRequest = requestAnimFrame(moveFn, this, true);
-
-  		preventDefault(e);
-  	},
-
-  	_onTouchEnd: function () {
-  		if (!this._moved || !this._zooming) {
-  			this._zooming = false;
-  			return;
-  		}
-
-  		this._zooming = false;
-  		cancelAnimFrame(this._animRequest);
-
-  		off(document, 'touchmove', this._onTouchMove, this);
-  		off(document, 'touchend', this._onTouchEnd, this);
-
-  		// Pinch updates GridLayers' levels only when zoomSnap is off, so zoomSnap becomes noUpdate.
-  		if (this._map.options.zoomAnimation) {
-  			this._map._animateZoom(this._center, this._map._limitZoom(this._zoom), true, this._map.options.zoomSnap);
-  		} else {
-  			this._map._resetView(this._center, this._map._limitZoom(this._zoom));
-  		}
-  	}
-  });
-
-  // @section Handlers
-  // @property touchZoom: Handler
-  // Touch zoom handler.
-  Map.addInitHook('addHandler', 'touchZoom', TouchZoom);
-
-  Map.BoxZoom = BoxZoom;
-  Map.DoubleClickZoom = DoubleClickZoom;
-  Map.Drag = Drag;
-  Map.Keyboard = Keyboard;
-  Map.ScrollWheelZoom = ScrollWheelZoom;
-  Map.Tap = Tap;
-  Map.TouchZoom = TouchZoom;
-
-  exports.version = version;
-  exports.Control = Control;
-  exports.control = control;
-  exports.Browser = Browser;
-  exports.Evented = Evented;
-  exports.Mixin = Mixin;
-  exports.Util = Util;
-  exports.Class = Class;
-  exports.Handler = Handler;
-  exports.extend = extend;
-  exports.bind = bind;
-  exports.stamp = stamp;
-  exports.setOptions = setOptions;
-  exports.DomEvent = DomEvent;
-  exports.DomUtil = DomUtil;
-  exports.PosAnimation = PosAnimation;
-  exports.Draggable = Draggable;
-  exports.LineUtil = LineUtil;
-  exports.PolyUtil = PolyUtil;
-  exports.Point = Point;
-  exports.point = toPoint;
-  exports.Bounds = Bounds;
-  exports.bounds = toBounds;
-  exports.Transformation = Transformation;
-  exports.transformation = toTransformation;
-  exports.Projection = index;
-  exports.LatLng = LatLng;
-  exports.latLng = toLatLng;
-  exports.LatLngBounds = LatLngBounds;
-  exports.latLngBounds = toLatLngBounds;
-  exports.CRS = CRS;
-  exports.GeoJSON = GeoJSON;
-  exports.geoJSON = geoJSON;
-  exports.geoJson = geoJson;
-  exports.Layer = Layer;
-  exports.LayerGroup = LayerGroup;
-  exports.layerGroup = layerGroup;
-  exports.FeatureGroup = FeatureGroup;
-  exports.featureGroup = featureGroup;
-  exports.ImageOverlay = ImageOverlay;
-  exports.imageOverlay = imageOverlay;
-  exports.VideoOverlay = VideoOverlay;
-  exports.videoOverlay = videoOverlay;
-  exports.SVGOverlay = SVGOverlay;
-  exports.svgOverlay = svgOverlay;
-  exports.DivOverlay = DivOverlay;
-  exports.Popup = Popup;
-  exports.popup = popup;
-  exports.Tooltip = Tooltip;
-  exports.tooltip = tooltip;
-  exports.Icon = Icon;
-  exports.icon = icon;
-  exports.DivIcon = DivIcon;
-  exports.divIcon = divIcon;
-  exports.Marker = Marker;
-  exports.marker = marker;
-  exports.TileLayer = TileLayer;
-  exports.tileLayer = tileLayer;
-  exports.GridLayer = GridLayer;
-  exports.gridLayer = gridLayer;
-  exports.SVG = SVG;
-  exports.svg = svg$1;
-  exports.Renderer = Renderer;
-  exports.Canvas = Canvas;
-  exports.canvas = canvas$1;
-  exports.Path = Path;
-  exports.CircleMarker = CircleMarker;
-  exports.circleMarker = circleMarker;
-  exports.Circle = Circle;
-  exports.circle = circle;
-  exports.Polyline = Polyline;
-  exports.polyline = polyline;
-  exports.Polygon = Polygon;
-  exports.polygon = polygon;
-  exports.Rectangle = Rectangle;
-  exports.rectangle = rectangle;
-  exports.Map = Map;
-  exports.map = createMap;
-
-  var oldL = window.L;
-  exports.noConflict = function() {
-  	window.L = oldL;
-  	return this;
-  }
-
-  // Always export us to window global (see #2364)
-  window.L = exports;
-
-})));
-//# sourceMappingURL=leaflet-src.js.map
diff --git a/multiple-extents/dist/map-area.js b/multiple-extents/dist/map-area.js
deleted file mode 100644
index 6d1fa47..0000000
--- a/multiple-extents/dist/map-area.js
+++ /dev/null
@@ -1,176 +0,0 @@
-import './leaflet-src.js';  // a lightly modified version of Leaflet for use as browser module
-import './proj4-src.js';        // modified version of proj4; could be stripped down for mapml
-import './proj4leaflet.js'; // not modified, seems to adapt proj4 for leaflet use. 
-import './mapml.js';       // refactored URI usage, replaced with URL standard
-
-export class MapArea extends HTMLAreaElement {
-  static get observedAttributes() {
-    return ['coords','alt','href','shape','rel','type','target'];
-  }
-  // see comments below regarding attributeChangedCallback vs. getter/setter 
-  // usage.  Effectively, the user of the element must use the property, not
-  // the getAttribute/setAttribute/removeAttribute DOM API, because the latter
-  // calls don't result in the getter/setter being called (so you have to use
-  // the getter/setter directly)
-  get alt() {
-    return this.hasAttribute('alt') ?  this.getAttribute('alt') : "";
-  }
-  set alt(value) {
-    this.setAttribute('controls', value);
-  }
-  get coords() {
-    return this.hasAttribute('coords') ? this.getAttribute('coords') : "";
-  }
-  set coords(coordinates) {
-    // what to do.  Probably replace the feature with a new one, without changing 
-    // anything else...
-  }
-  get href() {
-    return this.hasAttribute('href') ?  this.getAttribute('href') : "";
-  }
-  set href(url) {
-    this.href = url;
-  }
-  get shape() {
-    return this.hasAttribute('shape') ?  this.getAttribute('shape') : "default";
-  }
-  set shape(shape) {
-    shape = shape.toLowerCase();
-    var re = /default|circle|rect|poly/;
-    if (shape.search(re)) {
-      this.shape = shape;
-    }
-  }
-  get rel() {
-    return this.hasAttribute('rel') ?  this.getAttribute('rel') : "";
-  }
-  set rel(rel) {
-    this.rel = rel;
-  }
-  get type() {
-    return this.hasAttribute('type') ?  this.getAttribute('type') : "";
-  }
-  set type(type) {
-    this.type = type;
-  }
-  get target() {
-    return this.hasAttribute('target') ?  this.getAttribute('target') : "";
-  }
-  constructor() {
-    // Always call super first in constructor
-    super();
-  }
-  attributeChangedCallback(name, oldValue, newValue) {
-    
-  }
-  connectedCallback() {
-    // if the map has been attached, set this layer up wrt Leaflet map
-    if (this.parentElement._map) {
-        this._attachedToMap();
-    }
-  }
-  _attachedToMap() {
-    // need the map to convert container points to LatLngs
-    this._map = this.parentElement._map;
-    var map = this.parentElement._map;
-
-    // don't go through this if already done
-    if (!this._feature) {
-      // Scale this.coords if the this._map.poster exists because
-      // the img might have been scaled by CSS.
-      // compute the style properties to be applied to the feature
-      var options = this._styleToPathOptions(window.getComputedStyle(this)),
-          points = this.coords ? this._coordsToArray(this.coords): null;
-      // scale points if the poster exists because responsive areas
-      if (points && this.parentElement.poster) {
-        var worig = this.parentElement.poster.width, 
-            wresp = this.parentElement.width, 
-            wadjstmnt = (worig - wresp)/2,
-            horig = this.parentElement.poster.height, 
-            hresp = this.parentElement.height, 
-            hadjstmnt = (horig - hresp)/2;
-        for (var i = 0; i< points.length;i++) {
-          points[i][0] = points[i][0] - wadjstmnt;
-          points[i][1] = points[i][1] - hadjstmnt;
-        }
-      }
-
-      if (this.shape === 'circle') {
-        var pixelRadius = parseInt(this.coords.split(",")[2]), 
-            pointOnCirc = L.point(points[0]).add(L.point(0,pixelRadius)),
-            latLngOnCirc = map.containerPointToLatLng(pointOnCirc),
-            latLngCenter = map.containerPointToLatLng(points[0]),
-            radiusInMeters = map.distance(latLngCenter, latLngOnCirc);
-        this._feature = L.circle(latLngCenter, radiusInMeters, options).addTo(map);
-      } else if (!this.shape || this.shape === 'rect') {
-        var bounds = L.latLngBounds(map.containerPointToLatLng(points[0]), map.containerPointToLatLng(points[1]));
-        this._feature = L.rectangle(bounds, options).addTo(map);
-      } else if (this.shape === 'poly') {
-        this._feature = L.polygon(this._pointsToLatLngs(points),options).addTo(map);
-      } else {
-        // whole initial area of map is a hyperlink
-        this._feature = L.rectangle(map.getBounds(),options).addTo(map);
-      }
-      if (this.alt) {
-        // other Leaflet features are implemented via SVG.  SVG displays tooltips
-        // based on the <svg:title> graphics child element.
-        var title = L.SVG.create('title'),
-            titleText = document.createTextNode(this.alt);
-            title.appendChild(titleText);
-            this._feature._path.appendChild(title);
-      }
-      if (this.href) {
-        // conditionally act on click on an area link.  If no link it should be an
-        // inert area, but Leaflet doesn't quite support this.  For a full
-        // implementation, we could actually use an image map replete with area
-        // children which would provide the linking / cursor change behaviours
-        // that are familiar to HTML authors versed in image maps.
-        this._feature.on('click', function() {if (this.href) {window.open(this.href);}}, this);
-      }
-    }
-  }  
-  disconnectedCallback() {
-    this._map.removeLayer(this._feature);
-    delete this._feature;
-  }
-  _coordsToArray(containerPoints) {
-    // returns an array of arrays of coordinate pairs coordsToArray("1,2,3,4") -> [[1,2],[3,4]]
-    for (var i=1, points = [], coords = containerPoints.split(",");i<coords.length;i+=2) {
-      points.push([parseInt(coords[i-1]),parseInt(coords[i])]);
-    }
-    return points;
-  }
-  _pointsToLatLngs(points) {
-    // points should be an array of nested container coordinates [[x1,y1],[x2,y2](,[xN,yN])]
-    var latLngArray = [];
-    if (this._map) {
-      for (var i=0,map = this._map;i<points.length;i++) {
-        latLngArray.push(map.containerPointToLatLng(points[i]));
-      }
-    }
-    return latLngArray;
-  }
-  _styleToPathOptions(style) {
-    var options = {};
-    if(style.stroke !== 'none') {
-      options.stroke = true;
-      options.color = style.stroke;
-      options.opacity = style.strokeOpacity;
-      options.weight = parseInt(style.strokeWidth);
-      options.dashArray = style.strokeDasharray;
-      options.lineCap = style.strokeLinecap;
-      options.lineJoin = style.strokeLinejoin;
-    } else {
-      options.stroke = false;
-    }
-    if (style.fill !== 'none') {
-      options.fill = true;
-      options.fillColor = style.fill;
-      options.fillOpacity = style.fillOpacity;
-      options.fillRule = style.fillRule;
-    } else {
-      options.fill = false;
-    }
-    return options;
-  }
-}
diff --git a/multiple-extents/dist/mapml-viewer.js b/multiple-extents/dist/mapml-viewer.js
deleted file mode 100644
index 965fcf0..0000000
--- a/multiple-extents/dist/mapml-viewer.js
+++ /dev/null
@@ -1,756 +0,0 @@
-import './leaflet-src.js';  // a (very slightly) modified version of Leaflet for use as browser module
-import './proj4-src.js';        // modified version of proj4; could be stripped down for mapml
-import './proj4leaflet.js'; // not modified, seems to adapt proj4 for leaflet use.
-import './mapml.js';       // refactored URI usage, replaced with URL standard
-import { MapLayer } from './layer.js';
-
-export class MapViewer extends HTMLElement {
-  static get observedAttributes() {
-    return ['lat', 'lon', 'zoom', 'projection', 'width', 'height', 'controls'];
-  }
-  // see comments below regarding attributeChangedCallback vs. getter/setter
-  // usage.  Effectively, the user of the element must use the property, not
-  // the getAttribute/setAttribute/removeAttribute DOM API, because the latter
-  // calls don't result in the getter/setter being called (so you have to use
-  // the getter/setter directly)
-  get controls() {
-    return this.hasAttribute('controls');
-  }
-  set controls(value) {
-    const hasControls = Boolean(value);
-    if (hasControls)
-      this.setAttribute('controls', '');
-    else
-      this.removeAttribute('controls');
-    this._toggleControls(hasControls);
-  }
-  get controlslist() {
-    return this.hasAttribute('controlslist') ? this.getAttribute("controlslist") : "";
-  }
-  set controlslist(val) {
-    let options = ["nofullscreen", "nozoom", "nolayer", "noreload"],
-        lowerVal = val.toLowerCase();
-    if (this.controlslist.includes(lowerVal) || !options.includes(lowerVal))return;
-    this.setAttribute("controlslist", this.controlslist+` ${lowerVal}`);
-  }
-  get lat() {
-    return this.hasAttribute("lat") ? this.getAttribute("lat") : "0";
-  }
-  set lat(val) {
-    if (val) {
-      this.setAttribute("lat", val);
-    }
-  }
-  get lon() {
-    return this.hasAttribute("lon") ? this.getAttribute("lon") : "0";
-  }
-  set lon(val) {
-    if (val) {
-      this.setAttribute("lon", val);
-    }
-  }
-  get projection() {
-    return this.hasAttribute("projection") ? this.getAttribute("projection") : "";
-  }
-  set projection(val) {
-    if(val && M[val]){
-      this.setAttribute('projection', val);
-      if (this._map && this._map.options.projection !== val){
-        this._map.options.crs = M[val];
-        this._map.options.projection = val;
-        for(let layer of this.querySelectorAll("layer-")){
-          layer.removeAttribute("disabled");
-          let reAttach = this.removeChild(layer);
-          this.appendChild(reAttach);
-        }
-        if(this._debug) for(let i = 0; i<2;i++) this.toggleDebug();
-      } else this.dispatchEvent(new CustomEvent('createmap'));
-    } else throw new Error("Undefined Projection");
-  }
-  get zoom() {
-    return this.hasAttribute("zoom") ? this.getAttribute("zoom") : 0;
-  }
-  set zoom(val) {
-      var parsedVal = parseInt(val,10);
-      if (!isNaN(parsedVal) && (parsedVal >= 0 && parsedVal <= 25)) {
-        this.setAttribute('zoom', parsedVal);
-      }
-  }
-  get layers() {
-    return this.getElementsByTagName('layer-');
-  }
-
-  get extent(){
-    let map = this._map,
-      pcrsBounds = M.pixelToPCRSBounds(
-        map.getPixelBounds(),
-        map.getZoom(),
-        map.options.projection);
-    let formattedExtent = M.convertAndFormatPCRS(pcrsBounds, map);
-    if(map.getMaxZoom() !== Infinity){
-      formattedExtent.zoom = {
-        minZoom:map.getMinZoom(),
-        maxZoom:map.getMaxZoom()
-      };
-    }
-    return (formattedExtent);
-  }
-
-  constructor() {
-    // Always call super first in constructor
-    super();
-    this._source = this.outerHTML;
-    let tmpl = document.createElement('template');
-    tmpl.innerHTML = `<link rel="stylesheet" href="${new URL("mapml.css", import.meta.url).href}">`; // jshint ignore:line
-    
-    let shadowRoot = this.attachShadow({mode: 'open'});
-    this._container = document.createElement('div');
-
-    let output = "<output role='status' aria-live='polite' aria-atomic='true' class='mapml-screen-reader-output'></output>";
-    this._container.insertAdjacentHTML("beforeend", output);
-
-    // Set default styles for the map element.
-    let mapDefaultCSS = document.createElement('style');
-    mapDefaultCSS.innerHTML =
-    `:host {` +
-    `all: initial;` + // Reset properties inheritable from html/body, as some inherited styles may cause unexpected issues with the map element's components (https://github.com/Maps4HTML/Web-Map-Custom-Element/issues/140).
-    `contain: layout size;` + // Contain layout and size calculations within the map element.
-    `display: inline-block;` + // This together with dimension properties is required so that Leaflet isn't working with a height=0 box by default.
-    `height: 150px;` + // Provide a "default object size" (https://github.com/Maps4HTML/HTML-Map-Element/issues/31).
-    `width: 300px;` +
-    `border-width: 2px;` + // Set a default border for contrast, similar to UA default for iframes.
-    `border-style: inset;` +
-    `}` +
-    `:host([frameborder="0"]) {` +
-    `border-width: 0;` +
-    `}` +
-    `:host([hidden]) {` +
-    `display: none!important;` +
-    `}` +
-    `:host .leaflet-control-container {` +
-    `visibility: hidden!important;` + // Visibility hack to improve percieved performance (mitigate FOUC) – visibility is unset in mapml.css! (https://github.com/Maps4HTML/Web-Map-Custom-Element/issues/154).
-    `}`;
-    
-    // Hide all (light DOM) children of the map element.
-    let hideElementsCSS = document.createElement('style');
-    hideElementsCSS.innerHTML =
-    `mapml-viewer > * {` +
-    `display: none!important;` +
-    `}`;
-
-    shadowRoot.appendChild(mapDefaultCSS);
-    shadowRoot.appendChild(tmpl.content.cloneNode(true));
-    shadowRoot.appendChild(this._container);
-
-    this.appendChild(hideElementsCSS);
-
-    this._toggleState = false;
-    this.controlsListObserver = new MutationObserver((m) => {
-      m.forEach((change)=>{
-        if(change.type==="attributes" && change.attributeName === "controlslist")
-          this.setControls(false,false,false);
-      });
-    });
-    this.controlsListObserver.observe(this, {attributes:true});
-  }
-  connectedCallback() {
-    if (this.isConnected) {
-
-      // the dimension attributes win, if they're there. A map does not
-      // have an intrinsic size, unlike an image or video, and so must
-      // have a defined width and height.
-      var s = window.getComputedStyle(this),
-        wpx = s.width, hpx=s.height,
-        w = parseInt(wpx.replace('px','')),
-        h = parseInt(hpx.replace('px',''));
-
-      if (wpx === "" || hpx === "") {
-         return;
-      }
-
-      if (!this.width || this.width !== w) {
-        this._container.style.width = wpx;
-        this.width = w;
-      } else {
-        this._container.style.width = this.width+"px";
-      }
-
-      if (!this.height || this.height !== h) {
-        this._container.style.height = hpx;
-        this.height = h;
-      } else {
-        this._container.style.height = this.height+"px";
-      }
-
-      // create an array to track the history of the map and the current index
-      if(!this._history){
-        this._history = [];
-        this._historyIndex = -1;
-        this._traversalCall = false;
-      }
-
-      // wait for createmap event before creating leaflet map
-      // this allows a safeguard for the case where loading a custom TCRS takes longer than loading mapml-viewer.js/web-map.js
-      this.addEventListener('createmap', ()=>{
-        if (!this._map) {
-          this._map = L.map(this._container, {
-            center: new L.LatLng(this.lat, this.lon),
-            projection: this.projection,
-            query: true,
-            contextMenu: true,
-            announceMovement: M.options.announceMovement,
-            featureIndex: true,
-            mapEl: this,
-            crs: M[this.projection],
-            zoom: this.zoom,
-            zoomControl: false,
-            // because the M.MapMLLayer invokes _tileLayer._onMoveEnd when
-            // the mapml response is received the screen tends to flash.  I'm sure
-            // there is a better configuration than that, but at this moment
-            // I'm not sure how to approach that issue.
-            // See https://github.com/Maps4HTML/MapML-Leaflet-Client/issues/24
-            fadeAnimation: true
-          });
-          this._addToHistory();
-          // the attribution control is not optional
-          this._attributionControl =  this._map.attributionControl.setPrefix('<a href="https://www.w3.org/community/maps4html/" title="W3C Maps for HTML Community Group">Maps4HTML</a> | <a href="https://leafletjs.com" title="A JS library for interactive maps">Leaflet</a>');
-          this._attributionControl.getContainer().setAttribute("role","group");
-          this._attributionControl.getContainer().setAttribute("aria-label","Map data attribution");
-
-          this.setControls(false,false,true);
-          this._crosshair = M.crosshair().addTo(this._map);
-          
-          // https://github.com/Maps4HTML/Web-Map-Custom-Element/issues/274
-          this.setAttribute('role', 'application');
-          // Make the Leaflet container element programmatically identifiable
-          // (https://github.com/Leaflet/Leaflet/issues/7193).
-          this._container.setAttribute('role', 'region');
-          this._container.setAttribute('aria-label', 'Interactive map');
-    
-          this._setUpEvents();
-          // this.fire('load', {target: this});
-        }
-      }, {once:true});
- 
-      let custom = !(["CBMTILE","APSTILE","OSMTILE","WGS84"].includes(this.projection));
-      // if the page doesn't use nav.js or isn't custom then dispatch createmap event	
-      if(!custom){	
-        this.dispatchEvent(new CustomEvent('createmap'));
-      }
-    }
-  }
-  disconnectedCallback() {
-    //this._removeEvents();
-    delete this._map;
-  }
-  adoptedCallback() {
-//    console.log('Custom map element moved to new page.');
-  }
-
-  setControls(isToggle, toggleShow, setup){
-    if (this.controls && this._map) {
-      let controls = ["_zoomControl", "_reloadButton", "_fullScreenControl", "_layerControl"],
-          options = ["nozoom", "noreload", "nofullscreen", 'nolayer'],
-          mapSize = this._map.getSize().y,
-          totalSize = 0;
-
-      //removes the left hand controls, if not done they will be re-added in the incorrect order
-      //better to just reset them
-      for(let i = 0 ; i<3;i++){
-        if(this[controls[i]]){
-          this._map.removeControl(this[controls[i]]);
-          delete this[controls[i]];
-        }
-      }
-
-      if (!this.controlslist.toLowerCase().includes("nolayer") && !this._layerControl && this.layers.length > 0){
-        this._layerControl = M.mapMlLayerControl(null,{"collapsed": true, mapEl: this}).addTo(this._map);
-        //if this is the initial setup the layers dont need to be readded, causes issues if they are
-        if(!setup){
-          for (var i=0;i<this.layers.length;i++) {
-            if (!this.layers[i].hidden) {
-              this._layerControl.addOverlay(this.layers[i]._layer, this.layers[i].label);
-              this._map.on('moveend', this.layers[i]._validateDisabled,  this.layers[i]);
-              this.layers[i]._layerControl = this._layerControl;
-            }
-          }
-          this._map.fire("validate");
-        }
-      }
-      if (!this.controlslist.toLowerCase().includes("nozoom") && !this._zoomControl && (totalSize + 93) <= mapSize){
-        totalSize += 93;
-        this._zoomControl = L.control.zoom().addTo(this._map);
-      }
-      if (!this.controlslist.toLowerCase().includes("noreload") && !this._reloadButton && (totalSize + 49) <= mapSize){
-        totalSize += 49;
-        this._reloadButton = M.reloadButton().addTo(this._map);
-      }
-      if (!this.controlslist.toLowerCase().includes("nofullscreen") && !this._fullScreenControl && (totalSize + 49) <= mapSize){
-        totalSize += 49;
-        this._fullScreenControl = M.fullscreenButton().addTo(this._map);
-      }
-      //removes any control layers that are not needed, either by the toggling or by the controlslist attribute
-      for(let i in options){
-        if(this[controls[i]] && (this.controlslist.toLowerCase().includes(options[i]) || (isToggle && !toggleShow ))){
-          this._map.removeControl(this[controls[i]]);
-          delete this[controls[i]];
-        }
-      }
-    }
-  }
-  attributeChangedCallback(name, oldValue, newValue) {
-//    console.log('Attribute: ' + name + ' changed from: '+ oldValue + ' to: '+newValue);
-    // "Best practice": handle side-effects in this callback
-    // https://developers.google.com/web/fundamentals/web-components/best-practices
-    // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
-    // note that the example is misleading, since the user can't use
-    // setAttribute or removeAttribute to set the property, they need to use
-    // the property directly in their API usage, which kinda sucks
-    /*
-  const hasValue = newValue !== null;
-  switch (name) {
-    case 'checked':
-      // Note the attributeChangedCallback is only handling the *side effects*
-      // of setting the attribute.
-      this.setAttribute('aria-checked', hasValue);
-      break;
-    ...
-  }     */
-  }
-  _dropHandler(event) {
-    event.preventDefault();
-    // create a new <layer-> child of this <mapml-viewer> element
-      let l = new MapLayer();
-      l.src = event.dataTransfer.getData("text");
-      l.label = 'Layer';
-      l.checked = 'true';
-      this.appendChild(l);
-      l.addEventListener("error", function () {
-        if (l.parentElement) {
-          // should invoke lifecyle callbacks automatically by removing it from DOM
-          l.parentElement.removeChild(l);
-        }
-        // garbage collect it
-        l = null;
-      });
-  }
-  _dragoverHandler(event) {
-    function contains(list, value) {
-      for( var i = 0; i < list.length; ++i ) {
-        if(list[i] === value) return true;
-      }
-      return false;
-    }
-    // check if the thing being dragged is a URL
-    var isLink = contains( event.dataTransfer.types, "text/uri-list");
-    if (isLink) {
-      event.preventDefault();
-      event.dataTransfer.dropEffect = "copy";
-    }
-  }
-  _removeEvents() {
-    if (this._map) {
-      this._map.off('preclick click dblclick mousemove mouseover mouseout mousedown mouseup contextmenu', false, this);
-      this._map.off('load movestart move moveend zoomstart zoom zoomend', false, this);
-      this.removeEventListener("drop", this._dropHandler, false);
-      this.removeEventListener("dragover", this._dragoverHandler, false);
-    }
-  }
-  _setUpEvents() {
-    this.addEventListener("drop", this._dropHandler, false);
-    this.addEventListener("dragover", this._dragoverHandler, false);
-    this.addEventListener("change",
-    function(e) {
-      if(e.target.tagName === "LAYER-"){
-        this.dispatchEvent(new CustomEvent("layerchange", {details:{target: this, originalEvent: e}}));
-      }
-    }, false);
-
-    this.parentElement.addEventListener('keyup', function (e) {
-      if(e.keyCode === 9 && document.activeElement.nodeName === "MAPML-VIEWER"){
-        document.activeElement.dispatchEvent(new CustomEvent('mapfocused', {detail:
-              {target: this}}));
-      }
-    });
-    this.parentElement.addEventListener('mousedown', function (e) {
-      if(document.activeElement.nodeName === "MAPML-VIEWER"){
-        document.activeElement.dispatchEvent(new CustomEvent('mapfocused', {detail:
-              {target: this}}));
-      }
-    });
-    this._map.on('load',
-      function () {
-        this.dispatchEvent(new CustomEvent('load', {detail: {target: this}}));
-      }, this);
-    this._map.on('preclick',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('preclick', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      }, this);
-    this._map.on('click',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('click', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      }, this);
-    this._map.on('dblclick',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('dblclick', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      }, this);
-    this._map.on('mousemove',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('mousemove', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      }, this);
-    this._map.on('mouseover',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('mouseover', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      }, this);
-    this._map.on('mouseout',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('mouseout', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      }, this);
-    this._map.on('mousedown',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('mousedown', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      },this);
-    this._map.on('mouseup',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('mouseup', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      }, this);
-    this._map.on('contextmenu',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('contextmenu', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      }, this);
-    this._map.on('movestart',
-      function () {
-        this._updateMapCenter();
-        this.dispatchEvent(new CustomEvent('movestart', {detail:
-          {target: this}}));
-      }, this);
-    this._map.on('move',
-      function () {
-        this._updateMapCenter();
-        this.dispatchEvent(new CustomEvent('move', {detail:
-          {target: this}}));
-      }, this);
-    this._map.on('moveend',
-      function () {
-        this._updateMapCenter();
-        this._addToHistory();
-        this.dispatchEvent(new CustomEvent('moveend', {detail:
-          {target: this}}));
-      }, this);
-    this._map.on('zoomstart',
-      function () {
-        this._updateMapCenter();
-        this.dispatchEvent(new CustomEvent('zoomstart', {detail:
-          {target: this}}));
-      }, this);
-    this._map.on('zoom',
-      function () {
-        this._updateMapCenter();
-        this.dispatchEvent(new CustomEvent('zoom', {detail:
-          {target: this}}));
-      }, this);
-    this._map.on('zoomend',
-      function () {
-        this._updateMapCenter();
-        this.dispatchEvent(new CustomEvent('zoomend', {detail:
-          {target: this}}));
-      }, this);
-  }
-  _toggleControls() {
-    if (this._map) {
-      this.setControls(true, this._toggleState, false);
-      this._toggleState = !this._toggleState;
-    }
-  }
-
-  toggleDebug(){
-    if(this._debug){
-      this._debug.remove();
-      this._debug = undefined;
-    } else {
-      this._debug = M.debugOverlay().addTo(this._map);
-    }
-  }
-  
-  _widthChanged(width) {
-    this.style.width = width+"px";
-    this._container.style.width = width+"px";
-    if (this._map) {
-        this._map.invalidateSize(false);
-    }
-  }
-  _heightChanged(height) {
-    this.style.height = height+"px";
-    this._container.style.height = height+"px";
-    if (this._map) {
-        this._map.invalidateSize(false);
-    }
-  }
-  zoomTo(lat, lon, zoom) {
-    zoom = Number.isInteger(+zoom) ? +zoom : this.zoom;
-    let location = new L.LatLng(+lat, +lon);
-    this._map.setView(location, zoom);
-    this.zoom = zoom;
-    this.lat = location.lat;
-    this.lon = location.lng;
-  }
-  _updateMapCenter() {
-    // remember to tell Leaflet event handler that 'this' in here refers to
-    //  something other than the map in this case the custom polymer element
-    this.lat = this._map.getCenter().lat;
-    this.lon = this._map.getCenter().lng;
-    this.zoom = this._map.getZoom();
-  }
-
-  /**
-   * Adds to the maps history on moveends
-   * @private
-   */
-  _addToHistory(){
-    if(this._traversalCall > 0) { // this._traversalCall tracks how many consecutive moveends to ignore from history
-      this._traversalCall--;      // this is useful for ignoring moveends corresponding to back, forward and reload
-      return;
-    }
-
-    let mapLocation = this._map.getPixelBounds().getCenter();
-    let location = {
-      zoom: this._map.getZoom(),
-      x:mapLocation.x,
-      y:mapLocation.y,
-    };
-    this._historyIndex++;
-    this._history.splice(this._historyIndex, 0, location);
-  }
-
-  /**
-   * Allow user to move back in history
-   */
-  back(){
-    let history = this._history;
-    let curr = history[this._historyIndex];
-
-    if(this._historyIndex > 0){
-      this._historyIndex--;
-      let prev = history[this._historyIndex];
-
-      if(prev.zoom !== curr.zoom){
-        this._traversalCall = 2;  // allows the next 2 moveends to be ignored from history
-
-        let currScale = this._map.options.crs.scale(curr.zoom); // gets the scale of the current zoom level
-        let prevScale = this._map.options.crs.scale(prev.zoom); // gets the scale of the previous zoom level
-
-        let scale = currScale / prevScale; // used to convert the previous pixel location to be in terms of the current zoom level
-
-        this._map.panBy([((prev.x * scale) - curr.x), ((prev.y * scale) - curr.y)], {animate: false});
-        this._map.setZoom(prev.zoom);
-      } else {
-        this._traversalCall = 1;
-        this._map.panBy([(prev.x - curr.x), (prev.y - curr.y)]);
-      }
-    }
-  }
-
-  /**
-   * Allows user to move forward in history
-   */
-  forward(){
-    let history = this._history;
-    let curr = history[this._historyIndex];
-    if(this._historyIndex < history.length - 1){
-      this._historyIndex++;
-      let next = history[this._historyIndex];
-
-      if(next.zoom !== curr.zoom){
-        this._traversalCall = 2; // allows the next 2 moveends to be ignored from history
-
-        let currScale = this._map.options.crs.scale(curr.zoom); // gets the scale of the current zoom level
-        let nextScale = this._map.options.crs.scale(next.zoom); // gets the scale of the next zoom level
-
-        let scale = currScale / nextScale; // used to convert the next pixel location to be in terms of the current zoom level
-
-        this._map.panBy([((next.x * scale) - curr.x), ((next.y * scale) - curr.y)], {animate: false});
-        this._map.setZoom(next.zoom);
-      } else {
-        this._traversalCall = 1;
-        this._map.panBy([(next.x - curr.x), (next.y - curr.y)]);
-      }
-    }
-  }
-
-  /**
-   * Allows the user to reload/reset the map's location to it's initial location
-   */
-  reload(){
-    let initialLocation = this._history.shift();
-    let mapLocation = this._map.getPixelBounds().getCenter();
-    let curr = {
-      zoom: this._map.getZoom(),
-      x:mapLocation.x,
-      y:mapLocation.y,
-    };
-
-    this._history = [initialLocation];
-    this._historyIndex = 0;
-
-    if(initialLocation.zoom !== curr.zoom) {
-      this._traversalCall = 2; // ignores the next 2 moveend events
-
-      let currScale = this._map.options.crs.scale(curr.zoom); // gets the scale of the current zoom level
-      let initScale = this._map.options.crs.scale(initialLocation.zoom); // gets the scale of the initial location's zoom
-
-      let scale = currScale / initScale;
-
-      this._map.panBy([((initialLocation.x * scale) - curr.x), ((initialLocation.y * scale) - curr.y)], {animate: false});
-      this._map.setZoom(initialLocation.zoom);
-    } else { // if it's on the same zoom level as the initial location, no need to calculate scales
-      this._traversalCall = 1;
-      this._map.panBy([(initialLocation.x- curr.x), (initialLocation.y - curr.y)]);
-    }
-  }
-
-  viewSource(){
-    let blob = new Blob([this._source],{type:"text/plain"}),
-        url = URL.createObjectURL(blob);
-    window.open(url);
-    URL.revokeObjectURL(url);
-  }
-
-  defineCustomProjection(jsonTemplate) {
-    let t = JSON.parse(jsonTemplate);
-    if (t === undefined || !t.proj4string || !t.projection || !t.resolutions || !t.origin || !t.bounds) throw new Error('Incomplete TCRS Definition');
-    if (t.projection.indexOf(":") >= 0) throw new Error('":" is not permitted in projection name');
-    if (M[t.projection.toUpperCase()]) return t.projection.toUpperCase();
-    let tileSize = [256, 512, 1024, 2048, 4096].includes(t.tilesize)?t.tilesize:256;
-
-    M[t.projection] = new L.Proj.CRS(t.projection, t.proj4string, {
-      origin: t.origin,
-      resolutions: t.resolutions,
-      bounds: L.bounds(t.bounds),
-      crs: {
-        tcrs: {
-          horizontal: {
-            name: "x",
-            min: 0, 
-            max: zoom => (M[t.projection].options.bounds.getSize().x / M[t.projection].options.resolutions[zoom]).toFixed()
-          },
-          vertical: {
-            name: "y",
-            min:0, 
-            max: zoom => (M[t.projection].options.bounds.getSize().y / M[t.projection].options.resolutions[zoom]).toFixed()
-          },
-          bounds: zoom => L.bounds([M[t.projection].options.crs.tcrs.horizontal.min,
-            M[t.projection].options.crs.tcrs.vertical.min],
-            [M[t.projection].options.crs.tcrs.horizontal.max(zoom),
-            M[t.projection].options.crs.tcrs.vertical.max(zoom)])
-        },
-        pcrs: {
-          horizontal: {
-            name: "easting",
-            get min() {return M[t.projection].options.bounds.min.x;},
-            get max() {return M[t.projection].options.bounds.max.x;}
-          }, 
-          vertical: {
-            name: "northing", 
-            get min() {return M[t.projection].options.bounds.min.y;},
-            get max() {return M[t.projection].options.bounds.max.y;}
-          },
-          get bounds() {return M[t.projection].options.bounds;}
-        }, 
-        gcrs: {
-          horizontal: {
-            name: "longitude",
-            // set min/max axis values from EPSG registry area of use, retrieved 2019-07-25
-            get min() {return M[t.projection].unproject(M.OSMTILE.options.bounds.min).lng;},
-            get max() {return M[t.projection].unproject(M.OSMTILE.options.bounds.max).lng;}
-          }, 
-          vertical: {
-            name: "latitude",
-            // set min/max axis values from EPSG registry area of use, retrieved 2019-07-25
-            get min() {return M[t.projection].unproject(M.OSMTILE.options.bounds.min).lat;},
-            get max() {return M[t.projection].unproject(M.OSMTILE.options.bounds.max).lat;}
-          },
-          get bounds() {return L.latLngBounds(
-                [M[t.projection].options.crs.gcrs.vertical.min,M[t.projection].options.crs.gcrs.horizontal.min],
-                [M[t.projection].options.crs.gcrs.vertical.max,M[t.projection].options.crs.gcrs.horizontal.max]);}
-        },
-        map: {
-          horizontal: {
-            name: "i",
-            min: 0,
-            max: map => map.getSize().x
-          },
-          vertical: {
-            name: "j",
-            min: 0,
-            max: map => map.getSize().y
-          },
-          bounds: map => L.bounds(L.point([0,0]),map.getSize())
-        },
-        tile: {
-          horizontal: {
-            name: "i",
-            min: 0,
-            max: tileSize,
-          },
-          vertical: {
-            name: "j",
-            min: 0,
-            max: tileSize,
-          },
-          get bounds() {return L.bounds(
-                    [M[t.projection].options.crs.tile.horizontal.min,M[t.projection].options.crs.tile.vertical.min],
-                    [M[t.projection].options.crs.tile.horizontal.max,M[t.projection].options.crs.tile.vertical.max]);}
-        },
-        tilematrix: {
-          horizontal: {
-            name: "column",
-            min: 0,
-            max: zoom => (M[t.projection].options.crs.tcrs.horizontal.max(zoom) / M[t.projection].options.crs.tile.bounds.getSize().x).toFixed()
-          },
-          vertical: {
-            name: "row",
-            min: 0,
-            max: zoom => (M[t.projection].options.crs.tcrs.vertical.max(zoom) / M[t.projection].options.crs.tile.bounds.getSize().y).toFixed()
-          },
-          bounds: zoom => L.bounds(
-                   [M[t.projection].options.crs.tilematrix.horizontal.min,
-                   M[t.projection].options.crs.tilematrix.vertical.min],
-                   [M[t.projection].options.crs.tilematrix.horizontal.max(zoom),
-                   M[t.projection].options.crs.tilematrix.vertical.max(zoom)])
-        }
-      },
-    });      //creates crs using L.Proj
-    M[t.projection.toUpperCase()] = M[t.projection]; //adds the projection uppercase to global M
-    return t.projection;
-  }
-}
-// need to provide options { extends: ... }  for custom built-in elements
-window.customElements.define('mapml-viewer', MapViewer);
-window.customElements.define('layer-', MapLayer);
diff --git a/multiple-extents/dist/mapml.css b/multiple-extents/dist/mapml.css
deleted file mode 100644
index 5a2ed2c..0000000
--- a/multiple-extents/dist/mapml.css
+++ /dev/null
@@ -1,5 +0,0 @@
-.leaflet-image-layer,.leaflet-layer,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-pane,.leaflet-pane>canvas,.leaflet-pane>svg,.leaflet-tile,.leaflet-tile-container,.leaflet-zoom-box{position:absolute;left:0;top:0}.leaflet-container{overflow:hidden}.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile{-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-user-drag:none}.leaflet-tile::selection{background:0 0}.leaflet-safari .leaflet-tile{image-rendering:-webkit-optimize-contrast}.leaflet-safari .leaflet-tile-container{width:1600px;height:1600px;-webkit-transform-origin:0 0}.leaflet-marker-icon,.leaflet-marker-shadow{display:block}.leaflet-container .leaflet-marker-pane img,.leaflet-container .leaflet-overlay-pane svg,.leaflet-container .leaflet-shadow-pane img,.leaflet-container .leaflet-tile,.leaflet-container .leaflet-tile-pane img,.leaflet-container img.leaflet-image-layer{max-width:none!important;max-height:none!important}.leaflet-container.leaflet-touch-zoom{-ms-touch-action:pan-x pan-y;touch-action:pan-x pan-y}.leaflet-container.leaflet-touch-drag{-ms-touch-action:pinch-zoom;touch-action:none;touch-action:pinch-zoom}.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom{-ms-touch-action:none;touch-action:none}.leaflet-container{-webkit-tap-highlight-color:transparent}.leaflet-container a{-webkit-tap-highlight-color:rgba(51,181,229,0.4)}.leaflet-tile{filter:inherit;visibility:hidden}.leaflet-tile-loaded{visibility:inherit}.leaflet-zoom-box{width:0;height:0;-moz-box-sizing:border-box;box-sizing:border-box;z-index:800}.leaflet-overlay-pane svg{-moz-user-select:none}.leaflet-pane{z-index:400}.leaflet-tile-pane{z-index:200}.leaflet-overlay-pane{z-index:400}.leaflet-shadow-pane{z-index:500}.leaflet-marker-pane{z-index:600}.leaflet-tooltip-pane{z-index:650}.leaflet-popup-pane{z-index:700}.leaflet-map-pane canvas{z-index:100}.leaflet-map-pane svg{z-index:200}.leaflet-vml-shape{width:1px;height:1px}.lvml{behavior:url(#default#VML);display:inline-block;position:absolute}.leaflet-control{position:relative;z-index:800;pointer-events:visiblePainted;pointer-events:auto}.leaflet-bottom,.leaflet-top{position:absolute;z-index:1000;pointer-events:none}.leaflet-top{top:0}.leaflet-right{right:0}.leaflet-bottom{bottom:0}.leaflet-left{left:0}.leaflet-control{float:left;clear:both}.leaflet-right .leaflet-control{float:right}.leaflet-top .leaflet-control{margin-top:10px}.leaflet-bottom .leaflet-control{margin-bottom:10px}.leaflet-left .leaflet-control{margin-left:10px}.leaflet-right .leaflet-control{margin-right:10px}.leaflet-fade-anim .leaflet-tile{will-change:opacity}.leaflet-fade-anim .leaflet-popup{opacity:0;-webkit-transition:opacity .2s linear;-moz-transition:opacity .2s linear;transition:opacity .2s linear}.leaflet-fade-anim .leaflet-map-pane .leaflet-popup{opacity:1}.leaflet-zoom-animated{-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0}.leaflet-zoom-anim .leaflet-zoom-animated{will-change:transform}.leaflet-zoom-anim .leaflet-zoom-animated{-webkit-transition:-webkit-transform .25s cubic-bezier(0,0,.25,1);-moz-transition:-moz-transform .25s cubic-bezier(0,0,.25,1);transition:transform .25s cubic-bezier(0,0,.25,1)}.leaflet-pan-anim .leaflet-tile,.leaflet-zoom-anim .leaflet-tile{-webkit-transition:none;-moz-transition:none;transition:none}.leaflet-zoom-anim .leaflet-zoom-hide{visibility:hidden}.leaflet-interactive{cursor:pointer}.leaflet-grab{cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.leaflet-crosshair,.leaflet-crosshair .leaflet-interactive{cursor:crosshair}.leaflet-control,.leaflet-popup-pane{cursor:auto}.leaflet-dragging .leaflet-grab,.leaflet-dragging .leaflet-grab .leaflet-interactive,.leaflet-dragging .leaflet-marker-draggable{cursor:move;cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.leaflet-image-layer,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-pane>svg path,.leaflet-tile-container{pointer-events:none}.leaflet-image-layer.leaflet-interactive,.leaflet-marker-icon.leaflet-interactive,.leaflet-pane>svg path.leaflet-interactive,svg.leaflet-image-layer.leaflet-interactive path{pointer-events:visiblePainted;pointer-events:auto}.leaflet-container{background:#ddd;outline:0}.leaflet-container a{color:#0078a8}.leaflet-container a.leaflet-active{outline:2px solid orange}.leaflet-zoom-box{border:2px dotted #38f;background:rgba(255,255,255,.5)}.leaflet-container{font:12px/1.5 "Helvetica Neue",Arial,Helvetica,sans-serif}.leaflet-bar{box-shadow:0 1px 5px rgba(0,0,0,.65);border-radius:4px}.leaflet-bar a,.leaflet-bar a:hover{background-color:#fff;border-bottom:1px solid #ccc;width:26px;height:26px;line-height:26px;display:block;text-align:center;text-decoration:none;color:#000}.leaflet-bar a,.leaflet-control-layers-toggle{background-position:50% 50%;background-repeat:no-repeat;display:block}.leaflet-bar a:hover{background-color:#f4f4f4}.leaflet-bar a:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.leaflet-bar a:last-child{border-bottom-left-radius:4px;border-bottom-right-radius:4px;border-bottom:none}.leaflet-bar a.leaflet-disabled{cursor:default;background-color:#f4f4f4;color:#bbb}.leaflet-touch .leaflet-bar a{width:30px;height:30px;line-height:30px}.leaflet-touch .leaflet-bar a:first-child{border-top-left-radius:2px;border-top-right-radius:2px}.leaflet-touch .leaflet-bar a:last-child{border-bottom-left-radius:2px;border-bottom-right-radius:2px}.leaflet-control-zoom-in,.leaflet-control-zoom-out{font:bold 18px 'Lucida Console',Monaco,monospace;text-indent:1px}.leaflet-touch .leaflet-control-zoom-in,.leaflet-touch .leaflet-control-zoom-out{font-size:22px}.leaflet-control-layers{box-shadow:0 1px 5px rgba(0,0,0,.4);background:#fff;border-radius:5px}.leaflet-control-layers-toggle{background-image:url(images/layers.png);width:36px;height:36px}.leaflet-retina .leaflet-control-layers-toggle{background-image:url(images/layers-2x.png);background-size:26px 26px}.leaflet-touch .leaflet-control-layers-toggle{width:44px;height:44px}.leaflet-control-layers .leaflet-control-layers-list,.leaflet-control-layers-expanded .leaflet-control-layers-toggle{display:none}.leaflet-control-layers-expanded .leaflet-control-layers-list{display:block;position:relative}.leaflet-control-layers-expanded{padding:6px 10px 6px 6px;color:#333;background:#fff}.leaflet-control-layers-scrollbar{overflow-y:scroll;overflow-x:hidden;padding-right:5px}.leaflet-control-layers-selector{margin-top:2px;position:relative;top:1px}.leaflet-control-layers label{display:block}.leaflet-control-layers-separator{height:0;border-top:1px solid #ddd;margin:5px -10px 5px -6px}.leaflet-default-icon-path{background-image:url(images/marker-icon.png)}.leaflet-container .leaflet-control-attribution{background:#fff;background:rgba(255,255,255,.7);margin:0}.leaflet-control-attribution,.leaflet-control-scale-line{padding:0 5px;color:#333}.leaflet-control-attribution a{text-decoration:none}.leaflet-control-attribution a:hover{text-decoration:underline}.leaflet-container .leaflet-control-attribution,.leaflet-container .leaflet-control-scale{font-size:11px}.leaflet-left .leaflet-control-scale{margin-left:5px}.leaflet-bottom .leaflet-control-scale{margin-bottom:5px}.leaflet-control-scale-line{border:2px solid #777;border-top:none;line-height:1.1;padding:2px 5px 1px;font-size:11px;white-space:nowrap;overflow:hidden;-moz-box-sizing:border-box;box-sizing:border-box;background:#fff;background:rgba(255,255,255,.5)}.leaflet-control-scale-line:not(:first-child){border-top:2px solid #777;border-bottom:none;margin-top:-2px}.leaflet-control-scale-line:not(:first-child):not(:last-child){border-bottom:2px solid #777}.leaflet-touch .leaflet-bar,.leaflet-touch .leaflet-control-attribution,.leaflet-touch .leaflet-control-layers{box-shadow:none}.leaflet-touch .leaflet-bar,.leaflet-touch .leaflet-control-layers{border:2px solid rgba(0,0,0,.2);background-clip:padding-box}.leaflet-popup{position:absolute;text-align:center;margin-bottom:20px}.leaflet-popup-content-wrapper{padding:1px;text-align:left;border-radius:12px}.leaflet-popup-content{margin:13px 19px;line-height:1.4}.leaflet-popup-content p{margin:18px 0}.leaflet-popup-tip-container{width:40px;height:20px;position:absolute;left:50%;margin-left:-20px;overflow:hidden;pointer-events:none}.leaflet-popup-tip{width:17px;height:17px;padding:1px;margin:-10px auto 0;-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.leaflet-popup-content-wrapper,.leaflet-popup-tip{background:#fff;color:#333;box-shadow:0 3px 14px rgba(0,0,0,.4)}.leaflet-container a.leaflet-popup-close-button{position:absolute;top:0;right:0;padding:4px 4px 0 0;border:none;text-align:center;width:18px;height:14px;font:16px/14px Tahoma,Verdana,sans-serif;color:#c3c3c3;text-decoration:none;font-weight:700;background:0 0}.leaflet-container a.leaflet-popup-close-button:hover{color:#999}.leaflet-popup-scrolled{overflow:auto;border-bottom:1px solid #ddd;border-top:1px solid #ddd}.leaflet-oldie .leaflet-popup-content-wrapper{-ms-zoom:1}.leaflet-oldie .leaflet-popup-tip{width:24px;margin:0 auto}.leaflet-oldie .leaflet-popup-tip-container{margin-top:-1px}.leaflet-oldie .leaflet-control-layers,.leaflet-oldie .leaflet-control-zoom,.leaflet-oldie .leaflet-popup-content-wrapper,.leaflet-oldie .leaflet-popup-tip{border:1px solid #999}.leaflet-div-icon{background:#fff;border:1px solid #666}.leaflet-tooltip{position:absolute;padding:6px;background-color:#fff;border:1px solid #fff;border-radius:3px;color:#222;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;box-shadow:0 1px 3px rgba(0,0,0,.4)}.leaflet-tooltip.leaflet-clickable{cursor:pointer;pointer-events:auto}.leaflet-tooltip-bottom:before,.leaflet-tooltip-left:before,.leaflet-tooltip-right:before,.leaflet-tooltip-top:before{position:absolute;pointer-events:none;border:6px solid transparent;background:0 0;content:""}.leaflet-tooltip-bottom{margin-top:6px}.leaflet-tooltip-top{margin-top:-6px}.leaflet-tooltip-bottom:before,.leaflet-tooltip-top:before{left:50%;margin-left:-6px}.leaflet-tooltip-top:before{bottom:0;margin-bottom:-12px;border-top-color:#fff}.leaflet-tooltip-bottom:before{top:0;margin-top:-12px;margin-left:-6px;border-bottom-color:#fff}.leaflet-tooltip-left{margin-left:-6px}.leaflet-tooltip-right{margin-left:6px}.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{top:50%;margin-top:-6px}.leaflet-tooltip-left:before{right:0;margin-right:-12px;border-left-color:#fff}.leaflet-tooltip-right:before{left:0;margin-left:-12px;border-right-color:#fff}.leaflet-container{background-color:transparent;max-height:100%;max-width:100%;min-height:100%;min-width:100%;width:100%!important;height:100%!important}.leaflet-tile img{position:absolute;left:0;top:0}.leaflet-fade-anim .leaflet-image-layer{will-change:opacity}.leaflet-image-layer{visibility:hidden}.leaflet-image-loaded{visibility:inherit}.leaflet-container .leaflet-control-attribution,.leaflet-container .leaflet-control-scale,.leaflet-control-scale-line{font-size:12px}.mapml-button{background-color:transparent;border:none;border-radius:0;color:inherit;font:inherit;line-height:inherit;margin:0;padding:0;overflow:hidden;text-align:inherit;text-transform:none;-webkit-appearance:none;-moz-appearance:none;appearance:none}.leaflet-container a{color:revert}.leaflet-container a.leaflet-popup-close-button,.leaflet-container a.leaflet-popup-close-button:hover,.leaflet-control-container a,.mapml-reload-button{color:#000}.mapml-layer-item-name a{color:revert}.leaflet-top .leaflet-control{margin-top:5px}.leaflet-left .leaflet-control{margin-left:5px}.leaflet-bar a,.mapml-reload-button{background-color:#fff;box-sizing:border-box;width:44px!important;height:44px!important;line-height:44px!important;font-size:34px!important;font-weight:400;text-align:center}.mapml-reload-button:not([aria-disabled=true]):hover{background-color:#f4f4f4}.mapml-reload-button[aria-disabled=true]{color:#bbb;cursor:default}.leaflet-control-layers-toggle{width:44px!important;height:44px!important}.leaflet-bar a,.leaflet-control-layers,.mapml-reload-button{border-color:#e3e3e3!important}.leaflet-control-layers,.mapml-reload-button{border-radius:4px!important}.leaflet-touch .leaflet-bar a:last-child{border-bottom-left-radius:4px!important;border-bottom-right-radius:4px!important}.leaflet-touch .leaflet-bar a:first-child{border-top-left-radius:4px!important;border-top-right-radius:4px!important}.leaflet-touch .leaflet-bar,.leaflet-touch .leaflet-control-layers{border-style:inherit}.leaflet-bar,.leaflet-control-layers,.leaflet-popup-content-wrapper,.leaflet-popup-tip,.leaflet-tooltip-pane .leaflet-tooltip,.leaflet-touch .leaflet-bar,.leaflet-touch .leaflet-control-layers,.mapml-contextmenu,.mapml-debug{box-shadow:0 1px 3px rgba(0,0,0,.2),0 1px 2px rgb(0,0,0,.3)}.leaflet-container .leaflet-control-attribution{background-color:rgba(255,255,255,.95)}.leaflet-control-attribution a{color:revert;text-decoration:revert}.leaflet-control-zoom-in,.leaflet-control-zoom-out{text-indent:unset}.leaflet-control-fullscreen a{background-image:url("data:image/svg+xml,%0A%3Csvg width='26' height='52' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg transform='translate(0 -1000.4)'%3E%3Cuse transform='translate(0 26)' width='100%25' height='100%25' xlink:href='%23a'/%3E%3Cuse transform='translate(0 26)' width='100%25' height='100%25' xlink:href='%23b'/%3E%3Cuse transform='translate(0 26)' width='100%25' height='100%25' xlink:href='%23c'/%3E%3Cuse transform='translate(0 26)' width='100%25' height='100%25' xlink:href='%23d'/%3E%3Cpath id='a' transform='translate(0 1000.4)' d='M5 15v6h6v-2H7v-4z' color='%23000' fill='%23404040'/%3E%3Cpath id='b' transform='translate(0 1000.4)' d='M21 15v6h-6v-2h4v-4z' color='%23000' fill='%23404040'/%3E%3Cpath d='M10 1037.4v4l1 1h4l1-1v-4l-1-1h-4z' color='%23000' fill='%23404040'/%3E%3Cpath id='d' d='M5 1011.4v-6h6v2H7v4z' color='%23000' fill='%23404040'/%3E%3Cpath id='c' d='M21 1011.4v-6h-6v2h4v4z' color='%23000' fill='%23404040'/%3E%3C/g%3E%3C/svg%3E");background-repeat:no-repeat;background-size:38px 76px;background-position:3px 3px}:host(.mapml-fullscreen-on) .leaflet-control-fullscreen a{background-position:3px -35px}:host(:-webkit-full-screen){width:100%!important;height:100%!important}:host(.mapml-fullscreen-on){width:100%!important;height:100%!important}:host(.leaflet-pseudo-fullscreen){position:fixed!important;width:100%!important;height:100%!important;top:0!important;left:0!important;z-index:99999}.leaflet-control-layers.leaflet-control{margin-right:5px;margin-left:5px;padding:0}.leaflet-control-layers-list{padding:0;text-transform:capitalize}.leaflet-control-layers fieldset{margin:0;padding:0;min-height:44px}.leaflet-control-layers label{display:inline}.mapml-control-layers>:not(summary){display:block;margin-block-start:5px;margin-inline-start:15px;width:calc(100% - 15px)}.mapml-layer-item-style>div{display:flex}.mapml-layer-item-style input{margin-inline-start:0}.leaflet-control .leaflet-control-layers-toggle{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M0 0h24v24H0V0z' fill='none'/%3E%3Cpath d='m11.99 18.54-7.37-5.73L3 14.07l9 7 9-7-1.63-1.27zM12 16l7.36-5.73L21 9l-9-7-9 7 1.63 1.27L12 16zm0-11.47L17.74 9 12 13.47 6.26 9 12 4.53z'/%3E%3C/svg%3E");background-size:34px}.leaflet-control-layers-selector{margin-top:revert;position:revert}.mapml-contextmenu{border-radius:4px;padding:4px 0;background-color:#fff;cursor:default;position:absolute;width:160px;z-index:10001}.mapml-contextmenu button.mapml-contextmenu-item{color:#222;font-size:12px;line-height:20px;text-decoration:none;padding:0 12px;border-top:1px solid transparent;border-bottom:1px solid transparent;cursor:default;width:100%}.mapml-contextmenu button.mapml-contextmenu-item.over{background-color:#f4f4f4;border-top:1px solid #f0f0f0;border-bottom:1px solid #f0f0f0}.mapml-contextmenu-separator{border-bottom:1px solid #e3e3e3;margin:5px 0}.mapml-contextmenu.mapml-submenu{width:80px;margin-bottom:-2rem}@supports (contain:layout){.mapml-contextmenu{position:fixed}.mapml-contextmenu.mapml-submenu{position:absolute}}.mapml-contextmenu-item[aria-controls] span::after{content:">"}@supports (list-style-type:disclosure-open){.mapml-contextmenu-item[aria-controls] span{display:inline-block}.mapml-contextmenu-item[aria-controls] span::after{content:"";display:list-item;list-style-type:disclosure-closed;margin-inline-start:20px}}.mapml-debug{contain:content;max-height:100%;max-width:100%;border-radius:4px;padding:5px 10px;background-color:#fff;cursor:default;z-index:1000;position:absolute;display:block;top:auto;right:5px;bottom:5px;left:5px;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;font:inherit}.mapml-debug-banner{font-weight:700;text-transform:uppercase;display:inline-block;text-align:left;text-align:inline-start;line-height:2}.mapml-debug-grid,.mapml-debug-panel{font-family:monospace}.mapml-debug-tile{text-indent:6px;line-height:1.8}.mapml-debug-coordinates{padding-left:4px;padding-right:4px}.mapml-debug,.mapml-debug *{border-collapse:collapse;border-spacing:0}.mapml-debug-coordinates:empty{display:none}.mapml-debug-coordinates>*{display:inline}:host(.mapml-fullscreen-on) .mapml-debug-grid{color:#fff;text-shadow:1px 1px 1px #000,1px 1px 1px #000}:host(.leaflet-drag-target) .leaflet-grab{cursor:move;cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}:host(.leaflet-drag-target) .leaflet-control{pointer-events:none}.leaflet-control :not([draggable=true]),.leaflet-popup-close-button,.mapml-contextmenu :not([draggable=true]),.mapml-popup-button{-webkit-user-drag:none}.leaflet-control,.mapml-contextmenu,.mapml-debug,.mapml-focus-buttons,.mapml-layer-item-settings summary{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.leaflet-control a::selection,.leaflet-control-attribution::selection,.leaflet-popup-close-button::selection{background-color:transparent}.leaflet-crosshair *,.leaflet-tooltip,.mapml-contextmenu-item>*,.mapml-layer-item-settings .mapml-control-layers summary label,.mapml-link-preview{pointer-events:none!important}.leaflet-container :focus{outline-color:-webkit-focus-ring-color!important;outline-style:auto!important;outline-width:thin!important;outline:revert!important}.leaflet-active:not(:focus){outline:unset!important}.leaflet-container:not(:focus-within) .mapml-outline{outline:0}.leaflet-container:not(:focus-within) .mapml-crosshair{display:none}.leaflet-control a{-webkit-tap-highlight-color:initial}.leaflet-zoom-box{border:thin dotted;background-color:rgba(255,255,255,.33)}button,input,label,summary{cursor:pointer}.mapml-draggable,.mapml-draggable *{cursor:row-resize}.leaflet-crosshair{cursor:crosshair}[hidden]{display:none!important}.leaflet-container .leaflet-control-container,.leaflet-container .mapml-contextmenu{visibility:unset!important}.mapml-crosshair{margin:-36px 0 0 -36px;width:72px;height:72px;left:50%;top:50%;position:absolute;z-index:10000}.mapml-popup-button{padding:0 4px 0 4px;border:none;text-align:center;font:16px/14px Tahoma,Verdana,sans-serif;color:inherit;text-decoration:none;font-weight:700;background:0 0;white-space:nowrap;box-sizing:border-box;width:44px;height:44px;line-height:44px}.mapml-focus-buttons{white-space:nowrap}.mapml-feature-count{display:inline;white-space:nowrap;text-align:center;padding:2px}.leaflet-container a.leaflet-popup-close-button,.mapml-focus-buttons button{width:44px;height:44px;min-width:44px;min-height:44px;line-height:44px}.leaflet-popup-content{margin:0;min-width:min-content}.mapml-popup-content{padding-top:44px}.mapml-focus-buttons{display:block;text-align:center}.mapml-focus-buttons button{display:inline-block;padding:0}.leaflet-container a.leaflet-popup-close-button{padding:0;font-size:20px}.leaflet-popup-content .mapml-feature-count{margin:0;padding:0 5px;line-height:44px}.mapml-popup-content hr:last-of-type{margin-bottom:0;border-bottom:0;border-top:1px solid #e3e3e3}.mapml-popup-content :first-child{margin-top:0;padding-top:0}.mapml-popup-content>:not(.mapml-focus-buttons){padding:0 1rem}.leaflet-popup-tip-container{margin-top:-1px}.mapml-outline{outline-style:auto;outline-offset:-2px;z-index:1000;pointer-events:none;position:absolute;height:100%;width:100%;color:initial}@media print{.leaflet-control{-webkit-print-color-adjust:exact;color-adjust:exact}}.leaflet-pane>svg g.leaflet-interactive,svg.leaflet-image-layer.leaflet-interactive g{pointer-events:visiblePainted;pointer-events:auto}.mapml-link-preview{position:absolute;left:0;bottom:0;background-color:#dee1e6;border-radius:0 5px 0 0;z-index:1050}.mapml-link-preview>p{margin:3px 5px 2px 3px;color:#3c4043}.mapml-button[aria-disabled=true],.mapml-layer-item:disabled button.mapml-button,button.mapml-button:disabled{opacity:.3}.mapml-button-icon{pointer-events:none}.mapml-button-icon svg{fill:currentColor}.mapml-layer-item,.mapml-layer-item *{box-sizing:border-box}.mapml-layer-extent,.mapml-layer-grouped-extents,.mapml-layer-item{background-color:#fff;border:1px solid #fff;margin:0;padding:0}.mapml-layer-item:not(:last-of-type){border-bottom:1px solid #e3e3e3}.mapml-layer-item[aria-grabbed=true]{border:1px solid #e3e3e3;border-radius:0}.mapml-layer-item:first-of-type{border-top-left-radius:4px;border-top-right-radius:4px}.mapml-layer-item:last-of-type{border-bottom-left-radius:4px;border-bottom-right-radius:4px}.mapml-layer-item-properties{align-items:center;display:flex;justify-content:space-between;padding-inline-start:.5rem}.mapml-layer-item-controls{margin-inline-start:auto}.mapml-layer-item-controls button span{font-size:large;font-weight:900;vertical-align:middle}.mapml-layer-item-controls button svg{vertical-align:text-bottom}.mapml-layer-item-controls,.mapml-layer-item-remove-control,.mapml-layer-item-settings-control{align-items:center;display:flex;justify-content:center}.mapml-layer-item-remove-control,.mapml-layer-item-settings-control{min-height:44px;min-width:44px;height:44px;width:44px}label.mapml-layer-item-toggle{display:inline-flex;align-items:center;width:100%;min-height:44px}.mapml-layer-item-name{word-break:break-word;padding-block-start:.25rem;padding-block-end:.25rem;padding-inline-start:.25rem;padding-inline-end:1rem}.mapml-layer-item-settings>*{display:block;padding-block-start:.25rem;padding-block-end:.25rem;padding-inline-start:2rem;padding-inline-end:1rem}.mapml-screen-reader-output{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}.mapml-vector-container svg :is(
-[role=link]:focus,[role=link]:hover,[role=link]:focus path,[role=link]:hover path,[role=link] path:focus,[role=link] path:hover,[role=button]:focus,[role=button]:hover,[role=button]:focus path,[role=button]:hover path,[role=button] path:focus,[role=button] path:hover,path[tabindex="0"]:focus
-){stroke:#0000EE;stroke:LinkText}.mapml-vector-container svg :is(
-[role=link]:focus:not(:focus-visible),[role=link]:focus:not(:focus-visible) path,[role=link] path:focus:not(:focus-visible),[role=button]:focus:not(:focus-visible),[role=button]:focus:not(:focus-visible) path,[role=button] path:focus:not(:focus-visible),path[tabindex="0"]:focus:not(:focus-visible)
-){outline:0!important}.mapml-layer-item-settings .mapml-layer-extent{padding-inline-start:1.8rem}.mapml-layer-item-settings .mapml-layer-extent .mapml-layer-item-properties{padding-inline-start:0}.mapml-layer-item-settings .mapml-layer-extent .mapml-layer-item-opacity{padding-inline-start:1.6rem}.mapml-layer-item-settings .mapml-layer-extent .mapml-layer-item-controls{position:absolute;right:0}
\ No newline at end of file
diff --git a/multiple-extents/dist/mapml.js b/multiple-extents/dist/mapml.js
deleted file mode 100644
index d1a49a6..0000000
--- a/multiple-extents/dist/mapml.js
+++ /dev/null
@@ -1,7055 +0,0 @@
-(function () {
-  'use strict';
-
-  var MapMLStaticTileLayer = L.GridLayer.extend({
-
-    initialize: function (options) {
-      this.zoomBounds = this._getZoomBounds(options.tileContainer,options.maxZoomBound);
-      L.extend(options, this.zoomBounds);
-      L.setOptions(this, options);
-      this._groups = this._groupTiles(this.options.tileContainer.getElementsByTagName('map-tile'));
-    },
-
-    onAdd: function(){
-      this._bounds = this._getLayerBounds(this._groups,this._map.options.projection); //stores meter values of bounds
-      this.layerBounds = this._bounds[Object.keys(this._bounds)[0]];
-      for(let key of Object.keys(this._bounds)){
-        this.layerBounds.extend(this._bounds[key].min);
-        this.layerBounds.extend(this._bounds[key].max);
-      }
-      L.GridLayer.prototype.onAdd.call(this,this._map);
-      this._handleMoveEnd();
-    },
-    
-    getEvents: function(){
-      let events = L.GridLayer.prototype.getEvents.call(this,this._map);
-      this._parentOnMoveEnd = events.moveend;
-      events.moveend = this._handleMoveEnd;
-      events.move = ()=>{}; //needed to prevent moveend from running
-      return events;
-    },
-
-
-    //sets the bounds flag of the layer and calls default moveEnd if within bounds
-    //its the zoom level is between the nativeZoom and zoom then it uses the nativeZoom value to get the bound its checking
-    _handleMoveEnd : function(e){
-      let mapZoom = this._map.getZoom();
-      let zoomLevel = mapZoom;
-      zoomLevel = zoomLevel > this.options.maxNativeZoom? this.options.maxNativeZoom: zoomLevel;
-      zoomLevel = zoomLevel < this.options.minNativeZoom? this.options.minNativeZoom: zoomLevel;
-      this.isVisible = mapZoom <= this.zoomBounds.maxZoom && mapZoom >= this.zoomBounds.minZoom && 
-                        this._bounds[zoomLevel] && this._bounds[zoomLevel]
-                        .overlaps(M.pixelToPCRSBounds(
-                          this._map.getPixelBounds(),
-                          this._map.getZoom(),
-                          this._map.options.projection));
-      if(!(this.isVisible))return; //onMoveEnd still gets fired even when layer is out of bounds??, most likely need to overrride _onMoveEnd
-      this._parentOnMoveEnd();
-    },
-
-    _isValidTile(coords) {
-      return this._groups[this._tileCoordsToKey(coords)];
-    },
-
-    createTile: function (coords) {
-      let tileGroup = this._groups[this._tileCoordsToKey(coords)] || [],
-          tileElem = document.createElement('map-tile'), tileSize = this.getTileSize();
-      tileElem.setAttribute("col",coords.x);
-      tileElem.setAttribute("row",coords.y);
-      tileElem.setAttribute("zoom",coords.z);
-      
-      for(let i = 0;i<tileGroup.length;i++){
-        let tile= document.createElement('img');
-        tile.width = tileSize.x;
-        tile.height = tileSize.y;
-        tile.alt = '';
-        tile.setAttribute("role","presentation");
-        tile.src = tileGroup[i].src;
-        tileElem.appendChild(tile);
-      }
-      return tileElem;
-    },
-
-    _getLayerBounds: function(tileGroups, projection){
-      let layerBounds = {}, tileSize = M[projection].options.crs.tile.bounds.max.x;
-      for(let tile in tileGroups){
-        let sCoords = tile.split(":"), pixelCoords = {};
-        pixelCoords.x = +sCoords[0] * tileSize;
-        pixelCoords.y = +sCoords[1] * tileSize;
-        pixelCoords.z = +sCoords[2]; //+String same as parseInt(String)
-        if(sCoords[2] in layerBounds){
-
-          layerBounds[sCoords[2]].extend(L.point(pixelCoords.x ,pixelCoords.y ));
-          layerBounds[sCoords[2]].extend(L.point(((pixelCoords.x+tileSize) ),((pixelCoords.y+tileSize) )));
-        } else {
-          layerBounds[sCoords[2]] = L.bounds(
-                                      L.point(pixelCoords.x ,pixelCoords.y ),
-                                      L.point(((pixelCoords.x+tileSize) ),((pixelCoords.y+tileSize) )));
-        }
-      }
-      // TODO: optimize by removing 2nd loop, add util function to convert point in pixels to point in pcrs, use that instead then this loop
-      // won't be needed
-      for(let pixelBounds in layerBounds){
-        let zoom = +pixelBounds;
-        layerBounds[pixelBounds] = M.pixelToPCRSBounds(layerBounds[pixelBounds],zoom,projection);
-      }
-
-      return layerBounds;
-    },
-
-    _getZoomBounds: function(container, maxZoomBound){
-      if(!container) return null;
-      let meta = M.metaContentToObject(container.getElementsByTagName('map-tiles')[0].getAttribute('zoom')),
-          zoom = {},tiles = container.getElementsByTagName("map-tile");
-      zoom.nativeZoom = +meta.value || 0;
-      zoom.maxNativeZoom = 0;
-      zoom.minNativeZoom = maxZoomBound;
-      for (let i=0;i<tiles.length;i++) {
-        let lZoom = +tiles[i].getAttribute('zoom');
-        if(!tiles[i].getAttribute('zoom')) lZoom = zoom.nativeZoom;
-        zoom.minNativeZoom = Math.min(zoom.minNativeZoom, lZoom);
-        zoom.maxNativeZoom = Math.max(zoom.maxNativeZoom, lZoom);
-      }
-
-      //hard coded to only natively zoom out 2 levels, any more and too many tiles are going to be loaded in at one time
-      //lagging the users computer
-      zoom.minZoom = zoom.minNativeZoom - 2 <= 0? 0: zoom.minNativeZoom - 2;
-      zoom.maxZoom = maxZoomBound;
-      if(meta.min)zoom.minZoom = +meta.min < (zoom.minNativeZoom - 2)?(zoom.minNativeZoom - 2):+meta.min;
-      if(meta.max)zoom.maxZoom = +meta.max;
-      return zoom;
-    },
-
-    _groupTiles: function (tiles) {
-      let tileMap = {};
-      for (let i=0;i<tiles.length;i++) {
-        let tile = {};
-        tile.row = +tiles[i].getAttribute('row');
-        tile.col = +tiles[i].getAttribute('col');
-        tile.zoom = +tiles[i].getAttribute('zoom') || this.options.nativeZoom;
-        tile.src = tiles[i].getAttribute('src');
-        let tileCode = tile.col+":"+tile.row+":"+tile.zoom;
-        if(tileCode in tileMap){
-          tileMap[tileCode].push(tile);
-        } else {
-          tileMap[tileCode]=[tile];
-        }
-      }
-      return tileMap;
-    },
-  });
-
-  var mapMLStaticTileLayer = function(options) {
-    return new MapMLStaticTileLayer(options);
-  };
-
-  var MapMLLayerControl = L.Control.Layers.extend({
-      /* removes 'base' layers as a concept */
-      options: {
-        autoZIndex: false,
-        sortLayers: true,
-        sortFunction: function (layerA, layerB) {
-          return layerA.options.zIndex < layerB.options.zIndex ? -1 : (layerA.options.zIndex > layerB.options.zIndex ? 1 : 0);
-        }
-      },
-      initialize: function (overlays, options) {
-          L.setOptions(this, options);
-          
-          // the _layers array contains objects like {layer: layer, name: "name", overlay: true}
-          // the array index is the id of the layer returned by L.stamp(layer) which I guess is a unique hash
-          this._layerControlInputs = [];
-          this._layers = [];
-          this._lastZIndex = 0;
-          this._handlingClick = false;
-
-          for (var i in overlays) {
-              this._addLayer(overlays[i], i, true);
-          }
-      },
-      onAdd: function () {
-          this._initLayout();
-          this._map.on('validate', this._validateInput, this);
-          L.DomEvent.on(this.options.mapEl, "layerchange", this._validateInput, this);
-          L.DomEvent.on(this._container, 'keydown', this._focusFirstLayer, this._container);
-          this._update();
-          //this._validateExtents();
-          if(this._layers.length < 1 && !this._map._showControls){
-            this._container.setAttribute("hidden","");
-          } else {
-            this._map._showControls = true;
-          }
-          return this._container;
-      },
-      onRemove: function (map) {
-          map.off('validate', this._validateInput, this);
-          L.DomEvent.off(this._container, 'keydown', this._focusFirstLayer, this._container);
-          // remove layer-registerd event handlers so that if the control is not
-          // on the map it does not generate layer events
-          for (var i = 0; i < this._layers.length; i++) {
-            this._layers[i].layer.off('add remove', this._onLayerChange, this);
-            this._layers[i].layer.off('extentload', this._validateInput, this);
-          }
-      },
-      addOrUpdateOverlay: function (layer, name) {
-        var alreadyThere = false;
-        for (var i=0;i<this._layers.length;i++) {
-          if (this._layers[i].layer === layer) {
-            alreadyThere = true;
-            this._layers[i].name = name;
-            // replace the controls with updated controls if necessary.
-            break;
-          }
-        }
-        if (!alreadyThere) {
-          this.addOverlay(layer, name);
-        }
-        if(this._layers.length > 0){
-          this._container.removeAttribute("hidden");
-          this._map._showControls = true;
-        }
-        return (this._map) ? this._update() : this;
-      },
-      removeLayer: function (layer) {
-        L.Control.Layers.prototype.removeLayer.call(this, layer);
-        if(this._layers.length === 0){
-          this._container.setAttribute("hidden", "");
-        }
-      },
-      _validateInput: function (e) {
-        for (let i = 0; i < this._layers.length; i++) {
-          if(!this._layers[i].input.labels[0])continue;
-          let label = this._layers[i].input.labels[0].getElementsByTagName("span"),
-              input = this._layers[i].input.labels[0].getElementsByTagName("input");
-          input[0].checked = this._layers[i].layer._layerEl.checked;
-          if(this._layers[i].layer._layerEl.disabled && this._layers[i].layer._layerEl.checked){
-            input[0].closest("fieldset").disabled = true;
-            label[0].style.fontStyle = "italic";
-          } else {
-            input[0].closest("fieldset").disabled = false;
-            label[0].style.fontStyle = "normal";
-          }
-          // check if an extent is disabled and disable it
-          if(this._layers[i].layer._extent && this._layers[i].layer._extent._mapExtents){
-            for(let j = 0; j < this._layers[i].layer._extent._mapExtents.length; j++){
-              let input = this._layers[i].layer._extent._mapExtents[j].extentAnatomy,
-                  label = input.getElementsByClassName("mapml-layer-item-name")[0];
-              if(this._layers[i].layer._extent._mapExtents[j].disabled && this._layers[i].layer._extent._mapExtents[j].checked){
-                label.style.fontStyle = "italic";
-                input.disabled = true;
-              } else {
-                label.style.fontStyle = "normal";
-                input.disabled = false;
-              }
-            }
-          }
-        }
-
-      },
-
-      // focus the first layer in the layer control when enter is pressed
-      _focusFirstLayer: function(e){
-        if(e.key === 'Enter' && this.className != 'leaflet-control-layers leaflet-control leaflet-control-layers-expanded'){
-          var elem = this.children[1].children[2].children[0].children[0].children[0].children[0];
-          if(elem) setTimeout(() => elem.focus(), 0);
-          }
-      },
-      
-      _withinZoomBounds: function(zoom, range) {
-          return range.min <= zoom && zoom <= range.max;
-      },
-      _addItem: function (obj) {
-        var layercontrols  =  obj.layer.getLayerUserControlsHTML();
-        // the input is required by Leaflet...
-        obj.input = layercontrols.querySelector('input');
-
-        this._layerControlInputs.push(obj.input);
-      		obj.input.layerId = L.stamp(obj.layer);
-
-        L.DomEvent.on(obj.input, 'click', this._onInputClick, this);
-        // this is necessary because when there are several layers in the
-        // layer control, the response to the last one can be a long time
-        // after the info is first displayed, so we have to go back and
-        // verify the layer element is not disabled and can have an enabled input.
-        obj.layer.on('extentload', this._validateInput, this);
-        this._overlaysList.appendChild(layercontrols);
-        return layercontrols;
-      },
-
-      //overrides collapse and conditionally collapses the panel
-      collapse: function(e){
-        if (
-          e.target.tagName === "SELECT" ||
-          e.relatedTarget &&
-          e.relatedTarget.parentElement &&
-          (
-            e.relatedTarget.className === "mapml-contextmenu mapml-layer-menu" ||
-            e.relatedTarget.parentElement.className === "mapml-contextmenu mapml-layer-menu"
-          ) ||
-          (this._map && this._map.contextMenu._layerMenu.style.display === "block")
-        ) return this;
-
-        L.DomUtil.removeClass(this._container, 'leaflet-control-layers-expanded');
-  		  return this;
-      }
-  });
-  var mapMlLayerControl = function (layers, options) {
-  	return new MapMLLayerControl(layers, options);
-  };
-
-  const FALLBACK_PROJECTION = "OSMTILE";
-  const FALLBACK_CS = "TILEMATRIX";
-  const BLANK_TT_TREF = "mapmltemplatedtileplaceholder";
-
-  var MapMLFeatures = L.FeatureGroup.extend({
-    /*
-     * M.MapML turns any MapML feature data into a Leaflet layer. Based on L.GeoJSON.
-     */
-      initialize: function (mapml, options) {
-
-        L.setOptions(this, options);
-        if(this.options.static) {
-          this._container = L.DomUtil.create('div', 'leaflet-layer', this.options.pane);
-          // must have leaflet-pane class because of new/changed rule in leaflet.css
-          // info: https://github.com/Leaflet/Leaflet/pull/4597
-          L.DomUtil.addClass(this._container, 'leaflet-pane mapml-vector-container');
-          L.setOptions(this.options.renderer, {pane: this._container});
-        }
-
-        this._layers = {};
-        if(this.options.query){
-          this._mapmlFeatures = mapml.features ? mapml.features: mapml;
-          this.isVisible = true;
-          let native = this._getNativeVariables(mapml);
-          this.options.nativeZoom = native.zoom;
-          this.options.nativeCS = native.cs;
-        }
-        if (mapml && !this.options.query) {
-          let native = this._getNativeVariables(mapml);
-          //needed to check if the feature is static or not, since this method is used by templated also
-          if(!mapml.querySelector('map-extent') && mapml.querySelector('map-feature') && this.options.static){
-            this._features = {};
-            this._staticFeature = true;
-            this.isVisible = true; //placeholder for when this actually gets updated in the future
-            this.zoomBounds = this._getZoomBounds(mapml, native.zoom);
-            this.layerBounds = this._getLayerBounds(mapml);
-            L.extend(this.options, this.zoomBounds);
-          }
-          this.addData(mapml, native.cs, native.zoom);
-          if(this._staticFeature){
-            this._resetFeatures(this._clampZoom(this.options._leafletLayer._map.getZoom()));
-
-            this.options._leafletLayer._map._addZoomLimit(this);
-          }
-        }
-      },
-
-      onAdd: function(map){
-        L.FeatureGroup.prototype.onAdd.call(this, map);
-        if(this._mapmlFeatures)map.on("featurepagination", this.showPaginationFeature, this);
-      },
-
-      onRemove: function(map){
-        if(this._mapmlFeatures){
-          map.off("featurepagination", this.showPaginationFeature, this);
-          delete this._mapmlFeatures;
-          L.DomUtil.remove(this._container);
-        }
-        L.FeatureGroup.prototype.onRemove.call(this, map);
-        this._map.featureIndex.cleanIndex();
-      },
-
-      getEvents: function(){
-        if(this._staticFeature){
-          return {
-            'moveend':this._handleMoveEnd,
-            'zoomend' : this._handleZoomEnd,
-          };
-        }
-        return {
-          'moveend':this._removeCSS
-        };
-      },
-
-
-      showPaginationFeature: function(e){
-        if(this.options.query && this._mapmlFeatures[e.i]){
-          let feature = this._mapmlFeatures[e.i];
-          this.clearLayers();
-          this.addData(feature, this.options.nativeCS, this.options.nativeZoom);
-          e.popup._navigationBar.querySelector("p").innerText = (e.i + 1) + "/" + this.options._leafletLayer._totalFeatureCount;
-          e.popup._content.querySelector("iframe").setAttribute("sandbox", "allow-same-origin allow-forms");
-          e.popup._content.querySelector("iframe").srcdoc = feature.querySelector("map-properties").innerHTML;
-        }
-      },
-
-      _getNativeVariables: function(mapml){
-        let nativeZoom = mapml.querySelector("map-meta[name=zoom]") &&
-            +M.metaContentToObject(mapml.querySelector("map-meta[name=zoom]").getAttribute("content")).value || 0;
-        let nativeCS = mapml.querySelector("map-meta[name=cs]") &&
-            M.metaContentToObject(mapml.querySelector("map-meta[name=cs]").getAttribute("content")).content || "GCRS";
-        return {zoom:nativeZoom, cs: nativeCS};
-      },
-
-      _handleMoveEnd : function(){
-        let mapZoom = this._map.getZoom(),
-            withinZoom = mapZoom <= this.zoomBounds.maxZoom && mapZoom >= this.zoomBounds.minZoom;   
-        this.isVisible = withinZoom && this._layers && this.layerBounds && 
-                          this.layerBounds.overlaps(
-                            M.pixelToPCRSBounds(
-                              this._map.getPixelBounds(),
-                              mapZoom,this._map.options.projection));
-        this._removeCSS();
-      },
-
-      _handleZoomEnd: function(e){
-        let mapZoom = this._map.getZoom();
-        if(mapZoom > this.zoomBounds.maxZoom || mapZoom < this.zoomBounds.minZoom){
-          this.clearLayers();
-          return;
-        }
-        let clampZoom = this._clampZoom(mapZoom);
-        this._resetFeatures(clampZoom);
-      },
-
-      //sets default if any are missing, better to only replace ones that are missing
-      _getLayerBounds : function(container) {
-        if (!container) return null;
-        let cs = FALLBACK_CS,
-            projection = container.querySelector('map-meta[name=projection]') &&
-                      M.metaContentToObject(
-                        container.querySelector('map-meta[name=projection]').getAttribute('content'))
-                        .content.toUpperCase() || FALLBACK_PROJECTION;
-        try{
-
-          let meta = container.querySelector('map-meta[name=extent]') &&
-                      M.metaContentToObject(
-                        container.querySelector('map-meta[name=extent]').getAttribute('content'));
-
-          let zoom = meta.zoom || 0;
-          
-          let metaKeys = Object.keys(meta);
-          for(let i =0;i<metaKeys.length;i++){
-            if(!metaKeys[i].includes("zoom")){
-              cs = M.axisToCS(metaKeys[i].split("-")[2]);
-              break;
-            }
-          }
-          let axes = M.csToAxes(cs);
-          return M.boundsToPCRSBounds(
-                  L.bounds(L.point(+meta[`top-left-${axes[0]}`],+meta[`top-left-${axes[1]}`]),
-                  L.point(+meta[`bottom-right-${axes[0]}`],+meta[`bottom-right-${axes[1]}`])),
-                  zoom,projection,cs);
-        } catch (error){
-          //if error then by default set the layer to osm and bounds to the entire map view
-          return M.boundsToPCRSBounds(M[projection].options.crs.tilematrix.bounds(0),0,projection, cs);
-        }
-      },
-
-      _resetFeatures : function (zoom){
-        this.clearLayers();
-        // since features are removed and re-added by zoom level, need to clean the feature index before re-adding
-        if(this._map) this._map.featureIndex.cleanIndex();
-        if(this._features && this._features[zoom]){
-          for(let k =0;k < this._features[zoom].length;k++){
-            this.addLayer(this._features[zoom][k]);
-          }
-        }
-      },
-
-      _clampZoom : function(zoom){
-        if(zoom > this.zoomBounds.maxZoom || zoom < this.zoomBounds.minZoom) return zoom;
-        if (undefined !== this.zoomBounds.minNativeZoom && zoom < this.zoomBounds.minNativeZoom) {
-          return this.zoomBounds.minNativeZoom;
-        }
-        if (undefined !== this.zoomBounds.maxNativeZoom && this.zoomBounds.maxNativeZoom < zoom) {
-          return this.zoomBounds.maxNativeZoom;
-        }
-
-        return zoom;
-      },
-
-      _setZoomTransform: function(center, clampZoom){
-        var scale = this._map.getZoomScale(this._map.getZoom(),clampZoom),
-  		    translate = center.multiplyBy(scale)
-  		        .subtract(this._map._getNewPixelOrigin(center, this._map.getZoom())).round();
-
-        if (any3d) {
-          L.setTransform(this._layers[clampZoom], translate, scale);
-        } else {
-          L.setPosition(this._layers[clampZoom], translate);
-        }
-      },
-
-      _getZoomBounds: function(container, nativeZoom){
-        if (!container) return null;
-        let nMin = 100,nMax=0, features = container.getElementsByTagName('map-feature'),meta,projection;
-        for(let i =0;i<features.length;i++){
-          let lZoom = +features[i].getAttribute('zoom');
-          if(!features[i].getAttribute('zoom'))lZoom = nativeZoom;
-          nMax = Math.max(nMax, lZoom);
-          nMin = Math.min(nMin, lZoom);
-        }
-        try{
-          projection = M.metaContentToObject(container.querySelector('map-meta[name=projection]').getAttribute('content')).content;
-          meta = M.metaContentToObject(container.querySelector('map-meta[name=zoom]').getAttribute('content'));
-        } catch(error){
-          return {
-            minZoom:0,
-            maxZoom: M[projection || FALLBACK_PROJECTION].options.resolutions.length - 1,
-            minNativeZoom:nMin,
-            maxNativeZoom:nMax
-          };
-        }
-        return {
-          minZoom:+meta.min ,
-          maxZoom:+meta.max ,
-          minNativeZoom:nMin,
-          maxNativeZoom:nMax
-        };
-      },
-
-      addData: function (mapml, nativeCS, nativeZoom) {
-        var features = mapml.nodeType === Node.DOCUMENT_NODE || mapml.nodeName === "LAYER-" ? mapml.getElementsByTagName("map-feature") : null,
-            i, len, feature;
-
-        var linkedStylesheets = mapml.nodeType === Node.DOCUMENT_NODE ? mapml.querySelector("map-link[rel=stylesheet],map-style") : null;
-        if (linkedStylesheets) {
-          var base = mapml.querySelector('map-base') && mapml.querySelector('map-base').hasAttribute('href') ? 
-              new URL(mapml.querySelector('map-base').getAttribute('href')).href : 
-              mapml.URL;
-          M.parseStylesheetAsHTML(mapml,base,this._container);
-        }
-        if (features) {
-         for (i = 0, len = features.length; i < len; i++) {
-          // Only add this if geometry is set and not null
-          feature = features[i];
-          var geometriesExist = feature.getElementsByTagName("map-geometry").length && feature.getElementsByTagName("map-coordinates").length;
-          if (geometriesExist) {
-           this.addData(feature, nativeCS, nativeZoom);
-          }
-         }
-         return this; //if templated this runs
-        }
-
-        //if its a mapml with no more links this runs
-        var options = this.options;
-
-        if (options.filter && !options.filter(mapml)) { return; }
-        
-        if (mapml.classList.length) {
-          options.className = mapml.classList.value;
-        }
-        let zoom = mapml.getAttribute("zoom") || nativeZoom, title = mapml.querySelector("map-featurecaption");
-        title = title ? title.innerHTML : "Feature";
-
-        if(mapml.querySelector("map-properties")) {
-          options.properties = document.createElement('div');
-          options.properties.classList.add("mapml-popup-content");
-          options.properties.insertAdjacentHTML('afterbegin', mapml.querySelector("map-properties").innerHTML);
-        }
-
-        let layer = this.geometryToLayer(mapml, options, nativeCS, +zoom, title);
-        if (layer) {
-          // if the layer is being used as a query handler output, it will have
-          // a color option set.  Otherwise, copy classes from the feature
-          if (!layer.options.color && mapml.hasAttribute('class')) {
-            layer.options.className = mapml.getAttribute('class');
-          }
-          layer.defaultOptions = layer.options;
-          this.resetStyle(layer);
-
-          if (options.onEachFeature) {
-            layer.bindTooltip(title, { interactive:true, sticky: true, });
-          }
-          if(this._staticFeature){
-            let featureZoom = mapml.getAttribute('zoom') || nativeZoom;
-            if(featureZoom in this._features){
-              this._features[featureZoom].push(layer);
-            } else {
-              this._features[featureZoom]=[layer];
-            }
-            return;
-          } else {
-            return this.addLayer(layer);
-          }
-        }
-      },
-          
-      resetStyle: function (layer) {
-        var style = this.options.style;
-        if (style) {
-         // reset any custom styles
-         L.Util.extend(layer.options, layer.defaultOptions);
-         this._setLayerStyle(layer, style);
-        }
-      },
-
-      setStyle: function (style) {
-        this.eachLayer(function (layer) {
-          this._setLayerStyle(layer, style);
-        }, this);
-      },
-
-      _setLayerStyle: function (layer, style) {
-        if (typeof style === 'function') {
-          style = style(layer.feature);
-        }
-        if (layer.setStyle) {
-          layer.setStyle(style);
-        }
-      },
-      _removeCSS: function(){
-        let toDelete = this._container.querySelectorAll("link[rel=stylesheet],style");
-        for(let i = 0; i < toDelete.length;i++){
-          this._container.removeChild(toDelete[i]);
-        }
-      },
-    geometryToLayer: function (mapml, vectorOptions, nativeCS, zoom, title) {
-      let geometry = mapml.tagName.toUpperCase() === 'MAP-FEATURE' ? mapml.getElementsByTagName('map-geometry')[0] : mapml,
-          cs = geometry.getAttribute("cs") || nativeCS, group = [], svgGroup = L.SVG.create('g'), copyOptions = Object.assign({}, vectorOptions);
-      for(let geo of geometry.querySelectorAll('map-polygon, map-linestring, map-multilinestring, map-point, map-multipoint')){
-        group.push(M.feature(geo, Object.assign(copyOptions,
-          { nativeCS: cs,
-            nativeZoom: zoom,
-            projection: this.options.projection,
-            featureID: mapml.id,
-            group: svgGroup,
-            wrappers: this._getGeometryParents(geo.parentElement),
-            featureLayer: this,
-            _leafletLayer: this.options._leafletLayer,
-          })));
-      }
-      let groupOptions = {group:svgGroup, featureID: mapml.id, accessibleTitle: title, onEachFeature: vectorOptions.onEachFeature, properties: vectorOptions.properties, _leafletLayer: this.options._leafletLayer,},
-        collections = geometry.querySelector('map-multipolygon') || geometry.querySelector('map-geometrycollection');
-      if(collections) groupOptions.wrappers = this._getGeometryParents(collections.parentElement);
-
-      return M.featureGroup(group, groupOptions);
-    },
-
-    _getGeometryParents: function(subType, elems = []){
-      if(subType && subType.tagName.toUpperCase() !== "MAP-GEOMETRY"){
-        if(subType.tagName.toUpperCase() === "MAP-MULTIPOLYGON" || subType.tagName.toUpperCase() === "MAP-GEOMETRYCOLLECTION")
-          return this._getGeometryParents(subType.parentElement, elems);
-        return this._getGeometryParents(subType.parentElement, elems.concat([subType]));
-      } else {
-        return elems;
-      }
-    },
-  });
-  var mapMlFeatures = function (mapml, options) {
-  	return new MapMLFeatures(mapml, options);
-  };
-
-  var TemplatedTileLayer = L.TileLayer.extend({
-      // a TemplateTileLayer is similar to a L.TileLayer except its templates are
-      // defined by the <map-extent><template/></map-extent>
-      // content found in the MapML document.  As such, the client map does not
-      // 'revisit' the server for more MapML content, it simply fills the map extent
-      // with tiles for which it generates requests on demand (as the user pans/zooms/resizes
-      // the map)
-      initialize: function(template, options) {
-        // _setUpTileTemplateVars needs options.crs, not available unless we set
-        // options first...
-        let inputData = M.extractInputBounds(template);
-        this.zoomBounds = inputData.zoomBounds;
-        this.extentBounds=inputData.bounds;
-        this.isVisible = true;
-        L.extend(options, this.zoomBounds);
-        options.tms = template.tms;
-        L.setOptions(this, options);
-        this._setUpTileTemplateVars(template);
-
-        if (template.tile.subdomains) {
-          L.setOptions(this, L.extend(this.options, {subdomains: template.tile.subdomains}));
-        }
-        this._template = template;
-        this._initContainer();
-        // call the parent constructor with the template tref value, per the 
-        // Leaflet tutorial: http://leafletjs.com/examples/extending/extending-1-classes.html#methods-of-the-parent-class
-        L.TileLayer.prototype.initialize.call(this, template.template, L.extend(options, {pane: this._container}));
-      },
-      onAdd : function(){
-        this._map._addZoomLimit(this);
-        L.TileLayer.prototype.onAdd.call(this,this._map);
-        this._handleMoveEnd();
-      },
-      addTo: function(map){
-        L.tileLayer(this._url, this.options).addTo(map);
-      },
-
-      getEvents: function(){
-        let events = L.TileLayer.prototype.getEvents.call(this,this._map);
-        this._parentOnMoveEnd = events.moveend;
-        events.moveend = this._handleMoveEnd;
-        return events;
-      },
-
-      _initContainer: function () {
-        if (this._container) { return; }
-
-        this._container = L.DomUtil.create('div', 'leaflet-layer', this.options.pane);
-        L.DomUtil.addClass(this._container,'mapml-templated-tile-container');
-        this._updateZIndex();
-
-        if (this.options.opacity < 1) {
-          this._updateOpacity();
-        }
-      },
-      _handleMoveEnd : function(e){
-        let mapZoom = this._map.getZoom();
-        let mapBounds = M.pixelToPCRSBounds(this._map.getPixelBounds(),mapZoom,this._map.options.projection);
-        this.isVisible = mapZoom <= this.options.maxZoom && mapZoom >= this.options.minZoom && 
-                          this.extentBounds.overlaps(mapBounds);
-          if(!(this.isVisible))return;
-        this._parentOnMoveEnd();
-      },
-      createTile: function (coords) {
-        let tileGroup = document.createElement("DIV"),
-            tileSize = this.getTileSize();
-        L.DomUtil.addClass(tileGroup, "mapml-tile-group");
-        L.DomUtil.addClass(tileGroup, "leaflet-tile");
-
-        this._template.linkEl.dispatchEvent(new CustomEvent('tileloadstart', {
-          detail:{
-            x:coords.x,
-            y:coords.y,
-            zoom:coords.z,
-            appendTile: (elem)=>{tileGroup.appendChild(elem);},
-          },
-        }));
-
-        if (this._template.type.startsWith('image/')) {
-          let tile = L.TileLayer.prototype.createTile.call(this, coords, function(){});
-          tile.width = tileSize.x;
-          tile.height = tileSize.y;
-          tileGroup.appendChild(tile);
-        } else if(!this._url.includes(BLANK_TT_TREF)) {
-          // tiles of type="text/mapml" will have to fetch content while creating
-          // the tile here, unless there can be a callback associated to the element
-          // that will render the content in the alread-placed tile
-          // var tile = L.DomUtil.create('canvas', 'leaflet-tile');
-          this._fetchTile(coords, tileGroup);
-        }
-        return tileGroup;
-      },
-      _mapmlTileReady: function(tile) {
-          L.DomUtil.addClass(tile,'leaflet-tile-loaded');
-      },
-      // instead of being child of a pane, the TemplatedTileLayers are 'owned' by the group,
-      // and so are DOM children of the group, not the pane element (the MapMLLayer is
-      // a child of the overlay pane and always has a set of sub-layers)
-      getPane: function() {
-        return this.options.pane;
-      },
-      _fetchTile:  function (coords, tile) {
-         fetch(this.getTileUrl(coords),{redirect: 'follow'}).then(
-            function(response) {
-              if (response.status >= 200 && response.status < 300) {
-                return Promise.resolve(response);
-              } else {
-                console.log('Looks like there was a problem. Status Code: ' + response.status);
-                return Promise.reject(response);
-              }
-            }).then(function(response) {
-              return response.text();
-            }).then(text => {
-              var parser = new DOMParser();
-                  return parser.parseFromString(text, "application/xml");
-            }).then(mapml => {
-              this._createFeatures(mapml, coords, tile);
-              this._mapmlTileReady(tile);
-            }).catch(err => {console.log("Error Creating Tile");});
-      },
-
-      _createFeatures: function(markup, coords, tile){
-        let stylesheets = markup.querySelector('map-link[rel=stylesheet],map-style');
-        if (stylesheets) {
-          let base = markup.querySelector('map-base') && markup.querySelector('map-base').hasAttribute('href') ?
-            new URL(markup.querySelector('map-base').getAttribute('href')).href :
-            markup.URL;
-          M.parseStylesheetAsHTML(markup,base,tile);
-        }
-
-        let svg = L.SVG.create('svg'), g = L.SVG.create('g'), tileSize = this._map.options.crs.options.crs.tile.bounds.max.x,
-            xOffset = coords.x * tileSize, yOffset = coords.y * tileSize;
-
-        let tileFeatures = M.mapMlFeatures(markup, {
-          projection: this._map.options.projection,
-          static: false,
-          interactive: false,
-        });
-
-        for(let groupID in tileFeatures._layers){
-          for(let featureID in tileFeatures._layers[groupID]._layers){
-            let layer = tileFeatures._layers[groupID]._layers[featureID];
-            M.FeatureRenderer.prototype._initPath(layer, false);
-            layer._project(this._map, L.point([xOffset, yOffset]), coords.z);
-            M.FeatureRenderer.prototype._addPath(layer, g, false);
-            M.FeatureRenderer.prototype._updateFeature(layer);
-          }
-        }
-        svg.setAttribute('width', tileSize.toString());
-        svg.setAttribute('height', tileSize.toString());
-        svg.appendChild(g);
-        tile.appendChild(svg);
-      },
-
-      getTileUrl: function (coords) {
-          if (coords.z >= this._template.tilematrix.bounds.length || 
-                  !this._template.tilematrix.bounds[coords.z].contains(coords)) {
-            return '';
-          }
-          var obj = {};
-          obj[this._template.tilematrix.col.name] = coords.x;
-          obj[this._template.tilematrix.row.name] = coords.y;
-          obj[this._template.zoom.name] = this._getZoomForUrl();
-          obj[this._template.pcrs.easting.left] = this._tileMatrixToPCRSPosition(coords, 'top-left').x;
-          obj[this._template.pcrs.easting.right] = this._tileMatrixToPCRSPosition(coords, 'top-right').x;
-          obj[this._template.pcrs.northing.top] = this._tileMatrixToPCRSPosition(coords, 'top-left').y;
-          obj[this._template.pcrs.northing.bottom] = this._tileMatrixToPCRSPosition(coords, 'bottom-left').y;
-          obj[this._template.tile.server] = this._getSubdomain(coords);
-          for (var v in this._template.tile) {
-              if (["row","col","zoom","left","right","top","bottom"].indexOf(v) < 0) {
-                  obj[v] = this._template.tile[v];
-              }
-          }
-          if (this._map && !this._map.options.crs.infinite) {
-            let invertedY = this._globalTileRange.max.y - coords.y;
-            if (this.options.tms) {
-              obj[this._template.tilematrix.row.name] = invertedY;
-            }
-            //obj[`-${this._template.tilematrix.row.name}`] = invertedY; //leaflet has this but I dont see a use in storing row and -row as it doesnt follow that pattern
-          }
-          obj.r = this.options.detectRetina && L.Browser.retina && this.options.maxZoom > 0 ? '@2x' : '';
-          return L.Util.template(this._url, obj);
-      },
-      _tileMatrixToPCRSPosition: function (coords, pos) {
-  // this is a tile:
-  // 
-  //   top-left         top-center           top-right
-  //      +------------------+------------------+
-  //      |                  |                  |
-  //      |                  |                  |
-  //      |                  |                  |
-  //      |                  |                  |
-  //      |                  |                  |
-  //      |                  |                  |
-  //      + center-left    center               + center-right
-  //      |                  |                  |
-  //      |                  |                  |
-  //      |                  |                  |
-  //      |                  |                  |
-  //      |                  |                  |
-  //      |                  |                  |
-  //      |                  |                  |
-  //      +------------------+------------------+
-  //   bottom-left     bottom-center      bottom-right
-
-    var map = this._map,
-        crs = map.options.crs,
-        tileSize = this.getTileSize(),
-
-        nwPoint = coords.scaleBy(tileSize),
-        sePoint = nwPoint.add(tileSize),
-        centrePoint = nwPoint.add(Math.floor(tileSize / 2)),
-
-        nw = crs.transformation.untransform(nwPoint,crs.scale(coords.z)),
-        se = crs.transformation.untransform(sePoint,crs.scale(coords.z)),
-        cen = crs.transformation.untransform(centrePoint, crs.scale(coords.z)),
-        result = null;
-
-        switch (pos) {
-          case('top-left'):
-            result = nw;
-            break;
-          case('bottom-left'):
-            result = new L.Point(nw.x,se.y);
-            break;
-          case('center-left'):
-            result = new L.Point(nw.x,cen.y);
-            break;
-          case('top-right'):
-            result = new L.Point(se.x,nw.y);
-            break;
-          case('bottom-right'):
-            result = se;
-            break;
-          case('center-right'):
-            result = new L.Point(se.x,cen.y);
-            break;
-          case('top-center'):
-            result = new L.Point(cen.x,nw.y);
-            break;
-          case('bottom-center'):
-            result = new L.Point(cen.x,se.y);
-            break;
-          case('center'):
-            result = cen;
-            break;
-        }
-        return result;
-      },
-      _setUpTileTemplateVars: function(template) {
-        // process the inputs associated to template and create an object named
-        // tile with member properties as follows:
-        // {row: 'rowvarname', 
-        //  col: 'colvarname', 
-        //  left: 'leftvarname', 
-        //  right: 'rightvarname', 
-        //  top: 'topvarname', 
-        //  bottom: 'bottomvarname'}
-        template.tile = {};
-        var inputs = template.values,
-            crs = this.options.crs.options,
-            zoom, east, north, row, col;
-        
-        for (var i=0;i<template.values.length;i++) {
-          var type = inputs[i].getAttribute("type"), 
-              units = inputs[i].getAttribute("units"), 
-              axis = inputs[i].getAttribute("axis"), 
-              name = inputs[i].getAttribute("name"), 
-              position = inputs[i].getAttribute("position"),
-              shard = (type === "hidden" && inputs[i].hasAttribute("shard")),
-              select = (inputs[i].tagName.toLowerCase() === "map-select"),
-              value = inputs[i].getAttribute("value"),
-              min = inputs[i].getAttribute("min"),
-              max = inputs[i].getAttribute("max");
-          if (type === "location" && units === "tilematrix") {
-            switch (axis) {
-              case("column"):
-                col = {
-                  name: name,
-                  min: crs.crs.tilematrix.horizontal.min,
-                  max: crs.crs.tilematrix.horizontal.max(crs.resolutions.length-1)
-                };
-                if (!isNaN(Number.parseFloat(min))) {
-                  col.min = Number.parseFloat(min);
-                }
-                if (!isNaN(Number.parseFloat(max))) {
-                  col.max = Number.parseFloat(max);
-                }
-                break;
-              case("row"):
-                row = {
-                  name: name,
-                  min: crs.crs.tilematrix.vertical.min,
-                  max:  crs.crs.tilematrix.vertical.max(crs.resolutions.length-1)
-                };
-                if (!isNaN(Number.parseFloat(min))) {
-                  row.min = Number.parseFloat(min);
-                }
-                if (!isNaN(Number.parseFloat(max))) {
-                  row.max = Number.parseFloat(max);
-                }
-                break;
-              case('longitude'):
-              case("easting"):
-                if (!east) {
-                  east = {
-                    min: crs.crs.pcrs.horizontal.min,
-                    max: crs.crs.pcrs.horizontal.max
-                  };
-                }
-                if (!isNaN(Number.parseFloat(min))) {
-                  east.min = Number.parseFloat(min);
-                }
-                if (!isNaN(Number.parseFloat(max))) {
-                  east.max = Number.parseFloat(max);
-                }
-                if (position) {
-                  if (position.match(/.*?-left/i)) {
-                    east.left = name;
-                  } else if (position.match(/.*?-right/i)) {
-                    east.right = name;
-                  }
-                }
-                break;
-              case('latitude'):
-              case("northing"):
-                if (!north) {
-                  north = {
-                    min: crs.crs.pcrs.vertical.min,
-                    max: crs.crs.pcrs.vertical.max
-                  };
-                }
-                if (!isNaN(Number.parseFloat(min))) {
-                  north.min = Number.parseFloat(min);
-                }
-                if (!isNaN(Number.parseFloat(max))) {
-                  north.max = Number.parseFloat(max);
-                }
-                if (position) {
-                  if (position.match(/top-.*?/i)) {
-                    north.top = name;
-                  } else if (position.match(/bottom-.*?/i)) {
-                    north.bottom = name;
-                  }
-                } 
-                break;
-                // unsuportted axis value
-            }
-          } else if (type && type.toLowerCase() === "zoom") {
-            //<input name="..." type="zoom" value="0" min="0" max="17">
-             zoom = {
-               name: name,
-               min: 0, 
-               max: crs.resolutions.length,
-               value: crs.resolutions.length 
-             };
-             if (!isNaN(Number.parseInt(value,10)) && 
-                     Number.parseInt(value,10) >= zoom.min && 
-                     Number.parseInt(value,10) <= zoom.max) {
-               zoom.value = Number.parseInt(value,10);
-             } else {
-               zoom.value = zoom.max;
-             }
-             if (!isNaN(Number.parseInt(min,10)) && 
-                     Number.parseInt(min,10) >= zoom.min && 
-                     Number.parseInt(min,10) <= zoom.max) {
-               zoom.min = Number.parseInt(min,10);
-             }
-             if (!isNaN(Number.parseInt(max,10)) && 
-                     Number.parseInt(max,10) >= zoom.min && 
-                     Number.parseInt(max,10) <= zoom.max) {
-               zoom.max = Number.parseInt(max,10);
-             }
-             template.zoom = zoom;
-          } else if (shard) {
-            template.tile.server = name;
-            template.tile.subdomains = inputs[i].servers.slice();
-          } else if (select) {
-              /*jshint -W104 */
-            const parsedselect = inputs[i].htmlselect;
-            template.tile[name] = function() {
-                return parsedselect.value;
-            };
-          } else {
-             // needs to be a const otherwise it gets overwritten
-            /*jshint -W104 */
-            const input = inputs[i];
-            template.tile[name] = function () {
-                return input.getAttribute("value");
-            };
-          }
-        }
-        var transformation = this.options.crs.transformation,
-            tileSize = this.options.crs.options.crs.tile.bounds.max.x,
-            scale = L.bind(this.options.crs.scale, this.options.crs),
-        pcrs2tilematrix = function(c,zoom) {
-          return transformation.transform(c, scale(zoom)).divideBy(tileSize).floor();
-        };
-        if (east && north) {
-          
-          template.pcrs = {};
-          template.pcrs.bounds = L.bounds([east.min,north.min],[east.max,north.max]);
-          template.pcrs.easting = east;
-          template.pcrs.northing = north;
-          
-        } else if ( col && row && !isNaN(zoom.value)) {
-            
-            // convert the tile bounds at this zoom to a pcrs bounds, then 
-            // go through the zoom min/max and create a tile-based bounds
-            // at each zoom that applies to the col/row values that constrain what tiles
-            // will be requested so that we don't generate too many 404s
-            if (!template.pcrs) {
-              template.pcrs = {};
-              template.pcrs.easting = '';
-              template.pcrs.northing = '';
-            }
-            
-            template.pcrs.bounds =  M.boundsToPCRSBounds(
-                        L.bounds(L.point([col.min,row.min]),
-                        L.point([col.max,row.max])),
-                        zoom.value, this.options.crs, M.axisToCS("column"));
-            
-            template.tilematrix = {};
-            template.tilematrix.col = col;
-            template.tilematrix.row = row;
-
-        } else {
-          console.log('Unable to determine bounds for tile template: ' + template.template);
-        }
-        
-        if (!template.tilematrix) {
-          template.tilematrix = {};
-          template.tilematrix.col = {};
-          template.tilematrix.row = {};
-        }
-        template.tilematrix.bounds = [];
-        var pcrsBounds = template.pcrs.bounds;
-        // the template should _always_ have a zoom, because we force it to
-        // by first processing the extent to determine the zoom and if none, adding
-        // one and second by copying that zoom into the set of template variable inputs
-        // even if it is not referenced by one of the template's variable references
-        var zmin = template.zoom?template.zoom.min:0,
-            zmax = template.zoom?template.zoom.max:crs.resolutions.length;
-        for (var z=0; z <= zmax; z++) {
-          template.tilematrix.bounds[z] = (z >= zmin ?
-              L.bounds(pcrs2tilematrix(pcrsBounds.min,z),
-                pcrs2tilematrix(pcrsBounds.max,z)) :
-                        L.bounds(L.point([-1,-1]),L.point([-1,-1])));
-        }
-      }
-  });
-  var templatedTileLayer = function(template, options) {
-    return new TemplatedTileLayer(template, options);
-  };
-
-  var TemplatedLayer = L.Layer.extend({
-    initialize: function(templates, options) {
-      this._templates =  templates;
-      L.setOptions(this, options);
-      this._container = L.DomUtil.create('div', 'leaflet-layer', options.pane);
-      this._container.style.opacity = this._templates.opacity;
-      L.DomUtil.addClass(this._container,'mapml-templatedlayer-container');
-
-      for (var i=0;i<templates.length;i++) {
-        if (templates[i].rel === 'tile') {
-            this._templates[i].layer = M.templatedTileLayer(templates[i], 
-              L.Util.extend(options, {errorTileUrl: "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==", zIndex: i, pane: this._container}));
-        } else if (templates[i].rel === 'image') {
-            this._templates[i].layer = M.templatedImageLayer(templates[i], L.Util.extend(options, {zIndex: i, pane: this._container}));
-        } else if (templates[i].rel === 'features') {
-            this._templates[i].layer = M.templatedFeaturesLayer(templates[i], L.Util.extend(options, {zIndex: i, pane: this._container}));
-        } else if (templates[i].rel === 'query') {
-            // add template to array of queryies to be added to map and processed
-            // on click/tap events
-            this.hasSetBoundsHandler = true;
-            if (!this._queries) {
-              this._queries = [];
-            }
-            let inputData = M.extractInputBounds(templates[i]);
-            templates[i].extentBounds = inputData.bounds;
-            templates[i].zoomBounds = inputData.zoomBounds;
-            this._queries.push(L.extend(templates[i], this._setupQueryVars(templates[i])));
-        }
-      }
-    },
-    getEvents: function() {
-        return {
-            zoomstart: this._onZoomStart
-        };
-    },
-    redraw: function() {
-      this.closePopup();
-      for (var i=0;i<this._templates.length;i++) {
-        if (this._templates[i].rel === 'tile' || this._templates[i].rel === 'image' || this._templates[i].rel === 'features') {
-            this._templates[i].layer.redraw();
-        }
-      }
-    },
-    _onZoomStart: function() {
-        this.closePopup();
-    },
-
-    _onMoveEnd: function() {
-
-    },
-
-
-    _setupQueryVars: function(template) {
-        // process the inputs associated to template and create an object named
-        // query with member properties as follows:
-        // {width: 'widthvarname', 
-        //  height: 'heightvarname', 
-        //  left: 'leftvarname', 
-        //  right: 'rightvarname', 
-        //  top: 'topvarname', 
-        //  bottom: 'bottomvarname'
-        //  i: 'ivarname'
-        //  j: 'jvarname'}
-        //  x: 'xvarname' x being the tcrs x axis
-        //  y: 'yvarname' y being the tcrs y axis
-        //  z: 'zvarname' zoom
-        //  title: link title
-
-        var queryVarNames = {query:{}},
-            inputs = template.values;
-        
-        for (var i=0;i<template.values.length;i++) {
-          var type = inputs[i].getAttribute("type"), 
-              units = inputs[i].getAttribute("units"), 
-              axis = inputs[i].getAttribute("axis"), 
-              name = inputs[i].getAttribute("name"), 
-              position = inputs[i].getAttribute("position"),
-              rel = inputs[i].getAttribute("rel"),
-              select = (inputs[i].tagName.toLowerCase() === "map-select");
-          if (type === "width") {
-                queryVarNames.query.width = name;
-          } else if ( type === "height") {
-                queryVarNames.query.height = name;
-          } else if (type === "location") { 
-            switch (axis) {
-              case('x'):
-              case('y'):
-              case("column"): 
-              case("row"):
-                queryVarNames.query[axis] = name;
-                break;
-              case ('longitude'):
-              case ('easting'):
-                if (position) {
-                    if (position.match(/.*?-left/i)) {
-                      if (rel === "pixel") {
-                        queryVarNames.query.pixelleft = name;
-                      } else if (rel === "tile") {
-                        queryVarNames.query.tileleft = name;
-                      } else {
-                        queryVarNames.query.mapleft = name;
-                      }
-                    } else if (position.match(/.*?-right/i)) {
-                      if (rel === "pixel") {
-                        queryVarNames.query.pixelright = name;
-                      } else if (rel === "tile") {
-                        queryVarNames.query.tileright = name;
-                      } else {
-                        queryVarNames.query.mapright = name;
-                      }
-                    }
-                } else {
-                    queryVarNames.query[axis] = name;
-                }
-                break;
-              case ('latitude'):
-              case ('northing'):
-                if (position) {
-                    if (position.match(/top-.*?/i)) {
-                      if (rel === "pixel") {
-                        queryVarNames.query.pixeltop = name;
-                      } else if (rel === "tile") {
-                        queryVarNames.query.tiletop = name;
-                      } else {
-                        queryVarNames.query.maptop = name;
-                      }
-                    } else if (position.match(/bottom-.*?/i)) {
-                      if (rel === "pixel") {
-                        queryVarNames.query.pixelbottom = name;
-                      } else if (rel === "tile") {
-                        queryVarNames.query.tilebottom = name;
-                      } else {
-                        queryVarNames.query.mapbottom = name;
-                      }
-                    }
-                } else {
-                  queryVarNames.query[axis] = name;
-                }
-                break;
-              case('i'):
-                if (units === "tile") {
-                  queryVarNames.query.tilei = name;
-                } else {
-                  queryVarNames.query.mapi = name;
-                }
-                break;
-              case('j'):
-                if (units === "tile") {
-                  queryVarNames.query.tilej = name;
-                } else {
-                  queryVarNames.query.mapj = name;
-                }
-                break;
-                // unsuportted axis value
-            }
-          } else if (type === "zoom") {
-            //<input name="..." type="zoom" value="0" min="0" max="17">
-             queryVarNames.query.zoom = name;
-          } else if (select) {
-              /*jshint -W104 */
-            const parsedselect = inputs[i].htmlselect;
-            queryVarNames.query[name] = function() {
-                return parsedselect.value;
-            };
-          } else {
-              /*jshint -W104 */
-              const input = inputs[i];
-             queryVarNames.query[name] = function () {
-                return input.getAttribute("value");
-             };
-          }
-        }
-        queryVarNames.query.title = template.title;
-        return queryVarNames;
-    },
-    reset: function (templates) {
-      if (!templates) {return;}
-      if (!this._map) {return;}
-      var addToMap = this._map && this._map.hasLayer(this),
-          old_templates = this._templates;
-      delete this._queries;
-      this._map.off('click', null, this);
-
-      this._templates = templates;
-      for (var i=0;i<templates.length;i++) {
-        if (templates[i].rel === 'tile') {
-            this._templates[i].layer = M.templatedTileLayer(templates[i],
-              L.Util.extend(this.options, {errorTileUrl: "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==", zIndex: i, pane: this._container}));
-        } else if (templates[i].rel === 'image') {
-            this._templates[i].layer = M.templatedImageLayer(templates[i], L.Util.extend(this.options, {zIndex: i, pane: this._container}));
-        } else if (templates[i].rel === 'features') {
-            this._templates[i].layer = M.templatedFeaturesLayer(templates[i], L.Util.extend(this.options, {zIndex: i, pane: this._container}));
-        } else if (templates[i].rel === 'query') {
-            if (!this._queries) {
-              this._queries = [];
-            }
-            this._queries.push(L.extend(templates[i], this._setupQueryVars(templates[i])));
-        }
-        if (addToMap) {
-          this.onAdd(this._map);
-        }
-      }
-      for (i=0;i<old_templates.length;i++) {
-        if (this._map.hasLayer(old_templates[i].layer)) {
-          this._map.removeLayer(old_templates[i].layer);
-        }
-      }
-    },
-    onAdd: function (map) {
-      for (var i=0;i<this._templates.length;i++) {
-        if (this._templates[i].rel !== 'query') {
-          map.addLayer(this._templates[i].layer);
-        }
-      }
-    },
-    //addTo: function(map) {
-      //for(let i = 0; i < this._templates.length; i++){
-    //    this._templates[0].layer.addTo(map);
-      //}
-    //},
-  //  setZIndex: function (zIndex) {
-  //      this.options.zIndex = zIndex;
-  //      this._updateZIndex();
-  //
-  //      return this;
-  //  },
-  //  _updateZIndex: function () {
-  //      if (this._container && this.options.zIndex !== undefined && this.options.zIndex !== null) {
-  //          this._container.style.zIndex = this.options.zIndex;
-  //      }
-  //  },
-    onRemove: function (map) {
-      L.DomUtil.remove(this._container);
-      for (var i=0;i<this._templates.length;i++) {
-        if (this._templates[i].rel !== 'query') {
-          map.removeLayer(this._templates[i].layer);
-        }
-      }
-    },
-
-    _previousFeature: function(e){
-      if(this._count + -1 >= 0){
-        this._count--;
-        this._map.fire("featurepagination", {i: this._count, popup: this});
-      }
-    },
-    
-    _nextFeature: function(e){
-      if(this._count + 1 < this._source._totalFeatureCount){
-        this._count++;
-        this._map.fire("featurepagination", {i: this._count, popup: this});
-      }
-    },
-
-    changeOpacity: function(opacity){
-      this._container.style.opacity = opacity;
-    },
-
-  });
-  var templatedLayer = function(templates, options) {
-    // templates is an array of template objects
-    // a template object contains the template, plus associated <input> elements
-    // which need to be processed just prior to creating a url from the template 
-    // with the values of the inputs
-    return new TemplatedLayer(templates, options);
-  };
-
-  var TemplatedFeaturesLayer =  L.Layer.extend({
-    // this and M.ImageLayer could be merged or inherit from a common parent
-      initialize: function(template, options) {
-        let inputData = M.extractInputBounds(template);
-        this.zoomBounds = inputData.zoomBounds;
-        this.extentBounds=inputData.bounds;
-        this.isVisible = true;
-        this._template = template;
-        this._container = L.DomUtil.create('div', 'leaflet-layer', options.pane);
-        L.extend(options, this.zoomBounds);
-        L.DomUtil.addClass(this._container, 'mapml-features-container');
-        L.setOptions(this, L.extend(options,this._setUpFeaturesTemplateVars(template)));
-      },
-      getEvents: function () {
-          var events = {
-              moveend: this._onMoveEnd
-          };
-          return events;
-      },
-      onAdd: function () {
-        this._map._addZoomLimit(this);
-        var mapml, headers = new Headers({'Accept': 'text/mapml'});
-            var parser = new DOMParser(),
-            opacity = this.options.opacity || 1,
-            container = this._container,
-            map = this._map;
-        if (!this._features) {
-          this._features = M.mapMlFeatures( null, {
-            // pass the vector layer a renderer of its own, otherwise leaflet
-            // puts everything into the overlayPane
-            renderer: M.featureRenderer(),
-            // pass the vector layer the container for the parent into which
-            // it will append its own container for rendering into
-            pane: container,
-            opacity: opacity,
-            projection:map.options.projection,
-            static: true,
-            onEachFeature: function(properties, geometry) {
-              // need to parse as HTML to preserve semantics and styles
-              var c = document.createElement('div');
-              c.classList.add("mapml-popup-content");
-              c.insertAdjacentHTML('afterbegin', properties.innerHTML);
-              geometry.bindPopup(c, {autoClose: false, minWidth: 108});
-            }
-          });
-        }
-        // this was tricky...recursion alwasy breaks my brain
-        var features = this._features,
-            _pullFeatureFeed = function (url, limit) {
-              return (fetch (url,{redirect: 'follow',headers: headers})
-                      .then( function (response) {return response.text();})
-                      .then( function (text) {
-                mapml = parser.parseFromString(text,"application/xml");
-                var base = (new URL(mapml.querySelector('map-base') ? mapml.querySelector('map-base').getAttribute('href') : url)).href;
-                url = mapml.querySelector('map-link[rel=next]')? mapml.querySelector('map-link[rel=next]').getAttribute('href') : null;
-                url =  url ? (new URL(url, base)).href: null;
-                let nativeZoom = mapml.querySelector("map-meta[name=zoom]") &&
-                  +M.metaContentToObject(mapml.querySelector("map-meta[name=zoom]").getAttribute("content")).value || 0;
-                let nativeCS = mapml.querySelector("map-meta[name=cs]") &&
-                        M.metaContentToObject(mapml.querySelector("map-meta[name=cs]").getAttribute("content")).content || "GCRS";
-                features.addData(mapml, nativeCS, nativeZoom);
-                if (url && --limit) {
-                  return _pullFeatureFeed(url, limit);
-                }
-              }));
-            };
-        _pullFeatureFeed(this._getfeaturesUrl(), 10)
-          .then(function() { 
-                map.addLayer(features);
-                map.fire('moveend');  // TODO: replace with moveend handler for layer and not entire map
-          })
-          .catch(function (error) { console.log(error);});
-      },
-      redraw: function() {
-          this._onMoveEnd();
-      },
-
-      _onMoveEnd: function() {
-        let mapZoom = this._map.getZoom();
-        let mapBounds = M.pixelToPCRSBounds(this._map.getPixelBounds(),mapZoom,this._map.options.projection);
-        this.isVisible = mapZoom <= this.zoomBounds.maxZoom && mapZoom >= this.zoomBounds.minZoom && 
-                          this.extentBounds.overlaps(mapBounds);
-        
-        this._features.clearLayers();
-        if(!(this.isVisible)){
-          return;
-        }
-
-        // TODO add preference with a bit less weight than that for text/mapml; 0.8 for application/geo+json; 0.6
-        var mapml, headers = new Headers({'Accept': 'text/mapml;q=0.9,application/geo+json;q=0.8'}),
-            parser = new DOMParser(),
-            features = this._features,
-            map = this._map,
-            context = this,
-            MAX_PAGES = 10,
-          _pullFeatureFeed = function (url, limit) {
-            return (fetch (url,{redirect: 'follow',headers: headers})
-                    .then( function (response) {return response.text();})
-                    .then( function (text) {
-                      //TODO wrap this puppy in a try/catch/finally to parse application/geo+json if necessary
-                mapml = parser.parseFromString(text,"application/xml");
-                var base = (new URL(mapml.querySelector('map-base') ? mapml.querySelector('map-base').getAttribute('href') : url)).href;
-                url = mapml.querySelector('map-link[rel=next]')? mapml.querySelector('map-link[rel=next]').getAttribute('href') : null;
-                url =  url ? (new URL(url, base)).href: null;
-                // TODO if the xml parser barfed but the response is application/geo+json, use the parent addData method
-              let nativeZoom = mapml.querySelector("map-meta[name=zoom]") &&
-                                +M.metaContentToObject(mapml.querySelector("map-meta[name=zoom]").getAttribute("content")).value || 0;
-              let nativeCS = mapml.querySelector("map-meta[name=cs]") &&
-                                M.metaContentToObject(mapml.querySelector("map-meta[name=cs]").getAttribute("content")).content || "GCRS";
-              features.addData(mapml, nativeCS, nativeZoom);
-              if (url && --limit) {
-                return _pullFeatureFeed(url, limit);
-              }
-            }));
-          };
-        _pullFeatureFeed(this._getfeaturesUrl(), MAX_PAGES)
-          .then(function() { 
-            map.addLayer(features);
-            M.TemplatedFeaturesLayer.prototype._updateTabIndex(context);
-          })
-          .catch(function (error) { console.log(error);});
-      },
-      setZIndex: function (zIndex) {
-          this.options.zIndex = zIndex;
-          this._updateZIndex();
-          return this;
-      },
-      _updateTabIndex: function(context){
-        let c = context || this;
-        for(let layerNum in c._features._layers){
-          let layer = c._features._layers[layerNum];
-          if(layer._path){
-            if(layer._path.getAttribute("d") !== "M0 0"){
-              layer._path.setAttribute("tabindex", 0);
-            } else {
-              layer._path.removeAttribute("tabindex");
-            }
-            if(layer._path.childElementCount === 0) {
-              let title = document.createElement("title");
-              title.innerText = "Feature";
-              layer._path.appendChild(title);
-            }
-          }
-        }
-      },
-      _updateZIndex: function () {
-          if (this._container && this.options.zIndex !== undefined && this.options.zIndex !== null) {
-              this._container.style.zIndex = this.options.zIndex;
-          }
-      },
-      onRemove: function () {
-        this._map.removeLayer(this._features);
-      },
-      _getfeaturesUrl: function() {
-          var obj = {};
-          if (this.options.feature.zoom) {
-            obj[this.options.feature.zoom] = this._map.getZoom();
-          }
-          if (this.options.feature.width) {
-            obj[this.options.feature.width] = this._map.getSize().x;
-          }
-          if (this.options.feature.height) {
-            obj[this.options.feature.height] = this._map.getSize().y;
-          }
-          if (this.options.feature.bottom) {
-            obj[this.options.feature.bottom] = this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).y;
-          }
-          if (this.options.feature.left) {
-            obj[this.options.feature.left] = this._TCRSToPCRS(this._map.getPixelBounds().min, this._map.getZoom()).x;
-          }
-          if (this.options.feature.top) {
-            obj[this.options.feature.top] = this._TCRSToPCRS(this._map.getPixelBounds().min, this._map.getZoom()).y;
-          }
-          if (this.options.feature.right) {
-            obj[this.options.feature.right] = this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).x;
-          }
-          // hidden and other variables that may be associated
-          for (var v in this.options.feature) {
-              if (["width","height","left","right","top","bottom","zoom"].indexOf(v) < 0) {
-                  obj[v] = this.options.feature[v];
-                }
-          }
-          return L.Util.template(this._template.template, obj);
-      },
-      _TCRSToPCRS: function(coords, zoom) {
-        // TCRS pixel point to Projected CRS point (in meters, presumably)
-        var map = this._map,
-            crs = map.options.crs,
-            loc = crs.transformation.untransform(coords,crs.scale(zoom));
-            return loc;
-      },
-      _setUpFeaturesTemplateVars: function(template) {
-        // process the inputs and create an object named "extent"
-        // with member properties as follows:
-        // {width: {name: 'widthvarname'}, // value supplied by map if necessary
-        //  height: {name: 'heightvarname'}, // value supplied by map if necessary
-        //  left: {name: 'leftvarname', axis: 'leftaxisname'}, // axis name drives (coordinate system of) the value supplied by the map
-        //  right: {name: 'rightvarname', axis: 'rightaxisname'}, // axis name (coordinate system of) drives the value supplied by the map
-        //  top: {name: 'topvarname', axis: 'topaxisname'}, // axis name drives (coordinate system of) the value supplied by the map
-        //  bottom: {name: 'bottomvarname', axis: 'bottomaxisname'} // axis name drives (coordinate system of) the value supplied by the map
-        //  zoom: {name: 'zoomvarname'}
-        //  hidden: [{name: name, value: value}]}
-
-        var featuresVarNames = {feature:{}},
-            inputs = template.values;
-        featuresVarNames.feature.hidden = [];
-        for (var i=0;i<inputs.length;i++) {
-          // this can be removed when the spec removes the deprecated inputs...
-          var type = inputs[i].getAttribute("type"), 
-              units = inputs[i].getAttribute("units"), 
-              axis = inputs[i].getAttribute("axis"), 
-              name = inputs[i].getAttribute("name"), 
-              position = inputs[i].getAttribute("position"),
-              value = inputs[i].getAttribute("value"),
-              select = (inputs[i].tagName.toLowerCase() === "map-select");
-          if (type === "width") {
-                featuresVarNames.feature.width = name;
-          } else if ( type === "height") {
-                featuresVarNames.feature.height = name;
-          } else if (type === "zoom") {
-                featuresVarNames.feature.zoom = name;
-          } else if (type === "location" && (units === "pcrs" || units ==="gcrs") ) {
-            //<input name="..." units="pcrs" type="location" position="top|bottom-left|right" axis="northing|easting">
-            switch (axis) {
-              case ('x'):
-              case ('longitude'):
-              case ('easting'):
-                if (position) {
-                    if (position.match(/.*?-left/i)) {
-                      featuresVarNames.feature.left = name;
-                    } else if (position.match(/.*?-right/i)) {
-                      featuresVarNames.feature.right = name;
-                    }
-                }
-                break;
-              case ('y'):
-              case ('latitude'):
-              case ('northing'):
-                if (position) {
-                  if (position.match(/top-.*?/i)) {
-                    featuresVarNames.feature.top = name;
-                  } else if (position.match(/bottom-.*?/i)) {
-                    featuresVarNames.feature.bottom = name;
-                  }
-                }
-                break;
-            }
-           } else if (select) {
-              /*jshint -W104 */
-            const parsedselect = inputs[i].htmlselect;
-            featuresVarNames.feature[name] = function() {
-                return parsedselect.value;
-            };
-           // projection is deprecated, make it hidden
-          } else {
-              /*jshint -W104 */
-              const input = inputs[i];
-              featuresVarNames.feature[name] = function() {
-                  return input.getAttribute("value");
-              };
-          }
-        }
-        return featuresVarNames;
-      }
-  });
-  var templatedFeaturesLayer = function(template, options) {
-      return new TemplatedFeaturesLayer(template, options);
-  };
-
-  var TemplatedImageLayer =  L.Layer.extend({
-      initialize: function(template, options) {
-          this._template = template;
-          this._container = L.DomUtil.create('div', 'leaflet-layer', options.pane);
-          L.DomUtil.addClass(this._container, 'mapml-image-container');
-          let inputData = M.extractInputBounds(template);
-          this.zoomBounds = inputData.zoomBounds;
-          this.extentBounds=inputData.bounds;
-          this.isVisible = true;
-          L.extend(options, this.zoomBounds);
-          L.setOptions(this, L.extend(options,this._setUpExtentTemplateVars(template)));
-      },
-      getEvents: function () {
-          var events = {
-              moveend: this._onMoveEnd
-          };
-          return events;
-      },
-      onAdd: function () {
-          this._map._addZoomLimit(this);  //used to set the zoom limit of the map
-          this.setZIndex(this.options.zIndex);
-          this._onMoveEnd();
-      },
-      redraw: function() {
-          this._onMoveEnd();
-      },
-
-      _clearLayer: function(){
-        let containerImages = this._container.querySelectorAll('img');
-        for(let i = 0; i< containerImages.length;i++){
-          this._container.removeChild(containerImages[i]);
-        }
-      },
-
-      _onMoveEnd: function() {
-        let mapZoom = this._map.getZoom();
-        let mapBounds = M.pixelToPCRSBounds(this._map.getPixelBounds(),mapZoom,this._map.options.projection);
-        this.isVisible = mapZoom <= this.zoomBounds.maxZoom && mapZoom >= this.zoomBounds.minZoom && 
-                          this.extentBounds.overlaps(mapBounds);
-        if(!(this.isVisible)){
-          this._clearLayer();
-          return;
-        }
-        var map = this._map,
-          loc = map.getPixelBounds().min.subtract(map.getPixelOrigin()),
-          size = map.getSize(),
-          src = this.getImageUrl(),
-          overlayToRemove = this._imageOverlay;
-          this._imageOverlay = M.imageOverlay(src,loc,size,0,this._container);
-            
-        this._imageOverlay.addTo(map);
-        if (overlayToRemove) {
-          this._imageOverlay.on('load error', function () {map.removeLayer(overlayToRemove);});
-        }
-      },
-      setZIndex: function (zIndex) {
-          this.options.zIndex = zIndex;
-          this._updateZIndex();
-
-          return this;
-      },
-      _updateZIndex: function () {
-          if (this._container && this.options.zIndex !== undefined && this.options.zIndex !== null) {
-              this._container.style.zIndex = this.options.zIndex;
-          }
-      },
-      onRemove: function (map) {
-        this._clearLayer();
-        map._removeZoomLimit(this);
-        this._container = null;
-      },
-      getImageUrl: function() {
-          var obj = {};
-          obj[this.options.extent.width] = this._map.getSize().x;
-          obj[this.options.extent.height] = this._map.getSize().y;
-          obj[this.options.extent.bottom] = this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).y;
-          obj[this.options.extent.left] = this._TCRSToPCRS(this._map.getPixelBounds().min, this._map.getZoom()).x;
-          obj[this.options.extent.top] = this._TCRSToPCRS(this._map.getPixelBounds().min, this._map.getZoom()).y;
-          obj[this.options.extent.right] = this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).x;
-          // hidden and other variables that may be associated
-          for (var v in this.options.extent) {
-              if (["width","height","left","right","top","bottom"].indexOf(v) < 0) {
-                  obj[v] = this.options.extent[v];
-                }
-          }
-          return L.Util.template(this._template.template, obj);
-      },
-      _TCRSToPCRS: function(coords, zoom) {
-        // TCRS pixel point to Projected CRS point (in meters, presumably)
-        var map = this._map,
-            crs = map.options.crs,
-            loc = crs.transformation.untransform(coords,crs.scale(zoom));
-            return loc;
-      },
-      _setUpExtentTemplateVars: function(template) {
-        // process the inputs associated to template and create an object named
-        // extent with member properties as follows:
-        // {width: 'widthvarname', 
-        //  height: 'heightvarname', 
-        //  left: 'leftvarname', 
-        //  right: 'rightvarname', 
-        //  top: 'topvarname', 
-        //  bottom: 'bottomvarname'}
-
-        var extentVarNames = {extent:{}},
-            inputs = template.values;
-        
-        for (var i=0;i<template.values.length;i++) {
-          var type = inputs[i].getAttribute("type"), 
-              units = inputs[i].getAttribute("units"), 
-              axis = inputs[i].getAttribute("axis"), 
-              name = inputs[i].getAttribute("name"), 
-              position = inputs[i].getAttribute("position"),
-              select = (inputs[i].tagName.toLowerCase() === "map-select");
-          if (type === "width") {
-                extentVarNames.extent.width = name;
-          } else if ( type === "height") {
-                extentVarNames.extent.height = name;
-          } else if (type === "location" && (units === "pcrs" || units ==="gcrs") ) {
-            //<input name="..." units="pcrs" type="location" position="top|bottom-left|right" axis="northing|easting|latitude|longitude">
-            switch (axis) {
-              case ('longitude'):
-              case ('easting'):
-                if (position) {
-                    if (position.match(/.*?-left/i)) {
-                      extentVarNames.extent.left = name;
-                    } else if (position.match(/.*?-right/i)) {
-                      extentVarNames.extent.right = name;
-                    }
-                }
-                break;
-              case ('latitude'):
-              case ('northing'):
-                if (position) {
-                  if (position.match(/top-.*?/i)) {
-                    extentVarNames.extent.top = name;
-                  } else if (position.match(/bottom-.*?/i)) {
-                    extentVarNames.extent.bottom = name;
-                  }
-                }
-                break;
-            }
-          } else if (select) {
-              /*jshint -W104 */
-            const parsedselect = inputs[i].htmlselect;
-            extentVarNames.extent[name] = function() {
-                return parsedselect.value;
-            };
-          } else {
-              /*jshint -W104 */
-              const input = inputs[i];
-              extentVarNames.extent[name] = function() {
-                  return input.getAttribute("value");
-              };
-          }
-        }
-        return extentVarNames;
-      },
-  });
-  var templatedImageLayer = function(template, options) {
-      return new TemplatedImageLayer(template, options);
-  };
-
-  var ImageOverlay = L.ImageOverlay.extend({
-  	initialize: function (url, location, size, angle, container, options) { // (String, Point, Point, Number, Element, Object)
-                  this._container = container;
-  		this._url = url;
-                  // instead of calculating where the image goes, put it at 0,0
-  		//this._location = L.point(location);
-                  // the location for WMS requests will be the upper left hand
-                  // corner of the map.  When the map is initialized, that is 0,0,
-                  // but as the user pans, of course the
-  		this._location = location;
-                  this._size = L.point(size);
-                  this._angle = angle;
-
-  		L.setOptions(this, options);
-  	},
-          getEvents: function() {
-  		var events = {
-  			viewreset: this._reset
-  		};
-
-  		if (this._zoomAnimated) {
-  			events.zoomanim = this._animateZoom;
-  		}
-
-  		return events;
-          },
-  	onAdd: function () {
-                  this.on({ 
-                    load: this._onImageLoad
-                    });
-
-  		if (!this._image) {
-                      this._initImage();
-  		}
-
-  		if (this.options.interactive) {
-  			L.DomUtil.addClass(this._image, 'leaflet-interactive');
-  			this.addInteractiveTarget(this._image);
-  		}
-
-  		this._container.appendChild(this._image);
-  		this._reset();
-  	},
-  	onRemove: function () {
-  		L.DomUtil.remove(this._image);
-  		if (this.options.interactive) {
-  			this.removeInteractiveTarget(this._image);
-  		}
-  	},
-          _onImageLoad: function () {
-              if (!this._image) { return; }
-              this._image.loaded =  +new Date();
-              this._updateOpacity();
-          },
-  	_animateZoom: function (e) {
-  		var scale = this._map.getZoomScale(e.zoom),
-  		    translate = this._map.getPixelOrigin().add(this._location).multiplyBy(scale)
-  		        .subtract(this._map._getNewPixelOrigin(e.center, e.zoom)).round();
-
-  		if (L.Browser.any3d) {
-  			L.DomUtil.setTransform(this._image, translate, scale);
-  		} else {
-  			L.DomUtil.setPosition(this._image, translate);
-  		}
-  	},
-          _reset: function () {
-  		var image = this._image,
-  		    location = this._location,
-                      size = this._size;
-
-                  // TBD use the angle to establish the image rotation in CSS
-
-  		L.DomUtil.setPosition(image, location);
-
-  		image.style.width  = size.x + 'px';
-  		image.style.height = size.y + 'px';
-          },
-  	_updateOpacity: function () {
-  		if (!this._map) { return; }
-
-  		//L.DomUtil.setOpacity(this._image, this.options.opacity);
-
-  		var now = +new Date(),
-  		    nextFrame = false;
-
-                  var image = this._image;
-
-                  var fade = Math.min(1, (now - image.loaded) / 200);
-
-                  L.DomUtil.setOpacity(image, fade);
-                  if (fade < 1) {
-                          nextFrame = true;
-                  } 
-  		if (nextFrame) {
-  			L.Util.cancelAnimFrame(this._fadeFrame);
-  			this._fadeFrame = L.Util.requestAnimFrame(this._updateOpacity, this);
-  		}
-                  L.DomUtil.addClass(image, 'leaflet-image-loaded');
-  	}
-          
-  });
-  var imageOverlay = function (url, location, size, angle, container, options) {
-          return new ImageOverlay(url, location, size, angle, container, options);
-  };
-
-  var MapMLLayer = L.Layer.extend({
-      // zIndex has to be set, for the case where the layer is added to the
-      // map before the layercontrol is used to control it (where autoZindex is used)
-      // e.g. in the raw MapML-Leaflet-Client index.html page.
-      options: {
-          maxNext: 10,
-          zIndex: 0,
-          maxZoom: 25
-      },
-      // initialize is executed before the layer is added to a map
-      initialize: function (href, content, options) {
-          // in the custom element, the attribute is actually 'src'
-          // the _href version is the URL received from layer-@src
-          var mapml;
-          if (href) {
-              this._href = href;
-          }
-          if (content) {
-            this._layerEl = content;
-            mapml = content.querySelector('map-feature,map-tile,map-extent') ? true : false;
-            if (!href && mapml) {
-                this._content = content;
-            }
-          }
-          L.setOptions(this, options);
-          this._container = L.DomUtil.create('div', 'leaflet-layer');
-          L.DomUtil.addClass(this._container,'mapml-layer');
-          this._imageContainer = L.DomUtil.create('div', 'leaflet-layer', this._container);
-          L.DomUtil.addClass(this._imageContainer,'mapml-image-container');
-          
-          // this layer 'owns' a mapmlTileLayer, which is a subclass of L.GridLayer
-          // it 'passes' what tiles to load via the content of this._mapmlTileContainer
-          this._mapmlTileContainer = L.DomUtil.create('div', 'mapml-tile-container', this._container);
-          // hit the service to determine what its extent might be
-          // OR use the extent of the content provided
-
-          if (!mapml && content && content.hasAttribute('label')) this._title = content.getAttribute('label');
-          this._initCount = 0;
-          this._initExtent(mapml ? content : null);
-          
-          // a default extent can't be correctly set without the map to provide
-          // its bounds , projection, zoom range etc, so if that stuff's not
-          // established by metadata in the content, we should use map properties
-          // to set the extent, but the map won't be available until the <layer>
-          // element is attached to the <map> element, wait for that to happen.
-          this.on('attached', this._validateExtent, this );
-          // weirdness.  options is actually undefined here, despite the hardcoded
-          // options above. If you use this.options, you see the options defined
-          // above.  Not going to change this, but failing to understand ATM.
-          // may revisit some time.
-          this.validProjection = true; 
-      },
-      setZIndex: function (zIndex) {
-          this.options.zIndex = zIndex;
-          this._updateZIndex();
-
-          return this;
-      },
-      _updateZIndex: function () {
-          if (this._container && this.options.zIndex !== undefined && this.options.zIndex !== null) {
-              this._container.style.zIndex = this.options.zIndex;
-          }
-      },
-      // remove all the extents before removing the layer from the map
-      _removeExtents: function(map){
-        if(this._extent._mapExtents){
-          for(let i = 0; i < this._extent._mapExtents.length; i++){
-            if(this._extent._mapExtents[i].templatedLayer){
-              map.removeLayer(this._extent._mapExtents[i].templatedLayer);
-            }
-          }
-        }
-      },
-      _changeOpacity: function(e) {
-        if (e && e.target && e.target.value >=0 && e.target.value <= 1.0) {
-          this.changeOpacity(e.target.value);
-        }
-      },
-      changeOpacity: function(opacity) {
-          this._container.style.opacity = opacity;
-          if(this.opacityEl) this.opacityEl.value = opacity;
-      },
-      _changeExtentOpacity: function(e){
-        if(e && e.target && e.target.value >=0 && e.target.value <= 1.0){
-          this.templatedLayer.changeOpacity(e.target.value);
-          this._templateVars.opacity = e.target.value;
-        }
-      },
-      _changeExtent: function(e, extent) {
-          if(e.target.checked){
-            extent.checked = true;
-                extent.templatedLayer = M.templatedLayer(extent._templateVars, 
-                  { pane: this._container,
-                    _leafletLayer: this,
-                    crs: extent.crs
-                  }).addTo(this._map);
-                  this._getCombinedExtentsLayerBounds();         
-          } else {
-              L.DomEvent.stopPropagation(e);
-              extent.checked = false;
-              this._map.removeLayer(extent.templatedLayer);
-              this._getCombinedExtentsLayerBounds();
-          }
-      },
-
-      // if there are multiple extents, find the combined layerbounds
-      _getCombinedExtentsLayerBounds: function(){
-        let bounds, zoomMax, zoomMin, maxNativeZoom, minNativeZoom;
-
-        // get the bounds for each templateVars (need to get this again as value is being changed below - passed by ref)
-        for(let i = 0; i < this._extent._mapExtents.length; i++){
-          for(let j = 0; j < this._extent._mapExtents[i]._templateVars.length; j++){
-            let inputData = M.extractInputBounds(this._extent._mapExtents[i]._templateVars[j]);
-            this._extent._mapExtents[i]._templateVars[j].tempExtentBounds = inputData.bounds;
-            this._extent._mapExtents[i]._templateVars[j].extentZoomBounds = inputData.zoomBounds;
-          }
-        }
-
-        for(let i = 0; i < this._extent._mapExtents.length; i++){
-          if(this._extent._mapExtents[i].checked){
-                for(let j = 0; j < this._extent._mapExtents[i]._templateVars.length; j++){
-                  if(!bounds){
-                    bounds = this._extent._mapExtents[i]._templateVars[j].tempExtentBounds;
-                    zoomMax = this._extent._mapExtents[i]._templateVars[j].extentZoomBounds.maxZoom;
-                    zoomMin = this._extent._mapExtents[i]._templateVars[j].extentZoomBounds.minZoom;
-                    maxNativeZoom = this._extent._mapExtents[i]._templateVars[j].extentZoomBounds.maxNativeZoom;
-                    minNativeZoom = this._extent._mapExtents[i]._templateVars[j].extentZoomBounds.minNativeZoom;
-                  } else {
-                    bounds.extend(this._extent._mapExtents[i]._templateVars[j].tempExtentBounds.min);
-                    bounds.extend(this._extent._mapExtents[i]._templateVars[j].tempExtentBounds.max);
-                    zoomMax = Math.max(zoomMax, this._extent._mapExtents[i]._templateVars[j].extentZoomBounds.maxZoom);
-                    zoomMin = Math.min(zoomMin, this._extent._mapExtents[i]._templateVars[j].extentZoomBounds.minZoom);
-                    maxNativeZoom = Math.max(maxNativeZoom, this._extent._mapExtents[i]._templateVars[j].extentZoomBounds.maxNativeZoom);
-                    minNativeZoom = Math.min(minNativeZoom, this._extent._mapExtents[i]._templateVars[j].extentZoomBounds.minNativeZoom);
-                  }
-                }
-              }
-            }
-            this._extent.layerBounds = bounds;
-            this._extent.zoomBounds = {minZoom: 0, maxZoom: 0, maxNativeZoom: 0, minNativeZoom: 0};
-            this._extent.zoomBounds.maxZoom = zoomMax;
-            this._extent.zoomBounds.minZoom = zoomMin;
-            this._extent.zoomBounds.minNativeZoom = minNativeZoom;
-            this._extent.zoomBounds.maxNativeZoom = maxNativeZoom;
-            if(bounds){
-              //assigns the formatted extent object to .extent and spreads the zoom ranges to .extent also
-              this._layerEl.extent = (Object.assign(
-                                        M.convertAndFormatPCRS(bounds,this._map),
-                                        {zoom:this._extent.zoomBounds}));
-            }
-
-            // assign each template the layer and zoom bounds
-            for(let i = 0; i < this._extent._mapExtents.length; i++){
-              this._extent._mapExtents[i].templatedLayer.layerBounds = bounds;
-              this._extent._mapExtents[i].templatedLayer.zoomBounds = this._extent.zoomBounds;
-            }
-        },
-
-      onAdd: function (map) {
-          if((this._extent || this._extent_mapExtents) && !this._validProjection(map)){
-            this.validProjection = false;
-            return;
-          }
-          this._map = map;
-          if(this._content){
-            if (!this._mapmlvectors) {
-              this._mapmlvectors = M.mapMlFeatures(this._content, {
-                // pass the vector layer a renderer of its own, otherwise leaflet
-                // puts everything into the overlayPane
-                renderer: M.featureRenderer(),
-                // pass the vector layer the container for the parent into which
-                // it will append its own container for rendering into
-                pane: this._container,
-                opacity: this.options.opacity,
-                projection:map.options.projection,
-                // each owned child layer gets a reference to the root layer
-                _leafletLayer: this,
-                static: true,
-                onEachFeature: function(properties, geometry) {
-                  // need to parse as HTML to preserve semantics and styles
-                  if (properties) {
-                    var c = document.createElement('div');
-                    c.classList.add("mapml-popup-content");
-                    c.insertAdjacentHTML('afterbegin', properties.innerHTML);
-                    geometry.bindPopup(c, {autoClose: false, minWidth: 165});
-                  }
-                }
-              });
-            }
-            map.addLayer(this._mapmlvectors);
-          } else {
-            this.once('extentload', function() {
-              if(!this._validProjection(map)){
-                this.validProjection = false;
-                return;
-              }
-              if (!this._mapmlvectors) {
-                this._mapmlvectors = M.mapMlFeatures(this._content, {
-                    // pass the vector layer a renderer of its own, otherwise leaflet
-                    // puts everything into the overlayPane
-                    renderer: M.featureRenderer(),
-                    // pass the vector layer the container for the parent into which
-                    // it will append its own container for rendering into
-                    pane: this._container,
-                    opacity: this.options.opacity,
-                    projection:map.options.projection,
-                    // each owned child layer gets a reference to the root layer
-                    _leafletLayer: this,
-                    static: true,
-                    onEachFeature: function(properties, geometry) {
-                      // need to parse as HTML to preserve semantics and styles
-                      if (properties) {
-                        var c = document.createElement('div');
-                        c.classList.add("mapml-popup-content");
-                        c.insertAdjacentHTML('afterbegin', properties.innerHTML);
-                        geometry.bindPopup(c, {autoClose: false, minWidth: 165});
-                      }
-                    }
-                  }).addTo(map);
-              }
-              this._setLayerElExtent();
-            },this);
-          }
-          
-          
-          
-          if (!this._imageLayer) {
-              this._imageLayer = L.layerGroup();
-          }
-          map.addLayer(this._imageLayer);
-          // the layer._imageContainer property contains an element in which
-          // content will be maintained
-          
-          //only add the layer if there are tiles to be rendered
-          if((!this._staticTileLayer || this._staticTileLayer._container === null) && 
-            this._mapmlTileContainer.getElementsByTagName("map-tiles").length > 0)
-          {
-            this._staticTileLayer = M.mapMLStaticTileLayer({
-              pane:this._container,
-              _leafletLayer: this,
-              className:"mapml-static-tile-layer",
-              tileContainer:this._mapmlTileContainer,
-              maxZoomBound:map.options.crs.options.resolutions.length - 1,
-              tileSize: map.options.crs.options.crs.tile.bounds.max.x,
-            });
-            map.addLayer(this._staticTileLayer);
-          }
-
-          // if the extent has been initialized and received, update the map,
-          if (this._extent && this._extent._mapExtents && this._extent._mapExtents[0]._templateVars) {
-            for(let i = 0; i < this._extent._mapExtents.length; i++){
-              if (this._extent._mapExtents[i]._templateVars && this._extent._mapExtents[i].checked) {
-                this._templatedLayer = M.templatedLayer(this._extent._mapExtents[i]._templateVars, 
-                  { pane: this._container,
-                    _leafletLayer: this,
-                    crs: this._extent.crs,
-                    }).addTo(map);   
-                    this._extent._mapExtents[i].templatedLayer = this._templatedLayer;
-                    if(this._templatedLayer._queries){
-                      if(!this._extent._queries) this._extent._queries = [];
-                      this._extent._queries = this._extent._queries.concat(this._templatedLayer._queries);
-                    }
-              }
-             }
-            this._getCombinedExtentsLayerBounds();
-          } else {
-              this.once('extentload', function() {
-                  if(!this._validProjection(map)){
-                    this.validProjection = false;
-                    return;
-                  }
-                  if(this._extent && this._extent._mapExtents){
-                    for(let i = 0; i < this._extent._mapExtents.length; i++){
-                      if (this._extent._mapExtents[i]._templateVars) { 
-                        this._templatedLayer = M.templatedLayer(this._extent._mapExtents[i]._templateVars, 
-                        { pane: this._container,
-                          _leafletLayer: this,
-                          crs: this._extent.crs
-                        }).addTo(map);
-                        this._extent._mapExtents[i].templatedLayer = this._templatedLayer;
-                        this._getCombinedExtentsLayerBounds();
-                      }
-                    }
-                  } 
-                }, this);
-          }
-          this._setLayerElExtent();
-          this.setZIndex(this.options.zIndex);
-          this.getPane().appendChild(this._container);
-          setTimeout(() => {
-            map.fire('checkdisabled');
-          }, 0);
-          map.on("popupopen", this._attachSkipButtons, this);
-      },
-
-
-      _validProjection : function(map){
-        let noLayer = false;
-        if(this._extent._mapExtents){
-          for(let i = 0; i < this._extent._mapExtents.length; i++){
-            if(this._extent._mapExtents[i]._templateVars){
-              for(let template of this._extent._mapExtents[i]._templateVars)
-                if(!template.projectionMatch && template.projection !== map.options.projection) {
-                  noLayer = true; // if there's a single template where projections don't match, set noLayer to true
-                  break;
-                } 
-              }
-        }
-      }
-        return !(noLayer || this.getProjection() !== map.options.projection.toUpperCase());
-      },
-
-      //sets the <layer-> elements .bounds property 
-      _setLayerElExtent: function(){
-        let localBounds, localZoomRanges;
-        let layerTypes = ["_staticTileLayer","_imageLayer","_mapmlvectors"];
-        layerTypes.forEach((type) =>{
-          if(this[type]){
-              if(this[type].layerBounds){
-                if(!localBounds){
-                  localBounds = this[type].layerBounds;
-                  localZoomRanges = this[type].zoomBounds;
-                } else {
-                  localBounds.extend(this[type].layerBounds.min);
-                  localBounds.extend(this[type].layerBounds.max);
-                }
-              } 
-            
-            }       
-        });
-
-        if(localBounds){
-          //assigns the formatted extent object to .extent and spreads the zoom ranges to .extent also
-          this._layerEl.extent = (Object.assign(
-                                    M.convertAndFormatPCRS(localBounds,this._map),
-                                    {zoom:localZoomRanges}));
-        }
-      },
-
-      addTo: function (map) {
-          map.addLayer(this);
-          return this;
-      },
-      getEvents: function () {
-          return {zoomanim: this._onZoomAnim};
-      },
-      redraw: function() {
-        // for now, only redraw templated layers.
-          if (this._extent._mapExtents) {
-            for(let i = 0; i < this._extent._mapExtents.length; i++){
-              if(this._extent._mapExtents[i].templatedLayer){
-                this._extent._mapExtents[i].templatedLayer.redraw();
-              }
-            }
-          }
-      },
-      _onZoomAnim: function(e) {
-        // get the min and max zooms from all extents
-        var toZoom = e.zoom,
-            zoom = (this._extent && this._extent._mapExtents) ? this._extent._mapExtents[0].querySelector("map-input[type=zoom]") : null,
-            min = zoom && zoom.hasAttribute("min") ? parseInt(zoom.getAttribute("min")) : this._map.getMinZoom(),
-            max =  zoom && zoom.hasAttribute("max") ? parseInt(zoom.getAttribute("max")) : this._map.getMaxZoom();
-        if(zoom){
-          for(let i = 1; i < this._extent._mapExtents.length; i++){
-            zoom = this._extent._mapExtents[i].querySelector("map-input[type=zoom]");
-            if(zoom && zoom.hasAttribute("min")) { min = Math.min(parseInt(zoom.getAttribute("min")), min); }
-            if(zoom && zoom.hasAttribute("max")){ max = Math.max(parseInt(zoom.getAttribute("max")), max); }
-          }
-        }
-        var canZoom = (toZoom < min && this._extent.zoomout) || (toZoom > max && this._extent.zoomin);
-        if (!(min <= toZoom && toZoom <= max)){
-          if (this._extent.zoomin && toZoom > max) {
-            // this._href is the 'original' url from which this layer came
-            // since we are following a zoom link we will be getting a new
-            // layer almost, resetting child content as appropriate
-            this._href = this._extent.zoomin;
-            this._layerEl.src = this._extent.zoomin;
-            // this.href is the "public" property. When a dynamic layer is
-            // accessed, this value changes with every new extent received
-            this.href = this._extent.zoomin;
-            this._layerEl.src = this._extent.zoomin;
-          } else if (this._extent.zoomout && toZoom < min) {
-            this._href = this._extent.zoomout;
-            this.href = this._extent.zoomout;
-            this._layerEl.src = this._extent.zoomout;
-          }
-        }
-        if (this._templatedLayer && canZoom ) ;
-      },
-      onRemove: function (map) {
-          L.DomUtil.remove(this._container);
-          if(this._staticTileLayer) map.removeLayer(this._staticTileLayer);
-          if(this._mapmlvectors) map.removeLayer(this._mapmlvectors);
-          if(this._imageLayer) map.removeLayer(this._imageLayer);
-          if (this._extent && this._extent._mapExtents) this._removeExtents(map);
-
-          map.fire("checkdisabled");
-          map.off("popupopen", this._attachSkipButtons);
-      },
-      getZoomBounds: function () {
-          var ext = this._extent;
-          var zoom = ext ? ext.querySelector('[type=zoom]') : undefined,
-              min = zoom && zoom.hasAttribute('min') ? zoom.getAttribute('min') : this._map.getMinZoom(),
-              max = zoom && zoom.hasAttribute('max') ? zoom.getAttribute('max') : this._map.getMaxZoom();
-          var bounds = {};
-          bounds.min = Math.min(min,max);
-          bounds.max = Math.max(min,max);
-          return bounds;
-      },
-      _transformDeprectatedInput: function (i) {
-        var type = i.getAttribute("type").toLowerCase();
-        if (type === "xmin" || type === "ymin" || type === "xmax" || type === "ymax") {
-          i.setAttribute("type", "location");
-          i.setAttribute("units","tcrs");
-          switch (type) {
-            case "xmin":
-              i.setAttribute("axis","x");
-              i.setAttribute("position","top-left");
-              break;
-            case "ymin":
-              i.setAttribute("axis","y");
-              i.setAttribute("position","top-left");
-              break;
-            case "xmax":
-              i.setAttribute("axis","x");
-              i.setAttribute("position","bottom-right");
-              break;
-            case "ymax":
-              i.setAttribute("axis","y");
-              i.setAttribute("position","bottom-right");
-              break;
-          }
-        } 
-      },
-      // retrieve the (projected, scaled) layer extent for the current map zoom level
-      getLayerExtentBounds: function(map) {
-          
-          if (!this._extent) return;
-          var zoom = map.getZoom(), projection = map.options.projection,
-              ep = this._extent.getAttribute("units"),
-              projecting = (projection !== ep),
-              p;
-          
-          var xmin,ymin,xmax,ymax,v1,v2,extentZoomValue;
-          
-          // todo: create an array of min values, converted to tcrs units
-          // take the Math.min of all of them.
-          v1 = this._extent.querySelector('[type=xmin]').getAttribute('min');
-          v2 = this._extent.querySelector('[type=xmax]').getAttribute('min');
-          xmin = Math.min(v1,v2);
-          v1 = this._extent.querySelector('[type=xmin]').getAttribute('max');
-          v2 = this._extent.querySelector('[type=xmax]').getAttribute('max');
-          xmax = Math.max(v1,v2);
-          v1 = this._extent.querySelector('[type=ymin]').getAttribute('min');
-          v2 = this._extent.querySelector('[type=ymax]').getAttribute('min');
-          ymin = Math.min(v1,v2);
-          v1 = this._extent.querySelector('[type=ymin]').getAttribute('max');
-          v2 = this._extent.querySelector('[type=ymax]').getAttribute('max');
-          ymax = Math.max(v1,v2);
-          // WGS84 can be converted to Tiled CRS units
-          if (projecting) {
-              //project and scale to M[projection] from WGS84
-              p = M[projection];
-              var corners = [
-                p.latLngToPoint(L.latLng([ymin,xmin]),zoom),
-                p.latLngToPoint(L.latLng([ymax,xmax]),zoom), 
-                p.latLngToPoint(L.latLng([ymin,xmin]),zoom), 
-                p.latLngToPoint(L.latLng([ymin,xmax]),zoom)
-              ];
-              return L.bounds(corners);
-          } else {
-              // if the zoom level of the extent does not match that of the map
-              extentZoomValue = parseInt(this._extent.querySelector('[type=zoom]').getAttribute('value'));
-              if (extentZoomValue !== zoom) {
-                  // convert the extent bounds to corresponding bounds at the current map zoom
-                  p = M[projection];
-                  return L.bounds(
-                      p.latLngToPoint(p.pointToLatLng(L.point(xmin,ymin),extentZoomValue),zoom),
-                      p.latLngToPoint(p.pointToLatLng(L.point(xmax,ymax),extentZoomValue),zoom));
-              } else {
-                  // the extent's zoom value === map.getZoom(), return the bounds
-                  return L.bounds(L.point(xmin,ymin), L.point(xmax,ymax));
-              }
-          }
-      },
-      getAttribution: function () {
-          return this.options.attribution;
-      },
-
-      getLayerExtentHTML: function (labelName, i) {
-        var extent = L.DomUtil.create('fieldset', 'mapml-layer-extent'),
-          extentProperties = L.DomUtil.create('div', 'mapml-layer-item-properties', extent),
-          extentSettings = L.DomUtil.create('div', 'mapml-layer-item-settings', extent),
-          extentLabel = L.DomUtil.create('label', 'mapml-layer-item-toggle', extentProperties),
-          input = L.DomUtil.create('input'),
-          svgExtentControlIcon = L.SVG.create('svg'),
-          extentControlPath1 = L.SVG.create('path'),
-          extentControlPath2 = L.SVG.create('path'),
-          extentNameIcon = L.DomUtil.create('span'),
-          extentItemControls = L.DomUtil.create('div', 'mapml-layer-item-controls', extentProperties),
-          opacityControl = L.DomUtil.create('details', 'mapml-layer-item-opacity', extentSettings),
-          extentOpacitySummary = L.DomUtil.create('summary', '', opacityControl),
-          opacity = L.DomUtil.create('input', '', opacityControl);
-          extentSettings.hidden = true;
-
-          // append the svg paths
-          svgExtentControlIcon.setAttribute('viewBox', '0 0 24 24');
-          svgExtentControlIcon.setAttribute('height', '22');
-          svgExtentControlIcon.setAttribute('width', '22');
-          extentControlPath1.setAttribute('d', 'M0 0h24v24H0z');
-          extentControlPath1.setAttribute('fill', 'none');
-          extentControlPath2.setAttribute('d', 'M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z');
-          svgExtentControlIcon.appendChild(extentControlPath1);
-          svgExtentControlIcon.appendChild(extentControlPath2);
-
-          let removeExtentButton = L.DomUtil.create('button', 'mapml-layer-item-remove-control', extentItemControls);
-          removeExtentButton.type = 'button';
-          removeExtentButton.title = 'Remove Sub Layer';
-          removeExtentButton.innerHTML = "<span aria-hidden='true'>&#10005;</span>";
-          removeExtentButton.classList.add('mapml-button');
-          L.DomEvent.on(removeExtentButton, 'click', L.DomEvent.stop);
-          L.DomEvent.on(removeExtentButton, 'click', (e)=>{
-            e.target.checked = false;
-            this._changeExtent(e, this._extent._mapExtents[i]);
-            this._extent._mapExtents[i].extentAnatomy.parentNode.removeChild(this._extent._mapExtents[i].extentAnatomy);
-            //this._extent._mapExtents.splice(i, 1);
-            // remove events
-          }, this);
-
-          let extentsettingsButton = L.DomUtil.create('button', 'mapml-layer-item-settings-control', extentItemControls);
-          extentsettingsButton.type = 'button';
-          extentsettingsButton.title = 'Extent Settings';
-          extentsettingsButton.setAttribute('aria-expanded', false);
-          extentsettingsButton.classList.add('mapml-button');
-          L.DomEvent.on(extentsettingsButton, 'click', (e)=>{
-            if(extentSettings.hidden == true){
-              extentsettingsButton.setAttribute('aria-expanded', true);
-              extentSettings.hidden = false;
-            } else {
-              extentsettingsButton.setAttribute('aria-expanded', false);
-              extentSettings.hidden = true;
-            }
-          }, this);
-
-          extentNameIcon.setAttribute('aria-hidden', true);
-          extentLabel.appendChild(input);
-          extentsettingsButton.appendChild(extentNameIcon);
-          extentNameIcon.appendChild(svgExtentControlIcon);
-          extentOpacitySummary.innerText = 'Opacity';
-          extentOpacitySummary.id = 'mapml-layer-item-opacity-' + L.stamp(extentOpacitySummary);
-          opacity.setAttribute('type','range');
-          opacity.setAttribute('min', '0');
-          opacity.setAttribute('max','1.0');
-          opacity.setAttribute('value', this._extent._mapExtents[i]._templateVars.opacity || '1.0');
-          opacity.setAttribute('step','0.1');
-          opacity.setAttribute('aria-labelledby', 'mapml-layer-item-opacity-' + L.stamp(extentOpacitySummary));
-          this._extent._mapExtents[i]._templateVars.opacity = this._extent._mapExtents[i]._templateVars.opacity || '1.0';
-          L.DomEvent.on(opacity, 'change', this._changeExtentOpacity, this._extent._mapExtents[i]);
-
-          var extentItemNameSpan = L.DomUtil.create('span', 'mapml-layer-item-name', extentLabel);
-          input.defaultChecked = this._extent._mapExtents[i] ? true: false;
-          this._extent._mapExtents[i].checked = input.defaultChecked;
-          input.type = 'checkbox';
-          extentItemNameSpan.innerHTML = labelName;
-          L.DomEvent.on(input, 'change', (e)=>{
-            this._changeExtent(e, this._extent._mapExtents[i]);
-          });
-          extentItemNameSpan.id = 'mapml-extent-item-name-{' + L.stamp(extentItemNameSpan) + '}';
-          extent.setAttribute('aria-labelledby', extentItemNameSpan.id);
-          return extent;
-      },
-
-      getLayerUserControlsHTML: function () {
-        var fieldset = L.DomUtil.create('fieldset', 'mapml-layer-item'),
-          input = L.DomUtil.create('input'),
-          layerItemName = L.DomUtil.create('span', 'mapml-layer-item-name'),
-          settingsButtonNameIcon = L.DomUtil.create('span'),
-          layerItemProperty = L.DomUtil.create('div', 'mapml-layer-item-properties', fieldset),
-          layerItemSettings = L.DomUtil.create('div', 'mapml-layer-item-settings', fieldset),
-          itemToggleLabel = L.DomUtil.create('label', 'mapml-layer-item-toggle', layerItemProperty),
-          layerItemControls = L.DomUtil.create('div', 'mapml-layer-item-controls', layerItemProperty),
-          opacityControl = L.DomUtil.create('details', 'mapml-layer-item-opacity mapml-control-layers', layerItemSettings),
-          opacity = L.DomUtil.create('input'),
-          opacityControlSummary = L.DomUtil.create('summary'),
-          svgSettingsControlIcon = L.SVG.create('svg'),
-          settingsControlPath1 = L.SVG.create('path'),
-          settingsControlPath2 = L.SVG.create('path'),
-          mapEl = this._layerEl.parentNode;
-          this.opacityEl = opacity;
-
-          // append the paths in svg for the remove layer and toggle icons
-          svgSettingsControlIcon.setAttribute('viewBox', '0 0 24 24');
-          svgSettingsControlIcon.setAttribute('height', '22');
-          svgSettingsControlIcon.setAttribute('width', '22');
-          settingsControlPath1.setAttribute('d', 'M0 0h24v24H0z');
-          settingsControlPath1.setAttribute('fill', 'none');
-          settingsControlPath2.setAttribute('d', 'M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z');
-          svgSettingsControlIcon.appendChild(settingsControlPath1);
-          svgSettingsControlIcon.appendChild(settingsControlPath2);
-          
-          layerItemSettings.hidden = true;
-          settingsButtonNameIcon.setAttribute('aria-hidden', true);
-          
-          let removeControlButton = L.DomUtil.create('button', 'mapml-layer-item-remove-control', layerItemControls);
-          removeControlButton.type = 'button';
-          removeControlButton.title = 'Remove Layer';
-          removeControlButton.innerHTML = "<span aria-hidden='true'>&#10005;</span>";
-          removeControlButton.classList.add('mapml-button');
-          //L.DomEvent.disableClickPropagation(removeControlButton);
-          L.DomEvent.on(removeControlButton, 'click', L.DomEvent.stop);
-          L.DomEvent.on(removeControlButton, 'click', (e)=>{
-            let fieldset = 0, elem, root;
-            root = mapEl.tagName === "MAPML-VIEWER" ? mapEl.shadowRoot : mapEl.querySelector(".mapml-web-map").shadowRoot;
-            if(e.target.closest("fieldset").nextElementSibling && !e.target.closest("fieldset").nextElementSibling.disbaled){
-              elem = e.target.closest("fieldset").previousElementSibling;
-              while(elem){
-                fieldset += 2; // find the next layer menu item
-                elem = elem.previousElementSibling;
-              }
-            } else {
-              // focus on the link
-              elem = "link";
-            }
-            mapEl.removeChild(e.target.closest("fieldset").querySelector("span").layer._layerEl);
-            elem = elem ? root.querySelector(".leaflet-control-attribution").firstElementChild: elem = root.querySelectorAll('input')[fieldset];
-            elem.focus();
-          }, this);
-
-          let itemSettingControlButton = L.DomUtil.create('button', 'mapml-layer-item-settings-control', layerItemControls);
-          itemSettingControlButton.type = 'button';
-          itemSettingControlButton.title = 'Layer Settings';
-          itemSettingControlButton.setAttribute('aria-expanded', false);
-          itemSettingControlButton.classList.add('mapml-button');
-          L.DomEvent.on(itemSettingControlButton, 'click', (e)=>{
-            if(layerItemSettings.hidden == true){
-              itemSettingControlButton.setAttribute('aria-expanded', true);
-              layerItemSettings.hidden = false;
-            } else {
-              itemSettingControlButton.setAttribute('aria-expanded', false);
-              layerItemSettings.hidden = true;
-            }
-          }, this);
-
-          input.defaultChecked = this._map ? true: false;
-          input.type = 'checkbox';
-          layerItemName.layer = this;
-
-          if (this._legendUrl) {
-            var legendLink = document.createElement('a');
-            legendLink.text = ' ' + this._title;
-            legendLink.href = this._legendUrl;
-            legendLink.target = '_blank';
-            legendLink.draggable = false;
-            layerItemName.appendChild(legendLink);
-          } else {
-            layerItemName.innerHTML = this._title;
-          }
-          layerItemName.id = 'mapml-layer-item-name-{' + L.stamp(layerItemName) + '}';
-          opacityControlSummary.innerText = 'Opacity';
-          opacityControlSummary.id = 'mapml-layer-item-opacity-' + L.stamp(opacityControlSummary);
-          opacityControl.appendChild(opacityControlSummary);
-          opacityControl.appendChild(opacity);
-          opacity.setAttribute('type','range');
-          opacity.setAttribute('min', '0');
-          opacity.setAttribute('max','1.0');
-          opacity.setAttribute('value', this._container.style.opacity || '1.0');
-          opacity.setAttribute('step','0.1');
-          opacity.setAttribute('aria-labelledby', opacityControlSummary.id);
-          opacity.value = this._container.style.opacity || '1.0';
-
-          fieldset.setAttribute("aria-grabbed", "false");
-          fieldset.setAttribute('aria-labelledby', layerItemName.id);
-
-          fieldset.onmousedown = (downEvent) => {
-            if(downEvent.target.tagName.toLowerCase() === "input" || downEvent.target.tagName.toLowerCase() === "select") return;
-            downEvent.preventDefault();
-            let control = fieldset,
-                controls = fieldset.parentNode,
-                moving = false, yPos = downEvent.clientY;
-
-            document.body.onmousemove = (moveEvent) => {
-              moveEvent.preventDefault();
-
-              // Fixes flickering by only moving element when there is enough space
-              let offset = moveEvent.clientY - yPos;
-              moving = Math.abs(offset) > 5 || moving;
-              if( (controls && !moving) || (controls && controls.childElementCount <= 1) || 
-                  controls.getBoundingClientRect().top > control.getBoundingClientRect().bottom || 
-                  controls.getBoundingClientRect().bottom < control.getBoundingClientRect().top){
-                    return;
-                  }
-              
-              controls.classList.add("mapml-draggable");
-              control.style.transform = "translateY("+ offset +"px)";
-              control.style.pointerEvents = "none";
-
-              let x = moveEvent.clientX, y = moveEvent.clientY,
-                  root = mapEl.tagName === "MAPML-VIEWER" ? mapEl.shadowRoot : mapEl.querySelector(".mapml-web-map").shadowRoot,
-                  elementAt = root.elementFromPoint(x, y),
-                  swapControl = !elementAt || !elementAt.closest("fieldset") ? control : elementAt.closest("fieldset");
-        
-              swapControl =  Math.abs(offset) <= swapControl.offsetHeight ? control : swapControl;
-              
-              control.setAttribute("aria-grabbed", 'true');
-              control.setAttribute("aria-dropeffect", "move");
-              if(swapControl && controls === swapControl.parentNode){
-                swapControl = swapControl !== control.nextSibling? swapControl : swapControl.nextSibling;
-                if(control !== swapControl){ 
-                  yPos = moveEvent.clientY;
-                  control.style.transform = null;
-                }
-                controls.insertBefore(control, swapControl);
-              }
-            };
-
-            document.body.onmouseup = () => {
-              control.setAttribute("aria-grabbed", "false");
-              control.removeAttribute("aria-dropeffect");
-              control.style.pointerEvents = null;
-              control.style.transform = null;
-              let controlsElems = controls.children,
-                  zIndex = 1;
-              for(let c of controlsElems){
-                let layerEl = c.querySelector("span").layer._layerEl;
-                
-                layerEl.setAttribute("data-moving","");
-                mapEl.insertAdjacentElement("beforeend", layerEl);
-                layerEl.removeAttribute("data-moving");
-
-                
-                layerEl._layer.setZIndex(zIndex);
-                zIndex++;
-              }
-              controls.classList.remove("mapml-draggable");
-              document.body.onmousemove = document.body.onmouseup = null;
-            };
-          };
-
-          L.DomEvent.on(opacity,'change', this._changeOpacity, this);
-
-          itemToggleLabel.appendChild(input);
-          itemToggleLabel.appendChild(layerItemName);
-          itemSettingControlButton.appendChild(settingsButtonNameIcon);
-          settingsButtonNameIcon.appendChild(svgSettingsControlIcon);
-
-          if (this._styles) {
-            layerItemSettings.appendChild(this._styles);
-          }
-
-          if (this._userInputs) {
-            var frag = document.createDocumentFragment();
-            var templates = this._extent._templateVars;
-            if (templates) {
-              for (var i=0;i<templates.length;i++) {
-                var template = templates[i];
-                for (var j=0;j<template.values.length;j++) {
-                  var mapmlInput = template.values[j],
-                      id = '#'+mapmlInput.getAttribute('id');
-                  // don't add it again if it is referenced > once
-                  if (mapmlInput.tagName.toLowerCase() === 'map-select' && !frag.querySelector(id)) {
-                    // generate a <details><summary></summary><select...></details>
-                    var selectdetails = L.DomUtil.create('details', 'mapml-layer-item-time mapml-control-layers', frag),
-                        selectsummary = L.DomUtil.create('summary'),
-                        selectSummaryLabel = L.DomUtil.create('label');
-                        selectSummaryLabel.innerText = mapmlInput.getAttribute('name');
-                        selectSummaryLabel.setAttribute('for', mapmlInput.getAttribute('id'));
-                        selectsummary.appendChild(selectSummaryLabel);
-                        selectdetails.appendChild(selectsummary);
-                        selectdetails.appendChild(mapmlInput.htmlselect);
-                  }
-                }
-              }
-            }
-            layerItemSettings.appendChild(frag);
-          }
-
-          // if there are extents, add them to the layer control
-          if(this._extent && this._extent._mapExtents) {
-            var extentsFieldset = L.DomUtil.create('fieldset', 'mapml-layer-grouped-extents');
-            extentsFieldset.setAttribute('aria-label', 'Sublayers');
-            for(let j=0; j < this._extent._mapExtents.length; j++) {
-              extentsFieldset.appendChild(this._extent._mapExtents[j].extentAnatomy);
-            }
-            layerItemSettings.appendChild(extentsFieldset);
-          }
-
-          return fieldset;
-      },
-      _initExtent: function(content) {
-          if (!this._href && !content) {return;}
-          var layer = this;
-          // the this._href (comes from layer@src) should take precedence over 
-          // content of the <layer> element, but if no this._href / src is provided
-          // but there *is* child content of the <layer> element (which is copied/
-          // referred to by this._content), we should use that content.
-          if (this._href) {
-              var xhr = new XMLHttpRequest();
-  //            xhr.withCredentials = true;
-              _get(this._href, _processInitialExtent);
-          } else if (content) {
-              // may not set this._extent if it can't be done from the content
-              // (eg a single point) and there's no map to provide a default yet
-              _processInitialExtent.call(this, content);
-          }
-          function _get(url, fCallback  ) {
-              xhr.onreadystatechange = function () { 
-                if(this.readyState === this.DONE) {
-                  if (this.status === 400 || 
-                      this.status === 404 || 
-                      this.status === 500 || 
-                      this.status === 406) {
-                      layer.error = true;
-                      layer.fire('extentload', layer, true);
-                      xhr.abort();
-                  }
-                }};
-              xhr.onload = fCallback;
-              xhr.onerror = function () { 
-                layer.error = true;
-                layer.fire('extentload', layer, true);
-              };
-              xhr.open("GET", url);
-              xhr.setRequestHeader("Accept",M.mime);
-              xhr.overrideMimeType("text/xml");
-              xhr.send();
-          }
-          function transcribe(element) {
-              var select = document.createElement("select");
-              var elementAttrNames = element.getAttributeNames();
-
-              for(let i = 0; i < elementAttrNames.length; i++){
-                  select.setAttribute(elementAttrNames[i], element.getAttribute(elementAttrNames[i]));
-              }
-
-              var options = element.children;
-
-              for(let i = 0; i < options.length; i++){
-                  var option = document.createElement("option");
-                  var optionAttrNames = options[i].getAttributeNames();
-
-                  for (let j = 0; j < optionAttrNames.length; j++){
-                      option.setAttribute(optionAttrNames[j], options[i].getAttribute(optionAttrNames[j]));
-                  }
-
-                  option.innerHTML = options[i].innerHTML;
-                  select.appendChild(option);
-              }
-              return select;
-          }
-
-          function _initTemplateVars(serverExtent, metaExtent, projection, mapml, base, projectionMatch){
-            var templateVars = [];
-            // set up the URL template and associated inputs (which yield variable values when processed)
-            var tlist = serverExtent.querySelectorAll('map-link[rel=tile],map-link[rel=image],map-link[rel=features],map-link[rel=query]'),
-                varNamesRe = (new RegExp('(?:\{)(.*?)(?:\})','g')),
-                zoomInput = serverExtent.querySelector('map-input[type="zoom" i]'),
-                includesZoom = false, extentFallback = {};
-
-            extentFallback.zoom = 0;
-            if (metaExtent){
-              let content = M.metaContentToObject(metaExtent.getAttribute("content")), cs;
-              
-              extentFallback.zoom = content.zoom || extentFallback.zoom;
-
-              let metaKeys = Object.keys(content);
-              for(let i =0;i<metaKeys.length;i++){
-                if(!metaKeys[i].includes("zoom")){
-                  cs = M.axisToCS(metaKeys[i].split("-")[2]);
-                  break;
-                }
-              }
-              let axes = M.csToAxes(cs);
-              extentFallback.bounds = M.boundsToPCRSBounds(
-                L.bounds(L.point(+content[`top-left-${axes[0]}`],+content[`top-left-${axes[1]}`]),
-                L.point(+content[`bottom-right-${axes[0]}`],+content[`bottom-right-${axes[1]}`])),
-                extentFallback.zoom, projection, cs);
-              
-            } else {
-              extentFallback.bounds = M[projection].options.crs.pcrs.bounds;
-            }
-              
-            for (var i=0;i< tlist.length;i++) {
-              var t = tlist[i], template = t.getAttribute('tref'); 
-              if(!template){
-                template = BLANK_TT_TREF;
-                let blankInputs = mapml.querySelectorAll('map-input');
-                for (let i of blankInputs){
-                  template += `{${i.getAttribute("name")}}`;
-                }
-              }
-              
-              var v,
-                  title = t.hasAttribute('title') ? t.getAttribute('title') : 'Query this layer',
-                  vcount=template.match(varNamesRe),
-                  trel = (!t.hasAttribute('rel') || t.getAttribute('rel').toLowerCase() === 'tile') ? 'tile' : t.getAttribute('rel').toLowerCase(),
-                  ttype = (!t.hasAttribute('type')? 'image/*':t.getAttribute('type').toLowerCase()),
-                  inputs = [],
-                  tms = t && t.hasAttribute("tms");
-                  var zoomBounds = mapml.querySelector('map-meta[name=zoom]')?
-                                    M.metaContentToObject(mapml.querySelector('map-meta[name=zoom]').getAttribute('content')):
-                                    undefined;
-              while ((v = varNamesRe.exec(template)) !== null) {
-                var varName = v[1],
-                    inp = serverExtent.querySelector('map-input[name='+varName+'],map-select[name='+varName+']');
-                if (inp) {
-
-                  if ((inp.hasAttribute("type") && inp.getAttribute("type")==="location") && 
-                      (!inp.hasAttribute("min" )) && 
-                      (inp.hasAttribute("axis") && !["i","j"].includes(inp.getAttribute("axis").toLowerCase()))){
-                    zoomInput.setAttribute("value", extentFallback.zoom);
-                    
-                    let axis = inp.getAttribute("axis"), 
-                        axisBounds = M.convertPCRSBounds(extentFallback.bounds, extentFallback.zoom, projection, M.axisToCS(axis));
-                    inp.setAttribute("min", axisBounds.min[M.axisToXY(axis)]);
-                    inp.setAttribute("max", axisBounds.max[M.axisToXY(axis)]);
-                  }
-
-                  inputs.push(inp);
-                  includesZoom = includesZoom || inp.hasAttribute("type") && inp.getAttribute("type").toLowerCase() === "zoom";
-                  if (inp.hasAttribute('shard')) {
-                    var id = inp.getAttribute('list');
-                    inp.servers = [];
-                    var servers = serverExtent.querySelectorAll('map-datalist#'+id + ' > map-option');
-                    if (servers.length === 0 && inp.hasAttribute('value')) {
-                      servers = inp.getAttribute('value').split('');
-                    }
-                    for (var s=0;s < servers.length;s++) {
-                      if (servers[s].getAttribute) {
-                        inp.servers.push(servers[s].getAttribute('value'));
-                      } else {
-                        inp.servers.push(servers[s]);
-                      }
-                    }
-                  } else if (inp.tagName.toLowerCase() === 'map-select') {
-                    // use a throwaway div to parse the input from MapML into HTML
-                    var div =document.createElement("div");
-                    div.insertAdjacentHTML("afterbegin",inp.outerHTML);
-                    // parse
-                    inp.htmlselect = div.querySelector("map-select");
-                    inp.htmlselect = transcribe(inp.htmlselect);
-
-                    // this goes into the layer control, so add a listener
-                    L.DomEvent.on(inp.htmlselect, 'change', layer.redraw, layer);
-                    if (!layer._userInputs) {
-                      layer._userInputs = [];
-                    }
-                    layer._userInputs.push(inp.htmlselect);
-                  }
-                  // TODO: if this is an input@type=location 
-                  // get the TCRS min,max attribute values at the identified zoom level 
-                  // save this information as properties of the serverExtent,
-                  // perhaps as a bounds object so that it can be easily used
-                  // later by the layer control to determine when to enable
-                  // disable the layer for drawing.
-                } else {
-                  console.log('input with name='+varName+' not found for template variable of same name');
-                  // no match found, template won't be used
-                  break;
-                }
-              }
-              if (template && vcount.length === inputs.length || template === BLANK_TT_TREF) {
-                if (trel === 'query') {
-                  layer.queryable = true;
-                }
-                if(!includesZoom && zoomInput) {
-                  inputs.push(zoomInput);
-                }
-                // template has a matching input for every variable reference {varref}
-                templateVars.push({
-                  template:decodeURI(new URL(template, base)), 
-                  linkEl: t,
-                  title:title, 
-                  rel: trel, 
-                  type: ttype, 
-                  values: inputs, 
-                  zoomBounds:zoomBounds, 
-                  projectionMatch: projectionMatch,
-                  projection:serverExtent.getAttribute("units") || FALLBACK_PROJECTION,
-                  tms:tms,
-                });
-              }
-            }
-            return templateVars;
-          }
-
-          function _processInitialExtent(content) {
-            //TODO: include inline extents
-              var mapml = this.responseXML || content;
-              if(mapml.querySelector && mapml.querySelector('map-feature'))layer._content = mapml;
-              if(!this.responseXML && this.responseText) mapml = new DOMParser().parseFromString(this.responseText,'text/xml');
-              if (this.readyState === this.DONE && mapml.querySelector && !mapml.querySelector("parsererror")) {
-                  var serverExtent = mapml.querySelectorAll('map-extent'), projection, projectionMatch, serverMeta;
-                      
-                  
-                  if(!serverExtent.length){
-                    serverMeta = mapml.querySelector('map-meta[name=projection]');
-                  }
-
-                  // check whether all map-extent elements have the same units
-                  if(serverExtent.length >= 1){
-                    for(let i = 0; i < serverExtent.length; i++){
-                      if (serverExtent[i].tagName.toLowerCase() === "map-extent" && serverExtent[i].hasAttribute('units')){
-                        projection = serverExtent[i].getAttribute("units");
-                      }
-                      projectionMatch = projection && projection === layer.options.mapprojection;
-                      if(!projectionMatch){
-                        break;
-                      }
-                    }
-                  } else if(serverMeta){
-                    if (serverMeta.tagName.toLowerCase() === "map-meta" && serverMeta.hasAttribute('content')) {
-                      projection = M.metaContentToObject(serverMeta.getAttribute('content')).content;
-                      projectionMatch = projection && projection === layer.options.mapprojection;
-                    }
-                  }  
-                  
-                  var metaExtent = mapml.querySelector('map-meta[name=extent]'),
-                      selectedAlternate = !projectionMatch && mapml.querySelector('map-head map-link[rel=alternate][projection='+layer.options.mapprojection+']'),
-                      
-                      base = 
-        (new URL(mapml.querySelector('map-base') ? mapml.querySelector('map-base').getAttribute('href') : mapml.baseURI || this.responseURL, this.responseURL)).href;
-                  
-                  if (!serverExtent.length && !serverMeta) {
-                      serverExtent = layer._synthesizeExtent(mapml);
-                      // the mapml resource does not have a (complete) extent form, save
-                      // its content if any so we don't have to revisit the server, ever.
-                      if (mapml.querySelector('map-feature,map-tile')) {
-                          layer._content = mapml;
-                      }
-                  } else if (!projectionMatch && selectedAlternate && selectedAlternate.hasAttribute('href')) {
-                       
-                      layer.fire('changeprojection', {href:  (new URL(selectedAlternate.getAttribute('href'), base)).href}, false);
-                      return;
-                  } else if (!projectionMatch && layer._map && layer._map.options.mapEl.querySelectorAll("layer-").length === 1){
-                    layer._map.options.mapEl.projection = projection;
-                    return;
-                  } else if (!serverMeta){
-                    layer._extent = {};
-                    if(projectionMatch){
-                      layer._extent.crs = M[projection];
-                    }
-                    layer._extent._mapExtents = []; // stores all the map-extent elements in the layer
-                    layer._extent._templateVars = []; // stores all template variables coming from all extents
-                    for(let j = 0; j < serverExtent.length; j++){
-                      if (serverExtent[j].querySelector('map-link[rel=tile],map-link[rel=image],map-link[rel=features],map-link[rel=query]') &&
-                          serverExtent[j].hasAttribute("units")) {
-                            layer._extent._mapExtents.push(serverExtent[j]);
-                            projectionMatch = projectionMatch || selectedAlternate;
-                            let templateVars = _initTemplateVars.call(layer, serverExtent[j], metaExtent, projection, mapml, base, projectionMatch);
-                            layer._extent._mapExtents[j]._templateVars = templateVars;
-                            layer._extent._templateVars = layer._extent._templateVars.concat(templateVars);
-                          } 
-                        }     
-                  } else {
-                    layer._extent = serverMeta;
-                  }  
-                  layer._parseLicenseAndLegend(mapml, layer, projection);
-
-                  var zoomin = mapml.querySelector('map-link[rel=zoomin]'),
-                      zoomout = mapml.querySelector('map-link[rel=zoomout]');
-                  delete layer._extent.zoomin;
-                  delete layer._extent.zoomout;
-                  if (zoomin) {
-                    layer._extent.zoomin = (new URL(zoomin.getAttribute('href'), base)).href;
-                  }
-                  if (zoomout) {
-                    layer._extent.zoomout = (new URL(zoomout.getAttribute('href'), base)).href;
-                  }
-                  if (layer._extent._mapExtents) {
-                    for(let i = 0; i < layer._extent._mapExtents.length; i++){
-                      if(layer._extent._mapExtents[i].templatedLayer){
-                        layer._extent._mapExtents[i].templatedLayer.reset(layer._extent._mapExtents[i]._templateVars);
-                      }
-                    }
-                    
-                  }
-                  if (mapml.querySelector('map-tile')) {
-                    var tiles = document.createElement("map-tiles"),
-                      zoom = mapml.querySelector('map-meta[name=zoom][content]') || mapml.querySelector('map-input[type=zoom][value]');
-                    tiles.setAttribute("zoom", zoom && zoom.getAttribute('content') || zoom && zoom.getAttribute('value') || "0");
-                    var newTiles = mapml.getElementsByTagName('map-tile');
-                    for (var nt=0;nt<newTiles.length;nt++) {
-                        tiles.appendChild(document.importNode(newTiles[nt], true));
-                    }
-                    layer._mapmlTileContainer.appendChild(tiles);
-                  }
-                  M.parseStylesheetAsHTML(mapml, base, layer._container);
-
-                  // add multiple extents
-                  if(layer._extent._mapExtents){
-                    for(let j = 0; j < layer._extent._mapExtents.length; j++){
-                      var labelName = layer._extent._mapExtents[j].getAttribute('label');
-                      if(!labelName) labelName = layer._layerEl.getAttribute('label') + " Extent"; // temporariyl have the extent lableled by label name
-                      var extentElement = layer.getLayerExtentHTML(labelName, j);
-                      layer._extent._mapExtents[j].extentAnatomy = extentElement;
-                    }
-                  }
-
-                  var styleLinks = mapml.querySelectorAll('map-link[rel=style],map-link[rel="self style"],map-link[rel="style self"]');
-                  if (styleLinks.length > 1) {
-                    var stylesControl = document.createElement('details'),
-                    stylesControlSummary = document.createElement('summary');
-                    stylesControlSummary.innerText = 'Style';
-                    stylesControl.appendChild(stylesControlSummary);
-                    var changeStyle = function (e) {
-                        layer.fire('changestyle', {src: e.target.getAttribute("data-href")}, false);
-                    };
-
-                    for (var j=0;j<styleLinks.length;j++) {
-                      var styleOption = document.createElement('div'),
-                      styleOptionInput = styleOption.appendChild(document.createElement('input'));
-                      styleOptionInput.setAttribute("type", "radio");
-                      styleOptionInput.setAttribute("id", "rad-"+L.stamp(styleOptionInput));
-                      styleOptionInput.setAttribute("name", "styles-"+this._title);
-                      styleOptionInput.setAttribute("value", styleLinks[j].getAttribute('title'));
-                      styleOptionInput.setAttribute("data-href", new URL(styleLinks[j].getAttribute('href'),base).href);
-                      var styleOptionLabel = styleOption.appendChild(document.createElement('label'));
-                      styleOptionLabel.setAttribute("for", "rad-"+L.stamp(styleOptionInput));
-                      styleOptionLabel.innerText = styleLinks[j].getAttribute('title');
-                      if (styleLinks[j].getAttribute("rel") === "style self" || styleLinks[j].getAttribute("rel") === "self style") {
-                        styleOptionInput.checked = true;
-                      }
-                      stylesControl.appendChild(styleOption);
-                      L.DomUtil.addClass(stylesControl,'mapml-layer-item-style mapml-control-layers');
-                      L.DomEvent.on(styleOptionInput,'click', changeStyle, layer);
-                    }
-                    layer._styles = stylesControl;
-                  }
-                  
-                  if (mapml.querySelector('map-title')) {
-                    layer._title = mapml.querySelector('map-title').textContent.trim();
-                  } else if (mapml instanceof Element && mapml.hasAttribute('label')) {
-                    layer._title = mapml.getAttribute('label').trim();
-                  }
-                  if (layer._map) {
-                      layer._validateExtent();
-                      // if the layer is checked in the layer control, force the addition
-                      // of the attribution just received
-                      if (layer._map.hasLayer(layer)) {
-                          layer._map.attributionControl.addAttribution(layer.getAttribution());
-                      }
-                      //layer._map.fire('moveend', layer);
-                  }
-              } else {
-                  layer.error = true;
-              }
-              layer.fire('extentload', layer, false);
-              layer._layerEl.dispatchEvent(new CustomEvent('extentload', {detail: layer,}));
-          }
-      },
-      _createExtent: function () {
-      
-          var extent = document.createElement('map-extent'),
-              xminInput = document.createElement('map-input'),
-              yminInput = document.createElement('map-input'),
-              xmaxInput = document.createElement('map-input'),
-              ymaxInput = document.createElement('map-input'),
-              zoom = document.createElement('map-input'),
-              projection = document.createElement('map-input');
-      
-          zoom.setAttribute('type','zoom');
-          zoom.setAttribute('min','0');
-          zoom.setAttribute('max','0');
-          
-          xminInput.setAttribute('type','xmin');
-          xminInput.setAttribute('min','');
-          xminInput.setAttribute('max','');
-          
-          yminInput.setAttribute('type','ymin');
-          yminInput.setAttribute('min','');
-          yminInput.setAttribute('max','');
-          
-          xmaxInput.setAttribute('type','xmax');
-          xmaxInput.setAttribute('min','');
-          xmaxInput.setAttribute('max','');
-
-          ymaxInput.setAttribute('type','ymax');
-          ymaxInput.setAttribute('min','');
-          ymaxInput.setAttribute('max','');
-          
-          projection.setAttribute('type','projection');
-          projection.setAttribute('value','WGS84');
-          
-          extent.appendChild(xminInput);
-          extent.appendChild(yminInput);
-          extent.appendChild(xmaxInput);
-          extent.appendChild(ymaxInput);
-          extent.appendChild(zoom);
-          extent.appendChild(projection);
-
-          return extent;
-      },
-      _validateExtent: function () {
-        // TODO: change so that the _extent bounds are set based on inputs
-        if(!this._extent || !this._map){
-          return;
-        }
-        var serverExtent = this._extent._mapExtents ? this._extent._mapExtents : [this._extent], lp;
-          
-          // loop through the map-extent elements and assign each one its crs
-          for(let i = 0; i < serverExtent.length; i++){
-            if (!serverExtent[i].querySelector) {
-              return;
-            }
-          if (serverExtent[i].querySelector('[type=zoom][min=""], [type=zoom][max=""]')) {
-              var zoom = serverExtent[i].querySelector('[type=zoom]');
-              zoom.setAttribute('min',this._map.getMinZoom());
-              zoom.setAttribute('max',this._map.getMaxZoom());
-          }
-            lp = serverExtent[i].hasAttribute("units") ? serverExtent[i].getAttribute("units") : null;
-            if (lp && M[lp]) {
-              if(this._extent._mapExtents) this._extent._mapExtents[i].crs = M[lp];
-              else this._extent.crs = M[lp];
-            } else {
-              if(this._extent._mapExtents) this._extent._mapExtents[i].crs = M.OSMTILE;
-              else this._extent.crs = M.OSMTILE;
-            }
-          }
-      },
-      _getMapMLExtent: function (bounds, zooms, proj) {
-          
-          var extent = this._createExtent(),
-              zoom = extent.querySelector('map-input[type=zoom]'),
-              xminInput = extent.querySelector('map-input[type=xmin]'),
-              yminInput = extent.querySelector('map-input[type=ymin]'),
-              xmaxInput = extent.querySelector('map-input[type=xmax]'),
-              ymaxInput = extent.querySelector('map-input[type=ymax]'),
-              projection = extent.querySelector('map-input[type=projection]'),
-              zmin = zooms[0] !== undefined && zooms[1] !== undefined ? Math.min(zooms[0],zooms[1]) : '',
-              zmax = zooms[0] !== undefined && zooms[1] !== undefined ? Math.max(zooms[0],zooms[1]) : '',
-              xmin = bounds ? bounds._southWest ? bounds.getWest() : bounds.getBottomLeft().x : '',
-              ymin = bounds ? bounds._southWest ? bounds.getSouth() : bounds.getTopRight().y : '',
-              xmax = bounds ? bounds._southWest ? bounds.getEast() : bounds.getTopRight().x : '',
-              ymax = bounds ? bounds._southWest ? bounds.getNorth() : bounds.getBottomLeft().y : '';
-      
-          zoom.setAttribute('min', typeof(zmin) === 'number' && isNaN(zmin)? '' : zmin);
-          zoom.setAttribute('max', typeof(zmax) === 'number' && isNaN(zmax)? '' : zmax);
-          
-          xminInput.setAttribute('min',xmin);
-          xminInput.setAttribute('max',xmax);
-          
-          yminInput.setAttribute('min',ymin);
-          yminInput.setAttribute('max',ymax);
-          
-          xmaxInput.setAttribute('min',xmin);
-          xmaxInput.setAttribute('max',xmax);
-
-          ymaxInput.setAttribute('min',ymin);
-          ymaxInput.setAttribute('max',ymax);
-          
-          projection.setAttribute('value',bounds && bounds._southWest && !proj ? 'WGS84' : proj);
-
-          return extent;
-      },
-      _synthesizeExtent: function (mapml) {
-          var metaZoom = mapml.querySelectorAll('map-meta[name=zoom]')[0],
-              metaExtent = mapml.querySelector('map-meta[name=extent]'),
-              metaProjection = mapml.querySelector('map-meta[name=projection]'),
-              proj = metaProjection ? metaProjection.getAttribute('content'): FALLBACK_PROJECTION,
-              i,expressions,bounds,zmin,zmax,xmin,ymin,xmax,ymax,expr,lhs,rhs;
-          if (metaZoom) {
-              expressions = metaZoom.getAttribute('content').split(',');
-              for (i=0;i<expressions.length;i++) {
-                expr = expressions[i].split('=');
-                lhs = expr[0];
-                rhs=expr[1];
-                if (lhs === 'min') {
-                  zmin = parseInt(rhs);
-                }
-                if (lhs === 'max') {
-                  zmax = parseInt(rhs);
-                }
-              }
-          }  
-          if (metaExtent) {
-              expressions = metaExtent.getAttribute('content').split(',');
-              for (i=0;i<expressions.length;i++) {
-                expr = expressions[i].split('=');
-                lhs = expr[0];
-                rhs=expr[1];
-                if (lhs === 'xmin') {
-                  xmin = parseFloat(rhs);
-                }
-                if (lhs === 'xmax') {
-                  xmax = parseFloat(rhs);
-                }
-                if (lhs === 'ymin') {
-                  ymin = parseFloat(rhs);
-                }
-                if (lhs === 'ymax') {
-                  ymax = parseFloat(rhs);
-                }
-              }
-          }
-          if (xmin && ymin && xmax && ymax && proj === 'WGS84') {
-              var sw = L.latLng(ymin,xmin), ne = L.latLng(ymax,xmax);
-              bounds = L.latLngBounds(sw,ne);
-          } else if (xmin && ymin && xmax && ymax) {
-              // needs testing
-              bounds = L.bounds([[xmin,ymin],[xmax,ymax]]);
-          }
-          return this._getMapMLExtent(bounds, [zmin,zmax], proj);
-      },
-      // a layer must share a projection with the map so that all the layers can
-      // be overlayed in one coordinate space.  WGS84 is a 'wildcard', sort of.
-      getProjection: function () {
-        let extent = this._extent._mapExtents ? this._extent._mapExtents[0] : this._extent; // the projections for each extent eould be the same (as) validated in _validProjection, so can use mapExtents[0]
-        if(!extent) return FALLBACK_PROJECTION;
-        switch (extent.tagName.toUpperCase()) {
-          case "MAP-EXTENT":
-            if(extent.hasAttribute('units'))
-              return extent.getAttribute('units').toUpperCase();
-            break;
-          case "MAP-INPUT":
-            if(extent.hasAttribute('value'))
-              return extent.getAttribute('value').toUpperCase();
-            break;
-          case "MAP-META":
-            if(extent.hasAttribute('content'))
-              return M.metaContentToObject(extent.getAttribute('content')).content.toUpperCase(); 
-            break;
-          default:
-            return FALLBACK_PROJECTION; 
-        }
-        return FALLBACK_PROJECTION;
-      },
-      _parseLicenseAndLegend: function (xml, layer) {
-          var licenseLink =  xml.querySelector('map-link[rel=license]'), licenseTitle, licenseUrl, attText;
-          if (licenseLink) {
-              licenseTitle = licenseLink.getAttribute('title');
-              licenseUrl = licenseLink.getAttribute('href');
-              attText = '<a href="' + licenseUrl + '" title="'+licenseTitle+'">'+licenseTitle+'</a>';
-          }
-          L.setOptions(layer,{attribution:attText});
-          var legendLink = xml.querySelector('map-link[rel=legend]');
-          if (legendLink) {
-            layer._legendUrl = legendLink.getAttribute('href');
-          }
-      },
-      // return the LatLngBounds of the map unprojected such that the whole
-      // map is covered, not just a band defined by the projected map bounds.
-      _getUnprojectedMapLatLngBounds: function(map) {
-        
-          map = map||this._map; 
-          var origin = map.getPixelOrigin(),
-            bounds = map.getPixelBounds(),
-            nw = map.unproject(origin),
-            sw = map.unproject(bounds.getBottomLeft()),
-            ne = map.unproject(bounds.getTopRight()),
-            se = map.unproject(origin.add(map.getSize()));
-          return L.latLngBounds(sw,ne).extend(se).extend(nw);
-      },
-      // this takes into account that WGS84 is considered a wildcard match.
-      _projectionMatches: function(map) {
-          map = map||this._map;
-          var projection = this.getProjection();
-          if (!map.options.projection || projection !== 'WGS84' && map.options.projection !== projection) return false;
-          return true;
-      },
-      getQueryTemplates: function(pcrsClick) {
-          if (this._extent && this._extent._queries) {
-            var templates = [];
-            // only return queries that are in bound
-            for(let i = 0; i < this._extent._queries.length; i++){
-              if(this._extent._queries[i].extentBounds.contains(pcrsClick)){
-                templates.push(this._extent._queries[i]);
-              }
-            }
-            return templates;
-          }
-      },
-      _attachSkipButtons: function(e){
-        let popup = e.popup, map = e.target, layer, group,
-            content = popup._container.getElementsByClassName("mapml-popup-content")[0];
-
-        popup._container.setAttribute("role", "dialog");
-        content.setAttribute("tabindex", "-1");
-        // https://github.com/Maps4HTML/Web-Map-Custom-Element/pull/467#issuecomment-844307818
-        content.setAttribute("role", "document");
-        popup._count = 0; // used for feature pagination
-
-        if(popup._source._eventParents){ // check if the popup is for a feature or query
-          layer = popup._source._eventParents[Object.keys(popup._source._eventParents)[0]]; // get first parent of feature, there should only be one
-          group = popup._source.group;
-        } else {
-          layer = popup._source._templatedLayer;
-        }
-
-        if(popup._container.querySelector('nav[class="mapml-focus-buttons"]')){
-          L.DomUtil.remove(popup._container.querySelector('nav[class="mapml-focus-buttons"]'));
-          L.DomUtil.remove(popup._container.querySelector('hr'));
-        }
-        //add when popopen event happens instead
-        let div = L.DomUtil.create("nav", "mapml-focus-buttons");
-
-        // creates |< button, focuses map
-        let mapFocusButton = L.DomUtil.create("button", "mapml-popup-button", div);
-        mapFocusButton.type = "button";
-        mapFocusButton.title = "Focus Map";
-        mapFocusButton.innerHTML = "<span aria-hidden='true'>|&#10094;</span>";
-        L.DomEvent.on(mapFocusButton, 'click', (e)=>{
-          L.DomEvent.stop(e);
-          map.featureIndex._sortIndex();
-          map.closePopup();
-          map._container.focus();
-        }, popup);
-
-        // creates < button, focuses previous feature, if none exists focuses the current feature
-        let previousButton = L.DomUtil.create("button", "mapml-popup-button", div);
-        previousButton.type = "button";
-        previousButton.title = "Previous Feature";
-        previousButton.innerHTML = "<span aria-hidden='true'>&#10094;</span>";
-        L.DomEvent.on(previousButton, 'click', layer._previousFeature, popup);
-
-        // static feature counter that 1/1
-        let featureCount = L.DomUtil.create("p", "mapml-feature-count", div),
-            totalFeatures = this._totalFeatureCount ? this._totalFeatureCount : 1;
-        featureCount.innerText = (popup._count + 1)+"/"+totalFeatures;
-
-        // creates > button, focuses next feature, if none exists focuses the current feature
-        let nextButton = L.DomUtil.create("button", "mapml-popup-button", div);
-        nextButton.type = "button";
-        nextButton.title = "Next Feature";
-        nextButton.innerHTML = "<span aria-hidden='true'>&#10095;</span>";
-        L.DomEvent.on(nextButton, 'click', layer._nextFeature, popup);
-        
-        // creates >| button, focuses map controls
-        let controlFocusButton = L.DomUtil.create("button", "mapml-popup-button", div);
-        controlFocusButton.type = "button";
-        controlFocusButton.title = "Focus Controls";
-        controlFocusButton.innerHTML = "<span aria-hidden='true'>&#10095;|</span>";
-        L.DomEvent.on(controlFocusButton, 'click', (e) => {
-          map.featureIndex._sortIndex();
-          map.featureIndex.currentIndex = map.featureIndex.inBoundFeatures.length - 1;
-          map.featureIndex.inBoundFeatures[0].path.setAttribute("tabindex", -1);
-          map.featureIndex.inBoundFeatures[map.featureIndex.currentIndex].path.setAttribute("tabindex", 0);
-          L.DomEvent.stop(e);
-          map.closePopup();
-          map._controlContainer.querySelector("A").focus();
-        }, popup);
-    
-        let divider = L.DomUtil.create("hr");
-
-        popup._navigationBar = div;
-        popup._content.appendChild(divider);
-        popup._content.appendChild(div);
-        
-        content.focus();
-
-        if(group) {
-          // e.target = this._map
-          // Looks for keydown, more specifically tab and shift tab
-          group.setAttribute("aria-expanded", "true");
-          map.on("keydown", focusFeature);
-        } else {
-          map.on("keydown", focusMap);
-        }
-        // When popup is open, what gets focused with tab needs to be done using JS as the DOM order is not in an accessibility friendly manner
-        function focusFeature(focusEvent){
-          let path = focusEvent.originalEvent.path || focusEvent.originalEvent.composedPath();
-          let isTab = focusEvent.originalEvent.keyCode === 9,
-              shiftPressed = focusEvent.originalEvent.shiftKey;
-          if((path[0].classList.contains("leaflet-popup-close-button") && isTab && !shiftPressed) || focusEvent.originalEvent.keyCode === 27){
-            setTimeout(() => {
-              L.DomEvent.stop(focusEvent);
-              map.closePopup(popup);
-              group.focus();
-            }, 0);
-          } else if ((path[0].title==="Focus Map" || path[0].classList.contains("mapml-popup-content")) && isTab && shiftPressed){
-            setTimeout(() => { //timeout needed so focus of the feature is done even after the keypressup event occurs
-              L.DomEvent.stop(focusEvent);
-              map.closePopup(popup);
-              group.focus();
-            }, 0);
-          }
-        }
-
-        function focusMap(focusEvent){
-          let path = focusEvent.originalEvent.path || focusEvent.originalEvent.composedPath();
-          let isTab = focusEvent.originalEvent.keyCode === 9,
-          shiftPressed = focusEvent.originalEvent.shiftKey;
-
-          if((focusEvent.originalEvent.keyCode === 13 && path[0].classList.contains("leaflet-popup-close-button")) || focusEvent.originalEvent.keyCode === 27 ){
-            L.DomEvent.stopPropagation(focusEvent);
-            map._container.focus();
-            map.closePopup(popup);
-            if(focusEvent.originalEvent.keyCode !== 27)map._popupClosed = true;
-          } else if (isTab && path[0].classList.contains("leaflet-popup-close-button")){
-            map.closePopup(popup);
-          } else if ((path[0].title==="Focus Map" || path[0].classList.contains("mapml-popup-content")) && isTab && shiftPressed){
-            setTimeout(() => { //timeout needed so focus of the feature is done even after the keypressup event occurs
-              L.DomEvent.stop(focusEvent);
-              map.closePopup(popup);
-              map._container.focus();
-            }, 0);
-          }
-        }
-
-        // if popup closes then the focusFeature handler can be removed
-        map.on("popupclose", removeHandlers);
-        function removeHandlers(removeEvent){
-          if (removeEvent.popup === popup){
-            map.off("keydown", focusFeature);
-            map.off("keydown", focusMap);
-            map.off('popupclose', removeHandlers);
-            if(group) group.setAttribute("aria-expanded", "false");
-          }
-        }
-      },
-  });
-  var mapMLLayer = function (url, node, options) {
-    if (!url && !node) return null;
-  	return new MapMLLayer(url, node, options);
-  };
-
-  var DebugOverlay = L.Layer.extend({
-
-    onAdd: function (map) {
-
-      let mapSize = map.getSize();
-
-      //conditionally show container for debug panel/banner only when the map has enough space for it
-      if (mapSize.x > 400 || mapSize.y > 300) {
-        this._container = L.DomUtil.create("table", "mapml-debug", map._container);
-
-        this._panel = debugPanel({
-          className: "mapml-debug-panel",
-          pane: this._container,
-        });
-        map.addLayer(this._panel);
-
-      }
-
-      this._grid = debugGrid({
-        className: "mapml-debug-grid",
-        pane: map._panes.mapPane,
-        zIndex: 400,
-        tileSize: map.options.crs.options.crs.tile.bounds.max.x,
-      });
-      map.addLayer(this._grid);
-
-      this._vectors = debugVectors({
-        className: "mapml-debug-vectors",
-        pane: map._panes.mapPane,
-        toolPane: this._container,
-      });
-      map.addLayer(this._vectors);
-    },
-
-    onRemove: function (map) {
-      map.removeLayer(this._grid);
-      map.removeLayer(this._vectors);
-      if (this._panel) {  //conditionally remove the panel, as it's not always added
-        map.removeLayer(this._panel);
-        L.DomUtil.remove(this._container);
-      }
-    },
-
-  });
-
-  var debugOverlay = function () {
-    return new DebugOverlay();
-  };
-
-  var DebugPanel = L.Layer.extend({
-
-    initialize: function (options) {
-      L.setOptions(this, options);
-    },
-
-    onAdd: function (map) {
-
-      this._title = L.DomUtil.create("caption", "mapml-debug-banner", this.options.pane);
-      this._title.innerHTML = "Debug mode";
-
-      map.debug = {};
-      map.debug._infoContainer = this._debugContainer = L.DomUtil.create("tbody", "mapml-debug-panel", this.options.pane);
-
-      let infoContainer = map.debug._infoContainer;
-
-      map.debug._tileCoord = L.DomUtil.create("tr", "mapml-debug-coordinates", infoContainer);
-      map.debug._tileMatrixCoord = L.DomUtil.create("tr", "mapml-debug-coordinates", infoContainer);
-      map.debug._mapCoord = L.DomUtil.create("tr", "mapml-debug-coordinates", infoContainer);
-      map.debug._tcrsCoord = L.DomUtil.create("tr", "mapml-debug-coordinates", infoContainer);
-      map.debug._pcrsCoord = L.DomUtil.create("tr", "mapml-debug-coordinates", infoContainer);
-      map.debug._gcrsCoord = L.DomUtil.create("tr", "mapml-debug-coordinates", infoContainer);
-
-      this._map.on("mousemove", this._updateCoords);
-
-    },
-    onRemove: function () {
-      L.DomUtil.remove(this._title);
-      if (this._debugContainer) {
-        L.DomUtil.remove(this._debugContainer);
-        this._map.off("mousemove", this._updateCoords);
-      }
-    },
-    _updateCoords: function (e) {
-      if (this.contextMenu._visible) return;
-      let mapEl = this.options.mapEl,
-        point = mapEl._map.project(e.latlng),
-        scale = mapEl._map.options.crs.scale(+mapEl.zoom),
-        pcrs = mapEl._map.options.crs.transformation.untransform(point, scale),
-        tileSize = mapEl._map.options.crs.options.crs.tile.bounds.max.x,
-        pointI = point.x % tileSize, pointJ = point.y % tileSize;
-
-      if (pointI < 0) pointI += tileSize;
-      if (pointJ < 0) pointJ += tileSize;
-
-      this.debug._tileCoord.innerHTML = `
-      <th scope="row">tile: </th>
-      <td>i: ${Math.trunc(pointI)}, </td>
-      <td>j: ${Math.trunc(pointJ)}</td>
-      `;
-      this.debug._mapCoord.innerHTML = `
-      <th scope="row">map: </th>
-      <td>i: ${Math.trunc(e.containerPoint.x)}, </td>
-      <td>j: ${Math.trunc(e.containerPoint.y)}</td>
-      `;
-      this.debug._gcrsCoord.innerHTML = `
-      <th scope="row">gcrs: </th>
-      <td>lon: ${e.latlng.lng.toFixed(6)}, </td>
-      <td>lat: ${e.latlng.lat.toFixed(6)}</td>
-      `;
-      this.debug._tcrsCoord.innerHTML = `
-      <th scope="row">tcrs: </th>
-      <td>x: ${Math.trunc(point.x)}, </td>
-      <td>y: ${Math.trunc(point.y)}</td>
-      `;
-      this.debug._tileMatrixCoord.innerHTML = `
-      <th scope="row">tilematrix: </th>
-      <td>column: ${Math.trunc(point.x / tileSize)}, </td>
-      <td>row: ${Math.trunc(point.y / tileSize)}</td>
-      `;
-      this.debug._pcrsCoord.innerHTML = `
-      <th scope="row">pcrs: </th>
-      <td>easting: ${pcrs.x.toFixed(2)}, </td>
-      <td>northing: ${pcrs.y.toFixed(2)}</td>
-      `;
-    },
-
-  });
-
-  var debugPanel = function (options) {
-    return new DebugPanel(options);
-  };
-
-  var DebugGrid = L.GridLayer.extend({
-
-    initialize: function (options) {
-      L.setOptions(this, options);
-      L.GridLayer.prototype.initialize.call(this, this._map);
-    },
-
-    createTile: function (coords) {
-      let tile = L.DomUtil.create("div", "mapml-debug-tile");
-      tile.setAttribute("col", coords.x);
-      tile.setAttribute("row", coords.y);
-      tile.setAttribute("zoom", coords.z);
-      tile.innerHTML = [`col: ${coords.x}`, `row: ${coords.y}`, `zoom: ${coords.z}`].join(', ');
-
-      tile.style.outline = '1px dashed red';
-      return tile;
-    },
-  });
-
-  var debugGrid = function (options) {
-    return new DebugGrid(options);
-  };
-
-  var DebugVectors = L.LayerGroup.extend({
-    initialize: function (options) {
-      L.setOptions(this, options);
-      L.LayerGroup.prototype.initialize.call(this, this._map, options);
-    },
-    onAdd: function (map) {
-      map.on('overlayremove', this._mapLayerUpdate, this);
-      map.on('overlayadd', this._mapLayerUpdate, this);
-      let center = map.options.crs.transformation.transform(L.point(0, 0), map.options.crs.scale(0));
-      this._centerVector = L.circle(map.options.crs.pointToLatLng(center, 0), { radius: 250 });
-      this._centerVector.bindTooltip("Projection Center");
-
-      this._addBounds(map);
-    },
-    onRemove: function (map) {
-      this.clearLayers();
-    },
-
-    _addBounds: function (map) {
-      let id = Object.keys(map._layers),
-        layers = map._layers,
-        colors = ["#FF5733", "#8DFF33", "#3397FF", "#E433FF", "#F3FF33"],
-        j = 0;
-
-      this.addLayer(this._centerVector);
-
-      for (let i of id) {
-        if (layers[i].layerBounds || layers[i].extentBounds) {
-          let boundsArray;
-          if(layers[i].layerBounds){
-            boundsArray = [
-              layers[i].layerBounds.min,
-              L.point(layers[i].layerBounds.max.x, layers[i].layerBounds.min.y),
-              layers[i].layerBounds.max,
-              L.point(layers[i].layerBounds.min.x, layers[i].layerBounds.max.y)
-            ];
-          } else {
-            boundsArray = [
-              layers[i].extentBounds.min,
-              L.point(layers[i].extentBounds.max.x, layers[i].extentBounds.min.y),
-              layers[i].extentBounds.max,
-              L.point(layers[i].extentBounds.min.x, layers[i].extentBounds.max.y)
-            ];
-          }        
-          let boundsRect = projectedExtent(boundsArray, {
-            color: colors[j % colors.length],
-            weight: 2,
-            opacity: 1,
-            fillOpacity: 0.01,
-            fill: true,
-          });
-          if (layers[i].options._leafletLayer)
-            boundsRect.bindTooltip(layers[i].options._leafletLayer._title, { sticky: true });
-          this.addLayer(boundsRect);
-          j++;
-        }
-      }
-
-      if(map.totalLayerBounds){
-        let totalBoundsArray = [
-          map.totalLayerBounds.min,
-          L.point(map.totalLayerBounds.max.x, map.totalLayerBounds.min.y),
-          map.totalLayerBounds.max,
-          L.point(map.totalLayerBounds.min.x, map.totalLayerBounds.max.y)
-        ];
-
-        let totalBounds = projectedExtent(
-            totalBoundsArray,
-            {color: "#808080", weight: 5, opacity: 0.5, fill: false});
-        this.addLayer(totalBounds);
-      }
-    },
-
-    _mapLayerUpdate: function (e) {
-      this.clearLayers();
-      this._addBounds(e.target);
-    },
-  });
-
-  var debugVectors = function (options) {
-    return new DebugVectors(options);
-  };
-
-
-  var ProjectedExtent = L.Path.extend({
-    options: {
-      className: "mapml-debug-extent",
-    },
-    initialize: function (locations, options) {
-      //locations passed in as pcrs coordinates
-      this._locations = locations;
-      L.setOptions(this, options);
-    },
-
-    _project: function () {
-      this._rings = [];
-      let scale = this._map.options.crs.scale(this._map.getZoom()),
-        map = this._map;
-      for (let i = 0; i < this._locations.length; i++) {
-        let point = map.options.crs.transformation.transform(this._locations[i], scale);
-        //substract the pixel origin from the pixel coordinates to get the location relative to map viewport
-        this._rings.push(L.point(point.x, point.y)._subtract(map.getPixelOrigin()));
-      }
-      //leaflet SVG renderer looks for and array of arrays to build polygons,
-      //in this case it only deals with a rectangle so one closed array or points
-      this._parts = [this._rings];
-    },
-
-    _update: function () {
-      if (!this._map) return;
-      this._renderer._updatePoly(this, true); //passing true creates a closed path i.e. a rectangle
-    },
-
-  });
-
-  var projectedExtent = function (locations, options) {
-    return new ProjectedExtent(locations, options);
-  };
-
-  var QueryHandler = L.Handler.extend({
-      addHooks: function() {
-          // get a reference to the actual <map> element, so we can 
-          // use its layers property to iterate the layers from top down
-          // evaluating if they are 'on the map' (enabled)
-          L.setOptions(this, {mapEl: this._map.options.mapEl});
-          L.DomEvent.on(this._map, 'click', this._queryTopLayer, this);
-          L.DomEvent.on(this._map, 'keypress', this._queryTopLayerAtMapCenter, this);
-      },
-      removeHooks: function() {
-          L.DomEvent.off(this._map, 'click', this._queryTopLayer, this);
-          L.DomEvent.on(this._map, 'keypress', this._queryTopLayerAtMapCenter, this);
-      },
-      _getTopQueryableLayer: function() {
-          var layers = this.options.mapEl.layers;
-          // work backwards in document order (top down)
-          for (var l=layers.length-1;l>=0;l--) {
-            var mapmlLayer = layers[l]._layer;
-            if (layers[l].checked && mapmlLayer.queryable) {
-                return mapmlLayer;
-            }
-          }
-      },
-      _queryTopLayerAtMapCenter: function (event) {
-        setTimeout(() => {
-          if (this._map.isFocused && !this._map._popupClosed && (event.originalEvent.key === " " || +event.originalEvent.keyCode === 13)) {
-            this._map.fire('click', { 
-                latlng: this._map.getCenter(),
-                layerPoint: this._map.latLngToLayerPoint(this._map.getCenter()),
-                containerPoint: this._map.latLngToContainerPoint(this._map.getCenter())
-            });
-          } else {
-            delete this._map._popupClosed;
-          }
-        }, 0);
-      },
-      _queryTopLayer: function(event) {
-          var layer = this._getTopQueryableLayer();
-          if (layer) {
-              if(layer._mapmlFeatures) delete layer._mapmlFeatures;
-              this._query(event, layer);
-          }
-      },
-      _query(e, layer) {
-        var zoom = e.target.getZoom(),
-            map = this._map,
-            crs = layer._extent.crs, // the crs for each extent would be the same
-            tileSize = map.options.crs.options.crs.tile.bounds.max.x,
-            container = layer._container,
-            popupOptions = {autoClose: false, autoPan: true, maxHeight: (map.getSize().y * 0.5) - 50},
-            tcrs2pcrs = function (c) {
-              return crs.transformation.untransform(c,crs.scale(zoom));
-            },
-            tcrs2gcrs = function (c) {
-              return crs.unproject(crs.transformation.untransform(c,crs.scale(zoom)),zoom);
-            };
-        var tcrsClickLoc = crs.latLngToPoint(e.latlng, zoom),
-            tileMatrixClickLoc = tcrsClickLoc.divideBy(tileSize).floor(),
-            tileBounds = new L.Bounds(tcrsClickLoc.divideBy(tileSize).floor().multiplyBy(tileSize), 
-            tcrsClickLoc.divideBy(tileSize).ceil().multiplyBy(tileSize));
-
-        let point = this._map.project(e.latlng),
-            scale = this._map.options.crs.scale(this._map.getZoom()),
-            pcrsClick = this._map.options.crs.transformation.untransform(point,scale),
-            contenttype;
-        var templates = layer.getQueryTemplates(pcrsClick);
-
-        var fetchFeatures = function(template, obj, lastOne) {
-          fetch(L.Util.template(template.template, obj), { redirect: 'follow' }).then((response) => {
-          contenttype = response.headers.get("Content-Type");
-          if (response.status >= 200 && response.status < 300) {
-            return response.text();
-          } else {
-            throw new Error(response.status);
-          }
-        }).then((mapml) => {
-          if (contenttype.startsWith("text/mapml")) {
-            //if(!this.mapml) this.mapml = "";
-            //this.mapml = this.mapml.concat(mapml);
-            if(!layer._mapmlFeatures) layer._mapmlFeatures = [];
-            let parser = new DOMParser(),
-                mapmldoc = parser.parseFromString(mapml, "application/xml"),
-                features = Array.prototype.slice.call(mapmldoc.querySelectorAll("map-feature"));
-                if(features.length) layer._mapmlFeatures = layer._mapmlFeatures.concat(features);
-                mapmldoc.features = layer._mapmlFeatures;
-            if(lastOne) return handleMapMLResponse(mapmldoc, e.latlng);
-          } else {
-            return handleOtherResponse(mapml, layer, e.latlng);
-          }
-        }).catch((err) => {
-          console.log('Looks like there was a problem. Status: ' + err.message);
-        });
-      };
-
-      for(let i = 0; i < templates.length; i++){
-
-        var obj = {},
-            template = templates[i];
-   
-        // all of the following are locations that might be used in a query, I think.
-        obj[template.query.tilei] = tcrsClickLoc.x.toFixed() - (tileMatrixClickLoc.x * tileSize);
-        obj[template.query.tilej] = tcrsClickLoc.y.toFixed() - (tileMatrixClickLoc.y * tileSize);
-        
-        // this forces the click to the centre of the map extent in the layer crs
-        obj[template.query.mapi] = (map.getSize().divideBy(2)).x.toFixed();
-        obj[template.query.mapj] = (map.getSize().divideBy(2)).y.toFixed();
-        
-        obj[template.query.pixelleft] = crs.pointToLatLng(tcrsClickLoc, zoom).lng;
-        obj[template.query.pixeltop] = crs.pointToLatLng(tcrsClickLoc, zoom).lat;
-        obj[template.query.pixelright] = crs.pointToLatLng(tcrsClickLoc.add([1,1]), zoom).lng;
-        obj[template.query.pixelbottom] = crs.pointToLatLng(tcrsClickLoc.add([1,1]), zoom).lat;
-        
-        obj[template.query.column] = tileMatrixClickLoc.x;
-        obj[template.query.row] = tileMatrixClickLoc.y;
-        obj[template.query.x] = tcrsClickLoc.x.toFixed();
-        obj[template.query.y] = tcrsClickLoc.y.toFixed();
-        
-        // whereas the layerPoint is calculated relative to the origin plus / minus any
-        // pan movements so is equal to containerPoint at first before any pans, but
-        // changes as the map pans. 
-        obj[template.query.easting] =  tcrs2pcrs(tcrsClickLoc).x;
-        obj[template.query.northing] = tcrs2pcrs(tcrsClickLoc).y;
-        obj[template.query.longitude] =  tcrs2gcrs(tcrsClickLoc).lng;
-        obj[template.query.latitude] = tcrs2gcrs(tcrsClickLoc).lat;
-        obj[template.query.zoom] = zoom;
-        obj[template.query.width] = map.getSize().x;
-        obj[template.query.height] = map.getSize().y;
-        // assumes the click is at the centre of the map, per template.query.mapi, mapj above
-        obj[template.query.mapbottom] = tcrs2pcrs(tcrsClickLoc.add(map.getSize().divideBy(2))).y;
-        obj[template.query.mapleft] = tcrs2pcrs(tcrsClickLoc.subtract(map.getSize().divideBy(2))).x;
-        obj[template.query.maptop] = tcrs2pcrs(tcrsClickLoc.subtract(map.getSize().divideBy(2))).y;
-        obj[template.query.mapright] = tcrs2pcrs(tcrsClickLoc.add(map.getSize().divideBy(2))).x;
-        
-        obj[template.query.tilebottom] = tcrs2pcrs(tileBounds.max).y;
-        obj[template.query.tileleft] = tcrs2pcrs(tileBounds.min).x;
-        obj[template.query.tiletop] = tcrs2pcrs(tileBounds.min).y;
-        obj[template.query.tileright] = tcrs2pcrs(tileBounds.max).x;
-        // add hidden or other variables that may be present into the values to
-        // be processed by L.Util.template below.
-        for (var v in template.query) {
-            if (["mapi","mapj","tilei","tilej","row","col","x","y","easting","northing","longitude","latitude","width","height","zoom","mapleft","mapright",",maptop","mapbottom","tileleft","tileright","tiletop","tilebottom","pixeltop","pixelbottom","pixelleft","pixelright"].indexOf(v) < 0) {
-                obj[v] = template.query[v];
-            }
-        }
-
-        if(template.extentBounds.contains(pcrsClick)){
-          let lastOne = (i === (templates.length - 1)) ? true: false;
-          fetchFeatures(template, obj, lastOne);
-        }
-      }
-        function handleMapMLResponse(mapmldoc, loc) {
-
-          for(let feature of mapmldoc.features){
-            if(!feature.querySelector('map-geometry')){
-              let geo = document.createElement('map-geometry'), point = document.createElement('map-point'),
-                coords = document.createElement('map-coordinates');
-              geo.setAttribute("cs", "gcrs");
-              coords.innerHTML = `${loc.lng} ${loc.lat}`;
-              point.appendChild(coords);
-              geo.appendChild(point);
-              feature.appendChild(geo);
-            }
-          }
-
-          let f = M.mapMlFeatures(mapmldoc, {
-              // pass the vector layer a renderer of its own, otherwise leaflet
-              // puts everything into the overlayPane
-              renderer: M.featureRenderer(),
-              // pass the vector layer the container for the parent into which
-              // it will append its own container for rendering into
-              pane: container,
-              //color: 'yellow',
-              // instead of unprojecting and then projecting and scaling,
-              // a much smarter approach would be to scale at the current
-              // zoom
-              projection: map.options.projection,
-              _leafletLayer: layer,
-              query: true,
-              static:true,
-          });
-          f.addTo(map);
-
-          let div = L.DomUtil.create("div", "mapml-popup-content"),
-              c = L.DomUtil.create("iframe");
-          c.style = "border: none";
-          c.srcdoc = mapmldoc.querySelector('map-feature map-properties').innerHTML;
-          c.setAttribute("sandbox","allow-same-origin allow-forms");
-          div.appendChild(c);
-          // passing a latlng to the popup is necessary for when there is no
-          // geometry / null geometry
-          layer._totalFeatureCount = mapmldoc.features.length;
-          layer.bindPopup(div, popupOptions).openPopup(loc);
-          layer.on('popupclose', function() {
-              map.removeLayer(f);
-          });
-          f.showPaginationFeature({i: 0, popup: layer._popup});
-
-        }
-        function handleOtherResponse(text, layer, loc) {
-          let div = L.DomUtil.create("div", "mapml-popup-content"),
-              c = L.DomUtil.create("iframe");
-          c.style = "border: none";
-          c.srcdoc = text;
-          c.setAttribute("sandbox","allow-same-origin allow-forms");
-          div.appendChild(c);
-          layer.bindPopup(div, popupOptions).openPopup(loc);
-        }
-      }
-  });
-
-  /*
-  MIT License related to portions of M.ContextMenu 
-  Copyright (c) 2017 adam.ratcliffe@gmail.com
-  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), 
-  to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 
-  and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-  */
-  var ContextMenu = L.Handler.extend({
-    _touchstart: L.Browser.msPointer ? 'MSPointerDown' : L.Browser.pointer ? 'pointerdown' : 'touchstart',
-
-    initialize: function (map) {
-      L.Handler.prototype.initialize.call(this, map);
-
-      //setting the items in the context menu and their callback functions
-      this._items = [
-        {
-          text: M.options.locale.cmBack + " (<kbd>B</kbd>)",
-          callback:this._goBack,
-        },
-        {
-          text: M.options.locale.cmForward + " (<kbd>F</kbd>)",
-          callback:this._goForward,
-        },
-        {
-          text: M.options.locale.cmReload + " (<kbd>R</kbd>)",
-          callback:this._reload,
-        },
-        {
-          spacer:"-",
-        },
-        {
-          text: M.options.locale.cmToggleControls + " (<kbd>T</kbd>)",
-          callback:this._toggleControls,
-        },
-        {
-          text: M.options.locale.cmCopyCoords + " (<kbd>C</kbd>)<span></span>",
-          callback:this._copyCoords,
-          hideOnSelect:false,
-          popup:true,
-          submenu:[
-            {
-              text:"tile",
-              callback:this._copyTile,
-            },
-            {
-              text:"tilematrix",
-              callback:this._copyTileMatrix,
-            },
-            {
-              spacer:"-",
-            },
-            {
-              text:"map",
-              callback:this._copyMap,
-            },
-            {
-              spacer:"-",
-            },
-            {
-              text:"tcrs",
-              callback:this._copyTCRS,
-            },
-            {
-              text:"pcrs",
-              callback:this._copyPCRS,
-            },
-            {
-              text:"gcrs",
-              callback:this._copyGCRS,
-            },
-            {
-              spacer:"-",
-            },
-            {
-              text: M.options.locale.cmCopyAll,
-              callback:this._copyAllCoords,
-            }
-          ]
-        },
-        {
-          text: M.options.locale.cmToggleDebug + " (<kbd>D</kbd>)",
-          callback:this._toggleDebug,
-        },
-        {
-          text: M.options.locale.cmCopyMapML + " (<kbd>M</kbd>)",
-          callback:this._copyMapML,
-        },
-        {
-          text: M.options.locale.cmViewSource + " (<kbd>V</kbd>)",
-          callback:this._viewSource,
-        },
-      ];
-
-      this._layerItems = [
-        {
-          text: M.options.locale.lmZoomToLayer + " (<kbd>Z</kbd>)",
-          callback:this._zoomToLayer
-        },
-        {
-          text: M.options.locale.lmCopyExtent + " (<kbd>C</kbd>)",
-          callback:this._copyLayerExtent
-        },
-      ];
-      this._mapMenuVisible = false;
-      this._keyboardEvent = false;
-
-      this._container = L.DomUtil.create("div", "mapml-contextmenu", map._container);
-      this._container.setAttribute('hidden', '');
-      
-      for (let i = 0; i < 6; i++) {
-        this._items[i].el = this._createItem(this._container, this._items[i]);
-      }
-
-      this._coordMenu = L.DomUtil.create("div", "mapml-contextmenu mapml-submenu", this._container);
-      this._coordMenu.id = "mapml-copy-submenu";
-      this._coordMenu.setAttribute('hidden', '');
-
-      this._clickEvent = null;
-
-      for(let i =0;i<this._items[5].submenu.length;i++){
-        this._createItem(this._coordMenu,this._items[5].submenu[i],i);
-      }
-
-      this._items[6].el = this._createItem(this._container, this._items[6]);
-      this._items[7].el = this._createItem(this._container, this._items[7]);
-      this._items[8].el = this._createItem(this._container, this._items[8]);
-
-      this._layerMenu = L.DomUtil.create("div", "mapml-contextmenu mapml-layer-menu", map._container);
-      this._layerMenu.setAttribute('hidden', '');
-      for (let i = 0; i < this._layerItems.length; i++) {
-        this._createItem(this._layerMenu, this._layerItems[i]);
-      }
-
-      L.DomEvent
-        .on(this._container, 'click', L.DomEvent.stop)
-        .on(this._container, 'mousedown', L.DomEvent.stop)
-        .on(this._container, 'dblclick', L.DomEvent.stop)
-        .on(this._container, 'contextmenu', L.DomEvent.stop)
-        .on(this._layerMenu, 'click', L.DomEvent.stop)
-        .on(this._layerMenu, 'mousedown', L.DomEvent.stop)
-        .on(this._layerMenu, 'dblclick', L.DomEvent.stop)
-        .on(this._layerMenu, 'contextmenu', L.DomEvent.stop);
-    },
-
-    addHooks: function () {
-      var container = this._map.getContainer();
-
-      L.DomEvent
-        .on(container, 'mouseleave', this._hide, this)
-        .on(document, 'keydown', this._onKeyDown, this);
-
-      if (L.Browser.touch) {
-        L.DomEvent.on(document, this._touchstart, this._hide, this);
-      }
-
-      this._map.on({
-        contextmenu: this._show,
-        mousedown: this._hide,
-        zoomstart: this._hide
-      }, this);
-    },
-
-    removeHooks: function () {
-      var container = this._map.getContainer();
-
-      L.DomEvent
-        .off(container, 'mouseleave', this._hide, this)
-        .off(document, 'keydown', this._onKeyDown, this);
-
-      if (L.Browser.touch) {
-        L.DomEvent.off(document, this._touchstart, this._hide, this);
-      }
-
-      this._map.off({
-        contextmenu: this._show,
-        mousedown: this._hide,
-        zoomstart: this._hide
-      }, this);
-    },
-
-    _copyLayerExtent: function (e) {
-      let context = e instanceof KeyboardEvent ? this._map.contextMenu : this.contextMenu,
-          layerElem = context._layerClicked.layer._layerEl,
-          tL = layerElem.extent.topLeft.pcrs,
-          bR = layerElem.extent.bottomRight.pcrs;
-
-      let data = `<map-meta name="extent" content="top-left-easting=${tL.horizontal}, top-left-northing=${tL.vertical}, bottom-right-easting=${bR.horizontal}, bottom-right-northing=${bR.vertical}"></map-meta>`;
-      context._copyData(data);
-    },
-
-    _zoomToLayer: function (e) {
-      let context = e instanceof KeyboardEvent ? this._map.contextMenu : this.contextMenu;
-      context._layerClicked.layer._layerEl.focus();
-    },
-
-    _goForward: function(e){
-      let mapEl = e instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl;
-      mapEl.forward();
-    },
-
-    _goBack: function(e){
-      let mapEl = e instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl;
-      mapEl.back();
-    },
-
-    _reload: function(e){
-      let mapEl = e instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl;
-      mapEl.reload();
-    },
-
-    _toggleControls: function(e){
-      let mapEl = e instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl;
-      mapEl._toggleControls();
-    },
-
-    _copyMapML: function(e){
-      let context = e instanceof KeyboardEvent ? this._map.contextMenu : this.contextMenu,
-        mapEl = e instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl;
-      context._copyData(mapEl.outerHTML.replace(/<div class="mapml-web-map">.*?<\/div>|<style>\[is="web-map"].*?<\/style>|<style>mapml-viewer.*?<\/style>/gm, ""));
-    },
-
-    _viewSource: function(e){
-      let mapEl = e instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl;
-      mapEl.viewSource();
-    },
-
-    _toggleDebug: function(e){
-      let mapEl = e instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl;
-      mapEl.toggleDebug();
-    },
-
-    _copyCoords: function(e){
-      let directory = this.contextMenu?this.contextMenu:this;
-      directory._showCoordMenu(e);
-    },
-
-    _copyData: function(data){
-      const el = document.createElement('textarea');
-      el.value = data;
-      document.body.appendChild(el);
-      el.select();
-      document.execCommand('copy');
-      document.body.removeChild(el);
-    },
-
-    _copyGCRS: function(e){
-      let mapEl = this.options.mapEl,
-          click = this.contextMenu._clickEvent;
-      this.contextMenu._copyData(`z:${mapEl.zoom}, lon :${click.latlng.lng.toFixed(6)}, lat:${click.latlng.lat.toFixed(6)}`);
-    },
-
-    _copyTCRS: function(e){
-      let mapEl = this.options.mapEl,
-          click = this.contextMenu._clickEvent,
-          point = mapEl._map.project(click.latlng);
-      this.contextMenu._copyData(`z:${mapEl.zoom}, x:${point.x}, y:${point.y}`);
-    },
-
-    _copyTileMatrix: function(e){
-      let mapEl = this.options.mapEl,
-          click = this.contextMenu._clickEvent,
-          point = mapEl._map.project(click.latlng),
-          tileSize = mapEl._map.options.crs.options.crs.tile.bounds.max.x;
-      this.contextMenu._copyData(`z:${mapEl.zoom}, column:${Math.trunc(point.x/tileSize)}, row:${Math.trunc(point.y/tileSize)}`);
-    },
-
-    _copyPCRS: function(e){
-      let mapEl = this.options.mapEl,
-          click = this.contextMenu._clickEvent,
-          point = mapEl._map.project(click.latlng),
-          scale = mapEl._map.options.crs.scale(+mapEl.zoom),
-          pcrs = mapEl._map.options.crs.transformation.untransform(point,scale);
-      this.contextMenu._copyData(`z:${mapEl.zoom}, easting:${pcrs.x.toFixed(2)}, northing:${pcrs.y.toFixed(2)}`);
-    },
-
-    _copyTile: function(e){
-      let mapEl = this.options.mapEl,
-          click = this.contextMenu._clickEvent,
-          point = mapEl._map.options.crs.project(click.latlng),
-          tileSize = mapEl._map.options.crs.options.crs.tile.bounds.max.x,
-          pointX = point.x % tileSize, pointY = point.y % tileSize;
-      if(pointX < 0) pointX+= tileSize;
-      if(pointY < 0) pointY+= tileSize;
-
-      this.contextMenu._copyData(`z:${mapEl.zoom}, i:${Math.trunc(pointX)}, j:${Math.trunc(pointY)}`);
-    },
-
-    _copyMap: function(e){
-      let mapEl = this.options.mapEl,
-          click = this.contextMenu._clickEvent;
-      this.contextMenu._copyData(`z:${mapEl.zoom}, i:${Math.trunc(click.containerPoint.x)}, j:${Math.trunc(click.containerPoint.y)}`);
-    },
-
-    _copyAllCoords: function(e){
-      let mapEl = this.options.mapEl,
-      click = this.contextMenu._clickEvent,
-      point = mapEl._map.project(click.latlng),
-      tileSize = mapEl._map.options.crs.options.crs.tile.bounds.max.x,
-      pointX = point.x % tileSize, pointY = point.y % tileSize,
-      scale = mapEl._map.options.crs.scale(+mapEl.zoom),
-      pcrs = mapEl._map.options.crs.transformation.untransform(point,scale);
-      let allData = `z:${mapEl.zoom}\n`;
-      allData += `tile: i:${Math.trunc(pointX)}, j:${Math.trunc(pointY)}\n`;
-      allData += `tilematrix: column:${Math.trunc(point.x/tileSize)}, row:${Math.trunc(point.y/tileSize)}\n`;
-      allData += `map: i:${Math.trunc(click.containerPoint.x)}, j:${Math.trunc(click.containerPoint.y)}\n`;
-      allData += `tcrs: x:${Math.trunc(point.x)}, y:${Math.trunc(point.y)}\n`;
-      allData += `pcrs: easting:${pcrs.x.toFixed(2)}, northing:${pcrs.y.toFixed(2)}\n`;
-      allData += `gcrs: lon :${click.latlng.lng.toFixed(6)}, lat:${click.latlng.lat.toFixed(6)}`;
-      this.contextMenu._copyData(allData);
-    },
-
-    _createItem: function (container, options, index) {
-      if (options.spacer) {
-        return this._createSeparator(container, index);
-      }
-
-      var itemCls = 'mapml-contextmenu-item',
-          el = this._insertElementAt('button', itemCls, container, index),
-          callback = this._createEventHandler(el, options.callback, options.context, options.hideOnSelect),
-          html = '';
-
-      el.innerHTML = html + options.text;
-      el.setAttribute("type", "button");
-      el.classList.add("mapml-button");
-      if(options.popup){
-        el.setAttribute("aria-haspopup", "true");
-        el.setAttribute("aria-expanded", "false");
-        el.setAttribute("aria-controls", "mapml-copy-submenu");
-      }
-
-      L.DomEvent
-        .on(el, 'mouseover', this._onItemMouseOver, this)
-        .on(el, 'mouseout', this._onItemMouseOut, this)
-        .on(el, 'mousedown', L.DomEvent.stopPropagation)
-        .on(el, 'click', callback);
-
-      if (L.Browser.touch) {
-        L.DomEvent.on(el, this._touchstart, L.DomEvent.stopPropagation);
-      }
-
-      // Devices without a mouse fire "mouseover" on tap, but never “mouseout"
-      if (!L.Browser.pointer) {
-        L.DomEvent.on(el, 'click', this._onItemMouseOut, this);
-      }
-
-      return {
-        id: L.Util.stamp(el),
-        el: el,
-        callback: callback
-      };
-    },
-
-    _createSeparator: function (container, index) {
-      let el = this._insertElementAt('div', 'mapml-contextmenu-separator', container, index);
-
-      return {
-        id: L.Util.stamp(el),
-        el: el
-      };
-    },
-
-    _createEventHandler: function (el, func, context, hideOnSelect) {
-      let parent = this;
-
-      hideOnSelect = (hideOnSelect !== undefined) ? hideOnSelect : true;
-
-      return function (e) {
-        let map = parent._map,
-          containerPoint = parent._showLocation.containerPoint,
-          layerPoint = map.containerPointToLayerPoint(containerPoint),
-          latlng = map.layerPointToLatLng(layerPoint),
-          relatedTarget = parent._showLocation.relatedTarget,
-          data = {
-            containerPoint: containerPoint,
-            layerPoint: layerPoint,
-            latlng: latlng,
-            relatedTarget: relatedTarget
-          };
-
-        if (hideOnSelect) {
-          parent._hide();
-        }
-
-        if (func) {
-          func.call(context || map, data);
-        }
-
-        parent._map.fire('contextmenu.select', {
-          contextmenu: parent,
-          el: el
-        });
-      };
-    },
-
-    _insertElementAt: function (tagName, className, container, index) {
-        let refEl,
-            el = document.createElement(tagName);
-
-        el.className = className;
-
-        if (index !== undefined) {
-            refEl = container.children[index];
-        }
-
-        if (refEl) {
-            container.insertBefore(el, refEl);
-        } else {
-            container.appendChild(el);
-        }
-
-        return el;
-    },
-
-    _show: function (e) {
-      if(this._mapMenuVisible) this._hide();
-      this._clickEvent = e;
-      let elem = e.originalEvent.target;
-      if(elem.closest("fieldset")){
-        elem = elem.closest("fieldset").querySelector("span");
-        if(!elem.layer.validProjection) return;
-        this._layerClicked = elem;
-        this._showAtPoint(e.containerPoint, e, this._layerMenu);
-      } else if(elem.classList.contains("leaflet-container") || elem.classList.contains("mapml-debug-extent") ||
-        elem.tagName === "path") {
-        this._layerClicked = undefined;
-        this._showAtPoint(e.containerPoint, e, this._container);
-      }
-      if(e.originalEvent.button === 0 || e.originalEvent.button === -1){
-        this._keyboardEvent = true;
-        if(this._layerClicked){
-          let activeEl = document.activeElement;
-          this._elementInFocus = activeEl.shadowRoot.activeElement;
-          this._layerMenuTabs = 1;
-          this._layerMenu.firstChild.focus();
-        } else {
-          this._container.firstChild.focus();
-        }
-
-      }
-    },
-
-    _showAtPoint: function (pt, data, container) {
-        if (this._items.length) {
-            let event = L.extend(data || {}, {contextmenu: this});
-
-            this._showLocation = {
-                containerPoint: pt
-            };
-
-            if (data && data.relatedTarget){
-                this._showLocation.relatedTarget = data.relatedTarget;
-            }
-
-            this._setPosition(pt,container);
-
-            if (!this._mapMenuVisible) {
-              container.removeAttribute('hidden');
-                this._mapMenuVisible = true;
-            }
-
-            this._map.fire('contextmenu.show', event);
-        }
-    },
-
-    _hide: function () {
-        if (this._mapMenuVisible) {
-            this._mapMenuVisible = false;
-            this._container.setAttribute('hidden', '');
-            this._coordMenu.setAttribute('hidden', '');
-            this._layerMenu.setAttribute('hidden', '');
-            this._map.fire('contextmenu.hide', {contextmenu: this});
-            setTimeout(() => this._map._container.focus(), 0);
-        }
-    },
-
-    _setPosition: function (pt, container) {
-        let mapSize = this._map.getSize(),
-            containerSize = this._getElementSize(container),
-            anchor;
-
-        if (this._map.options.contextmenuAnchor) {
-            anchor = L.point(this._map.options.contextmenuAnchor);
-            pt = pt.add(anchor);
-        }
-
-        container._leaflet_pos = pt;
-
-        if (pt.x + containerSize.x > mapSize.x) {
-            container.style.left = 'auto';
-            container.style.right = Math.min(Math.max(mapSize.x - pt.x, 0), mapSize.x - containerSize.x - 1) + 'px';
-        } else {
-            container.style.left = Math.max(pt.x, 0) + 'px';
-            container.style.right = 'auto';
-        }
-
-        if (pt.y + containerSize.y > mapSize.y) {
-            container.style.top = 'auto';
-            container.style.bottom = Math.min(Math.max(mapSize.y - pt.y, 0), mapSize.y - containerSize.y - 1) + 'px';
-        } else {
-            container.style.top = Math.max(pt.y, 0) + 'px';
-            container.style.bottom = 'auto';
-        }
-    },
-
-    _getElementSize: function (el) {
-        let size = this._size;
-
-        if (!size || this._sizeChanged) {
-            size = {};
-
-            el.style.left = '-999999px';
-            el.style.right = 'auto';
-
-            size.x = el.offsetWidth;
-            size.y = el.offsetHeight;
-
-            el.style.left = 'auto';
-
-            this._sizeChanged = false;
-        }
-
-        return size;
-    },
-
-     // once tab is clicked on the layer menu, change the focus back to the layer control
-     _focusOnLayerControl: function(){
-      this._mapMenuVisible = false;
-      delete this._layerMenuTabs;
-      this._layerMenu.setAttribute('hidden', '');
-      if(this._elementInFocus){
-        this._elementInFocus.focus();
-      } else {
-        this._layerClicked.parentElement.firstChild.focus();
-      }
-      delete this._elementInFocus;
-    },
-
-    _onKeyDown: function (e) {
-      if(!this._mapMenuVisible) return;
-
-      let key = e.keyCode;
-      let path = e.path || e.composedPath();
-
-      if(key === 13)
-        e.preventDefault();
-      // keep track of where the focus is on the layer menu and when the layer menu is tabbed out of, focus on layer control
-      if(this._layerMenuTabs && (key === 9 || key === 27)){
-        if(e.shiftKey){
-          this._layerMenuTabs -= 1;
-        } else {
-          this._layerMenuTabs += 1;
-        }
-        if(this._layerMenuTabs === 0 || this._layerMenuTabs === 3 || key === 27){
-          L.DomEvent.stop(e);
-          this._focusOnLayerControl();
-        } 
-      } else if(key !== 16 && key!== 9 && !(!this._layerClicked && key === 67) && path[0].innerText !== (M.options.locale.cmCopyCoords + " (C)")){
-        this._hide();
-      }
-      switch(key){
-        case 13:  //ENTER KEY
-        case 32:  //SPACE KEY
-          if(this._map._container.parentNode.activeElement.parentNode.classList.contains("mapml-contextmenu"))
-            this._map._container.parentNode.activeElement.click();
-          break;
-        case 66: //B KEY
-          this._goBack(e);
-          break;
-        case 67: //C KEY
-          if(this._layerClicked){
-            this._copyLayerExtent(e);
-          } else {
-            this._copyCoords({
-              latlng:this._map.getCenter()
-            });
-          }
-          break;
-        case 68: //D KEY
-          this._toggleDebug(e);
-          break;
-        case 77: //M KEY
-          this._copyMapML(e);
-          break;
-        case 70: //F KEY
-          this._goForward(e);
-          break;
-        case 82: //R KEY
-          this._reload(e);
-          break;
-        case 84: //T KEY
-          this._toggleControls(e);
-          break;
-        case 86: //V KEY
-          this._viewSource(e);
-          break;
-        case 90: //Z KEY
-          if(this._layerClicked)
-            this._zoomToLayer(e);
-          break;
-      }
-    },
-
-    _showCoordMenu: function(e){
-      let mapSize = this._map.getSize(),
-          click = this._clickEvent,
-          menu = this._coordMenu,
-          copyEl = this._items[5].el.el;
-
-      copyEl.setAttribute("aria-expanded","true");
-      menu.removeAttribute('hidden');
-
-      if (click.containerPoint.x + 160 + 80 > mapSize.x) {
-        menu.style.left = 'auto';
-        menu.style.right = 160 + 'px';
-      } else {
-        menu.style.left = 160 + 'px';
-        menu.style.right = 'auto';
-      }
-
-      if (click.containerPoint.y + 160 > mapSize.y) {
-        menu.style.top = 'auto';
-        menu.style.bottom = 20 + 'px';
-      } else {
-        menu.style.top = 100 + 'px';
-        menu.style.bottom = 'auto';
-      }
-      if(this._keyboardEvent)menu.firstChild.focus();
-    },
-
-    _hideCoordMenu: function(e){
-      if(e.srcElement.parentElement.classList.contains("mapml-submenu") ||
-          e.srcElement.innerText === (M.options.locale.cmCopyCoords + " (C)"))return;
-      let menu = this._coordMenu, copyEl = this._items[5].el.el;
-      copyEl.setAttribute("aria-expanded","false");
-      menu.setAttribute('hidden', '');
-    },
-
-    _onItemMouseOver: function (e) {
-      L.DomUtil.addClass(e.target || e.srcElement, 'over');
-      if(e.srcElement.innerText === (M.options.locale.cmCopyCoords + " (C)")) this._showCoordMenu(e);
-    },
-
-    _onItemMouseOut: function (e) {
-      L.DomUtil.removeClass(e.target || e.srcElement, 'over');
-      this._hideCoordMenu(e);
-    }
-  });
-
-  var Util = {
-    convertAndFormatPCRS : function(pcrsBounds, map){
-      if(!pcrsBounds || !map) return {};
-
-      let tcrsTopLeft = [], tcrsBottomRight = [],
-          tileMatrixTopLeft = [], tileMatrixBottomRight = [],
-          tileSize = map.options.crs.options.crs.tile.bounds.max.y;
-
-      for(let i = 0;i<map.options.crs.options.resolutions.length;i++){
-        let scale = map.options.crs.scale(i),
-            minConverted = map.options.crs.transformation.transform(pcrsBounds.min,scale),
-            maxConverted = map.options.crs.transformation.transform(pcrsBounds.max,scale);
-            
-        tcrsTopLeft.push({
-          horizontal: minConverted.x,
-          vertical:maxConverted.y,
-        });
-        tcrsBottomRight.push({
-          horizontal: maxConverted.x,
-          vertical: minConverted.y,
-        });
-
-        //converts the tcrs values from earlier to tilematrix
-        tileMatrixTopLeft.push({
-          horizontal: tcrsTopLeft[i].horizontal / tileSize,
-          vertical:tcrsTopLeft[i].vertical / tileSize,
-        });
-        tileMatrixBottomRight.push({
-          horizontal: tcrsBottomRight[i].horizontal / tileSize,
-          vertical: tcrsBottomRight[i].vertical / tileSize,
-        });
-      }
-      
-      //converts the gcrs, I believe it can take any number values from -inf to +inf
-      let unprojectedMin = map.options.crs.unproject(pcrsBounds.min),
-          unprojectedMax = map.options.crs.unproject(pcrsBounds.max);
-
-      let gcrs = {
-        topLeft:{
-          horizontal: unprojectedMin.lng,
-          vertical:unprojectedMax.lat,
-        },
-        bottomRight:{
-          horizontal: unprojectedMax.lng,
-          vertical: unprojectedMin.lat,
-        },
-      };
-
-      //formats known pcrs bounds to correct format
-      let pcrs = {
-        topLeft:{
-          horizontal:pcrsBounds.min.x,
-          vertical:pcrsBounds.max.y,
-        },
-        bottomRight:{
-          horizontal:pcrsBounds.max.x,
-          vertical:pcrsBounds.min.y,
-        },
-      };
-
-      //formats all extent data
-      return {
-        topLeft:{
-          tcrs:tcrsTopLeft,
-          tilematrix:tileMatrixTopLeft,
-          gcrs:gcrs.topLeft,
-          pcrs:pcrs.topLeft,
-        },
-        bottomRight:{
-          tcrs:tcrsBottomRight,
-          tilematrix:tileMatrixBottomRight,
-          gcrs:gcrs.bottomRight,
-          pcrs:pcrs.bottomRight,
-        },
-        projection:map.options.projection
-      };
-    },
-    extractInputBounds: function(template){
-      if(!template) return undefined;
-
-      //sets variables with their respective fallback values incase content is missing from the template
-        let inputs = template.values, projection = template.projection || FALLBACK_PROJECTION, value = 0, boundsUnit = FALLBACK_CS;
-        let bounds = this[projection].options.crs.tilematrix.bounds(0), nMinZoom = 0, nMaxZoom = this[projection].options.resolutions.length - 1;
-        let locInputs = false, numberOfAxes = 0;
-      if(!template.zoomBounds){
-        template.zoomBounds ={};
-        template.zoomBounds.min=0;
-        template.zoomBounds.max=nMaxZoom;
-      }
-      for(let i=0;i<inputs.length;i++){
-        switch(inputs[i].getAttribute("type")){
-          case "zoom":
-            nMinZoom = +inputs[i].getAttribute("min");
-            nMaxZoom = +(inputs[i].hasAttribute("max") ? inputs[i].getAttribute("max") : nMaxZoom);
-            value = +inputs[i].getAttribute("value");
-          break;
-          case "location":
-            if(!inputs[i].getAttribute("max") || !inputs[i].getAttribute("min")) continue;
-            let max = +inputs[i].getAttribute("max"),min = +inputs[i].getAttribute("min");
-            switch(inputs[i].getAttribute("axis").toLowerCase()){
-              case "x":
-              case "longitude":
-              case "column":
-              case "easting":
-                boundsUnit = M.axisToCS(inputs[i].getAttribute("axis").toLowerCase());
-                bounds.min.x = min;
-                bounds.max.x = max;
-                numberOfAxes++;
-              break;
-              case "y":
-              case "latitude":
-              case "row":
-              case "northing":
-                boundsUnit = M.axisToCS(inputs[i].getAttribute("axis").toLowerCase());
-                bounds.min.y = min;
-                bounds.max.y = max;
-                numberOfAxes++;
-              break;
-            }
-          break;
-        }
-      }
-      if (numberOfAxes >= 2) {
-        locInputs = true;
-      }
-      let zoomBoundsFormatted = {
-        minZoom:+template.zoomBounds.min,
-        maxZoom:+template.zoomBounds.max,
-        minNativeZoom:nMinZoom,
-        maxNativeZoom:nMaxZoom
-      };
-      if(!locInputs && template.extentPCRSFallback && template.extentPCRSFallback.bounds) {
-        bounds = template.extentPCRSFallback.bounds;
-      } else if (locInputs) {
-        bounds = this.boundsToPCRSBounds(bounds,value,projection,boundsUnit);
-      } else {
-        bounds = this[projection].options.crs.pcrs.bounds;
-      }
-      return {
-        zoomBounds:zoomBoundsFormatted,
-        bounds:bounds
-      };
-    },
-
-    axisToCS : function(axis){
-      try{
-        switch(axis.toLowerCase()){
-          case "row":
-          case "column":
-            return "TILEMATRIX";
-          case "i":
-          case "j":
-            return ["MAP","TILE"];
-          case "x":
-          case "y":
-            return "TCRS";
-          case "latitude":
-          case "longitude":
-            return "GCRS";
-          case "northing":
-          case "easting":
-            return "PCRS";
-          default:
-            return FALLBACK_CS;
-        }
-      } catch (e) {return undefined;}
-    },
-
-    //takes a given cs and retuns the axes, first horizontal then vertical
-    csToAxes: function(cs){
-      try{
-        switch(cs.toLowerCase()){
-          case "tilematrix":
-            return ["column", "row"];
-          case "map":
-          case "tile":
-            return ["i", "j"];
-          case "tcrs":
-            return ["x", "y"];
-          case "gcrs":
-            return ["longitude", "latitude"];
-          case "pcrs":
-            return ["easting", "northing"];
-        }
-      } catch (e) {return undefined;}
-    },
-
-    axisToXY: function(axis){
-      try{
-        switch(axis.toLowerCase()){
-          case "i":
-          case "column":
-          case "longitude":
-          case "x":
-          case "easting":
-            return "x";
-          case "row":
-          case "j":
-          case "latitude":
-          case "y":
-          case "northing":
-            return "y";
-
-          default:
-            return undefined;
-        }
-      } catch (e) {return undefined;}
-    },
-
-    convertPCRSBounds: function(pcrsBounds, zoom, projection, cs){
-      if(!pcrsBounds || (!zoom && zoom !== 0) || !Number.isFinite(+zoom) || !projection || !cs) return undefined;
-      projection = (typeof projection === "string") ? M[projection] : projection;
-      switch (cs.toUpperCase()) {
-        case "PCRS":
-          return pcrsBounds;
-        case "TCRS":
-        case "TILEMATRIX":
-          let minPixel = projection.transformation.transform(pcrsBounds.min, projection.scale(+zoom)),
-              maxPixel = projection.transformation.transform(pcrsBounds.max, projection.scale(+zoom));
-          if (cs.toUpperCase() === "TCRS") return L.bounds(minPixel, maxPixel);
-          let tileSize = projection.options.crs.tile.bounds.max.x;
-          return L.bounds(L.point(minPixel.x / tileSize, minPixel.y / tileSize), L.point(maxPixel.x / tileSize,maxPixel.y / tileSize)); 
-        case "GCRS":
-          let minGCRS = projection.unproject(pcrsBounds.min),
-              maxGCRS = projection.unproject(pcrsBounds.max);
-          return L.bounds(L.point(minGCRS.lng, minGCRS.lat), L.point(maxGCRS.lng, maxGCRS.lat)); 
-        default:
-          return undefined;
-      }
-    },
-
-    pointToPCRSPoint: function(point, zoom, projection, cs){
-      if(!point || (!zoom && zoom !== 0) || !Number.isFinite(+zoom) || !cs || !projection) return undefined;
-      projection = (typeof projection === "string") ? M[projection] : projection;
-      let tileSize = projection.options.crs.tile.bounds.max.x;
-      switch(cs.toUpperCase()){
-        case "TILEMATRIX":
-          return M.pixelToPCRSPoint(L.point(point.x*tileSize,point.y*tileSize),zoom,projection);
-        case "PCRS":
-          return point;
-        case "TCRS" :
-          return M.pixelToPCRSPoint(point,zoom,projection);
-        case "GCRS":
-          return projection.project(L.latLng(point.y,point.x));
-        default:
-          return undefined;
-      }
-    },
-
-    pixelToPCRSPoint: function(point, zoom, projection){
-      if(!point || (!zoom && zoom !== 0) || !Number.isFinite(+zoom) || !projection) return undefined;
-      projection = (typeof projection === "string") ? M[projection] : projection;
-      return projection.transformation.untransform(point,projection.scale(zoom));
-    },
-
-    boundsToPCRSBounds: function(bounds, zoom, projection, cs){
-      if(!bounds || !bounds.max || !bounds.min || (!zoom && zoom !== 0) || !Number.isFinite(+zoom) || !projection || !cs) return undefined;
-      projection = (typeof projection === "string") ? M[projection] : projection;
-      return L.bounds(M.pointToPCRSPoint(bounds.min, zoom, projection, cs), M.pointToPCRSPoint(bounds.max, zoom, projection, cs));
-    },
-
-    //L.bounds have fixed point positions, where min is always topleft, max is always bottom right, and the values are always sorted by leaflet
-    //important to consider when working with pcrs where the origin is not topleft but rather bottomleft, could lead to confusion
-    pixelToPCRSBounds : function(bounds, zoom, projection){
-      if(!bounds || !bounds.max || !bounds.min || (!zoom && zoom !== 0) || !Number.isFinite(+zoom) || !projection) return undefined;
-      projection = (typeof projection === "string") ? M[projection] : projection;
-      return L.bounds(M.pixelToPCRSPoint(bounds.min, zoom, projection), M.pixelToPCRSPoint(bounds.max, zoom, projection));
-    },
-    //meta content is the content attribute of meta
-    // input "max=5,min=4" => [[max,5][min,5]]
-    metaContentToObject: function(input){
-      if(!input || input instanceof Object)return {};
-      let content = input.split(/\s+/).join("");
-      let contentArray = {};
-      let stringSplit = content.split(',');
-
-      for(let i=0;i<stringSplit.length;i++){
-        let prop = stringSplit[i].split("=");
-        if(prop.length === 2) contentArray[prop[0]]=prop[1];
-      }
-      if(contentArray !== "" && stringSplit[0].split("=").length ===1)contentArray.content = stringSplit[0];
-      return contentArray;
-    },
-    coordsToArray: function(containerPoints) {
-      // returns an array of arrays of coordinate pairs coordsToArray("1,2,3,4") -> [[1,2],[3,4]]
-      for (var i=1, pairs = [], coords = containerPoints.split(",");i<coords.length;i+=2) {
-        pairs.push([parseInt(coords[i-1]),parseInt(coords[i])]);
-      }
-      return pairs;
-    },
-    parseStylesheetAsHTML: function(mapml, base, container) {
-        if (!(container instanceof Element) || !mapml || !mapml.querySelector('map-link[rel=stylesheet],map-style')) return;
-
-        if(base instanceof Element) {
-          base = base.getAttribute('href')?base.getAttribute('href'):document.URL;
-        } else if (!base || base==="" || base instanceof Object) {
-          return;
-        }
-
-        var ss = [];
-        var stylesheets = mapml.querySelectorAll('map-link[rel=stylesheet],map-style');
-        for (var i=0;i<stylesheets.length;i++) {
-          if (stylesheets[i].nodeName.toUpperCase() === "MAP-LINK" ) {
-            var href = stylesheets[i].hasAttribute('href') ? new URL(stylesheets[i].getAttribute('href'),base).href: null;
-            if (href) {
-              if (!container.querySelector("link[href='"+href+"']")) {
-                var linkElm = document.createElement("link");
-                linkElm.setAttribute("href", href);
-                linkElm.setAttribute("rel", "stylesheet");
-                ss.push(linkElm);
-              }
-            }  
-          } else { // <map-style>
-              var styleElm = document.createElement('style');
-              styleElm.textContent = stylesheets[i].textContent;
-              ss.push(styleElm);
-          }
-        }
-        // insert <link> or <style> elements after the begining  of the container
-        // element, in document order as copied from original mapml document
-        // note the code below assumes hrefs have been resolved and elements
-        // re-parsed from xml and serialized as html elements ready for insertion
-        for (var s=ss.length-1;s >= 0;s--) {
-          container.insertAdjacentElement('afterbegin',ss[s]);
-        }
-    },
-
-    splitCoordinate: function(element, index, array) {
-      var a = [];
-      element.split(/\s+/gim).forEach(M.parseNumber,a);
-      this.push(a);
-    },
-
-    parseNumber : function(element, index, array){
-      this.push(parseFloat(element));
-    },
-
-    handleLink: function (link, leafletLayer) {
-      let zoomTo, justPan = false, layer, map = leafletLayer._map, opacity;
-      if(link.type === "text/html" && link.target !== "_blank"){  // all other target values other than blank behave as _top
-        link.target = "_top";
-      } else if (link.type !== "text/html" && link.url.includes("#")){
-        let hash = link.url.split("#"), loc = hash[1].split(",");
-        zoomTo = {z: loc[0] || 0, lng: loc[1] || 0, lat: loc[2] || 0};
-        justPan = !hash[0]; // if the first half of the array is an empty string then the link is just for panning
-        if(["/", ".","#"].includes(link.url[0])) link.target = "_self";
-      }
-      if(!justPan) {
-        let newLayer = false;
-        layer = document.createElement('layer-');
-        layer.setAttribute('src', link.url);
-        layer.setAttribute('checked', '');
-        switch (link.target) {
-          case "_blank":
-            if (link.type === "text/html") {
-              window.open(link.url);
-            } else {
-              map.options.mapEl.appendChild(layer);
-              newLayer = true;
-            }
-            break;
-          case "_parent":
-            for (let l of map.options.mapEl.querySelectorAll("layer-"))
-              if (l._layer !== leafletLayer) map.options.mapEl.removeChild(l);
-            map.options.mapEl.appendChild(layer);
-            map.options.mapEl.removeChild(leafletLayer._layerEl);
-            newLayer = true;
-            break;
-          case "_top":
-            window.location.href = link.url;
-            break;
-          default:
-            opacity = leafletLayer._layerEl.opacity;
-            leafletLayer._layerEl.insertAdjacentElement('beforebegin', layer);
-            map.options.mapEl.removeChild(leafletLayer._layerEl);
-            newLayer = true;
-        }
-        if(!link.inPlace && newLayer) L.DomEvent.on(layer,'extentload', function focusOnLoad(e) {
-          if(newLayer && ["_parent", "_self"].includes(link.target) && layer.parentElement.querySelectorAll("layer-").length === 1)
-            layer.parentElement.projection = layer._layer.getProjection();
-          if(layer.extent){
-            if(zoomTo) layer.parentElement.zoomTo(+zoomTo.lat, +zoomTo.lng, +zoomTo.z);
-            else layer.focus();
-            L.DomEvent.off(layer, 'extentload', focusOnLoad);
-          }
-
-          if(opacity) layer.opacity = opacity;
-          map.getContainer().focus();
-        });
-      } else if (zoomTo && !link.inPlace && justPan){
-        leafletLayer._map.options.mapEl.zoomTo(+zoomTo.lat, +zoomTo.lng, +zoomTo.z);
-        if(opacity) layer.opacity = opacity;
-      }
-    },
-
-    gcrsToTileMatrix: function (mapEl) {
-      let point = mapEl._map.project(mapEl._map.getCenter());
-      let tileSize = mapEl._map.options.crs.options.crs.tile.bounds.max.y;
-      let column = Math.trunc(point.x / tileSize);
-      let row = Math.trunc(point.y / tileSize);
-      return [column, row];
-    }
-  };
-
-  var ReloadButton = L.Control.extend({
-    options: {
-      position: 'topleft',
-    },
-
-    onAdd: function (map) {
-      let container = L.DomUtil.create("div", "mapml-reload-button leaflet-bar");
-
-      let link = L.DomUtil.create("button", "mapml-reload-button", container);
-      link.innerHTML = "<span aria-hidden='true'>&#x021BA</span>";
-      link.title = M.options.locale.cmReload;
-      link.setAttribute("type", "button");
-      link.classList.add("mapml-button");
-      link.setAttribute('aria-label', "Reload");
-
-      L.DomEvent.disableClickPropagation(link);
-      L.DomEvent.on(link, 'click', L.DomEvent.stop);
-      L.DomEvent.on(link, 'click', this._goReload, this);
-
-      this._reloadButton = link;
-
-      this._updateDisabled();
-      map.on('moveend', this._updateDisabled, this);
-
-      return container;
-    },
-
-    onRemove: function (map) {
-      map.off('moveend', this._updateDisabled, this);
-    },
-
-    disable: function () {
-      this._disabled = true;
-      this._updateDisabled();
-      return this;
-    },
-
-    enable: function () {
-      this._disabled = false;
-      this._updateDisabled();
-      return this;
-    },
-
-    _goReload: function (e) {
-      if (!this._disabled && this._map.options.mapEl._history.length > 1) {
-        this._map.options.mapEl.reload();
-      }
-    },
-
-    _updateDisabled: function () {
-      setTimeout(() => {
-        L.DomUtil.removeClass(this._reloadButton, "leaflet-disabled");
-        this._reloadButton.setAttribute("aria-disabled", "false");
-
-        if (this._map && (this._disabled || this._map.options.mapEl._history.length <= 1)) {
-          L.DomUtil.addClass(this._reloadButton, "leaflet-disabled");
-          this._reloadButton.setAttribute("aria-disabled", "true");
-        }
-      }, 0);
-    }
-  });
-
-  var reloadButton = function (options) {
-    return new ReloadButton(options);
-  };
-
-  var FullscreenButton = L.Control.extend({
-          options: {
-              position: 'topleft',
-              title: {
-                  'false': 'View fullscreen',
-                  'true': 'Exit fullscreen'
-              }
-          },
-
-          onAdd: function (map) {
-              var container = L.DomUtil.create('div', 'leaflet-control-fullscreen leaflet-bar leaflet-control');
-
-              this.link = L.DomUtil.create('a', 'leaflet-control-fullscreen-button leaflet-bar-part', container);
-              this.link.href = '#';
-              this.link.setAttribute('role', 'button');
-
-              this._map = map;
-              this._map.on('fullscreenchange', this._toggleTitle, this);
-              this._toggleTitle();
-
-              L.DomEvent.on(this.link, 'click', this._click, this);
-
-              return container;
-          },
-
-          onRemove: function (map) {
-              map.off('fullscreenchange', this._toggleTitle, this);
-          },
-
-          _click: function (e) {
-              L.DomEvent.stopPropagation(e);
-              L.DomEvent.preventDefault(e);
-              this._map.toggleFullscreen(this.options);
-          },
-
-          _toggleTitle: function() {
-              this.link.title = this.options.title[this._map.isFullscreen()];
-          }
-      });
-
-      L.Map.include({
-          isFullscreen: function () {
-              return this._isFullscreen || false;
-          },
-
-          toggleFullscreen: function (options) {
-              // the <map> element can't contain a shadow root, so we used a child <div>
-              // <mapml-viewer> can contain a shadow root, so return it directly
-              var mapEl = this.getContainer().getRootNode().host,
-                  container = mapEl.nodeName === "DIV" ? mapEl.parentElement : mapEl;
-              if (this.isFullscreen()) {
-                  if (options && options.pseudoFullscreen) {
-                      this._disablePseudoFullscreen(container);
-                  } else if (document.exitFullscreen) {
-                      document.exitFullscreen();
-                  } else if (document.mozCancelFullScreen) {
-                      document.mozCancelFullScreen();
-                  } else if (document.webkitCancelFullScreen) {
-                      document.webkitCancelFullScreen();
-                  } else if (document.msExitFullscreen) {
-                      document.msExitFullscreen();
-                  } else {
-                      this._disablePseudoFullscreen(container);
-                  }
-              } else {
-                  if (options && options.pseudoFullscreen) {
-                      this._enablePseudoFullscreen(container);
-                  } else if (container.requestFullscreen) {
-                      container.requestFullscreen();
-                  } else if (container.mozRequestFullScreen) {
-                      container.mozRequestFullScreen();
-                  } else if (container.webkitRequestFullscreen) {
-                      container.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
-                  } else if (container.msRequestFullscreen) {
-                      container.msRequestFullscreen();
-                  } else {
-                      this._enablePseudoFullscreen(container);
-                  }
-              }
-
-          },
-
-          _enablePseudoFullscreen: function (container) {
-              L.DomUtil.addClass(container, 'leaflet-pseudo-fullscreen');
-              this._setFullscreen(true);
-              this.fire('fullscreenchange');
-          },
-
-          _disablePseudoFullscreen: function (container) {
-              L.DomUtil.removeClass(container, 'leaflet-pseudo-fullscreen');
-              this._setFullscreen(false);
-              this.fire('fullscreenchange');
-          },
-
-          _setFullscreen: function(fullscreen) {
-              this._isFullscreen = fullscreen;
-              var container = this.getContainer().getRootNode().host;
-              if (fullscreen) {
-                  L.DomUtil.addClass(container, 'mapml-fullscreen-on');
-              } else {
-                  L.DomUtil.removeClass(container, 'mapml-fullscreen-on');
-              }
-              this.invalidateSize();
-          },
-
-          _onFullscreenChange: function (e) {
-              var fullscreenElement =
-                  document.fullscreenElement ||
-                  document.mozFullScreenElement ||
-                  document.webkitFullscreenElement ||
-                  document.msFullscreenElement,
-                  mapEl = this.getContainer().getRootNode().host,
-                  container = mapEl.nodeName === "DIV" ? mapEl.parentElement : mapEl;
-              
-
-              if (fullscreenElement === container && !this._isFullscreen) {
-                  this._setFullscreen(true);
-                  this.fire('fullscreenchange');
-              } else if (fullscreenElement !== container && this._isFullscreen) {
-                  this._setFullscreen(false);
-                  this.fire('fullscreenchange');
-              }
-          }
-      });
-
-      L.Map.mergeOptions({
-          fullscreenControl: false
-      });
-
-      L.Map.addInitHook(function () {
-          if (this.options.fullscreenControl) {
-              this.fullscreenControl = new FullscreenButton(this.options.fullscreenControl);
-              this.addControl(this.fullscreenControl);
-          }
-
-          var fullscreenchange;
-
-          if ('onfullscreenchange' in document) {
-              fullscreenchange = 'fullscreenchange';
-          } else if ('onmozfullscreenchange' in document) {
-              fullscreenchange = 'mozfullscreenchange';
-          } else if ('onwebkitfullscreenchange' in document) {
-              fullscreenchange = 'webkitfullscreenchange';
-          } else if ('onmsfullscreenchange' in document) {
-              fullscreenchange = 'MSFullscreenChange';
-          }
-
-          if (fullscreenchange) {
-              var onFullscreenChange = L.bind(this._onFullscreenChange, this);
-
-              this.whenReady(function () {
-                  L.DomEvent.on(document, fullscreenchange, onFullscreenChange);
-              });
-
-              this.on('unload', function () {
-                  L.DomEvent.off(document, fullscreenchange, onFullscreenChange);
-              });
-          }
-      });
-
-      var fullscreenButton = function (options) {
-          return new FullscreenButton(options);
-      };
-
-  var Crosshair = L.Layer.extend({
-    onAdd: function (map) {
-
-      // SVG crosshair design from https://github.com/xguaita/Leaflet.MapCenterCoord/blob/master/src/icons/MapCenterCoordIcon1.svg?short_path=81a5c76
-      // Optimized with SVGOMG: https://jakearchibald.github.io/svgomg/
-      let svgInnerHTML = `<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 100 100"><g stroke="#fff" stroke-linecap="round" stroke-linejoin="round"><circle cx="50.028" cy="50.219" r="3.923" stroke-width="2" color="currentColor" overflow="visible"/><path stroke-width="3" d="M4.973 54.424h31.768a4.204 4.204 0 1 0 0-8.409H4.973A4.203 4.203 0 0 0 .77 50.22a4.203 4.203 0 0 0 4.204 4.205z" color="currentColor" overflow="visible"/><path stroke-width="3" d="M54.232 5.165a4.204 4.204 0 1 0-8.408 0v31.767a4.204 4.204 0 1 0 8.408 0V5.165z"/><path stroke-width="3" d="M99.288 50.22a4.204 4.204 0 0 0-4.204-4.205H63.317a4.204 4.204 0 1 0 0 8.409h31.767a4.205 4.205 0 0 0 4.204-4.205zM45.823 95.274a4.204 4.204 0 1 0 8.409 0V63.506a4.204 4.204 0 1 0-8.409 0v31.768z" color="currentColor" overflow="visible"/></g></svg>`;
-
-      this._container = L.DomUtil.create("div", "mapml-crosshair", map._container);
-      this._container.innerHTML = svgInnerHTML;
-      map.isFocused = false;
-      this._isQueryable = false;
-
-      map.on("layerchange layeradd layerremove overlayremove", this._toggleEvents, this);
-      map.on("popupopen", this._isMapFocused, this);
-      L.DomEvent.on(map._container, "keydown keyup mousedown", this._isMapFocused, this);
-
-      this._addOrRemoveCrosshair();
-    },
-
-    onRemove: function (map) {
-      map.off("layerchange layeradd layerremove overlayremove", this._toggleEvents);
-      map.off("popupopen", this._isMapFocused);
-      L.DomEvent.off(map._container, "keydown keyup mousedown", this._isMapFocused);
-    },
-
-    _toggleEvents: function () {
-      if (this._hasQueryableLayer()) {
-        this._map.on("viewreset move moveend", this._addOrRemoveCrosshair, this);
-      } else {
-        this._map.off("viewreset move moveend", this._addOrRemoveCrosshair, this);
-      }
-      this._addOrRemoveCrosshair();
-    },
-
-    _addOrRemoveCrosshair: function (e) {
-      if (this._hasQueryableLayer()) {
-        this._container.removeAttribute("hidden");
-      } else {
-        this._container.setAttribute("hidden", "");
-      }
-    },
-
-    _addOrRemoveMapOutline: function (e) {
-      let mapContainer = this._map._container;
-      if (this._map.isFocused && !this._outline) {
-        this._outline = L.DomUtil.create("div", "mapml-outline", mapContainer);
-      } else if (!this._map.isFocused && this._outline) {
-        L.DomUtil.remove(this._outline);
-        delete this._outline;
-      }
-    },
-
-    _hasQueryableLayer: function () {
-      let layers = this._map.options.mapEl.layers;
-      if (this._map.isFocused) {
-        for (let layer of layers) {
-          if (layer.checked && layer._layer.queryable) {
-            return true;
-          }
-        }
-      }
-      return false;
-    },
-
-    // TODO: should be merged with the 'mapfocused' event emitted by mapml-viewer and map, not trivial
-    _isMapFocused: function (e) {
-      //set this._map.isFocused = true if arrow buttons are used
-      if(!this._map._container.parentNode.activeElement){
-        this._map.isFocused = false;
-        return;
-      }
-      let isLeafletContainer = this._map._container.parentNode.activeElement.classList.contains("leaflet-container");
-      if (isLeafletContainer && ["keydown"].includes(e.type) && (e.shiftKey && e.keyCode === 9)) {
-        this._map.isFocused = false;
-      } else this._map.isFocused = isLeafletContainer && ["keyup", "keydown"].includes(e.type);
-
-      if(this._map.isFocused) this._map.fire("mapkeyboardfocused");
-      this._addOrRemoveMapOutline();
-      this._addOrRemoveCrosshair();
-    },
-
-  });
-
-
-  var crosshair = function (options) {
-    return new Crosshair(options);
-  };
-
-  /**
-   * M.Feature is a extension of L.Path that understands mapml feature markup
-   * It converts the markup to the following structure (abstract enough to encompass all feature types) for example:
-   *  this._outlinePath = HTMLElement;
-   *  this._parts = [
-   *    {
-   *      path: HTMLElement,
-   *      rings:[
-   *        {points:[{x:1,y:1}, ...]},
-   *        ...
-   *      ],
-   *      subrings:[
-   *        {points:[{x:2, y:2}, ...], cls:"Span Class Name", path: HTMLElement,},
-   *        ...
-   *      ],
-   *      cls:"className",
-   *    },
-   *    ...
-   *  ];
-   */
-  var Feature = L.Path.extend({
-
-    /**
-     * Initializes the M.Feature
-     * @param {HTMLElement} markup - The markup representation of the feature
-     * @param {Object} options - The options of the feature
-     */
-    initialize: function (markup, options) {
-      this.type = markup.tagName.toUpperCase();
-
-      if(this.type === "MAP-POINT" || this.type === "MAP-MULTIPOINT") options.fillOpacity = 1;
-
-      if(options.wrappers.length > 0)
-        options = Object.assign(this._convertWrappers(options.wrappers), options);
-      L.setOptions(this, options);
-
-      this.group = this.options.group;
-      this.options.interactive = this.options.link || (this.options.properties && this.options.onEachFeature);
-
-      this._parts = [];
-      this._markup = markup;
-      this.options.zoom = markup.getAttribute('zoom') || this.options.nativeZoom;
-
-      this._convertMarkup();
-
-      if(markup.querySelector('map-span') || markup.querySelector('map-a')){
-        this._generateOutlinePoints();
-      }
-
-      this.isClosed = this._isClosed();
-    },
-
-    /**
-     * Attaches link handler to the sub parts' paths
-     * @param {SVGElement} elem - The element to add listeners to, either path or g elements
-     * @param {Object} link - The link object that contains the url, type and target data
-     * @param leafletLayer
-     */
-    attachLinkHandler: function (elem, link, leafletLayer) {
-      let dragStart, container = document.createElement('div'), p = document.createElement('p'), hovered = false;
-      container.classList.add('mapml-link-preview');
-      container.appendChild(p);
-      elem.classList.add('map-a');
-      if (link.visited) elem.classList.add("map-a-visited");
-      L.DomEvent.on(elem, 'mousedown', e => dragStart = {x:e.clientX, y:e.clientY}, this);
-      L.DomEvent.on(elem, "mouseup", (e) => {
-        if (e.button !== 0) return; // don't trigger when button isn't left click
-        let onTop = true, nextLayer = this.options._leafletLayer._layerEl.nextElementSibling;
-        while(nextLayer && onTop){
-          if(nextLayer.tagName && nextLayer.tagName.toUpperCase() === "LAYER-")
-            onTop = !(nextLayer.checked && nextLayer._layer.queryable);
-          nextLayer = nextLayer.nextElementSibling;
-        }
-        if(onTop && dragStart) {
-          L.DomEvent.stop(e);
-          let dist = Math.sqrt(Math.pow(dragStart.x - e.clientX, 2) + Math.pow(dragStart.y - e.clientY, 2));
-          if (dist <= 5){
-            link.visited = true;
-            elem.setAttribute("stroke", "#6c00a2");
-            elem.classList.add("map-a-visited");
-            M.handleLink(link, leafletLayer);
-          }
-        }
-      }, this);
-      L.DomEvent.on(elem, "keypress", (e) => {
-        L.DomEvent.stop(e);
-        if(e.keyCode === 13 || e.keyCode === 32) {
-          link.visited = true;
-          elem.setAttribute("stroke", "#6c00a2");
-          elem.classList.add("map-a-visited");
-          M.handleLink(link, leafletLayer);
-        }
-      }, this);
-      L.DomEvent.on(elem, 'mouseenter keyup', (e) => {
-        if(e.target !== e.currentTarget) return;
-        hovered = true;
-        let resolver = document.createElement('a'), mapWidth = this._map.getContainer().clientWidth;
-        resolver.href = link.url;
-        p.innerHTML = resolver.href;
-
-        this._map.getContainer().appendChild(container);
-
-        while(p.clientWidth > mapWidth/2){
-          p.innerHTML = p.innerHTML.substring(0, p.innerHTML.length - 5) + "...";
-        }
-        setTimeout(()=>{
-          if(hovered) p.innerHTML = resolver.href;
-        }, 1000);
-      }, this);
-      L.DomEvent.on(elem, 'mouseout keydown mousedown', (e) => {
-        if(e.target !== e.currentTarget || !container.parentElement) return;
-        hovered = false;
-        this._map.getContainer().removeChild(container);
-      }, this);
-      L.DomEvent.on(leafletLayer._map.getContainer(),'mouseout mouseenter click', (e) => { //adds a lot of event handlers
-        if(!container.parentElement) return;
-        hovered = false;
-        this._map.getContainer().removeChild(container);
-      }, this);
-    },
-
-    /**
-     * Updates internal structure of the feature to the new map state, the structure can be found in this._parts
-     * @param {L.Map} addedMap - The map that the feature is part of, can be left blank in the case of static features
-     * @param {L.Point} tileOrigin - The tile origin for the feature, if blank then it takes the maps pixel origin in the function
-     * @param {int} zoomingTo - The zoom the map is animating to, if left blank then it takes the map zoom, its provided because in templated tiles zoom is delayed
-     * @private
-     */
-    _project: function (addedMap, tileOrigin = undefined, zoomingTo = undefined) {
-      let map = addedMap || this._map, origin = tileOrigin || map.getPixelOrigin(), zoom = zoomingTo === undefined ? map.getZoom() : zoomingTo;
-      for (let p of this._parts) {
-        p.pixelRings = this._convertRing(p.rings, map, origin, zoom);
-        for (let subP of p.subrings) {
-          subP.pixelSubrings = this._convertRing([subP], map, origin, zoom);
-        }
-      }
-      if (!this._outline) return;
-      this.pixelOutline = [];
-      for (let o of this._outline) {
-        this.pixelOutline = this.pixelOutline.concat(this._convertRing(o, map, origin, zoom));
-      }
-    },
-
-    /**
-     * Converts the PCRS points to pixel points that can be used to create the SVG
-     * @param {L.Point[][]} r - Is the rings of a feature, either the mainParts, subParts or outline
-     * @param {L.Map} map - The map that the feature is part of
-     * @param {L.Point} origin - The origin used to calculate the pixel points
-     * @param {int} zoom - The current zoom level of the map
-     * @returns {L.Point[][]}
-     * @private
-     */
-    _convertRing: function (r, map, origin, zoom) {
-      // TODO: Implement Ramer-Douglas-Peucer Algo for simplifying points
-      let scale = map.options.crs.scale(zoom), parts = [];
-      for (let sub of r) {
-        let interm = [];
-        for (let p of sub.points) {
-          let conv = map.options.crs.transformation.transform(p, scale);
-          interm.push(L.point(conv.x, conv.y)._subtract(origin).round());
-        }
-        parts.push(interm);
-      }
-      return parts;
-    },
-
-    /**
-     * Updates the features
-     * @private
-     */
-    _update: function () {
-      if (!this._map) return;
-      this._renderer._updateFeature(this);
-    },
-
-    /**
-     * Converts the map-spans, a and divs around a geometry subtype into options for the feature
-     * @param {HTMLElement[]} elems - The current zoom level of the map
-     * @private
-     */
-    _convertWrappers: function (elems) {
-      if(!elems || elems.length === 0) return;
-      let classList = '', output = {};
-      for(let elem of elems){
-        if(elem.tagName.toUpperCase() !== "MAP-A" && elem.className){
-          classList +=`${elem.className} `;
-        } else if(!output.link && elem.getAttribute("href")) {
-          let link = {};
-          link.url = elem.getAttribute("href");
-          if(elem.hasAttribute("target")) link.target = elem.getAttribute("target");
-          if(elem.hasAttribute("type")) link.type = elem.getAttribute("type");
-          if(elem.hasAttribute("inplace")) link.inPlace = true;
-          output.link = link;
-        }
-      }
-      output.className = `${classList} ${this.options.className}`.trim();
-      return output;
-    },
-
-    /**
-     * Converts this._markup to the internal structure of features
-     * @private
-     */
-    _convertMarkup: function () {
-      if (!this._markup) return;
-
-      let attr = this._markup.attributes;
-      this.featureAttributes = {};
-      if(this.options.link && this._markup.parentElement.tagName.toUpperCase() === "MAP-A" && this._markup.parentElement.parentElement.tagName.toUpperCase() !== "MAP-GEOMETRY")
-        this.featureAttributes.tabindex = "0";
-      for(let i = 0; i < attr.length; i++){
-        this.featureAttributes[attr[i].name] = attr[i].value;
-      }
-
-      let first = true;
-      for (let c of this._markup.querySelectorAll('map-coordinates')) {              //loops through the coordinates of the child
-        let ring = [], subRings = [];
-        this._coordinateToArrays(c, ring, subRings, this.options.className);              //creates an array of pcrs points for the main ring and the subparts
-        if (!first && this.type === "MAP-POLYGON") {
-          this._parts[0].rings.push(ring[0]);
-          if (subRings.length > 0)
-            this._parts[0].subrings = this._parts[0].subrings.concat(subRings);
-        } else if (this.type === "MAP-MULTIPOINT") {
-          for (let point of ring[0].points.concat(subRings)) {
-            this._parts.push({ rings: [{ points: [point] }], subrings: [], cls:`${point.cls || ""} ${this.options.className || ""}`.trim() });
-          }
-        } else {
-          this._parts.push({ rings: ring, subrings: subRings, cls: `${this.featureAttributes.class || ""} ${this.options.className || ""}`.trim() });
-        }
-        first = false;
-      }
-    },
-
-    /**
-     * Generates the feature outline, subtracting the map-spans to generate those separately
-     * @private
-     */
-    _generateOutlinePoints: function () {
-      if (this.type === "MAP-MULTIPOINT" || this.type === "MAP-POINT" || this.type === "MAP-LINESTRING" || this.type === "MAP-MULTILINESTRING") return;
-
-      this._outline = [];
-      for (let coords of this._markup.querySelectorAll('map-coordinates')) {
-        let nodes = coords.childNodes, cur = 0, tempDiv = document.createElement('div'), nodeLength = nodes.length;
-        for(let i = 0; i < nodes.length; i++){
-          if(nodes[i].textContent.trim().length === 0){
-            nodes[i].remove();
-          }
-        }
-        for (let n of nodes) {
-          let line = [];
-          if (!n.tagName) {  //no tagName means it's text content
-            let c = '', ind = (((cur - 1)%nodes.length) + nodes.length) % nodes.length; // this equation turns Javascript's % to how it behaves in C for example
-            if (nodes[ind].tagName) {
-              let prev = nodes[ind].textContent.trim().split(/\s+/);
-              c += `${prev[prev.length - 2]} ${prev[prev.length - 1]} `;
-            }
-            c += n.textContent;
-            ind = (((cur + 1)%nodes.length) + nodes.length) % nodes.length; // this is equivalent to C/C++'s (cur + 1) % nodes.length
-            if (nodes[ind].tagName) {
-              let next = nodes[ind].textContent.trim().split(/\s+/);
-              c += `${next[0]} ${next[1]} `;
-            }
-            tempDiv.innerHTML = c;
-            this._coordinateToArrays(tempDiv, line, [], true, this.featureAttributes.class || this.options.className);
-            this._outline.push(line);
-          }
-          cur++;
-        }
-      }
-    },
-
-    /**
-     * Converts map-coordinates element to an object representing the parts and subParts
-     * @param {HTMLElement} coords - A single map-coordinates element
-     * @param {Object[]} main - An empty array representing the main parts
-     * @param {Object[]} subParts - An empty array representing the sub parts
-     * @param {boolean} isFirst - A true | false representing if the current HTML element is the parent map-coordinates element or not
-     * @param {string} cls - The class of the coordinate/span
-     * @param parents
-     * @private
-     */
-    _coordinateToArrays: function (coords, main, subParts, isFirst = true, cls = undefined, parents = []) {
-      for (let span of coords.children) {
-        this._coordinateToArrays(span, main, subParts, false, span.getAttribute("class"), parents.concat([span]));
-      }
-      let noSpan = coords.textContent.replace(/(<([^>]+)>)/ig, ''),
-          pairs = noSpan.match(/(\S+\s+\S+)/gim), local = [], bounds;
-      for (let p of pairs) {
-        let numPair = [];
-        p.split(/\s+/gim).forEach(M.parseNumber, numPair);
-        let point = M.pointToPCRSPoint(L.point(numPair), this.options.zoom, this.options.projection, this.options.nativeCS);
-        local.push(point);
-        bounds = bounds ? bounds.extend(point) : L.bounds(point, point);
-      }
-      if (this._bounds) {
-        this._bounds.extend(bounds.min);
-        this._bounds.extend(bounds.max);
-      } else {
-        this._bounds = bounds;
-      }
-      if (isFirst) {
-        main.push({ points: local });
-      } else {
-        let attrMap = {}, attr = coords.attributes, wrapperAttr = this._convertWrappers(parents);
-        if(wrapperAttr.link) attrMap.tabindex = "0";
-        for(let i = 0; i < attr.length; i++){
-          if(attr[i].name === "class") continue;
-          attrMap[attr[i].name] = attr[i].value;
-        }
-        subParts.unshift({
-          points: local,
-          center: bounds.getCenter(),
-          cls: `${cls || ""} ${wrapperAttr.className || ""}`.trim(),
-          attr: attrMap,
-          link: wrapperAttr.link,
-          linkTarget: wrapperAttr.linkTarget,
-          linkType: wrapperAttr.linkType});
-      }
-    },
-
-    /**
-     * Returns if the feature is closed or open, useful when styling
-     * @returns {boolean}
-     * @private
-     */
-    _isClosed: function () {
-      switch (this.type) {
-        case 'MAP-POLYGON':
-        case 'MAP-MULTIPOLYGON':
-        case 'MAP-POINT':
-        case 'MAP-MULTIPOINT':
-          return true;
-        case 'MAP-LINESTRING':
-        case 'MAP-MULTILINESTRING':
-          return false;
-        default:
-          return false;
-      }
-    },
-
-    /**
-     * Returns the center of the entire feature
-     * @returns {L.Point}
-     */
-    getCenter: function () {
-      if (!this._bounds) return null;
-      return this._map.options.crs.unproject(this._bounds.getCenter());
-    },
-
-    getPCRSCenter: function () {
-      return this._bounds.getCenter();
-    },
-  });
-
-  /**
-   *
-   * @param {HTMLElement} markup - The markup of the feature
-   * @param {Object} options - Options of the feature
-   * @returns {M.Feature}
-   */
-  var feature = function (markup, options) {
-    return new Feature(markup, options);
-  };
-
-  /**
-   * Returns a new Feature Renderer
-   * @param {Object} options - Options for the renderer
-   * @returns {*}
-   */
-  var FeatureRenderer = L.SVG.extend({
-    /**
-     * Override method of same name from L.SVG, use the this._container property
-     * to set up the role="none presentation" on featureGroupu container,
-     * per this recommendation: 
-     * https://github.com/Maps4HTML/Web-Map-Custom-Element/pull/471#issuecomment-845192246
-     * @private overrides ancestor method so that we have a _container to work with
-     */
-    _initContainer: function () {
-      // call the method we're overriding, per https://leafletjs.com/examples/extending/extending-1-classes.html#methods-of-the-parent-class
-      // note you have to pass 'this' as the first arg
-      L.SVG.prototype._initContainer.call(this);
-      // knowing that the previous method call creates the this._container, we
-      // access it and set the role="none presetation" which suppresses the 
-      // announcement of "Graphic" on each feature focus.
-      this._container.setAttribute('role', 'none presentation');
-    },
-    
-    /**
-     * Creates all the appropriate path elements for a M.Feature
-     * @param {M.Feature} layer - The M.Feature that needs paths generated
-     * @param {boolean} stampLayer - Whether or not a layer should be stamped and stored in the renderer layers
-     * @private
-     */
-    _initPath: function (layer, stampLayer = true) {
-
-      if(layer._outline) {
-        let outlinePath = L.SVG.create('path');
-        if (layer.options.className) L.DomUtil.addClass(outlinePath, layer.featureAttributes.class || layer.options.className);
-        L.DomUtil.addClass(outlinePath, 'mapml-feature-outline');
-        outlinePath.style.fill = "none";
-        layer.outlinePath = outlinePath;
-      }
-
-      //creates the main parts and sub parts paths
-      for (let p of layer._parts) {
-        if (p.rings){
-          this._createPath(p, layer.options.className, layer.featureAttributes['aria-label'], layer.options.interactive, layer.featureAttributes);
-          if(layer.outlinePath) p.path.style.stroke = "none";
-        }
-        if (p.subrings) {
-          for (let r of p.subrings) {
-            this._createPath(r, layer.options.className, r.attr['aria-label'], (r.link !== undefined), r.attr);
-          }
-        }
-        this._updateStyle(layer);
-      }
-      if(stampLayer){
-        let stamp = L.stamp(layer);
-        this._layers[stamp] = layer;
-      }
-    },
-
-    /**
-     * Creates paths for either mainParts, subParts or outline of a feature
-     * @param {Object} ring - The ring the current path is being generated for
-     * @param {string} title - The accessible aria-label of a path
-     * @param {string} cls - The class of the path
-     * @param {boolean} interactive - The boolean representing whether a feature is interactive or not
-     * @param {Object} attr - Attributes map
-     * @private
-     */
-    _createPath: function (ring, cls, title, interactive = false, attr = undefined) {
-      let p = L.SVG.create('path');
-      ring.path = p;
-      if(!attr) {
-        if (title) p.setAttribute('aria-label', title);
-      } else {
-        for(let [name, value] of Object.entries(attr)){
-          if(name === "id" || name === "tabindex") continue;
-          p.setAttribute(name, value);
-        }
-      }
-      if (ring.cls || cls) {
-        L.DomUtil.addClass(p, ring.cls || cls);
-      }
-      if (interactive) {
-        L.DomUtil.addClass(p, 'leaflet-interactive');
-      }
-    },
-
-    /**
-     * Adds all the paths needed for a feature
-     * @param {M.Feature} layer - The feature that needs it's paths added
-     * @param {HTMLElement} container - The location the paths need to be added to
-     * @param {boolean} interactive - Whether a feature is interactive or not
-     * @private
-     */
-    _addPath: function (layer, container = undefined, interactive = true) {
-      if (!this._rootGroup && !container) { this._initContainer(); }
-      let c = container || this._rootGroup, outlineAdded = false;
-      if(interactive) {
-        layer.addInteractiveTarget(layer.group);
-      }
-      for (let p of layer._parts) {
-        if (p.path)
-          layer.group.appendChild(p.path);
-        if (interactive){
-          if(layer.options.link) layer.attachLinkHandler(p.path, layer.options.link, layer.options._leafletLayer);
-          layer.addInteractiveTarget(p.path);
-        }
-
-        if(!outlineAdded && layer.pixelOutline) {
-          layer.group.appendChild(layer.outlinePath);
-          outlineAdded = true;
-        }
-
-        for (let subP of p.subrings) {
-          if (subP.path) {
-            if (subP.link){
-              layer.attachLinkHandler(subP.path, subP.link, layer.options._leafletLayer);
-              layer.addInteractiveTarget(subP.path);
-            }
-            layer.group.appendChild(subP.path);
-          }
-        }
-      }
-      c.appendChild(layer.group);
-    },
-
-    /**
-     * Removes all the paths related to a feature
-     * @param {M.Feature} layer - The feature who's paths need to be removed
-     * @private
-     */
-    _removePath: function (layer) {
-      for (let p of layer._parts) {
-        if (p.path) {
-          layer.removeInteractiveTarget(p.path);
-          L.DomUtil.remove(p.path);
-        }
-        for (let subP of p.subrings) {
-          if (subP.path)
-            L.DomUtil.remove(subP.path);
-        }
-      }
-      if(layer.outlinePath) L.DomUtil.remove(layer.outlinePath);
-      layer.removeInteractiveTarget(layer.group);
-      L.DomUtil.remove(layer.group);
-      delete this._layers[L.stamp(layer)];
-    },
-
-    /**
-     * Updates the d attribute of all paths of a feature
-     * @param {M.Feature} layer - The Feature that needs updating
-     * @private
-     */
-    _updateFeature: function (layer) {
-      if (layer.pixelOutline) this._setPath(layer.outlinePath, this.geometryToPath(layer.pixelOutline, false));
-      for (let p of layer._parts) {
-        this._setPath(p.path, this.geometryToPath(p.pixelRings, layer.isClosed));
-        for (let subP of p.subrings) {
-          this._setPath(subP.path, this.geometryToPath(subP.pixelSubrings, false));
-        }
-      }
-    },
-
-    /**
-     * Generates the marker d attribute for a given point
-     * @param {L.Point} p - The point of the marker
-     * @returns {string}
-     * @private
-     */
-    _pointToMarker: function (p) {
-      return `M${p.x} ${p.y} L${p.x - 12.5} ${p.y - 30} C${p.x - 12.5} ${p.y - 50}, ${p.x + 12.5} ${p.y - 50}, ${p.x + 12.5} ${p.y - 30} L${p.x} ${p.y}z`;
-    },
-
-    /**
-     * Updates the styles of all paths of a feature
-     * @param {M.Feature} layer - The feature that needs styles updated
-     * @private
-     */
-    _updateStyle: function (layer) {
-      this._updatePathStyle(layer.outlinePath, layer, false, true);
-      for (let p of layer._parts) {
-        if (p.path) {
-          this._updatePathStyle(p.path, layer, true);
-        }
-        for (let subP of p.subrings) {
-          if (subP.path)
-            this._updatePathStyle(subP.path, layer);
-        }
-      }
-    },
-
-    /**
-     * Updates the style of a single path
-     * @param {HTMLElement} path - The path that needs updating
-     * @param {M.Feature} layer - The feature layer
-     * @param {boolean} isMain - Whether it's the main parts or not
-     * @param {boolean} isOutline - Whether a path is an outline or not
-     * @private
-     */
-    _updatePathStyle: function (path, layer, isMain = false, isOutline = false) {
-      if (!path || !layer) { return; }
-      let options = layer.options, isClosed = layer.isClosed;
-      if ((options.stroke && (!isClosed || isOutline)) || (isMain && !layer.outlinePath)) {
-        path.setAttribute('stroke', options.color);
-        path.setAttribute('stroke-opacity', options.opacity);
-        path.setAttribute('stroke-width', options.weight);
-        path.setAttribute('stroke-linecap', options.lineCap);
-        path.setAttribute('stroke-linejoin', options.lineJoin);
-
-        if (options.dashArray) {
-          path.setAttribute('stroke-dasharray', options.dashArray);
-        } else {
-          path.removeAttribute('stroke-dasharray');
-        }
-
-        if (options.dashOffset) {
-          path.setAttribute('stroke-dashoffset', options.dashOffset);
-        } else {
-          path.removeAttribute('stroke-dashoffset');
-        }
-
-        if (options.link){
-          path.setAttribute("stroke", options.link.visited?"#6c00a2":"#0000EE");
-          path.setAttribute("stroke-opacity", "1");
-          path.setAttribute("stroke-width", "1px");
-          path.setAttribute("stroke-dasharray", "none");
-        }
-      } else {
-        path.setAttribute('stroke', 'none');
-      }
-
-      if(isClosed && !isOutline) {
-        if (!options.fill) {
-          path.setAttribute('fill', options.fillColor || options.color);
-          path.setAttribute('fill-opacity', options.fillOpacity);
-          path.setAttribute('fill-rule', options.fillRule || 'evenodd');
-        } else {
-          path.setAttribute('fill', options.color);
-        }
-      } else {
-        path.setAttribute('fill', 'none');
-      }
-    },
-
-    /**
-     * Sets the d attribute of a path
-     * @param {HTMLElement} path - The path that is being updated
-     * @param {string} def - The new d attribute of the path
-     * @private
-     */
-    _setPath: function (path, def) {
-      path.setAttribute('d', def);
-    },
-
-    /**
-     * Generates the d string of a feature part
-     * @param {L.Point[]} rings - The points making up a given part of a feature
-     * @param {boolean} closed - Whether a feature is closed or not
-     * @returns {string}
-     */
-    geometryToPath: function (rings, closed) {
-      let str = '', i, j, len, len2, points, p;
-
-      for (i = 0, len = rings.length; i < len; i++) {
-        points = rings[i];
-        if (points.length === 1) {
-          return this._pointToMarker(points[0]);
-        }
-        for (j = 0, len2 = points.length; j < len2; j++) {
-          p = points[j];
-          str += (j ? 'L' : 'M') + p.x + ' ' + p.y;
-        }
-        str += closed ? 'z' : '';
-      }
-      return str || 'M0 0';
-    },
-  });
-
-  /**
-   * Returns new M.FeatureRenderer
-   * @param {Object} options - Options for the renderer
-   * @returns {M.FeatureRenderer}
-   */
-  var featureRenderer = function (options) {
-    return new FeatureRenderer(options);
-  };
-
-  var FeatureGroup = L.FeatureGroup.extend({
-
-    /**
-     * Initialize the feature group
-     * @param {M.Feature[]} layers
-     * @param {Object} options
-     */
-    initialize: function (layers, options) {
-      if(options.wrappers && options.wrappers.length > 0)
-        options = Object.assign(M.Feature.prototype._convertWrappers(options.wrappers), options);
-
-      L.LayerGroup.prototype.initialize.call(this, layers, options);
-
-      if((this.options.onEachFeature && this.options.properties) || this.options.link) {
-        L.DomUtil.addClass(this.options.group, "leaflet-interactive");
-        L.DomEvent.on(this.options.group, "keyup keydown mousedown", this._handleFocus, this);
-        let firstLayer = layers[Object.keys(layers)[0]];
-        if(layers.length === 1 && firstLayer.options.link) this.options.link = firstLayer.options.link;
-        if(this.options.link){
-          M.Feature.prototype.attachLinkHandler.call(this, this.options.group, this.options.link, this.options._leafletLayer);
-          this.options.group.setAttribute('role', 'link');
-        } else {
-          this.options.group.setAttribute("aria-expanded", "false");
-          this.options.group.setAttribute('role', 'button');
-          this.options.onEachFeature(this.options.properties, this);
-          this.off("click", this._openPopup);
-        }
-      }
-
-      this.options.group.setAttribute('aria-label', this.options.accessibleTitle);
-      if(this.options.featureID) this.options.group.setAttribute("data-fid", this.options.featureID);
-    },
-
-    onAdd: function (map) {
-      L.LayerGroup.prototype.onAdd.call(this, map);
-      this.updateInteraction();
-    },
-
-    updateInteraction: function () {
-      let map = this._map || this.options._leafletLayer._map;
-      if((this.options.onEachFeature && this.options.properties) || this.options.link)
-        map.featureIndex.addToIndex(this, this.getPCRSCenter(), this.options.group);
-
-      for (let layerID in this._layers) {
-        let layer = this._layers[layerID];
-        for(let part of layer._parts){
-          if(layer.featureAttributes && layer.featureAttributes.tabindex)
-            map.featureIndex.addToIndex(layer, layer.getPCRSCenter(), part.path);
-          for(let subPart of part.subrings) {
-            if(subPart.attr && subPart.attr.tabindex) map.featureIndex.addToIndex(layer, subPart.center, subPart.path);
-          }
-        }
-      }
-    },
-
-    /**
-     * Handler for focus events
-     * @param {L.DOMEvent} e - Event that occurred
-     * @private
-     */
-    _handleFocus: function(e) {
-      if((e.keyCode === 9 || e.keyCode === 16) && e.type === "keydown"){
-        let index = this._map.featureIndex.currentIndex;
-        if(e.keyCode === 9 && e.shiftKey) {
-          if(index === this._map.featureIndex.inBoundFeatures.length - 1)
-            this._map.featureIndex.inBoundFeatures[index].path.setAttribute("tabindex", -1);
-          if(index !== 0){
-            L.DomEvent.stop(e);
-            this._map.featureIndex.inBoundFeatures[index - 1].path.focus();
-            this._map.featureIndex.currentIndex--;
-          }
-        } else if (e.keyCode === 9) {
-          if(index !== this._map.featureIndex.inBoundFeatures.length - 1) {
-            L.DomEvent.stop(e);
-            this._map.featureIndex.inBoundFeatures[index + 1].path.focus();
-            this._map.featureIndex.currentIndex++;
-          } else {
-            this._map.featureIndex.inBoundFeatures[0].path.setAttribute("tabindex", -1);
-            this._map.featureIndex.inBoundFeatures[index].path.setAttribute("tabindex", 0);
-          }
-        }
-      } else if (!(e.keyCode === 9 || e.keyCode === 16 || e.keyCode === 13)){
-        this._map.featureIndex.currentIndex = 0;
-        this._map.featureIndex.inBoundFeatures[0].path.focus();
-      }
-
-      if(e.target.tagName.toUpperCase() !== "G") return;
-      if((e.keyCode === 9 || e.keyCode === 16 || e.keyCode === 13) && e.type === "keyup") {
-        this.openTooltip();
-      } else if (e.keyCode === 13 || e.keyCode === 32){
-        this.closeTooltip();
-        if(!this.options.link && this.options.onEachFeature){
-          L.DomEvent.stop(e);
-          this.openPopup();
-        }
-      } else {
-        this.closeTooltip();
-      }
-    },
-
-    /**
-     * Add a M.Feature to the M.FeatureGroup
-     * @param layer
-     */
-    addLayer: function (layer) {
-      if(!layer.options.link && layer.options.interactive) {
-        this.options.onEachFeature(this.options.properties, layer);
-      }
-      L.FeatureGroup.prototype.addLayer.call(this, layer);
-    },
-
-    /**
-     * Focuses the previous function in the sequence on previous button press
-     * @param e
-     * @private
-     */
-    _previousFeature: function(e){
-      L.DomEvent.stop(e);
-      this._map.featureIndex.currentIndex = Math.max(this._map.featureIndex.currentIndex - 1, 0);
-      let prevFocus = this._map.featureIndex.inBoundFeatures[this._map.featureIndex.currentIndex];
-      prevFocus.path.focus();
-      this._map.closePopup();
-    },
-
-    /**
-     * Focuses next feature in sequence
-     * @param e
-     * @private
-     */
-    _nextFeature: function(e){
-      L.DomEvent.stop(e);
-      this._map.featureIndex.currentIndex = Math.min(this._map.featureIndex.currentIndex + 1, this._map.featureIndex.inBoundFeatures.length - 1);
-      let nextFocus = this._map.featureIndex.inBoundFeatures[this._map.featureIndex.currentIndex];
-      nextFocus.path.focus();
-      this._map.closePopup();
-    },
-
-    getPCRSCenter: function () {
-      let bounds;
-      for(let l in this._layers){
-        let layer = this._layers[l];
-        if (!bounds) {
-          bounds = L.bounds(layer.getPCRSCenter(), layer.getPCRSCenter());
-        } else {
-          bounds.extend(layer.getPCRSCenter());
-        }
-      }
-      return bounds.getCenter();
-    },
-  });
-
-  /**
-   * Returns new M.FeatureGroup
-   * @param {M.Feature[]} layers - Layers belonging to feature group
-   * @param {Object} options - Options for the feature group
-   * @returns {M.FeatureGroup}
-   */
-  var featureGroup = function (layers, options) {
-    return new FeatureGroup(layers, options);
-  };
-
-  var AnnounceMovement = L.Handler.extend({
-      addHooks: function () {
-          this._map.on({
-              layeradd: this.totalBounds,
-              layerremove: this.totalBounds,
-          });
-
-          this._map.options.mapEl.addEventListener('moveend', this.announceBounds);
-          this._map.dragging._draggable.addEventListener('dragstart', this.dragged);
-          this._map.options.mapEl.addEventListener('mapfocused', this.focusAnnouncement);
-      },
-      removeHooks: function () {
-          this._map.off({
-              layeradd: this.totalBounds,
-              layerremove: this.totalBounds,
-          });
-
-          this._map.options.mapEl.removeEventListener('moveend', this.announceBounds);
-          this._map.dragging._draggable.removeEventListener('dragstart', this.dragged);
-          this._map.options.mapEl.removeEventListener('mapfocused', this.focusAnnouncement);
-      },
-
-       focusAnnouncement: function () {
-           let mapEl = this;
-           setTimeout(function (){
-               let el = mapEl.querySelector(".mapml-web-map") ? mapEl.querySelector(".mapml-web-map").shadowRoot.querySelector(".leaflet-container") :
-                   mapEl.shadowRoot.querySelector(".leaflet-container");
-
-               let mapZoom = mapEl._map.getZoom();
-               let location = M.gcrsToTileMatrix(mapEl);
-               let standard = M.options.locale.amZoom + " " + mapZoom + " " + M.options.locale.amColumn + " " + location[0] + " " + M.options.locale.amRow + " " + location[1];
-
-               if(mapZoom === mapEl._map._layersMaxZoom){
-                   standard = M.options.locale.amMaxZoom + " " + standard;
-               }
-               else if(mapZoom === mapEl._map._layersMinZoom){
-                   standard = M.options.locale.amMinZoom + " " + standard;
-               }
-
-               el.setAttribute("aria-roledescription", "region " + standard);
-               setTimeout(function () {
-                   el.removeAttribute("aria-roledescription");
-               }, 2000);
-           }, 0);
-       },
-
-      announceBounds: function () {
-          if(this._traversalCall > 0){
-              return;
-          }
-          let mapZoom = this._map.getZoom();
-          let mapBounds = M.pixelToPCRSBounds(this._map.getPixelBounds(),mapZoom,this._map.options.projection);
-
-          let visible = true;
-          if(this._map.totalLayerBounds){
-              visible = mapZoom <= this._map._layersMaxZoom && mapZoom >= this._map._layersMinZoom &&
-                  this._map.totalLayerBounds.overlaps(mapBounds);
-          }
-
-          let output = this.querySelector(".mapml-web-map") ? this.querySelector(".mapml-web-map").shadowRoot.querySelector(".mapml-screen-reader-output") :
-              this.shadowRoot.querySelector(".mapml-screen-reader-output");
-
-          //GCRS to TileMatrix
-          let location = M.gcrsToTileMatrix(this);
-          let standard = M.options.locale.amZoom + " " + mapZoom + " " + M.options.locale.amColumn + " " + location[0] + " " + M.options.locale.amRow + " " + location[1];
-
-          if(!visible){
-              let outOfBoundsPos = this._history[this._historyIndex];
-              let inBoundsPos = this._history[this._historyIndex - 1];
-              this.back();
-              this._history.pop();
-
-              if(outOfBoundsPos.zoom !== inBoundsPos.zoom){
-                  output.innerText = M.options.locale.amZoomedOut;
-              }
-              else if(this._map.dragging._draggable.wasDragged){
-                  output.innerText = M.options.locale.amDraggedOut;
-              }
-              else if(outOfBoundsPos.x > inBoundsPos.x){
-                  output.innerText = M.options.locale.amEastBound;
-              }
-              else if(outOfBoundsPos.x < inBoundsPos.x){
-                  output.innerText = M.options.locale.amWestBound;
-              }
-              else if(outOfBoundsPos.y < inBoundsPos.y){
-                  output.innerText = M.options.locale.amNorthBound;
-              }
-              else if(outOfBoundsPos.y > inBoundsPos.y){
-                  output.innerText = M.options.locale.amSouthBound;
-              }
-
-          }
-          else {
-              let prevZoom = this._history[this._historyIndex - 1] ? this._history[this._historyIndex - 1].zoom : this._history[this._historyIndex].zoom;
-              if(mapZoom === this._map._layersMaxZoom && mapZoom !== prevZoom){
-                  output.innerText = M.options.locale.amMaxZoom + " " + standard;
-              }
-              else if(mapZoom === this._map._layersMinZoom && mapZoom !== prevZoom){
-                  output.innerText = M.options.locale.amMinZoom + " " + standard;
-              }
-              else {
-                  output.innerText = standard;
-              }
-          }
-          this._map.dragging._draggable.wasDragged = false;
-      },
-
-      totalBounds: function () {
-          let layers = Object.keys(this._layers);
-          let bounds = L.bounds();
-
-          layers.forEach(i => {
-              if(this._layers[i].layerBounds){
-                  if(!bounds){
-                      let point = this._layers[i].layerBounds.getCenter();
-                      bounds = L.bounds(point, point);
-                  }
-                  bounds.extend(this._layers[i].layerBounds.min);
-                  bounds.extend(this._layers[i].layerBounds.max);
-              }
-          });
-
-          this.totalLayerBounds = bounds;
-      },
-
-      dragged: function () {
-          this.wasDragged = true;
-      }
-
-  });
-
-  var FeatureIndex = L.Handler.extend({
-    initialize: function (map) {
-      L.Handler.prototype.initialize.call(this, map);
-      this.inBoundFeatures = [];
-      this.outBoundFeatures = [];
-      this.currentIndex = 0;
-      this._mapPCRSBounds = M.pixelToPCRSBounds(
-        map.getPixelBounds(),
-        map.getZoom(),
-        map.options.projection);
-    },
-
-    addHooks: function () {
-      this._map.on("mapkeyboardfocused", this._updateMapBounds, this);
-      this._map.on('mapkeyboardfocused', this._sortIndex, this);
-    },
-
-    removeHooks: function () {
-      this._map.off("mapkeyboardfocused", this._updateMapBounds);
-      this._map.off('mapkeyboardfocused', this._sortIndex);
-    },
-
-    /**
-     * Adds a svg element to the index of tabbable features, it also keeps track of the layer it's associated + center
-     * @param layer - the layer object the feature is associated with
-     * @param lc - the layer center
-     * @param path - the svg element that needs to be focused, can be a path or g
-     */
-    addToIndex: function (layer, lc, path) {
-      let mc = this._mapPCRSBounds.getCenter();
-      let dist = Math.sqrt(Math.pow(lc.x - mc.x, 2) + Math.pow(lc.y - mc.y, 2));
-      let index = this._mapPCRSBounds.contains(lc) ? this.inBoundFeatures : this.outBoundFeatures;
-
-      let elem = {path: path, layer: layer, center: lc, dist: dist};
-      path.setAttribute("tabindex", -1);
-
-      index.push(elem);
-
-      // TODO: this insertion loop has potential to be improved slightly
-      for (let i = index.length - 1; i > 0 && index[i].dist < index[i-1].dist; i--) {
-        let tmp = index[i];
-        index[i] = index[i-1];
-        index[i-1] = tmp;
-      }
-
-      if (this._mapPCRSBounds.contains(lc))
-        this.inBoundFeatures = index;
-      else
-        this.outBoundFeatures = index;
-    },
-
-    /**
-     * Removes features that are no longer on the map, also moves features to the respective array depending
-     * on whether the feature is in the maps viewport or not
-     */
-    cleanIndex: function() {
-      this.currentIndex = 0;
-      this.inBoundFeatures = this.inBoundFeatures.filter((elem) => {
-        let inbound = this._mapPCRSBounds.contains(elem.center);
-        elem.path.setAttribute("tabindex", -1);
-        if (elem.layer._map && !inbound) {
-          this.outBoundFeatures.push(elem);
-        }
-        return elem.layer._map && inbound;
-      });
-      this.outBoundFeatures = this.outBoundFeatures.filter((elem) => {
-        let inbound = this._mapPCRSBounds.contains(elem.center);
-        elem.path.setAttribute("tabindex", -1);
-        if (elem.layer._map && inbound) {
-          this.inBoundFeatures.push(elem);
-        }
-        return elem.layer._map && !inbound;
-      });
-    },
-
-    /**
-     * Sorts the index of features in the map's viewport based on distance from center
-     * @private
-     */
-    _sortIndex: function() {
-      this.cleanIndex();
-      if(this.inBoundFeatures.length === 0) return;
-
-      let mc = this._mapPCRSBounds.getCenter();
-
-      this.inBoundFeatures.sort(function(a, b) {
-        let ac = a.center;
-        let bc = b.center;
-        a.dist = Math.sqrt(Math.pow(ac.x - mc.x, 2) + Math.pow(ac.y - mc.y, 2));
-        b.dist = Math.sqrt(Math.pow(bc.x - mc.x, 2) + Math.pow(bc.y - mc.y, 2));
-        return a.dist - b.dist;
-      });
-
-      this.inBoundFeatures[0].path.setAttribute("tabindex", 0);
-    },
-
-    /**
-     * Event handler for 'mapfocused' event to update the map's bounds in terms of PCRS
-     * @param e - the event object
-     * @private
-     */
-    _updateMapBounds: function (e) {
-      // TODO: map's PCRS bounds is used in other parts of the viewer, can be moved out to the map object directly
-      this._mapPCRSBounds = M.pixelToPCRSBounds(
-        this._map.getPixelBounds(),
-        this._map.getZoom(),
-        this._map.options.projection);
-    },
-  });
-
-  var Options = {
-    announceMovement: false,
-    locale: {
-      cmBack: "Back",
-      cmForward: "Forward",
-      cmReload: "Reload",
-      cmToggleControls: "Toggle Controls",
-      cmCopyCoords: "Copy Coordinates",
-      cmToggleDebug: "Toggle Debug Mode",
-      cmCopyMapML: "Copy MapML",
-      cmViewSource: "View Map Source",
-      cmCopyAll: "All",
-      lmZoomToLayer: "Zoom To Layer",
-      lmCopyExtent: "Copy Extent",
-      lcOpacity: "Opacity",
-      btnZoomIn: "Zoom in",
-      btnZoomOut: "Zoom out",
-      btnFullScreen: "View fullscreen",
-      amZoom: "zoom level",
-      amColumn: "column",
-      amRow: "row",
-      amMaxZoom: "At maximum zoom level, zoom in disabled",
-      amMinZoom: "At minimum zoom level, zoom out disabled",
-      amZoomedOut: "Zoomed out of bounds, returning to",
-      amDraggedOut: "Dragged out of bounds, returning to",
-      amEastBound: "Reached east bound, panning east disabled",
-      amWestBound: "Reached west bound, panning west disabled",
-      amNorthBound: "Reached north bound, panning north disabled",
-      amSouthBound: "Reached south bound, panning south disabled"
-    }
-  };
-
-  L.Map.Keyboard.include({
-      _onKeyDown: function (e) {
-
-          if (e.altKey || e.metaKey) { return; }
-
-          let zoomIn = {
-              187: 187,
-              107: 107,
-              61: 61,
-              171: 171
-          };
-
-          let zoomOut = {
-              189: 189,
-              109: 109,
-              54: 54,
-              173: 173
-          };
-
-          var key = e.keyCode,
-              map = this._map,
-              offset;
-
-          if (key in this._panKeys) {
-              if (!map._panAnim || !map._panAnim._inProgress) {
-                  offset = this._panKeys[key];
-                  if (e.shiftKey) {
-                      offset = L.point(offset).multiplyBy(3);
-                  }
-                  if (e.ctrlKey) {
-                      offset = L.point(offset).divideBy(5);
-                  }
-
-                  map.panBy(offset);
-
-                  if (map.options.maxBounds) {
-                      map.panInsideBounds(map.options.maxBounds);
-                  }
-              }
-          } else if (key in this._zoomKeys) {
-              if((key in zoomIn && map._layersMaxZoom !== map.getZoom()) || (key in zoomOut && map._layersMinZoom !== map.getZoom()))
-                  map.setZoom(map.getZoom() + (e.shiftKey ? 3 : 1) * this._zoomKeys[key]);
-
-          } else if (key === 27 && map._popup && map._popup.options.closeOnEscapeKey) {
-              map.closePopup();
-
-          } else {
-              return;
-          }
-
-          L.DomEvent.stop(e);
-      }
-  });
-
-  /* 
-   * Copyright 2015-2016 Canada Centre for Mapping and Earth Observation, 
-   * Earth Sciences Sector, Natural Resources Canada.
-   * 
-   * License
-   * 
-   * By obtaining and/or copying this work, you (the licensee) agree that you have 
-   * read, understood, and will comply with the following terms and conditions.
-   * 
-   * Permission to copy, modify, and distribute this work, with or without 
-   * modification, for any purpose and without fee or royalty is hereby granted, 
-   * provided that you include the following on ALL copies of the work or portions 
-   * thereof, including modifications:
-   * 
-   * The full text of this NOTICE in a location viewable to users of the 
-   * redistributed or derivative work.
-   * 
-   * Any pre-existing intellectual property disclaimers, notices, or terms and 
-   * conditions. If none exist, the W3C Software and Document Short Notice should 
-   * be included.
-   * 
-   * Notice of any changes or modifications, through a copyright statement on the 
-   * new code or document such as "This software or document includes material 
-   * copied from or derived from [title and URI of the W3C document]. 
-   * Copyright © [YEAR] W3C® (MIT, ERCIM, Keio, Beihang)."
-   * 
-   * Disclaimers
-   * 
-   * THIS WORK IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS 
-   * OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF 
-   * MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE 
-   * SOFTWARE OR DOCUMENT WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, 
-   * TRADEMARKS OR OTHER RIGHTS.
-   * COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR 
-   * CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENT.
-   * 
-   * The name and trademarks of copyright holders may NOT be used in advertising or 
-   * publicity pertaining to the work without specific, written prior permission. 
-   * Title to copyright in this work will at all times remain with copyright holders.
-   */
-
-  /* global L, Node */
-  (function (window, document, undefined$1) {
-    
-  var M = {};
-  window.M = M;
-
-  (function () {
-    M.detectImagePath = function (container) {
-      // this relies on the CSS style leaflet-default-icon-path containing a 
-      // relative url() that leads to a valid icon file.  Since that depends on
-      // how all of this stuff is deployed (i.e. custom element or as leaflet-plugin)
-      // also, because we're using 'shady DOM' api, the container must be 
-      // a shady dom container, because the custom element tags it with added
-      // style-scope ... and related classes.
-     var el = L.DomUtil.create('div',  'leaflet-default-icon-path', container);
-     var path = L.DomUtil.getStyle(el, 'background-image') ||
-                L.DomUtil.getStyle(el, 'backgroundImage');	// IE8
-
-     container.removeChild(el);
-
-     if (path === null || path.indexOf('url') !== 0) {
-      path = '';
-     } else {
-      path = path.replace(/^url\(["']?/, '').replace(/marker-icon\.png["']?\)$/, '');
-     }
-
-     return path;
-    };
-    M.mime = "text/mapml";
-
-    let mapOptions = window.document.head.querySelector("map-options");
-    M.options = Options;
-    if (mapOptions) M.options = Object.assign(M.options, JSON.parse(mapOptions.innerHTML));
-
-    // see https://leafletjs.com/reference-1.5.0.html#crs-l-crs-base
-    // "new classes can't inherit from (L.CRS), and methods can't be added 
-    // to (L.CRS.anything) with the include function
-    // so we'll use the options property as a way to integrate needed 
-    // properties and methods...
-    M.WGS84 = new L.Proj.CRS('EPSG:4326','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs ', {
-      origin: [-180,+90],
-      bounds: L.bounds([[-180,-90],[180,90]]),
-      resolutions: [
-        0.703125,
-        0.3515625,
-        0.17578125,
-        0.087890625,
-        0.0439453125,
-        0.02197265625,
-        0.010986328125,
-        0.0054931640625,
-        0.00274658203125,
-        0.001373291015625,
-        0.0006866455078125,
-        0.0003433227539062,
-        0.0001716613769531,
-        0.0000858306884766,
-        0.0000429153442383,
-        0.0000214576721191,
-        0.0000107288360596,
-        0.0000053644180298,
-        0.0000026822090149,
-        0.0000013411045074,
-        0.0000006705522537,
-        0.0000003352761269
-      ],
-      crs: {
-        tcrs: {
-          horizontal: {
-            name: "x",
-            min: 0, 
-            max: zoom => (M.WGS84.options.bounds.getSize().x / M.WGS84.options.resolutions[zoom]).toFixed()
-          },
-          vertical: {
-            name: "y",
-            min:0, 
-            max: zoom => (M.WGS84.options.bounds.getSize().y / M.WGS84.options.resolutions[zoom]).toFixed()
-          },
-          bounds: zoom => L.bounds([M.WGS84.options.crs.tcrs.horizontal.min,
-                            M.WGS84.options.crs.tcrs.vertical.min],
-                           [M.WGS84.options.crs.tcrs.horizontal.max(zoom),
-                            M.WGS84.options.crs.tcrs.vertical.max(zoom)])
-        },
-        pcrs: {
-          horizontal: {
-            name: "longitude",
-            get min() {return M.WGS84.options.crs.gcrs.horizontal.min;},
-            get max() {return M.WGS84.options.crs.gcrs.horizontal.max;}
-          }, 
-          vertical: {
-            name: "latitude", 
-            get min() {return M.WGS84.options.crs.gcrs.vertical.min;},
-            get max() {return M.WGS84.options.crs.gcrs.vertical.max;}
-          },
-          get bounds() {return M.WGS84.options.bounds;}
-        }, 
-        gcrs: {
-          horizontal: {
-            name: "longitude",
-            // set min/max axis values from EPSG registry area of use, retrieved 2019-07-25
-            min: -180.0,
-            max: 180.0
-          }, 
-          vertical: {
-            name: "latitude",
-            // set min/max axis values from EPSG registry area of use, retrieved 2019-07-25
-            min: -90.0,
-            max: 90.0
-          },
-          get bounds() {return L.latLngBounds(
-                [M.WGS84.options.crs.gcrs.vertical.min,M.WGS84.options.crs.gcrs.horizontal.min],
-                [M.WGS84.options.crs.gcrs.vertical.max,M.WGS84.options.crs.gcrs.horizontal.max]);}
-        },
-        map: {
-          horizontal: {
-            name: "i",
-            min: 0,
-            max: map => map.getSize().x
-          },
-          vertical: {
-            name: "j",
-            min: 0,
-            max: map => map.getSize().y
-          },
-          bounds: map => L.bounds(L.point([0,0]),map.getSize())
-        },
-        tile: {
-          horizontal: {
-            name: "i",
-            min: 0,
-            max: 256
-          },
-          vertical: {
-            name: "j",
-            min: 0,
-            max: 256
-          },
-          get bounds() {return L.bounds(
-                    [M.WGS84.options.crs.tile.horizontal.min,M.WGS84.options.crs.tile.vertical.min],
-                    [M.WGS84.options.crs.tile.horizontal.max,M.WGS84.options.crs.tile.vertical.max]);}
-        },
-        tilematrix: {
-          horizontal: {
-            name: "column",
-            min: 0,
-            max: zoom => (M.WGS84.options.crs.tcrs.horizontal.max(zoom) / M.WGS84.options.crs.tile.bounds.getSize().x).toFixed()
-          },
-          vertical: {
-            name: "row",
-            min: 0,
-            max: zoom => (M.WGS84.options.crs.tcrs.vertical.max(zoom) / M.WGS84.options.crs.tile.bounds.getSize().y).toFixed()
-          },
-          bounds: zoom => L.bounds(
-                   [M.WGS84.options.crs.tilematrix.horizontal.min,
-                    M.WGS84.options.crs.tilematrix.vertical.min],
-                   [M.WGS84.options.crs.tilematrix.horizontal.max(zoom),
-                    M.WGS84.options.crs.tilematrix.vertical.max(zoom)])
-        }
-      }
-    });
-    M.CBMTILE = new L.Proj.CRS('EPSG:3978',
-    '+proj=lcc +lat_1=49 +lat_2=77 +lat_0=49 +lon_0=-95 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs', {
-      origin: [-34655800, 39310000],
-      bounds: L.bounds([[-34655800,-39000000],[10000000,39310000]]),
-      resolutions: [
-        38364.660062653464, 
-        22489.62831258996, 
-        13229.193125052918, 
-        7937.5158750317505, 
-        4630.2175937685215, 
-        2645.8386250105837,
-        1587.5031750063501,
-        926.0435187537042, 
-        529.1677250021168, 
-        317.50063500127004, 
-        185.20870375074085, 
-        111.12522225044451, 
-        66.1459656252646, 
-        38.36466006265346, 
-        22.48962831258996,
-        13.229193125052918,
-        7.9375158750317505, 
-        4.6302175937685215,
-        2.6458386250105836,
-        1.5875031750063502,
-        0.92604351875370428,
-        0.52916772500211673,
-        0.31750063500127002,
-        0.18520870375074083,
-        0.11112522225044451,
-        0.066145965625264591
-      ],
-      crs: {
-        tcrs: {
-          horizontal: {
-            name: "x",
-            min: 0, 
-            max: zoom => (M.CBMTILE.options.bounds.getSize().x / M.CBMTILE.options.resolutions[zoom]).toFixed()
-          },
-          vertical: {
-            name: "y",
-            min:0, 
-            max: zoom => (M.CBMTILE.options.bounds.getSize().y / M.CBMTILE.options.resolutions[zoom]).toFixed()
-          },
-          bounds: zoom => L.bounds([M.CBMTILE.options.crs.tcrs.horizontal.min,
-                            M.CBMTILE.options.crs.tcrs.vertical.min],
-                           [M.CBMTILE.options.crs.tcrs.horizontal.max(zoom),
-                            M.CBMTILE.options.crs.tcrs.vertical.max(zoom)])
-        },
-        pcrs: {
-          horizontal: {
-            name: "easting",
-            get min() {return M.CBMTILE.options.bounds.min.x;},
-            get max() {return M.CBMTILE.options.bounds.max.x;}
-          }, 
-          vertical: {
-            name: "northing", 
-            get min() {return M.CBMTILE.options.bounds.min.y;},
-            get max() {return M.CBMTILE.options.bounds.max.y;}
-          },
-          get bounds() {return M.CBMTILE.options.bounds;}
-        }, 
-        gcrs: {
-          horizontal: {
-            name: "longitude",
-            // set min/max axis values from EPSG registry area of use, retrieved 2019-07-25
-            min: -141.01,
-            max: -47.74
-          }, 
-          vertical: {
-            name: "latitude",
-            // set min/max axis values from EPSG registry area of use, retrieved 2019-07-25
-            min: 40.04,
-            max: 86.46
-          },
-          get bounds() {return L.latLngBounds(
-                [M.CBMTILE.options.crs.gcrs.vertical.min,M.CBMTILE.options.crs.gcrs.horizontal.min],
-                [M.CBMTILE.options.crs.gcrs.vertical.max,M.CBMTILE.options.crs.gcrs.horizontal.max]);}
-        },
-        map: {
-          horizontal: {
-            name: "i",
-            min: 0,
-            max: map => map.getSize().x
-          },
-          vertical: {
-            name: "j",
-            min: 0,
-            max: map => map.getSize().y
-          },
-          bounds: map => L.bounds(L.point([0,0]),map.getSize())
-        },
-        tile: {
-          horizontal: {
-            name: "i",
-            min: 0,
-            max: 256
-          },
-          vertical: {
-            name: "j",
-            min: 0,
-            max: 256
-          },
-          get bounds() {return L.bounds(
-                    [M.CBMTILE.options.crs.tile.horizontal.min,M.CBMTILE.options.crs.tile.vertical.min],
-                    [M.CBMTILE.options.crs.tile.horizontal.max,M.CBMTILE.options.crs.tile.vertical.max]);}
-        },
-        tilematrix: {
-          horizontal: {
-            name: "column",
-            min: 0,
-            max: zoom => (M.CBMTILE.options.crs.tcrs.horizontal.max(zoom) / M.CBMTILE.options.crs.tile.bounds.getSize().x).toFixed()
-          },
-          vertical: {
-            name: "row",
-            min: 0,
-            max: zoom => (M.CBMTILE.options.crs.tcrs.vertical.max(zoom) / M.CBMTILE.options.crs.tile.bounds.getSize().y).toFixed()
-          },
-          bounds: zoom => L.bounds([0,0],
-                   [M.CBMTILE.options.crs.tilematrix.horizontal.max(zoom),
-                    M.CBMTILE.options.crs.tilematrix.vertical.max(zoom)])
-        }
-      }
-    });
-    M.APSTILE = new L.Proj.CRS('EPSG:5936',
-    '+proj=stere +lat_0=90 +lat_ts=50 +lon_0=-150 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m +no_defs', {
-      origin: [-2.8567784109255E7, 3.2567784109255E7],
-      bounds: L.bounds([[-28567784.109254867,-28567784.109254755],[32567784.109255023,32567784.10925506]]),
-      resolutions: [
-        238810.813354,
-        119405.406677,
-        59702.7033384999,
-        29851.3516692501,
-        14925.675834625,
-        7462.83791731252,
-        3731.41895865639,
-        1865.70947932806,
-        932.854739664032,
-        466.427369832148,
-        233.213684916074,
-        116.606842458037,
-        58.3034212288862,
-        29.1517106145754,
-        14.5758553072877,
-        7.28792765351156,
-        3.64396382688807,
-        1.82198191331174,
-        0.910990956788164,
-        0.45549547826179
-      ],
-      crs: {
-        tcrs: {
-          horizontal: {
-            name: "x",
-            min: 0, 
-            max: zoom => (M.APSTILE.options.bounds.getSize().x / M.APSTILE.options.resolutions[zoom]).toFixed()
-          },
-          vertical: {
-            name: "y",
-            min:0, 
-            max: zoom => (M.APSTILE.options.bounds.getSize().y / M.APSTILE.options.resolutions[zoom]).toFixed()
-          },
-          bounds: zoom => L.bounds([M.APSTILE.options.crs.tcrs.horizontal.min,
-                            M.APSTILE.options.crs.tcrs.vertical.min],
-                           [M.APSTILE.options.crs.tcrs.horizontal.max(zoom),
-                            M.APSTILE.options.crs.tcrs.vertical.max(zoom)])
-        },
-        pcrs: {
-          horizontal: {
-            name: "easting",
-            get min() {return M.APSTILE.options.bounds.min.x;},
-            get max() {return M.APSTILE.options.bounds.max.x;}
-          }, 
-          vertical: {
-            name: "northing", 
-            get min() {return M.APSTILE.options.bounds.min.y;},
-            get max() {return M.APSTILE.options.bounds.max.y;}
-          },
-          get bounds() {return M.APSTILE.options.bounds;}
-        }, 
-        gcrs: {
-          horizontal: {
-            name: "longitude",
-            // set min/max axis values from EPSG registry area of use, retrieved 2019-07-25
-            min: -180.0,
-            max: 180.0
-          }, 
-          vertical: {
-            name: "latitude",
-            // set min/max axis values from EPSG registry area of use, retrieved 2019-07-25
-            min: 60.0,
-            max: 90.0
-          },
-          get bounds() {return L.latLngBounds(
-                    [M.APSTILE.options.crs.gcrs.vertical.min,M.APSTILE.options.crs.gcrs.horizontal.min],
-                    [M.APSTILE.options.crs.gcrs.vertical.max,M.APSTILE.options.crs.gcrs.horizontal.max]);}
-        },
-        map: {
-          horizontal: {
-            name: "i",
-            min: 0,
-            max: map => map.getSize().x
-          },
-          vertical: {
-            name: "j",
-            min: 0,
-            max: map => map.getSize().y
-          },
-          bounds: map => L.bounds(L.point([0,0]),map.getSize())
-        },
-        tile: {
-          horizontal: {
-            name: "i",
-            min: 0,
-            max: 256
-          },
-          vertical: {
-            name: "j",
-            min: 0,
-            max: 256
-          },
-          get bounds() {return L.bounds(
-                    [M.APSTILE.options.crs.tile.horizontal.min,M.APSTILE.options.crs.tile.vertical.min],
-                    [M.APSTILE.options.crs.tile.horizontal.max,M.APSTILE.options.crs.tile.vertical.max]);}
-        },
-        tilematrix: {
-          horizontal: {
-            name: "column",
-            min: 0,
-            max: zoom => (M.APSTILE.options.crs.tcrs.horizontal.max(zoom) / M.APSTILE.options.crs.tile.bounds.getSize().x).toFixed()
-          },
-          vertical: {
-            name: "row",
-            min: 0,
-            max: zoom => (M.APSTILE.options.crs.tcrs.vertical.max(zoom) / M.APSTILE.options.crs.tile.bounds.getSize().y).toFixed()
-          },
-          bounds: zoom => L.bounds([0,0],
-                   [M.APSTILE.options.crs.tilematrix.horizontal.max(zoom),
-                    M.APSTILE.options.crs.tilematrix.vertical.max(zoom)])
-        }
-      }
-    });
-    M.OSMTILE = L.CRS.EPSG3857;
-    L.setOptions(M.OSMTILE, {
-      origin: [-20037508.342787, 20037508.342787],
-      bounds: L.bounds([[-20037508.342787, -20037508.342787],[20037508.342787, 20037508.342787]]),
-      resolutions: [
-        156543.0339,
-        78271.51695,
-        39135.758475,
-        19567.8792375,
-        9783.93961875,
-        4891.969809375,
-        2445.9849046875,
-        1222.9924523438,
-        611.49622617188,
-        305.74811308594,
-        152.87405654297,
-        76.437028271484,
-        38.218514135742,
-        19.109257067871,
-        9.5546285339355,
-        4.7773142669678,
-        2.3886571334839,
-        1.1943285667419,
-        0.59716428337097,
-        0.29858214168549,
-        0.14929107084274,
-        0.074645535421371,
-        0.03732276771068573,
-        0.018661383855342865,
-        0.009330691927671432495
-      ],
-      crs: {
-        tcrs: {
-          horizontal: {
-            name: "x",
-            min: 0, 
-            max: zoom => (M.OSMTILE.options.bounds.getSize().x / M.OSMTILE.options.resolutions[zoom]).toFixed()
-          },
-          vertical: {
-            name: "y",
-            min:0, 
-            max: zoom => (M.OSMTILE.options.bounds.getSize().y / M.OSMTILE.options.resolutions[zoom]).toFixed()
-          },
-          bounds: zoom => L.bounds([M.OSMTILE.options.crs.tcrs.horizontal.min,
-                            M.OSMTILE.options.crs.tcrs.vertical.min],
-                           [M.OSMTILE.options.crs.tcrs.horizontal.max(zoom),
-                            M.OSMTILE.options.crs.tcrs.vertical.max(zoom)])
-        },
-        pcrs: {
-          horizontal: {
-            name: "easting",
-            get min() {return M.OSMTILE.options.bounds.min.x;},
-            get max() {return M.OSMTILE.options.bounds.max.x;}
-          }, 
-          vertical: {
-            name: "northing", 
-            get min() {return M.OSMTILE.options.bounds.min.y;},
-            get max() {return M.OSMTILE.options.bounds.max.y;}
-          },
-          get bounds() {return M.OSMTILE.options.bounds;}
-        }, 
-        gcrs: {
-          horizontal: {
-            name: "longitude",
-            get min() {return M.OSMTILE.unproject(M.OSMTILE.options.bounds.min).lng;},
-            get max() {return M.OSMTILE.unproject(M.OSMTILE.options.bounds.max).lng;}
-          }, 
-          vertical: {
-            name: "latitude",
-            get min() {return M.OSMTILE.unproject(M.OSMTILE.options.bounds.min).lat;},
-            get max() {return M.OSMTILE.unproject(M.OSMTILE.options.bounds.max).lat;}
-          },
-          get bounds() {return L.latLngBounds(
-                [M.OSMTILE.options.crs.gcrs.vertical.min,M.OSMTILE.options.crs.gcrs.horizontal.min],
-                [M.OSMTILE.options.crs.gcrs.vertical.max,M.OSMTILE.options.crs.gcrs.horizontal.max]);}
-        },
-        map: {
-          horizontal: {
-            name: "i",
-            min: 0,
-            max: map => map.getSize().x
-          },
-          vertical: {
-            name: "j",
-            min: 0,
-            max: map => map.getSize().y
-          },
-          bounds: map => L.bounds(L.point([0,0]),map.getSize())
-        },
-        tile: {
-          horizontal: {
-            name: "i",
-            min: 0,
-            max: 256
-          },
-          vertical: {
-            name: "j",
-            min: 0,
-            max: 256
-          },
-          get bounds() {return L.bounds(
-                    [M.OSMTILE.options.crs.tile.horizontal.min,M.OSMTILE.options.crs.tile.vertical.min],
-                    [M.OSMTILE.options.crs.tile.horizontal.max,M.OSMTILE.options.crs.tile.vertical.max]);}
-        },
-        tilematrix: {
-          horizontal: {
-            name: "column",
-            min: 0,
-            max: zoom => (M.OSMTILE.options.crs.tcrs.horizontal.max(zoom) / M.OSMTILE.options.crs.tile.bounds.getSize().x).toFixed()
-          },
-          vertical: {
-            name: "row",
-            min: 0,
-            max: zoom => (M.OSMTILE.options.crs.tcrs.vertical.max(zoom) / M.OSMTILE.options.crs.tile.bounds.getSize().y).toFixed()
-          },
-          bounds: zoom => L.bounds([0,0],
-                   [M.OSMTILE.options.crs.tilematrix.horizontal.max(zoom),
-                    M.OSMTILE.options.crs.tilematrix.vertical.max(zoom)])
-        }
-      }
-    });
-  }());
-
-  M.handleLink = Util.handleLink;
-  M.convertPCRSBounds = Util.convertPCRSBounds;
-  M.axisToXY = Util.axisToXY;
-  M.csToAxes = Util.csToAxes;
-  M.convertAndFormatPCRS = Util.convertAndFormatPCRS;
-  M.axisToCS = Util.axisToCS;
-  M.parseNumber = Util.parseNumber;
-  M.extractInputBounds = Util.extractInputBounds;
-  M.splitCoordinate = Util.splitCoordinate;
-  M.boundsToPCRSBounds = Util.boundsToPCRSBounds;
-  M.pixelToPCRSBounds = Util.pixelToPCRSBounds;
-  M.metaContentToObject = Util.metaContentToObject;
-  M.coordsToArray = Util.coordsToArray;
-  M.parseStylesheetAsHTML = Util.parseStylesheetAsHTML;
-  M.pointToPCRSPoint = Util.pointToPCRSPoint;
-  M.pixelToPCRSPoint = Util.pixelToPCRSPoint;
-  M.gcrsToTileMatrix = Util.gcrsToTileMatrix;
-
-  M.QueryHandler = QueryHandler;
-  M.ContextMenu = ContextMenu;
-  M.AnnounceMovement = AnnounceMovement;
-  M.FeatureIndex = FeatureIndex;
-
-  // see https://leafletjs.com/examples/extending/extending-3-controls.html#handlers
-  L.Map.addInitHook('addHandler', 'query', M.QueryHandler);
-  L.Map.addInitHook('addHandler', 'contextMenu', M.ContextMenu);
-  L.Map.addInitHook('addHandler', 'announceMovement', M.AnnounceMovement);
-  L.Map.addInitHook('addHandler', 'featureIndex', M.FeatureIndex);
-
-  M.MapMLLayer = MapMLLayer;
-  M.mapMLLayer = mapMLLayer;
-
-  M.ImageOverlay = ImageOverlay;
-  M.imageOverlay = imageOverlay;
-
-  M.TemplatedImageLayer = TemplatedImageLayer;
-  M.templatedImageLayer = templatedImageLayer;
-
-  M.TemplatedFeaturesLayer = TemplatedFeaturesLayer;
-  M.templatedFeaturesLayer = templatedFeaturesLayer;
-
-  M.TemplatedLayer = TemplatedLayer;
-  M.templatedLayer = templatedLayer;
-
-  M.TemplatedTileLayer = TemplatedTileLayer;
-  M.templatedTileLayer = templatedTileLayer;
-
-  M.MapMLFeatures = MapMLFeatures;
-  M.mapMlFeatures = mapMlFeatures;
-
-  M.MapMLLayerControl = MapMLLayerControl;
-  M.mapMlLayerControl = mapMlLayerControl;
-
-  M.ReloadButton = ReloadButton;
-  M.reloadButton = reloadButton;
-
-  M.FullscreenButton = FullscreenButton;
-  M.fullscreenButton = fullscreenButton;
-
-  M.MapMLStaticTileLayer = MapMLStaticTileLayer;
-  M.mapMLStaticTileLayer = mapMLStaticTileLayer;
-
-  M.DebugOverlay = DebugOverlay;
-  M.debugOverlay = debugOverlay;
-
-  M.Crosshair = Crosshair;
-  M.crosshair = crosshair;
-
-  M.Feature = Feature;
-  M.feature = feature;
-
-  M.FeatureRenderer = FeatureRenderer;
-  M.featureRenderer = featureRenderer;
-
-  M.FeatureGroup = FeatureGroup;
-  M.featureGroup = featureGroup;
-
-  }(window));
-
-}());
diff --git a/multiple-extents/dist/mapml.min.js b/multiple-extents/dist/mapml.min.js
deleted file mode 100644
index 13d60bb..0000000
--- a/multiple-extents/dist/mapml.min.js
+++ /dev/null
@@ -1,3 +0,0 @@
-/*! @maps4html/web-map-custom-element 16-12-2021 */
-
-!function(){"use strict";var t=L.GridLayer.extend({initialize:function(t){this.zoomBounds=this._getZoomBounds(t.tileContainer,t.maxZoomBound),L.extend(t,this.zoomBounds),L.setOptions(this,t),this._groups=this._groupTiles(this.options.tileContainer.getElementsByTagName("map-tile"))},onAdd:function(){this._bounds=this._getLayerBounds(this._groups,this._map.options.projection),this.layerBounds=this._bounds[Object.keys(this._bounds)[0]];for(let t of Object.keys(this._bounds))this.layerBounds.extend(this._bounds[t].min),this.layerBounds.extend(this._bounds[t].max);L.GridLayer.prototype.onAdd.call(this,this._map),this._handleMoveEnd()},getEvents:function(){let t=L.GridLayer.prototype.getEvents.call(this,this._map);return this._parentOnMoveEnd=t.moveend,t.moveend=this._handleMoveEnd,t.move=(()=>{}),t},_handleMoveEnd:function(t){let e=this._map.getZoom(),i=e;i=(i=i>this.options.maxNativeZoom?this.options.maxNativeZoom:i)<this.options.minNativeZoom?this.options.minNativeZoom:i,this.isVisible=e<=this.zoomBounds.maxZoom&&e>=this.zoomBounds.minZoom&&this._bounds[i]&&this._bounds[i].overlaps(M.pixelToPCRSBounds(this._map.getPixelBounds(),this._map.getZoom(),this._map.options.projection)),this.isVisible&&this._parentOnMoveEnd()},_isValidTile(t){return this._groups[this._tileCoordsToKey(t)]},createTile:function(t){let e=this._groups[this._tileCoordsToKey(t)]||[],i=document.createElement("map-tile"),o=this.getTileSize();i.setAttribute("col",t.x),i.setAttribute("row",t.y),i.setAttribute("zoom",t.z);for(let t=0;t<e.length;t++){let n=document.createElement("img");n.width=o.x,n.height=o.y,n.alt="",n.setAttribute("role","presentation"),n.src=e[t].src,i.appendChild(n)}return i},_getLayerBounds:function(t,e){let i={},o=M[e].options.crs.tile.bounds.max.x;for(let e in t){let t=e.split(":"),n={};n.x=+t[0]*o,n.y=+t[1]*o,n.z=+t[2],t[2]in i?(i[t[2]].extend(L.point(n.x,n.y)),i[t[2]].extend(L.point(n.x+o,n.y+o))):i[t[2]]=L.bounds(L.point(n.x,n.y),L.point(n.x+o,n.y+o))}for(let t in i){let o=+t;i[t]=M.pixelToPCRSBounds(i[t],o,e)}return i},_getZoomBounds:function(t,e){if(!t)return null;let i=M.metaContentToObject(t.getElementsByTagName("map-tiles")[0].getAttribute("zoom")),o={},n=t.getElementsByTagName("map-tile");o.nativeZoom=+i.value||0,o.maxNativeZoom=0,o.minNativeZoom=e;for(let t=0;t<n.length;t++){let e=+n[t].getAttribute("zoom");n[t].getAttribute("zoom")||(e=o.nativeZoom),o.minNativeZoom=Math.min(o.minNativeZoom,e),o.maxNativeZoom=Math.max(o.maxNativeZoom,e)}return o.minZoom=o.minNativeZoom-2<=0?0:o.minNativeZoom-2,o.maxZoom=e,i.min&&(o.minZoom=+i.min<o.minNativeZoom-2?o.minNativeZoom-2:+i.min),i.max&&(o.maxZoom=+i.max),o},_groupTiles:function(t){let e={};for(let i=0;i<t.length;i++){let o={};o.row=+t[i].getAttribute("row"),o.col=+t[i].getAttribute("col"),o.zoom=+t[i].getAttribute("zoom")||this.options.nativeZoom,o.src=t[i].getAttribute("src");let n=o.col+":"+o.row+":"+o.zoom;n in e?e[n].push(o):e[n]=[o]}return e}}),e=function(e){return new t(e)},i=L.Control.Layers.extend({options:{autoZIndex:!1,sortLayers:!0,sortFunction:function(t,e){return t.options.zIndex<e.options.zIndex?-1:t.options.zIndex>e.options.zIndex?1:0}},initialize:function(t,e){for(var i in L.setOptions(this,e),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,t)this._addLayer(t[i],i,!0)},onAdd:function(){return this._initLayout(),this._map.on("validate",this._validateInput,this),L.DomEvent.on(this.options.mapEl,"layerchange",this._validateInput,this),L.DomEvent.on(this._container,"keydown",this._focusFirstLayer,this._container),this._update(),this._layers.length<1&&!this._map._showControls?this._container.setAttribute("hidden",""):this._map._showControls=!0,this._container},onRemove:function(t){t.off("validate",this._validateInput,this),L.DomEvent.off(this._container,"keydown",this._focusFirstLayer,this._container);for(var e=0;e<this._layers.length;e++)this._layers[e].layer.off("add remove",this._onLayerChange,this),this._layers[e].layer.off("extentload",this._validateInput,this)},addOrUpdateOverlay:function(t,e){for(var i=!1,o=0;o<this._layers.length;o++)if(this._layers[o].layer===t){i=!0,this._layers[o].name=e;break}return i||this.addOverlay(t,e),this._layers.length>0&&(this._container.removeAttribute("hidden"),this._map._showControls=!0),this._map?this._update():this},removeLayer:function(t){L.Control.Layers.prototype.removeLayer.call(this,t),0===this._layers.length&&this._container.setAttribute("hidden","")},_validateInput:function(t){for(let t=0;t<this._layers.length;t++){if(!this._layers[t].input.labels[0])continue;let e=this._layers[t].input.labels[0].getElementsByTagName("span"),i=this._layers[t].input.labels[0].getElementsByTagName("input");if(i[0].checked=this._layers[t].layer._layerEl.checked,this._layers[t].layer._layerEl.disabled&&this._layers[t].layer._layerEl.checked?(i[0].closest("fieldset").disabled=!0,e[0].style.fontStyle="italic"):(i[0].closest("fieldset").disabled=!1,e[0].style.fontStyle="normal"),this._layers[t].layer._extent&&this._layers[t].layer._extent._mapExtents)for(let e=0;e<this._layers[t].layer._extent._mapExtents.length;e++){let i=this._layers[t].layer._extent._mapExtents[e].extentAnatomy,o=i.getElementsByClassName("mapml-layer-item-name")[0];this._layers[t].layer._extent._mapExtents[e].disabled&&this._layers[t].layer._extent._mapExtents[e].checked?(o.style.fontStyle="italic",i.disabled=!0):(o.style.fontStyle="normal",i.disabled=!1)}}},_focusFirstLayer:function(t){if("Enter"===t.key&&"leaflet-control-layers leaflet-control leaflet-control-layers-expanded"!=this.className){var e=this.children[1].children[2].children[0].children[0].children[0].children[0];e&&setTimeout(()=>e.focus(),0)}},_withinZoomBounds:function(t,e){return e.min<=t&&t<=e.max},_addItem:function(t){var e=t.layer.getLayerUserControlsHTML();return t.input=e.querySelector("input"),this._layerControlInputs.push(t.input),t.input.layerId=L.stamp(t.layer),L.DomEvent.on(t.input,"click",this._onInputClick,this),t.layer.on("extentload",this._validateInput,this),this._overlaysList.appendChild(e),e},collapse:function(t){return"SELECT"===t.target.tagName||t.relatedTarget&&t.relatedTarget.parentElement&&("mapml-contextmenu mapml-layer-menu"===t.relatedTarget.className||"mapml-contextmenu mapml-layer-menu"===t.relatedTarget.parentElement.className)||this._map&&"block"===this._map.contextMenu._layerMenu.style.display?this:(L.DomUtil.removeClass(this._container,"leaflet-control-layers-expanded"),this)}}),o=function(t,e){return new i(t,e)};const n="OSMTILE",a="mapmltemplatedtileplaceholder";var s=L.FeatureGroup.extend({initialize:function(t,e){if(L.setOptions(this,e),this.options.static&&(this._container=L.DomUtil.create("div","leaflet-layer",this.options.pane),L.DomUtil.addClass(this._container,"leaflet-pane mapml-vector-container"),L.setOptions(this.options.renderer,{pane:this._container})),this._layers={},this.options.query){this._mapmlFeatures=t.features?t.features:t,this.isVisible=!0;let e=this._getNativeVariables(t);this.options.nativeZoom=e.zoom,this.options.nativeCS=e.cs}if(t&&!this.options.query){let e=this._getNativeVariables(t);!t.querySelector("map-extent")&&t.querySelector("map-feature")&&this.options.static&&(this._features={},this._staticFeature=!0,this.isVisible=!0,this.zoomBounds=this._getZoomBounds(t,e.zoom),this.layerBounds=this._getLayerBounds(t),L.extend(this.options,this.zoomBounds)),this.addData(t,e.cs,e.zoom),this._staticFeature&&(this._resetFeatures(this._clampZoom(this.options._leafletLayer._map.getZoom())),this.options._leafletLayer._map._addZoomLimit(this))}},onAdd:function(t){L.FeatureGroup.prototype.onAdd.call(this,t),this._mapmlFeatures&&t.on("featurepagination",this.showPaginationFeature,this)},onRemove:function(t){this._mapmlFeatures&&(t.off("featurepagination",this.showPaginationFeature,this),delete this._mapmlFeatures,L.DomUtil.remove(this._container)),L.FeatureGroup.prototype.onRemove.call(this,t),this._map.featureIndex.cleanIndex()},getEvents:function(){return this._staticFeature?{moveend:this._handleMoveEnd,zoomend:this._handleZoomEnd}:{moveend:this._removeCSS}},showPaginationFeature:function(t){if(this.options.query&&this._mapmlFeatures[t.i]){let e=this._mapmlFeatures[t.i];this.clearLayers(),this.addData(e,this.options.nativeCS,this.options.nativeZoom),t.popup._navigationBar.querySelector("p").innerText=t.i+1+"/"+this.options._leafletLayer._totalFeatureCount,t.popup._content.querySelector("iframe").setAttribute("sandbox","allow-same-origin allow-forms"),t.popup._content.querySelector("iframe").srcdoc=e.querySelector("map-properties").innerHTML}},_getNativeVariables:function(t){return{zoom:t.querySelector("map-meta[name=zoom]")&&+M.metaContentToObject(t.querySelector("map-meta[name=zoom]").getAttribute("content")).value||0,cs:t.querySelector("map-meta[name=cs]")&&M.metaContentToObject(t.querySelector("map-meta[name=cs]").getAttribute("content")).content||"GCRS"}},_handleMoveEnd:function(){let t=this._map.getZoom(),e=t<=this.zoomBounds.maxZoom&&t>=this.zoomBounds.minZoom;this.isVisible=e&&this._layers&&this.layerBounds&&this.layerBounds.overlaps(M.pixelToPCRSBounds(this._map.getPixelBounds(),t,this._map.options.projection)),this._removeCSS()},_handleZoomEnd:function(t){let e=this._map.getZoom();if(e>this.zoomBounds.maxZoom||e<this.zoomBounds.minZoom)return void this.clearLayers();let i=this._clampZoom(e);this._resetFeatures(i)},_getLayerBounds:function(t){if(!t)return null;let e="TILEMATRIX",i=t.querySelector("map-meta[name=projection]")&&M.metaContentToObject(t.querySelector("map-meta[name=projection]").getAttribute("content")).content.toUpperCase()||n;try{let o=t.querySelector("map-meta[name=extent]")&&M.metaContentToObject(t.querySelector("map-meta[name=extent]").getAttribute("content")),n=o.zoom||0,a=Object.keys(o);for(let t=0;t<a.length;t++)if(!a[t].includes("zoom")){e=M.axisToCS(a[t].split("-")[2]);break}let s=M.csToAxes(e);return M.boundsToPCRSBounds(L.bounds(L.point(+o[`top-left-${s[0]}`],+o[`top-left-${s[1]}`]),L.point(+o[`bottom-right-${s[0]}`],+o[`bottom-right-${s[1]}`])),n,i,e)}catch(t){return M.boundsToPCRSBounds(M[i].options.crs.tilematrix.bounds(0),0,i,e)}},_resetFeatures:function(t){if(this.clearLayers(),this._map&&this._map.featureIndex.cleanIndex(),this._features&&this._features[t])for(let e=0;e<this._features[t].length;e++)this.addLayer(this._features[t][e])},_clampZoom:function(t){return t>this.zoomBounds.maxZoom||t<this.zoomBounds.minZoom?t:void 0!==this.zoomBounds.minNativeZoom&&t<this.zoomBounds.minNativeZoom?this.zoomBounds.minNativeZoom:void 0!==this.zoomBounds.maxNativeZoom&&this.zoomBounds.maxNativeZoom<t?this.zoomBounds.maxNativeZoom:t},_setZoomTransform:function(t,e){var i=this._map.getZoomScale(this._map.getZoom(),e),o=t.multiplyBy(i).subtract(this._map._getNewPixelOrigin(t,this._map.getZoom())).round();any3d?L.setTransform(this._layers[e],o,i):L.setPosition(this._layers[e],o)},_getZoomBounds:function(t,e){if(!t)return null;let i,o,a=100,s=0,r=t.getElementsByTagName("map-feature");for(let t=0;t<r.length;t++){let i=+r[t].getAttribute("zoom");r[t].getAttribute("zoom")||(i=e),s=Math.max(s,i),a=Math.min(a,i)}try{o=M.metaContentToObject(t.querySelector("map-meta[name=projection]").getAttribute("content")).content,i=M.metaContentToObject(t.querySelector("map-meta[name=zoom]").getAttribute("content"))}catch(t){return{minZoom:0,maxZoom:M[o||n].options.resolutions.length-1,minNativeZoom:a,maxNativeZoom:s}}return{minZoom:+i.min,maxZoom:+i.max,minNativeZoom:a,maxNativeZoom:s}},addData:function(t,e,i){var o,n,a,s=t.nodeType===Node.DOCUMENT_NODE||"LAYER-"===t.nodeName?t.getElementsByTagName("map-feature"):null;if(t.nodeType===Node.DOCUMENT_NODE?t.querySelector("map-link[rel=stylesheet],map-style"):null){var r=t.querySelector("map-base")&&t.querySelector("map-base").hasAttribute("href")?new URL(t.querySelector("map-base").getAttribute("href")).href:t.URL;M.parseStylesheetAsHTML(t,r,this._container)}if(s){for(o=0,n=s.length;o<n;o++){(a=s[o]).getElementsByTagName("map-geometry").length&&a.getElementsByTagName("map-coordinates").length&&this.addData(a,e,i)}return this}var l=this.options;if(l.filter&&!l.filter(t))return;t.classList.length&&(l.className=t.classList.value);let m=t.getAttribute("zoom")||i,u=t.querySelector("map-featurecaption");u=u?u.innerHTML:"Feature",t.querySelector("map-properties")&&(l.properties=document.createElement("div"),l.properties.classList.add("mapml-popup-content"),l.properties.insertAdjacentHTML("afterbegin",t.querySelector("map-properties").innerHTML));let p=this.geometryToLayer(t,l,e,+m,u);if(p){if(!p.options.color&&t.hasAttribute("class")&&(p.options.className=t.getAttribute("class")),p.defaultOptions=p.options,this.resetStyle(p),l.onEachFeature&&p.bindTooltip(u,{interactive:!0,sticky:!0}),this._staticFeature){let e=t.getAttribute("zoom")||i;return void(e in this._features?this._features[e].push(p):this._features[e]=[p])}return this.addLayer(p)}},resetStyle:function(t){var e=this.options.style;e&&(L.Util.extend(t.options,t.defaultOptions),this._setLayerStyle(t,e))},setStyle:function(t){this.eachLayer(function(e){this._setLayerStyle(e,t)},this)},_setLayerStyle:function(t,e){"function"==typeof e&&(e=e(t.feature)),t.setStyle&&t.setStyle(e)},_removeCSS:function(){let t=this._container.querySelectorAll("link[rel=stylesheet],style");for(let e=0;e<t.length;e++)this._container.removeChild(t[e])},geometryToLayer:function(t,e,i,o,n){let a="MAP-FEATURE"===t.tagName.toUpperCase()?t.getElementsByTagName("map-geometry")[0]:t,s=a.getAttribute("cs")||i,r=[],l=L.SVG.create("g"),m=Object.assign({},e);for(let e of a.querySelectorAll("map-polygon, map-linestring, map-multilinestring, map-point, map-multipoint"))r.push(M.feature(e,Object.assign(m,{nativeCS:s,nativeZoom:o,projection:this.options.projection,featureID:t.id,group:l,wrappers:this._getGeometryParents(e.parentElement),featureLayer:this,_leafletLayer:this.options._leafletLayer})));let u={group:l,featureID:t.id,accessibleTitle:n,onEachFeature:e.onEachFeature,properties:e.properties,_leafletLayer:this.options._leafletLayer},p=a.querySelector("map-multipolygon")||a.querySelector("map-geometrycollection");return p&&(u.wrappers=this._getGeometryParents(p.parentElement)),M.featureGroup(r,u)},_getGeometryParents:function(t,e=[]){return t&&"MAP-GEOMETRY"!==t.tagName.toUpperCase()?"MAP-MULTIPOLYGON"===t.tagName.toUpperCase()||"MAP-GEOMETRYCOLLECTION"===t.tagName.toUpperCase()?this._getGeometryParents(t.parentElement,e):this._getGeometryParents(t.parentElement,e.concat([t])):e}}),r=function(t,e){return new s(t,e)},l=L.TileLayer.extend({initialize:function(t,e){let i=M.extractInputBounds(t);this.zoomBounds=i.zoomBounds,this.extentBounds=i.bounds,this.isVisible=!0,L.extend(e,this.zoomBounds),e.tms=t.tms,L.setOptions(this,e),this._setUpTileTemplateVars(t),t.tile.subdomains&&L.setOptions(this,L.extend(this.options,{subdomains:t.tile.subdomains})),this._template=t,this._initContainer(),L.TileLayer.prototype.initialize.call(this,t.template,L.extend(e,{pane:this._container}))},onAdd:function(){this._map._addZoomLimit(this),L.TileLayer.prototype.onAdd.call(this,this._map),this._handleMoveEnd()},addTo:function(t){L.tileLayer(this._url,this.options).addTo(t)},getEvents:function(){let t=L.TileLayer.prototype.getEvents.call(this,this._map);return this._parentOnMoveEnd=t.moveend,t.moveend=this._handleMoveEnd,t},_initContainer:function(){this._container||(this._container=L.DomUtil.create("div","leaflet-layer",this.options.pane),L.DomUtil.addClass(this._container,"mapml-templated-tile-container"),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity())},_handleMoveEnd:function(t){let e=this._map.getZoom(),i=M.pixelToPCRSBounds(this._map.getPixelBounds(),e,this._map.options.projection);this.isVisible=e<=this.options.maxZoom&&e>=this.options.minZoom&&this.extentBounds.overlaps(i),this.isVisible&&this._parentOnMoveEnd()},createTile:function(t){let e=document.createElement("DIV"),i=this.getTileSize();if(L.DomUtil.addClass(e,"mapml-tile-group"),L.DomUtil.addClass(e,"leaflet-tile"),this._template.linkEl.dispatchEvent(new CustomEvent("tileloadstart",{detail:{x:t.x,y:t.y,zoom:t.z,appendTile:t=>{e.appendChild(t)}}})),this._template.type.startsWith("image/")){let o=L.TileLayer.prototype.createTile.call(this,t,function(){});o.width=i.x,o.height=i.y,e.appendChild(o)}else this._url.includes(a)||this._fetchTile(t,e);return e},_mapmlTileReady:function(t){L.DomUtil.addClass(t,"leaflet-tile-loaded")},getPane:function(){return this.options.pane},_fetchTile:function(t,e){fetch(this.getTileUrl(t),{redirect:"follow"}).then(function(t){return t.status>=200&&t.status<300?Promise.resolve(t):(console.log("Looks like there was a problem. Status Code: "+t.status),Promise.reject(t))}).then(function(t){return t.text()}).then(t=>{return(new DOMParser).parseFromString(t,"application/xml")}).then(i=>{this._createFeatures(i,t,e),this._mapmlTileReady(e)}).catch(t=>{console.log("Error Creating Tile")})},_createFeatures:function(t,e,i){if(t.querySelector("map-link[rel=stylesheet],map-style")){let e=t.querySelector("map-base")&&t.querySelector("map-base").hasAttribute("href")?new URL(t.querySelector("map-base").getAttribute("href")).href:t.URL;M.parseStylesheetAsHTML(t,e,i)}let o=L.SVG.create("svg"),n=L.SVG.create("g"),a=this._map.options.crs.options.crs.tile.bounds.max.x,s=e.x*a,r=e.y*a,l=M.mapMlFeatures(t,{projection:this._map.options.projection,static:!1,interactive:!1});for(let t in l._layers)for(let i in l._layers[t]._layers){let o=l._layers[t]._layers[i];M.FeatureRenderer.prototype._initPath(o,!1),o._project(this._map,L.point([s,r]),e.z),M.FeatureRenderer.prototype._addPath(o,n,!1),M.FeatureRenderer.prototype._updateFeature(o)}o.setAttribute("width",a.toString()),o.setAttribute("height",a.toString()),o.appendChild(n),i.appendChild(o)},getTileUrl:function(t){if(t.z>=this._template.tilematrix.bounds.length||!this._template.tilematrix.bounds[t.z].contains(t))return"";var e={};for(var i in e[this._template.tilematrix.col.name]=t.x,e[this._template.tilematrix.row.name]=t.y,e[this._template.zoom.name]=this._getZoomForUrl(),e[this._template.pcrs.easting.left]=this._tileMatrixToPCRSPosition(t,"top-left").x,e[this._template.pcrs.easting.right]=this._tileMatrixToPCRSPosition(t,"top-right").x,e[this._template.pcrs.northing.top]=this._tileMatrixToPCRSPosition(t,"top-left").y,e[this._template.pcrs.northing.bottom]=this._tileMatrixToPCRSPosition(t,"bottom-left").y,e[this._template.tile.server]=this._getSubdomain(t),this._template.tile)["row","col","zoom","left","right","top","bottom"].indexOf(i)<0&&(e[i]=this._template.tile[i]);if(this._map&&!this._map.options.crs.infinite){let i=this._globalTileRange.max.y-t.y;this.options.tms&&(e[this._template.tilematrix.row.name]=i)}return e.r=this.options.detectRetina&&L.Browser.retina&&this.options.maxZoom>0?"@2x":"",L.Util.template(this._url,e)},_tileMatrixToPCRSPosition:function(t,e){var i=this._map.options.crs,o=this.getTileSize(),n=t.scaleBy(o),a=n.add(o),s=n.add(Math.floor(o/2)),r=i.transformation.untransform(n,i.scale(t.z)),l=i.transformation.untransform(a,i.scale(t.z)),m=i.transformation.untransform(s,i.scale(t.z)),u=null;switch(e){case"top-left":u=r;break;case"bottom-left":u=new L.Point(r.x,l.y);break;case"center-left":u=new L.Point(r.x,m.y);break;case"top-right":u=new L.Point(l.x,r.y);break;case"bottom-right":u=l;break;case"center-right":u=new L.Point(l.x,m.y);break;case"top-center":u=new L.Point(m.x,r.y);break;case"bottom-center":u=new L.Point(m.x,l.y);break;case"center":u=m}return u},_setUpTileTemplateVars:function(t){t.tile={};for(var e,i,o,n,a,s=t.values,r=this.options.crs.options,l=0;l<t.values.length;l++){var m=s[l].getAttribute("type"),u=s[l].getAttribute("units"),p=s[l].getAttribute("axis"),c=s[l].getAttribute("name"),h=s[l].getAttribute("position"),d="hidden"===m&&s[l].hasAttribute("shard"),_="map-select"===s[l].tagName.toLowerCase(),y=s[l].getAttribute("value"),x=s[l].getAttribute("min"),f=s[l].getAttribute("max");if("location"===m&&"tilematrix"===u)switch(p){case"column":a={name:c,min:r.crs.tilematrix.horizontal.min,max:r.crs.tilematrix.horizontal.max(r.resolutions.length-1)},isNaN(Number.parseFloat(x))||(a.min=Number.parseFloat(x)),isNaN(Number.parseFloat(f))||(a.max=Number.parseFloat(f));break;case"row":n={name:c,min:r.crs.tilematrix.vertical.min,max:r.crs.tilematrix.vertical.max(r.resolutions.length-1)},isNaN(Number.parseFloat(x))||(n.min=Number.parseFloat(x)),isNaN(Number.parseFloat(f))||(n.max=Number.parseFloat(f));break;case"longitude":case"easting":i||(i={min:r.crs.pcrs.horizontal.min,max:r.crs.pcrs.horizontal.max}),isNaN(Number.parseFloat(x))||(i.min=Number.parseFloat(x)),isNaN(Number.parseFloat(f))||(i.max=Number.parseFloat(f)),h&&(h.match(/.*?-left/i)?i.left=c:h.match(/.*?-right/i)&&(i.right=c));break;case"latitude":case"northing":o||(o={min:r.crs.pcrs.vertical.min,max:r.crs.pcrs.vertical.max}),isNaN(Number.parseFloat(x))||(o.min=Number.parseFloat(x)),isNaN(Number.parseFloat(f))||(o.max=Number.parseFloat(f)),h&&(h.match(/top-.*?/i)?o.top=c:h.match(/bottom-.*?/i)&&(o.bottom=c))}else if(m&&"zoom"===m.toLowerCase())e={name:c,min:0,max:r.resolutions.length,value:r.resolutions.length},!isNaN(Number.parseInt(y,10))&&Number.parseInt(y,10)>=e.min&&Number.parseInt(y,10)<=e.max?e.value=Number.parseInt(y,10):e.value=e.max,!isNaN(Number.parseInt(x,10))&&Number.parseInt(x,10)>=e.min&&Number.parseInt(x,10)<=e.max&&(e.min=Number.parseInt(x,10)),!isNaN(Number.parseInt(f,10))&&Number.parseInt(f,10)>=e.min&&Number.parseInt(f,10)<=e.max&&(e.max=Number.parseInt(f,10)),t.zoom=e;else if(d)t.tile.server=c,t.tile.subdomains=s[l].servers.slice();else if(_){const e=s[l].htmlselect;t.tile[c]=function(){return e.value}}else{const e=s[l];t.tile[c]=function(){return e.getAttribute("value")}}}var g=this.options.crs.transformation,b=this.options.crs.options.crs.tile.bounds.max.x,v=L.bind(this.options.crs.scale,this.options.crs),E=function(t,e){return g.transform(t,v(e)).divideBy(b).floor()};i&&o?(t.pcrs={},t.pcrs.bounds=L.bounds([i.min,o.min],[i.max,o.max]),t.pcrs.easting=i,t.pcrs.northing=o):a&&n&&!isNaN(e.value)?(t.pcrs||(t.pcrs={},t.pcrs.easting="",t.pcrs.northing=""),t.pcrs.bounds=M.boundsToPCRSBounds(L.bounds(L.point([a.min,n.min]),L.point([a.max,n.max])),e.value,this.options.crs,M.axisToCS("column")),t.tilematrix={},t.tilematrix.col=a,t.tilematrix.row=n):console.log("Unable to determine bounds for tile template: "+t.template),t.tilematrix||(t.tilematrix={},t.tilematrix.col={},t.tilematrix.row={}),t.tilematrix.bounds=[];for(var A=t.pcrs.bounds,C=t.zoom?t.zoom.min:0,T=t.zoom?t.zoom.max:r.resolutions.length,S=0;S<=T;S++)t.tilematrix.bounds[S]=S>=C?L.bounds(E(A.min,S),E(A.max,S)):L.bounds(L.point([-1,-1]),L.point([-1,-1]))}}),m=function(t,e){return new l(t,e)},u=L.Layer.extend({initialize:function(t,e){this._templates=t,L.setOptions(this,e),this._container=L.DomUtil.create("div","leaflet-layer",e.pane),this._container.style.opacity=this._templates.opacity,L.DomUtil.addClass(this._container,"mapml-templatedlayer-container");for(var i=0;i<t.length;i++)if("tile"===t[i].rel)this._templates[i].layer=M.templatedTileLayer(t[i],L.Util.extend(e,{errorTileUrl:"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",zIndex:i,pane:this._container}));else if("image"===t[i].rel)this._templates[i].layer=M.templatedImageLayer(t[i],L.Util.extend(e,{zIndex:i,pane:this._container}));else if("features"===t[i].rel)this._templates[i].layer=M.templatedFeaturesLayer(t[i],L.Util.extend(e,{zIndex:i,pane:this._container}));else if("query"===t[i].rel){this.hasSetBoundsHandler=!0,this._queries||(this._queries=[]);let e=M.extractInputBounds(t[i]);t[i].extentBounds=e.bounds,t[i].zoomBounds=e.zoomBounds,this._queries.push(L.extend(t[i],this._setupQueryVars(t[i])))}},getEvents:function(){return{zoomstart:this._onZoomStart}},redraw:function(){this.closePopup();for(var t=0;t<this._templates.length;t++)"tile"!==this._templates[t].rel&&"image"!==this._templates[t].rel&&"features"!==this._templates[t].rel||this._templates[t].layer.redraw()},_onZoomStart:function(){this.closePopup()},_onMoveEnd:function(){},_setupQueryVars:function(t){for(var e={query:{}},i=t.values,o=0;o<t.values.length;o++){var n=i[o].getAttribute("type"),a=i[o].getAttribute("units"),s=i[o].getAttribute("axis"),r=i[o].getAttribute("name"),l=i[o].getAttribute("position"),m=i[o].getAttribute("rel"),u="map-select"===i[o].tagName.toLowerCase();if("width"===n)e.query.width=r;else if("height"===n)e.query.height=r;else if("location"===n)switch(s){case"x":case"y":case"column":case"row":e.query[s]=r;break;case"longitude":case"easting":l?l.match(/.*?-left/i)?"pixel"===m?e.query.pixelleft=r:"tile"===m?e.query.tileleft=r:e.query.mapleft=r:l.match(/.*?-right/i)&&("pixel"===m?e.query.pixelright=r:"tile"===m?e.query.tileright=r:e.query.mapright=r):e.query[s]=r;break;case"latitude":case"northing":l?l.match(/top-.*?/i)?"pixel"===m?e.query.pixeltop=r:"tile"===m?e.query.tiletop=r:e.query.maptop=r:l.match(/bottom-.*?/i)&&("pixel"===m?e.query.pixelbottom=r:"tile"===m?e.query.tilebottom=r:e.query.mapbottom=r):e.query[s]=r;break;case"i":"tile"===a?e.query.tilei=r:e.query.mapi=r;break;case"j":"tile"===a?e.query.tilej=r:e.query.mapj=r}else if("zoom"===n)e.query.zoom=r;else if(u){const t=i[o].htmlselect;e.query[r]=function(){return t.value}}else{const t=i[o];e.query[r]=function(){return t.getAttribute("value")}}}return e.query.title=t.title,e},reset:function(t){if(t&&this._map){var e=this._map&&this._map.hasLayer(this),i=this._templates;delete this._queries,this._map.off("click",null,this),this._templates=t;for(var o=0;o<t.length;o++)"tile"===t[o].rel?this._templates[o].layer=M.templatedTileLayer(t[o],L.Util.extend(this.options,{errorTileUrl:"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",zIndex:o,pane:this._container})):"image"===t[o].rel?this._templates[o].layer=M.templatedImageLayer(t[o],L.Util.extend(this.options,{zIndex:o,pane:this._container})):"features"===t[o].rel?this._templates[o].layer=M.templatedFeaturesLayer(t[o],L.Util.extend(this.options,{zIndex:o,pane:this._container})):"query"===t[o].rel&&(this._queries||(this._queries=[]),this._queries.push(L.extend(t[o],this._setupQueryVars(t[o])))),e&&this.onAdd(this._map);for(o=0;o<i.length;o++)this._map.hasLayer(i[o].layer)&&this._map.removeLayer(i[o].layer)}},onAdd:function(t){for(var e=0;e<this._templates.length;e++)"query"!==this._templates[e].rel&&t.addLayer(this._templates[e].layer)},onRemove:function(t){L.DomUtil.remove(this._container);for(var e=0;e<this._templates.length;e++)"query"!==this._templates[e].rel&&t.removeLayer(this._templates[e].layer)},_previousFeature:function(t){this._count+-1>=0&&(this._count--,this._map.fire("featurepagination",{i:this._count,popup:this}))},_nextFeature:function(t){this._count+1<this._source._totalFeatureCount&&(this._count++,this._map.fire("featurepagination",{i:this._count,popup:this}))},changeOpacity:function(t){this._container.style.opacity=t}}),p=function(t,e){return new u(t,e)},c=L.Layer.extend({initialize:function(t,e){let i=M.extractInputBounds(t);this.zoomBounds=i.zoomBounds,this.extentBounds=i.bounds,this.isVisible=!0,this._template=t,this._container=L.DomUtil.create("div","leaflet-layer",e.pane),L.extend(e,this.zoomBounds),L.DomUtil.addClass(this._container,"mapml-features-container"),L.setOptions(this,L.extend(e,this._setUpFeaturesTemplateVars(t)))},getEvents:function(){return{moveend:this._onMoveEnd}},onAdd:function(){this._map._addZoomLimit(this);var t,e=new Headers({Accept:"text/mapml"}),i=new DOMParser,o=this.options.opacity||1,n=this._container,a=this._map;this._features||(this._features=M.mapMlFeatures(null,{renderer:M.featureRenderer(),pane:n,opacity:o,projection:a.options.projection,static:!0,onEachFeature:function(t,e){var i=document.createElement("div");i.classList.add("mapml-popup-content"),i.insertAdjacentHTML("afterbegin",t.innerHTML),e.bindPopup(i,{autoClose:!1,minWidth:108})}}));var s=this._features,r=function(o,n){return fetch(o,{redirect:"follow",headers:e}).then(function(t){return t.text()}).then(function(e){t=i.parseFromString(e,"application/xml");var a=new URL(t.querySelector("map-base")?t.querySelector("map-base").getAttribute("href"):o).href;o=(o=t.querySelector("map-link[rel=next]")?t.querySelector("map-link[rel=next]").getAttribute("href"):null)?new URL(o,a).href:null;let l=t.querySelector("map-meta[name=zoom]")&&+M.metaContentToObject(t.querySelector("map-meta[name=zoom]").getAttribute("content")).value||0,m=t.querySelector("map-meta[name=cs]")&&M.metaContentToObject(t.querySelector("map-meta[name=cs]").getAttribute("content")).content||"GCRS";if(s.addData(t,m,l),o&&--n)return r(o,n)})};r(this._getfeaturesUrl(),10).then(function(){a.addLayer(s),a.fire("moveend")}).catch(function(t){console.log(t)})},redraw:function(){this._onMoveEnd()},_onMoveEnd:function(){let t=this._map.getZoom(),e=M.pixelToPCRSBounds(this._map.getPixelBounds(),t,this._map.options.projection);if(this.isVisible=t<=this.zoomBounds.maxZoom&&t>=this.zoomBounds.minZoom&&this.extentBounds.overlaps(e),this._features.clearLayers(),this.isVisible){var i,o=new Headers({Accept:"text/mapml;q=0.9,application/geo+json;q=0.8"}),n=new DOMParser,a=this._features,s=this._map,r=this,l=function(t,e){return fetch(t,{redirect:"follow",headers:o}).then(function(t){return t.text()}).then(function(o){i=n.parseFromString(o,"application/xml");var s=new URL(i.querySelector("map-base")?i.querySelector("map-base").getAttribute("href"):t).href;t=(t=i.querySelector("map-link[rel=next]")?i.querySelector("map-link[rel=next]").getAttribute("href"):null)?new URL(t,s).href:null;let r=i.querySelector("map-meta[name=zoom]")&&+M.metaContentToObject(i.querySelector("map-meta[name=zoom]").getAttribute("content")).value||0,m=i.querySelector("map-meta[name=cs]")&&M.metaContentToObject(i.querySelector("map-meta[name=cs]").getAttribute("content")).content||"GCRS";if(a.addData(i,m,r),t&&--e)return l(t,e)})};l(this._getfeaturesUrl(),10).then(function(){s.addLayer(a),M.TemplatedFeaturesLayer.prototype._updateTabIndex(r)}).catch(function(t){console.log(t)})}},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},_updateTabIndex:function(t){let e=t||this;for(let t in e._features._layers){let i=e._features._layers[t];if(i._path&&("M0 0"!==i._path.getAttribute("d")?i._path.setAttribute("tabindex",0):i._path.removeAttribute("tabindex"),0===i._path.childElementCount)){let t=document.createElement("title");t.innerText="Feature",i._path.appendChild(t)}}},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},onRemove:function(){this._map.removeLayer(this._features)},_getfeaturesUrl:function(){var t={};for(var e in this.options.feature.zoom&&(t[this.options.feature.zoom]=this._map.getZoom()),this.options.feature.width&&(t[this.options.feature.width]=this._map.getSize().x),this.options.feature.height&&(t[this.options.feature.height]=this._map.getSize().y),this.options.feature.bottom&&(t[this.options.feature.bottom]=this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).y),this.options.feature.left&&(t[this.options.feature.left]=this._TCRSToPCRS(this._map.getPixelBounds().min,this._map.getZoom()).x),this.options.feature.top&&(t[this.options.feature.top]=this._TCRSToPCRS(this._map.getPixelBounds().min,this._map.getZoom()).y),this.options.feature.right&&(t[this.options.feature.right]=this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).x),this.options.feature)["width","height","left","right","top","bottom","zoom"].indexOf(e)<0&&(t[e]=this.options.feature[e]);return L.Util.template(this._template.template,t)},_TCRSToPCRS:function(t,e){var i=this._map.options.crs;return i.transformation.untransform(t,i.scale(e))},_setUpFeaturesTemplateVars:function(t){var e={feature:{}},i=t.values;e.feature.hidden=[];for(var o=0;o<i.length;o++){var n=i[o].getAttribute("type"),a=i[o].getAttribute("units"),s=i[o].getAttribute("axis"),r=i[o].getAttribute("name"),l=i[o].getAttribute("position"),m=(i[o].getAttribute("value"),"map-select"===i[o].tagName.toLowerCase());if("width"===n)e.feature.width=r;else if("height"===n)e.feature.height=r;else if("zoom"===n)e.feature.zoom=r;else if("location"!==n||"pcrs"!==a&&"gcrs"!==a)if(m){const t=i[o].htmlselect;e.feature[r]=function(){return t.value}}else{const t=i[o];e.feature[r]=function(){return t.getAttribute("value")}}else switch(s){case"x":case"longitude":case"easting":l&&(l.match(/.*?-left/i)?e.feature.left=r:l.match(/.*?-right/i)&&(e.feature.right=r));break;case"y":case"latitude":case"northing":l&&(l.match(/top-.*?/i)?e.feature.top=r:l.match(/bottom-.*?/i)&&(e.feature.bottom=r))}}return e}}),h=function(t,e){return new c(t,e)},d=L.Layer.extend({initialize:function(t,e){this._template=t,this._container=L.DomUtil.create("div","leaflet-layer",e.pane),L.DomUtil.addClass(this._container,"mapml-image-container");let i=M.extractInputBounds(t);this.zoomBounds=i.zoomBounds,this.extentBounds=i.bounds,this.isVisible=!0,L.extend(e,this.zoomBounds),L.setOptions(this,L.extend(e,this._setUpExtentTemplateVars(t)))},getEvents:function(){return{moveend:this._onMoveEnd}},onAdd:function(){this._map._addZoomLimit(this),this.setZIndex(this.options.zIndex),this._onMoveEnd()},redraw:function(){this._onMoveEnd()},_clearLayer:function(){let t=this._container.querySelectorAll("img");for(let e=0;e<t.length;e++)this._container.removeChild(t[e])},_onMoveEnd:function(){let t=this._map.getZoom(),e=M.pixelToPCRSBounds(this._map.getPixelBounds(),t,this._map.options.projection);if(this.isVisible=t<=this.zoomBounds.maxZoom&&t>=this.zoomBounds.minZoom&&this.extentBounds.overlaps(e),this.isVisible){var i=this._map,o=i.getPixelBounds().min.subtract(i.getPixelOrigin()),n=i.getSize(),a=this.getImageUrl(),s=this._imageOverlay;this._imageOverlay=M.imageOverlay(a,o,n,0,this._container),this._imageOverlay.addTo(i),s&&this._imageOverlay.on("load error",function(){i.removeLayer(s)})}else this._clearLayer()},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},onRemove:function(t){this._clearLayer(),t._removeZoomLimit(this),this._container=null},getImageUrl:function(){var t={};for(var e in t[this.options.extent.width]=this._map.getSize().x,t[this.options.extent.height]=this._map.getSize().y,t[this.options.extent.bottom]=this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).y,t[this.options.extent.left]=this._TCRSToPCRS(this._map.getPixelBounds().min,this._map.getZoom()).x,t[this.options.extent.top]=this._TCRSToPCRS(this._map.getPixelBounds().min,this._map.getZoom()).y,t[this.options.extent.right]=this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).x,this.options.extent)["width","height","left","right","top","bottom"].indexOf(e)<0&&(t[e]=this.options.extent[e]);return L.Util.template(this._template.template,t)},_TCRSToPCRS:function(t,e){var i=this._map.options.crs;return i.transformation.untransform(t,i.scale(e))},_setUpExtentTemplateVars:function(t){for(var e={extent:{}},i=t.values,o=0;o<t.values.length;o++){var n=i[o].getAttribute("type"),a=i[o].getAttribute("units"),s=i[o].getAttribute("axis"),r=i[o].getAttribute("name"),l=i[o].getAttribute("position"),m="map-select"===i[o].tagName.toLowerCase();if("width"===n)e.extent.width=r;else if("height"===n)e.extent.height=r;else if("location"!==n||"pcrs"!==a&&"gcrs"!==a)if(m){const t=i[o].htmlselect;e.extent[r]=function(){return t.value}}else{const t=i[o];e.extent[r]=function(){return t.getAttribute("value")}}else switch(s){case"longitude":case"easting":l&&(l.match(/.*?-left/i)?e.extent.left=r:l.match(/.*?-right/i)&&(e.extent.right=r));break;case"latitude":case"northing":l&&(l.match(/top-.*?/i)?e.extent.top=r:l.match(/bottom-.*?/i)&&(e.extent.bottom=r))}}return e}}),_=function(t,e){return new d(t,e)},y=L.ImageOverlay.extend({initialize:function(t,e,i,o,n,a){this._container=n,this._url=t,this._location=e,this._size=L.point(i),this._angle=o,L.setOptions(this,a)},getEvents:function(){var t={viewreset:this._reset};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},onAdd:function(){this.on({load:this._onImageLoad}),this._image||this._initImage(),this.options.interactive&&(L.DomUtil.addClass(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this._container.appendChild(this._image),this._reset()},onRemove:function(){L.DomUtil.remove(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},_onImageLoad:function(){this._image&&(this._image.loaded=+new Date,this._updateOpacity())},_animateZoom:function(t){var e=this._map.getZoomScale(t.zoom),i=this._map.getPixelOrigin().add(this._location).multiplyBy(e).subtract(this._map._getNewPixelOrigin(t.center,t.zoom)).round();L.Browser.any3d?L.DomUtil.setTransform(this._image,i,e):L.DomUtil.setPosition(this._image,i)},_reset:function(){var t=this._image,e=this._location,i=this._size;L.DomUtil.setPosition(t,e),t.style.width=i.x+"px",t.style.height=i.y+"px"},_updateOpacity:function(){if(this._map){var t=+new Date,e=!1,i=this._image,o=Math.min(1,(t-i.loaded)/200);L.DomUtil.setOpacity(i,o),o<1&&(e=!0),e&&(L.Util.cancelAnimFrame(this._fadeFrame),this._fadeFrame=L.Util.requestAnimFrame(this._updateOpacity,this)),L.DomUtil.addClass(i,"leaflet-image-loaded")}}}),x=function(t,e,i,o,n,a){return new y(t,e,i,o,n,a)},f=L.Layer.extend({options:{maxNext:10,zIndex:0,maxZoom:25},initialize:function(t,e,i){var o;t&&(this._href=t),e&&(this._layerEl=e,o=!!e.querySelector("map-feature,map-tile,map-extent"),!t&&o&&(this._content=e)),L.setOptions(this,i),this._container=L.DomUtil.create("div","leaflet-layer"),L.DomUtil.addClass(this._container,"mapml-layer"),this._imageContainer=L.DomUtil.create("div","leaflet-layer",this._container),L.DomUtil.addClass(this._imageContainer,"mapml-image-container"),this._mapmlTileContainer=L.DomUtil.create("div","mapml-tile-container",this._container),!o&&e&&e.hasAttribute("label")&&(this._title=e.getAttribute("label")),this._initCount=0,this._initExtent(o?e:null),this.on("attached",this._validateExtent,this),this.validProjection=!0},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},_removeExtents:function(t){if(this._extent._mapExtents)for(let e=0;e<this._extent._mapExtents.length;e++)this._extent._mapExtents[e].templatedLayer&&t.removeLayer(this._extent._mapExtents[e].templatedLayer)},_changeOpacity:function(t){t&&t.target&&t.target.value>=0&&t.target.value<=1&&this.changeOpacity(t.target.value)},changeOpacity:function(t){this._container.style.opacity=t,this.opacityEl&&(this.opacityEl.value=t)},_changeExtentOpacity:function(t){t&&t.target&&t.target.value>=0&&t.target.value<=1&&(this.templatedLayer.changeOpacity(t.target.value),this._templateVars.opacity=t.target.value)},_changeExtent:function(t,e){t.target.checked?(e.checked=!0,e.templatedLayer=M.templatedLayer(e._templateVars,{pane:this._container,_leafletLayer:this,crs:e.crs}).addTo(this._map),this._getCombinedExtentsLayerBounds()):(L.DomEvent.stopPropagation(t),e.checked=!1,this._map.removeLayer(e.templatedLayer),this._getCombinedExtentsLayerBounds())},_getCombinedExtentsLayerBounds:function(){let t,e,i,o,n;for(let t=0;t<this._extent._mapExtents.length;t++)for(let e=0;e<this._extent._mapExtents[t]._templateVars.length;e++){let i=M.extractInputBounds(this._extent._mapExtents[t]._templateVars[e]);this._extent._mapExtents[t]._templateVars[e].tempExtentBounds=i.bounds,this._extent._mapExtents[t]._templateVars[e].extentZoomBounds=i.zoomBounds}for(let a=0;a<this._extent._mapExtents.length;a++)if(this._extent._mapExtents[a].checked)for(let s=0;s<this._extent._mapExtents[a]._templateVars.length;s++)t?(t.extend(this._extent._mapExtents[a]._templateVars[s].tempExtentBounds.min),t.extend(this._extent._mapExtents[a]._templateVars[s].tempExtentBounds.max),e=Math.max(e,this._extent._mapExtents[a]._templateVars[s].extentZoomBounds.maxZoom),i=Math.min(i,this._extent._mapExtents[a]._templateVars[s].extentZoomBounds.minZoom),o=Math.max(o,this._extent._mapExtents[a]._templateVars[s].extentZoomBounds.maxNativeZoom),n=Math.min(n,this._extent._mapExtents[a]._templateVars[s].extentZoomBounds.minNativeZoom)):(t=this._extent._mapExtents[a]._templateVars[s].tempExtentBounds,e=this._extent._mapExtents[a]._templateVars[s].extentZoomBounds.maxZoom,i=this._extent._mapExtents[a]._templateVars[s].extentZoomBounds.minZoom,o=this._extent._mapExtents[a]._templateVars[s].extentZoomBounds.maxNativeZoom,n=this._extent._mapExtents[a]._templateVars[s].extentZoomBounds.minNativeZoom);this._extent.layerBounds=t,this._extent.zoomBounds={minZoom:0,maxZoom:0,maxNativeZoom:0,minNativeZoom:0},this._extent.zoomBounds.maxZoom=e,this._extent.zoomBounds.minZoom=i,this._extent.zoomBounds.minNativeZoom=n,this._extent.zoomBounds.maxNativeZoom=o,t&&(this._layerEl.extent=Object.assign(M.convertAndFormatPCRS(t,this._map),{zoom:this._extent.zoomBounds}));for(let e=0;e<this._extent._mapExtents.length;e++)this._extent._mapExtents[e].templatedLayer.layerBounds=t,this._extent._mapExtents[e].templatedLayer.zoomBounds=this._extent.zoomBounds},onAdd:function(t){if(!this._extent&&!this._extent_mapExtents||this._validProjection(t)){if(this._map=t,this._content?(this._mapmlvectors||(this._mapmlvectors=M.mapMlFeatures(this._content,{renderer:M.featureRenderer(),pane:this._container,opacity:this.options.opacity,projection:t.options.projection,_leafletLayer:this,static:!0,onEachFeature:function(t,e){if(t){var i=document.createElement("div");i.classList.add("mapml-popup-content"),i.insertAdjacentHTML("afterbegin",t.innerHTML),e.bindPopup(i,{autoClose:!1,minWidth:165})}}})),t.addLayer(this._mapmlvectors)):this.once("extentload",function(){this._validProjection(t)?(this._mapmlvectors||(this._mapmlvectors=M.mapMlFeatures(this._content,{renderer:M.featureRenderer(),pane:this._container,opacity:this.options.opacity,projection:t.options.projection,_leafletLayer:this,static:!0,onEachFeature:function(t,e){if(t){var i=document.createElement("div");i.classList.add("mapml-popup-content"),i.insertAdjacentHTML("afterbegin",t.innerHTML),e.bindPopup(i,{autoClose:!1,minWidth:165})}}}).addTo(t)),this._setLayerElExtent()):this.validProjection=!1},this),this._imageLayer||(this._imageLayer=L.layerGroup()),t.addLayer(this._imageLayer),(!this._staticTileLayer||null===this._staticTileLayer._container)&&this._mapmlTileContainer.getElementsByTagName("map-tiles").length>0&&(this._staticTileLayer=M.mapMLStaticTileLayer({pane:this._container,_leafletLayer:this,className:"mapml-static-tile-layer",tileContainer:this._mapmlTileContainer,maxZoomBound:t.options.crs.options.resolutions.length-1,tileSize:t.options.crs.options.crs.tile.bounds.max.x}),t.addLayer(this._staticTileLayer)),this._extent&&this._extent._mapExtents&&this._extent._mapExtents[0]._templateVars){for(let e=0;e<this._extent._mapExtents.length;e++)this._extent._mapExtents[e]._templateVars&&this._extent._mapExtents[e].checked&&(this._templatedLayer=M.templatedLayer(this._extent._mapExtents[e]._templateVars,{pane:this._container,_leafletLayer:this,crs:this._extent.crs}).addTo(t),this._extent._mapExtents[e].templatedLayer=this._templatedLayer,this._templatedLayer._queries&&(this._extent._queries||(this._extent._queries=[]),this._extent._queries=this._extent._queries.concat(this._templatedLayer._queries)));this._getCombinedExtentsLayerBounds()}else this.once("extentload",function(){if(this._validProjection(t)){if(this._extent&&this._extent._mapExtents)for(let e=0;e<this._extent._mapExtents.length;e++)this._extent._mapExtents[e]._templateVars&&(this._templatedLayer=M.templatedLayer(this._extent._mapExtents[e]._templateVars,{pane:this._container,_leafletLayer:this,crs:this._extent.crs}).addTo(t),this._extent._mapExtents[e].templatedLayer=this._templatedLayer,this._getCombinedExtentsLayerBounds())}else this.validProjection=!1},this);this._setLayerElExtent(),this.setZIndex(this.options.zIndex),this.getPane().appendChild(this._container),setTimeout(()=>{t.fire("checkdisabled")},0),t.on("popupopen",this._attachSkipButtons,this)}else this.validProjection=!1},_validProjection:function(t){let e=!1;if(this._extent._mapExtents)for(let i=0;i<this._extent._mapExtents.length;i++)if(this._extent._mapExtents[i]._templateVars)for(let o of this._extent._mapExtents[i]._templateVars)if(!o.projectionMatch&&o.projection!==t.options.projection){e=!0;break}return!(e||this.getProjection()!==t.options.projection.toUpperCase())},_setLayerElExtent:function(){let t,e;["_staticTileLayer","_imageLayer","_mapmlvectors"].forEach(i=>{this[i]&&this[i].layerBounds&&(t?(t.extend(this[i].layerBounds.min),t.extend(this[i].layerBounds.max)):(t=this[i].layerBounds,e=this[i].zoomBounds))}),t&&(this._layerEl.extent=Object.assign(M.convertAndFormatPCRS(t,this._map),{zoom:e}))},addTo:function(t){return t.addLayer(this),this},getEvents:function(){return{zoomanim:this._onZoomAnim}},redraw:function(){if(this._extent._mapExtents)for(let t=0;t<this._extent._mapExtents.length;t++)this._extent._mapExtents[t].templatedLayer&&this._extent._mapExtents[t].templatedLayer.redraw()},_onZoomAnim:function(t){var e=t.zoom,i=this._extent&&this._extent._mapExtents?this._extent._mapExtents[0].querySelector("map-input[type=zoom]"):null,o=i&&i.hasAttribute("min")?parseInt(i.getAttribute("min")):this._map.getMinZoom(),n=i&&i.hasAttribute("max")?parseInt(i.getAttribute("max")):this._map.getMaxZoom();if(i)for(let t=1;t<this._extent._mapExtents.length;t++)(i=this._extent._mapExtents[t].querySelector("map-input[type=zoom]"))&&i.hasAttribute("min")&&(o=Math.min(parseInt(i.getAttribute("min")),o)),i&&i.hasAttribute("max")&&(n=Math.max(parseInt(i.getAttribute("max")),n));e<o&&this._extent.zoomout||e>n&&this._extent.zoomin;o<=e&&e<=n||(this._extent.zoomin&&e>n?(this._href=this._extent.zoomin,this._layerEl.src=this._extent.zoomin,this.href=this._extent.zoomin,this._layerEl.src=this._extent.zoomin):this._extent.zoomout&&e<o&&(this._href=this._extent.zoomout,this.href=this._extent.zoomout,this._layerEl.src=this._extent.zoomout)),this._templatedLayer},onRemove:function(t){L.DomUtil.remove(this._container),this._staticTileLayer&&t.removeLayer(this._staticTileLayer),this._mapmlvectors&&t.removeLayer(this._mapmlvectors),this._imageLayer&&t.removeLayer(this._imageLayer),this._extent&&this._extent._mapExtents&&this._removeExtents(t),t.fire("checkdisabled"),t.off("popupopen",this._attachSkipButtons)},getZoomBounds:function(){var t=this._extent,e=t?t.querySelector("[type=zoom]"):void 0,i=e&&e.hasAttribute("min")?e.getAttribute("min"):this._map.getMinZoom(),o=e&&e.hasAttribute("max")?e.getAttribute("max"):this._map.getMaxZoom(),n={};return n.min=Math.min(i,o),n.max=Math.max(i,o),n},_transformDeprectatedInput:function(t){var e=t.getAttribute("type").toLowerCase();if("xmin"===e||"ymin"===e||"xmax"===e||"ymax"===e)switch(t.setAttribute("type","location"),t.setAttribute("units","tcrs"),e){case"xmin":t.setAttribute("axis","x"),t.setAttribute("position","top-left");break;case"ymin":t.setAttribute("axis","y"),t.setAttribute("position","top-left");break;case"xmax":t.setAttribute("axis","x"),t.setAttribute("position","bottom-right");break;case"ymax":t.setAttribute("axis","y"),t.setAttribute("position","bottom-right")}},getLayerExtentBounds:function(t){if(this._extent){var e,i,o,n,a,s,r,l,m=t.getZoom(),u=t.options.projection,p=u!==this._extent.getAttribute("units");if(s=this._extent.querySelector("[type=xmin]").getAttribute("min"),r=this._extent.querySelector("[type=xmax]").getAttribute("min"),i=Math.min(s,r),s=this._extent.querySelector("[type=xmin]").getAttribute("max"),r=this._extent.querySelector("[type=xmax]").getAttribute("max"),n=Math.max(s,r),s=this._extent.querySelector("[type=ymin]").getAttribute("min"),r=this._extent.querySelector("[type=ymax]").getAttribute("min"),o=Math.min(s,r),s=this._extent.querySelector("[type=ymin]").getAttribute("max"),r=this._extent.querySelector("[type=ymax]").getAttribute("max"),a=Math.max(s,r),p){var c=[(e=M[u]).latLngToPoint(L.latLng([o,i]),m),e.latLngToPoint(L.latLng([a,n]),m),e.latLngToPoint(L.latLng([o,i]),m),e.latLngToPoint(L.latLng([o,n]),m)];return L.bounds(c)}return(l=parseInt(this._extent.querySelector("[type=zoom]").getAttribute("value")))!==m?(e=M[u],L.bounds(e.latLngToPoint(e.pointToLatLng(L.point(i,o),l),m),e.latLngToPoint(e.pointToLatLng(L.point(n,a),l),m))):L.bounds(L.point(i,o),L.point(n,a))}},getAttribution:function(){return this.options.attribution},getLayerExtentHTML:function(t,e){var i=L.DomUtil.create("fieldset","mapml-layer-extent"),o=L.DomUtil.create("div","mapml-layer-item-properties",i),n=L.DomUtil.create("div","mapml-layer-item-settings",i),a=L.DomUtil.create("label","mapml-layer-item-toggle",o),s=L.DomUtil.create("input"),r=L.SVG.create("svg"),l=L.SVG.create("path"),m=L.SVG.create("path"),u=L.DomUtil.create("span"),p=L.DomUtil.create("div","mapml-layer-item-controls",o),c=L.DomUtil.create("details","mapml-layer-item-opacity",n),h=L.DomUtil.create("summary","",c),d=L.DomUtil.create("input","",c);n.hidden=!0,r.setAttribute("viewBox","0 0 24 24"),r.setAttribute("height","22"),r.setAttribute("width","22"),l.setAttribute("d","M0 0h24v24H0z"),l.setAttribute("fill","none"),m.setAttribute("d","M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"),r.appendChild(l),r.appendChild(m);let _=L.DomUtil.create("button","mapml-layer-item-remove-control",p);_.type="button",_.title="Remove Sub Layer",_.innerHTML="<span aria-hidden='true'>&#10005;</span>",_.classList.add("mapml-button"),L.DomEvent.on(_,"click",L.DomEvent.stop),L.DomEvent.on(_,"click",t=>{t.target.checked=!1,this._changeExtent(t,this._extent._mapExtents[e]),this._extent._mapExtents[e].extentAnatomy.parentNode.removeChild(this._extent._mapExtents[e].extentAnatomy)},this);let y=L.DomUtil.create("button","mapml-layer-item-settings-control",p);y.type="button",y.title="Extent Settings",y.setAttribute("aria-expanded",!1),y.classList.add("mapml-button"),L.DomEvent.on(y,"click",t=>{1==n.hidden?(y.setAttribute("aria-expanded",!0),n.hidden=!1):(y.setAttribute("aria-expanded",!1),n.hidden=!0)},this),u.setAttribute("aria-hidden",!0),a.appendChild(s),y.appendChild(u),u.appendChild(r),h.innerText="Opacity",h.id="mapml-layer-item-opacity-"+L.stamp(h),d.setAttribute("type","range"),d.setAttribute("min","0"),d.setAttribute("max","1.0"),d.setAttribute("value",this._extent._mapExtents[e]._templateVars.opacity||"1.0"),d.setAttribute("step","0.1"),d.setAttribute("aria-labelledby","mapml-layer-item-opacity-"+L.stamp(h)),this._extent._mapExtents[e]._templateVars.opacity=this._extent._mapExtents[e]._templateVars.opacity||"1.0",L.DomEvent.on(d,"change",this._changeExtentOpacity,this._extent._mapExtents[e]);var x=L.DomUtil.create("span","mapml-layer-item-name",a);return s.defaultChecked=!!this._extent._mapExtents[e],this._extent._mapExtents[e].checked=s.defaultChecked,s.type="checkbox",x.innerHTML=t,L.DomEvent.on(s,"change",t=>{this._changeExtent(t,this._extent._mapExtents[e])}),x.id="mapml-extent-item-name-{"+L.stamp(x)+"}",i.setAttribute("aria-labelledby",x.id),i},getLayerUserControlsHTML:function(){var t=L.DomUtil.create("fieldset","mapml-layer-item"),e=L.DomUtil.create("input"),i=L.DomUtil.create("span","mapml-layer-item-name"),o=L.DomUtil.create("span"),n=L.DomUtil.create("div","mapml-layer-item-properties",t),a=L.DomUtil.create("div","mapml-layer-item-settings",t),s=L.DomUtil.create("label","mapml-layer-item-toggle",n),r=L.DomUtil.create("div","mapml-layer-item-controls",n),l=L.DomUtil.create("details","mapml-layer-item-opacity mapml-control-layers",a),m=L.DomUtil.create("input"),u=L.DomUtil.create("summary"),p=L.SVG.create("svg"),c=L.SVG.create("path"),h=L.SVG.create("path"),d=this._layerEl.parentNode;this.opacityEl=m,p.setAttribute("viewBox","0 0 24 24"),p.setAttribute("height","22"),p.setAttribute("width","22"),c.setAttribute("d","M0 0h24v24H0z"),c.setAttribute("fill","none"),h.setAttribute("d","M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"),p.appendChild(c),p.appendChild(h),a.hidden=!0,o.setAttribute("aria-hidden",!0);let _=L.DomUtil.create("button","mapml-layer-item-remove-control",r);_.type="button",_.title="Remove Layer",_.innerHTML="<span aria-hidden='true'>&#10005;</span>",_.classList.add("mapml-button"),L.DomEvent.on(_,"click",L.DomEvent.stop),L.DomEvent.on(_,"click",t=>{let e,i,o=0;if(i="MAPML-VIEWER"===d.tagName?d.shadowRoot:d.querySelector(".mapml-web-map").shadowRoot,t.target.closest("fieldset").nextElementSibling&&!t.target.closest("fieldset").nextElementSibling.disbaled)for(e=t.target.closest("fieldset").previousElementSibling;e;)o+=2,e=e.previousElementSibling;else e="link";d.removeChild(t.target.closest("fieldset").querySelector("span").layer._layerEl),(e=e?i.querySelector(".leaflet-control-attribution").firstElementChild:e=i.querySelectorAll("input")[o]).focus()},this);let y=L.DomUtil.create("button","mapml-layer-item-settings-control",r);if(y.type="button",y.title="Layer Settings",y.setAttribute("aria-expanded",!1),y.classList.add("mapml-button"),L.DomEvent.on(y,"click",t=>{1==a.hidden?(y.setAttribute("aria-expanded",!0),a.hidden=!1):(y.setAttribute("aria-expanded",!1),a.hidden=!0)},this),e.defaultChecked=!!this._map,e.type="checkbox",i.layer=this,this._legendUrl){var x=document.createElement("a");x.text=" "+this._title,x.href=this._legendUrl,x.target="_blank",x.draggable=!1,i.appendChild(x)}else i.innerHTML=this._title;if(i.id="mapml-layer-item-name-{"+L.stamp(i)+"}",u.innerText="Opacity",u.id="mapml-layer-item-opacity-"+L.stamp(u),l.appendChild(u),l.appendChild(m),m.setAttribute("type","range"),m.setAttribute("min","0"),m.setAttribute("max","1.0"),m.setAttribute("value",this._container.style.opacity||"1.0"),m.setAttribute("step","0.1"),m.setAttribute("aria-labelledby",u.id),m.value=this._container.style.opacity||"1.0",t.setAttribute("aria-grabbed","false"),t.setAttribute("aria-labelledby",i.id),t.onmousedown=(e=>{if("input"===e.target.tagName.toLowerCase()||"select"===e.target.tagName.toLowerCase())return;e.preventDefault();let i=t,o=t.parentNode,n=!1,a=e.clientY;document.body.onmousemove=(t=>{t.preventDefault();let e=t.clientY-a;if(n=Math.abs(e)>5||n,o&&!n||o&&o.childElementCount<=1||o.getBoundingClientRect().top>i.getBoundingClientRect().bottom||o.getBoundingClientRect().bottom<i.getBoundingClientRect().top)return;o.classList.add("mapml-draggable"),i.style.transform="translateY("+e+"px)",i.style.pointerEvents="none";let s=t.clientX,r=t.clientY,l=("MAPML-VIEWER"===d.tagName?d.shadowRoot:d.querySelector(".mapml-web-map").shadowRoot).elementFromPoint(s,r),m=l&&l.closest("fieldset")?l.closest("fieldset"):i;m=Math.abs(e)<=m.offsetHeight?i:m,i.setAttribute("aria-grabbed","true"),i.setAttribute("aria-dropeffect","move"),m&&o===m.parentNode&&(m=m!==i.nextSibling?m:m.nextSibling,i!==m&&(a=t.clientY,i.style.transform=null),o.insertBefore(i,m))}),document.body.onmouseup=(()=>{i.setAttribute("aria-grabbed","false"),i.removeAttribute("aria-dropeffect"),i.style.pointerEvents=null,i.style.transform=null;let t=o.children,e=1;for(let i of t){let t=i.querySelector("span").layer._layerEl;t.setAttribute("data-moving",""),d.insertAdjacentElement("beforeend",t),t.removeAttribute("data-moving"),t._layer.setZIndex(e),e++}o.classList.remove("mapml-draggable"),document.body.onmousemove=document.body.onmouseup=null})}),L.DomEvent.on(m,"change",this._changeOpacity,this),s.appendChild(e),s.appendChild(i),y.appendChild(o),o.appendChild(p),this._styles&&a.appendChild(this._styles),this._userInputs){var f=document.createDocumentFragment(),g=this._extent._templateVars;if(g)for(var b=0;b<g.length;b++)for(var v=g[b],E=0;E<v.values.length;E++){var A=v.values[E],M="#"+A.getAttribute("id");if("map-select"===A.tagName.toLowerCase()&&!f.querySelector(M)){var C=L.DomUtil.create("details","mapml-layer-item-time mapml-control-layers",f),T=L.DomUtil.create("summary"),S=L.DomUtil.create("label");S.innerText=A.getAttribute("name"),S.setAttribute("for",A.getAttribute("id")),T.appendChild(S),C.appendChild(T),C.appendChild(A.htmlselect)}}a.appendChild(f)}if(this._extent&&this._extent._mapExtents){var z=L.DomUtil.create("fieldset","mapml-layer-grouped-extents");z.setAttribute("aria-label","Sublayers");for(let t=0;t<this._extent._mapExtents.length;t++)z.appendChild(this._extent._mapExtents[t].extentAnatomy);a.appendChild(z)}return t},_initExtent:function(t){if(this._href||t){var e,i,o=this;if(this._href){var s=new XMLHttpRequest;e=this._href,i=m,s.onreadystatechange=function(){this.readyState===this.DONE&&(400!==this.status&&404!==this.status&&500!==this.status&&406!==this.status||(o.error=!0,o.fire("extentload",o,!0),s.abort()))},s.onload=i,s.onerror=function(){o.error=!0,o.fire("extentload",o,!0)},s.open("GET",e),s.setRequestHeader("Accept",M.mime),s.overrideMimeType("text/xml"),s.send()}else t&&m.call(this,t)}function r(t){var e=document.createElement("select"),i=t.getAttributeNames();for(let o=0;o<i.length;o++)e.setAttribute(i[o],t.getAttribute(i[o]));var o=t.children;for(let t=0;t<o.length;t++){var n=document.createElement("option"),a=o[t].getAttributeNames();for(let e=0;e<a.length;e++)n.setAttribute(a[e],o[t].getAttribute(a[e]));n.innerHTML=o[t].innerHTML,e.appendChild(n)}return e}function l(t,e,i,s,l,m){var u=[],p=t.querySelectorAll("map-link[rel=tile],map-link[rel=image],map-link[rel=features],map-link[rel=query]"),c=new RegExp("(?:{)(.*?)(?:})","g"),h=t.querySelector('map-input[type="zoom" i]'),d=!1,_={zoom:0};if(e){let t,o=M.metaContentToObject(e.getAttribute("content"));_.zoom=o.zoom||_.zoom;let n=Object.keys(o);for(let e=0;e<n.length;e++)if(!n[e].includes("zoom")){t=M.axisToCS(n[e].split("-")[2]);break}let a=M.csToAxes(t);_.bounds=M.boundsToPCRSBounds(L.bounds(L.point(+o[`top-left-${a[0]}`],+o[`top-left-${a[1]}`]),L.point(+o[`bottom-right-${a[0]}`],+o[`bottom-right-${a[1]}`])),_.zoom,i,t)}else _.bounds=M[i].options.crs.pcrs.bounds;for(var y=0;y<p.length;y++){var x=p[y],f=x.getAttribute("tref");if(!f){f=a;let t=s.querySelectorAll("map-input");for(let e of t)f+=`{${e.getAttribute("name")}}`}for(var g,b=x.hasAttribute("title")?x.getAttribute("title"):"Query this layer",v=f.match(c),E=x.hasAttribute("rel")&&"tile"!==x.getAttribute("rel").toLowerCase()?x.getAttribute("rel").toLowerCase():"tile",A=x.hasAttribute("type")?x.getAttribute("type").toLowerCase():"image/*",C=[],T=x&&x.hasAttribute("tms"),S=s.querySelector("map-meta[name=zoom]")?M.metaContentToObject(s.querySelector("map-meta[name=zoom]").getAttribute("content")):void 0;null!==(g=c.exec(f));){var z=g[1],k=t.querySelector("map-input[name="+z+"],map-select[name="+z+"]");if(!k){console.log("input with name="+z+" not found for template variable of same name");break}if(k.hasAttribute("type")&&"location"===k.getAttribute("type")&&!k.hasAttribute("min")&&k.hasAttribute("axis")&&!["i","j"].includes(k.getAttribute("axis").toLowerCase())){h.setAttribute("value",_.zoom);let t=k.getAttribute("axis"),e=M.convertPCRSBounds(_.bounds,_.zoom,i,M.axisToCS(t));k.setAttribute("min",e.min[M.axisToXY(t)]),k.setAttribute("max",e.max[M.axisToXY(t)])}if(C.push(k),d=d||k.hasAttribute("type")&&"zoom"===k.getAttribute("type").toLowerCase(),k.hasAttribute("shard")){var B=k.getAttribute("list");k.servers=[];var P=t.querySelectorAll("map-datalist#"+B+" > map-option");0===P.length&&k.hasAttribute("value")&&(P=k.getAttribute("value").split(""));for(var I=0;I<P.length;I++)P[I].getAttribute?k.servers.push(P[I].getAttribute("value")):k.servers.push(P[I])}else if("map-select"===k.tagName.toLowerCase()){var w=document.createElement("div");w.insertAdjacentHTML("afterbegin",k.outerHTML),k.htmlselect=w.querySelector("map-select"),k.htmlselect=r(k.htmlselect),L.DomEvent.on(k.htmlselect,"change",o.redraw,o),o._userInputs||(o._userInputs=[]),o._userInputs.push(k.htmlselect)}}(f&&v.length===C.length||f===a)&&("query"===E&&(o.queryable=!0),!d&&h&&C.push(h),u.push({template:decodeURI(new URL(f,l)),linkEl:x,title:b,rel:E,type:A,values:C,zoomBounds:S,projectionMatch:m,projection:t.getAttribute("units")||n,tms:T}))}return u}function m(t){var e=this.responseXML||t;if(e.querySelector&&e.querySelector("map-feature")&&(o._content=e),!this.responseXML&&this.responseText&&(e=(new DOMParser).parseFromString(this.responseText,"text/xml")),this.readyState===this.DONE&&e.querySelector&&!e.querySelector("parsererror")){var i,n,a,s=e.querySelectorAll("map-extent");if(s.length||(a=e.querySelector("map-meta[name=projection]")),s.length>=1)for(let t=0;t<s.length&&("map-extent"===s[t].tagName.toLowerCase()&&s[t].hasAttribute("units")&&(i=s[t].getAttribute("units")),n=i&&i===o.options.mapprojection);t++);else a&&"map-meta"===a.tagName.toLowerCase()&&a.hasAttribute("content")&&(n=(i=M.metaContentToObject(a.getAttribute("content")).content)&&i===o.options.mapprojection);var r=e.querySelector("map-meta[name=extent]"),m=!n&&e.querySelector("map-head map-link[rel=alternate][projection="+o.options.mapprojection+"]"),u=new URL(e.querySelector("map-base")?e.querySelector("map-base").getAttribute("href"):e.baseURI||this.responseURL,this.responseURL).href;if(s.length||a){if(!n&&m&&m.hasAttribute("href"))return void o.fire("changeprojection",{href:new URL(m.getAttribute("href"),u).href},!1);if(!n&&o._map&&1===o._map.options.mapEl.querySelectorAll("layer-").length)return void(o._map.options.mapEl.projection=i);if(a)o._extent=a;else{o._extent={},n&&(o._extent.crs=M[i]),o._extent._mapExtents=[],o._extent._templateVars=[];for(let t=0;t<s.length;t++)if(s[t].querySelector("map-link[rel=tile],map-link[rel=image],map-link[rel=features],map-link[rel=query]")&&s[t].hasAttribute("units")){o._extent._mapExtents.push(s[t]),n=n||m;let a=l.call(o,s[t],r,i,e,u,n);o._extent._mapExtents[t]._templateVars=a,o._extent._templateVars=o._extent._templateVars.concat(a)}}}else s=o._synthesizeExtent(e),e.querySelector("map-feature,map-tile")&&(o._content=e);o._parseLicenseAndLegend(e,o,i);var p=e.querySelector("map-link[rel=zoomin]"),c=e.querySelector("map-link[rel=zoomout]");if(delete o._extent.zoomin,delete o._extent.zoomout,p&&(o._extent.zoomin=new URL(p.getAttribute("href"),u).href),c&&(o._extent.zoomout=new URL(c.getAttribute("href"),u).href),o._extent._mapExtents)for(let t=0;t<o._extent._mapExtents.length;t++)o._extent._mapExtents[t].templatedLayer&&o._extent._mapExtents[t].templatedLayer.reset(o._extent._mapExtents[t]._templateVars);if(e.querySelector("map-tile")){var h=document.createElement("map-tiles"),d=e.querySelector("map-meta[name=zoom][content]")||e.querySelector("map-input[type=zoom][value]");h.setAttribute("zoom",d&&d.getAttribute("content")||d&&d.getAttribute("value")||"0");for(var _=e.getElementsByTagName("map-tile"),y=0;y<_.length;y++)h.appendChild(document.importNode(_[y],!0));o._mapmlTileContainer.appendChild(h)}if(M.parseStylesheetAsHTML(e,u,o._container),o._extent._mapExtents)for(let t=0;t<o._extent._mapExtents.length;t++){var x=o._extent._mapExtents[t].getAttribute("label");x||(x=o._layerEl.getAttribute("label")+" Extent");var f=o.getLayerExtentHTML(x,t);o._extent._mapExtents[t].extentAnatomy=f}var g=e.querySelectorAll('map-link[rel=style],map-link[rel="self style"],map-link[rel="style self"]');if(g.length>1){var b=document.createElement("details"),v=document.createElement("summary");v.innerText="Style",b.appendChild(v);for(var E=function(t){o.fire("changestyle",{src:t.target.getAttribute("data-href")},!1)},A=0;A<g.length;A++){var C=document.createElement("div"),T=C.appendChild(document.createElement("input"));T.setAttribute("type","radio"),T.setAttribute("id","rad-"+L.stamp(T)),T.setAttribute("name","styles-"+this._title),T.setAttribute("value",g[A].getAttribute("title")),T.setAttribute("data-href",new URL(g[A].getAttribute("href"),u).href);var S=C.appendChild(document.createElement("label"));S.setAttribute("for","rad-"+L.stamp(T)),S.innerText=g[A].getAttribute("title"),"style self"!==g[A].getAttribute("rel")&&"self style"!==g[A].getAttribute("rel")||(T.checked=!0),b.appendChild(C),L.DomUtil.addClass(b,"mapml-layer-item-style mapml-control-layers"),L.DomEvent.on(T,"click",E,o)}o._styles=b}e.querySelector("map-title")?o._title=e.querySelector("map-title").textContent.trim():e instanceof Element&&e.hasAttribute("label")&&(o._title=e.getAttribute("label").trim()),o._map&&(o._validateExtent(),o._map.hasLayer(o)&&o._map.attributionControl.addAttribution(o.getAttribution()))}else o.error=!0;o.fire("extentload",o,!1),o._layerEl.dispatchEvent(new CustomEvent("extentload",{detail:o}))}},_createExtent:function(){var t=document.createElement("map-extent"),e=document.createElement("map-input"),i=document.createElement("map-input"),o=document.createElement("map-input"),n=document.createElement("map-input"),a=document.createElement("map-input"),s=document.createElement("map-input");return a.setAttribute("type","zoom"),a.setAttribute("min","0"),a.setAttribute("max","0"),e.setAttribute("type","xmin"),e.setAttribute("min",""),e.setAttribute("max",""),i.setAttribute("type","ymin"),i.setAttribute("min",""),i.setAttribute("max",""),o.setAttribute("type","xmax"),o.setAttribute("min",""),o.setAttribute("max",""),n.setAttribute("type","ymax"),n.setAttribute("min",""),n.setAttribute("max",""),s.setAttribute("type","projection"),s.setAttribute("value","WGS84"),t.appendChild(e),t.appendChild(i),t.appendChild(o),t.appendChild(n),t.appendChild(a),t.appendChild(s),t},_validateExtent:function(){if(this._extent&&this._map){var t,e=this._extent._mapExtents?this._extent._mapExtents:[this._extent];for(let o=0;o<e.length;o++){if(!e[o].querySelector)return;if(e[o].querySelector('[type=zoom][min=""], [type=zoom][max=""]')){var i=e[o].querySelector("[type=zoom]");i.setAttribute("min",this._map.getMinZoom()),i.setAttribute("max",this._map.getMaxZoom())}(t=e[o].hasAttribute("units")?e[o].getAttribute("units"):null)&&M[t]?this._extent._mapExtents?this._extent._mapExtents[o].crs=M[t]:this._extent.crs=M[t]:this._extent._mapExtents?this._extent._mapExtents[o].crs=M.OSMTILE:this._extent.crs=M.OSMTILE}}},_getMapMLExtent:function(t,e,i){var o=this._createExtent(),n=o.querySelector("map-input[type=zoom]"),a=o.querySelector("map-input[type=xmin]"),s=o.querySelector("map-input[type=ymin]"),r=o.querySelector("map-input[type=xmax]"),l=o.querySelector("map-input[type=ymax]"),m=o.querySelector("map-input[type=projection]"),u=void 0!==e[0]&&void 0!==e[1]?Math.min(e[0],e[1]):"",p=void 0!==e[0]&&void 0!==e[1]?Math.max(e[0],e[1]):"",c=t?t._southWest?t.getWest():t.getBottomLeft().x:"",h=t?t._southWest?t.getSouth():t.getTopRight().y:"",d=t?t._southWest?t.getEast():t.getTopRight().x:"",_=t?t._southWest?t.getNorth():t.getBottomLeft().y:"";return n.setAttribute("min","number"==typeof u&&isNaN(u)?"":u),n.setAttribute("max","number"==typeof p&&isNaN(p)?"":p),a.setAttribute("min",c),a.setAttribute("max",d),s.setAttribute("min",h),s.setAttribute("max",_),r.setAttribute("min",c),r.setAttribute("max",d),l.setAttribute("min",h),l.setAttribute("max",_),m.setAttribute("value",t&&t._southWest&&!i?"WGS84":i),o},_synthesizeExtent:function(t){var e,i,o,a,s,r,l,m,u,p,c,h,d=t.querySelectorAll("map-meta[name=zoom]")[0],_=t.querySelector("map-meta[name=extent]"),y=t.querySelector("map-meta[name=projection]"),x=y?y.getAttribute("content"):n;if(d)for(i=d.getAttribute("content").split(","),e=0;e<i.length;e++)c=(p=i[e].split("="))[0],h=p[1],"min"===c&&(a=parseInt(h)),"max"===c&&(s=parseInt(h));if(_)for(i=_.getAttribute("content").split(","),e=0;e<i.length;e++)c=(p=i[e].split("="))[0],h=p[1],"xmin"===c&&(r=parseFloat(h)),"xmax"===c&&(m=parseFloat(h)),"ymin"===c&&(l=parseFloat(h)),"ymax"===c&&(u=parseFloat(h));if(r&&l&&m&&u&&"WGS84"===x){var f=L.latLng(l,r),g=L.latLng(u,m);o=L.latLngBounds(f,g)}else r&&l&&m&&u&&(o=L.bounds([[r,l],[m,u]]));return this._getMapMLExtent(o,[a,s],x)},getProjection:function(){let t=this._extent._mapExtents?this._extent._mapExtents[0]:this._extent;if(!t)return n;switch(t.tagName.toUpperCase()){case"MAP-EXTENT":if(t.hasAttribute("units"))return t.getAttribute("units").toUpperCase();break;case"MAP-INPUT":if(t.hasAttribute("value"))return t.getAttribute("value").toUpperCase();break;case"MAP-META":if(t.hasAttribute("content"))return M.metaContentToObject(t.getAttribute("content")).content.toUpperCase();break;default:return n}return n},_parseLicenseAndLegend:function(t,e){var i,o,n=t.querySelector("map-link[rel=license]");n&&(i=n.getAttribute("title"),o='<a href="'+n.getAttribute("href")+'" title="'+i+'">'+i+"</a>"),L.setOptions(e,{attribution:o});var a=t.querySelector("map-link[rel=legend]");a&&(e._legendUrl=a.getAttribute("href"))},_getUnprojectedMapLatLngBounds:function(t){var e=(t=t||this._map).getPixelOrigin(),i=t.getPixelBounds(),o=t.unproject(e),n=t.unproject(i.getBottomLeft()),a=t.unproject(i.getTopRight()),s=t.unproject(e.add(t.getSize()));return L.latLngBounds(n,a).extend(s).extend(o)},_projectionMatches:function(t){t=t||this._map;var e=this.getProjection();return!(!t.options.projection||"WGS84"!==e&&t.options.projection!==e)},getQueryTemplates:function(t){if(this._extent&&this._extent._queries){var e=[];for(let i=0;i<this._extent._queries.length;i++)this._extent._queries[i].extentBounds.contains(t)&&e.push(this._extent._queries[i]);return e}},_attachSkipButtons:function(t){let e,i,o=t.popup,n=t.target,a=o._container.getElementsByClassName("mapml-popup-content")[0];o._container.setAttribute("role","dialog"),a.setAttribute("tabindex","-1"),a.setAttribute("role","document"),o._count=0,o._source._eventParents?(e=o._source._eventParents[Object.keys(o._source._eventParents)[0]],i=o._source.group):e=o._source._templatedLayer,o._container.querySelector('nav[class="mapml-focus-buttons"]')&&(L.DomUtil.remove(o._container.querySelector('nav[class="mapml-focus-buttons"]')),L.DomUtil.remove(o._container.querySelector("hr")));let s=L.DomUtil.create("nav","mapml-focus-buttons"),r=L.DomUtil.create("button","mapml-popup-button",s);r.type="button",r.title="Focus Map",r.innerHTML="<span aria-hidden='true'>|&#10094;</span>",L.DomEvent.on(r,"click",t=>{L.DomEvent.stop(t),n.featureIndex._sortIndex(),n.closePopup(),n._container.focus()},o);let l=L.DomUtil.create("button","mapml-popup-button",s);l.type="button",l.title="Previous Feature",l.innerHTML="<span aria-hidden='true'>&#10094;</span>",L.DomEvent.on(l,"click",e._previousFeature,o);let m=L.DomUtil.create("p","mapml-feature-count",s),u=this._totalFeatureCount?this._totalFeatureCount:1;m.innerText=o._count+1+"/"+u;let p=L.DomUtil.create("button","mapml-popup-button",s);p.type="button",p.title="Next Feature",p.innerHTML="<span aria-hidden='true'>&#10095;</span>",L.DomEvent.on(p,"click",e._nextFeature,o);let c=L.DomUtil.create("button","mapml-popup-button",s);c.type="button",c.title="Focus Controls",c.innerHTML="<span aria-hidden='true'>&#10095;|</span>",L.DomEvent.on(c,"click",t=>{n.featureIndex._sortIndex(),n.featureIndex.currentIndex=n.featureIndex.inBoundFeatures.length-1,n.featureIndex.inBoundFeatures[0].path.setAttribute("tabindex",-1),n.featureIndex.inBoundFeatures[n.featureIndex.currentIndex].path.setAttribute("tabindex",0),L.DomEvent.stop(t),n.closePopup(),n._controlContainer.querySelector("A").focus()},o);let h=L.DomUtil.create("hr");function d(t){let e=t.originalEvent.path||t.originalEvent.composedPath(),a=9===t.originalEvent.keyCode,s=t.originalEvent.shiftKey;e[0].classList.contains("leaflet-popup-close-button")&&a&&!s||27===t.originalEvent.keyCode?setTimeout(()=>{L.DomEvent.stop(t),n.closePopup(o),i.focus()},0):("Focus Map"===e[0].title||e[0].classList.contains("mapml-popup-content"))&&a&&s&&setTimeout(()=>{L.DomEvent.stop(t),n.closePopup(o),i.focus()},0)}function _(t){let e=t.originalEvent.path||t.originalEvent.composedPath(),i=9===t.originalEvent.keyCode,a=t.originalEvent.shiftKey;13===t.originalEvent.keyCode&&e[0].classList.contains("leaflet-popup-close-button")||27===t.originalEvent.keyCode?(L.DomEvent.stopPropagation(t),n._container.focus(),n.closePopup(o),27!==t.originalEvent.keyCode&&(n._popupClosed=!0)):i&&e[0].classList.contains("leaflet-popup-close-button")?n.closePopup(o):("Focus Map"===e[0].title||e[0].classList.contains("mapml-popup-content"))&&i&&a&&setTimeout(()=>{L.DomEvent.stop(t),n.closePopup(o),n._container.focus()},0)}o._navigationBar=s,o._content.appendChild(h),o._content.appendChild(s),a.focus(),i?(i.setAttribute("aria-expanded","true"),n.on("keydown",d)):n.on("keydown",_),n.on("popupclose",function t(e){e.popup===o&&(n.off("keydown",d),n.off("keydown",_),n.off("popupclose",t),i&&i.setAttribute("aria-expanded","false"))})}}),g=function(t,e,i){return t||e?new f(t,e,i):null},b=L.Layer.extend({onAdd:function(t){let e=t.getSize();(e.x>400||e.y>300)&&(this._container=L.DomUtil.create("table","mapml-debug",t._container),this._panel=A({className:"mapml-debug-panel",pane:this._container}),t.addLayer(this._panel)),this._grid=T({className:"mapml-debug-grid",pane:t._panes.mapPane,zIndex:400,tileSize:t.options.crs.options.crs.tile.bounds.max.x}),t.addLayer(this._grid),this._vectors=z({className:"mapml-debug-vectors",pane:t._panes.mapPane,toolPane:this._container}),t.addLayer(this._vectors)},onRemove:function(t){t.removeLayer(this._grid),t.removeLayer(this._vectors),this._panel&&(t.removeLayer(this._panel),L.DomUtil.remove(this._container))}}),v=function(){return new b},E=L.Layer.extend({initialize:function(t){L.setOptions(this,t)},onAdd:function(t){this._title=L.DomUtil.create("caption","mapml-debug-banner",this.options.pane),this._title.innerHTML="Debug mode",t.debug={},t.debug._infoContainer=this._debugContainer=L.DomUtil.create("tbody","mapml-debug-panel",this.options.pane);let e=t.debug._infoContainer;t.debug._tileCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._tileMatrixCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._mapCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._tcrsCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._pcrsCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._gcrsCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),this._map.on("mousemove",this._updateCoords)},onRemove:function(){L.DomUtil.remove(this._title),this._debugContainer&&(L.DomUtil.remove(this._debugContainer),this._map.off("mousemove",this._updateCoords))},_updateCoords:function(t){if(this.contextMenu._visible)return;let e=this.options.mapEl,i=e._map.project(t.latlng),o=e._map.options.crs.scale(+e.zoom),n=e._map.options.crs.transformation.untransform(i,o),a=e._map.options.crs.options.crs.tile.bounds.max.x,s=i.x%a,r=i.y%a;s<0&&(s+=a),r<0&&(r+=a),this.debug._tileCoord.innerHTML=`\n      <th scope="row">tile: </th>\n      <td>i: ${Math.trunc(s)}, </td>\n      <td>j: ${Math.trunc(r)}</td>\n      `,this.debug._mapCoord.innerHTML=`\n      <th scope="row">map: </th>\n      <td>i: ${Math.trunc(t.containerPoint.x)}, </td>\n      <td>j: ${Math.trunc(t.containerPoint.y)}</td>\n      `,this.debug._gcrsCoord.innerHTML=`\n      <th scope="row">gcrs: </th>\n      <td>lon: ${t.latlng.lng.toFixed(6)}, </td>\n      <td>lat: ${t.latlng.lat.toFixed(6)}</td>\n      `,this.debug._tcrsCoord.innerHTML=`\n      <th scope="row">tcrs: </th>\n      <td>x: ${Math.trunc(i.x)}, </td>\n      <td>y: ${Math.trunc(i.y)}</td>\n      `,this.debug._tileMatrixCoord.innerHTML=`\n      <th scope="row">tilematrix: </th>\n      <td>column: ${Math.trunc(i.x/a)}, </td>\n      <td>row: ${Math.trunc(i.y/a)}</td>\n      `,this.debug._pcrsCoord.innerHTML=`\n      <th scope="row">pcrs: </th>\n      <td>easting: ${n.x.toFixed(2)}, </td>\n      <td>northing: ${n.y.toFixed(2)}</td>\n      `}}),A=function(t){return new E(t)},C=L.GridLayer.extend({initialize:function(t){L.setOptions(this,t),L.GridLayer.prototype.initialize.call(this,this._map)},createTile:function(t){let e=L.DomUtil.create("div","mapml-debug-tile");return e.setAttribute("col",t.x),e.setAttribute("row",t.y),e.setAttribute("zoom",t.z),e.innerHTML=[`col: ${t.x}`,`row: ${t.y}`,`zoom: ${t.z}`].join(", "),e.style.outline="1px dashed red",e}}),T=function(t){return new C(t)},S=L.LayerGroup.extend({initialize:function(t){L.setOptions(this,t),L.LayerGroup.prototype.initialize.call(this,this._map,t)},onAdd:function(t){t.on("overlayremove",this._mapLayerUpdate,this),t.on("overlayadd",this._mapLayerUpdate,this);let e=t.options.crs.transformation.transform(L.point(0,0),t.options.crs.scale(0));this._centerVector=L.circle(t.options.crs.pointToLatLng(e,0),{radius:250}),this._centerVector.bindTooltip("Projection Center"),this._addBounds(t)},onRemove:function(t){this.clearLayers()},_addBounds:function(t){let e=Object.keys(t._layers),i=t._layers,o=["#FF5733","#8DFF33","#3397FF","#E433FF","#F3FF33"],n=0;this.addLayer(this._centerVector);for(let t of e)if(i[t].layerBounds||i[t].extentBounds){let e;e=i[t].layerBounds?[i[t].layerBounds.min,L.point(i[t].layerBounds.max.x,i[t].layerBounds.min.y),i[t].layerBounds.max,L.point(i[t].layerBounds.min.x,i[t].layerBounds.max.y)]:[i[t].extentBounds.min,L.point(i[t].extentBounds.max.x,i[t].extentBounds.min.y),i[t].extentBounds.max,L.point(i[t].extentBounds.min.x,i[t].extentBounds.max.y)];let a=B(e,{color:o[n%o.length],weight:2,opacity:1,fillOpacity:.01,fill:!0});i[t].options._leafletLayer&&a.bindTooltip(i[t].options._leafletLayer._title,{sticky:!0}),this.addLayer(a),n++}if(t.totalLayerBounds){let e=[t.totalLayerBounds.min,L.point(t.totalLayerBounds.max.x,t.totalLayerBounds.min.y),t.totalLayerBounds.max,L.point(t.totalLayerBounds.min.x,t.totalLayerBounds.max.y)],i=B(e,{color:"#808080",weight:5,opacity:.5,fill:!1});this.addLayer(i)}},_mapLayerUpdate:function(t){this.clearLayers(),this._addBounds(t.target)}}),z=function(t){return new S(t)},k=L.Path.extend({options:{className:"mapml-debug-extent"},initialize:function(t,e){this._locations=t,L.setOptions(this,e)},_project:function(){this._rings=[];let t=this._map.options.crs.scale(this._map.getZoom()),e=this._map;for(let i=0;i<this._locations.length;i++){let o=e.options.crs.transformation.transform(this._locations[i],t);this._rings.push(L.point(o.x,o.y)._subtract(e.getPixelOrigin()))}this._parts=[this._rings]},_update:function(){this._map&&this._renderer._updatePoly(this,!0)}}),B=function(t,e){return new k(t,e)},P=L.Handler.extend({addHooks:function(){L.setOptions(this,{mapEl:this._map.options.mapEl}),L.DomEvent.on(this._map,"click",this._queryTopLayer,this),L.DomEvent.on(this._map,"keypress",this._queryTopLayerAtMapCenter,this)},removeHooks:function(){L.DomEvent.off(this._map,"click",this._queryTopLayer,this),L.DomEvent.on(this._map,"keypress",this._queryTopLayerAtMapCenter,this)},_getTopQueryableLayer:function(){for(var t=this.options.mapEl.layers,e=t.length-1;e>=0;e--){var i=t[e]._layer;if(t[e].checked&&i.queryable)return i}},_queryTopLayerAtMapCenter:function(t){setTimeout(()=>{!this._map.isFocused||this._map._popupClosed||" "!==t.originalEvent.key&&13!=+t.originalEvent.keyCode?delete this._map._popupClosed:this._map.fire("click",{latlng:this._map.getCenter(),layerPoint:this._map.latLngToLayerPoint(this._map.getCenter()),containerPoint:this._map.latLngToContainerPoint(this._map.getCenter())})},0)},_queryTopLayer:function(t){var e=this._getTopQueryableLayer();e&&(e._mapmlFeatures&&delete e._mapmlFeatures,this._query(t,e))},_query(t,e){var i=t.target.getZoom(),o=this._map,n=e._extent.crs,a=o.options.crs.options.crs.tile.bounds.max.x,s=e._container,r={autoClose:!1,autoPan:!0,maxHeight:.5*o.getSize().y-50},l=function(t){return n.transformation.untransform(t,n.scale(i))},m=function(t){return n.unproject(n.transformation.untransform(t,n.scale(i)),i)},u=n.latLngToPoint(t.latlng,i),p=u.divideBy(a).floor(),c=new L.Bounds(u.divideBy(a).floor().multiplyBy(a),u.divideBy(a).ceil().multiplyBy(a));let h,d=this._map.project(t.latlng),_=this._map.options.crs.scale(this._map.getZoom()),y=this._map.options.crs.transformation.untransform(d,_);var x=e.getQueryTemplates(y),f=function(i,n,a){fetch(L.Util.template(i.template,n),{redirect:"follow"}).then(t=>{if(h=t.headers.get("Content-Type"),t.status>=200&&t.status<300)return t.text();throw new Error(t.status)}).then(i=>{if(!h.startsWith("text/mapml"))return function(t,e,i){let o=L.DomUtil.create("div","mapml-popup-content"),n=L.DomUtil.create("iframe");n.style="border: none",n.srcdoc=t,n.setAttribute("sandbox","allow-same-origin allow-forms"),o.appendChild(n),e.bindPopup(o,r).openPopup(i)}(i,e,t.latlng);{e._mapmlFeatures||(e._mapmlFeatures=[]);let n=(new DOMParser).parseFromString(i,"application/xml"),l=Array.prototype.slice.call(n.querySelectorAll("map-feature"));if(l.length&&(e._mapmlFeatures=e._mapmlFeatures.concat(l)),n.features=e._mapmlFeatures,a)return function(t,i){for(let e of t.features)if(!e.querySelector("map-geometry")){let t=document.createElement("map-geometry"),o=document.createElement("map-point"),n=document.createElement("map-coordinates");t.setAttribute("cs","gcrs"),n.innerHTML=`${i.lng} ${i.lat}`,o.appendChild(n),t.appendChild(o),e.appendChild(t)}let n=M.mapMlFeatures(t,{renderer:M.featureRenderer(),pane:s,projection:o.options.projection,_leafletLayer:e,query:!0,static:!0});n.addTo(o);let a=L.DomUtil.create("div","mapml-popup-content"),l=L.DomUtil.create("iframe");l.style="border: none",l.srcdoc=t.querySelector("map-feature map-properties").innerHTML,l.setAttribute("sandbox","allow-same-origin allow-forms"),a.appendChild(l),e._totalFeatureCount=t.features.length,e.bindPopup(a,r).openPopup(i),e.on("popupclose",function(){o.removeLayer(n)}),n.showPaginationFeature({i:0,popup:e._popup})}(n,t.latlng)}}).catch(t=>{console.log("Looks like there was a problem. Status: "+t.message)})};for(let t=0;t<x.length;t++){var g={},b=x[t];for(var v in g[b.query.tilei]=u.x.toFixed()-p.x*a,g[b.query.tilej]=u.y.toFixed()-p.y*a,g[b.query.mapi]=o.getSize().divideBy(2).x.toFixed(),g[b.query.mapj]=o.getSize().divideBy(2).y.toFixed(),g[b.query.pixelleft]=n.pointToLatLng(u,i).lng,g[b.query.pixeltop]=n.pointToLatLng(u,i).lat,g[b.query.pixelright]=n.pointToLatLng(u.add([1,1]),i).lng,g[b.query.pixelbottom]=n.pointToLatLng(u.add([1,1]),i).lat,g[b.query.column]=p.x,g[b.query.row]=p.y,g[b.query.x]=u.x.toFixed(),g[b.query.y]=u.y.toFixed(),g[b.query.easting]=l(u).x,g[b.query.northing]=l(u).y,g[b.query.longitude]=m(u).lng,g[b.query.latitude]=m(u).lat,g[b.query.zoom]=i,g[b.query.width]=o.getSize().x,g[b.query.height]=o.getSize().y,g[b.query.mapbottom]=l(u.add(o.getSize().divideBy(2))).y,g[b.query.mapleft]=l(u.subtract(o.getSize().divideBy(2))).x,g[b.query.maptop]=l(u.subtract(o.getSize().divideBy(2))).y,g[b.query.mapright]=l(u.add(o.getSize().divideBy(2))).x,g[b.query.tilebottom]=l(c.max).y,g[b.query.tileleft]=l(c.min).x,g[b.query.tiletop]=l(c.min).y,g[b.query.tileright]=l(c.max).x,b.query)["mapi","mapj","tilei","tilej","row","col","x","y","easting","northing","longitude","latitude","width","height","zoom","mapleft","mapright",",maptop","mapbottom","tileleft","tileright","tiletop","tilebottom","pixeltop","pixelbottom","pixelleft","pixelright"].indexOf(v)<0&&(g[v]=b.query[v]);if(b.extentBounds.contains(y)){f(b,g,t===x.length-1)}}}}),I=L.Handler.extend({_touchstart:L.Browser.msPointer?"MSPointerDown":L.Browser.pointer?"pointerdown":"touchstart",initialize:function(t){L.Handler.prototype.initialize.call(this,t),this._items=[{text:M.options.locale.cmBack+" (<kbd>B</kbd>)",callback:this._goBack},{text:M.options.locale.cmForward+" (<kbd>F</kbd>)",callback:this._goForward},{text:M.options.locale.cmReload+" (<kbd>R</kbd>)",callback:this._reload},{spacer:"-"},{text:M.options.locale.cmToggleControls+" (<kbd>T</kbd>)",callback:this._toggleControls},{text:M.options.locale.cmCopyCoords+" (<kbd>C</kbd>)<span></span>",callback:this._copyCoords,hideOnSelect:!1,popup:!0,submenu:[{text:"tile",callback:this._copyTile},{text:"tilematrix",callback:this._copyTileMatrix},{spacer:"-"},{text:"map",callback:this._copyMap},{spacer:"-"},{text:"tcrs",callback:this._copyTCRS},{text:"pcrs",callback:this._copyPCRS},{text:"gcrs",callback:this._copyGCRS},{spacer:"-"},{text:M.options.locale.cmCopyAll,callback:this._copyAllCoords}]},{text:M.options.locale.cmToggleDebug+" (<kbd>D</kbd>)",callback:this._toggleDebug},{text:M.options.locale.cmCopyMapML+" (<kbd>M</kbd>)",callback:this._copyMapML},{text:M.options.locale.cmViewSource+" (<kbd>V</kbd>)",callback:this._viewSource}],this._layerItems=[{text:M.options.locale.lmZoomToLayer+" (<kbd>Z</kbd>)",callback:this._zoomToLayer},{text:M.options.locale.lmCopyExtent+" (<kbd>C</kbd>)",callback:this._copyLayerExtent}],this._mapMenuVisible=!1,this._keyboardEvent=!1,this._container=L.DomUtil.create("div","mapml-contextmenu",t._container),this._container.setAttribute("hidden","");for(let t=0;t<6;t++)this._items[t].el=this._createItem(this._container,this._items[t]);this._coordMenu=L.DomUtil.create("div","mapml-contextmenu mapml-submenu",this._container),this._coordMenu.id="mapml-copy-submenu",this._coordMenu.setAttribute("hidden",""),this._clickEvent=null;for(let t=0;t<this._items[5].submenu.length;t++)this._createItem(this._coordMenu,this._items[5].submenu[t],t);this._items[6].el=this._createItem(this._container,this._items[6]),this._items[7].el=this._createItem(this._container,this._items[7]),this._items[8].el=this._createItem(this._container,this._items[8]),this._layerMenu=L.DomUtil.create("div","mapml-contextmenu mapml-layer-menu",t._container),this._layerMenu.setAttribute("hidden","");for(let t=0;t<this._layerItems.length;t++)this._createItem(this._layerMenu,this._layerItems[t]);L.DomEvent.on(this._container,"click",L.DomEvent.stop).on(this._container,"mousedown",L.DomEvent.stop).on(this._container,"dblclick",L.DomEvent.stop).on(this._container,"contextmenu",L.DomEvent.stop).on(this._layerMenu,"click",L.DomEvent.stop).on(this._layerMenu,"mousedown",L.DomEvent.stop).on(this._layerMenu,"dblclick",L.DomEvent.stop).on(this._layerMenu,"contextmenu",L.DomEvent.stop)},addHooks:function(){var t=this._map.getContainer();L.DomEvent.on(t,"mouseleave",this._hide,this).on(document,"keydown",this._onKeyDown,this),L.Browser.touch&&L.DomEvent.on(document,this._touchstart,this._hide,this),this._map.on({contextmenu:this._show,mousedown:this._hide,zoomstart:this._hide},this)},removeHooks:function(){var t=this._map.getContainer();L.DomEvent.off(t,"mouseleave",this._hide,this).off(document,"keydown",this._onKeyDown,this),L.Browser.touch&&L.DomEvent.off(document,this._touchstart,this._hide,this),this._map.off({contextmenu:this._show,mousedown:this._hide,zoomstart:this._hide},this)},_copyLayerExtent:function(t){let e=t instanceof KeyboardEvent?this._map.contextMenu:this.contextMenu,i=e._layerClicked.layer._layerEl,o=i.extent.topLeft.pcrs,n=i.extent.bottomRight.pcrs,a=`<map-meta name="extent" content="top-left-easting=${o.horizontal}, top-left-northing=${o.vertical}, bottom-right-easting=${n.horizontal}, bottom-right-northing=${n.vertical}"></map-meta>`;e._copyData(a)},_zoomToLayer:function(t){(t instanceof KeyboardEvent?this._map.contextMenu:this.contextMenu)._layerClicked.layer._layerEl.focus()},_goForward:function(t){(t instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl).forward()},_goBack:function(t){(t instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl).back()},_reload:function(t){(t instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl).reload()},_toggleControls:function(t){(t instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl)._toggleControls()},_copyMapML:function(t){let e=t instanceof KeyboardEvent?this._map.contextMenu:this.contextMenu,i=t instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl;e._copyData(i.outerHTML.replace(/<div class="mapml-web-map">.*?<\/div>|<style>\[is="web-map"].*?<\/style>|<style>mapml-viewer.*?<\/style>/gm,""))},_viewSource:function(t){(t instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl).viewSource()},_toggleDebug:function(t){(t instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl).toggleDebug()},_copyCoords:function(t){(this.contextMenu?this.contextMenu:this)._showCoordMenu(t)},_copyData:function(t){const e=document.createElement("textarea");e.value=t,document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)},_copyGCRS:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent;this.contextMenu._copyData(`z:${e.zoom}, lon :${i.latlng.lng.toFixed(6)}, lat:${i.latlng.lat.toFixed(6)}`)},_copyTCRS:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent,o=e._map.project(i.latlng);this.contextMenu._copyData(`z:${e.zoom}, x:${o.x}, y:${o.y}`)},_copyTileMatrix:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent,o=e._map.project(i.latlng),n=e._map.options.crs.options.crs.tile.bounds.max.x;this.contextMenu._copyData(`z:${e.zoom}, column:${Math.trunc(o.x/n)}, row:${Math.trunc(o.y/n)}`)},_copyPCRS:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent,o=e._map.project(i.latlng),n=e._map.options.crs.scale(+e.zoom),a=e._map.options.crs.transformation.untransform(o,n);this.contextMenu._copyData(`z:${e.zoom}, easting:${a.x.toFixed(2)}, northing:${a.y.toFixed(2)}`)},_copyTile:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent,o=e._map.options.crs.project(i.latlng),n=e._map.options.crs.options.crs.tile.bounds.max.x,a=o.x%n,s=o.y%n;a<0&&(a+=n),s<0&&(s+=n),this.contextMenu._copyData(`z:${e.zoom}, i:${Math.trunc(a)}, j:${Math.trunc(s)}`)},_copyMap:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent;this.contextMenu._copyData(`z:${e.zoom}, i:${Math.trunc(i.containerPoint.x)}, j:${Math.trunc(i.containerPoint.y)}`)},_copyAllCoords:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent,o=e._map.project(i.latlng),n=e._map.options.crs.options.crs.tile.bounds.max.x,a=o.x%n,s=o.y%n,r=e._map.options.crs.scale(+e.zoom),l=e._map.options.crs.transformation.untransform(o,r),m=`z:${e.zoom}\n`;m+=`tile: i:${Math.trunc(a)}, j:${Math.trunc(s)}\n`,m+=`tilematrix: column:${Math.trunc(o.x/n)}, row:${Math.trunc(o.y/n)}\n`,m+=`map: i:${Math.trunc(i.containerPoint.x)}, j:${Math.trunc(i.containerPoint.y)}\n`,m+=`tcrs: x:${Math.trunc(o.x)}, y:${Math.trunc(o.y)}\n`,m+=`pcrs: easting:${l.x.toFixed(2)}, northing:${l.y.toFixed(2)}\n`,m+=`gcrs: lon :${i.latlng.lng.toFixed(6)}, lat:${i.latlng.lat.toFixed(6)}`,this.contextMenu._copyData(m)},_createItem:function(t,e,i){if(e.spacer)return this._createSeparator(t,i);var o=this._insertElementAt("button","mapml-contextmenu-item",t,i),n=this._createEventHandler(o,e.callback,e.context,e.hideOnSelect);return o.innerHTML=""+e.text,o.setAttribute("type","button"),o.classList.add("mapml-button"),e.popup&&(o.setAttribute("aria-haspopup","true"),o.setAttribute("aria-expanded","false"),o.setAttribute("aria-controls","mapml-copy-submenu")),L.DomEvent.on(o,"mouseover",this._onItemMouseOver,this).on(o,"mouseout",this._onItemMouseOut,this).on(o,"mousedown",L.DomEvent.stopPropagation).on(o,"click",n),L.Browser.touch&&L.DomEvent.on(o,this._touchstart,L.DomEvent.stopPropagation),L.Browser.pointer||L.DomEvent.on(o,"click",this._onItemMouseOut,this),{id:L.Util.stamp(o),el:o,callback:n}},_createSeparator:function(t,e){let i=this._insertElementAt("div","mapml-contextmenu-separator",t,e);return{id:L.Util.stamp(i),el:i}},_createEventHandler:function(t,e,i,o){let n=this;return o=void 0===o||o,function(a){let s=n._map,r=n._showLocation.containerPoint,l=s.containerPointToLayerPoint(r),m={containerPoint:r,layerPoint:l,latlng:s.layerPointToLatLng(l),relatedTarget:n._showLocation.relatedTarget};o&&n._hide(),e&&e.call(i||s,m),n._map.fire("contextmenu.select",{contextmenu:n,el:t})}},_insertElementAt:function(t,e,i,o){let n,a=document.createElement(t);return a.className=e,void 0!==o&&(n=i.children[o]),n?i.insertBefore(a,n):i.appendChild(a),a},_show:function(t){this._mapMenuVisible&&this._hide(),this._clickEvent=t;let e=t.originalEvent.target;if(e.closest("fieldset")){if(!(e=e.closest("fieldset").querySelector("span")).layer.validProjection)return;this._layerClicked=e,this._showAtPoint(t.containerPoint,t,this._layerMenu)}else(e.classList.contains("leaflet-container")||e.classList.contains("mapml-debug-extent")||"path"===e.tagName)&&(this._layerClicked=void 0,this._showAtPoint(t.containerPoint,t,this._container));if(0===t.originalEvent.button||-1===t.originalEvent.button)if(this._keyboardEvent=!0,this._layerClicked){let t=document.activeElement;this._elementInFocus=t.shadowRoot.activeElement,this._layerMenuTabs=1,this._layerMenu.firstChild.focus()}else this._container.firstChild.focus()},_showAtPoint:function(t,e,i){if(this._items.length){let o=L.extend(e||{},{contextmenu:this});this._showLocation={containerPoint:t},e&&e.relatedTarget&&(this._showLocation.relatedTarget=e.relatedTarget),this._setPosition(t,i),this._mapMenuVisible||(i.removeAttribute("hidden"),this._mapMenuVisible=!0),this._map.fire("contextmenu.show",o)}},_hide:function(){this._mapMenuVisible&&(this._mapMenuVisible=!1,this._container.setAttribute("hidden",""),this._coordMenu.setAttribute("hidden",""),this._layerMenu.setAttribute("hidden",""),this._map.fire("contextmenu.hide",{contextmenu:this}),setTimeout(()=>this._map._container.focus(),0))},_setPosition:function(t,e){let i,o=this._map.getSize(),n=this._getElementSize(e);this._map.options.contextmenuAnchor&&(i=L.point(this._map.options.contextmenuAnchor),t=t.add(i)),e._leaflet_pos=t,t.x+n.x>o.x?(e.style.left="auto",e.style.right=Math.min(Math.max(o.x-t.x,0),o.x-n.x-1)+"px"):(e.style.left=Math.max(t.x,0)+"px",e.style.right="auto"),t.y+n.y>o.y?(e.style.top="auto",e.style.bottom=Math.min(Math.max(o.y-t.y,0),o.y-n.y-1)+"px"):(e.style.top=Math.max(t.y,0)+"px",e.style.bottom="auto")},_getElementSize:function(t){let e=this._size;return e&&!this._sizeChanged||(e={},t.style.left="-999999px",t.style.right="auto",e.x=t.offsetWidth,e.y=t.offsetHeight,t.style.left="auto",this._sizeChanged=!1),e},_focusOnLayerControl:function(){this._mapMenuVisible=!1,delete this._layerMenuTabs,this._layerMenu.setAttribute("hidden",""),this._elementInFocus?this._elementInFocus.focus():this._layerClicked.parentElement.firstChild.focus(),delete this._elementInFocus},_onKeyDown:function(t){if(!this._mapMenuVisible)return;let e=t.keyCode,i=t.path||t.composedPath();switch(13===e&&t.preventDefault(),!this._layerMenuTabs||9!==e&&27!==e?16===e||9===e||!this._layerClicked&&67===e||i[0].innerText===M.options.locale.cmCopyCoords+" (C)"||this._hide():(t.shiftKey?this._layerMenuTabs-=1:this._layerMenuTabs+=1,0!==this._layerMenuTabs&&3!==this._layerMenuTabs&&27!==e||(L.DomEvent.stop(t),this._focusOnLayerControl())),e){case 13:case 32:this._map._container.parentNode.activeElement.parentNode.classList.contains("mapml-contextmenu")&&this._map._container.parentNode.activeElement.click();break;case 66:this._goBack(t);break;case 67:this._layerClicked?this._copyLayerExtent(t):this._copyCoords({latlng:this._map.getCenter()});break;case 68:this._toggleDebug(t);break;case 77:this._copyMapML(t);break;case 70:this._goForward(t);break;case 82:this._reload(t);break;case 84:this._toggleControls(t);break;case 86:this._viewSource(t);break;case 90:this._layerClicked&&this._zoomToLayer(t)}},_showCoordMenu:function(t){let e=this._map.getSize(),i=this._clickEvent,o=this._coordMenu;this._items[5].el.el.setAttribute("aria-expanded","true"),o.removeAttribute("hidden"),i.containerPoint.x+160+80>e.x?(o.style.left="auto",o.style.right="160px"):(o.style.left="160px",o.style.right="auto"),i.containerPoint.y+160>e.y?(o.style.top="auto",o.style.bottom="20px"):(o.style.top="100px",o.style.bottom="auto"),this._keyboardEvent&&o.firstChild.focus()},_hideCoordMenu:function(t){if(t.srcElement.parentElement.classList.contains("mapml-submenu")||t.srcElement.innerText===M.options.locale.cmCopyCoords+" (C)")return;let e=this._coordMenu;this._items[5].el.el.setAttribute("aria-expanded","false"),e.setAttribute("hidden","")},_onItemMouseOver:function(t){L.DomUtil.addClass(t.target||t.srcElement,"over"),t.srcElement.innerText===M.options.locale.cmCopyCoords+" (C)"&&this._showCoordMenu(t)},_onItemMouseOut:function(t){L.DomUtil.removeClass(t.target||t.srcElement,"over"),this._hideCoordMenu(t)}}),w={convertAndFormatPCRS:function(t,e){if(!t||!e)return{};let i=[],o=[],n=[],a=[],s=e.options.crs.options.crs.tile.bounds.max.y;for(let r=0;r<e.options.crs.options.resolutions.length;r++){let l=e.options.crs.scale(r),m=e.options.crs.transformation.transform(t.min,l),u=e.options.crs.transformation.transform(t.max,l);i.push({horizontal:m.x,vertical:u.y}),o.push({horizontal:u.x,vertical:m.y}),n.push({horizontal:i[r].horizontal/s,vertical:i[r].vertical/s}),a.push({horizontal:o[r].horizontal/s,vertical:o[r].vertical/s})}let r=e.options.crs.unproject(t.min),l=e.options.crs.unproject(t.max),m={topLeft:{horizontal:r.lng,vertical:l.lat},bottomRight:{horizontal:l.lng,vertical:r.lat}},u={topLeft:{horizontal:t.min.x,vertical:t.max.y},bottomRight:{horizontal:t.max.x,vertical:t.min.y}};return{topLeft:{tcrs:i,tilematrix:n,gcrs:m.topLeft,pcrs:u.topLeft},bottomRight:{tcrs:o,tilematrix:a,gcrs:m.bottomRight,pcrs:u.bottomRight},projection:e.options.projection}},extractInputBounds:function(t){if(!t)return;let e=t.values,i=t.projection||n,o=0,a="TILEMATRIX",s=this[i].options.crs.tilematrix.bounds(0),r=0,l=this[i].options.resolutions.length-1,m=!1,u=0;t.zoomBounds||(t.zoomBounds={},t.zoomBounds.min=0,t.zoomBounds.max=l);for(let t=0;t<e.length;t++)switch(e[t].getAttribute("type")){case"zoom":r=+e[t].getAttribute("min"),l=+(e[t].hasAttribute("max")?e[t].getAttribute("max"):l),o=+e[t].getAttribute("value");break;case"location":if(!e[t].getAttribute("max")||!e[t].getAttribute("min"))continue;let i=+e[t].getAttribute("max"),n=+e[t].getAttribute("min");switch(e[t].getAttribute("axis").toLowerCase()){case"x":case"longitude":case"column":case"easting":a=M.axisToCS(e[t].getAttribute("axis").toLowerCase()),s.min.x=n,s.max.x=i,u++;break;case"y":case"latitude":case"row":case"northing":a=M.axisToCS(e[t].getAttribute("axis").toLowerCase()),s.min.y=n,s.max.y=i,u++}}return u>=2&&(m=!0),{zoomBounds:{minZoom:+t.zoomBounds.min,maxZoom:+t.zoomBounds.max,minNativeZoom:r,maxNativeZoom:l},bounds:s=!m&&t.extentPCRSFallback&&t.extentPCRSFallback.bounds?t.extentPCRSFallback.bounds:m?this.boundsToPCRSBounds(s,o,i,a):this[i].options.crs.pcrs.bounds}},axisToCS:function(t){try{switch(t.toLowerCase()){case"row":case"column":return"TILEMATRIX";case"i":case"j":return["MAP","TILE"];case"x":case"y":return"TCRS";case"latitude":case"longitude":return"GCRS";case"northing":case"easting":return"PCRS";default:return"TILEMATRIX"}}catch(t){return}},csToAxes:function(t){try{switch(t.toLowerCase()){case"tilematrix":return["column","row"];case"map":case"tile":return["i","j"];case"tcrs":return["x","y"];case"gcrs":return["longitude","latitude"];case"pcrs":return["easting","northing"]}}catch(t){return}},axisToXY:function(t){try{switch(t.toLowerCase()){case"i":case"column":case"longitude":case"x":case"easting":return"x";case"row":case"j":case"latitude":case"y":case"northing":return"y";default:return}}catch(t){return}},convertPCRSBounds:function(t,e,i,o){if(t&&(e||0===e)&&Number.isFinite(+e)&&i&&o)switch(i="string"==typeof i?M[i]:i,o.toUpperCase()){case"PCRS":return t;case"TCRS":case"TILEMATRIX":let n=i.transformation.transform(t.min,i.scale(+e)),a=i.transformation.transform(t.max,i.scale(+e));if("TCRS"===o.toUpperCase())return L.bounds(n,a);let s=i.options.crs.tile.bounds.max.x;return L.bounds(L.point(n.x/s,n.y/s),L.point(a.x/s,a.y/s));case"GCRS":let r=i.unproject(t.min),l=i.unproject(t.max);return L.bounds(L.point(r.lng,r.lat),L.point(l.lng,l.lat));default:return}},pointToPCRSPoint:function(t,e,i,o){if(!t||!e&&0!==e||!Number.isFinite(+e)||!o||!i)return;let n=(i="string"==typeof i?M[i]:i).options.crs.tile.bounds.max.x;switch(o.toUpperCase()){case"TILEMATRIX":return M.pixelToPCRSPoint(L.point(t.x*n,t.y*n),e,i);case"PCRS":return t;case"TCRS":return M.pixelToPCRSPoint(t,e,i);case"GCRS":return i.project(L.latLng(t.y,t.x));default:return}},pixelToPCRSPoint:function(t,e,i){if(t&&(e||0===e)&&Number.isFinite(+e)&&i)return(i="string"==typeof i?M[i]:i).transformation.untransform(t,i.scale(e))},boundsToPCRSBounds:function(t,e,i,o){if(t&&t.max&&t.min&&(e||0===e)&&Number.isFinite(+e)&&i&&o)return i="string"==typeof i?M[i]:i,L.bounds(M.pointToPCRSPoint(t.min,e,i,o),M.pointToPCRSPoint(t.max,e,i,o))},pixelToPCRSBounds:function(t,e,i){if(t&&t.max&&t.min&&(e||0===e)&&Number.isFinite(+e)&&i)return i="string"==typeof i?M[i]:i,L.bounds(M.pixelToPCRSPoint(t.min,e,i),M.pixelToPCRSPoint(t.max,e,i))},metaContentToObject:function(t){if(!t||t instanceof Object)return{};let e={},i=t.split(/\s+/).join("").split(",");for(let t=0;t<i.length;t++){let o=i[t].split("=");2===o.length&&(e[o[0]]=o[1])}return""!==e&&1===i[0].split("=").length&&(e.content=i[0]),e},coordsToArray:function(t){for(var e=1,i=[],o=t.split(",");e<o.length;e+=2)i.push([parseInt(o[e-1]),parseInt(o[e])]);return i},parseStylesheetAsHTML:function(t,e,i){if(i instanceof Element&&t&&t.querySelector("map-link[rel=stylesheet],map-style")){if(e instanceof Element)e=e.getAttribute("href")?e.getAttribute("href"):document.URL;else if(!e||""===e||e instanceof Object)return;for(var o=[],n=t.querySelectorAll("map-link[rel=stylesheet],map-style"),a=0;a<n.length;a++)if("MAP-LINK"===n[a].nodeName.toUpperCase()){var s=n[a].hasAttribute("href")?new URL(n[a].getAttribute("href"),e).href:null;if(s&&!i.querySelector("link[href='"+s+"']")){var r=document.createElement("link");r.setAttribute("href",s),r.setAttribute("rel","stylesheet"),o.push(r)}}else{var l=document.createElement("style");l.textContent=n[a].textContent,o.push(l)}for(var m=o.length-1;m>=0;m--)i.insertAdjacentElement("afterbegin",o[m])}},splitCoordinate:function(t,e,i){var o=[];t.split(/\s+/gim).forEach(M.parseNumber,o),this.push(o)},parseNumber:function(t,e,i){this.push(parseFloat(t))},handleLink:function(t,e){let i,o,n,a=!1,s=e._map;if("text/html"===t.type&&"_blank"!==t.target)t.target="_top";else if("text/html"!==t.type&&t.url.includes("#")){let e=t.url.split("#"),o=e[1].split(",");i={z:o[0]||0,lng:o[1]||0,lat:o[2]||0},a=!e[0],["/",".","#"].includes(t.url[0])&&(t.target="_self")}if(a)i&&!t.inPlace&&a&&(e._map.options.mapEl.zoomTo(+i.lat,+i.lng,+i.z),n&&(o.opacity=n));else{let a=!1;switch((o=document.createElement("layer-")).setAttribute("src",t.url),o.setAttribute("checked",""),t.target){case"_blank":"text/html"===t.type?window.open(t.url):(s.options.mapEl.appendChild(o),a=!0);break;case"_parent":for(let t of s.options.mapEl.querySelectorAll("layer-"))t._layer!==e&&s.options.mapEl.removeChild(t);s.options.mapEl.appendChild(o),s.options.mapEl.removeChild(e._layerEl),a=!0;break;case"_top":window.location.href=t.url;break;default:n=e._layerEl.opacity,e._layerEl.insertAdjacentElement("beforebegin",o),s.options.mapEl.removeChild(e._layerEl),a=!0}!t.inPlace&&a&&L.DomEvent.on(o,"extentload",function e(r){a&&["_parent","_self"].includes(t.target)&&1===o.parentElement.querySelectorAll("layer-").length&&(o.parentElement.projection=o._layer.getProjection()),o.extent&&(i?o.parentElement.zoomTo(+i.lat,+i.lng,+i.z):o.focus(),L.DomEvent.off(o,"extentload",e)),n&&(o.opacity=n),s.getContainer().focus()})}},gcrsToTileMatrix:function(t){let e=t._map.project(t._map.getCenter()),i=t._map.options.crs.options.crs.tile.bounds.max.y;return[Math.trunc(e.x/i),Math.trunc(e.y/i)]}},F=L.Control.extend({options:{position:"topleft"},onAdd:function(t){let e=L.DomUtil.create("div","mapml-reload-button leaflet-bar"),i=L.DomUtil.create("button","mapml-reload-button",e);return i.innerHTML="<span aria-hidden='true'>&#x021BA</span>",i.title=M.options.locale.cmReload,i.setAttribute("type","button"),i.classList.add("mapml-button"),i.setAttribute("aria-label","Reload"),L.DomEvent.disableClickPropagation(i),L.DomEvent.on(i,"click",L.DomEvent.stop),L.DomEvent.on(i,"click",this._goReload,this),this._reloadButton=i,this._updateDisabled(),t.on("moveend",this._updateDisabled,this),e},onRemove:function(t){t.off("moveend",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_goReload:function(t){!this._disabled&&this._map.options.mapEl._history.length>1&&this._map.options.mapEl.reload()},_updateDisabled:function(){setTimeout(()=>{L.DomUtil.removeClass(this._reloadButton,"leaflet-disabled"),this._reloadButton.setAttribute("aria-disabled","false"),this._map&&(this._disabled||this._map.options.mapEl._history.length<=1)&&(L.DomUtil.addClass(this._reloadButton,"leaflet-disabled"),this._reloadButton.setAttribute("aria-disabled","true"))},0)}}),D=function(t){return new F(t)},q=L.Control.extend({options:{position:"topleft",title:{false:"View fullscreen",true:"Exit fullscreen"}},onAdd:function(t){var e=L.DomUtil.create("div","leaflet-control-fullscreen leaflet-bar leaflet-control");return this.link=L.DomUtil.create("a","leaflet-control-fullscreen-button leaflet-bar-part",e),this.link.href="#",this.link.setAttribute("role","button"),this._map=t,this._map.on("fullscreenchange",this._toggleTitle,this),this._toggleTitle(),L.DomEvent.on(this.link,"click",this._click,this),e},onRemove:function(t){t.off("fullscreenchange",this._toggleTitle,this)},_click:function(t){L.DomEvent.stopPropagation(t),L.DomEvent.preventDefault(t),this._map.toggleFullscreen(this.options)},_toggleTitle:function(){this.link.title=this.options.title[this._map.isFullscreen()]}});L.Map.include({isFullscreen:function(){return this._isFullscreen||!1},toggleFullscreen:function(t){var e=this.getContainer().getRootNode().host,i="DIV"===e.nodeName?e.parentElement:e;this.isFullscreen()?t&&t.pseudoFullscreen?this._disablePseudoFullscreen(i):document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.msExitFullscreen?document.msExitFullscreen():this._disablePseudoFullscreen(i):t&&t.pseudoFullscreen?this._enablePseudoFullscreen(i):i.requestFullscreen?i.requestFullscreen():i.mozRequestFullScreen?i.mozRequestFullScreen():i.webkitRequestFullscreen?i.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):i.msRequestFullscreen?i.msRequestFullscreen():this._enablePseudoFullscreen(i)},_enablePseudoFullscreen:function(t){L.DomUtil.addClass(t,"leaflet-pseudo-fullscreen"),this._setFullscreen(!0),this.fire("fullscreenchange")},_disablePseudoFullscreen:function(t){L.DomUtil.removeClass(t,"leaflet-pseudo-fullscreen"),this._setFullscreen(!1),this.fire("fullscreenchange")},_setFullscreen:function(t){this._isFullscreen=t;var e=this.getContainer().getRootNode().host;t?L.DomUtil.addClass(e,"mapml-fullscreen-on"):L.DomUtil.removeClass(e,"mapml-fullscreen-on"),this.invalidateSize()},_onFullscreenChange:function(t){var e=document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement,i=this.getContainer().getRootNode().host,o="DIV"===i.nodeName?i.parentElement:i;e!==o||this._isFullscreen?e!==o&&this._isFullscreen&&(this._setFullscreen(!1),this.fire("fullscreenchange")):(this._setFullscreen(!0),this.fire("fullscreenchange"))}}),L.Map.mergeOptions({fullscreenControl:!1}),L.Map.addInitHook(function(){var t;if(this.options.fullscreenControl&&(this.fullscreenControl=new q(this.options.fullscreenControl),this.addControl(this.fullscreenControl)),"onfullscreenchange"in document?t="fullscreenchange":"onmozfullscreenchange"in document?t="mozfullscreenchange":"onwebkitfullscreenchange"in document?t="webkitfullscreenchange":"onmsfullscreenchange"in document&&(t="MSFullscreenChange"),t){var e=L.bind(this._onFullscreenChange,this);this.whenReady(function(){L.DomEvent.on(document,t,e)}),this.on("unload",function(){L.DomEvent.off(document,t,e)})}});var R=function(t){return new q(t)},N=L.Layer.extend({onAdd:function(t){this._container=L.DomUtil.create("div","mapml-crosshair",t._container),this._container.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 100 100"><g stroke="#fff" stroke-linecap="round" stroke-linejoin="round"><circle cx="50.028" cy="50.219" r="3.923" stroke-width="2" color="currentColor" overflow="visible"/><path stroke-width="3" d="M4.973 54.424h31.768a4.204 4.204 0 1 0 0-8.409H4.973A4.203 4.203 0 0 0 .77 50.22a4.203 4.203 0 0 0 4.204 4.205z" color="currentColor" overflow="visible"/><path stroke-width="3" d="M54.232 5.165a4.204 4.204 0 1 0-8.408 0v31.767a4.204 4.204 0 1 0 8.408 0V5.165z"/><path stroke-width="3" d="M99.288 50.22a4.204 4.204 0 0 0-4.204-4.205H63.317a4.204 4.204 0 1 0 0 8.409h31.767a4.205 4.205 0 0 0 4.204-4.205zM45.823 95.274a4.204 4.204 0 1 0 8.409 0V63.506a4.204 4.204 0 1 0-8.409 0v31.768z" color="currentColor" overflow="visible"/></g></svg>',t.isFocused=!1,this._isQueryable=!1,t.on("layerchange layeradd layerremove overlayremove",this._toggleEvents,this),t.on("popupopen",this._isMapFocused,this),L.DomEvent.on(t._container,"keydown keyup mousedown",this._isMapFocused,this),this._addOrRemoveCrosshair()},onRemove:function(t){t.off("layerchange layeradd layerremove overlayremove",this._toggleEvents),t.off("popupopen",this._isMapFocused),L.DomEvent.off(t._container,"keydown keyup mousedown",this._isMapFocused)},_toggleEvents:function(){this._hasQueryableLayer()?this._map.on("viewreset move moveend",this._addOrRemoveCrosshair,this):this._map.off("viewreset move moveend",this._addOrRemoveCrosshair,this),this._addOrRemoveCrosshair()},_addOrRemoveCrosshair:function(t){this._hasQueryableLayer()?this._container.removeAttribute("hidden"):this._container.setAttribute("hidden","")},_addOrRemoveMapOutline:function(t){let e=this._map._container;this._map.isFocused&&!this._outline?this._outline=L.DomUtil.create("div","mapml-outline",e):!this._map.isFocused&&this._outline&&(L.DomUtil.remove(this._outline),delete this._outline)},_hasQueryableLayer:function(){let t=this._map.options.mapEl.layers;if(this._map.isFocused)for(let e of t)if(e.checked&&e._layer.queryable)return!0;return!1},_isMapFocused:function(t){if(!this._map._container.parentNode.activeElement)return void(this._map.isFocused=!1);let e=this._map._container.parentNode.activeElement.classList.contains("leaflet-container");e&&["keydown"].includes(t.type)&&t.shiftKey&&9===t.keyCode?this._map.isFocused=!1:this._map.isFocused=e&&["keyup","keydown"].includes(t.type),this._map.isFocused&&this._map.fire("mapkeyboardfocused"),this._addOrRemoveMapOutline(),this._addOrRemoveCrosshair()}}),O=function(t){return new N(t)},U=L.Path.extend({initialize:function(t,e){this.type=t.tagName.toUpperCase(),"MAP-POINT"!==this.type&&"MAP-MULTIPOINT"!==this.type||(e.fillOpacity=1),e.wrappers.length>0&&(e=Object.assign(this._convertWrappers(e.wrappers),e)),L.setOptions(this,e),this.group=this.options.group,this.options.interactive=this.options.link||this.options.properties&&this.options.onEachFeature,this._parts=[],this._markup=t,this.options.zoom=t.getAttribute("zoom")||this.options.nativeZoom,this._convertMarkup(),(t.querySelector("map-span")||t.querySelector("map-a"))&&this._generateOutlinePoints(),this.isClosed=this._isClosed()},attachLinkHandler:function(t,e,i){let o,n=document.createElement("div"),a=document.createElement("p"),s=!1;n.classList.add("mapml-link-preview"),n.appendChild(a),t.classList.add("map-a"),e.visited&&t.classList.add("map-a-visited"),L.DomEvent.on(t,"mousedown",t=>o={x:t.clientX,y:t.clientY},this),L.DomEvent.on(t,"mouseup",n=>{if(0!==n.button)return;let a=!0,s=this.options._leafletLayer._layerEl.nextElementSibling;for(;s&&a;)s.tagName&&"LAYER-"===s.tagName.toUpperCase()&&(a=!(s.checked&&s._layer.queryable)),s=s.nextElementSibling;if(a&&o){L.DomEvent.stop(n),Math.sqrt(Math.pow(o.x-n.clientX,2)+Math.pow(o.y-n.clientY,2))<=5&&(e.visited=!0,t.setAttribute("stroke","#6c00a2"),t.classList.add("map-a-visited"),M.handleLink(e,i))}},this),L.DomEvent.on(t,"keypress",o=>{L.DomEvent.stop(o),13!==o.keyCode&&32!==o.keyCode||(e.visited=!0,t.setAttribute("stroke","#6c00a2"),t.classList.add("map-a-visited"),M.handleLink(e,i))},this),L.DomEvent.on(t,"mouseenter keyup",t=>{if(t.target!==t.currentTarget)return;s=!0;let i=document.createElement("a"),o=this._map.getContainer().clientWidth;for(i.href=e.url,a.innerHTML=i.href,this._map.getContainer().appendChild(n);a.clientWidth>o/2;)a.innerHTML=a.innerHTML.substring(0,a.innerHTML.length-5)+"...";setTimeout(()=>{s&&(a.innerHTML=i.href)},1e3)},this),L.DomEvent.on(t,"mouseout keydown mousedown",t=>{t.target===t.currentTarget&&n.parentElement&&(s=!1,this._map.getContainer().removeChild(n))},this),L.DomEvent.on(i._map.getContainer(),"mouseout mouseenter click",t=>{n.parentElement&&(s=!1,this._map.getContainer().removeChild(n))},this)},_project:function(t,e,i){let o=t||this._map,n=e||o.getPixelOrigin(),a=void 0===i?o.getZoom():i;for(let t of this._parts){t.pixelRings=this._convertRing(t.rings,o,n,a);for(let e of t.subrings)e.pixelSubrings=this._convertRing([e],o,n,a)}if(this._outline){this.pixelOutline=[];for(let t of this._outline)this.pixelOutline=this.pixelOutline.concat(this._convertRing(t,o,n,a))}},_convertRing:function(t,e,i,o){let n=e.options.crs.scale(o),a=[];for(let o of t){let t=[];for(let a of o.points){let o=e.options.crs.transformation.transform(a,n);t.push(L.point(o.x,o.y)._subtract(i).round())}a.push(t)}return a},_update:function(){this._map&&this._renderer._updateFeature(this)},_convertWrappers:function(t){if(!t||0===t.length)return;let e="",i={};for(let o of t)if("MAP-A"!==o.tagName.toUpperCase()&&o.className)e+=`${o.className} `;else if(!i.link&&o.getAttribute("href")){let t={};t.url=o.getAttribute("href"),o.hasAttribute("target")&&(t.target=o.getAttribute("target")),o.hasAttribute("type")&&(t.type=o.getAttribute("type")),o.hasAttribute("inplace")&&(t.inPlace=!0),i.link=t}return i.className=`${e} ${this.options.className}`.trim(),i},_convertMarkup:function(){if(!this._markup)return;let t=this._markup.attributes;this.featureAttributes={},this.options.link&&"MAP-A"===this._markup.parentElement.tagName.toUpperCase()&&"MAP-GEOMETRY"!==this._markup.parentElement.parentElement.tagName.toUpperCase()&&(this.featureAttributes.tabindex="0");for(let e=0;e<t.length;e++)this.featureAttributes[t[e].name]=t[e].value;let e=!0;for(let t of this._markup.querySelectorAll("map-coordinates")){let i=[],o=[];if(this._coordinateToArrays(t,i,o,this.options.className),e||"MAP-POLYGON"!==this.type)if("MAP-MULTIPOINT"===this.type)for(let t of i[0].points.concat(o))this._parts.push({rings:[{points:[t]}],subrings:[],cls:`${t.cls||""} ${this.options.className||""}`.trim()});else this._parts.push({rings:i,subrings:o,cls:`${this.featureAttributes.class||""} ${this.options.className||""}`.trim()});else this._parts[0].rings.push(i[0]),o.length>0&&(this._parts[0].subrings=this._parts[0].subrings.concat(o));e=!1}},_generateOutlinePoints:function(){if("MAP-MULTIPOINT"!==this.type&&"MAP-POINT"!==this.type&&"MAP-LINESTRING"!==this.type&&"MAP-MULTILINESTRING"!==this.type){this._outline=[];for(let t of this._markup.querySelectorAll("map-coordinates")){let e=t.childNodes,i=0,o=document.createElement("div");e.length;for(let t=0;t<e.length;t++)0===e[t].textContent.trim().length&&e[t].remove();for(let t of e){let n=[];if(!t.tagName){let a="",s=((i-1)%e.length+e.length)%e.length;if(e[s].tagName){let t=e[s].textContent.trim().split(/\s+/);a+=`${t[t.length-2]} ${t[t.length-1]} `}if(a+=t.textContent,e[s=((i+1)%e.length+e.length)%e.length].tagName){let t=e[s].textContent.trim().split(/\s+/);a+=`${t[0]} ${t[1]} `}o.innerHTML=a,this._coordinateToArrays(o,n,[],!0,this.featureAttributes.class||this.options.className),this._outline.push(n)}i++}}}},_coordinateToArrays:function(t,e,i,o=!0,n,a=[]){for(let o of t.children)this._coordinateToArrays(o,e,i,!1,o.getAttribute("class"),a.concat([o]));let s,r=t.textContent.replace(/(<([^>]+)>)/gi,"").match(/(\S+\s+\S+)/gim),l=[];for(let t of r){let e=[];t.split(/\s+/gim).forEach(M.parseNumber,e);let i=M.pointToPCRSPoint(L.point(e),this.options.zoom,this.options.projection,this.options.nativeCS);l.push(i),s=s?s.extend(i):L.bounds(i,i)}if(this._bounds?(this._bounds.extend(s.min),this._bounds.extend(s.max)):this._bounds=s,o)e.push({points:l});else{let e={},o=t.attributes,r=this._convertWrappers(a);r.link&&(e.tabindex="0");for(let t=0;t<o.length;t++)"class"!==o[t].name&&(e[o[t].name]=o[t].value);i.unshift({points:l,center:s.getCenter(),cls:`${n||""} ${r.className||""}`.trim(),attr:e,link:r.link,linkTarget:r.linkTarget,linkType:r.linkType})}},_isClosed:function(){switch(this.type){case"MAP-POLYGON":case"MAP-MULTIPOLYGON":case"MAP-POINT":case"MAP-MULTIPOINT":return!0;case"MAP-LINESTRING":case"MAP-MULTILINESTRING":default:return!1}},getCenter:function(){return this._bounds?this._map.options.crs.unproject(this._bounds.getCenter()):null},getPCRSCenter:function(){return this._bounds.getCenter()}}),Z=function(t,e){return new U(t,e)},j=L.SVG.extend({_initContainer:function(){L.SVG.prototype._initContainer.call(this),this._container.setAttribute("role","none presentation")},_initPath:function(t,e=!0){if(t._outline){let e=L.SVG.create("path");t.options.className&&L.DomUtil.addClass(e,t.featureAttributes.class||t.options.className),L.DomUtil.addClass(e,"mapml-feature-outline"),e.style.fill="none",t.outlinePath=e}for(let e of t._parts){if(e.rings&&(this._createPath(e,t.options.className,t.featureAttributes["aria-label"],t.options.interactive,t.featureAttributes),t.outlinePath&&(e.path.style.stroke="none")),e.subrings)for(let i of e.subrings)this._createPath(i,t.options.className,i.attr["aria-label"],void 0!==i.link,i.attr);this._updateStyle(t)}if(e){let e=L.stamp(t);this._layers[e]=t}},_createPath:function(t,e,i,o=!1,n){let a=L.SVG.create("path");if(t.path=a,n)for(let[t,e]of Object.entries(n))"id"!==t&&"tabindex"!==t&&a.setAttribute(t,e);else i&&a.setAttribute("aria-label",i);(t.cls||e)&&L.DomUtil.addClass(a,t.cls||e),o&&L.DomUtil.addClass(a,"leaflet-interactive")},_addPath:function(t,e,i=!0){this._rootGroup||e||this._initContainer();let o=e||this._rootGroup,n=!1;i&&t.addInteractiveTarget(t.group);for(let e of t._parts){e.path&&t.group.appendChild(e.path),i&&(t.options.link&&t.attachLinkHandler(e.path,t.options.link,t.options._leafletLayer),t.addInteractiveTarget(e.path)),!n&&t.pixelOutline&&(t.group.appendChild(t.outlinePath),n=!0);for(let i of e.subrings)i.path&&(i.link&&(t.attachLinkHandler(i.path,i.link,t.options._leafletLayer),t.addInteractiveTarget(i.path)),t.group.appendChild(i.path))}o.appendChild(t.group)},_removePath:function(t){for(let e of t._parts){e.path&&(t.removeInteractiveTarget(e.path),L.DomUtil.remove(e.path));for(let t of e.subrings)t.path&&L.DomUtil.remove(t.path)}t.outlinePath&&L.DomUtil.remove(t.outlinePath),t.removeInteractiveTarget(t.group),L.DomUtil.remove(t.group),delete this._layers[L.stamp(t)]},_updateFeature:function(t){t.pixelOutline&&this._setPath(t.outlinePath,this.geometryToPath(t.pixelOutline,!1));for(let e of t._parts){this._setPath(e.path,this.geometryToPath(e.pixelRings,t.isClosed));for(let t of e.subrings)this._setPath(t.path,this.geometryToPath(t.pixelSubrings,!1))}},_pointToMarker:function(t){return`M${t.x} ${t.y} L${t.x-12.5} ${t.y-30} C${t.x-12.5} ${t.y-50}, ${t.x+12.5} ${t.y-50}, ${t.x+12.5} ${t.y-30} L${t.x} ${t.y}z`},_updateStyle:function(t){this._updatePathStyle(t.outlinePath,t,!1,!0);for(let e of t._parts){e.path&&this._updatePathStyle(e.path,t,!0);for(let i of e.subrings)i.path&&this._updatePathStyle(i.path,t)}},_updatePathStyle:function(t,e,i=!1,o=!1){if(!t||!e)return;let n=e.options,a=e.isClosed;n.stroke&&(!a||o)||i&&!e.outlinePath?(t.setAttribute("stroke",n.color),t.setAttribute("stroke-opacity",n.opacity),t.setAttribute("stroke-width",n.weight),t.setAttribute("stroke-linecap",n.lineCap),t.setAttribute("stroke-linejoin",n.lineJoin),n.dashArray?t.setAttribute("stroke-dasharray",n.dashArray):t.removeAttribute("stroke-dasharray"),n.dashOffset?t.setAttribute("stroke-dashoffset",n.dashOffset):t.removeAttribute("stroke-dashoffset"),n.link&&(t.setAttribute("stroke",n.link.visited?"#6c00a2":"#0000EE"),t.setAttribute("stroke-opacity","1"),t.setAttribute("stroke-width","1px"),t.setAttribute("stroke-dasharray","none"))):t.setAttribute("stroke","none"),a&&!o?n.fill?t.setAttribute("fill",n.color):(t.setAttribute("fill",n.fillColor||n.color),t.setAttribute("fill-opacity",n.fillOpacity),t.setAttribute("fill-rule",n.fillRule||"evenodd")):t.setAttribute("fill","none")},_setPath:function(t,e){t.setAttribute("d",e)},geometryToPath:function(t,e){let i,o,n,a,s,r,l="";for(i=0,n=t.length;i<n;i++){if(1===(s=t[i]).length)return this._pointToMarker(s[0]);for(o=0,a=s.length;o<a;o++)r=s[o],l+=(o?"L":"M")+r.x+" "+r.y;l+=e?"z":""}return l||"M0 0"}}),G=function(t){return new j(t)},H=L.FeatureGroup.extend({initialize:function(t,e){if(e.wrappers&&e.wrappers.length>0&&(e=Object.assign(M.Feature.prototype._convertWrappers(e.wrappers),e)),L.LayerGroup.prototype.initialize.call(this,t,e),this.options.onEachFeature&&this.options.properties||this.options.link){L.DomUtil.addClass(this.options.group,"leaflet-interactive"),L.DomEvent.on(this.options.group,"keyup keydown mousedown",this._handleFocus,this);let e=t[Object.keys(t)[0]];1===t.length&&e.options.link&&(this.options.link=e.options.link),this.options.link?(M.Feature.prototype.attachLinkHandler.call(this,this.options.group,this.options.link,this.options._leafletLayer),this.options.group.setAttribute("role","link")):(this.options.group.setAttribute("aria-expanded","false"),this.options.group.setAttribute("role","button"),this.options.onEachFeature(this.options.properties,this),this.off("click",this._openPopup))}this.options.group.setAttribute("aria-label",this.options.accessibleTitle),this.options.featureID&&this.options.group.setAttribute("data-fid",this.options.featureID)},onAdd:function(t){L.LayerGroup.prototype.onAdd.call(this,t),this.updateInteraction()},updateInteraction:function(){let t=this._map||this.options._leafletLayer._map;(this.options.onEachFeature&&this.options.properties||this.options.link)&&t.featureIndex.addToIndex(this,this.getPCRSCenter(),this.options.group);for(let e in this._layers){let i=this._layers[e];for(let e of i._parts){i.featureAttributes&&i.featureAttributes.tabindex&&t.featureIndex.addToIndex(i,i.getPCRSCenter(),e.path);for(let o of e.subrings)o.attr&&o.attr.tabindex&&t.featureIndex.addToIndex(i,o.center,o.path)}}},_handleFocus:function(t){if(9!==t.keyCode&&16!==t.keyCode||"keydown"!==t.type)9!==t.keyCode&&16!==t.keyCode&&13!==t.keyCode&&(this._map.featureIndex.currentIndex=0,this._map.featureIndex.inBoundFeatures[0].path.focus());else{let e=this._map.featureIndex.currentIndex;9===t.keyCode&&t.shiftKey?(e===this._map.featureIndex.inBoundFeatures.length-1&&this._map.featureIndex.inBoundFeatures[e].path.setAttribute("tabindex",-1),0!==e&&(L.DomEvent.stop(t),this._map.featureIndex.inBoundFeatures[e-1].path.focus(),this._map.featureIndex.currentIndex--)):9===t.keyCode&&(e!==this._map.featureIndex.inBoundFeatures.length-1?(L.DomEvent.stop(t),this._map.featureIndex.inBoundFeatures[e+1].path.focus(),this._map.featureIndex.currentIndex++):(this._map.featureIndex.inBoundFeatures[0].path.setAttribute("tabindex",-1),this._map.featureIndex.inBoundFeatures[e].path.setAttribute("tabindex",0)))}"G"===t.target.tagName.toUpperCase()&&(9!==t.keyCode&&16!==t.keyCode&&13!==t.keyCode||"keyup"!==t.type?13===t.keyCode||32===t.keyCode?(this.closeTooltip(),!this.options.link&&this.options.onEachFeature&&(L.DomEvent.stop(t),this.openPopup())):this.closeTooltip():this.openTooltip())},addLayer:function(t){!t.options.link&&t.options.interactive&&this.options.onEachFeature(this.options.properties,t),L.FeatureGroup.prototype.addLayer.call(this,t)},_previousFeature:function(t){L.DomEvent.stop(t),this._map.featureIndex.currentIndex=Math.max(this._map.featureIndex.currentIndex-1,0),this._map.featureIndex.inBoundFeatures[this._map.featureIndex.currentIndex].path.focus(),this._map.closePopup()},_nextFeature:function(t){L.DomEvent.stop(t),this._map.featureIndex.currentIndex=Math.min(this._map.featureIndex.currentIndex+1,this._map.featureIndex.inBoundFeatures.length-1),this._map.featureIndex.inBoundFeatures[this._map.featureIndex.currentIndex].path.focus(),this._map.closePopup()},getPCRSCenter:function(){let t;for(let e in this._layers){let i=this._layers[e];t?t.extend(i.getPCRSCenter()):t=L.bounds(i.getPCRSCenter(),i.getPCRSCenter())}return t.getCenter()}}),V=function(t,e){return new H(t,e)},$=L.Handler.extend({addHooks:function(){this._map.on({layeradd:this.totalBounds,layerremove:this.totalBounds}),this._map.options.mapEl.addEventListener("moveend",this.announceBounds),this._map.dragging._draggable.addEventListener("dragstart",this.dragged),this._map.options.mapEl.addEventListener("mapfocused",this.focusAnnouncement)},removeHooks:function(){this._map.off({layeradd:this.totalBounds,layerremove:this.totalBounds}),this._map.options.mapEl.removeEventListener("moveend",this.announceBounds),this._map.dragging._draggable.removeEventListener("dragstart",this.dragged),this._map.options.mapEl.removeEventListener("mapfocused",this.focusAnnouncement)},focusAnnouncement:function(){let t=this;setTimeout(function(){let e=t.querySelector(".mapml-web-map")?t.querySelector(".mapml-web-map").shadowRoot.querySelector(".leaflet-container"):t.shadowRoot.querySelector(".leaflet-container"),i=t._map.getZoom(),o=M.gcrsToTileMatrix(t),n=M.options.locale.amZoom+" "+i+" "+M.options.locale.amColumn+" "+o[0]+" "+M.options.locale.amRow+" "+o[1];i===t._map._layersMaxZoom?n=M.options.locale.amMaxZoom+" "+n:i===t._map._layersMinZoom&&(n=M.options.locale.amMinZoom+" "+n),e.setAttribute("aria-roledescription","region "+n),setTimeout(function(){e.removeAttribute("aria-roledescription")},2e3)},0)},announceBounds:function(){if(this._traversalCall>0)return;let t=this._map.getZoom(),e=M.pixelToPCRSBounds(this._map.getPixelBounds(),t,this._map.options.projection),i=!0;this._map.totalLayerBounds&&(i=t<=this._map._layersMaxZoom&&t>=this._map._layersMinZoom&&this._map.totalLayerBounds.overlaps(e));let o=this.querySelector(".mapml-web-map")?this.querySelector(".mapml-web-map").shadowRoot.querySelector(".mapml-screen-reader-output"):this.shadowRoot.querySelector(".mapml-screen-reader-output"),n=M.gcrsToTileMatrix(this),a=M.options.locale.amZoom+" "+t+" "+M.options.locale.amColumn+" "+n[0]+" "+M.options.locale.amRow+" "+n[1];if(i){let e=this._history[this._historyIndex-1]?this._history[this._historyIndex-1].zoom:this._history[this._historyIndex].zoom;t===this._map._layersMaxZoom&&t!==e?o.innerText=M.options.locale.amMaxZoom+" "+a:t===this._map._layersMinZoom&&t!==e?o.innerText=M.options.locale.amMinZoom+" "+a:o.innerText=a}else{let t=this._history[this._historyIndex],e=this._history[this._historyIndex-1];this.back(),this._history.pop(),t.zoom!==e.zoom?o.innerText=M.options.locale.amZoomedOut:this._map.dragging._draggable.wasDragged?o.innerText=M.options.locale.amDraggedOut:t.x>e.x?o.innerText=M.options.locale.amEastBound:t.x<e.x?o.innerText=M.options.locale.amWestBound:t.y<e.y?o.innerText=M.options.locale.amNorthBound:t.y>e.y&&(o.innerText=M.options.locale.amSouthBound)}this._map.dragging._draggable.wasDragged=!1},totalBounds:function(){let t=Object.keys(this._layers),e=L.bounds();t.forEach(t=>{if(this._layers[t].layerBounds){if(!e){let i=this._layers[t].layerBounds.getCenter();e=L.bounds(i,i)}e.extend(this._layers[t].layerBounds.min),e.extend(this._layers[t].layerBounds.max)}}),this.totalLayerBounds=e},dragged:function(){this.wasDragged=!0}}),W=L.Handler.extend({initialize:function(t){L.Handler.prototype.initialize.call(this,t),this.inBoundFeatures=[],this.outBoundFeatures=[],this.currentIndex=0,this._mapPCRSBounds=M.pixelToPCRSBounds(t.getPixelBounds(),t.getZoom(),t.options.projection)},addHooks:function(){this._map.on("mapkeyboardfocused",this._updateMapBounds,this),this._map.on("mapkeyboardfocused",this._sortIndex,this)},removeHooks:function(){this._map.off("mapkeyboardfocused",this._updateMapBounds),this._map.off("mapkeyboardfocused",this._sortIndex)},addToIndex:function(t,e,i){let o=this._mapPCRSBounds.getCenter(),n=Math.sqrt(Math.pow(e.x-o.x,2)+Math.pow(e.y-o.y,2)),a=this._mapPCRSBounds.contains(e)?this.inBoundFeatures:this.outBoundFeatures,s={path:i,layer:t,center:e,dist:n};i.setAttribute("tabindex",-1),a.push(s);for(let t=a.length-1;t>0&&a[t].dist<a[t-1].dist;t--){let e=a[t];a[t]=a[t-1],a[t-1]=e}this._mapPCRSBounds.contains(e)?this.inBoundFeatures=a:this.outBoundFeatures=a},cleanIndex:function(){this.currentIndex=0,this.inBoundFeatures=this.inBoundFeatures.filter(t=>{let e=this._mapPCRSBounds.contains(t.center);return t.path.setAttribute("tabindex",-1),t.layer._map&&!e&&this.outBoundFeatures.push(t),t.layer._map&&e}),this.outBoundFeatures=this.outBoundFeatures.filter(t=>{let e=this._mapPCRSBounds.contains(t.center);return t.path.setAttribute("tabindex",-1),t.layer._map&&e&&this.inBoundFeatures.push(t),t.layer._map&&!e})},_sortIndex:function(){if(this.cleanIndex(),0===this.inBoundFeatures.length)return;let t=this._mapPCRSBounds.getCenter();this.inBoundFeatures.sort(function(e,i){let o=e.center,n=i.center;return e.dist=Math.sqrt(Math.pow(o.x-t.x,2)+Math.pow(o.y-t.y,2)),i.dist=Math.sqrt(Math.pow(n.x-t.x,2)+Math.pow(n.y-t.y,2)),e.dist-i.dist}),this.inBoundFeatures[0].path.setAttribute("tabindex",0)},_updateMapBounds:function(t){this._mapPCRSBounds=M.pixelToPCRSBounds(this._map.getPixelBounds(),this._map.getZoom(),this._map.options.projection)}}),K={announceMovement:!1,locale:{cmBack:"Back",cmForward:"Forward",cmReload:"Reload",cmToggleControls:"Toggle Controls",cmCopyCoords:"Copy Coordinates",cmToggleDebug:"Toggle Debug Mode",cmCopyMapML:"Copy MapML",cmViewSource:"View Map Source",cmCopyAll:"All",lmZoomToLayer:"Zoom To Layer",lmCopyExtent:"Copy Extent",lcOpacity:"Opacity",btnZoomIn:"Zoom in",btnZoomOut:"Zoom out",btnFullScreen:"View fullscreen",amZoom:"zoom level",amColumn:"column",amRow:"row",amMaxZoom:"At maximum zoom level, zoom in disabled",amMinZoom:"At minimum zoom level, zoom out disabled",amZoomedOut:"Zoomed out of bounds, returning to",amDraggedOut:"Dragged out of bounds, returning to",amEastBound:"Reached east bound, panning east disabled",amWestBound:"Reached west bound, panning west disabled",amNorthBound:"Reached north bound, panning north disabled",amSouthBound:"Reached south bound, panning south disabled"}};L.Map.Keyboard.include({_onKeyDown:function(t){if(t.altKey||t.metaKey)return;let e={187:187,107:107,61:61,171:171},i={189:189,109:109,54:54,173:173};var o,n=t.keyCode,a=this._map;if(n in this._panKeys)a._panAnim&&a._panAnim._inProgress||(o=this._panKeys[n],t.shiftKey&&(o=L.point(o).multiplyBy(3)),t.ctrlKey&&(o=L.point(o).divideBy(5)),a.panBy(o),a.options.maxBounds&&a.panInsideBounds(a.options.maxBounds));else if(n in this._zoomKeys)(n in e&&a._layersMaxZoom!==a.getZoom()||n in i&&a._layersMinZoom!==a.getZoom())&&a.setZoom(a.getZoom()+(t.shiftKey?3:1)*this._zoomKeys[n]);else{if(27!==n||!a._popup||!a._popup.options.closeOnEscapeKey)return;a.closePopup()}L.DomEvent.stop(t)}}),function(n,a,E){var A={};n.M=A,function(){A.detectImagePath=function(t){var e=L.DomUtil.create("div","leaflet-default-icon-path",t),i=L.DomUtil.getStyle(e,"background-image")||L.DomUtil.getStyle(e,"backgroundImage");return t.removeChild(e),i=null===i||0!==i.indexOf("url")?"":i.replace(/^url\(["']?/,"").replace(/marker-icon\.png["']?\)$/,"")},A.mime="text/mapml";let t=n.document.head.querySelector("map-options");A.options=K,t&&(A.options=Object.assign(A.options,JSON.parse(t.innerHTML))),A.WGS84=new L.Proj.CRS("EPSG:4326","+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs ",{origin:[-180,90],bounds:L.bounds([[-180,-90],[180,90]]),resolutions:[.703125,.3515625,.17578125,.087890625,.0439453125,.02197265625,.010986328125,.0054931640625,.00274658203125,.001373291015625,.0006866455078125,.0003433227539062,.0001716613769531,858306884766e-16,429153442383e-16,214576721191e-16,107288360596e-16,53644180298e-16,26822090149e-16,13411045074e-16,6.705522537e-7,3.352761269e-7],crs:{tcrs:{horizontal:{name:"x",min:0,max:t=>(A.WGS84.options.bounds.getSize().x/A.WGS84.options.resolutions[t]).toFixed()},vertical:{name:"y",min:0,max:t=>(A.WGS84.options.bounds.getSize().y/A.WGS84.options.resolutions[t]).toFixed()},bounds:t=>L.bounds([A.WGS84.options.crs.tcrs.horizontal.min,A.WGS84.options.crs.tcrs.vertical.min],[A.WGS84.options.crs.tcrs.horizontal.max(t),A.WGS84.options.crs.tcrs.vertical.max(t)])},pcrs:{horizontal:{name:"longitude",get min(){return A.WGS84.options.crs.gcrs.horizontal.min},get max(){return A.WGS84.options.crs.gcrs.horizontal.max}},vertical:{name:"latitude",get min(){return A.WGS84.options.crs.gcrs.vertical.min},get max(){return A.WGS84.options.crs.gcrs.vertical.max}},get bounds(){return A.WGS84.options.bounds}},gcrs:{horizontal:{name:"longitude",min:-180,max:180},vertical:{name:"latitude",min:-90,max:90},get bounds(){return L.latLngBounds([A.WGS84.options.crs.gcrs.vertical.min,A.WGS84.options.crs.gcrs.horizontal.min],[A.WGS84.options.crs.gcrs.vertical.max,A.WGS84.options.crs.gcrs.horizontal.max])}},map:{horizontal:{name:"i",min:0,max:t=>t.getSize().x},vertical:{name:"j",min:0,max:t=>t.getSize().y},bounds:t=>L.bounds(L.point([0,0]),t.getSize())},tile:{horizontal:{name:"i",min:0,max:256},vertical:{name:"j",min:0,max:256},get bounds(){return L.bounds([A.WGS84.options.crs.tile.horizontal.min,A.WGS84.options.crs.tile.vertical.min],[A.WGS84.options.crs.tile.horizontal.max,A.WGS84.options.crs.tile.vertical.max])}},tilematrix:{horizontal:{name:"column",min:0,max:t=>(A.WGS84.options.crs.tcrs.horizontal.max(t)/A.WGS84.options.crs.tile.bounds.getSize().x).toFixed()},vertical:{name:"row",min:0,max:t=>(A.WGS84.options.crs.tcrs.vertical.max(t)/A.WGS84.options.crs.tile.bounds.getSize().y).toFixed()},bounds:t=>L.bounds([A.WGS84.options.crs.tilematrix.horizontal.min,A.WGS84.options.crs.tilematrix.vertical.min],[A.WGS84.options.crs.tilematrix.horizontal.max(t),A.WGS84.options.crs.tilematrix.vertical.max(t)])}}}),A.CBMTILE=new L.Proj.CRS("EPSG:3978","+proj=lcc +lat_1=49 +lat_2=77 +lat_0=49 +lon_0=-95 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs",{origin:[-34655800,3931e4],bounds:L.bounds([[-34655800,-39e6],[1e7,3931e4]]),resolutions:[38364.660062653464,22489.62831258996,13229.193125052918,7937.5158750317505,4630.2175937685215,2645.8386250105837,1587.5031750063501,926.0435187537042,529.1677250021168,317.50063500127004,185.20870375074085,111.12522225044451,66.1459656252646,38.36466006265346,22.48962831258996,13.229193125052918,7.9375158750317505,4.6302175937685215,2.6458386250105836,1.5875031750063502,.9260435187537043,.5291677250021167,.31750063500127,.18520870375074083,.11112522225044451,.06614596562526459],crs:{tcrs:{horizontal:{name:"x",min:0,max:t=>(A.CBMTILE.options.bounds.getSize().x/A.CBMTILE.options.resolutions[t]).toFixed()},vertical:{name:"y",min:0,max:t=>(A.CBMTILE.options.bounds.getSize().y/A.CBMTILE.options.resolutions[t]).toFixed()},bounds:t=>L.bounds([A.CBMTILE.options.crs.tcrs.horizontal.min,A.CBMTILE.options.crs.tcrs.vertical.min],[A.CBMTILE.options.crs.tcrs.horizontal.max(t),A.CBMTILE.options.crs.tcrs.vertical.max(t)])},pcrs:{horizontal:{name:"easting",get min(){return A.CBMTILE.options.bounds.min.x},get max(){return A.CBMTILE.options.bounds.max.x}},vertical:{name:"northing",get min(){return A.CBMTILE.options.bounds.min.y},get max(){return A.CBMTILE.options.bounds.max.y}},get bounds(){return A.CBMTILE.options.bounds}},gcrs:{horizontal:{name:"longitude",min:-141.01,max:-47.74},vertical:{name:"latitude",min:40.04,max:86.46},get bounds(){return L.latLngBounds([A.CBMTILE.options.crs.gcrs.vertical.min,A.CBMTILE.options.crs.gcrs.horizontal.min],[A.CBMTILE.options.crs.gcrs.vertical.max,A.CBMTILE.options.crs.gcrs.horizontal.max])}},map:{horizontal:{name:"i",min:0,max:t=>t.getSize().x},vertical:{name:"j",min:0,max:t=>t.getSize().y},bounds:t=>L.bounds(L.point([0,0]),t.getSize())},tile:{horizontal:{name:"i",min:0,max:256},vertical:{name:"j",min:0,max:256},get bounds(){return L.bounds([A.CBMTILE.options.crs.tile.horizontal.min,A.CBMTILE.options.crs.tile.vertical.min],[A.CBMTILE.options.crs.tile.horizontal.max,A.CBMTILE.options.crs.tile.vertical.max])}},tilematrix:{horizontal:{name:"column",min:0,max:t=>(A.CBMTILE.options.crs.tcrs.horizontal.max(t)/A.CBMTILE.options.crs.tile.bounds.getSize().x).toFixed()},vertical:{name:"row",min:0,max:t=>(A.CBMTILE.options.crs.tcrs.vertical.max(t)/A.CBMTILE.options.crs.tile.bounds.getSize().y).toFixed()},bounds:t=>L.bounds([0,0],[A.CBMTILE.options.crs.tilematrix.horizontal.max(t),A.CBMTILE.options.crs.tilematrix.vertical.max(t)])}}}),A.APSTILE=new L.Proj.CRS("EPSG:5936","+proj=stere +lat_0=90 +lat_ts=50 +lon_0=-150 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m +no_defs",{origin:[-28567784.109255,32567784.109255],bounds:L.bounds([[-28567784.109254867,-28567784.109254755],[32567784.109255023,32567784.10925506]]),resolutions:[238810.813354,119405.406677,59702.7033384999,29851.3516692501,14925.675834625,7462.83791731252,3731.41895865639,1865.70947932806,932.854739664032,466.427369832148,233.213684916074,116.606842458037,58.3034212288862,29.1517106145754,14.5758553072877,7.28792765351156,3.64396382688807,1.82198191331174,.910990956788164,.45549547826179],crs:{tcrs:{horizontal:{name:"x",min:0,max:t=>(A.APSTILE.options.bounds.getSize().x/A.APSTILE.options.resolutions[t]).toFixed()},vertical:{name:"y",min:0,max:t=>(A.APSTILE.options.bounds.getSize().y/A.APSTILE.options.resolutions[t]).toFixed()},bounds:t=>L.bounds([A.APSTILE.options.crs.tcrs.horizontal.min,A.APSTILE.options.crs.tcrs.vertical.min],[A.APSTILE.options.crs.tcrs.horizontal.max(t),A.APSTILE.options.crs.tcrs.vertical.max(t)])},pcrs:{horizontal:{name:"easting",get min(){return A.APSTILE.options.bounds.min.x},get max(){return A.APSTILE.options.bounds.max.x}},vertical:{name:"northing",get min(){return A.APSTILE.options.bounds.min.y},get max(){return A.APSTILE.options.bounds.max.y}},get bounds(){return A.APSTILE.options.bounds}},gcrs:{horizontal:{name:"longitude",min:-180,max:180},vertical:{name:"latitude",min:60,max:90},get bounds(){return L.latLngBounds([A.APSTILE.options.crs.gcrs.vertical.min,A.APSTILE.options.crs.gcrs.horizontal.min],[A.APSTILE.options.crs.gcrs.vertical.max,A.APSTILE.options.crs.gcrs.horizontal.max])}},map:{horizontal:{name:"i",min:0,max:t=>t.getSize().x},vertical:{name:"j",min:0,max:t=>t.getSize().y},bounds:t=>L.bounds(L.point([0,0]),t.getSize())},tile:{horizontal:{name:"i",min:0,max:256},vertical:{name:"j",min:0,max:256},get bounds(){return L.bounds([A.APSTILE.options.crs.tile.horizontal.min,A.APSTILE.options.crs.tile.vertical.min],[A.APSTILE.options.crs.tile.horizontal.max,A.APSTILE.options.crs.tile.vertical.max])}},tilematrix:{horizontal:{name:"column",min:0,max:t=>(A.APSTILE.options.crs.tcrs.horizontal.max(t)/A.APSTILE.options.crs.tile.bounds.getSize().x).toFixed()},vertical:{name:"row",min:0,max:t=>(A.APSTILE.options.crs.tcrs.vertical.max(t)/A.APSTILE.options.crs.tile.bounds.getSize().y).toFixed()},bounds:t=>L.bounds([0,0],[A.APSTILE.options.crs.tilematrix.horizontal.max(t),A.APSTILE.options.crs.tilematrix.vertical.max(t)])}}}),A.OSMTILE=L.CRS.EPSG3857,L.setOptions(A.OSMTILE,{origin:[-20037508.342787,20037508.342787],bounds:L.bounds([[-20037508.342787,-20037508.342787],[20037508.342787,20037508.342787]]),resolutions:[156543.0339,78271.51695,39135.758475,19567.8792375,9783.93961875,4891.969809375,2445.9849046875,1222.9924523438,611.49622617188,305.74811308594,152.87405654297,76.437028271484,38.218514135742,19.109257067871,9.5546285339355,4.7773142669678,2.3886571334839,1.1943285667419,.59716428337097,.29858214168549,.14929107084274,.074645535421371,.03732276771068573,.018661383855342866,.009330691927671433],crs:{tcrs:{horizontal:{name:"x",min:0,max:t=>(A.OSMTILE.options.bounds.getSize().x/A.OSMTILE.options.resolutions[t]).toFixed()},vertical:{name:"y",min:0,max:t=>(A.OSMTILE.options.bounds.getSize().y/A.OSMTILE.options.resolutions[t]).toFixed()},bounds:t=>L.bounds([A.OSMTILE.options.crs.tcrs.horizontal.min,A.OSMTILE.options.crs.tcrs.vertical.min],[A.OSMTILE.options.crs.tcrs.horizontal.max(t),A.OSMTILE.options.crs.tcrs.vertical.max(t)])},pcrs:{horizontal:{name:"easting",get min(){return A.OSMTILE.options.bounds.min.x},get max(){return A.OSMTILE.options.bounds.max.x}},vertical:{name:"northing",get min(){return A.OSMTILE.options.bounds.min.y},get max(){return A.OSMTILE.options.bounds.max.y}},get bounds(){return A.OSMTILE.options.bounds}},gcrs:{horizontal:{name:"longitude",get min(){return A.OSMTILE.unproject(A.OSMTILE.options.bounds.min).lng},get max(){return A.OSMTILE.unproject(A.OSMTILE.options.bounds.max).lng}},vertical:{name:"latitude",get min(){return A.OSMTILE.unproject(A.OSMTILE.options.bounds.min).lat},get max(){return A.OSMTILE.unproject(A.OSMTILE.options.bounds.max).lat}},get bounds(){return L.latLngBounds([A.OSMTILE.options.crs.gcrs.vertical.min,A.OSMTILE.options.crs.gcrs.horizontal.min],[A.OSMTILE.options.crs.gcrs.vertical.max,A.OSMTILE.options.crs.gcrs.horizontal.max])}},map:{horizontal:{name:"i",min:0,max:t=>t.getSize().x},vertical:{name:"j",min:0,max:t=>t.getSize().y},bounds:t=>L.bounds(L.point([0,0]),t.getSize())},tile:{horizontal:{name:"i",min:0,max:256},vertical:{name:"j",min:0,max:256},get bounds(){return L.bounds([A.OSMTILE.options.crs.tile.horizontal.min,A.OSMTILE.options.crs.tile.vertical.min],[A.OSMTILE.options.crs.tile.horizontal.max,A.OSMTILE.options.crs.tile.vertical.max])}},tilematrix:{horizontal:{name:"column",min:0,max:t=>(A.OSMTILE.options.crs.tcrs.horizontal.max(t)/A.OSMTILE.options.crs.tile.bounds.getSize().x).toFixed()},vertical:{name:"row",min:0,max:t=>(A.OSMTILE.options.crs.tcrs.vertical.max(t)/A.OSMTILE.options.crs.tile.bounds.getSize().y).toFixed()},bounds:t=>L.bounds([0,0],[A.OSMTILE.options.crs.tilematrix.horizontal.max(t),A.OSMTILE.options.crs.tilematrix.vertical.max(t)])}}})}(),A.handleLink=w.handleLink,A.convertPCRSBounds=w.convertPCRSBounds,A.axisToXY=w.axisToXY,A.csToAxes=w.csToAxes,A.convertAndFormatPCRS=w.convertAndFormatPCRS,A.axisToCS=w.axisToCS,A.parseNumber=w.parseNumber,A.extractInputBounds=w.extractInputBounds,A.splitCoordinate=w.splitCoordinate,A.boundsToPCRSBounds=w.boundsToPCRSBounds,A.pixelToPCRSBounds=w.pixelToPCRSBounds,A.metaContentToObject=w.metaContentToObject,A.coordsToArray=w.coordsToArray,A.parseStylesheetAsHTML=w.parseStylesheetAsHTML,A.pointToPCRSPoint=w.pointToPCRSPoint,A.pixelToPCRSPoint=w.pixelToPCRSPoint,A.gcrsToTileMatrix=w.gcrsToTileMatrix,A.QueryHandler=P,A.ContextMenu=I,A.AnnounceMovement=$,A.FeatureIndex=W,L.Map.addInitHook("addHandler","query",A.QueryHandler),L.Map.addInitHook("addHandler","contextMenu",A.ContextMenu),L.Map.addInitHook("addHandler","announceMovement",A.AnnounceMovement),L.Map.addInitHook("addHandler","featureIndex",A.FeatureIndex),A.MapMLLayer=f,A.mapMLLayer=g,A.ImageOverlay=y,A.imageOverlay=x,A.TemplatedImageLayer=d,A.templatedImageLayer=_,A.TemplatedFeaturesLayer=c,A.templatedFeaturesLayer=h,A.TemplatedLayer=u,A.templatedLayer=p,A.TemplatedTileLayer=l,A.templatedTileLayer=m,A.MapMLFeatures=s,A.mapMlFeatures=r,A.MapMLLayerControl=i,A.mapMlLayerControl=o,A.ReloadButton=F,A.reloadButton=D,A.FullscreenButton=q,A.fullscreenButton=R,A.MapMLStaticTileLayer=t,A.mapMLStaticTileLayer=e,A.DebugOverlay=b,A.debugOverlay=v,A.Crosshair=N,A.crosshair=O,A.Feature=U,A.feature=Z,A.FeatureRenderer=j,A.featureRenderer=G,A.FeatureGroup=H,A.featureGroup=V}(window)}();
\ No newline at end of file
diff --git a/multiple-extents/dist/proj4-src.js b/multiple-extents/dist/proj4-src.js
deleted file mode 100644
index b29a12a..0000000
--- a/multiple-extents/dist/proj4-src.js
+++ /dev/null
@@ -1,6602 +0,0 @@
-(function (global, factory) {
-    typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
-    typeof define === 'function' && define.amd ? define(factory) :
-    (global.proj4 = factory());
-}(window, (function () { 'use strict';
-
-    var globals = function(defs) {
-      defs('EPSG:4326', "+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees");
-      defs('EPSG:4269', "+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees");
-      defs('EPSG:3857', "+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs");
-
-      defs.WGS84 = defs['EPSG:4326'];
-      defs['EPSG:3785'] = defs['EPSG:3857']; // maintain backward compat, official code is 3857
-      defs.GOOGLE = defs['EPSG:3857'];
-      defs['EPSG:900913'] = defs['EPSG:3857'];
-      defs['EPSG:102113'] = defs['EPSG:3857'];
-    };
-
-    var PJD_3PARAM = 1;
-    var PJD_7PARAM = 2;
-    var PJD_WGS84 = 4; // WGS84 or equivalent
-    var PJD_NODATUM = 5; // WGS84 or equivalent
-    var SEC_TO_RAD = 4.84813681109535993589914102357e-6;
-    var HALF_PI = Math.PI/2;
-    // ellipoid pj_set_ell.c
-    var SIXTH = 0.1666666666666666667;
-    /* 1/6 */
-    var RA4 = 0.04722222222222222222;
-    /* 17/360 */
-    var RA6 = 0.02215608465608465608;
-    var EPSLN = 1.0e-10;
-    // you'd think you could use Number.EPSILON above but that makes
-    // Mollweide get into an infinate loop.
-
-    var D2R = 0.01745329251994329577;
-    var R2D = 57.29577951308232088;
-    var FORTPI = Math.PI/4;
-    var TWO_PI = Math.PI * 2;
-    // SPI is slightly greater than Math.PI, so values that exceed the -180..180
-    // degree range by a tiny amount don't get wrapped. This prevents points that
-    // have drifted from their original location along the 180th meridian (due to
-    // floating point error) from changing their sign.
-    var SPI = 3.14159265359;
-
-    var exports$1 = {};
-    exports$1.greenwich = 0.0; //"0dE",
-    exports$1.lisbon = -9.131906111111; //"9d07'54.862\"W",
-    exports$1.paris = 2.337229166667; //"2d20'14.025\"E",
-    exports$1.bogota = -74.080916666667; //"74d04'51.3\"W",
-    exports$1.madrid = -3.687938888889; //"3d41'16.58\"W",
-    exports$1.rome = 12.452333333333; //"12d27'8.4\"E",
-    exports$1.bern = 7.439583333333; //"7d26'22.5\"E",
-    exports$1.jakarta = 106.807719444444; //"106d48'27.79\"E",
-    exports$1.ferro = -17.666666666667; //"17d40'W",
-    exports$1.brussels = 4.367975; //"4d22'4.71\"E",
-    exports$1.stockholm = 18.058277777778; //"18d3'29.8\"E",
-    exports$1.athens = 23.7163375; //"23d42'58.815\"E",
-    exports$1.oslo = 10.722916666667; //"10d43'22.5\"E"
-
-    var units = {
-      ft: {to_meter: 0.3048},
-      'us-ft': {to_meter: 1200 / 3937}
-    };
-
-    var ignoredChar = /[\s_\-\/\(\)]/g;
-    function match(obj, key) {
-      if (obj[key]) {
-        return obj[key];
-      }
-      var keys = Object.keys(obj);
-      var lkey = key.toLowerCase().replace(ignoredChar, '');
-      var i = -1;
-      var testkey, processedKey;
-      while (++i < keys.length) {
-        testkey = keys[i];
-        processedKey = testkey.toLowerCase().replace(ignoredChar, '');
-        if (processedKey === lkey) {
-          return obj[testkey];
-        }
-      }
-    }
-
-    var parseProj = function(defData) {
-      var self = {};
-      var paramObj = defData.split('+').map(function(v) {
-        return v.trim();
-      }).filter(function(a) {
-        return a;
-      }).reduce(function(p, a) {
-        var split = a.split('=');
-        split.push(true);
-        p[split[0].toLowerCase()] = split[1];
-        return p;
-      }, {});
-      var paramName, paramVal, paramOutname;
-      var params = {
-        proj: 'projName',
-        datum: 'datumCode',
-        rf: function(v) {
-          self.rf = parseFloat(v);
-        },
-        lat_0: function(v) {
-          self.lat0 = v * D2R;
-        },
-        lat_1: function(v) {
-          self.lat1 = v * D2R;
-        },
-        lat_2: function(v) {
-          self.lat2 = v * D2R;
-        },
-        lat_ts: function(v) {
-          self.lat_ts = v * D2R;
-        },
-        lon_0: function(v) {
-          self.long0 = v * D2R;
-        },
-        lon_1: function(v) {
-          self.long1 = v * D2R;
-        },
-        lon_2: function(v) {
-          self.long2 = v * D2R;
-        },
-        alpha: function(v) {
-          self.alpha = parseFloat(v) * D2R;
-        },
-        lonc: function(v) {
-          self.longc = v * D2R;
-        },
-        x_0: function(v) {
-          self.x0 = parseFloat(v);
-        },
-        y_0: function(v) {
-          self.y0 = parseFloat(v);
-        },
-        k_0: function(v) {
-          self.k0 = parseFloat(v);
-        },
-        k: function(v) {
-          self.k0 = parseFloat(v);
-        },
-        a: function(v) {
-          self.a = parseFloat(v);
-        },
-        b: function(v) {
-          self.b = parseFloat(v);
-        },
-        r_a: function() {
-          self.R_A = true;
-        },
-        zone: function(v) {
-          self.zone = parseInt(v, 10);
-        },
-        south: function() {
-          self.utmSouth = true;
-        },
-        towgs84: function(v) {
-          self.datum_params = v.split(",").map(function(a) {
-            return parseFloat(a);
-          });
-        },
-        to_meter: function(v) {
-          self.to_meter = parseFloat(v);
-        },
-        units: function(v) {
-          self.units = v;
-          var unit = match(units, v);
-          if (unit) {
-            self.to_meter = unit.to_meter;
-          }
-        },
-        from_greenwich: function(v) {
-          self.from_greenwich = v * D2R;
-        },
-        pm: function(v) {
-          var pm = match(exports$1, v);
-          self.from_greenwich = (pm ? pm : parseFloat(v)) * D2R;
-        },
-        nadgrids: function(v) {
-          if (v === '@null') {
-            self.datumCode = 'none';
-          }
-          else {
-            self.nadgrids = v;
-          }
-        },
-        axis: function(v) {
-          var legalAxis = "ewnsud";
-          if (v.length === 3 && legalAxis.indexOf(v.substr(0, 1)) !== -1 && legalAxis.indexOf(v.substr(1, 1)) !== -1 && legalAxis.indexOf(v.substr(2, 1)) !== -1) {
-            self.axis = v;
-          }
-        }
-      };
-      for (paramName in paramObj) {
-        paramVal = paramObj[paramName];
-        if (paramName in params) {
-          paramOutname = params[paramName];
-          if (typeof paramOutname === 'function') {
-            paramOutname(paramVal);
-          }
-          else {
-            self[paramOutname] = paramVal;
-          }
-        }
-        else {
-          self[paramName] = paramVal;
-        }
-      }
-      if(typeof self.datumCode === 'string' && self.datumCode !== "WGS84"){
-        self.datumCode = self.datumCode.toLowerCase();
-      }
-      return self;
-    };
-
-    var NEUTRAL = 1;
-    var KEYWORD = 2;
-    var NUMBER = 3;
-    var QUOTED = 4;
-    var AFTERQUOTE = 5;
-    var ENDED = -1;
-    var whitespace = /\s/;
-    var latin = /[A-Za-z]/;
-    var keyword = /[A-Za-z84]/;
-    var endThings = /[,\]]/;
-    var digets = /[\d\.E\-\+]/;
-    // const ignoredChar = /[\s_\-\/\(\)]/g;
-    function Parser(text) {
-      if (typeof text !== 'string') {
-        throw new Error('not a string');
-      }
-      this.text = text.trim();
-      this.level = 0;
-      this.place = 0;
-      this.root = null;
-      this.stack = [];
-      this.currentObject = null;
-      this.state = NEUTRAL;
-    }
-    Parser.prototype.readCharicter = function() {
-      var char = this.text[this.place++];
-      if (this.state !== QUOTED) {
-        while (whitespace.test(char)) {
-          if (this.place >= this.text.length) {
-            return;
-          }
-          char = this.text[this.place++];
-        }
-      }
-      switch (this.state) {
-        case NEUTRAL:
-          return this.neutral(char);
-        case KEYWORD:
-          return this.keyword(char)
-        case QUOTED:
-          return this.quoted(char);
-        case AFTERQUOTE:
-          return this.afterquote(char);
-        case NUMBER:
-          return this.number(char);
-        case ENDED:
-          return;
-      }
-    };
-    Parser.prototype.afterquote = function(char) {
-      if (char === '"') {
-        this.word += '"';
-        this.state = QUOTED;
-        return;
-      }
-      if (endThings.test(char)) {
-        this.word = this.word.trim();
-        this.afterItem(char);
-        return;
-      }
-      throw new Error('havn\'t handled "' +char + '" in afterquote yet, index ' + this.place);
-    };
-    Parser.prototype.afterItem = function(char) {
-      if (char === ',') {
-        if (this.word !== null) {
-          this.currentObject.push(this.word);
-        }
-        this.word = null;
-        this.state = NEUTRAL;
-        return;
-      }
-      if (char === ']') {
-        this.level--;
-        if (this.word !== null) {
-          this.currentObject.push(this.word);
-          this.word = null;
-        }
-        this.state = NEUTRAL;
-        this.currentObject = this.stack.pop();
-        if (!this.currentObject) {
-          this.state = ENDED;
-        }
-
-        return;
-      }
-    };
-    Parser.prototype.number = function(char) {
-      if (digets.test(char)) {
-        this.word += char;
-        return;
-      }
-      if (endThings.test(char)) {
-        this.word = parseFloat(this.word);
-        this.afterItem(char);
-        return;
-      }
-      throw new Error('havn\'t handled "' +char + '" in number yet, index ' + this.place);
-    };
-    Parser.prototype.quoted = function(char) {
-      if (char === '"') {
-        this.state = AFTERQUOTE;
-        return;
-      }
-      this.word += char;
-      return;
-    };
-    Parser.prototype.keyword = function(char) {
-      if (keyword.test(char)) {
-        this.word += char;
-        return;
-      }
-      if (char === '[') {
-        var newObjects = [];
-        newObjects.push(this.word);
-        this.level++;
-        if (this.root === null) {
-          this.root = newObjects;
-        } else {
-          this.currentObject.push(newObjects);
-        }
-        this.stack.push(this.currentObject);
-        this.currentObject = newObjects;
-        this.state = NEUTRAL;
-        return;
-      }
-      if (endThings.test(char)) {
-        this.afterItem(char);
-        return;
-      }
-      throw new Error('havn\'t handled "' +char + '" in keyword yet, index ' + this.place);
-    };
-    Parser.prototype.neutral = function(char) {
-      if (latin.test(char)) {
-        this.word = char;
-        this.state = KEYWORD;
-        return;
-      }
-      if (char === '"') {
-        this.word = '';
-        this.state = QUOTED;
-        return;
-      }
-      if (digets.test(char)) {
-        this.word = char;
-        this.state = NUMBER;
-        return;
-      }
-      if (endThings.test(char)) {
-        this.afterItem(char);
-        return;
-      }
-      throw new Error('havn\'t handled "' +char + '" in neutral yet, index ' + this.place);
-    };
-    Parser.prototype.output = function() {
-      while (this.place < this.text.length) {
-        this.readCharicter();
-      }
-      if (this.state === ENDED) {
-        return this.root;
-      }
-      throw new Error('unable to parse string "' +this.text + '". State is ' + this.state);
-    };
-
-    function parseString(txt) {
-      var parser = new Parser(txt);
-      return parser.output();
-    }
-
-    function mapit(obj, key, value) {
-      if (Array.isArray(key)) {
-        value.unshift(key);
-        key = null;
-      }
-      var thing = key ? {} : obj;
-
-      var out = value.reduce(function(newObj, item) {
-        sExpr(item, newObj);
-        return newObj
-      }, thing);
-      if (key) {
-        obj[key] = out;
-      }
-    }
-
-    function sExpr(v, obj) {
-      if (!Array.isArray(v)) {
-        obj[v] = true;
-        return;
-      }
-      var key = v.shift();
-      if (key === 'PARAMETER') {
-        key = v.shift();
-      }
-      if (v.length === 1) {
-        if (Array.isArray(v[0])) {
-          obj[key] = {};
-          sExpr(v[0], obj[key]);
-          return;
-        }
-        obj[key] = v[0];
-        return;
-      }
-      if (!v.length) {
-        obj[key] = true;
-        return;
-      }
-      if (key === 'TOWGS84') {
-        obj[key] = v;
-        return;
-      }
-      if (key === 'AXIS') {
-        if (!(key in obj)) {
-          obj[key] = [];
-        }
-        obj[key].push(v);
-        return;
-      }
-      if (!Array.isArray(key)) {
-        obj[key] = {};
-      }
-
-      var i;
-      switch (key) {
-        case 'UNIT':
-        case 'PRIMEM':
-        case 'VERT_DATUM':
-          obj[key] = {
-            name: v[0].toLowerCase(),
-            convert: v[1]
-          };
-          if (v.length === 3) {
-            sExpr(v[2], obj[key]);
-          }
-          return;
-        case 'SPHEROID':
-        case 'ELLIPSOID':
-          obj[key] = {
-            name: v[0],
-            a: v[1],
-            rf: v[2]
-          };
-          if (v.length === 4) {
-            sExpr(v[3], obj[key]);
-          }
-          return;
-        case 'PROJECTEDCRS':
-        case 'PROJCRS':
-        case 'GEOGCS':
-        case 'GEOCCS':
-        case 'PROJCS':
-        case 'LOCAL_CS':
-        case 'GEODCRS':
-        case 'GEODETICCRS':
-        case 'GEODETICDATUM':
-        case 'EDATUM':
-        case 'ENGINEERINGDATUM':
-        case 'VERT_CS':
-        case 'VERTCRS':
-        case 'VERTICALCRS':
-        case 'COMPD_CS':
-        case 'COMPOUNDCRS':
-        case 'ENGINEERINGCRS':
-        case 'ENGCRS':
-        case 'FITTED_CS':
-        case 'LOCAL_DATUM':
-        case 'DATUM':
-          v[0] = ['name', v[0]];
-          mapit(obj, key, v);
-          return;
-        default:
-          i = -1;
-          while (++i < v.length) {
-            if (!Array.isArray(v[i])) {
-              return sExpr(v, obj[key]);
-            }
-          }
-          return mapit(obj, key, v);
-      }
-    }
-
-    var D2R$1 = 0.01745329251994329577;
-    function rename(obj, params) {
-      var outName = params[0];
-      var inName = params[1];
-      if (!(outName in obj) && (inName in obj)) {
-        obj[outName] = obj[inName];
-        if (params.length === 3) {
-          obj[outName] = params[2](obj[outName]);
-        }
-      }
-    }
-
-    function d2r(input) {
-      return input * D2R$1;
-    }
-
-    function cleanWKT(wkt) {
-      if (wkt.type === 'GEOGCS') {
-        wkt.projName = 'longlat';
-      } else if (wkt.type === 'LOCAL_CS') {
-        wkt.projName = 'identity';
-        wkt.local = true;
-      } else {
-        if (typeof wkt.PROJECTION === 'object') {
-          wkt.projName = Object.keys(wkt.PROJECTION)[0];
-        } else {
-          wkt.projName = wkt.PROJECTION;
-        }
-      }
-      if (wkt.AXIS) {
-        var axisOrder = '';
-        for (var i = 0, ii = wkt.AXIS.length; i < ii; ++i) {
-          var axis = wkt.AXIS[i];
-          var descriptor = axis[0].toLowerCase();
-          if (descriptor.indexOf('north') !== -1) {
-            axisOrder += 'n';
-          } else if (descriptor.indexOf('south') !== -1) {
-            axisOrder += 's';
-          } else if (descriptor.indexOf('east') !== -1) {
-            axisOrder += 'e';
-          } else if (descriptor.indexOf('west') !== -1) {
-            axisOrder += 'w';
-          }
-        }
-        if (axisOrder.length === 2) {
-          axisOrder += 'u';
-        }
-        if (axisOrder.length === 3) {
-          wkt.axis = axisOrder;
-        }
-      }
-      if (wkt.UNIT) {
-        wkt.units = wkt.UNIT.name.toLowerCase();
-        if (wkt.units === 'metre') {
-          wkt.units = 'meter';
-        }
-        if (wkt.UNIT.convert) {
-          if (wkt.type === 'GEOGCS') {
-            if (wkt.DATUM && wkt.DATUM.SPHEROID) {
-              wkt.to_meter = wkt.UNIT.convert*wkt.DATUM.SPHEROID.a;
-            }
-          } else {
-            wkt.to_meter = wkt.UNIT.convert;
-          }
-        }
-      }
-      var geogcs = wkt.GEOGCS;
-      if (wkt.type === 'GEOGCS') {
-        geogcs = wkt;
-      }
-      if (geogcs) {
-        //if(wkt.GEOGCS.PRIMEM&&wkt.GEOGCS.PRIMEM.convert){
-        //  wkt.from_greenwich=wkt.GEOGCS.PRIMEM.convert*D2R;
-        //}
-        if (geogcs.DATUM) {
-          wkt.datumCode = geogcs.DATUM.name.toLowerCase();
-        } else {
-          wkt.datumCode = geogcs.name.toLowerCase();
-        }
-        if (wkt.datumCode.slice(0, 2) === 'd_') {
-          wkt.datumCode = wkt.datumCode.slice(2);
-        }
-        if (wkt.datumCode === 'new_zealand_geodetic_datum_1949' || wkt.datumCode === 'new_zealand_1949') {
-          wkt.datumCode = 'nzgd49';
-        }
-        if (wkt.datumCode === 'wgs_1984' || wkt.datumCode === 'world_geodetic_system_1984') {
-          if (wkt.PROJECTION === 'Mercator_Auxiliary_Sphere') {
-            wkt.sphere = true;
-          }
-          wkt.datumCode = 'wgs84';
-        }
-        if (wkt.datumCode.slice(-6) === '_ferro') {
-          wkt.datumCode = wkt.datumCode.slice(0, - 6);
-        }
-        if (wkt.datumCode.slice(-8) === '_jakarta') {
-          wkt.datumCode = wkt.datumCode.slice(0, - 8);
-        }
-        if (~wkt.datumCode.indexOf('belge')) {
-          wkt.datumCode = 'rnb72';
-        }
-        if (geogcs.DATUM && geogcs.DATUM.SPHEROID) {
-          wkt.ellps = geogcs.DATUM.SPHEROID.name.replace('_19', '').replace(/[Cc]larke\_18/, 'clrk');
-          if (wkt.ellps.toLowerCase().slice(0, 13) === 'international') {
-            wkt.ellps = 'intl';
-          }
-
-          wkt.a = geogcs.DATUM.SPHEROID.a;
-          wkt.rf = parseFloat(geogcs.DATUM.SPHEROID.rf, 10);
-        }
-
-        if (geogcs.DATUM && geogcs.DATUM.TOWGS84) {
-          wkt.datum_params = geogcs.DATUM.TOWGS84;
-        }
-        if (~wkt.datumCode.indexOf('osgb_1936')) {
-          wkt.datumCode = 'osgb36';
-        }
-        if (~wkt.datumCode.indexOf('osni_1952')) {
-          wkt.datumCode = 'osni52';
-        }
-        if (~wkt.datumCode.indexOf('tm65')
-          || ~wkt.datumCode.indexOf('geodetic_datum_of_1965')) {
-          wkt.datumCode = 'ire65';
-        }
-        if (wkt.datumCode === 'ch1903+') {
-          wkt.datumCode = 'ch1903';
-        }
-        if (~wkt.datumCode.indexOf('israel')) {
-          wkt.datumCode = 'isr93';
-        }
-      }
-      if (wkt.b && !isFinite(wkt.b)) {
-        wkt.b = wkt.a;
-      }
-
-      function toMeter(input) {
-        var ratio = wkt.to_meter || 1;
-        return input * ratio;
-      }
-      var renamer = function(a) {
-        return rename(wkt, a);
-      };
-      var list = [
-        ['standard_parallel_1', 'Standard_Parallel_1'],
-        ['standard_parallel_2', 'Standard_Parallel_2'],
-        ['false_easting', 'False_Easting'],
-        ['false_northing', 'False_Northing'],
-        ['central_meridian', 'Central_Meridian'],
-        ['latitude_of_origin', 'Latitude_Of_Origin'],
-        ['latitude_of_origin', 'Central_Parallel'],
-        ['scale_factor', 'Scale_Factor'],
-        ['k0', 'scale_factor'],
-        ['latitude_of_center', 'Latitude_Of_Center'],
-        ['latitude_of_center', 'Latitude_of_center'],
-        ['lat0', 'latitude_of_center', d2r],
-        ['longitude_of_center', 'Longitude_Of_Center'],
-        ['longitude_of_center', 'Longitude_of_center'],
-        ['longc', 'longitude_of_center', d2r],
-        ['x0', 'false_easting', toMeter],
-        ['y0', 'false_northing', toMeter],
-        ['long0', 'central_meridian', d2r],
-        ['lat0', 'latitude_of_origin', d2r],
-        ['lat0', 'standard_parallel_1', d2r],
-        ['lat1', 'standard_parallel_1', d2r],
-        ['lat2', 'standard_parallel_2', d2r],
-        ['azimuth', 'Azimuth'],
-        ['alpha', 'azimuth', d2r],
-        ['srsCode', 'name']
-      ];
-      list.forEach(renamer);
-      if (!wkt.long0 && wkt.longc && (wkt.projName === 'Albers_Conic_Equal_Area' || wkt.projName === 'Lambert_Azimuthal_Equal_Area')) {
-        wkt.long0 = wkt.longc;
-      }
-      if (!wkt.lat_ts && wkt.lat1 && (wkt.projName === 'Stereographic_South_Pole' || wkt.projName === 'Polar Stereographic (variant B)')) {
-        wkt.lat0 = d2r(wkt.lat1 > 0 ? 90 : -90);
-        wkt.lat_ts = wkt.lat1;
-      }
-    }
-    var wkt = function(wkt) {
-      var lisp = parseString(wkt);
-      var type = lisp.shift();
-      var name = lisp.shift();
-      lisp.unshift(['name', name]);
-      lisp.unshift(['type', type]);
-      var obj = {};
-      sExpr(lisp, obj);
-      cleanWKT(obj);
-      return obj;
-    };
-
-    function defs(name) {
-      /*global console*/
-      var that = this;
-      if (arguments.length === 2) {
-        var def = arguments[1];
-        if (typeof def === 'string') {
-          if (def.charAt(0) === '+') {
-            defs[name] = parseProj(arguments[1]);
-          }
-          else {
-            defs[name] = wkt(arguments[1]);
-          }
-        } else {
-          defs[name] = def;
-        }
-      }
-      else if (arguments.length === 1) {
-        if (Array.isArray(name)) {
-          return name.map(function(v) {
-            if (Array.isArray(v)) {
-              defs.apply(that, v);
-            }
-            else {
-              defs(v);
-            }
-          });
-        }
-        else if (typeof name === 'string') {
-          if (name in defs) {
-            return defs[name];
-          }
-        }
-        else if ('EPSG' in name) {
-          defs['EPSG:' + name.EPSG] = name;
-        }
-        else if ('ESRI' in name) {
-          defs['ESRI:' + name.ESRI] = name;
-        }
-        else if ('IAU2000' in name) {
-          defs['IAU2000:' + name.IAU2000] = name;
-        }
-        else {
-          console.log(name);
-        }
-        return;
-      }
-
-
-    }
-    globals(defs);
-
-    function testObj(code){
-      return typeof code === 'string';
-    }
-    function testDef(code){
-      return code in defs;
-    }
-     var codeWords = ['PROJECTEDCRS', 'PROJCRS', 'GEOGCS','GEOCCS','PROJCS','LOCAL_CS', 'GEODCRS', 'GEODETICCRS', 'GEODETICDATUM', 'ENGCRS', 'ENGINEERINGCRS'];
-    function testWKT(code){
-      return codeWords.some(function (word) {
-        return code.indexOf(word) > -1;
-      });
-    }
-    var codes = ['3857', '900913', '3785', '102113'];
-    function checkMercator(item) {
-      var auth = match(item, 'authority');
-      if (!auth) {
-        return;
-      }
-      var code = match(auth, 'epsg');
-      return code && codes.indexOf(code) > -1;
-    }
-    function checkProjStr(item) {
-      var ext = match(item, 'extension');
-      if (!ext) {
-        return;
-      }
-      return match(ext, 'proj4');
-    }
-    function testProj(code){
-      return code[0] === '+';
-    }
-    function parse(code){
-      if (testObj(code)) {
-        //check to see if this is a WKT string
-        if (testDef(code)) {
-          return defs[code];
-        }
-        if (testWKT(code)) {
-          var out = wkt(code);
-          // test of spetial case, due to this being a very common and often malformed
-          if (checkMercator(out)) {
-            return defs['EPSG:3857'];
-          }
-          var maybeProjStr = checkProjStr(out);
-          if (maybeProjStr) {
-            return parseProj(maybeProjStr);
-          }
-          return out;
-        }
-        if (testProj(code)) {
-          return parseProj(code);
-        }
-      }else{
-        return code;
-      }
-    }
-
-    var extend = function(destination, source) {
-      destination = destination || {};
-      var value, property;
-      if (!source) {
-        return destination;
-      }
-      for (property in source) {
-        value = source[property];
-        if (value !== undefined) {
-          destination[property] = value;
-        }
-      }
-      return destination;
-    };
-
-    var msfnz = function(eccent, sinphi, cosphi) {
-      var con = eccent * sinphi;
-      return cosphi / (Math.sqrt(1 - con * con));
-    };
-
-    var sign = function(x) {
-      return x<0 ? -1 : 1;
-    };
-
-    var adjust_lon = function(x) {
-      return (Math.abs(x) <= SPI) ? x : (x - (sign(x) * TWO_PI));
-    };
-
-    var tsfnz = function(eccent, phi, sinphi) {
-      var con = eccent * sinphi;
-      var com = 0.5 * eccent;
-      con = Math.pow(((1 - con) / (1 + con)), com);
-      return (Math.tan(0.5 * (HALF_PI - phi)) / con);
-    };
-
-    var phi2z = function(eccent, ts) {
-      var eccnth = 0.5 * eccent;
-      var con, dphi;
-      var phi = HALF_PI - 2 * Math.atan(ts);
-      for (var i = 0; i <= 15; i++) {
-        con = eccent * Math.sin(phi);
-        dphi = HALF_PI - 2 * Math.atan(ts * (Math.pow(((1 - con) / (1 + con)), eccnth))) - phi;
-        phi += dphi;
-        if (Math.abs(dphi) <= 0.0000000001) {
-          return phi;
-        }
-      }
-      //console.log("phi2z has NoConvergence");
-      return -9999;
-    };
-
-    function init() {
-      var con = this.b / this.a;
-      this.es = 1 - con * con;
-      if(!('x0' in this)){
-        this.x0 = 0;
-      }
-      if(!('y0' in this)){
-        this.y0 = 0;
-      }
-      this.e = Math.sqrt(this.es);
-      if (this.lat_ts) {
-        if (this.sphere) {
-          this.k0 = Math.cos(this.lat_ts);
-        }
-        else {
-          this.k0 = msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts));
-        }
-      }
-      else {
-        if (!this.k0) {
-          if (this.k) {
-            this.k0 = this.k;
-          }
-          else {
-            this.k0 = 1;
-          }
-        }
-      }
-    }
-
-    /* Mercator forward equations--mapping lat,long to x,y
-      --------------------------------------------------*/
-
-    function forward(p) {
-      var lon = p.x;
-      var lat = p.y;
-      // convert to radians
-      if (lat * R2D > 90 && lat * R2D < -90 && lon * R2D > 180 && lon * R2D < -180) {
-        return null;
-      }
-
-      var x, y;
-      if (Math.abs(Math.abs(lat) - HALF_PI) <= EPSLN) {
-        return null;
-      }
-      else {
-        if (this.sphere) {
-          x = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0);
-          y = this.y0 + this.a * this.k0 * Math.log(Math.tan(FORTPI + 0.5 * lat));
-        }
-        else {
-          var sinphi = Math.sin(lat);
-          var ts = tsfnz(this.e, lat, sinphi);
-          x = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0);
-          y = this.y0 - this.a * this.k0 * Math.log(ts);
-        }
-        p.x = x;
-        p.y = y;
-        return p;
-      }
-    }
-
-    /* Mercator inverse equations--mapping x,y to lat/long
-      --------------------------------------------------*/
-    function inverse(p) {
-
-      var x = p.x - this.x0;
-      var y = p.y - this.y0;
-      var lon, lat;
-
-      if (this.sphere) {
-        lat = HALF_PI - 2 * Math.atan(Math.exp(-y / (this.a * this.k0)));
-      }
-      else {
-        var ts = Math.exp(-y / (this.a * this.k0));
-        lat = phi2z(this.e, ts);
-        if (lat === -9999) {
-          return null;
-        }
-      }
-      lon = adjust_lon(this.long0 + x / (this.a * this.k0));
-
-      p.x = lon;
-      p.y = lat;
-      return p;
-    }
-
-    var names$1 = ["Mercator", "Popular Visualisation Pseudo Mercator", "Mercator_1SP", "Mercator_Auxiliary_Sphere", "merc"];
-    var merc = {
-      init: init,
-      forward: forward,
-      inverse: inverse,
-      names: names$1
-    };
-
-    function init$1() {
-      //no-op for longlat
-    }
-
-    function identity(pt) {
-      return pt;
-    }
-    var names$2 = ["longlat", "identity"];
-    var longlat = {
-      init: init$1,
-      forward: identity,
-      inverse: identity,
-      names: names$2
-    };
-
-    var projs = [merc, longlat];
-    var names = {};
-    var projStore = [];
-
-    function add(proj, i) {
-      var len = projStore.length;
-      if (!proj.names) {
-        console.log(i);
-        return true;
-      }
-      projStore[len] = proj;
-      proj.names.forEach(function(n) {
-        names[n.toLowerCase()] = len;
-      });
-      return this;
-    }
-
-    function get(name) {
-      if (!name) {
-        return false;
-      }
-      var n = name.toLowerCase();
-      if (typeof names[n] !== 'undefined' && projStore[names[n]]) {
-        return projStore[names[n]];
-      }
-    }
-
-    function start() {
-      projs.forEach(add);
-    }
-    var projections = {
-      start: start,
-      add: add,
-      get: get
-    };
-
-    var exports$2 = {};
-    exports$2.MERIT = {
-      a: 6378137.0,
-      rf: 298.257,
-      ellipseName: "MERIT 1983"
-    };
-
-    exports$2.SGS85 = {
-      a: 6378136.0,
-      rf: 298.257,
-      ellipseName: "Soviet Geodetic System 85"
-    };
-
-    exports$2.GRS80 = {
-      a: 6378137.0,
-      rf: 298.257222101,
-      ellipseName: "GRS 1980(IUGG, 1980)"
-    };
-
-    exports$2.IAU76 = {
-      a: 6378140.0,
-      rf: 298.257,
-      ellipseName: "IAU 1976"
-    };
-
-    exports$2.airy = {
-      a: 6377563.396,
-      b: 6356256.910,
-      ellipseName: "Airy 1830"
-    };
-
-    exports$2.APL4 = {
-      a: 6378137,
-      rf: 298.25,
-      ellipseName: "Appl. Physics. 1965"
-    };
-
-    exports$2.NWL9D = {
-      a: 6378145.0,
-      rf: 298.25,
-      ellipseName: "Naval Weapons Lab., 1965"
-    };
-
-    exports$2.mod_airy = {
-      a: 6377340.189,
-      b: 6356034.446,
-      ellipseName: "Modified Airy"
-    };
-
-    exports$2.andrae = {
-      a: 6377104.43,
-      rf: 300.0,
-      ellipseName: "Andrae 1876 (Den., Iclnd.)"
-    };
-
-    exports$2.aust_SA = {
-      a: 6378160.0,
-      rf: 298.25,
-      ellipseName: "Australian Natl & S. Amer. 1969"
-    };
-
-    exports$2.GRS67 = {
-      a: 6378160.0,
-      rf: 298.2471674270,
-      ellipseName: "GRS 67(IUGG 1967)"
-    };
-
-    exports$2.bessel = {
-      a: 6377397.155,
-      rf: 299.1528128,
-      ellipseName: "Bessel 1841"
-    };
-
-    exports$2.bess_nam = {
-      a: 6377483.865,
-      rf: 299.1528128,
-      ellipseName: "Bessel 1841 (Namibia)"
-    };
-
-    exports$2.clrk66 = {
-      a: 6378206.4,
-      b: 6356583.8,
-      ellipseName: "Clarke 1866"
-    };
-
-    exports$2.clrk80 = {
-      a: 6378249.145,
-      rf: 293.4663,
-      ellipseName: "Clarke 1880 mod."
-    };
-
-    exports$2.clrk58 = {
-      a: 6378293.645208759,
-      rf: 294.2606763692654,
-      ellipseName: "Clarke 1858"
-    };
-
-    exports$2.CPM = {
-      a: 6375738.7,
-      rf: 334.29,
-      ellipseName: "Comm. des Poids et Mesures 1799"
-    };
-
-    exports$2.delmbr = {
-      a: 6376428.0,
-      rf: 311.5,
-      ellipseName: "Delambre 1810 (Belgium)"
-    };
-
-    exports$2.engelis = {
-      a: 6378136.05,
-      rf: 298.2566,
-      ellipseName: "Engelis 1985"
-    };
-
-    exports$2.evrst30 = {
-      a: 6377276.345,
-      rf: 300.8017,
-      ellipseName: "Everest 1830"
-    };
-
-    exports$2.evrst48 = {
-      a: 6377304.063,
-      rf: 300.8017,
-      ellipseName: "Everest 1948"
-    };
-
-    exports$2.evrst56 = {
-      a: 6377301.243,
-      rf: 300.8017,
-      ellipseName: "Everest 1956"
-    };
-
-    exports$2.evrst69 = {
-      a: 6377295.664,
-      rf: 300.8017,
-      ellipseName: "Everest 1969"
-    };
-
-    exports$2.evrstSS = {
-      a: 6377298.556,
-      rf: 300.8017,
-      ellipseName: "Everest (Sabah & Sarawak)"
-    };
-
-    exports$2.fschr60 = {
-      a: 6378166.0,
-      rf: 298.3,
-      ellipseName: "Fischer (Mercury Datum) 1960"
-    };
-
-    exports$2.fschr60m = {
-      a: 6378155.0,
-      rf: 298.3,
-      ellipseName: "Fischer 1960"
-    };
-
-    exports$2.fschr68 = {
-      a: 6378150.0,
-      rf: 298.3,
-      ellipseName: "Fischer 1968"
-    };
-
-    exports$2.helmert = {
-      a: 6378200.0,
-      rf: 298.3,
-      ellipseName: "Helmert 1906"
-    };
-
-    exports$2.hough = {
-      a: 6378270.0,
-      rf: 297.0,
-      ellipseName: "Hough"
-    };
-
-    exports$2.intl = {
-      a: 6378388.0,
-      rf: 297.0,
-      ellipseName: "International 1909 (Hayford)"
-    };
-
-    exports$2.kaula = {
-      a: 6378163.0,
-      rf: 298.24,
-      ellipseName: "Kaula 1961"
-    };
-
-    exports$2.lerch = {
-      a: 6378139.0,
-      rf: 298.257,
-      ellipseName: "Lerch 1979"
-    };
-
-    exports$2.mprts = {
-      a: 6397300.0,
-      rf: 191.0,
-      ellipseName: "Maupertius 1738"
-    };
-
-    exports$2.new_intl = {
-      a: 6378157.5,
-      b: 6356772.2,
-      ellipseName: "New International 1967"
-    };
-
-    exports$2.plessis = {
-      a: 6376523.0,
-      rf: 6355863.0,
-      ellipseName: "Plessis 1817 (France)"
-    };
-
-    exports$2.krass = {
-      a: 6378245.0,
-      rf: 298.3,
-      ellipseName: "Krassovsky, 1942"
-    };
-
-    exports$2.SEasia = {
-      a: 6378155.0,
-      b: 6356773.3205,
-      ellipseName: "Southeast Asia"
-    };
-
-    exports$2.walbeck = {
-      a: 6376896.0,
-      b: 6355834.8467,
-      ellipseName: "Walbeck"
-    };
-
-    exports$2.WGS60 = {
-      a: 6378165.0,
-      rf: 298.3,
-      ellipseName: "WGS 60"
-    };
-
-    exports$2.WGS66 = {
-      a: 6378145.0,
-      rf: 298.25,
-      ellipseName: "WGS 66"
-    };
-
-    exports$2.WGS7 = {
-      a: 6378135.0,
-      rf: 298.26,
-      ellipseName: "WGS 72"
-    };
-
-    var WGS84 = exports$2.WGS84 = {
-      a: 6378137.0,
-      rf: 298.257223563,
-      ellipseName: "WGS 84"
-    };
-
-    exports$2.sphere = {
-      a: 6370997.0,
-      b: 6370997.0,
-      ellipseName: "Normal Sphere (r=6370997)"
-    };
-
-    function eccentricity(a, b, rf, R_A) {
-      var a2 = a * a; // used in geocentric
-      var b2 = b * b; // used in geocentric
-      var es = (a2 - b2) / a2; // e ^ 2
-      var e = 0;
-      if (R_A) {
-        a *= 1 - es * (SIXTH + es * (RA4 + es * RA6));
-        a2 = a * a;
-        es = 0;
-      } else {
-        e = Math.sqrt(es); // eccentricity
-      }
-      var ep2 = (a2 - b2) / b2; // used in geocentric
-      return {
-        es: es,
-        e: e,
-        ep2: ep2
-      };
-    }
-    function sphere(a, b, rf, ellps, sphere) {
-      if (!a) { // do we have an ellipsoid?
-        var ellipse = match(exports$2, ellps);
-        if (!ellipse) {
-          ellipse = WGS84;
-        }
-        a = ellipse.a;
-        b = ellipse.b;
-        rf = ellipse.rf;
-      }
-
-      if (rf && !b) {
-        b = (1.0 - 1.0 / rf) * a;
-      }
-      if (rf === 0 || Math.abs(a - b) < EPSLN) {
-        sphere = true;
-        b = a;
-      }
-      return {
-        a: a,
-        b: b,
-        rf: rf,
-        sphere: sphere
-      };
-    }
-
-    var exports$3 = {};
-    exports$3.wgs84 = {
-      towgs84: "0,0,0",
-      ellipse: "WGS84",
-      datumName: "WGS84"
-    };
-
-    exports$3.ch1903 = {
-      towgs84: "674.374,15.056,405.346",
-      ellipse: "bessel",
-      datumName: "swiss"
-    };
-
-    exports$3.ggrs87 = {
-      towgs84: "-199.87,74.79,246.62",
-      ellipse: "GRS80",
-      datumName: "Greek_Geodetic_Reference_System_1987"
-    };
-
-    exports$3.nad83 = {
-      towgs84: "0,0,0",
-      ellipse: "GRS80",
-      datumName: "North_American_Datum_1983"
-    };
-
-    exports$3.nad27 = {
-      nadgrids: "@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",
-      ellipse: "clrk66",
-      datumName: "North_American_Datum_1927"
-    };
-
-    exports$3.potsdam = {
-      towgs84: "606.0,23.0,413.0",
-      ellipse: "bessel",
-      datumName: "Potsdam Rauenberg 1950 DHDN"
-    };
-
-    exports$3.carthage = {
-      towgs84: "-263.0,6.0,431.0",
-      ellipse: "clark80",
-      datumName: "Carthage 1934 Tunisia"
-    };
-
-    exports$3.hermannskogel = {
-      towgs84: "653.0,-212.0,449.0",
-      ellipse: "bessel",
-      datumName: "Hermannskogel"
-    };
-
-    exports$3.osni52 = {
-      towgs84: "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",
-      ellipse: "airy",
-      datumName: "Irish National"
-    };
-
-    exports$3.ire65 = {
-      towgs84: "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",
-      ellipse: "mod_airy",
-      datumName: "Ireland 1965"
-    };
-
-    exports$3.rassadiran = {
-      towgs84: "-133.63,-157.5,-158.62",
-      ellipse: "intl",
-      datumName: "Rassadiran"
-    };
-
-    exports$3.nzgd49 = {
-      towgs84: "59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",
-      ellipse: "intl",
-      datumName: "New Zealand Geodetic Datum 1949"
-    };
-
-    exports$3.osgb36 = {
-      towgs84: "446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",
-      ellipse: "airy",
-      datumName: "Airy 1830"
-    };
-
-    exports$3.s_jtsk = {
-      towgs84: "589,76,480",
-      ellipse: 'bessel',
-      datumName: 'S-JTSK (Ferro)'
-    };
-
-    exports$3.beduaram = {
-      towgs84: '-106,-87,188',
-      ellipse: 'clrk80',
-      datumName: 'Beduaram'
-    };
-
-    exports$3.gunung_segara = {
-      towgs84: '-403,684,41',
-      ellipse: 'bessel',
-      datumName: 'Gunung Segara Jakarta'
-    };
-
-    exports$3.rnb72 = {
-      towgs84: "106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",
-      ellipse: "intl",
-      datumName: "Reseau National Belge 1972"
-    };
-
-    function datum(datumCode, datum_params, a, b, es, ep2) {
-      var out = {};
-
-      if (datumCode === undefined || datumCode === 'none') {
-        out.datum_type = PJD_NODATUM;
-      } else {
-        out.datum_type = PJD_WGS84;
-      }
-
-      if (datum_params) {
-        out.datum_params = datum_params.map(parseFloat);
-        if (out.datum_params[0] !== 0 || out.datum_params[1] !== 0 || out.datum_params[2] !== 0) {
-          out.datum_type = PJD_3PARAM;
-        }
-        if (out.datum_params.length > 3) {
-          if (out.datum_params[3] !== 0 || out.datum_params[4] !== 0 || out.datum_params[5] !== 0 || out.datum_params[6] !== 0) {
-            out.datum_type = PJD_7PARAM;
-            out.datum_params[3] *= SEC_TO_RAD;
-            out.datum_params[4] *= SEC_TO_RAD;
-            out.datum_params[5] *= SEC_TO_RAD;
-            out.datum_params[6] = (out.datum_params[6] / 1000000.0) + 1.0;
-          }
-        }
-      }
-
-      out.a = a; //datum object also uses these values
-      out.b = b;
-      out.es = es;
-      out.ep2 = ep2;
-      return out;
-    }
-
-    function Projection(srsCode,callback) {
-      if (!(this instanceof Projection)) {
-        return new Projection(srsCode);
-      }
-      callback = callback || function(error){
-        if(error){
-          throw error;
-        }
-      };
-      var json = parse(srsCode);
-      if(typeof json !== 'object'){
-        callback(srsCode);
-        return;
-      }
-      var ourProj = Projection.projections.get(json.projName);
-      if(!ourProj){
-        callback(srsCode);
-        return;
-      }
-      if (json.datumCode && json.datumCode !== 'none') {
-        var datumDef = match(exports$3, json.datumCode);
-        if (datumDef) {
-          json.datum_params = datumDef.towgs84 ? datumDef.towgs84.split(',') : null;
-          json.ellps = datumDef.ellipse;
-          json.datumName = datumDef.datumName ? datumDef.datumName : json.datumCode;
-        }
-      }
-      json.k0 = json.k0 || 1.0;
-      json.axis = json.axis || 'enu';
-      json.ellps = json.ellps || 'wgs84';
-      var sphere_ = sphere(json.a, json.b, json.rf, json.ellps, json.sphere);
-      var ecc = eccentricity(sphere_.a, sphere_.b, sphere_.rf, json.R_A);
-      var datumObj = json.datum || datum(json.datumCode, json.datum_params, sphere_.a, sphere_.b, ecc.es, ecc.ep2);
-
-      extend(this, json); // transfer everything over from the projection because we don't know what we'll need
-      extend(this, ourProj); // transfer all the methods from the projection
-
-      // copy the 4 things over we calulated in deriveConstants.sphere
-      this.a = sphere_.a;
-      this.b = sphere_.b;
-      this.rf = sphere_.rf;
-      this.sphere = sphere_.sphere;
-
-      // copy the 3 things we calculated in deriveConstants.eccentricity
-      this.es = ecc.es;
-      this.e = ecc.e;
-      this.ep2 = ecc.ep2;
-
-      // add in the datum object
-      this.datum = datumObj;
-
-      // init the projection
-      this.init();
-
-      // legecy callback from back in the day when it went to spatialreference.org
-      callback(null, this);
-
-    }
-    Projection.projections = projections;
-    Projection.projections.start();
-
-    'use strict';
-    function compareDatums(source, dest) {
-      if (source.datum_type !== dest.datum_type) {
-        return false; // false, datums are not equal
-      } else if (source.a !== dest.a || Math.abs(source.es - dest.es) > 0.000000000050) {
-        // the tolerance for es is to ensure that GRS80 and WGS84
-        // are considered identical
-        return false;
-      } else if (source.datum_type === PJD_3PARAM) {
-        return (source.datum_params[0] === dest.datum_params[0] && source.datum_params[1] === dest.datum_params[1] && source.datum_params[2] === dest.datum_params[2]);
-      } else if (source.datum_type === PJD_7PARAM) {
-        return (source.datum_params[0] === dest.datum_params[0] && source.datum_params[1] === dest.datum_params[1] && source.datum_params[2] === dest.datum_params[2] && source.datum_params[3] === dest.datum_params[3] && source.datum_params[4] === dest.datum_params[4] && source.datum_params[5] === dest.datum_params[5] && source.datum_params[6] === dest.datum_params[6]);
-      } else {
-        return true; // datums are equal
-      }
-    } // cs_compare_datums()
-
-    /*
-     * The function Convert_Geodetic_To_Geocentric converts geodetic coordinates
-     * (latitude, longitude, and height) to geocentric coordinates (X, Y, Z),
-     * according to the current ellipsoid parameters.
-     *
-     *    Latitude  : Geodetic latitude in radians                     (input)
-     *    Longitude : Geodetic longitude in radians                    (input)
-     *    Height    : Geodetic height, in meters                       (input)
-     *    X         : Calculated Geocentric X coordinate, in meters    (output)
-     *    Y         : Calculated Geocentric Y coordinate, in meters    (output)
-     *    Z         : Calculated Geocentric Z coordinate, in meters    (output)
-     *
-     */
-    function geodeticToGeocentric(p, es, a) {
-      var Longitude = p.x;
-      var Latitude = p.y;
-      var Height = p.z ? p.z : 0; //Z value not always supplied
-
-      var Rn; /*  Earth radius at location  */
-      var Sin_Lat; /*  Math.sin(Latitude)  */
-      var Sin2_Lat; /*  Square of Math.sin(Latitude)  */
-      var Cos_Lat; /*  Math.cos(Latitude)  */
-
-      /*
-       ** Don't blow up if Latitude is just a little out of the value
-       ** range as it may just be a rounding issue.  Also removed longitude
-       ** test, it should be wrapped by Math.cos() and Math.sin().  NFW for PROJ.4, Sep/2001.
-       */
-      if (Latitude < -HALF_PI && Latitude > -1.001 * HALF_PI) {
-        Latitude = -HALF_PI;
-      } else if (Latitude > HALF_PI && Latitude < 1.001 * HALF_PI) {
-        Latitude = HALF_PI;
-      } else if (Latitude < -HALF_PI) {
-        /* Latitude out of range */
-        //..reportError('geocent:lat out of range:' + Latitude);
-        return { x: -Infinity, y: -Infinity, z: p.z };
-      } else if (Latitude > HALF_PI) {
-        /* Latitude out of range */
-        return { x: Infinity, y: Infinity, z: p.z };
-      }
-
-      if (Longitude > Math.PI) {
-        Longitude -= (2 * Math.PI);
-      }
-      Sin_Lat = Math.sin(Latitude);
-      Cos_Lat = Math.cos(Latitude);
-      Sin2_Lat = Sin_Lat * Sin_Lat;
-      Rn = a / (Math.sqrt(1.0e0 - es * Sin2_Lat));
-      return {
-        x: (Rn + Height) * Cos_Lat * Math.cos(Longitude),
-        y: (Rn + Height) * Cos_Lat * Math.sin(Longitude),
-        z: ((Rn * (1 - es)) + Height) * Sin_Lat
-      };
-    } // cs_geodetic_to_geocentric()
-
-    function geocentricToGeodetic(p, es, a, b) {
-      /* local defintions and variables */
-      /* end-criterium of loop, accuracy of sin(Latitude) */
-      var genau = 1e-12;
-      var genau2 = (genau * genau);
-      var maxiter = 30;
-
-      var P; /* distance between semi-minor axis and location */
-      var RR; /* distance between center and location */
-      var CT; /* sin of geocentric latitude */
-      var ST; /* cos of geocentric latitude */
-      var RX;
-      var RK;
-      var RN; /* Earth radius at location */
-      var CPHI0; /* cos of start or old geodetic latitude in iterations */
-      var SPHI0; /* sin of start or old geodetic latitude in iterations */
-      var CPHI; /* cos of searched geodetic latitude */
-      var SPHI; /* sin of searched geodetic latitude */
-      var SDPHI; /* end-criterium: addition-theorem of sin(Latitude(iter)-Latitude(iter-1)) */
-      var iter; /* # of continous iteration, max. 30 is always enough (s.a.) */
-
-      var X = p.x;
-      var Y = p.y;
-      var Z = p.z ? p.z : 0.0; //Z value not always supplied
-      var Longitude;
-      var Latitude;
-      var Height;
-
-      P = Math.sqrt(X * X + Y * Y);
-      RR = Math.sqrt(X * X + Y * Y + Z * Z);
-
-      /*      special cases for latitude and longitude */
-      if (P / a < genau) {
-
-        /*  special case, if P=0. (X=0., Y=0.) */
-        Longitude = 0.0;
-
-        /*  if (X,Y,Z)=(0.,0.,0.) then Height becomes semi-minor axis
-         *  of ellipsoid (=center of mass), Latitude becomes PI/2 */
-        if (RR / a < genau) {
-          Latitude = HALF_PI;
-          Height = -b;
-          return {
-            x: p.x,
-            y: p.y,
-            z: p.z
-          };
-        }
-      } else {
-        /*  ellipsoidal (geodetic) longitude
-         *  interval: -PI < Longitude <= +PI */
-        Longitude = Math.atan2(Y, X);
-      }
-
-      /* --------------------------------------------------------------
-       * Following iterative algorithm was developped by
-       * "Institut for Erdmessung", University of Hannover, July 1988.
-       * Internet: www.ife.uni-hannover.de
-       * Iterative computation of CPHI,SPHI and Height.
-       * Iteration of CPHI and SPHI to 10**-12 radian resp.
-       * 2*10**-7 arcsec.
-       * --------------------------------------------------------------
-       */
-      CT = Z / RR;
-      ST = P / RR;
-      RX = 1.0 / Math.sqrt(1.0 - es * (2.0 - es) * ST * ST);
-      CPHI0 = ST * (1.0 - es) * RX;
-      SPHI0 = CT * RX;
-      iter = 0;
-
-      /* loop to find sin(Latitude) resp. Latitude
-       * until |sin(Latitude(iter)-Latitude(iter-1))| < genau */
-      do {
-        iter++;
-        RN = a / Math.sqrt(1.0 - es * SPHI0 * SPHI0);
-
-        /*  ellipsoidal (geodetic) height */
-        Height = P * CPHI0 + Z * SPHI0 - RN * (1.0 - es * SPHI0 * SPHI0);
-
-        RK = es * RN / (RN + Height);
-        RX = 1.0 / Math.sqrt(1.0 - RK * (2.0 - RK) * ST * ST);
-        CPHI = ST * (1.0 - RK) * RX;
-        SPHI = CT * RX;
-        SDPHI = SPHI * CPHI0 - CPHI * SPHI0;
-        CPHI0 = CPHI;
-        SPHI0 = SPHI;
-      }
-      while (SDPHI * SDPHI > genau2 && iter < maxiter);
-
-      /*      ellipsoidal (geodetic) latitude */
-      Latitude = Math.atan(SPHI / Math.abs(CPHI));
-      return {
-        x: Longitude,
-        y: Latitude,
-        z: Height
-      };
-    } // cs_geocentric_to_geodetic()
-
-    /****************************************************************/
-    // pj_geocentic_to_wgs84( p )
-    //  p = point to transform in geocentric coordinates (x,y,z)
-
-
-    /** point object, nothing fancy, just allows values to be
-        passed back and forth by reference rather than by value.
-        Other point classes may be used as long as they have
-        x and y properties, which will get modified in the transform method.
-    */
-    function geocentricToWgs84(p, datum_type, datum_params) {
-
-      if (datum_type === PJD_3PARAM) {
-        // if( x[io] === HUGE_VAL )
-        //    continue;
-        return {
-          x: p.x + datum_params[0],
-          y: p.y + datum_params[1],
-          z: p.z + datum_params[2],
-        };
-      } else if (datum_type === PJD_7PARAM) {
-        var Dx_BF = datum_params[0];
-        var Dy_BF = datum_params[1];
-        var Dz_BF = datum_params[2];
-        var Rx_BF = datum_params[3];
-        var Ry_BF = datum_params[4];
-        var Rz_BF = datum_params[5];
-        var M_BF = datum_params[6];
-        // if( x[io] === HUGE_VAL )
-        //    continue;
-        return {
-          x: M_BF * (p.x - Rz_BF * p.y + Ry_BF * p.z) + Dx_BF,
-          y: M_BF * (Rz_BF * p.x + p.y - Rx_BF * p.z) + Dy_BF,
-          z: M_BF * (-Ry_BF * p.x + Rx_BF * p.y + p.z) + Dz_BF
-        };
-      }
-    } // cs_geocentric_to_wgs84
-
-    /****************************************************************/
-    // pj_geocentic_from_wgs84()
-    //  coordinate system definition,
-    //  point to transform in geocentric coordinates (x,y,z)
-    function geocentricFromWgs84(p, datum_type, datum_params) {
-
-      if (datum_type === PJD_3PARAM) {
-        //if( x[io] === HUGE_VAL )
-        //    continue;
-        return {
-          x: p.x - datum_params[0],
-          y: p.y - datum_params[1],
-          z: p.z - datum_params[2],
-        };
-
-      } else if (datum_type === PJD_7PARAM) {
-        var Dx_BF = datum_params[0];
-        var Dy_BF = datum_params[1];
-        var Dz_BF = datum_params[2];
-        var Rx_BF = datum_params[3];
-        var Ry_BF = datum_params[4];
-        var Rz_BF = datum_params[5];
-        var M_BF = datum_params[6];
-        var x_tmp = (p.x - Dx_BF) / M_BF;
-        var y_tmp = (p.y - Dy_BF) / M_BF;
-        var z_tmp = (p.z - Dz_BF) / M_BF;
-        //if( x[io] === HUGE_VAL )
-        //    continue;
-
-        return {
-          x: x_tmp + Rz_BF * y_tmp - Ry_BF * z_tmp,
-          y: -Rz_BF * x_tmp + y_tmp + Rx_BF * z_tmp,
-          z: Ry_BF * x_tmp - Rx_BF * y_tmp + z_tmp
-        };
-      } //cs_geocentric_from_wgs84()
-    }
-
-    function checkParams(type) {
-      return (type === PJD_3PARAM || type === PJD_7PARAM);
-    }
-
-    var datum_transform = function(source, dest, point) {
-      // Short cut if the datums are identical.
-      if (compareDatums(source, dest)) {
-        return point; // in this case, zero is sucess,
-        // whereas cs_compare_datums returns 1 to indicate TRUE
-        // confusing, should fix this
-      }
-
-      // Explicitly skip datum transform by setting 'datum=none' as parameter for either source or dest
-      if (source.datum_type === PJD_NODATUM || dest.datum_type === PJD_NODATUM) {
-        return point;
-      }
-
-      // If this datum requires grid shifts, then apply it to geodetic coordinates.
-
-      // Do we need to go through geocentric coordinates?
-      if (source.es === dest.es && source.a === dest.a && !checkParams(source.datum_type) &&  !checkParams(dest.datum_type)) {
-        return point;
-      }
-
-      // Convert to geocentric coordinates.
-      point = geodeticToGeocentric(point, source.es, source.a);
-      // Convert between datums
-      if (checkParams(source.datum_type)) {
-        point = geocentricToWgs84(point, source.datum_type, source.datum_params);
-      }
-      if (checkParams(dest.datum_type)) {
-        point = geocentricFromWgs84(point, dest.datum_type, dest.datum_params);
-      }
-      return geocentricToGeodetic(point, dest.es, dest.a, dest.b);
-
-    };
-
-    var adjust_axis = function(crs, denorm, point) {
-      var xin = point.x,
-        yin = point.y,
-        zin = point.z || 0.0;
-      var v, t, i;
-      var out = {};
-      for (i = 0; i < 3; i++) {
-        if (denorm && i === 2 && point.z === undefined) {
-          continue;
-        }
-        if (i === 0) {
-          v = xin;
-          if ("ew".indexOf(crs.axis[i]) !== -1) {
-            t = 'x';
-          } else {
-            t = 'y';
-          }
-
-        }
-        else if (i === 1) {
-          v = yin;
-          if ("ns".indexOf(crs.axis[i]) !== -1) {
-            t = 'y';
-          } else {
-            t = 'x';
-          }
-        }
-        else {
-          v = zin;
-          t = 'z';
-        }
-        switch (crs.axis[i]) {
-        case 'e':
-        case 'w':
-        case 'n':
-        case 's':
-          out[t] = v;
-          break;
-        case 'u':
-          if (point[t] !== undefined) {
-            out.z = v;
-          }
-          break;
-        case 'd':
-          if (point[t] !== undefined) {
-            out.z = -v;
-          }
-          break;
-        default:
-          //console.log("ERROR: unknow axis ("+crs.axis[i]+") - check definition of "+crs.projName);
-          return null;
-        }
-      }
-      return out;
-    };
-
-    var toPoint = function (array){
-      var out = {
-        x: array[0],
-        y: array[1]
-      };
-      if (array.length>2) {
-        out.z = array[2];
-      }
-      if (array.length>3) {
-        out.m = array[3];
-      }
-      return out;
-    };
-
-    var checkSanity = function (point) {
-      checkCoord(point.x);
-      checkCoord(point.y);
-    };
-    function checkCoord(num) {
-      if (typeof Number.isFinite === 'function') {
-        if (Number.isFinite(num)) {
-          return;
-        }
-        throw new TypeError('coordinates must be finite numbers');
-      }
-      if (typeof num !== 'number' || num !== num || !isFinite(num)) {
-        throw new TypeError('coordinates must be finite numbers');
-      }
-    }
-
-    function checkNotWGS(source, dest) {
-      return ((source.datum.datum_type === PJD_3PARAM || source.datum.datum_type === PJD_7PARAM) && dest.datumCode !== 'WGS84') || ((dest.datum.datum_type === PJD_3PARAM || dest.datum.datum_type === PJD_7PARAM) && source.datumCode !== 'WGS84');
-    }
-
-    function transform(source, dest, point) {
-      var wgs84;
-      if (Array.isArray(point)) {
-        point = toPoint(point);
-      }
-      checkSanity(point);
-      // Workaround for datum shifts towgs84, if either source or destination projection is not wgs84
-      if (source.datum && dest.datum && checkNotWGS(source, dest)) {
-        wgs84 = new Projection('WGS84');
-        point = transform(source, wgs84, point);
-        source = wgs84;
-      }
-      // DGR, 2010/11/12
-      if (source.axis !== 'enu') {
-        point = adjust_axis(source, false, point);
-      }
-      // Transform source points to long/lat, if they aren't already.
-      if (source.projName === 'longlat') {
-        point = {
-          x: point.x * D2R,
-          y: point.y * D2R,
-          z: point.z || 0
-        };
-      } else {
-        if (source.to_meter) {
-          point = {
-            x: point.x * source.to_meter,
-            y: point.y * source.to_meter,
-            z: point.z || 0
-          };
-        }
-        point = source.inverse(point); // Convert Cartesian to longlat
-        if (!point) {
-          return;
-        }
-      }
-      // Adjust for the prime meridian if necessary
-      if (source.from_greenwich) {
-        point.x += source.from_greenwich;
-      }
-
-      // Convert datums if needed, and if possible.
-      point = datum_transform(source.datum, dest.datum, point);
-
-      // Adjust for the prime meridian if necessary
-      if (dest.from_greenwich) {
-        point = {
-          x: point.x - dest.from_greenwich,
-          y: point.y,
-          z: point.z || 0
-        };
-      }
-
-      if (dest.projName === 'longlat') {
-        // convert radians to decimal degrees
-        point = {
-          x: point.x * R2D,
-          y: point.y * R2D,
-          z: point.z || 0
-        };
-      } else { // else project
-        point = dest.forward(point);
-        if (dest.to_meter) {
-          point = {
-            x: point.x / dest.to_meter,
-            y: point.y / dest.to_meter,
-            z: point.z || 0
-          };
-        }
-      }
-
-      // DGR, 2010/11/12
-      if (dest.axis !== 'enu') {
-        return adjust_axis(dest, true, point);
-      }
-
-      return point;
-    }
-
-    var wgs84 = Projection('WGS84');
-
-    function transformer(from, to, coords) {
-      var transformedArray, out, keys;
-      if (Array.isArray(coords)) {
-        transformedArray = transform(from, to, coords) || {x: NaN, y: NaN};
-        if (coords.length > 2) {
-          if ((typeof from.name !== 'undefined' && from.name === 'geocent') || (typeof to.name !== 'undefined' && to.name === 'geocent')) {
-            if (typeof transformedArray.z === 'number') {
-              return [transformedArray.x, transformedArray.y, transformedArray.z].concat(coords.splice(3));
-            } else {
-              return [transformedArray.x, transformedArray.y, coords[2]].concat(coords.splice(3));
-            }
-          } else {
-            return [transformedArray.x, transformedArray.y].concat(coords.splice(2));
-          }
-        } else {
-          return [transformedArray.x, transformedArray.y];
-        }
-      } else {
-        out = transform(from, to, coords);
-        keys = Object.keys(coords);
-        if (keys.length === 2) {
-          return out;
-        }
-        keys.forEach(function (key) {
-          if ((typeof from.name !== 'undefined' && from.name === 'geocent') || (typeof to.name !== 'undefined' && to.name === 'geocent')) {
-            if (key === 'x' || key === 'y' || key === 'z') {
-              return;
-            }
-          } else {
-            if (key === 'x' || key === 'y') {
-              return;
-            }
-          }
-          out[key] = coords[key];
-        });
-        return out;
-      }
-    }
-
-    function checkProj(item) {
-      if (item instanceof Projection) {
-        return item;
-      }
-      if (item.oProj) {
-        return item.oProj;
-      }
-      return Projection(item);
-    }
-
-    function proj4$1(fromProj, toProj, coord) {
-      fromProj = checkProj(fromProj);
-      var single = false;
-      var obj;
-      if (typeof toProj === 'undefined') {
-        toProj = fromProj;
-        fromProj = wgs84;
-        single = true;
-      } else if (typeof toProj.x !== 'undefined' || Array.isArray(toProj)) {
-        coord = toProj;
-        toProj = fromProj;
-        fromProj = wgs84;
-        single = true;
-      }
-      toProj = checkProj(toProj);
-      if (coord) {
-        return transformer(fromProj, toProj, coord);
-      } else {
-        obj = {
-          forward: function (coords) {
-            return transformer(fromProj, toProj, coords);
-          },
-          inverse: function (coords) {
-            return transformer(toProj, fromProj, coords);
-          }
-        };
-        if (single) {
-          obj.oProj = toProj;
-        }
-        return obj;
-      }
-    }
-
-    /**
-     * UTM zones are grouped, and assigned to one of a group of 6
-     * sets.
-     *
-     * {int} @private
-     */
-    var NUM_100K_SETS = 6;
-
-    /**
-     * The column letters (for easting) of the lower left value, per
-     * set.
-     *
-     * {string} @private
-     */
-    var SET_ORIGIN_COLUMN_LETTERS = 'AJSAJS';
-
-    /**
-     * The row letters (for northing) of the lower left value, per
-     * set.
-     *
-     * {string} @private
-     */
-    var SET_ORIGIN_ROW_LETTERS = 'AFAFAF';
-
-    var A = 65; // A
-    var I = 73; // I
-    var O = 79; // O
-    var V = 86; // V
-    var Z = 90; // Z
-    var mgrs = {
-      forward: forward$1,
-      inverse: inverse$1,
-      toPoint: toPoint$1
-    };
-    /**
-     * Conversion of lat/lon to MGRS.
-     *
-     * @param {object} ll Object literal with lat and lon properties on a
-     *     WGS84 ellipsoid.
-     * @param {int} accuracy Accuracy in digits (5 for 1 m, 4 for 10 m, 3 for
-     *      100 m, 2 for 1000 m or 1 for 10000 m). Optional, default is 5.
-     * @return {string} the MGRS string for the given location and accuracy.
-     */
-    function forward$1(ll, accuracy) {
-      accuracy = accuracy || 5; // default accuracy 1m
-      return encode(LLtoUTM({
-        lat: ll[1],
-        lon: ll[0]
-      }), accuracy);
-    }
-
-    /**
-     * Conversion of MGRS to lat/lon.
-     *
-     * @param {string} mgrs MGRS string.
-     * @return {array} An array with left (longitude), bottom (latitude), right
-     *     (longitude) and top (latitude) values in WGS84, representing the
-     *     bounding box for the provided MGRS reference.
-     */
-    function inverse$1(mgrs) {
-      var bbox = UTMtoLL(decode(mgrs.toUpperCase()));
-      if (bbox.lat && bbox.lon) {
-        return [bbox.lon, bbox.lat, bbox.lon, bbox.lat];
-      }
-      return [bbox.left, bbox.bottom, bbox.right, bbox.top];
-    }
-
-    function toPoint$1(mgrs) {
-      var bbox = UTMtoLL(decode(mgrs.toUpperCase()));
-      if (bbox.lat && bbox.lon) {
-        return [bbox.lon, bbox.lat];
-      }
-      return [(bbox.left + bbox.right) / 2, (bbox.top + bbox.bottom) / 2];
-    }
-    /**
-     * Conversion from degrees to radians.
-     *
-     * @private
-     * @param {number} deg the angle in degrees.
-     * @return {number} the angle in radians.
-     */
-    function degToRad(deg) {
-      return (deg * (Math.PI / 180.0));
-    }
-
-    /**
-     * Conversion from radians to degrees.
-     *
-     * @private
-     * @param {number} rad the angle in radians.
-     * @return {number} the angle in degrees.
-     */
-    function radToDeg(rad) {
-      return (180.0 * (rad / Math.PI));
-    }
-
-    /**
-     * Converts a set of Longitude and Latitude co-ordinates to UTM
-     * using the WGS84 ellipsoid.
-     *
-     * @private
-     * @param {object} ll Object literal with lat and lon properties
-     *     representing the WGS84 coordinate to be converted.
-     * @return {object} Object literal containing the UTM value with easting,
-     *     northing, zoneNumber and zoneLetter properties, and an optional
-     *     accuracy property in digits. Returns null if the conversion failed.
-     */
-    function LLtoUTM(ll) {
-      var Lat = ll.lat;
-      var Long = ll.lon;
-      var a = 6378137.0; //ellip.radius;
-      var eccSquared = 0.00669438; //ellip.eccsq;
-      var k0 = 0.9996;
-      var LongOrigin;
-      var eccPrimeSquared;
-      var N, T, C, A, M;
-      var LatRad = degToRad(Lat);
-      var LongRad = degToRad(Long);
-      var LongOriginRad;
-      var ZoneNumber;
-      // (int)
-      ZoneNumber = Math.floor((Long + 180) / 6) + 1;
-
-      //Make sure the longitude 180.00 is in Zone 60
-      if (Long === 180) {
-        ZoneNumber = 60;
-      }
-
-      // Special zone for Norway
-      if (Lat >= 56.0 && Lat < 64.0 && Long >= 3.0 && Long < 12.0) {
-        ZoneNumber = 32;
-      }
-
-      // Special zones for Svalbard
-      if (Lat >= 72.0 && Lat < 84.0) {
-        if (Long >= 0.0 && Long < 9.0) {
-          ZoneNumber = 31;
-        }
-        else if (Long >= 9.0 && Long < 21.0) {
-          ZoneNumber = 33;
-        }
-        else if (Long >= 21.0 && Long < 33.0) {
-          ZoneNumber = 35;
-        }
-        else if (Long >= 33.0 && Long < 42.0) {
-          ZoneNumber = 37;
-        }
-      }
-
-      LongOrigin = (ZoneNumber - 1) * 6 - 180 + 3; //+3 puts origin
-      // in middle of
-      // zone
-      LongOriginRad = degToRad(LongOrigin);
-
-      eccPrimeSquared = (eccSquared) / (1 - eccSquared);
-
-      N = a / Math.sqrt(1 - eccSquared * Math.sin(LatRad) * Math.sin(LatRad));
-      T = Math.tan(LatRad) * Math.tan(LatRad);
-      C = eccPrimeSquared * Math.cos(LatRad) * Math.cos(LatRad);
-      A = Math.cos(LatRad) * (LongRad - LongOriginRad);
-
-      M = a * ((1 - eccSquared / 4 - 3 * eccSquared * eccSquared / 64 - 5 * eccSquared * eccSquared * eccSquared / 256) * LatRad - (3 * eccSquared / 8 + 3 * eccSquared * eccSquared / 32 + 45 * eccSquared * eccSquared * eccSquared / 1024) * Math.sin(2 * LatRad) + (15 * eccSquared * eccSquared / 256 + 45 * eccSquared * eccSquared * eccSquared / 1024) * Math.sin(4 * LatRad) - (35 * eccSquared * eccSquared * eccSquared / 3072) * Math.sin(6 * LatRad));
-
-      var UTMEasting = (k0 * N * (A + (1 - T + C) * A * A * A / 6.0 + (5 - 18 * T + T * T + 72 * C - 58 * eccPrimeSquared) * A * A * A * A * A / 120.0) + 500000.0);
-
-      var UTMNorthing = (k0 * (M + N * Math.tan(LatRad) * (A * A / 2 + (5 - T + 9 * C + 4 * C * C) * A * A * A * A / 24.0 + (61 - 58 * T + T * T + 600 * C - 330 * eccPrimeSquared) * A * A * A * A * A * A / 720.0)));
-      if (Lat < 0.0) {
-        UTMNorthing += 10000000.0; //10000000 meter offset for
-        // southern hemisphere
-      }
-
-      return {
-        northing: Math.round(UTMNorthing),
-        easting: Math.round(UTMEasting),
-        zoneNumber: ZoneNumber,
-        zoneLetter: getLetterDesignator(Lat)
-      };
-    }
-
-    /**
-     * Converts UTM coords to lat/long, using the WGS84 ellipsoid. This is a convenience
-     * class where the Zone can be specified as a single string eg."60N" which
-     * is then broken down into the ZoneNumber and ZoneLetter.
-     *
-     * @private
-     * @param {object} utm An object literal with northing, easting, zoneNumber
-     *     and zoneLetter properties. If an optional accuracy property is
-     *     provided (in meters), a bounding box will be returned instead of
-     *     latitude and longitude.
-     * @return {object} An object literal containing either lat and lon values
-     *     (if no accuracy was provided), or top, right, bottom and left values
-     *     for the bounding box calculated according to the provided accuracy.
-     *     Returns null if the conversion failed.
-     */
-    function UTMtoLL(utm) {
-
-      var UTMNorthing = utm.northing;
-      var UTMEasting = utm.easting;
-      var zoneLetter = utm.zoneLetter;
-      var zoneNumber = utm.zoneNumber;
-      // check the ZoneNummber is valid
-      if (zoneNumber < 0 || zoneNumber > 60) {
-        return null;
-      }
-
-      var k0 = 0.9996;
-      var a = 6378137.0; //ellip.radius;
-      var eccSquared = 0.00669438; //ellip.eccsq;
-      var eccPrimeSquared;
-      var e1 = (1 - Math.sqrt(1 - eccSquared)) / (1 + Math.sqrt(1 - eccSquared));
-      var N1, T1, C1, R1, D, M;
-      var LongOrigin;
-      var mu, phi1Rad;
-
-      // remove 500,000 meter offset for longitude
-      var x = UTMEasting - 500000.0;
-      var y = UTMNorthing;
-
-      // We must know somehow if we are in the Northern or Southern
-      // hemisphere, this is the only time we use the letter So even
-      // if the Zone letter isn't exactly correct it should indicate
-      // the hemisphere correctly
-      if (zoneLetter < 'N') {
-        y -= 10000000.0; // remove 10,000,000 meter offset used
-        // for southern hemisphere
-      }
-
-      // There are 60 zones with zone 1 being at West -180 to -174
-      LongOrigin = (zoneNumber - 1) * 6 - 180 + 3; // +3 puts origin
-      // in middle of
-      // zone
-
-      eccPrimeSquared = (eccSquared) / (1 - eccSquared);
-
-      M = y / k0;
-      mu = M / (a * (1 - eccSquared / 4 - 3 * eccSquared * eccSquared / 64 - 5 * eccSquared * eccSquared * eccSquared / 256));
-
-      phi1Rad = mu + (3 * e1 / 2 - 27 * e1 * e1 * e1 / 32) * Math.sin(2 * mu) + (21 * e1 * e1 / 16 - 55 * e1 * e1 * e1 * e1 / 32) * Math.sin(4 * mu) + (151 * e1 * e1 * e1 / 96) * Math.sin(6 * mu);
-      // double phi1 = ProjMath.radToDeg(phi1Rad);
-
-      N1 = a / Math.sqrt(1 - eccSquared * Math.sin(phi1Rad) * Math.sin(phi1Rad));
-      T1 = Math.tan(phi1Rad) * Math.tan(phi1Rad);
-      C1 = eccPrimeSquared * Math.cos(phi1Rad) * Math.cos(phi1Rad);
-      R1 = a * (1 - eccSquared) / Math.pow(1 - eccSquared * Math.sin(phi1Rad) * Math.sin(phi1Rad), 1.5);
-      D = x / (N1 * k0);
-
-      var lat = phi1Rad - (N1 * Math.tan(phi1Rad) / R1) * (D * D / 2 - (5 + 3 * T1 + 10 * C1 - 4 * C1 * C1 - 9 * eccPrimeSquared) * D * D * D * D / 24 + (61 + 90 * T1 + 298 * C1 + 45 * T1 * T1 - 252 * eccPrimeSquared - 3 * C1 * C1) * D * D * D * D * D * D / 720);
-      lat = radToDeg(lat);
-
-      var lon = (D - (1 + 2 * T1 + C1) * D * D * D / 6 + (5 - 2 * C1 + 28 * T1 - 3 * C1 * C1 + 8 * eccPrimeSquared + 24 * T1 * T1) * D * D * D * D * D / 120) / Math.cos(phi1Rad);
-      lon = LongOrigin + radToDeg(lon);
-
-      var result;
-      if (utm.accuracy) {
-        var topRight = UTMtoLL({
-          northing: utm.northing + utm.accuracy,
-          easting: utm.easting + utm.accuracy,
-          zoneLetter: utm.zoneLetter,
-          zoneNumber: utm.zoneNumber
-        });
-        result = {
-          top: topRight.lat,
-          right: topRight.lon,
-          bottom: lat,
-          left: lon
-        };
-      }
-      else {
-        result = {
-          lat: lat,
-          lon: lon
-        };
-      }
-      return result;
-    }
-
-    /**
-     * Calculates the MGRS letter designator for the given latitude.
-     *
-     * @private
-     * @param {number} lat The latitude in WGS84 to get the letter designator
-     *     for.
-     * @return {char} The letter designator.
-     */
-    function getLetterDesignator(lat) {
-      //This is here as an error flag to show that the Latitude is
-      //outside MGRS limits
-      var LetterDesignator = 'Z';
-
-      if ((84 >= lat) && (lat >= 72)) {
-        LetterDesignator = 'X';
-      }
-      else if ((72 > lat) && (lat >= 64)) {
-        LetterDesignator = 'W';
-      }
-      else if ((64 > lat) && (lat >= 56)) {
-        LetterDesignator = 'V';
-      }
-      else if ((56 > lat) && (lat >= 48)) {
-        LetterDesignator = 'U';
-      }
-      else if ((48 > lat) && (lat >= 40)) {
-        LetterDesignator = 'T';
-      }
-      else if ((40 > lat) && (lat >= 32)) {
-        LetterDesignator = 'S';
-      }
-      else if ((32 > lat) && (lat >= 24)) {
-        LetterDesignator = 'R';
-      }
-      else if ((24 > lat) && (lat >= 16)) {
-        LetterDesignator = 'Q';
-      }
-      else if ((16 > lat) && (lat >= 8)) {
-        LetterDesignator = 'P';
-      }
-      else if ((8 > lat) && (lat >= 0)) {
-        LetterDesignator = 'N';
-      }
-      else if ((0 > lat) && (lat >= -8)) {
-        LetterDesignator = 'M';
-      }
-      else if ((-8 > lat) && (lat >= -16)) {
-        LetterDesignator = 'L';
-      }
-      else if ((-16 > lat) && (lat >= -24)) {
-        LetterDesignator = 'K';
-      }
-      else if ((-24 > lat) && (lat >= -32)) {
-        LetterDesignator = 'J';
-      }
-      else if ((-32 > lat) && (lat >= -40)) {
-        LetterDesignator = 'H';
-      }
-      else if ((-40 > lat) && (lat >= -48)) {
-        LetterDesignator = 'G';
-      }
-      else if ((-48 > lat) && (lat >= -56)) {
-        LetterDesignator = 'F';
-      }
-      else if ((-56 > lat) && (lat >= -64)) {
-        LetterDesignator = 'E';
-      }
-      else if ((-64 > lat) && (lat >= -72)) {
-        LetterDesignator = 'D';
-      }
-      else if ((-72 > lat) && (lat >= -80)) {
-        LetterDesignator = 'C';
-      }
-      return LetterDesignator;
-    }
-
-    /**
-     * Encodes a UTM location as MGRS string.
-     *
-     * @private
-     * @param {object} utm An object literal with easting, northing,
-     *     zoneLetter, zoneNumber
-     * @param {number} accuracy Accuracy in digits (1-5).
-     * @return {string} MGRS string for the given UTM location.
-     */
-    function encode(utm, accuracy) {
-      // prepend with leading zeroes
-      var seasting = "00000" + utm.easting,
-        snorthing = "00000" + utm.northing;
-
-      return utm.zoneNumber + utm.zoneLetter + get100kID(utm.easting, utm.northing, utm.zoneNumber) + seasting.substr(seasting.length - 5, accuracy) + snorthing.substr(snorthing.length - 5, accuracy);
-    }
-
-    /**
-     * Get the two letter 100k designator for a given UTM easting,
-     * northing and zone number value.
-     *
-     * @private
-     * @param {number} easting
-     * @param {number} northing
-     * @param {number} zoneNumber
-     * @return the two letter 100k designator for the given UTM location.
-     */
-    function get100kID(easting, northing, zoneNumber) {
-      var setParm = get100kSetForZone(zoneNumber);
-      var setColumn = Math.floor(easting / 100000);
-      var setRow = Math.floor(northing / 100000) % 20;
-      return getLetter100kID(setColumn, setRow, setParm);
-    }
-
-    /**
-     * Given a UTM zone number, figure out the MGRS 100K set it is in.
-     *
-     * @private
-     * @param {number} i An UTM zone number.
-     * @return {number} the 100k set the UTM zone is in.
-     */
-    function get100kSetForZone(i) {
-      var setParm = i % NUM_100K_SETS;
-      if (setParm === 0) {
-        setParm = NUM_100K_SETS;
-      }
-
-      return setParm;
-    }
-
-    /**
-     * Get the two-letter MGRS 100k designator given information
-     * translated from the UTM northing, easting and zone number.
-     *
-     * @private
-     * @param {number} column the column index as it relates to the MGRS
-     *        100k set spreadsheet, created from the UTM easting.
-     *        Values are 1-8.
-     * @param {number} row the row index as it relates to the MGRS 100k set
-     *        spreadsheet, created from the UTM northing value. Values
-     *        are from 0-19.
-     * @param {number} parm the set block, as it relates to the MGRS 100k set
-     *        spreadsheet, created from the UTM zone. Values are from
-     *        1-60.
-     * @return two letter MGRS 100k code.
-     */
-    function getLetter100kID(column, row, parm) {
-      // colOrigin and rowOrigin are the letters at the origin of the set
-      var index = parm - 1;
-      var colOrigin = SET_ORIGIN_COLUMN_LETTERS.charCodeAt(index);
-      var rowOrigin = SET_ORIGIN_ROW_LETTERS.charCodeAt(index);
-
-      // colInt and rowInt are the letters to build to return
-      var colInt = colOrigin + column - 1;
-      var rowInt = rowOrigin + row;
-      var rollover = false;
-
-      if (colInt > Z) {
-        colInt = colInt - Z + A - 1;
-        rollover = true;
-      }
-
-      if (colInt === I || (colOrigin < I && colInt > I) || ((colInt > I || colOrigin < I) && rollover)) {
-        colInt++;
-      }
-
-      if (colInt === O || (colOrigin < O && colInt > O) || ((colInt > O || colOrigin < O) && rollover)) {
-        colInt++;
-
-        if (colInt === I) {
-          colInt++;
-        }
-      }
-
-      if (colInt > Z) {
-        colInt = colInt - Z + A - 1;
-      }
-
-      if (rowInt > V) {
-        rowInt = rowInt - V + A - 1;
-        rollover = true;
-      }
-      else {
-        rollover = false;
-      }
-
-      if (((rowInt === I) || ((rowOrigin < I) && (rowInt > I))) || (((rowInt > I) || (rowOrigin < I)) && rollover)) {
-        rowInt++;
-      }
-
-      if (((rowInt === O) || ((rowOrigin < O) && (rowInt > O))) || (((rowInt > O) || (rowOrigin < O)) && rollover)) {
-        rowInt++;
-
-        if (rowInt === I) {
-          rowInt++;
-        }
-      }
-
-      if (rowInt > V) {
-        rowInt = rowInt - V + A - 1;
-      }
-
-      var twoLetter = String.fromCharCode(colInt) + String.fromCharCode(rowInt);
-      return twoLetter;
-    }
-
-    /**
-     * Decode the UTM parameters from a MGRS string.
-     *
-     * @private
-     * @param {string} mgrsString an UPPERCASE coordinate string is expected.
-     * @return {object} An object literal with easting, northing, zoneLetter,
-     *     zoneNumber and accuracy (in meters) properties.
-     */
-    function decode(mgrsString) {
-
-      if (mgrsString && mgrsString.length === 0) {
-        throw ("MGRSPoint coverting from nothing");
-      }
-
-      var length = mgrsString.length;
-
-      var hunK = null;
-      var sb = "";
-      var testChar;
-      var i = 0;
-
-      // get Zone number
-      while (!(/[A-Z]/).test(testChar = mgrsString.charAt(i))) {
-        if (i >= 2) {
-          throw ("MGRSPoint bad conversion from: " + mgrsString);
-        }
-        sb += testChar;
-        i++;
-      }
-
-      var zoneNumber = parseInt(sb, 10);
-
-      if (i === 0 || i + 3 > length) {
-        // A good MGRS string has to be 4-5 digits long,
-        // ##AAA/#AAA at least.
-        throw ("MGRSPoint bad conversion from: " + mgrsString);
-      }
-
-      var zoneLetter = mgrsString.charAt(i++);
-
-      // Should we check the zone letter here? Why not.
-      if (zoneLetter <= 'A' || zoneLetter === 'B' || zoneLetter === 'Y' || zoneLetter >= 'Z' || zoneLetter === 'I' || zoneLetter === 'O') {
-        throw ("MGRSPoint zone letter " + zoneLetter + " not handled: " + mgrsString);
-      }
-
-      hunK = mgrsString.substring(i, i += 2);
-
-      var set = get100kSetForZone(zoneNumber);
-
-      var east100k = getEastingFromChar(hunK.charAt(0), set);
-      var north100k = getNorthingFromChar(hunK.charAt(1), set);
-
-      // We have a bug where the northing may be 2000000 too low.
-      // How
-      // do we know when to roll over?
-
-      while (north100k < getMinNorthing(zoneLetter)) {
-        north100k += 2000000;
-      }
-
-      // calculate the char index for easting/northing separator
-      var remainder = length - i;
-
-      if (remainder % 2 !== 0) {
-        throw ("MGRSPoint has to have an even number \nof digits after the zone letter and two 100km letters - front \nhalf for easting meters, second half for \nnorthing meters" + mgrsString);
-      }
-
-      var sep = remainder / 2;
-
-      var sepEasting = 0.0;
-      var sepNorthing = 0.0;
-      var accuracyBonus, sepEastingString, sepNorthingString, easting, northing;
-      if (sep > 0) {
-        accuracyBonus = 100000.0 / Math.pow(10, sep);
-        sepEastingString = mgrsString.substring(i, i + sep);
-        sepEasting = parseFloat(sepEastingString) * accuracyBonus;
-        sepNorthingString = mgrsString.substring(i + sep);
-        sepNorthing = parseFloat(sepNorthingString) * accuracyBonus;
-      }
-
-      easting = sepEasting + east100k;
-      northing = sepNorthing + north100k;
-
-      return {
-        easting: easting,
-        northing: northing,
-        zoneLetter: zoneLetter,
-        zoneNumber: zoneNumber,
-        accuracy: accuracyBonus
-      };
-    }
-
-    /**
-     * Given the first letter from a two-letter MGRS 100k zone, and given the
-     * MGRS table set for the zone number, figure out the easting value that
-     * should be added to the other, secondary easting value.
-     *
-     * @private
-     * @param {char} e The first letter from a two-letter MGRS 100´k zone.
-     * @param {number} set The MGRS table set for the zone number.
-     * @return {number} The easting value for the given letter and set.
-     */
-    function getEastingFromChar(e, set) {
-      // colOrigin is the letter at the origin of the set for the
-      // column
-      var curCol = SET_ORIGIN_COLUMN_LETTERS.charCodeAt(set - 1);
-      var eastingValue = 100000.0;
-      var rewindMarker = false;
-
-      while (curCol !== e.charCodeAt(0)) {
-        curCol++;
-        if (curCol === I) {
-          curCol++;
-        }
-        if (curCol === O) {
-          curCol++;
-        }
-        if (curCol > Z) {
-          if (rewindMarker) {
-            throw ("Bad character: " + e);
-          }
-          curCol = A;
-          rewindMarker = true;
-        }
-        eastingValue += 100000.0;
-      }
-
-      return eastingValue;
-    }
-
-    /**
-     * Given the second letter from a two-letter MGRS 100k zone, and given the
-     * MGRS table set for the zone number, figure out the northing value that
-     * should be added to the other, secondary northing value. You have to
-     * remember that Northings are determined from the equator, and the vertical
-     * cycle of letters mean a 2000000 additional northing meters. This happens
-     * approx. every 18 degrees of latitude. This method does *NOT* count any
-     * additional northings. You have to figure out how many 2000000 meters need
-     * to be added for the zone letter of the MGRS coordinate.
-     *
-     * @private
-     * @param {char} n Second letter of the MGRS 100k zone
-     * @param {number} set The MGRS table set number, which is dependent on the
-     *     UTM zone number.
-     * @return {number} The northing value for the given letter and set.
-     */
-    function getNorthingFromChar(n, set) {
-
-      if (n > 'V') {
-        throw ("MGRSPoint given invalid Northing " + n);
-      }
-
-      // rowOrigin is the letter at the origin of the set for the
-      // column
-      var curRow = SET_ORIGIN_ROW_LETTERS.charCodeAt(set - 1);
-      var northingValue = 0.0;
-      var rewindMarker = false;
-
-      while (curRow !== n.charCodeAt(0)) {
-        curRow++;
-        if (curRow === I) {
-          curRow++;
-        }
-        if (curRow === O) {
-          curRow++;
-        }
-        // fixing a bug making whole application hang in this loop
-        // when 'n' is a wrong character
-        if (curRow > V) {
-          if (rewindMarker) { // making sure that this loop ends
-            throw ("Bad character: " + n);
-          }
-          curRow = A;
-          rewindMarker = true;
-        }
-        northingValue += 100000.0;
-      }
-
-      return northingValue;
-    }
-
-    /**
-     * The function getMinNorthing returns the minimum northing value of a MGRS
-     * zone.
-     *
-     * Ported from Geotrans' c Lattitude_Band_Value structure table.
-     *
-     * @private
-     * @param {char} zoneLetter The MGRS zone to get the min northing for.
-     * @return {number}
-     */
-    function getMinNorthing(zoneLetter) {
-      var northing;
-      switch (zoneLetter) {
-      case 'C':
-        northing = 1100000.0;
-        break;
-      case 'D':
-        northing = 2000000.0;
-        break;
-      case 'E':
-        northing = 2800000.0;
-        break;
-      case 'F':
-        northing = 3700000.0;
-        break;
-      case 'G':
-        northing = 4600000.0;
-        break;
-      case 'H':
-        northing = 5500000.0;
-        break;
-      case 'J':
-        northing = 6400000.0;
-        break;
-      case 'K':
-        northing = 7300000.0;
-        break;
-      case 'L':
-        northing = 8200000.0;
-        break;
-      case 'M':
-        northing = 9100000.0;
-        break;
-      case 'N':
-        northing = 0.0;
-        break;
-      case 'P':
-        northing = 800000.0;
-        break;
-      case 'Q':
-        northing = 1700000.0;
-        break;
-      case 'R':
-        northing = 2600000.0;
-        break;
-      case 'S':
-        northing = 3500000.0;
-        break;
-      case 'T':
-        northing = 4400000.0;
-        break;
-      case 'U':
-        northing = 5300000.0;
-        break;
-      case 'V':
-        northing = 6200000.0;
-        break;
-      case 'W':
-        northing = 7000000.0;
-        break;
-      case 'X':
-        northing = 7900000.0;
-        break;
-      default:
-        northing = -1.0;
-      }
-      if (northing >= 0.0) {
-        return northing;
-      }
-      else {
-        throw ("Invalid zone letter: " + zoneLetter);
-      }
-
-    }
-
-    function Point(x, y, z) {
-      if (!(this instanceof Point)) {
-        return new Point(x, y, z);
-      }
-      if (Array.isArray(x)) {
-        this.x = x[0];
-        this.y = x[1];
-        this.z = x[2] || 0.0;
-      } else if(typeof x === 'object') {
-        this.x = x.x;
-        this.y = x.y;
-        this.z = x.z || 0.0;
-      } else if (typeof x === 'string' && typeof y === 'undefined') {
-        var coords = x.split(',');
-        this.x = parseFloat(coords[0], 10);
-        this.y = parseFloat(coords[1], 10);
-        this.z = parseFloat(coords[2], 10) || 0.0;
-      } else {
-        this.x = x;
-        this.y = y;
-        this.z = z || 0.0;
-      }
-      console.warn('proj4.Point will be removed in version 3, use proj4.toPoint');
-    }
-
-    Point.fromMGRS = function(mgrsStr) {
-      return new Point(toPoint$1(mgrsStr));
-    };
-    Point.prototype.toMGRS = function(accuracy) {
-      return forward$1([this.x, this.y], accuracy);
-    };
-
-    var C00 = 1;
-    var C02 = 0.25;
-    var C04 = 0.046875;
-    var C06 = 0.01953125;
-    var C08 = 0.01068115234375;
-    var C22 = 0.75;
-    var C44 = 0.46875;
-    var C46 = 0.01302083333333333333;
-    var C48 = 0.00712076822916666666;
-    var C66 = 0.36458333333333333333;
-    var C68 = 0.00569661458333333333;
-    var C88 = 0.3076171875;
-
-    var pj_enfn = function(es) {
-      var en = [];
-      en[0] = C00 - es * (C02 + es * (C04 + es * (C06 + es * C08)));
-      en[1] = es * (C22 - es * (C04 + es * (C06 + es * C08)));
-      var t = es * es;
-      en[2] = t * (C44 - es * (C46 + es * C48));
-      t *= es;
-      en[3] = t * (C66 - es * C68);
-      en[4] = t * es * C88;
-      return en;
-    };
-
-    var pj_mlfn = function(phi, sphi, cphi, en) {
-      cphi *= sphi;
-      sphi *= sphi;
-      return (en[0] * phi - cphi * (en[1] + sphi * (en[2] + sphi * (en[3] + sphi * en[4]))));
-    };
-
-    var MAX_ITER = 20;
-
-    var pj_inv_mlfn = function(arg, es, en) {
-      var k = 1 / (1 - es);
-      var phi = arg;
-      for (var i = MAX_ITER; i; --i) { /* rarely goes over 2 iterations */
-        var s = Math.sin(phi);
-        var t = 1 - es * s * s;
-        //t = this.pj_mlfn(phi, s, Math.cos(phi), en) - arg;
-        //phi -= t * (t * Math.sqrt(t)) * k;
-        t = (pj_mlfn(phi, s, Math.cos(phi), en) - arg) * (t * Math.sqrt(t)) * k;
-        phi -= t;
-        if (Math.abs(t) < EPSLN) {
-          return phi;
-        }
-      }
-      //..reportError("cass:pj_inv_mlfn: Convergence error");
-      return phi;
-    };
-
-    // Heavily based on this tmerc projection implementation
-    // https://github.com/mbloch/mapshaper-proj/blob/master/src/projections/tmerc.js
-
-    function init$2() {
-      this.x0 = this.x0 !== undefined ? this.x0 : 0;
-      this.y0 = this.y0 !== undefined ? this.y0 : 0;
-      this.long0 = this.long0 !== undefined ? this.long0 : 0;
-      this.lat0 = this.lat0 !== undefined ? this.lat0 : 0;
-
-      if (this.es) {
-        this.en = pj_enfn(this.es);
-        this.ml0 = pj_mlfn(this.lat0, Math.sin(this.lat0), Math.cos(this.lat0), this.en);
-      }
-    }
-
-    /**
-        Transverse Mercator Forward  - long/lat to x/y
-        long/lat in radians
-      */
-    function forward$2(p) {
-      var lon = p.x;
-      var lat = p.y;
-
-      var delta_lon = adjust_lon(lon - this.long0);
-      var con;
-      var x, y;
-      var sin_phi = Math.sin(lat);
-      var cos_phi = Math.cos(lat);
-
-      if (!this.es) {
-        var b = cos_phi * Math.sin(delta_lon);
-
-        if ((Math.abs(Math.abs(b) - 1)) < EPSLN) {
-          return (93);
-        }
-        else {
-          x = 0.5 * this.a * this.k0 * Math.log((1 + b) / (1 - b)) + this.x0;
-          y = cos_phi * Math.cos(delta_lon) / Math.sqrt(1 - Math.pow(b, 2));
-          b = Math.abs(y);
-
-          if (b >= 1) {
-            if ((b - 1) > EPSLN) {
-              return (93);
-            }
-            else {
-              y = 0;
-            }
-          }
-          else {
-            y = Math.acos(y);
-          }
-
-          if (lat < 0) {
-            y = -y;
-          }
-
-          y = this.a * this.k0 * (y - this.lat0) + this.y0;
-        }
-      }
-      else {
-        var al = cos_phi * delta_lon;
-        var als = Math.pow(al, 2);
-        var c = this.ep2 * Math.pow(cos_phi, 2);
-        var cs = Math.pow(c, 2);
-        var tq = Math.abs(cos_phi) > EPSLN ? Math.tan(lat) : 0;
-        var t = Math.pow(tq, 2);
-        var ts = Math.pow(t, 2);
-        con = 1 - this.es * Math.pow(sin_phi, 2);
-        al = al / Math.sqrt(con);
-        var ml = pj_mlfn(lat, sin_phi, cos_phi, this.en);
-
-        x = this.a * (this.k0 * al * (1 +
-          als / 6 * (1 - t + c +
-          als / 20 * (5 - 18 * t + ts + 14 * c - 58 * t * c +
-          als / 42 * (61 + 179 * ts - ts * t - 479 * t))))) +
-          this.x0;
-
-        y = this.a * (this.k0 * (ml - this.ml0 +
-          sin_phi * delta_lon * al / 2 * (1 +
-          als / 12 * (5 - t + 9 * c + 4 * cs +
-          als / 30 * (61 + ts - 58 * t + 270 * c - 330 * t * c +
-          als / 56 * (1385 + 543 * ts - ts * t - 3111 * t)))))) +
-          this.y0;
-      }
-
-      p.x = x;
-      p.y = y;
-
-      return p;
-    }
-
-    /**
-        Transverse Mercator Inverse  -  x/y to long/lat
-      */
-    function inverse$2(p) {
-      var con, phi;
-      var lat, lon;
-      var x = (p.x - this.x0) * (1 / this.a);
-      var y = (p.y - this.y0) * (1 / this.a);
-
-      if (!this.es) {
-        var f = Math.exp(x / this.k0);
-        var g = 0.5 * (f - 1 / f);
-        var temp = this.lat0 + y / this.k0;
-        var h = Math.cos(temp);
-        con = Math.sqrt((1 - Math.pow(h, 2)) / (1 + Math.pow(g, 2)));
-        lat = Math.asin(con);
-
-        if (y < 0) {
-          lat = -lat;
-        }
-
-        if ((g === 0) && (h === 0)) {
-          lon = 0;
-        }
-        else {
-          lon = adjust_lon(Math.atan2(g, h) + this.long0);
-        }
-      }
-      else { // ellipsoidal form
-        con = this.ml0 + y / this.k0;
-        phi = pj_inv_mlfn(con, this.es, this.en);
-
-        if (Math.abs(phi) < HALF_PI) {
-          var sin_phi = Math.sin(phi);
-          var cos_phi = Math.cos(phi);
-          var tan_phi = Math.abs(cos_phi) > EPSLN ? Math.tan(phi) : 0;
-          var c = this.ep2 * Math.pow(cos_phi, 2);
-          var cs = Math.pow(c, 2);
-          var t = Math.pow(tan_phi, 2);
-          var ts = Math.pow(t, 2);
-          con = 1 - this.es * Math.pow(sin_phi, 2);
-          var d = x * Math.sqrt(con) / this.k0;
-          var ds = Math.pow(d, 2);
-          con = con * tan_phi;
-
-          lat = phi - (con * ds / (1 - this.es)) * 0.5 * (1 -
-            ds / 12 * (5 + 3 * t - 9 * c * t + c - 4 * cs -
-            ds / 30 * (61 + 90 * t - 252 * c * t + 45 * ts + 46 * c -
-            ds / 56 * (1385 + 3633 * t + 4095 * ts + 1574 * ts * t))));
-
-          lon = adjust_lon(this.long0 + (d * (1 -
-            ds / 6 * (1 + 2 * t + c -
-            ds / 20 * (5 + 28 * t + 24 * ts + 8 * c * t + 6 * c -
-            ds / 42 * (61 + 662 * t + 1320 * ts + 720 * ts * t)))) / cos_phi));
-        }
-        else {
-          lat = HALF_PI * sign(y);
-          lon = 0;
-        }
-      }
-
-      p.x = lon;
-      p.y = lat;
-
-      return p;
-    }
-
-    var names$3 = ["Transverse_Mercator", "Transverse Mercator", "tmerc"];
-    var tmerc = {
-      init: init$2,
-      forward: forward$2,
-      inverse: inverse$2,
-      names: names$3
-    };
-
-    var sinh = function(x) {
-      var r = Math.exp(x);
-      r = (r - 1 / r) / 2;
-      return r;
-    };
-
-    var hypot = function(x, y) {
-      x = Math.abs(x);
-      y = Math.abs(y);
-      var a = Math.max(x, y);
-      var b = Math.min(x, y) / (a ? a : 1);
-
-      return a * Math.sqrt(1 + Math.pow(b, 2));
-    };
-
-    var log1py = function(x) {
-      var y = 1 + x;
-      var z = y - 1;
-
-      return z === 0 ? x : x * Math.log(y) / z;
-    };
-
-    var asinhy = function(x) {
-      var y = Math.abs(x);
-      y = log1py(y * (1 + y / (hypot(1, y) + 1)));
-
-      return x < 0 ? -y : y;
-    };
-
-    var gatg = function(pp, B) {
-      var cos_2B = 2 * Math.cos(2 * B);
-      var i = pp.length - 1;
-      var h1 = pp[i];
-      var h2 = 0;
-      var h;
-
-      while (--i >= 0) {
-        h = -h2 + cos_2B * h1 + pp[i];
-        h2 = h1;
-        h1 = h;
-      }
-
-      return (B + h * Math.sin(2 * B));
-    };
-
-    var clens = function(pp, arg_r) {
-      var r = 2 * Math.cos(arg_r);
-      var i = pp.length - 1;
-      var hr1 = pp[i];
-      var hr2 = 0;
-      var hr;
-
-      while (--i >= 0) {
-        hr = -hr2 + r * hr1 + pp[i];
-        hr2 = hr1;
-        hr1 = hr;
-      }
-
-      return Math.sin(arg_r) * hr;
-    };
-
-    var cosh = function(x) {
-      var r = Math.exp(x);
-      r = (r + 1 / r) / 2;
-      return r;
-    };
-
-    var clens_cmplx = function(pp, arg_r, arg_i) {
-      var sin_arg_r = Math.sin(arg_r);
-      var cos_arg_r = Math.cos(arg_r);
-      var sinh_arg_i = sinh(arg_i);
-      var cosh_arg_i = cosh(arg_i);
-      var r = 2 * cos_arg_r * cosh_arg_i;
-      var i = -2 * sin_arg_r * sinh_arg_i;
-      var j = pp.length - 1;
-      var hr = pp[j];
-      var hi1 = 0;
-      var hr1 = 0;
-      var hi = 0;
-      var hr2;
-      var hi2;
-
-      while (--j >= 0) {
-        hr2 = hr1;
-        hi2 = hi1;
-        hr1 = hr;
-        hi1 = hi;
-        hr = -hr2 + r * hr1 - i * hi1 + pp[j];
-        hi = -hi2 + i * hr1 + r * hi1;
-      }
-
-      r = sin_arg_r * cosh_arg_i;
-      i = cos_arg_r * sinh_arg_i;
-
-      return [r * hr - i * hi, r * hi + i * hr];
-    };
-
-    // Heavily based on this etmerc projection implementation
-    // https://github.com/mbloch/mapshaper-proj/blob/master/src/projections/etmerc.js
-
-    function init$3() {
-      if (this.es === undefined || this.es <= 0) {
-        throw new Error('incorrect elliptical usage');
-      }
-
-      this.x0 = this.x0 !== undefined ? this.x0 : 0;
-      this.y0 = this.y0 !== undefined ? this.y0 : 0;
-      this.long0 = this.long0 !== undefined ? this.long0 : 0;
-      this.lat0 = this.lat0 !== undefined ? this.lat0 : 0;
-
-      this.cgb = [];
-      this.cbg = [];
-      this.utg = [];
-      this.gtu = [];
-
-      var f = this.es / (1 + Math.sqrt(1 - this.es));
-      var n = f / (2 - f);
-      var np = n;
-
-      this.cgb[0] = n * (2 + n * (-2 / 3 + n * (-2 + n * (116 / 45 + n * (26 / 45 + n * (-2854 / 675 ))))));
-      this.cbg[0] = n * (-2 + n * ( 2 / 3 + n * ( 4 / 3 + n * (-82 / 45 + n * (32 / 45 + n * (4642 / 4725))))));
-
-      np = np * n;
-      this.cgb[1] = np * (7 / 3 + n * (-8 / 5 + n * (-227 / 45 + n * (2704 / 315 + n * (2323 / 945)))));
-      this.cbg[1] = np * (5 / 3 + n * (-16 / 15 + n * ( -13 / 9 + n * (904 / 315 + n * (-1522 / 945)))));
-
-      np = np * n;
-      this.cgb[2] = np * (56 / 15 + n * (-136 / 35 + n * (-1262 / 105 + n * (73814 / 2835))));
-      this.cbg[2] = np * (-26 / 15 + n * (34 / 21 + n * (8 / 5 + n * (-12686 / 2835))));
-
-      np = np * n;
-      this.cgb[3] = np * (4279 / 630 + n * (-332 / 35 + n * (-399572 / 14175)));
-      this.cbg[3] = np * (1237 / 630 + n * (-12 / 5 + n * ( -24832 / 14175)));
-
-      np = np * n;
-      this.cgb[4] = np * (4174 / 315 + n * (-144838 / 6237));
-      this.cbg[4] = np * (-734 / 315 + n * (109598 / 31185));
-
-      np = np * n;
-      this.cgb[5] = np * (601676 / 22275);
-      this.cbg[5] = np * (444337 / 155925);
-
-      np = Math.pow(n, 2);
-      this.Qn = this.k0 / (1 + n) * (1 + np * (1 / 4 + np * (1 / 64 + np / 256)));
-
-      this.utg[0] = n * (-0.5 + n * ( 2 / 3 + n * (-37 / 96 + n * ( 1 / 360 + n * (81 / 512 + n * (-96199 / 604800))))));
-      this.gtu[0] = n * (0.5 + n * (-2 / 3 + n * (5 / 16 + n * (41 / 180 + n * (-127 / 288 + n * (7891 / 37800))))));
-
-      this.utg[1] = np * (-1 / 48 + n * (-1 / 15 + n * (437 / 1440 + n * (-46 / 105 + n * (1118711 / 3870720)))));
-      this.gtu[1] = np * (13 / 48 + n * (-3 / 5 + n * (557 / 1440 + n * (281 / 630 + n * (-1983433 / 1935360)))));
-
-      np = np * n;
-      this.utg[2] = np * (-17 / 480 + n * (37 / 840 + n * (209 / 4480 + n * (-5569 / 90720 ))));
-      this.gtu[2] = np * (61 / 240 + n * (-103 / 140 + n * (15061 / 26880 + n * (167603 / 181440))));
-
-      np = np * n;
-      this.utg[3] = np * (-4397 / 161280 + n * (11 / 504 + n * (830251 / 7257600)));
-      this.gtu[3] = np * (49561 / 161280 + n * (-179 / 168 + n * (6601661 / 7257600)));
-
-      np = np * n;
-      this.utg[4] = np * (-4583 / 161280 + n * (108847 / 3991680));
-      this.gtu[4] = np * (34729 / 80640 + n * (-3418889 / 1995840));
-
-      np = np * n;
-      this.utg[5] = np * (-20648693 / 638668800);
-      this.gtu[5] = np * (212378941 / 319334400);
-
-      var Z = gatg(this.cbg, this.lat0);
-      this.Zb = -this.Qn * (Z + clens(this.gtu, 2 * Z));
-    }
-
-    function forward$3(p) {
-      var Ce = adjust_lon(p.x - this.long0);
-      var Cn = p.y;
-
-      Cn = gatg(this.cbg, Cn);
-      var sin_Cn = Math.sin(Cn);
-      var cos_Cn = Math.cos(Cn);
-      var sin_Ce = Math.sin(Ce);
-      var cos_Ce = Math.cos(Ce);
-
-      Cn = Math.atan2(sin_Cn, cos_Ce * cos_Cn);
-      Ce = Math.atan2(sin_Ce * cos_Cn, hypot(sin_Cn, cos_Cn * cos_Ce));
-      Ce = asinhy(Math.tan(Ce));
-
-      var tmp = clens_cmplx(this.gtu, 2 * Cn, 2 * Ce);
-
-      Cn = Cn + tmp[0];
-      Ce = Ce + tmp[1];
-
-      var x;
-      var y;
-
-      if (Math.abs(Ce) <= 2.623395162778) {
-        x = this.a * (this.Qn * Ce) + this.x0;
-        y = this.a * (this.Qn * Cn + this.Zb) + this.y0;
-      }
-      else {
-        x = Infinity;
-        y = Infinity;
-      }
-
-      p.x = x;
-      p.y = y;
-
-      return p;
-    }
-
-    function inverse$3(p) {
-      var Ce = (p.x - this.x0) * (1 / this.a);
-      var Cn = (p.y - this.y0) * (1 / this.a);
-
-      Cn = (Cn - this.Zb) / this.Qn;
-      Ce = Ce / this.Qn;
-
-      var lon;
-      var lat;
-
-      if (Math.abs(Ce) <= 2.623395162778) {
-        var tmp = clens_cmplx(this.utg, 2 * Cn, 2 * Ce);
-
-        Cn = Cn + tmp[0];
-        Ce = Ce + tmp[1];
-        Ce = Math.atan(sinh(Ce));
-
-        var sin_Cn = Math.sin(Cn);
-        var cos_Cn = Math.cos(Cn);
-        var sin_Ce = Math.sin(Ce);
-        var cos_Ce = Math.cos(Ce);
-
-        Cn = Math.atan2(sin_Cn * cos_Ce, hypot(sin_Ce, cos_Ce * cos_Cn));
-        Ce = Math.atan2(sin_Ce, cos_Ce * cos_Cn);
-
-        lon = adjust_lon(Ce + this.long0);
-        lat = gatg(this.cgb, Cn);
-      }
-      else {
-        lon = Infinity;
-        lat = Infinity;
-      }
-
-      p.x = lon;
-      p.y = lat;
-
-      return p;
-    }
-
-    var names$4 = ["Extended_Transverse_Mercator", "Extended Transverse Mercator", "etmerc"];
-    var etmerc = {
-      init: init$3,
-      forward: forward$3,
-      inverse: inverse$3,
-      names: names$4
-    };
-
-    var adjust_zone = function(zone, lon) {
-      if (zone === undefined) {
-        zone = Math.floor((adjust_lon(lon) + Math.PI) * 30 / Math.PI) + 1;
-
-        if (zone < 0) {
-          return 0;
-        } else if (zone > 60) {
-          return 60;
-        }
-      }
-      return zone;
-    };
-
-    var dependsOn = 'etmerc';
-    function init$4() {
-      var zone = adjust_zone(this.zone, this.long0);
-      if (zone === undefined) {
-        throw new Error('unknown utm zone');
-      }
-      this.lat0 = 0;
-      this.long0 =  ((6 * Math.abs(zone)) - 183) * D2R;
-      this.x0 = 500000;
-      this.y0 = this.utmSouth ? 10000000 : 0;
-      this.k0 = 0.9996;
-
-      etmerc.init.apply(this);
-      this.forward = etmerc.forward;
-      this.inverse = etmerc.inverse;
-    }
-
-    var names$5 = ["Universal Transverse Mercator System", "utm"];
-    var utm = {
-      init: init$4,
-      names: names$5,
-      dependsOn: dependsOn
-    };
-
-    var srat = function(esinp, exp) {
-      return (Math.pow((1 - esinp) / (1 + esinp), exp));
-    };
-
-    var MAX_ITER$1 = 20;
-    function init$6() {
-      var sphi = Math.sin(this.lat0);
-      var cphi = Math.cos(this.lat0);
-      cphi *= cphi;
-      this.rc = Math.sqrt(1 - this.es) / (1 - this.es * sphi * sphi);
-      this.C = Math.sqrt(1 + this.es * cphi * cphi / (1 - this.es));
-      this.phic0 = Math.asin(sphi / this.C);
-      this.ratexp = 0.5 * this.C * this.e;
-      this.K = Math.tan(0.5 * this.phic0 + FORTPI) / (Math.pow(Math.tan(0.5 * this.lat0 + FORTPI), this.C) * srat(this.e * sphi, this.ratexp));
-    }
-
-    function forward$5(p) {
-      var lon = p.x;
-      var lat = p.y;
-
-      p.y = 2 * Math.atan(this.K * Math.pow(Math.tan(0.5 * lat + FORTPI), this.C) * srat(this.e * Math.sin(lat), this.ratexp)) - HALF_PI;
-      p.x = this.C * lon;
-      return p;
-    }
-
-    function inverse$5(p) {
-      var DEL_TOL = 1e-14;
-      var lon = p.x / this.C;
-      var lat = p.y;
-      var num = Math.pow(Math.tan(0.5 * lat + FORTPI) / this.K, 1 / this.C);
-      for (var i = MAX_ITER$1; i > 0; --i) {
-        lat = 2 * Math.atan(num * srat(this.e * Math.sin(p.y), - 0.5 * this.e)) - HALF_PI;
-        if (Math.abs(lat - p.y) < DEL_TOL) {
-          break;
-        }
-        p.y = lat;
-      }
-      /* convergence failed */
-      if (!i) {
-        return null;
-      }
-      p.x = lon;
-      p.y = lat;
-      return p;
-    }
-
-    var names$7 = ["gauss"];
-    var gauss = {
-      init: init$6,
-      forward: forward$5,
-      inverse: inverse$5,
-      names: names$7
-    };
-
-    function init$5() {
-      gauss.init.apply(this);
-      if (!this.rc) {
-        return;
-      }
-      this.sinc0 = Math.sin(this.phic0);
-      this.cosc0 = Math.cos(this.phic0);
-      this.R2 = 2 * this.rc;
-      if (!this.title) {
-        this.title = "Oblique Stereographic Alternative";
-      }
-    }
-
-    function forward$4(p) {
-      var sinc, cosc, cosl, k;
-      p.x = adjust_lon(p.x - this.long0);
-      gauss.forward.apply(this, [p]);
-      sinc = Math.sin(p.y);
-      cosc = Math.cos(p.y);
-      cosl = Math.cos(p.x);
-      k = this.k0 * this.R2 / (1 + this.sinc0 * sinc + this.cosc0 * cosc * cosl);
-      p.x = k * cosc * Math.sin(p.x);
-      p.y = k * (this.cosc0 * sinc - this.sinc0 * cosc * cosl);
-      p.x = this.a * p.x + this.x0;
-      p.y = this.a * p.y + this.y0;
-      return p;
-    }
-
-    function inverse$4(p) {
-      var sinc, cosc, lon, lat, rho;
-      p.x = (p.x - this.x0) / this.a;
-      p.y = (p.y - this.y0) / this.a;
-
-      p.x /= this.k0;
-      p.y /= this.k0;
-      if ((rho = Math.sqrt(p.x * p.x + p.y * p.y))) {
-        var c = 2 * Math.atan2(rho, this.R2);
-        sinc = Math.sin(c);
-        cosc = Math.cos(c);
-        lat = Math.asin(cosc * this.sinc0 + p.y * sinc * this.cosc0 / rho);
-        lon = Math.atan2(p.x * sinc, rho * this.cosc0 * cosc - p.y * this.sinc0 * sinc);
-      }
-      else {
-        lat = this.phic0;
-        lon = 0;
-      }
-
-      p.x = lon;
-      p.y = lat;
-      gauss.inverse.apply(this, [p]);
-      p.x = adjust_lon(p.x + this.long0);
-      return p;
-    }
-
-    var names$6 = ["Stereographic_North_Pole", "Oblique_Stereographic", "Polar_Stereographic", "sterea","Oblique Stereographic Alternative","Double_Stereographic"];
-    var sterea = {
-      init: init$5,
-      forward: forward$4,
-      inverse: inverse$4,
-      names: names$6
-    };
-
-    function ssfn_(phit, sinphi, eccen) {
-      sinphi *= eccen;
-      return (Math.tan(0.5 * (HALF_PI + phit)) * Math.pow((1 - sinphi) / (1 + sinphi), 0.5 * eccen));
-    }
-
-    function init$7() {
-      this.coslat0 = Math.cos(this.lat0);
-      this.sinlat0 = Math.sin(this.lat0);
-      if (this.sphere) {
-        if (this.k0 === 1 && !isNaN(this.lat_ts) && Math.abs(this.coslat0) <= EPSLN) {
-          this.k0 = 0.5 * (1 + sign(this.lat0) * Math.sin(this.lat_ts));
-        }
-      }
-      else {
-        if (Math.abs(this.coslat0) <= EPSLN) {
-          if (this.lat0 > 0) {
-            //North pole
-            //trace('stere:north pole');
-            this.con = 1;
-          }
-          else {
-            //South pole
-            //trace('stere:south pole');
-            this.con = -1;
-          }
-        }
-        this.cons = Math.sqrt(Math.pow(1 + this.e, 1 + this.e) * Math.pow(1 - this.e, 1 - this.e));
-        if (this.k0 === 1 && !isNaN(this.lat_ts) && Math.abs(this.coslat0) <= EPSLN) {
-          this.k0 = 0.5 * this.cons * msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts)) / tsfnz(this.e, this.con * this.lat_ts, this.con * Math.sin(this.lat_ts));
-        }
-        this.ms1 = msfnz(this.e, this.sinlat0, this.coslat0);
-        this.X0 = 2 * Math.atan(this.ssfn_(this.lat0, this.sinlat0, this.e)) - HALF_PI;
-        this.cosX0 = Math.cos(this.X0);
-        this.sinX0 = Math.sin(this.X0);
-      }
-    }
-
-    // Stereographic forward equations--mapping lat,long to x,y
-    function forward$6(p) {
-      var lon = p.x;
-      var lat = p.y;
-      var sinlat = Math.sin(lat);
-      var coslat = Math.cos(lat);
-      var A, X, sinX, cosX, ts, rh;
-      var dlon = adjust_lon(lon - this.long0);
-
-      if (Math.abs(Math.abs(lon - this.long0) - Math.PI) <= EPSLN && Math.abs(lat + this.lat0) <= EPSLN) {
-        //case of the origine point
-        //trace('stere:this is the origin point');
-        p.x = NaN;
-        p.y = NaN;
-        return p;
-      }
-      if (this.sphere) {
-        //trace('stere:sphere case');
-        A = 2 * this.k0 / (1 + this.sinlat0 * sinlat + this.coslat0 * coslat * Math.cos(dlon));
-        p.x = this.a * A * coslat * Math.sin(dlon) + this.x0;
-        p.y = this.a * A * (this.coslat0 * sinlat - this.sinlat0 * coslat * Math.cos(dlon)) + this.y0;
-        return p;
-      }
-      else {
-        X = 2 * Math.atan(this.ssfn_(lat, sinlat, this.e)) - HALF_PI;
-        cosX = Math.cos(X);
-        sinX = Math.sin(X);
-        if (Math.abs(this.coslat0) <= EPSLN) {
-          ts = tsfnz(this.e, lat * this.con, this.con * sinlat);
-          rh = 2 * this.a * this.k0 * ts / this.cons;
-          p.x = this.x0 + rh * Math.sin(lon - this.long0);
-          p.y = this.y0 - this.con * rh * Math.cos(lon - this.long0);
-          //trace(p.toString());
-          return p;
-        }
-        else if (Math.abs(this.sinlat0) < EPSLN) {
-          //Eq
-          //trace('stere:equateur');
-          A = 2 * this.a * this.k0 / (1 + cosX * Math.cos(dlon));
-          p.y = A * sinX;
-        }
-        else {
-          //other case
-          //trace('stere:normal case');
-          A = 2 * this.a * this.k0 * this.ms1 / (this.cosX0 * (1 + this.sinX0 * sinX + this.cosX0 * cosX * Math.cos(dlon)));
-          p.y = A * (this.cosX0 * sinX - this.sinX0 * cosX * Math.cos(dlon)) + this.y0;
-        }
-        p.x = A * cosX * Math.sin(dlon) + this.x0;
-      }
-      //trace(p.toString());
-      return p;
-    }
-
-    //* Stereographic inverse equations--mapping x,y to lat/long
-    function inverse$6(p) {
-      p.x -= this.x0;
-      p.y -= this.y0;
-      var lon, lat, ts, ce, Chi;
-      var rh = Math.sqrt(p.x * p.x + p.y * p.y);
-      if (this.sphere) {
-        var c = 2 * Math.atan(rh / (2 * this.a * this.k0));
-        lon = this.long0;
-        lat = this.lat0;
-        if (rh <= EPSLN) {
-          p.x = lon;
-          p.y = lat;
-          return p;
-        }
-        lat = Math.asin(Math.cos(c) * this.sinlat0 + p.y * Math.sin(c) * this.coslat0 / rh);
-        if (Math.abs(this.coslat0) < EPSLN) {
-          if (this.lat0 > 0) {
-            lon = adjust_lon(this.long0 + Math.atan2(p.x, - 1 * p.y));
-          }
-          else {
-            lon = adjust_lon(this.long0 + Math.atan2(p.x, p.y));
-          }
-        }
-        else {
-          lon = adjust_lon(this.long0 + Math.atan2(p.x * Math.sin(c), rh * this.coslat0 * Math.cos(c) - p.y * this.sinlat0 * Math.sin(c)));
-        }
-        p.x = lon;
-        p.y = lat;
-        return p;
-      }
-      else {
-        if (Math.abs(this.coslat0) <= EPSLN) {
-          if (rh <= EPSLN) {
-            lat = this.lat0;
-            lon = this.long0;
-            p.x = lon;
-            p.y = lat;
-            //trace(p.toString());
-            return p;
-          }
-          p.x *= this.con;
-          p.y *= this.con;
-          ts = rh * this.cons / (2 * this.a * this.k0);
-          lat = this.con * phi2z(this.e, ts);
-          lon = this.con * adjust_lon(this.con * this.long0 + Math.atan2(p.x, - 1 * p.y));
-        }
-        else {
-          ce = 2 * Math.atan(rh * this.cosX0 / (2 * this.a * this.k0 * this.ms1));
-          lon = this.long0;
-          if (rh <= EPSLN) {
-            Chi = this.X0;
-          }
-          else {
-            Chi = Math.asin(Math.cos(ce) * this.sinX0 + p.y * Math.sin(ce) * this.cosX0 / rh);
-            lon = adjust_lon(this.long0 + Math.atan2(p.x * Math.sin(ce), rh * this.cosX0 * Math.cos(ce) - p.y * this.sinX0 * Math.sin(ce)));
-          }
-          lat = -1 * phi2z(this.e, Math.tan(0.5 * (HALF_PI + Chi)));
-        }
-      }
-      p.x = lon;
-      p.y = lat;
-
-      //trace(p.toString());
-      return p;
-
-    }
-
-    var names$8 = ["stere", "Stereographic_South_Pole", "Polar Stereographic (variant B)"];
-    var stere = {
-      init: init$7,
-      forward: forward$6,
-      inverse: inverse$6,
-      names: names$8,
-      ssfn_: ssfn_
-    };
-
-    /*
-      references:
-        Formules et constantes pour le Calcul pour la
-        projection cylindrique conforme à axe oblique et pour la transformation entre
-        des systèmes de référence.
-        http://www.swisstopo.admin.ch/internet/swisstopo/fr/home/topics/survey/sys/refsys/switzerland.parsysrelated1.31216.downloadList.77004.DownloadFile.tmp/swissprojectionfr.pdf
-      */
-
-    function init$8() {
-      var phy0 = this.lat0;
-      this.lambda0 = this.long0;
-      var sinPhy0 = Math.sin(phy0);
-      var semiMajorAxis = this.a;
-      var invF = this.rf;
-      var flattening = 1 / invF;
-      var e2 = 2 * flattening - Math.pow(flattening, 2);
-      var e = this.e = Math.sqrt(e2);
-      this.R = this.k0 * semiMajorAxis * Math.sqrt(1 - e2) / (1 - e2 * Math.pow(sinPhy0, 2));
-      this.alpha = Math.sqrt(1 + e2 / (1 - e2) * Math.pow(Math.cos(phy0), 4));
-      this.b0 = Math.asin(sinPhy0 / this.alpha);
-      var k1 = Math.log(Math.tan(Math.PI / 4 + this.b0 / 2));
-      var k2 = Math.log(Math.tan(Math.PI / 4 + phy0 / 2));
-      var k3 = Math.log((1 + e * sinPhy0) / (1 - e * sinPhy0));
-      this.K = k1 - this.alpha * k2 + this.alpha * e / 2 * k3;
-    }
-
-    function forward$7(p) {
-      var Sa1 = Math.log(Math.tan(Math.PI / 4 - p.y / 2));
-      var Sa2 = this.e / 2 * Math.log((1 + this.e * Math.sin(p.y)) / (1 - this.e * Math.sin(p.y)));
-      var S = -this.alpha * (Sa1 + Sa2) + this.K;
-
-      // spheric latitude
-      var b = 2 * (Math.atan(Math.exp(S)) - Math.PI / 4);
-
-      // spheric longitude
-      var I = this.alpha * (p.x - this.lambda0);
-
-      // psoeudo equatorial rotation
-      var rotI = Math.atan(Math.sin(I) / (Math.sin(this.b0) * Math.tan(b) + Math.cos(this.b0) * Math.cos(I)));
-
-      var rotB = Math.asin(Math.cos(this.b0) * Math.sin(b) - Math.sin(this.b0) * Math.cos(b) * Math.cos(I));
-
-      p.y = this.R / 2 * Math.log((1 + Math.sin(rotB)) / (1 - Math.sin(rotB))) + this.y0;
-      p.x = this.R * rotI + this.x0;
-      return p;
-    }
-
-    function inverse$7(p) {
-      var Y = p.x - this.x0;
-      var X = p.y - this.y0;
-
-      var rotI = Y / this.R;
-      var rotB = 2 * (Math.atan(Math.exp(X / this.R)) - Math.PI / 4);
-
-      var b = Math.asin(Math.cos(this.b0) * Math.sin(rotB) + Math.sin(this.b0) * Math.cos(rotB) * Math.cos(rotI));
-      var I = Math.atan(Math.sin(rotI) / (Math.cos(this.b0) * Math.cos(rotI) - Math.sin(this.b0) * Math.tan(rotB)));
-
-      var lambda = this.lambda0 + I / this.alpha;
-
-      var S = 0;
-      var phy = b;
-      var prevPhy = -1000;
-      var iteration = 0;
-      while (Math.abs(phy - prevPhy) > 0.0000001) {
-        if (++iteration > 20) {
-          //...reportError("omercFwdInfinity");
-          return;
-        }
-        //S = Math.log(Math.tan(Math.PI / 4 + phy / 2));
-        S = 1 / this.alpha * (Math.log(Math.tan(Math.PI / 4 + b / 2)) - this.K) + this.e * Math.log(Math.tan(Math.PI / 4 + Math.asin(this.e * Math.sin(phy)) / 2));
-        prevPhy = phy;
-        phy = 2 * Math.atan(Math.exp(S)) - Math.PI / 2;
-      }
-
-      p.x = lambda;
-      p.y = phy;
-      return p;
-    }
-
-    var names$9 = ["somerc"];
-    var somerc = {
-      init: init$8,
-      forward: forward$7,
-      inverse: inverse$7,
-      names: names$9
-    };
-
-    /* Initialize the Oblique Mercator  projection
-        ------------------------------------------*/
-    function init$9() {
-      this.no_off = this.no_off || false;
-      this.no_rot = this.no_rot || false;
-
-      if (isNaN(this.k0)) {
-        this.k0 = 1;
-      }
-      var sinlat = Math.sin(this.lat0);
-      var coslat = Math.cos(this.lat0);
-      var con = this.e * sinlat;
-
-      this.bl = Math.sqrt(1 + this.es / (1 - this.es) * Math.pow(coslat, 4));
-      this.al = this.a * this.bl * this.k0 * Math.sqrt(1 - this.es) / (1 - con * con);
-      var t0 = tsfnz(this.e, this.lat0, sinlat);
-      var dl = this.bl / coslat * Math.sqrt((1 - this.es) / (1 - con * con));
-      if (dl * dl < 1) {
-        dl = 1;
-      }
-      var fl;
-      var gl;
-      if (!isNaN(this.longc)) {
-        //Central point and azimuth method
-
-        if (this.lat0 >= 0) {
-          fl = dl + Math.sqrt(dl * dl - 1);
-        }
-        else {
-          fl = dl - Math.sqrt(dl * dl - 1);
-        }
-        this.el = fl * Math.pow(t0, this.bl);
-        gl = 0.5 * (fl - 1 / fl);
-        this.gamma0 = Math.asin(Math.sin(this.alpha) / dl);
-        this.long0 = this.longc - Math.asin(gl * Math.tan(this.gamma0)) / this.bl;
-
-      }
-      else {
-        //2 points method
-        var t1 = tsfnz(this.e, this.lat1, Math.sin(this.lat1));
-        var t2 = tsfnz(this.e, this.lat2, Math.sin(this.lat2));
-        if (this.lat0 >= 0) {
-          this.el = (dl + Math.sqrt(dl * dl - 1)) * Math.pow(t0, this.bl);
-        }
-        else {
-          this.el = (dl - Math.sqrt(dl * dl - 1)) * Math.pow(t0, this.bl);
-        }
-        var hl = Math.pow(t1, this.bl);
-        var ll = Math.pow(t2, this.bl);
-        fl = this.el / hl;
-        gl = 0.5 * (fl - 1 / fl);
-        var jl = (this.el * this.el - ll * hl) / (this.el * this.el + ll * hl);
-        var pl = (ll - hl) / (ll + hl);
-        var dlon12 = adjust_lon(this.long1 - this.long2);
-        this.long0 = 0.5 * (this.long1 + this.long2) - Math.atan(jl * Math.tan(0.5 * this.bl * (dlon12)) / pl) / this.bl;
-        this.long0 = adjust_lon(this.long0);
-        var dlon10 = adjust_lon(this.long1 - this.long0);
-        this.gamma0 = Math.atan(Math.sin(this.bl * (dlon10)) / gl);
-        this.alpha = Math.asin(dl * Math.sin(this.gamma0));
-      }
-
-      if (this.no_off) {
-        this.uc = 0;
-      }
-      else {
-        if (this.lat0 >= 0) {
-          this.uc = this.al / this.bl * Math.atan2(Math.sqrt(dl * dl - 1), Math.cos(this.alpha));
-        }
-        else {
-          this.uc = -1 * this.al / this.bl * Math.atan2(Math.sqrt(dl * dl - 1), Math.cos(this.alpha));
-        }
-      }
-
-    }
-
-    /* Oblique Mercator forward equations--mapping lat,long to x,y
-        ----------------------------------------------------------*/
-    function forward$8(p) {
-      var lon = p.x;
-      var lat = p.y;
-      var dlon = adjust_lon(lon - this.long0);
-      var us, vs;
-      var con;
-      if (Math.abs(Math.abs(lat) - HALF_PI) <= EPSLN) {
-        if (lat > 0) {
-          con = -1;
-        }
-        else {
-          con = 1;
-        }
-        vs = this.al / this.bl * Math.log(Math.tan(FORTPI + con * this.gamma0 * 0.5));
-        us = -1 * con * HALF_PI * this.al / this.bl;
-      }
-      else {
-        var t = tsfnz(this.e, lat, Math.sin(lat));
-        var ql = this.el / Math.pow(t, this.bl);
-        var sl = 0.5 * (ql - 1 / ql);
-        var tl = 0.5 * (ql + 1 / ql);
-        var vl = Math.sin(this.bl * (dlon));
-        var ul = (sl * Math.sin(this.gamma0) - vl * Math.cos(this.gamma0)) / tl;
-        if (Math.abs(Math.abs(ul) - 1) <= EPSLN) {
-          vs = Number.POSITIVE_INFINITY;
-        }
-        else {
-          vs = 0.5 * this.al * Math.log((1 - ul) / (1 + ul)) / this.bl;
-        }
-        if (Math.abs(Math.cos(this.bl * (dlon))) <= EPSLN) {
-          us = this.al * this.bl * (dlon);
-        }
-        else {
-          us = this.al * Math.atan2(sl * Math.cos(this.gamma0) + vl * Math.sin(this.gamma0), Math.cos(this.bl * dlon)) / this.bl;
-        }
-      }
-
-      if (this.no_rot) {
-        p.x = this.x0 + us;
-        p.y = this.y0 + vs;
-      }
-      else {
-
-        us -= this.uc;
-        p.x = this.x0 + vs * Math.cos(this.alpha) + us * Math.sin(this.alpha);
-        p.y = this.y0 + us * Math.cos(this.alpha) - vs * Math.sin(this.alpha);
-      }
-      return p;
-    }
-
-    function inverse$8(p) {
-      var us, vs;
-      if (this.no_rot) {
-        vs = p.y - this.y0;
-        us = p.x - this.x0;
-      }
-      else {
-        vs = (p.x - this.x0) * Math.cos(this.alpha) - (p.y - this.y0) * Math.sin(this.alpha);
-        us = (p.y - this.y0) * Math.cos(this.alpha) + (p.x - this.x0) * Math.sin(this.alpha);
-        us += this.uc;
-      }
-      var qp = Math.exp(-1 * this.bl * vs / this.al);
-      var sp = 0.5 * (qp - 1 / qp);
-      var tp = 0.5 * (qp + 1 / qp);
-      var vp = Math.sin(this.bl * us / this.al);
-      var up = (vp * Math.cos(this.gamma0) + sp * Math.sin(this.gamma0)) / tp;
-      var ts = Math.pow(this.el / Math.sqrt((1 + up) / (1 - up)), 1 / this.bl);
-      if (Math.abs(up - 1) < EPSLN) {
-        p.x = this.long0;
-        p.y = HALF_PI;
-      }
-      else if (Math.abs(up + 1) < EPSLN) {
-        p.x = this.long0;
-        p.y = -1 * HALF_PI;
-      }
-      else {
-        p.y = phi2z(this.e, ts);
-        p.x = adjust_lon(this.long0 - Math.atan2(sp * Math.cos(this.gamma0) - vp * Math.sin(this.gamma0), Math.cos(this.bl * us / this.al)) / this.bl);
-      }
-      return p;
-    }
-
-    var names$10 = ["Hotine_Oblique_Mercator", "Hotine Oblique Mercator", "Hotine_Oblique_Mercator_Azimuth_Natural_Origin", "Hotine_Oblique_Mercator_Azimuth_Center", "omerc"];
-    var omerc = {
-      init: init$9,
-      forward: forward$8,
-      inverse: inverse$8,
-      names: names$10
-    };
-
-    function init$10() {
-
-      // array of:  r_maj,r_min,lat1,lat2,c_lon,c_lat,false_east,false_north
-      //double c_lat;                   /* center latitude                      */
-      //double c_lon;                   /* center longitude                     */
-      //double lat1;                    /* first standard parallel              */
-      //double lat2;                    /* second standard parallel             */
-      //double r_maj;                   /* major axis                           */
-      //double r_min;                   /* minor axis                           */
-      //double false_east;              /* x offset in meters                   */
-      //double false_north;             /* y offset in meters                   */
-
-      if (!this.lat2) {
-        this.lat2 = this.lat1;
-      } //if lat2 is not defined
-      if (!this.k0) {
-        this.k0 = 1;
-      }
-      this.x0 = this.x0 || 0;
-      this.y0 = this.y0 || 0;
-      // Standard Parallels cannot be equal and on opposite sides of the equator
-      if (Math.abs(this.lat1 + this.lat2) < EPSLN) {
-        return;
-      }
-
-      var temp = this.b / this.a;
-      this.e = Math.sqrt(1 - temp * temp);
-
-      var sin1 = Math.sin(this.lat1);
-      var cos1 = Math.cos(this.lat1);
-      var ms1 = msfnz(this.e, sin1, cos1);
-      var ts1 = tsfnz(this.e, this.lat1, sin1);
-
-      var sin2 = Math.sin(this.lat2);
-      var cos2 = Math.cos(this.lat2);
-      var ms2 = msfnz(this.e, sin2, cos2);
-      var ts2 = tsfnz(this.e, this.lat2, sin2);
-
-      var ts0 = tsfnz(this.e, this.lat0, Math.sin(this.lat0));
-
-      if (Math.abs(this.lat1 - this.lat2) > EPSLN) {
-        this.ns = Math.log(ms1 / ms2) / Math.log(ts1 / ts2);
-      }
-      else {
-        this.ns = sin1;
-      }
-      if (isNaN(this.ns)) {
-        this.ns = sin1;
-      }
-      this.f0 = ms1 / (this.ns * Math.pow(ts1, this.ns));
-      this.rh = this.a * this.f0 * Math.pow(ts0, this.ns);
-      if (!this.title) {
-        this.title = "Lambert Conformal Conic";
-      }
-    }
-
-    // Lambert Conformal conic forward equations--mapping lat,long to x,y
-    // -----------------------------------------------------------------
-    function forward$9(p) {
-
-      var lon = p.x;
-      var lat = p.y;
-
-      // singular cases :
-      if (Math.abs(2 * Math.abs(lat) - Math.PI) <= EPSLN) {
-        lat = sign(lat) * (HALF_PI - 2 * EPSLN);
-      }
-
-      var con = Math.abs(Math.abs(lat) - HALF_PI);
-      var ts, rh1;
-      if (con > EPSLN) {
-        ts = tsfnz(this.e, lat, Math.sin(lat));
-        rh1 = this.a * this.f0 * Math.pow(ts, this.ns);
-      }
-      else {
-        con = lat * this.ns;
-        if (con <= 0) {
-          return null;
-        }
-        rh1 = 0;
-      }
-      var theta = this.ns * adjust_lon(lon - this.long0);
-      p.x = this.k0 * (rh1 * Math.sin(theta)) + this.x0;
-      p.y = this.k0 * (this.rh - rh1 * Math.cos(theta)) + this.y0;
-
-      return p;
-    }
-
-    // Lambert Conformal Conic inverse equations--mapping x,y to lat/long
-    // -----------------------------------------------------------------
-    function inverse$9(p) {
-
-      var rh1, con, ts;
-      var lat, lon;
-      var x = (p.x - this.x0) / this.k0;
-      var y = (this.rh - (p.y - this.y0) / this.k0);
-      if (this.ns > 0) {
-        rh1 = Math.sqrt(x * x + y * y);
-        con = 1;
-      }
-      else {
-        rh1 = -Math.sqrt(x * x + y * y);
-        con = -1;
-      }
-      var theta = 0;
-      if (rh1 !== 0) {
-        theta = Math.atan2((con * x), (con * y));
-      }
-      if ((rh1 !== 0) || (this.ns > 0)) {
-        con = 1 / this.ns;
-        ts = Math.pow((rh1 / (this.a * this.f0)), con);
-        lat = phi2z(this.e, ts);
-        if (lat === -9999) {
-          return null;
-        }
-      }
-      else {
-        lat = -HALF_PI;
-      }
-      lon = adjust_lon(theta / this.ns + this.long0);
-
-      p.x = lon;
-      p.y = lat;
-      return p;
-    }
-
-    var names$11 = ["Lambert Tangential Conformal Conic Projection", "Lambert_Conformal_Conic", "Lambert_Conformal_Conic_2SP", "lcc"];
-    var lcc = {
-      init: init$10,
-      forward: forward$9,
-      inverse: inverse$9,
-      names: names$11
-    };
-
-    function init$11() {
-      this.a = 6377397.155;
-      this.es = 0.006674372230614;
-      this.e = Math.sqrt(this.es);
-      if (!this.lat0) {
-        this.lat0 = 0.863937979737193;
-      }
-      if (!this.long0) {
-        this.long0 = 0.7417649320975901 - 0.308341501185665;
-      }
-      /* if scale not set default to 0.9999 */
-      if (!this.k0) {
-        this.k0 = 0.9999;
-      }
-      this.s45 = 0.785398163397448; /* 45 */
-      this.s90 = 2 * this.s45;
-      this.fi0 = this.lat0;
-      this.e2 = this.es;
-      this.e = Math.sqrt(this.e2);
-      this.alfa = Math.sqrt(1 + (this.e2 * Math.pow(Math.cos(this.fi0), 4)) / (1 - this.e2));
-      this.uq = 1.04216856380474;
-      this.u0 = Math.asin(Math.sin(this.fi0) / this.alfa);
-      this.g = Math.pow((1 + this.e * Math.sin(this.fi0)) / (1 - this.e * Math.sin(this.fi0)), this.alfa * this.e / 2);
-      this.k = Math.tan(this.u0 / 2 + this.s45) / Math.pow(Math.tan(this.fi0 / 2 + this.s45), this.alfa) * this.g;
-      this.k1 = this.k0;
-      this.n0 = this.a * Math.sqrt(1 - this.e2) / (1 - this.e2 * Math.pow(Math.sin(this.fi0), 2));
-      this.s0 = 1.37008346281555;
-      this.n = Math.sin(this.s0);
-      this.ro0 = this.k1 * this.n0 / Math.tan(this.s0);
-      this.ad = this.s90 - this.uq;
-    }
-
-    /* ellipsoid */
-    /* calculate xy from lat/lon */
-    /* Constants, identical to inverse transform function */
-    function forward$10(p) {
-      var gfi, u, deltav, s, d, eps, ro;
-      var lon = p.x;
-      var lat = p.y;
-      var delta_lon = adjust_lon(lon - this.long0);
-      /* Transformation */
-      gfi = Math.pow(((1 + this.e * Math.sin(lat)) / (1 - this.e * Math.sin(lat))), (this.alfa * this.e / 2));
-      u = 2 * (Math.atan(this.k * Math.pow(Math.tan(lat / 2 + this.s45), this.alfa) / gfi) - this.s45);
-      deltav = -delta_lon * this.alfa;
-      s = Math.asin(Math.cos(this.ad) * Math.sin(u) + Math.sin(this.ad) * Math.cos(u) * Math.cos(deltav));
-      d = Math.asin(Math.cos(u) * Math.sin(deltav) / Math.cos(s));
-      eps = this.n * d;
-      ro = this.ro0 * Math.pow(Math.tan(this.s0 / 2 + this.s45), this.n) / Math.pow(Math.tan(s / 2 + this.s45), this.n);
-      p.y = ro * Math.cos(eps) / 1;
-      p.x = ro * Math.sin(eps) / 1;
-
-      if (!this.czech) {
-        p.y *= -1;
-        p.x *= -1;
-      }
-      return (p);
-    }
-
-    /* calculate lat/lon from xy */
-    function inverse$10(p) {
-      var u, deltav, s, d, eps, ro, fi1;
-      var ok;
-
-      /* Transformation */
-      /* revert y, x*/
-      var tmp = p.x;
-      p.x = p.y;
-      p.y = tmp;
-      if (!this.czech) {
-        p.y *= -1;
-        p.x *= -1;
-      }
-      ro = Math.sqrt(p.x * p.x + p.y * p.y);
-      eps = Math.atan2(p.y, p.x);
-      d = eps / Math.sin(this.s0);
-      s = 2 * (Math.atan(Math.pow(this.ro0 / ro, 1 / this.n) * Math.tan(this.s0 / 2 + this.s45)) - this.s45);
-      u = Math.asin(Math.cos(this.ad) * Math.sin(s) - Math.sin(this.ad) * Math.cos(s) * Math.cos(d));
-      deltav = Math.asin(Math.cos(s) * Math.sin(d) / Math.cos(u));
-      p.x = this.long0 - deltav / this.alfa;
-      fi1 = u;
-      ok = 0;
-      var iter = 0;
-      do {
-        p.y = 2 * (Math.atan(Math.pow(this.k, - 1 / this.alfa) * Math.pow(Math.tan(u / 2 + this.s45), 1 / this.alfa) * Math.pow((1 + this.e * Math.sin(fi1)) / (1 - this.e * Math.sin(fi1)), this.e / 2)) - this.s45);
-        if (Math.abs(fi1 - p.y) < 0.0000000001) {
-          ok = 1;
-        }
-        fi1 = p.y;
-        iter += 1;
-      } while (ok === 0 && iter < 15);
-      if (iter >= 15) {
-        return null;
-      }
-
-      return (p);
-    }
-
-    var names$12 = ["Krovak", "krovak"];
-    var krovak = {
-      init: init$11,
-      forward: forward$10,
-      inverse: inverse$10,
-      names: names$12
-    };
-
-    var mlfn = function(e0, e1, e2, e3, phi) {
-      return (e0 * phi - e1 * Math.sin(2 * phi) + e2 * Math.sin(4 * phi) - e3 * Math.sin(6 * phi));
-    };
-
-    var e0fn = function(x) {
-      return (1 - 0.25 * x * (1 + x / 16 * (3 + 1.25 * x)));
-    };
-
-    var e1fn = function(x) {
-      return (0.375 * x * (1 + 0.25 * x * (1 + 0.46875 * x)));
-    };
-
-    var e2fn = function(x) {
-      return (0.05859375 * x * x * (1 + 0.75 * x));
-    };
-
-    var e3fn = function(x) {
-      return (x * x * x * (35 / 3072));
-    };
-
-    var gN = function(a, e, sinphi) {
-      var temp = e * sinphi;
-      return a / Math.sqrt(1 - temp * temp);
-    };
-
-    var adjust_lat = function(x) {
-      return (Math.abs(x) < HALF_PI) ? x : (x - (sign(x) * Math.PI));
-    };
-
-    var imlfn = function(ml, e0, e1, e2, e3) {
-      var phi;
-      var dphi;
-
-      phi = ml / e0;
-      for (var i = 0; i < 15; i++) {
-        dphi = (ml - (e0 * phi - e1 * Math.sin(2 * phi) + e2 * Math.sin(4 * phi) - e3 * Math.sin(6 * phi))) / (e0 - 2 * e1 * Math.cos(2 * phi) + 4 * e2 * Math.cos(4 * phi) - 6 * e3 * Math.cos(6 * phi));
-        phi += dphi;
-        if (Math.abs(dphi) <= 0.0000000001) {
-          return phi;
-        }
-      }
-
-      //..reportError("IMLFN-CONV:Latitude failed to converge after 15 iterations");
-      return NaN;
-    };
-
-    function init$12() {
-      if (!this.sphere) {
-        this.e0 = e0fn(this.es);
-        this.e1 = e1fn(this.es);
-        this.e2 = e2fn(this.es);
-        this.e3 = e3fn(this.es);
-        this.ml0 = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, this.lat0);
-      }
-    }
-
-    /* Cassini forward equations--mapping lat,long to x,y
-      -----------------------------------------------------------------------*/
-    function forward$11(p) {
-
-      /* Forward equations
-          -----------------*/
-      var x, y;
-      var lam = p.x;
-      var phi = p.y;
-      lam = adjust_lon(lam - this.long0);
-
-      if (this.sphere) {
-        x = this.a * Math.asin(Math.cos(phi) * Math.sin(lam));
-        y = this.a * (Math.atan2(Math.tan(phi), Math.cos(lam)) - this.lat0);
-      }
-      else {
-        //ellipsoid
-        var sinphi = Math.sin(phi);
-        var cosphi = Math.cos(phi);
-        var nl = gN(this.a, this.e, sinphi);
-        var tl = Math.tan(phi) * Math.tan(phi);
-        var al = lam * Math.cos(phi);
-        var asq = al * al;
-        var cl = this.es * cosphi * cosphi / (1 - this.es);
-        var ml = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, phi);
-
-        x = nl * al * (1 - asq * tl * (1 / 6 - (8 - tl + 8 * cl) * asq / 120));
-        y = ml - this.ml0 + nl * sinphi / cosphi * asq * (0.5 + (5 - tl + 6 * cl) * asq / 24);
-
-
-      }
-
-      p.x = x + this.x0;
-      p.y = y + this.y0;
-      return p;
-    }
-
-    /* Inverse equations
-      -----------------*/
-    function inverse$11(p) {
-      p.x -= this.x0;
-      p.y -= this.y0;
-      var x = p.x / this.a;
-      var y = p.y / this.a;
-      var phi, lam;
-
-      if (this.sphere) {
-        var dd = y + this.lat0;
-        phi = Math.asin(Math.sin(dd) * Math.cos(x));
-        lam = Math.atan2(Math.tan(x), Math.cos(dd));
-      }
-      else {
-        /* ellipsoid */
-        var ml1 = this.ml0 / this.a + y;
-        var phi1 = imlfn(ml1, this.e0, this.e1, this.e2, this.e3);
-        if (Math.abs(Math.abs(phi1) - HALF_PI) <= EPSLN) {
-          p.x = this.long0;
-          p.y = HALF_PI;
-          if (y < 0) {
-            p.y *= -1;
-          }
-          return p;
-        }
-        var nl1 = gN(this.a, this.e, Math.sin(phi1));
-
-        var rl1 = nl1 * nl1 * nl1 / this.a / this.a * (1 - this.es);
-        var tl1 = Math.pow(Math.tan(phi1), 2);
-        var dl = x * this.a / nl1;
-        var dsq = dl * dl;
-        phi = phi1 - nl1 * Math.tan(phi1) / rl1 * dl * dl * (0.5 - (1 + 3 * tl1) * dl * dl / 24);
-        lam = dl * (1 - dsq * (tl1 / 3 + (1 + 3 * tl1) * tl1 * dsq / 15)) / Math.cos(phi1);
-
-      }
-
-      p.x = adjust_lon(lam + this.long0);
-      p.y = adjust_lat(phi);
-      return p;
-
-    }
-
-    var names$13 = ["Cassini", "Cassini_Soldner", "cass"];
-    var cass = {
-      init: init$12,
-      forward: forward$11,
-      inverse: inverse$11,
-      names: names$13
-    };
-
-    var qsfnz = function(eccent, sinphi) {
-      var con;
-      if (eccent > 1.0e-7) {
-        con = eccent * sinphi;
-        return ((1 - eccent * eccent) * (sinphi / (1 - con * con) - (0.5 / eccent) * Math.log((1 - con) / (1 + con))));
-      }
-      else {
-        return (2 * sinphi);
-      }
-    };
-
-    /*
-      reference
-        "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder,
-        The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355.
-      */
-
-    var S_POLE = 1;
-
-    var N_POLE = 2;
-    var EQUIT = 3;
-    var OBLIQ = 4;
-
-    /* Initialize the Lambert Azimuthal Equal Area projection
-      ------------------------------------------------------*/
-    function init$13() {
-      var t = Math.abs(this.lat0);
-      if (Math.abs(t - HALF_PI) < EPSLN) {
-        this.mode = this.lat0 < 0 ? this.S_POLE : this.N_POLE;
-      }
-      else if (Math.abs(t) < EPSLN) {
-        this.mode = this.EQUIT;
-      }
-      else {
-        this.mode = this.OBLIQ;
-      }
-      if (this.es > 0) {
-        var sinphi;
-
-        this.qp = qsfnz(this.e, 1);
-        this.mmf = 0.5 / (1 - this.es);
-        this.apa = authset(this.es);
-        switch (this.mode) {
-        case this.N_POLE:
-          this.dd = 1;
-          break;
-        case this.S_POLE:
-          this.dd = 1;
-          break;
-        case this.EQUIT:
-          this.rq = Math.sqrt(0.5 * this.qp);
-          this.dd = 1 / this.rq;
-          this.xmf = 1;
-          this.ymf = 0.5 * this.qp;
-          break;
-        case this.OBLIQ:
-          this.rq = Math.sqrt(0.5 * this.qp);
-          sinphi = Math.sin(this.lat0);
-          this.sinb1 = qsfnz(this.e, sinphi) / this.qp;
-          this.cosb1 = Math.sqrt(1 - this.sinb1 * this.sinb1);
-          this.dd = Math.cos(this.lat0) / (Math.sqrt(1 - this.es * sinphi * sinphi) * this.rq * this.cosb1);
-          this.ymf = (this.xmf = this.rq) / this.dd;
-          this.xmf *= this.dd;
-          break;
-        }
-      }
-      else {
-        if (this.mode === this.OBLIQ) {
-          this.sinph0 = Math.sin(this.lat0);
-          this.cosph0 = Math.cos(this.lat0);
-        }
-      }
-    }
-
-    /* Lambert Azimuthal Equal Area forward equations--mapping lat,long to x,y
-      -----------------------------------------------------------------------*/
-    function forward$12(p) {
-
-      /* Forward equations
-          -----------------*/
-      var x, y, coslam, sinlam, sinphi, q, sinb, cosb, b, cosphi;
-      var lam = p.x;
-      var phi = p.y;
-
-      lam = adjust_lon(lam - this.long0);
-      if (this.sphere) {
-        sinphi = Math.sin(phi);
-        cosphi = Math.cos(phi);
-        coslam = Math.cos(lam);
-        if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
-          y = (this.mode === this.EQUIT) ? 1 + cosphi * coslam : 1 + this.sinph0 * sinphi + this.cosph0 * cosphi * coslam;
-          if (y <= EPSLN) {
-            return null;
-          }
-          y = Math.sqrt(2 / y);
-          x = y * cosphi * Math.sin(lam);
-          y *= (this.mode === this.EQUIT) ? sinphi : this.cosph0 * sinphi - this.sinph0 * cosphi * coslam;
-        }
-        else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {
-          if (this.mode === this.N_POLE) {
-            coslam = -coslam;
-          }
-          if (Math.abs(phi + this.lat0) < EPSLN) {
-            return null;
-          }
-          y = FORTPI - phi * 0.5;
-          y = 2 * ((this.mode === this.S_POLE) ? Math.cos(y) : Math.sin(y));
-          x = y * Math.sin(lam);
-          y *= coslam;
-        }
-      }
-      else {
-        sinb = 0;
-        cosb = 0;
-        b = 0;
-        coslam = Math.cos(lam);
-        sinlam = Math.sin(lam);
-        sinphi = Math.sin(phi);
-        q = qsfnz(this.e, sinphi);
-        if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
-          sinb = q / this.qp;
-          cosb = Math.sqrt(1 - sinb * sinb);
-        }
-        switch (this.mode) {
-        case this.OBLIQ:
-          b = 1 + this.sinb1 * sinb + this.cosb1 * cosb * coslam;
-          break;
-        case this.EQUIT:
-          b = 1 + cosb * coslam;
-          break;
-        case this.N_POLE:
-          b = HALF_PI + phi;
-          q = this.qp - q;
-          break;
-        case this.S_POLE:
-          b = phi - HALF_PI;
-          q = this.qp + q;
-          break;
-        }
-        if (Math.abs(b) < EPSLN) {
-          return null;
-        }
-        switch (this.mode) {
-        case this.OBLIQ:
-        case this.EQUIT:
-          b = Math.sqrt(2 / b);
-          if (this.mode === this.OBLIQ) {
-            y = this.ymf * b * (this.cosb1 * sinb - this.sinb1 * cosb * coslam);
-          }
-          else {
-            y = (b = Math.sqrt(2 / (1 + cosb * coslam))) * sinb * this.ymf;
-          }
-          x = this.xmf * b * cosb * sinlam;
-          break;
-        case this.N_POLE:
-        case this.S_POLE:
-          if (q >= 0) {
-            x = (b = Math.sqrt(q)) * sinlam;
-            y = coslam * ((this.mode === this.S_POLE) ? b : -b);
-          }
-          else {
-            x = y = 0;
-          }
-          break;
-        }
-      }
-
-      p.x = this.a * x + this.x0;
-      p.y = this.a * y + this.y0;
-      return p;
-    }
-
-    /* Inverse equations
-      -----------------*/
-    function inverse$12(p) {
-      p.x -= this.x0;
-      p.y -= this.y0;
-      var x = p.x / this.a;
-      var y = p.y / this.a;
-      var lam, phi, cCe, sCe, q, rho, ab;
-      if (this.sphere) {
-        var cosz = 0,
-          rh, sinz = 0;
-
-        rh = Math.sqrt(x * x + y * y);
-        phi = rh * 0.5;
-        if (phi > 1) {
-          return null;
-        }
-        phi = 2 * Math.asin(phi);
-        if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
-          sinz = Math.sin(phi);
-          cosz = Math.cos(phi);
-        }
-        switch (this.mode) {
-        case this.EQUIT:
-          phi = (Math.abs(rh) <= EPSLN) ? 0 : Math.asin(y * sinz / rh);
-          x *= sinz;
-          y = cosz * rh;
-          break;
-        case this.OBLIQ:
-          phi = (Math.abs(rh) <= EPSLN) ? this.lat0 : Math.asin(cosz * this.sinph0 + y * sinz * this.cosph0 / rh);
-          x *= sinz * this.cosph0;
-          y = (cosz - Math.sin(phi) * this.sinph0) * rh;
-          break;
-        case this.N_POLE:
-          y = -y;
-          phi = HALF_PI - phi;
-          break;
-        case this.S_POLE:
-          phi -= HALF_PI;
-          break;
-        }
-        lam = (y === 0 && (this.mode === this.EQUIT || this.mode === this.OBLIQ)) ? 0 : Math.atan2(x, y);
-      }
-      else {
-        ab = 0;
-        if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
-          x /= this.dd;
-          y *= this.dd;
-          rho = Math.sqrt(x * x + y * y);
-          if (rho < EPSLN) {
-            p.x = this.long0;
-            p.y = this.lat0;
-            return p;
-          }
-          sCe = 2 * Math.asin(0.5 * rho / this.rq);
-          cCe = Math.cos(sCe);
-          x *= (sCe = Math.sin(sCe));
-          if (this.mode === this.OBLIQ) {
-            ab = cCe * this.sinb1 + y * sCe * this.cosb1 / rho;
-            q = this.qp * ab;
-            y = rho * this.cosb1 * cCe - y * this.sinb1 * sCe;
-          }
-          else {
-            ab = y * sCe / rho;
-            q = this.qp * ab;
-            y = rho * cCe;
-          }
-        }
-        else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {
-          if (this.mode === this.N_POLE) {
-            y = -y;
-          }
-          q = (x * x + y * y);
-          if (!q) {
-            p.x = this.long0;
-            p.y = this.lat0;
-            return p;
-          }
-          ab = 1 - q / this.qp;
-          if (this.mode === this.S_POLE) {
-            ab = -ab;
-          }
-        }
-        lam = Math.atan2(x, y);
-        phi = authlat(Math.asin(ab), this.apa);
-      }
-
-      p.x = adjust_lon(this.long0 + lam);
-      p.y = phi;
-      return p;
-    }
-
-    /* determine latitude from authalic latitude */
-    var P00 = 0.33333333333333333333;
-
-    var P01 = 0.17222222222222222222;
-    var P02 = 0.10257936507936507936;
-    var P10 = 0.06388888888888888888;
-    var P11 = 0.06640211640211640211;
-    var P20 = 0.01641501294219154443;
-
-    function authset(es) {
-      var t;
-      var APA = [];
-      APA[0] = es * P00;
-      t = es * es;
-      APA[0] += t * P01;
-      APA[1] = t * P10;
-      t *= es;
-      APA[0] += t * P02;
-      APA[1] += t * P11;
-      APA[2] = t * P20;
-      return APA;
-    }
-
-    function authlat(beta, APA) {
-      var t = beta + beta;
-      return (beta + APA[0] * Math.sin(t) + APA[1] * Math.sin(t + t) + APA[2] * Math.sin(t + t + t));
-    }
-
-    var names$14 = ["Lambert Azimuthal Equal Area", "Lambert_Azimuthal_Equal_Area", "laea"];
-    var laea = {
-      init: init$13,
-      forward: forward$12,
-      inverse: inverse$12,
-      names: names$14,
-      S_POLE: S_POLE,
-      N_POLE: N_POLE,
-      EQUIT: EQUIT,
-      OBLIQ: OBLIQ
-    };
-
-    var asinz = function(x) {
-      if (Math.abs(x) > 1) {
-        x = (x > 1) ? 1 : -1;
-      }
-      return Math.asin(x);
-    };
-
-    function init$14() {
-
-      if (Math.abs(this.lat1 + this.lat2) < EPSLN) {
-        return;
-      }
-      this.temp = this.b / this.a;
-      this.es = 1 - Math.pow(this.temp, 2);
-      this.e3 = Math.sqrt(this.es);
-
-      this.sin_po = Math.sin(this.lat1);
-      this.cos_po = Math.cos(this.lat1);
-      this.t1 = this.sin_po;
-      this.con = this.sin_po;
-      this.ms1 = msfnz(this.e3, this.sin_po, this.cos_po);
-      this.qs1 = qsfnz(this.e3, this.sin_po, this.cos_po);
-
-      this.sin_po = Math.sin(this.lat2);
-      this.cos_po = Math.cos(this.lat2);
-      this.t2 = this.sin_po;
-      this.ms2 = msfnz(this.e3, this.sin_po, this.cos_po);
-      this.qs2 = qsfnz(this.e3, this.sin_po, this.cos_po);
-
-      this.sin_po = Math.sin(this.lat0);
-      this.cos_po = Math.cos(this.lat0);
-      this.t3 = this.sin_po;
-      this.qs0 = qsfnz(this.e3, this.sin_po, this.cos_po);
-
-      if (Math.abs(this.lat1 - this.lat2) > EPSLN) {
-        this.ns0 = (this.ms1 * this.ms1 - this.ms2 * this.ms2) / (this.qs2 - this.qs1);
-      }
-      else {
-        this.ns0 = this.con;
-      }
-      this.c = this.ms1 * this.ms1 + this.ns0 * this.qs1;
-      this.rh = this.a * Math.sqrt(this.c - this.ns0 * this.qs0) / this.ns0;
-    }
-
-    /* Albers Conical Equal Area forward equations--mapping lat,long to x,y
-      -------------------------------------------------------------------*/
-    function forward$13(p) {
-
-      var lon = p.x;
-      var lat = p.y;
-
-      this.sin_phi = Math.sin(lat);
-      this.cos_phi = Math.cos(lat);
-
-      var qs = qsfnz(this.e3, this.sin_phi, this.cos_phi);
-      var rh1 = this.a * Math.sqrt(this.c - this.ns0 * qs) / this.ns0;
-      var theta = this.ns0 * adjust_lon(lon - this.long0);
-      var x = rh1 * Math.sin(theta) + this.x0;
-      var y = this.rh - rh1 * Math.cos(theta) + this.y0;
-
-      p.x = x;
-      p.y = y;
-      return p;
-    }
-
-    function inverse$13(p) {
-      var rh1, qs, con, theta, lon, lat;
-
-      p.x -= this.x0;
-      p.y = this.rh - p.y + this.y0;
-      if (this.ns0 >= 0) {
-        rh1 = Math.sqrt(p.x * p.x + p.y * p.y);
-        con = 1;
-      }
-      else {
-        rh1 = -Math.sqrt(p.x * p.x + p.y * p.y);
-        con = -1;
-      }
-      theta = 0;
-      if (rh1 !== 0) {
-        theta = Math.atan2(con * p.x, con * p.y);
-      }
-      con = rh1 * this.ns0 / this.a;
-      if (this.sphere) {
-        lat = Math.asin((this.c - con * con) / (2 * this.ns0));
-      }
-      else {
-        qs = (this.c - con * con) / this.ns0;
-        lat = this.phi1z(this.e3, qs);
-      }
-
-      lon = adjust_lon(theta / this.ns0 + this.long0);
-      p.x = lon;
-      p.y = lat;
-      return p;
-    }
-
-    /* Function to compute phi1, the latitude for the inverse of the
-       Albers Conical Equal-Area projection.
-    -------------------------------------------*/
-    function phi1z(eccent, qs) {
-      var sinphi, cosphi, con, com, dphi;
-      var phi = asinz(0.5 * qs);
-      if (eccent < EPSLN) {
-        return phi;
-      }
-
-      var eccnts = eccent * eccent;
-      for (var i = 1; i <= 25; i++) {
-        sinphi = Math.sin(phi);
-        cosphi = Math.cos(phi);
-        con = eccent * sinphi;
-        com = 1 - con * con;
-        dphi = 0.5 * com * com / cosphi * (qs / (1 - eccnts) - sinphi / com + 0.5 / eccent * Math.log((1 - con) / (1 + con)));
-        phi = phi + dphi;
-        if (Math.abs(dphi) <= 1e-7) {
-          return phi;
-        }
-      }
-      return null;
-    }
-
-    var names$15 = ["Albers_Conic_Equal_Area", "Albers", "aea"];
-    var aea = {
-      init: init$14,
-      forward: forward$13,
-      inverse: inverse$13,
-      names: names$15,
-      phi1z: phi1z
-    };
-
-    /*
-      reference:
-        Wolfram Mathworld "Gnomonic Projection"
-        http://mathworld.wolfram.com/GnomonicProjection.html
-        Accessed: 12th November 2009
-      */
-    function init$15() {
-
-      /* Place parameters in static storage for common use
-          -------------------------------------------------*/
-      this.sin_p14 = Math.sin(this.lat0);
-      this.cos_p14 = Math.cos(this.lat0);
-      // Approximation for projecting points to the horizon (infinity)
-      this.infinity_dist = 1000 * this.a;
-      this.rc = 1;
-    }
-
-    /* Gnomonic forward equations--mapping lat,long to x,y
-        ---------------------------------------------------*/
-    function forward$14(p) {
-      var sinphi, cosphi; /* sin and cos value        */
-      var dlon; /* delta longitude value      */
-      var coslon; /* cos of longitude        */
-      var ksp; /* scale factor          */
-      var g;
-      var x, y;
-      var lon = p.x;
-      var lat = p.y;
-      /* Forward equations
-          -----------------*/
-      dlon = adjust_lon(lon - this.long0);
-
-      sinphi = Math.sin(lat);
-      cosphi = Math.cos(lat);
-
-      coslon = Math.cos(dlon);
-      g = this.sin_p14 * sinphi + this.cos_p14 * cosphi * coslon;
-      ksp = 1;
-      if ((g > 0) || (Math.abs(g) <= EPSLN)) {
-        x = this.x0 + this.a * ksp * cosphi * Math.sin(dlon) / g;
-        y = this.y0 + this.a * ksp * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon) / g;
-      }
-      else {
-
-        // Point is in the opposing hemisphere and is unprojectable
-        // We still need to return a reasonable point, so we project
-        // to infinity, on a bearing
-        // equivalent to the northern hemisphere equivalent
-        // This is a reasonable approximation for short shapes and lines that
-        // straddle the horizon.
-
-        x = this.x0 + this.infinity_dist * cosphi * Math.sin(dlon);
-        y = this.y0 + this.infinity_dist * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon);
-
-      }
-      p.x = x;
-      p.y = y;
-      return p;
-    }
-
-    function inverse$14(p) {
-      var rh; /* Rho */
-      var sinc, cosc;
-      var c;
-      var lon, lat;
-
-      /* Inverse equations
-          -----------------*/
-      p.x = (p.x - this.x0) / this.a;
-      p.y = (p.y - this.y0) / this.a;
-
-      p.x /= this.k0;
-      p.y /= this.k0;
-
-      if ((rh = Math.sqrt(p.x * p.x + p.y * p.y))) {
-        c = Math.atan2(rh, this.rc);
-        sinc = Math.sin(c);
-        cosc = Math.cos(c);
-
-        lat = asinz(cosc * this.sin_p14 + (p.y * sinc * this.cos_p14) / rh);
-        lon = Math.atan2(p.x * sinc, rh * this.cos_p14 * cosc - p.y * this.sin_p14 * sinc);
-        lon = adjust_lon(this.long0 + lon);
-      }
-      else {
-        lat = this.phic0;
-        lon = 0;
-      }
-
-      p.x = lon;
-      p.y = lat;
-      return p;
-    }
-
-    var names$16 = ["gnom"];
-    var gnom = {
-      init: init$15,
-      forward: forward$14,
-      inverse: inverse$14,
-      names: names$16
-    };
-
-    var iqsfnz = function(eccent, q) {
-      var temp = 1 - (1 - eccent * eccent) / (2 * eccent) * Math.log((1 - eccent) / (1 + eccent));
-      if (Math.abs(Math.abs(q) - temp) < 1.0E-6) {
-        if (q < 0) {
-          return (-1 * HALF_PI);
-        }
-        else {
-          return HALF_PI;
-        }
-      }
-      //var phi = 0.5* q/(1-eccent*eccent);
-      var phi = Math.asin(0.5 * q);
-      var dphi;
-      var sin_phi;
-      var cos_phi;
-      var con;
-      for (var i = 0; i < 30; i++) {
-        sin_phi = Math.sin(phi);
-        cos_phi = Math.cos(phi);
-        con = eccent * sin_phi;
-        dphi = Math.pow(1 - con * con, 2) / (2 * cos_phi) * (q / (1 - eccent * eccent) - sin_phi / (1 - con * con) + 0.5 / eccent * Math.log((1 - con) / (1 + con)));
-        phi += dphi;
-        if (Math.abs(dphi) <= 0.0000000001) {
-          return phi;
-        }
-      }
-
-      //console.log("IQSFN-CONV:Latitude failed to converge after 30 iterations");
-      return NaN;
-    };
-
-    /*
-      reference:
-        "Cartographic Projection Procedures for the UNIX Environment-
-        A User's Manual" by Gerald I. Evenden,
-        USGS Open File Report 90-284and Release 4 Interim Reports (2003)
-    */
-    function init$16() {
-      //no-op
-      if (!this.sphere) {
-        this.k0 = msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts));
-      }
-    }
-
-    /* Cylindrical Equal Area forward equations--mapping lat,long to x,y
-        ------------------------------------------------------------*/
-    function forward$15(p) {
-      var lon = p.x;
-      var lat = p.y;
-      var x, y;
-      /* Forward equations
-          -----------------*/
-      var dlon = adjust_lon(lon - this.long0);
-      if (this.sphere) {
-        x = this.x0 + this.a * dlon * Math.cos(this.lat_ts);
-        y = this.y0 + this.a * Math.sin(lat) / Math.cos(this.lat_ts);
-      }
-      else {
-        var qs = qsfnz(this.e, Math.sin(lat));
-        x = this.x0 + this.a * this.k0 * dlon;
-        y = this.y0 + this.a * qs * 0.5 / this.k0;
-      }
-
-      p.x = x;
-      p.y = y;
-      return p;
-    }
-
-    /* Cylindrical Equal Area inverse equations--mapping x,y to lat/long
-        ------------------------------------------------------------*/
-    function inverse$15(p) {
-      p.x -= this.x0;
-      p.y -= this.y0;
-      var lon, lat;
-
-      if (this.sphere) {
-        lon = adjust_lon(this.long0 + (p.x / this.a) / Math.cos(this.lat_ts));
-        lat = Math.asin((p.y / this.a) * Math.cos(this.lat_ts));
-      }
-      else {
-        lat = iqsfnz(this.e, 2 * p.y * this.k0 / this.a);
-        lon = adjust_lon(this.long0 + p.x / (this.a * this.k0));
-      }
-
-      p.x = lon;
-      p.y = lat;
-      return p;
-    }
-
-    var names$17 = ["cea"];
-    var cea = {
-      init: init$16,
-      forward: forward$15,
-      inverse: inverse$15,
-      names: names$17
-    };
-
-    function init$17() {
-
-      this.x0 = this.x0 || 0;
-      this.y0 = this.y0 || 0;
-      this.lat0 = this.lat0 || 0;
-      this.long0 = this.long0 || 0;
-      this.lat_ts = this.lat_ts || 0;
-      this.title = this.title || "Equidistant Cylindrical (Plate Carre)";
-
-      this.rc = Math.cos(this.lat_ts);
-    }
-
-    // forward equations--mapping lat,long to x,y
-    // -----------------------------------------------------------------
-    function forward$16(p) {
-
-      var lon = p.x;
-      var lat = p.y;
-
-      var dlon = adjust_lon(lon - this.long0);
-      var dlat = adjust_lat(lat - this.lat0);
-      p.x = this.x0 + (this.a * dlon * this.rc);
-      p.y = this.y0 + (this.a * dlat);
-      return p;
-    }
-
-    // inverse equations--mapping x,y to lat/long
-    // -----------------------------------------------------------------
-    function inverse$16(p) {
-
-      var x = p.x;
-      var y = p.y;
-
-      p.x = adjust_lon(this.long0 + ((x - this.x0) / (this.a * this.rc)));
-      p.y = adjust_lat(this.lat0 + ((y - this.y0) / (this.a)));
-      return p;
-    }
-
-    var names$18 = ["Equirectangular", "Equidistant_Cylindrical", "eqc"];
-    var eqc = {
-      init: init$17,
-      forward: forward$16,
-      inverse: inverse$16,
-      names: names$18
-    };
-
-    var MAX_ITER$2 = 20;
-
-    function init$18() {
-      /* Place parameters in static storage for common use
-          -------------------------------------------------*/
-      this.temp = this.b / this.a;
-      this.es = 1 - Math.pow(this.temp, 2); // devait etre dans tmerc.js mais n y est pas donc je commente sinon retour de valeurs nulles
-      this.e = Math.sqrt(this.es);
-      this.e0 = e0fn(this.es);
-      this.e1 = e1fn(this.es);
-      this.e2 = e2fn(this.es);
-      this.e3 = e3fn(this.es);
-      this.ml0 = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, this.lat0); //si que des zeros le calcul ne se fait pas
-    }
-
-    /* Polyconic forward equations--mapping lat,long to x,y
-        ---------------------------------------------------*/
-    function forward$17(p) {
-      var lon = p.x;
-      var lat = p.y;
-      var x, y, el;
-      var dlon = adjust_lon(lon - this.long0);
-      el = dlon * Math.sin(lat);
-      if (this.sphere) {
-        if (Math.abs(lat) <= EPSLN) {
-          x = this.a * dlon;
-          y = -1 * this.a * this.lat0;
-        }
-        else {
-          x = this.a * Math.sin(el) / Math.tan(lat);
-          y = this.a * (adjust_lat(lat - this.lat0) + (1 - Math.cos(el)) / Math.tan(lat));
-        }
-      }
-      else {
-        if (Math.abs(lat) <= EPSLN) {
-          x = this.a * dlon;
-          y = -1 * this.ml0;
-        }
-        else {
-          var nl = gN(this.a, this.e, Math.sin(lat)) / Math.tan(lat);
-          x = nl * Math.sin(el);
-          y = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, lat) - this.ml0 + nl * (1 - Math.cos(el));
-        }
-
-      }
-      p.x = x + this.x0;
-      p.y = y + this.y0;
-      return p;
-    }
-
-    /* Inverse equations
-      -----------------*/
-    function inverse$17(p) {
-      var lon, lat, x, y, i;
-      var al, bl;
-      var phi, dphi;
-      x = p.x - this.x0;
-      y = p.y - this.y0;
-
-      if (this.sphere) {
-        if (Math.abs(y + this.a * this.lat0) <= EPSLN) {
-          lon = adjust_lon(x / this.a + this.long0);
-          lat = 0;
-        }
-        else {
-          al = this.lat0 + y / this.a;
-          bl = x * x / this.a / this.a + al * al;
-          phi = al;
-          var tanphi;
-          for (i = MAX_ITER$2; i; --i) {
-            tanphi = Math.tan(phi);
-            dphi = -1 * (al * (phi * tanphi + 1) - phi - 0.5 * (phi * phi + bl) * tanphi) / ((phi - al) / tanphi - 1);
-            phi += dphi;
-            if (Math.abs(dphi) <= EPSLN) {
-              lat = phi;
-              break;
-            }
-          }
-          lon = adjust_lon(this.long0 + (Math.asin(x * Math.tan(phi) / this.a)) / Math.sin(lat));
-        }
-      }
-      else {
-        if (Math.abs(y + this.ml0) <= EPSLN) {
-          lat = 0;
-          lon = adjust_lon(this.long0 + x / this.a);
-        }
-        else {
-
-          al = (this.ml0 + y) / this.a;
-          bl = x * x / this.a / this.a + al * al;
-          phi = al;
-          var cl, mln, mlnp, ma;
-          var con;
-          for (i = MAX_ITER$2; i; --i) {
-            con = this.e * Math.sin(phi);
-            cl = Math.sqrt(1 - con * con) * Math.tan(phi);
-            mln = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, phi);
-            mlnp = this.e0 - 2 * this.e1 * Math.cos(2 * phi) + 4 * this.e2 * Math.cos(4 * phi) - 6 * this.e3 * Math.cos(6 * phi);
-            ma = mln / this.a;
-            dphi = (al * (cl * ma + 1) - ma - 0.5 * cl * (ma * ma + bl)) / (this.es * Math.sin(2 * phi) * (ma * ma + bl - 2 * al * ma) / (4 * cl) + (al - ma) * (cl * mlnp - 2 / Math.sin(2 * phi)) - mlnp);
-            phi -= dphi;
-            if (Math.abs(dphi) <= EPSLN) {
-              lat = phi;
-              break;
-            }
-          }
-
-          //lat=phi4z(this.e,this.e0,this.e1,this.e2,this.e3,al,bl,0,0);
-          cl = Math.sqrt(1 - this.es * Math.pow(Math.sin(lat), 2)) * Math.tan(lat);
-          lon = adjust_lon(this.long0 + Math.asin(x * cl / this.a) / Math.sin(lat));
-        }
-      }
-
-      p.x = lon;
-      p.y = lat;
-      return p;
-    }
-
-    var names$19 = ["Polyconic", "poly"];
-    var poly = {
-      init: init$18,
-      forward: forward$17,
-      inverse: inverse$17,
-      names: names$19
-    };
-
-    /*
-      reference
-        Department of Land and Survey Technical Circular 1973/32
-          http://www.linz.govt.nz/docs/miscellaneous/nz-map-definition.pdf
-        OSG Technical Report 4.1
-          http://www.linz.govt.nz/docs/miscellaneous/nzmg.pdf
-      */
-
-    /**
-     * iterations: Number of iterations to refine inverse transform.
-     *     0 -> km accuracy
-     *     1 -> m accuracy -- suitable for most mapping applications
-     *     2 -> mm accuracy
-     */
-
-
-    function init$19() {
-      this.A = [];
-      this.A[1] = 0.6399175073;
-      this.A[2] = -0.1358797613;
-      this.A[3] = 0.063294409;
-      this.A[4] = -0.02526853;
-      this.A[5] = 0.0117879;
-      this.A[6] = -0.0055161;
-      this.A[7] = 0.0026906;
-      this.A[8] = -0.001333;
-      this.A[9] = 0.00067;
-      this.A[10] = -0.00034;
-
-      this.B_re = [];
-      this.B_im = [];
-      this.B_re[1] = 0.7557853228;
-      this.B_im[1] = 0;
-      this.B_re[2] = 0.249204646;
-      this.B_im[2] = 0.003371507;
-      this.B_re[3] = -0.001541739;
-      this.B_im[3] = 0.041058560;
-      this.B_re[4] = -0.10162907;
-      this.B_im[4] = 0.01727609;
-      this.B_re[5] = -0.26623489;
-      this.B_im[5] = -0.36249218;
-      this.B_re[6] = -0.6870983;
-      this.B_im[6] = -1.1651967;
-
-      this.C_re = [];
-      this.C_im = [];
-      this.C_re[1] = 1.3231270439;
-      this.C_im[1] = 0;
-      this.C_re[2] = -0.577245789;
-      this.C_im[2] = -0.007809598;
-      this.C_re[3] = 0.508307513;
-      this.C_im[3] = -0.112208952;
-      this.C_re[4] = -0.15094762;
-      this.C_im[4] = 0.18200602;
-      this.C_re[5] = 1.01418179;
-      this.C_im[5] = 1.64497696;
-      this.C_re[6] = 1.9660549;
-      this.C_im[6] = 2.5127645;
-
-      this.D = [];
-      this.D[1] = 1.5627014243;
-      this.D[2] = 0.5185406398;
-      this.D[3] = -0.03333098;
-      this.D[4] = -0.1052906;
-      this.D[5] = -0.0368594;
-      this.D[6] = 0.007317;
-      this.D[7] = 0.01220;
-      this.D[8] = 0.00394;
-      this.D[9] = -0.0013;
-    }
-
-    /**
-        New Zealand Map Grid Forward  - long/lat to x/y
-        long/lat in radians
-      */
-    function forward$18(p) {
-      var n;
-      var lon = p.x;
-      var lat = p.y;
-
-      var delta_lat = lat - this.lat0;
-      var delta_lon = lon - this.long0;
-
-      // 1. Calculate d_phi and d_psi    ...                          // and d_lambda
-      // For this algorithm, delta_latitude is in seconds of arc x 10-5, so we need to scale to those units. Longitude is radians.
-      var d_phi = delta_lat / SEC_TO_RAD * 1E-5;
-      var d_lambda = delta_lon;
-      var d_phi_n = 1; // d_phi^0
-
-      var d_psi = 0;
-      for (n = 1; n <= 10; n++) {
-        d_phi_n = d_phi_n * d_phi;
-        d_psi = d_psi + this.A[n] * d_phi_n;
-      }
-
-      // 2. Calculate theta
-      var th_re = d_psi;
-      var th_im = d_lambda;
-
-      // 3. Calculate z
-      var th_n_re = 1;
-      var th_n_im = 0; // theta^0
-      var th_n_re1;
-      var th_n_im1;
-
-      var z_re = 0;
-      var z_im = 0;
-      for (n = 1; n <= 6; n++) {
-        th_n_re1 = th_n_re * th_re - th_n_im * th_im;
-        th_n_im1 = th_n_im * th_re + th_n_re * th_im;
-        th_n_re = th_n_re1;
-        th_n_im = th_n_im1;
-        z_re = z_re + this.B_re[n] * th_n_re - this.B_im[n] * th_n_im;
-        z_im = z_im + this.B_im[n] * th_n_re + this.B_re[n] * th_n_im;
-      }
-
-      // 4. Calculate easting and northing
-      p.x = (z_im * this.a) + this.x0;
-      p.y = (z_re * this.a) + this.y0;
-
-      return p;
-    }
-
-    /**
-        New Zealand Map Grid Inverse  -  x/y to long/lat
-      */
-    function inverse$18(p) {
-      var n;
-      var x = p.x;
-      var y = p.y;
-
-      var delta_x = x - this.x0;
-      var delta_y = y - this.y0;
-
-      // 1. Calculate z
-      var z_re = delta_y / this.a;
-      var z_im = delta_x / this.a;
-
-      // 2a. Calculate theta - first approximation gives km accuracy
-      var z_n_re = 1;
-      var z_n_im = 0; // z^0
-      var z_n_re1;
-      var z_n_im1;
-
-      var th_re = 0;
-      var th_im = 0;
-      for (n = 1; n <= 6; n++) {
-        z_n_re1 = z_n_re * z_re - z_n_im * z_im;
-        z_n_im1 = z_n_im * z_re + z_n_re * z_im;
-        z_n_re = z_n_re1;
-        z_n_im = z_n_im1;
-        th_re = th_re + this.C_re[n] * z_n_re - this.C_im[n] * z_n_im;
-        th_im = th_im + this.C_im[n] * z_n_re + this.C_re[n] * z_n_im;
-      }
-
-      // 2b. Iterate to refine the accuracy of the calculation
-      //        0 iterations gives km accuracy
-      //        1 iteration gives m accuracy -- good enough for most mapping applications
-      //        2 iterations bives mm accuracy
-      for (var i = 0; i < this.iterations; i++) {
-        var th_n_re = th_re;
-        var th_n_im = th_im;
-        var th_n_re1;
-        var th_n_im1;
-
-        var num_re = z_re;
-        var num_im = z_im;
-        for (n = 2; n <= 6; n++) {
-          th_n_re1 = th_n_re * th_re - th_n_im * th_im;
-          th_n_im1 = th_n_im * th_re + th_n_re * th_im;
-          th_n_re = th_n_re1;
-          th_n_im = th_n_im1;
-          num_re = num_re + (n - 1) * (this.B_re[n] * th_n_re - this.B_im[n] * th_n_im);
-          num_im = num_im + (n - 1) * (this.B_im[n] * th_n_re + this.B_re[n] * th_n_im);
-        }
-
-        th_n_re = 1;
-        th_n_im = 0;
-        var den_re = this.B_re[1];
-        var den_im = this.B_im[1];
-        for (n = 2; n <= 6; n++) {
-          th_n_re1 = th_n_re * th_re - th_n_im * th_im;
-          th_n_im1 = th_n_im * th_re + th_n_re * th_im;
-          th_n_re = th_n_re1;
-          th_n_im = th_n_im1;
-          den_re = den_re + n * (this.B_re[n] * th_n_re - this.B_im[n] * th_n_im);
-          den_im = den_im + n * (this.B_im[n] * th_n_re + this.B_re[n] * th_n_im);
-        }
-
-        // Complex division
-        var den2 = den_re * den_re + den_im * den_im;
-        th_re = (num_re * den_re + num_im * den_im) / den2;
-        th_im = (num_im * den_re - num_re * den_im) / den2;
-      }
-
-      // 3. Calculate d_phi              ...                                    // and d_lambda
-      var d_psi = th_re;
-      var d_lambda = th_im;
-      var d_psi_n = 1; // d_psi^0
-
-      var d_phi = 0;
-      for (n = 1; n <= 9; n++) {
-        d_psi_n = d_psi_n * d_psi;
-        d_phi = d_phi + this.D[n] * d_psi_n;
-      }
-
-      // 4. Calculate latitude and longitude
-      // d_phi is calcuated in second of arc * 10^-5, so we need to scale back to radians. d_lambda is in radians.
-      var lat = this.lat0 + (d_phi * SEC_TO_RAD * 1E5);
-      var lon = this.long0 + d_lambda;
-
-      p.x = lon;
-      p.y = lat;
-
-      return p;
-    }
-
-    var names$20 = ["New_Zealand_Map_Grid", "nzmg"];
-    var nzmg = {
-      init: init$19,
-      forward: forward$18,
-      inverse: inverse$18,
-      names: names$20
-    };
-
-    /*
-      reference
-        "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder,
-        The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355.
-      */
-
-
-    /* Initialize the Miller Cylindrical projection
-      -------------------------------------------*/
-    function init$20() {
-      //no-op
-    }
-
-    /* Miller Cylindrical forward equations--mapping lat,long to x,y
-        ------------------------------------------------------------*/
-    function forward$19(p) {
-      var lon = p.x;
-      var lat = p.y;
-      /* Forward equations
-          -----------------*/
-      var dlon = adjust_lon(lon - this.long0);
-      var x = this.x0 + this.a * dlon;
-      var y = this.y0 + this.a * Math.log(Math.tan((Math.PI / 4) + (lat / 2.5))) * 1.25;
-
-      p.x = x;
-      p.y = y;
-      return p;
-    }
-
-    /* Miller Cylindrical inverse equations--mapping x,y to lat/long
-        ------------------------------------------------------------*/
-    function inverse$19(p) {
-      p.x -= this.x0;
-      p.y -= this.y0;
-
-      var lon = adjust_lon(this.long0 + p.x / this.a);
-      var lat = 2.5 * (Math.atan(Math.exp(0.8 * p.y / this.a)) - Math.PI / 4);
-
-      p.x = lon;
-      p.y = lat;
-      return p;
-    }
-
-    var names$21 = ["Miller_Cylindrical", "mill"];
-    var mill = {
-      init: init$20,
-      forward: forward$19,
-      inverse: inverse$19,
-      names: names$21
-    };
-
-    var MAX_ITER$3 = 20;
-    function init$21() {
-      /* Place parameters in static storage for common use
-        -------------------------------------------------*/
-
-
-      if (!this.sphere) {
-        this.en = pj_enfn(this.es);
-      }
-      else {
-        this.n = 1;
-        this.m = 0;
-        this.es = 0;
-        this.C_y = Math.sqrt((this.m + 1) / this.n);
-        this.C_x = this.C_y / (this.m + 1);
-      }
-
-    }
-
-    /* Sinusoidal forward equations--mapping lat,long to x,y
-      -----------------------------------------------------*/
-    function forward$20(p) {
-      var x, y;
-      var lon = p.x;
-      var lat = p.y;
-      /* Forward equations
-        -----------------*/
-      lon = adjust_lon(lon - this.long0);
-
-      if (this.sphere) {
-        if (!this.m) {
-          lat = this.n !== 1 ? Math.asin(this.n * Math.sin(lat)) : lat;
-        }
-        else {
-          var k = this.n * Math.sin(lat);
-          for (var i = MAX_ITER$3; i; --i) {
-            var V = (this.m * lat + Math.sin(lat) - k) / (this.m + Math.cos(lat));
-            lat -= V;
-            if (Math.abs(V) < EPSLN) {
-              break;
-            }
-          }
-        }
-        x = this.a * this.C_x * lon * (this.m + Math.cos(lat));
-        y = this.a * this.C_y * lat;
-
-      }
-      else {
-
-        var s = Math.sin(lat);
-        var c = Math.cos(lat);
-        y = this.a * pj_mlfn(lat, s, c, this.en);
-        x = this.a * lon * c / Math.sqrt(1 - this.es * s * s);
-      }
-
-      p.x = x;
-      p.y = y;
-      return p;
-    }
-
-    function inverse$20(p) {
-      var lat, temp, lon, s;
-
-      p.x -= this.x0;
-      lon = p.x / this.a;
-      p.y -= this.y0;
-      lat = p.y / this.a;
-
-      if (this.sphere) {
-        lat /= this.C_y;
-        lon = lon / (this.C_x * (this.m + Math.cos(lat)));
-        if (this.m) {
-          lat = asinz((this.m * lat + Math.sin(lat)) / this.n);
-        }
-        else if (this.n !== 1) {
-          lat = asinz(Math.sin(lat) / this.n);
-        }
-        lon = adjust_lon(lon + this.long0);
-        lat = adjust_lat(lat);
-      }
-      else {
-        lat = pj_inv_mlfn(p.y / this.a, this.es, this.en);
-        s = Math.abs(lat);
-        if (s < HALF_PI) {
-          s = Math.sin(lat);
-          temp = this.long0 + p.x * Math.sqrt(1 - this.es * s * s) / (this.a * Math.cos(lat));
-          //temp = this.long0 + p.x / (this.a * Math.cos(lat));
-          lon = adjust_lon(temp);
-        }
-        else if ((s - EPSLN) < HALF_PI) {
-          lon = this.long0;
-        }
-      }
-      p.x = lon;
-      p.y = lat;
-      return p;
-    }
-
-    var names$22 = ["Sinusoidal", "sinu"];
-    var sinu = {
-      init: init$21,
-      forward: forward$20,
-      inverse: inverse$20,
-      names: names$22
-    };
-
-    function init$22() {}
-    /* Mollweide forward equations--mapping lat,long to x,y
-        ----------------------------------------------------*/
-    function forward$21(p) {
-
-      /* Forward equations
-          -----------------*/
-      var lon = p.x;
-      var lat = p.y;
-
-      var delta_lon = adjust_lon(lon - this.long0);
-      var theta = lat;
-      var con = Math.PI * Math.sin(lat);
-
-      /* Iterate using the Newton-Raphson method to find theta
-          -----------------------------------------------------*/
-      while (true) {
-        var delta_theta = -(theta + Math.sin(theta) - con) / (1 + Math.cos(theta));
-        theta += delta_theta;
-        if (Math.abs(delta_theta) < EPSLN) {
-          break;
-        }
-      }
-      theta /= 2;
-
-      /* If the latitude is 90 deg, force the x coordinate to be "0 + false easting"
-           this is done here because of precision problems with "cos(theta)"
-           --------------------------------------------------------------------------*/
-      if (Math.PI / 2 - Math.abs(lat) < EPSLN) {
-        delta_lon = 0;
-      }
-      var x = 0.900316316158 * this.a * delta_lon * Math.cos(theta) + this.x0;
-      var y = 1.4142135623731 * this.a * Math.sin(theta) + this.y0;
-
-      p.x = x;
-      p.y = y;
-      return p;
-    }
-
-    function inverse$21(p) {
-      var theta;
-      var arg;
-
-      /* Inverse equations
-          -----------------*/
-      p.x -= this.x0;
-      p.y -= this.y0;
-      arg = p.y / (1.4142135623731 * this.a);
-
-      /* Because of division by zero problems, 'arg' can not be 1.  Therefore
-           a number very close to one is used instead.
-           -------------------------------------------------------------------*/
-      if (Math.abs(arg) > 0.999999999999) {
-        arg = 0.999999999999;
-      }
-      theta = Math.asin(arg);
-      var lon = adjust_lon(this.long0 + (p.x / (0.900316316158 * this.a * Math.cos(theta))));
-      if (lon < (-Math.PI)) {
-        lon = -Math.PI;
-      }
-      if (lon > Math.PI) {
-        lon = Math.PI;
-      }
-      arg = (2 * theta + Math.sin(2 * theta)) / Math.PI;
-      if (Math.abs(arg) > 1) {
-        arg = 1;
-      }
-      var lat = Math.asin(arg);
-
-      p.x = lon;
-      p.y = lat;
-      return p;
-    }
-
-    var names$23 = ["Mollweide", "moll"];
-    var moll = {
-      init: init$22,
-      forward: forward$21,
-      inverse: inverse$21,
-      names: names$23
-    };
-
-    function init$23() {
-
-      /* Place parameters in static storage for common use
-          -------------------------------------------------*/
-      // Standard Parallels cannot be equal and on opposite sides of the equator
-      if (Math.abs(this.lat1 + this.lat2) < EPSLN) {
-        return;
-      }
-      this.lat2 = this.lat2 || this.lat1;
-      this.temp = this.b / this.a;
-      this.es = 1 - Math.pow(this.temp, 2);
-      this.e = Math.sqrt(this.es);
-      this.e0 = e0fn(this.es);
-      this.e1 = e1fn(this.es);
-      this.e2 = e2fn(this.es);
-      this.e3 = e3fn(this.es);
-
-      this.sinphi = Math.sin(this.lat1);
-      this.cosphi = Math.cos(this.lat1);
-
-      this.ms1 = msfnz(this.e, this.sinphi, this.cosphi);
-      this.ml1 = mlfn(this.e0, this.e1, this.e2, this.e3, this.lat1);
-
-      if (Math.abs(this.lat1 - this.lat2) < EPSLN) {
-        this.ns = this.sinphi;
-      }
-      else {
-        this.sinphi = Math.sin(this.lat2);
-        this.cosphi = Math.cos(this.lat2);
-        this.ms2 = msfnz(this.e, this.sinphi, this.cosphi);
-        this.ml2 = mlfn(this.e0, this.e1, this.e2, this.e3, this.lat2);
-        this.ns = (this.ms1 - this.ms2) / (this.ml2 - this.ml1);
-      }
-      this.g = this.ml1 + this.ms1 / this.ns;
-      this.ml0 = mlfn(this.e0, this.e1, this.e2, this.e3, this.lat0);
-      this.rh = this.a * (this.g - this.ml0);
-    }
-
-    /* Equidistant Conic forward equations--mapping lat,long to x,y
-      -----------------------------------------------------------*/
-    function forward$22(p) {
-      var lon = p.x;
-      var lat = p.y;
-      var rh1;
-
-      /* Forward equations
-          -----------------*/
-      if (this.sphere) {
-        rh1 = this.a * (this.g - lat);
-      }
-      else {
-        var ml = mlfn(this.e0, this.e1, this.e2, this.e3, lat);
-        rh1 = this.a * (this.g - ml);
-      }
-      var theta = this.ns * adjust_lon(lon - this.long0);
-      var x = this.x0 + rh1 * Math.sin(theta);
-      var y = this.y0 + this.rh - rh1 * Math.cos(theta);
-      p.x = x;
-      p.y = y;
-      return p;
-    }
-
-    /* Inverse equations
-      -----------------*/
-    function inverse$22(p) {
-      p.x -= this.x0;
-      p.y = this.rh - p.y + this.y0;
-      var con, rh1, lat, lon;
-      if (this.ns >= 0) {
-        rh1 = Math.sqrt(p.x * p.x + p.y * p.y);
-        con = 1;
-      }
-      else {
-        rh1 = -Math.sqrt(p.x * p.x + p.y * p.y);
-        con = -1;
-      }
-      var theta = 0;
-      if (rh1 !== 0) {
-        theta = Math.atan2(con * p.x, con * p.y);
-      }
-
-      if (this.sphere) {
-        lon = adjust_lon(this.long0 + theta / this.ns);
-        lat = adjust_lat(this.g - rh1 / this.a);
-        p.x = lon;
-        p.y = lat;
-        return p;
-      }
-      else {
-        var ml = this.g - rh1 / this.a;
-        lat = imlfn(ml, this.e0, this.e1, this.e2, this.e3);
-        lon = adjust_lon(this.long0 + theta / this.ns);
-        p.x = lon;
-        p.y = lat;
-        return p;
-      }
-
-    }
-
-    var names$24 = ["Equidistant_Conic", "eqdc"];
-    var eqdc = {
-      init: init$23,
-      forward: forward$22,
-      inverse: inverse$22,
-      names: names$24
-    };
-
-    /* Initialize the Van Der Grinten projection
-      ----------------------------------------*/
-    function init$24() {
-      //this.R = 6370997; //Radius of earth
-      this.R = this.a;
-    }
-
-    function forward$23(p) {
-
-      var lon = p.x;
-      var lat = p.y;
-
-      /* Forward equations
-        -----------------*/
-      var dlon = adjust_lon(lon - this.long0);
-      var x, y;
-
-      if (Math.abs(lat) <= EPSLN) {
-        x = this.x0 + this.R * dlon;
-        y = this.y0;
-      }
-      var theta = asinz(2 * Math.abs(lat / Math.PI));
-      if ((Math.abs(dlon) <= EPSLN) || (Math.abs(Math.abs(lat) - HALF_PI) <= EPSLN)) {
-        x = this.x0;
-        if (lat >= 0) {
-          y = this.y0 + Math.PI * this.R * Math.tan(0.5 * theta);
-        }
-        else {
-          y = this.y0 + Math.PI * this.R * -Math.tan(0.5 * theta);
-        }
-        //  return(OK);
-      }
-      var al = 0.5 * Math.abs((Math.PI / dlon) - (dlon / Math.PI));
-      var asq = al * al;
-      var sinth = Math.sin(theta);
-      var costh = Math.cos(theta);
-
-      var g = costh / (sinth + costh - 1);
-      var gsq = g * g;
-      var m = g * (2 / sinth - 1);
-      var msq = m * m;
-      var con = Math.PI * this.R * (al * (g - msq) + Math.sqrt(asq * (g - msq) * (g - msq) - (msq + asq) * (gsq - msq))) / (msq + asq);
-      if (dlon < 0) {
-        con = -con;
-      }
-      x = this.x0 + con;
-      //con = Math.abs(con / (Math.PI * this.R));
-      var q = asq + g;
-      con = Math.PI * this.R * (m * q - al * Math.sqrt((msq + asq) * (asq + 1) - q * q)) / (msq + asq);
-      if (lat >= 0) {
-        //y = this.y0 + Math.PI * this.R * Math.sqrt(1 - con * con - 2 * al * con);
-        y = this.y0 + con;
-      }
-      else {
-        //y = this.y0 - Math.PI * this.R * Math.sqrt(1 - con * con - 2 * al * con);
-        y = this.y0 - con;
-      }
-      p.x = x;
-      p.y = y;
-      return p;
-    }
-
-    /* Van Der Grinten inverse equations--mapping x,y to lat/long
-      ---------------------------------------------------------*/
-    function inverse$23(p) {
-      var lon, lat;
-      var xx, yy, xys, c1, c2, c3;
-      var a1;
-      var m1;
-      var con;
-      var th1;
-      var d;
-
-      /* inverse equations
-        -----------------*/
-      p.x -= this.x0;
-      p.y -= this.y0;
-      con = Math.PI * this.R;
-      xx = p.x / con;
-      yy = p.y / con;
-      xys = xx * xx + yy * yy;
-      c1 = -Math.abs(yy) * (1 + xys);
-      c2 = c1 - 2 * yy * yy + xx * xx;
-      c3 = -2 * c1 + 1 + 2 * yy * yy + xys * xys;
-      d = yy * yy / c3 + (2 * c2 * c2 * c2 / c3 / c3 / c3 - 9 * c1 * c2 / c3 / c3) / 27;
-      a1 = (c1 - c2 * c2 / 3 / c3) / c3;
-      m1 = 2 * Math.sqrt(-a1 / 3);
-      con = ((3 * d) / a1) / m1;
-      if (Math.abs(con) > 1) {
-        if (con >= 0) {
-          con = 1;
-        }
-        else {
-          con = -1;
-        }
-      }
-      th1 = Math.acos(con) / 3;
-      if (p.y >= 0) {
-        lat = (-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;
-      }
-      else {
-        lat = -(-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;
-      }
-
-      if (Math.abs(xx) < EPSLN) {
-        lon = this.long0;
-      }
-      else {
-        lon = adjust_lon(this.long0 + Math.PI * (xys - 1 + Math.sqrt(1 + 2 * (xx * xx - yy * yy) + xys * xys)) / 2 / xx);
-      }
-
-      p.x = lon;
-      p.y = lat;
-      return p;
-    }
-
-    var names$25 = ["Van_der_Grinten_I", "VanDerGrinten", "vandg"];
-    var vandg = {
-      init: init$24,
-      forward: forward$23,
-      inverse: inverse$23,
-      names: names$25
-    };
-
-    function init$25() {
-      this.sin_p12 = Math.sin(this.lat0);
-      this.cos_p12 = Math.cos(this.lat0);
-    }
-
-    function forward$24(p) {
-      var lon = p.x;
-      var lat = p.y;
-      var sinphi = Math.sin(p.y);
-      var cosphi = Math.cos(p.y);
-      var dlon = adjust_lon(lon - this.long0);
-      var e0, e1, e2, e3, Mlp, Ml, tanphi, Nl1, Nl, psi, Az, G, H, GH, Hs, c, kp, cos_c, s, s2, s3, s4, s5;
-      if (this.sphere) {
-        if (Math.abs(this.sin_p12 - 1) <= EPSLN) {
-          //North Pole case
-          p.x = this.x0 + this.a * (HALF_PI - lat) * Math.sin(dlon);
-          p.y = this.y0 - this.a * (HALF_PI - lat) * Math.cos(dlon);
-          return p;
-        }
-        else if (Math.abs(this.sin_p12 + 1) <= EPSLN) {
-          //South Pole case
-          p.x = this.x0 + this.a * (HALF_PI + lat) * Math.sin(dlon);
-          p.y = this.y0 + this.a * (HALF_PI + lat) * Math.cos(dlon);
-          return p;
-        }
-        else {
-          //default case
-          cos_c = this.sin_p12 * sinphi + this.cos_p12 * cosphi * Math.cos(dlon);
-          c = Math.acos(cos_c);
-          kp = c ? c / Math.sin(c) : 1;
-          p.x = this.x0 + this.a * kp * cosphi * Math.sin(dlon);
-          p.y = this.y0 + this.a * kp * (this.cos_p12 * sinphi - this.sin_p12 * cosphi * Math.cos(dlon));
-          return p;
-        }
-      }
-      else {
-        e0 = e0fn(this.es);
-        e1 = e1fn(this.es);
-        e2 = e2fn(this.es);
-        e3 = e3fn(this.es);
-        if (Math.abs(this.sin_p12 - 1) <= EPSLN) {
-          //North Pole case
-          Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);
-          Ml = this.a * mlfn(e0, e1, e2, e3, lat);
-          p.x = this.x0 + (Mlp - Ml) * Math.sin(dlon);
-          p.y = this.y0 - (Mlp - Ml) * Math.cos(dlon);
-          return p;
-        }
-        else if (Math.abs(this.sin_p12 + 1) <= EPSLN) {
-          //South Pole case
-          Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);
-          Ml = this.a * mlfn(e0, e1, e2, e3, lat);
-          p.x = this.x0 + (Mlp + Ml) * Math.sin(dlon);
-          p.y = this.y0 + (Mlp + Ml) * Math.cos(dlon);
-          return p;
-        }
-        else {
-          //Default case
-          tanphi = sinphi / cosphi;
-          Nl1 = gN(this.a, this.e, this.sin_p12);
-          Nl = gN(this.a, this.e, sinphi);
-          psi = Math.atan((1 - this.es) * tanphi + this.es * Nl1 * this.sin_p12 / (Nl * cosphi));
-          Az = Math.atan2(Math.sin(dlon), this.cos_p12 * Math.tan(psi) - this.sin_p12 * Math.cos(dlon));
-          if (Az === 0) {
-            s = Math.asin(this.cos_p12 * Math.sin(psi) - this.sin_p12 * Math.cos(psi));
-          }
-          else if (Math.abs(Math.abs(Az) - Math.PI) <= EPSLN) {
-            s = -Math.asin(this.cos_p12 * Math.sin(psi) - this.sin_p12 * Math.cos(psi));
-          }
-          else {
-            s = Math.asin(Math.sin(dlon) * Math.cos(psi) / Math.sin(Az));
-          }
-          G = this.e * this.sin_p12 / Math.sqrt(1 - this.es);
-          H = this.e * this.cos_p12 * Math.cos(Az) / Math.sqrt(1 - this.es);
-          GH = G * H;
-          Hs = H * H;
-          s2 = s * s;
-          s3 = s2 * s;
-          s4 = s3 * s;
-          s5 = s4 * s;
-          c = Nl1 * s * (1 - s2 * Hs * (1 - Hs) / 6 + s3 / 8 * GH * (1 - 2 * Hs) + s4 / 120 * (Hs * (4 - 7 * Hs) - 3 * G * G * (1 - 7 * Hs)) - s5 / 48 * GH);
-          p.x = this.x0 + c * Math.sin(Az);
-          p.y = this.y0 + c * Math.cos(Az);
-          return p;
-        }
-      }
-
-
-    }
-
-    function inverse$24(p) {
-      p.x -= this.x0;
-      p.y -= this.y0;
-      var rh, z, sinz, cosz, lon, lat, con, e0, e1, e2, e3, Mlp, M, N1, psi, Az, cosAz, tmp, A, B, D, Ee, F, sinpsi;
-      if (this.sphere) {
-        rh = Math.sqrt(p.x * p.x + p.y * p.y);
-        if (rh > (2 * HALF_PI * this.a)) {
-          return;
-        }
-        z = rh / this.a;
-
-        sinz = Math.sin(z);
-        cosz = Math.cos(z);
-
-        lon = this.long0;
-        if (Math.abs(rh) <= EPSLN) {
-          lat = this.lat0;
-        }
-        else {
-          lat = asinz(cosz * this.sin_p12 + (p.y * sinz * this.cos_p12) / rh);
-          con = Math.abs(this.lat0) - HALF_PI;
-          if (Math.abs(con) <= EPSLN) {
-            if (this.lat0 >= 0) {
-              lon = adjust_lon(this.long0 + Math.atan2(p.x, - p.y));
-            }
-            else {
-              lon = adjust_lon(this.long0 - Math.atan2(-p.x, p.y));
-            }
-          }
-          else {
-            /*con = cosz - this.sin_p12 * Math.sin(lat);
-            if ((Math.abs(con) < EPSLN) && (Math.abs(p.x) < EPSLN)) {
-              //no-op, just keep the lon value as is
-            } else {
-              var temp = Math.atan2((p.x * sinz * this.cos_p12), (con * rh));
-              lon = adjust_lon(this.long0 + Math.atan2((p.x * sinz * this.cos_p12), (con * rh)));
-            }*/
-            lon = adjust_lon(this.long0 + Math.atan2(p.x * sinz, rh * this.cos_p12 * cosz - p.y * this.sin_p12 * sinz));
-          }
-        }
-
-        p.x = lon;
-        p.y = lat;
-        return p;
-      }
-      else {
-        e0 = e0fn(this.es);
-        e1 = e1fn(this.es);
-        e2 = e2fn(this.es);
-        e3 = e3fn(this.es);
-        if (Math.abs(this.sin_p12 - 1) <= EPSLN) {
-          //North pole case
-          Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);
-          rh = Math.sqrt(p.x * p.x + p.y * p.y);
-          M = Mlp - rh;
-          lat = imlfn(M / this.a, e0, e1, e2, e3);
-          lon = adjust_lon(this.long0 + Math.atan2(p.x, - 1 * p.y));
-          p.x = lon;
-          p.y = lat;
-          return p;
-        }
-        else if (Math.abs(this.sin_p12 + 1) <= EPSLN) {
-          //South pole case
-          Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);
-          rh = Math.sqrt(p.x * p.x + p.y * p.y);
-          M = rh - Mlp;
-
-          lat = imlfn(M / this.a, e0, e1, e2, e3);
-          lon = adjust_lon(this.long0 + Math.atan2(p.x, p.y));
-          p.x = lon;
-          p.y = lat;
-          return p;
-        }
-        else {
-          //default case
-          rh = Math.sqrt(p.x * p.x + p.y * p.y);
-          Az = Math.atan2(p.x, p.y);
-          N1 = gN(this.a, this.e, this.sin_p12);
-          cosAz = Math.cos(Az);
-          tmp = this.e * this.cos_p12 * cosAz;
-          A = -tmp * tmp / (1 - this.es);
-          B = 3 * this.es * (1 - A) * this.sin_p12 * this.cos_p12 * cosAz / (1 - this.es);
-          D = rh / N1;
-          Ee = D - A * (1 + A) * Math.pow(D, 3) / 6 - B * (1 + 3 * A) * Math.pow(D, 4) / 24;
-          F = 1 - A * Ee * Ee / 2 - D * Ee * Ee * Ee / 6;
-          psi = Math.asin(this.sin_p12 * Math.cos(Ee) + this.cos_p12 * Math.sin(Ee) * cosAz);
-          lon = adjust_lon(this.long0 + Math.asin(Math.sin(Az) * Math.sin(Ee) / Math.cos(psi)));
-          sinpsi = Math.sin(psi);
-          lat = Math.atan2((sinpsi - this.es * F * this.sin_p12) * Math.tan(psi), sinpsi * (1 - this.es));
-          p.x = lon;
-          p.y = lat;
-          return p;
-        }
-      }
-
-    }
-
-    var names$26 = ["Azimuthal_Equidistant", "aeqd"];
-    var aeqd = {
-      init: init$25,
-      forward: forward$24,
-      inverse: inverse$24,
-      names: names$26
-    };
-
-    function init$26() {
-      //double temp;      /* temporary variable    */
-
-      /* Place parameters in static storage for common use
-          -------------------------------------------------*/
-      this.sin_p14 = Math.sin(this.lat0);
-      this.cos_p14 = Math.cos(this.lat0);
-    }
-
-    /* Orthographic forward equations--mapping lat,long to x,y
-        ---------------------------------------------------*/
-    function forward$25(p) {
-      var sinphi, cosphi; /* sin and cos value        */
-      var dlon; /* delta longitude value      */
-      var coslon; /* cos of longitude        */
-      var ksp; /* scale factor          */
-      var g, x, y;
-      var lon = p.x;
-      var lat = p.y;
-      /* Forward equations
-          -----------------*/
-      dlon = adjust_lon(lon - this.long0);
-
-      sinphi = Math.sin(lat);
-      cosphi = Math.cos(lat);
-
-      coslon = Math.cos(dlon);
-      g = this.sin_p14 * sinphi + this.cos_p14 * cosphi * coslon;
-      ksp = 1;
-      if ((g > 0) || (Math.abs(g) <= EPSLN)) {
-        x = this.a * ksp * cosphi * Math.sin(dlon);
-        y = this.y0 + this.a * ksp * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon);
-      }
-      p.x = x;
-      p.y = y;
-      return p;
-    }
-
-    function inverse$25(p) {
-      var rh; /* height above ellipsoid      */
-      var z; /* angle          */
-      var sinz, cosz; /* sin of z and cos of z      */
-      var con;
-      var lon, lat;
-      /* Inverse equations
-          -----------------*/
-      p.x -= this.x0;
-      p.y -= this.y0;
-      rh = Math.sqrt(p.x * p.x + p.y * p.y);
-      z = asinz(rh / this.a);
-
-      sinz = Math.sin(z);
-      cosz = Math.cos(z);
-
-      lon = this.long0;
-      if (Math.abs(rh) <= EPSLN) {
-        lat = this.lat0;
-        p.x = lon;
-        p.y = lat;
-        return p;
-      }
-      lat = asinz(cosz * this.sin_p14 + (p.y * sinz * this.cos_p14) / rh);
-      con = Math.abs(this.lat0) - HALF_PI;
-      if (Math.abs(con) <= EPSLN) {
-        if (this.lat0 >= 0) {
-          lon = adjust_lon(this.long0 + Math.atan2(p.x, - p.y));
-        }
-        else {
-          lon = adjust_lon(this.long0 - Math.atan2(-p.x, p.y));
-        }
-        p.x = lon;
-        p.y = lat;
-        return p;
-      }
-      lon = adjust_lon(this.long0 + Math.atan2((p.x * sinz), rh * this.cos_p14 * cosz - p.y * this.sin_p14 * sinz));
-      p.x = lon;
-      p.y = lat;
-      return p;
-    }
-
-    var names$27 = ["ortho"];
-    var ortho = {
-      init: init$26,
-      forward: forward$25,
-      inverse: inverse$25,
-      names: names$27
-    };
-
-    // QSC projection rewritten from the original PROJ4
-    // https://github.com/OSGeo/proj.4/blob/master/src/PJ_qsc.c
-
-    /* constants */
-    var FACE_ENUM = {
-        FRONT: 1,
-        RIGHT: 2,
-        BACK: 3,
-        LEFT: 4,
-        TOP: 5,
-        BOTTOM: 6
-    };
-
-    var AREA_ENUM = {
-        AREA_0: 1,
-        AREA_1: 2,
-        AREA_2: 3,
-        AREA_3: 4
-    };
-
-    function init$27() {
-
-      this.x0 = this.x0 || 0;
-      this.y0 = this.y0 || 0;
-      this.lat0 = this.lat0 || 0;
-      this.long0 = this.long0 || 0;
-      this.lat_ts = this.lat_ts || 0;
-      this.title = this.title || "Quadrilateralized Spherical Cube";
-
-      /* Determine the cube face from the center of projection. */
-      if (this.lat0 >= HALF_PI - FORTPI / 2.0) {
-        this.face = FACE_ENUM.TOP;
-      } else if (this.lat0 <= -(HALF_PI - FORTPI / 2.0)) {
-        this.face = FACE_ENUM.BOTTOM;
-      } else if (Math.abs(this.long0) <= FORTPI) {
-        this.face = FACE_ENUM.FRONT;
-      } else if (Math.abs(this.long0) <= HALF_PI + FORTPI) {
-        this.face = this.long0 > 0.0 ? FACE_ENUM.RIGHT : FACE_ENUM.LEFT;
-      } else {
-        this.face = FACE_ENUM.BACK;
-      }
-
-      /* Fill in useful values for the ellipsoid <-> sphere shift
-       * described in [LK12]. */
-      if (this.es !== 0) {
-        this.one_minus_f = 1 - (this.a - this.b) / this.a;
-        this.one_minus_f_squared = this.one_minus_f * this.one_minus_f;
-      }
-    }
-
-    // QSC forward equations--mapping lat,long to x,y
-    // -----------------------------------------------------------------
-    function forward$26(p) {
-      var xy = {x: 0, y: 0};
-      var lat, lon;
-      var theta, phi;
-      var t, mu;
-      /* nu; */
-      var area = {value: 0};
-
-      // move lon according to projection's lon
-      p.x -= this.long0;
-
-      /* Convert the geodetic latitude to a geocentric latitude.
-       * This corresponds to the shift from the ellipsoid to the sphere
-       * described in [LK12]. */
-      if (this.es !== 0) {//if (P->es != 0) {
-        lat = Math.atan(this.one_minus_f_squared * Math.tan(p.y));
-      } else {
-        lat = p.y;
-      }
-
-      /* Convert the input lat, lon into theta, phi as used by QSC.
-       * This depends on the cube face and the area on it.
-       * For the top and bottom face, we can compute theta and phi
-       * directly from phi, lam. For the other faces, we must use
-       * unit sphere cartesian coordinates as an intermediate step. */
-      lon = p.x; //lon = lp.lam;
-      if (this.face === FACE_ENUM.TOP) {
-        phi = HALF_PI - lat;
-        if (lon >= FORTPI && lon <= HALF_PI + FORTPI) {
-          area.value = AREA_ENUM.AREA_0;
-          theta = lon - HALF_PI;
-        } else if (lon > HALF_PI + FORTPI || lon <= -(HALF_PI + FORTPI)) {
-          area.value = AREA_ENUM.AREA_1;
-          theta = (lon > 0.0 ? lon - SPI : lon + SPI);
-        } else if (lon > -(HALF_PI + FORTPI) && lon <= -FORTPI) {
-          area.value = AREA_ENUM.AREA_2;
-          theta = lon + HALF_PI;
-        } else {
-          area.value = AREA_ENUM.AREA_3;
-          theta = lon;
-        }
-      } else if (this.face === FACE_ENUM.BOTTOM) {
-        phi = HALF_PI + lat;
-        if (lon >= FORTPI && lon <= HALF_PI + FORTPI) {
-          area.value = AREA_ENUM.AREA_0;
-          theta = -lon + HALF_PI;
-        } else if (lon < FORTPI && lon >= -FORTPI) {
-          area.value = AREA_ENUM.AREA_1;
-          theta = -lon;
-        } else if (lon < -FORTPI && lon >= -(HALF_PI + FORTPI)) {
-          area.value = AREA_ENUM.AREA_2;
-          theta = -lon - HALF_PI;
-        } else {
-          area.value = AREA_ENUM.AREA_3;
-          theta = (lon > 0.0 ? -lon + SPI : -lon - SPI);
-        }
-      } else {
-        var q, r, s;
-        var sinlat, coslat;
-        var sinlon, coslon;
-
-        if (this.face === FACE_ENUM.RIGHT) {
-          lon = qsc_shift_lon_origin(lon, +HALF_PI);
-        } else if (this.face === FACE_ENUM.BACK) {
-          lon = qsc_shift_lon_origin(lon, +SPI);
-        } else if (this.face === FACE_ENUM.LEFT) {
-          lon = qsc_shift_lon_origin(lon, -HALF_PI);
-        }
-        sinlat = Math.sin(lat);
-        coslat = Math.cos(lat);
-        sinlon = Math.sin(lon);
-        coslon = Math.cos(lon);
-        q = coslat * coslon;
-        r = coslat * sinlon;
-        s = sinlat;
-
-        if (this.face === FACE_ENUM.FRONT) {
-          phi = Math.acos(q);
-          theta = qsc_fwd_equat_face_theta(phi, s, r, area);
-        } else if (this.face === FACE_ENUM.RIGHT) {
-          phi = Math.acos(r);
-          theta = qsc_fwd_equat_face_theta(phi, s, -q, area);
-        } else if (this.face === FACE_ENUM.BACK) {
-          phi = Math.acos(-q);
-          theta = qsc_fwd_equat_face_theta(phi, s, -r, area);
-        } else if (this.face === FACE_ENUM.LEFT) {
-          phi = Math.acos(-r);
-          theta = qsc_fwd_equat_face_theta(phi, s, q, area);
-        } else {
-          /* Impossible */
-          phi = theta = 0;
-          area.value = AREA_ENUM.AREA_0;
-        }
-      }
-
-      /* Compute mu and nu for the area of definition.
-       * For mu, see Eq. (3-21) in [OL76], but note the typos:
-       * compare with Eq. (3-14). For nu, see Eq. (3-38). */
-      mu = Math.atan((12 / SPI) * (theta + Math.acos(Math.sin(theta) * Math.cos(FORTPI)) - HALF_PI));
-      t = Math.sqrt((1 - Math.cos(phi)) / (Math.cos(mu) * Math.cos(mu)) / (1 - Math.cos(Math.atan(1 / Math.cos(theta)))));
-
-      /* Apply the result to the real area. */
-      if (area.value === AREA_ENUM.AREA_1) {
-        mu += HALF_PI;
-      } else if (area.value === AREA_ENUM.AREA_2) {
-        mu += SPI;
-      } else if (area.value === AREA_ENUM.AREA_3) {
-        mu += 1.5 * SPI;
-      }
-
-      /* Now compute x, y from mu and nu */
-      xy.x = t * Math.cos(mu);
-      xy.y = t * Math.sin(mu);
-      xy.x = xy.x * this.a + this.x0;
-      xy.y = xy.y * this.a + this.y0;
-
-      p.x = xy.x;
-      p.y = xy.y;
-      return p;
-    }
-
-    // QSC inverse equations--mapping x,y to lat/long
-    // -----------------------------------------------------------------
-    function inverse$26(p) {
-      var lp = {lam: 0, phi: 0};
-      var mu, nu, cosmu, tannu;
-      var tantheta, theta, cosphi, phi;
-      var t;
-      var area = {value: 0};
-
-      /* de-offset */
-      p.x = (p.x - this.x0) / this.a;
-      p.y = (p.y - this.y0) / this.a;
-
-      /* Convert the input x, y to the mu and nu angles as used by QSC.
-       * This depends on the area of the cube face. */
-      nu = Math.atan(Math.sqrt(p.x * p.x + p.y * p.y));
-      mu = Math.atan2(p.y, p.x);
-      if (p.x >= 0.0 && p.x >= Math.abs(p.y)) {
-        area.value = AREA_ENUM.AREA_0;
-      } else if (p.y >= 0.0 && p.y >= Math.abs(p.x)) {
-        area.value = AREA_ENUM.AREA_1;
-        mu -= HALF_PI;
-      } else if (p.x < 0.0 && -p.x >= Math.abs(p.y)) {
-        area.value = AREA_ENUM.AREA_2;
-        mu = (mu < 0.0 ? mu + SPI : mu - SPI);
-      } else {
-        area.value = AREA_ENUM.AREA_3;
-        mu += HALF_PI;
-      }
-
-      /* Compute phi and theta for the area of definition.
-       * The inverse projection is not described in the original paper, but some
-       * good hints can be found here (as of 2011-12-14):
-       * http://fits.gsfc.nasa.gov/fitsbits/saf.93/saf.9302
-       * (search for "Message-Id: <9302181759.AA25477 at fits.cv.nrao.edu>") */
-      t = (SPI / 12) * Math.tan(mu);
-      tantheta = Math.sin(t) / (Math.cos(t) - (1 / Math.sqrt(2)));
-      theta = Math.atan(tantheta);
-      cosmu = Math.cos(mu);
-      tannu = Math.tan(nu);
-      cosphi = 1 - cosmu * cosmu * tannu * tannu * (1 - Math.cos(Math.atan(1 / Math.cos(theta))));
-      if (cosphi < -1) {
-        cosphi = -1;
-      } else if (cosphi > +1) {
-        cosphi = +1;
-      }
-
-      /* Apply the result to the real area on the cube face.
-       * For the top and bottom face, we can compute phi and lam directly.
-       * For the other faces, we must use unit sphere cartesian coordinates
-       * as an intermediate step. */
-      if (this.face === FACE_ENUM.TOP) {
-        phi = Math.acos(cosphi);
-        lp.phi = HALF_PI - phi;
-        if (area.value === AREA_ENUM.AREA_0) {
-          lp.lam = theta + HALF_PI;
-        } else if (area.value === AREA_ENUM.AREA_1) {
-          lp.lam = (theta < 0.0 ? theta + SPI : theta - SPI);
-        } else if (area.value === AREA_ENUM.AREA_2) {
-          lp.lam = theta - HALF_PI;
-        } else /* area.value == AREA_ENUM.AREA_3 */ {
-          lp.lam = theta;
-        }
-      } else if (this.face === FACE_ENUM.BOTTOM) {
-        phi = Math.acos(cosphi);
-        lp.phi = phi - HALF_PI;
-        if (area.value === AREA_ENUM.AREA_0) {
-          lp.lam = -theta + HALF_PI;
-        } else if (area.value === AREA_ENUM.AREA_1) {
-          lp.lam = -theta;
-        } else if (area.value === AREA_ENUM.AREA_2) {
-          lp.lam = -theta - HALF_PI;
-        } else /* area.value == AREA_ENUM.AREA_3 */ {
-          lp.lam = (theta < 0.0 ? -theta - SPI : -theta + SPI);
-        }
-      } else {
-        /* Compute phi and lam via cartesian unit sphere coordinates. */
-        var q, r, s;
-        q = cosphi;
-        t = q * q;
-        if (t >= 1) {
-          s = 0;
-        } else {
-          s = Math.sqrt(1 - t) * Math.sin(theta);
-        }
-        t += s * s;
-        if (t >= 1) {
-          r = 0;
-        } else {
-          r = Math.sqrt(1 - t);
-        }
-        /* Rotate q,r,s into the correct area. */
-        if (area.value === AREA_ENUM.AREA_1) {
-          t = r;
-          r = -s;
-          s = t;
-        } else if (area.value === AREA_ENUM.AREA_2) {
-          r = -r;
-          s = -s;
-        } else if (area.value === AREA_ENUM.AREA_3) {
-          t = r;
-          r = s;
-          s = -t;
-        }
-        /* Rotate q,r,s into the correct cube face. */
-        if (this.face === FACE_ENUM.RIGHT) {
-          t = q;
-          q = -r;
-          r = t;
-        } else if (this.face === FACE_ENUM.BACK) {
-          q = -q;
-          r = -r;
-        } else if (this.face === FACE_ENUM.LEFT) {
-          t = q;
-          q = r;
-          r = -t;
-        }
-        /* Now compute phi and lam from the unit sphere coordinates. */
-        lp.phi = Math.acos(-s) - HALF_PI;
-        lp.lam = Math.atan2(r, q);
-        if (this.face === FACE_ENUM.RIGHT) {
-          lp.lam = qsc_shift_lon_origin(lp.lam, -HALF_PI);
-        } else if (this.face === FACE_ENUM.BACK) {
-          lp.lam = qsc_shift_lon_origin(lp.lam, -SPI);
-        } else if (this.face === FACE_ENUM.LEFT) {
-          lp.lam = qsc_shift_lon_origin(lp.lam, +HALF_PI);
-        }
-      }
-
-      /* Apply the shift from the sphere to the ellipsoid as described
-       * in [LK12]. */
-      if (this.es !== 0) {
-        var invert_sign;
-        var tanphi, xa;
-        invert_sign = (lp.phi < 0 ? 1 : 0);
-        tanphi = Math.tan(lp.phi);
-        xa = this.b / Math.sqrt(tanphi * tanphi + this.one_minus_f_squared);
-        lp.phi = Math.atan(Math.sqrt(this.a * this.a - xa * xa) / (this.one_minus_f * xa));
-        if (invert_sign) {
-          lp.phi = -lp.phi;
-        }
-      }
-
-      lp.lam += this.long0;
-      p.x = lp.lam;
-      p.y = lp.phi;
-      return p;
-    }
-
-    /* Helper function for forward projection: compute the theta angle
-     * and determine the area number. */
-    function qsc_fwd_equat_face_theta(phi, y, x, area) {
-      var theta;
-      if (phi < EPSLN) {
-        area.value = AREA_ENUM.AREA_0;
-        theta = 0.0;
-      } else {
-        theta = Math.atan2(y, x);
-        if (Math.abs(theta) <= FORTPI) {
-          area.value = AREA_ENUM.AREA_0;
-        } else if (theta > FORTPI && theta <= HALF_PI + FORTPI) {
-          area.value = AREA_ENUM.AREA_1;
-          theta -= HALF_PI;
-        } else if (theta > HALF_PI + FORTPI || theta <= -(HALF_PI + FORTPI)) {
-          area.value = AREA_ENUM.AREA_2;
-          theta = (theta >= 0.0 ? theta - SPI : theta + SPI);
-        } else {
-          area.value = AREA_ENUM.AREA_3;
-          theta += HALF_PI;
-        }
-      }
-      return theta;
-    }
-
-    /* Helper function: shift the longitude. */
-    function qsc_shift_lon_origin(lon, offset) {
-      var slon = lon + offset;
-      if (slon < -SPI) {
-        slon += TWO_PI;
-      } else if (slon > +SPI) {
-        slon -= TWO_PI;
-      }
-      return slon;
-    }
-
-    var names$28 = ["Quadrilateralized Spherical Cube", "Quadrilateralized_Spherical_Cube", "qsc"];
-    var qsc = {
-      init: init$27,
-      forward: forward$26,
-      inverse: inverse$26,
-      names: names$28
-    };
-
-    // Robinson projection
-    // Based on https://github.com/OSGeo/proj.4/blob/master/src/PJ_robin.c
-    // Polynomial coeficients from http://article.gmane.org/gmane.comp.gis.proj-4.devel/6039
-
-    var COEFS_X = [
-        [1.0000, 2.2199e-17, -7.15515e-05, 3.1103e-06],
-        [0.9986, -0.000482243, -2.4897e-05, -1.3309e-06],
-        [0.9954, -0.00083103, -4.48605e-05, -9.86701e-07],
-        [0.9900, -0.00135364, -5.9661e-05, 3.6777e-06],
-        [0.9822, -0.00167442, -4.49547e-06, -5.72411e-06],
-        [0.9730, -0.00214868, -9.03571e-05, 1.8736e-08],
-        [0.9600, -0.00305085, -9.00761e-05, 1.64917e-06],
-        [0.9427, -0.00382792, -6.53386e-05, -2.6154e-06],
-        [0.9216, -0.00467746, -0.00010457, 4.81243e-06],
-        [0.8962, -0.00536223, -3.23831e-05, -5.43432e-06],
-        [0.8679, -0.00609363, -0.000113898, 3.32484e-06],
-        [0.8350, -0.00698325, -6.40253e-05, 9.34959e-07],
-        [0.7986, -0.00755338, -5.00009e-05, 9.35324e-07],
-        [0.7597, -0.00798324, -3.5971e-05, -2.27626e-06],
-        [0.7186, -0.00851367, -7.01149e-05, -8.6303e-06],
-        [0.6732, -0.00986209, -0.000199569, 1.91974e-05],
-        [0.6213, -0.010418, 8.83923e-05, 6.24051e-06],
-        [0.5722, -0.00906601, 0.000182, 6.24051e-06],
-        [0.5322, -0.00677797, 0.000275608, 6.24051e-06]
-    ];
-
-    var COEFS_Y = [
-        [-5.20417e-18, 0.0124, 1.21431e-18, -8.45284e-11],
-        [0.0620, 0.0124, -1.26793e-09, 4.22642e-10],
-        [0.1240, 0.0124, 5.07171e-09, -1.60604e-09],
-        [0.1860, 0.0123999, -1.90189e-08, 6.00152e-09],
-        [0.2480, 0.0124002, 7.10039e-08, -2.24e-08],
-        [0.3100, 0.0123992, -2.64997e-07, 8.35986e-08],
-        [0.3720, 0.0124029, 9.88983e-07, -3.11994e-07],
-        [0.4340, 0.0123893, -3.69093e-06, -4.35621e-07],
-        [0.4958, 0.0123198, -1.02252e-05, -3.45523e-07],
-        [0.5571, 0.0121916, -1.54081e-05, -5.82288e-07],
-        [0.6176, 0.0119938, -2.41424e-05, -5.25327e-07],
-        [0.6769, 0.011713, -3.20223e-05, -5.16405e-07],
-        [0.7346, 0.0113541, -3.97684e-05, -6.09052e-07],
-        [0.7903, 0.0109107, -4.89042e-05, -1.04739e-06],
-        [0.8435, 0.0103431, -6.4615e-05, -1.40374e-09],
-        [0.8936, 0.00969686, -6.4636e-05, -8.547e-06],
-        [0.9394, 0.00840947, -0.000192841, -4.2106e-06],
-        [0.9761, 0.00616527, -0.000256, -4.2106e-06],
-        [1.0000, 0.00328947, -0.000319159, -4.2106e-06]
-    ];
-
-    var FXC = 0.8487;
-    var FYC = 1.3523;
-    var C1 = R2D/5; // rad to 5-degree interval
-    var RC1 = 1/C1;
-    var NODES = 18;
-
-    var poly3_val = function(coefs, x) {
-        return coefs[0] + x * (coefs[1] + x * (coefs[2] + x * coefs[3]));
-    };
-
-    var poly3_der = function(coefs, x) {
-        return coefs[1] + x * (2 * coefs[2] + x * 3 * coefs[3]);
-    };
-
-    function newton_rapshon(f_df, start, max_err, iters) {
-        var x = start;
-        for (; iters; --iters) {
-            var upd = f_df(x);
-            x -= upd;
-            if (Math.abs(upd) < max_err) {
-                break;
-            }
-        }
-        return x;
-    }
-
-    function init$28() {
-        this.x0 = this.x0 || 0;
-        this.y0 = this.y0 || 0;
-        this.long0 = this.long0 || 0;
-        this.es = 0;
-        this.title = this.title || "Robinson";
-    }
-
-    function forward$27(ll) {
-        var lon = adjust_lon(ll.x - this.long0);
-
-        var dphi = Math.abs(ll.y);
-        var i = Math.floor(dphi * C1);
-        if (i < 0) {
-            i = 0;
-        } else if (i >= NODES) {
-            i = NODES - 1;
-        }
-        dphi = R2D * (dphi - RC1 * i);
-        var xy = {
-            x: poly3_val(COEFS_X[i], dphi) * lon,
-            y: poly3_val(COEFS_Y[i], dphi)
-        };
-        if (ll.y < 0) {
-            xy.y = -xy.y;
-        }
-
-        xy.x = xy.x * this.a * FXC + this.x0;
-        xy.y = xy.y * this.a * FYC + this.y0;
-        return xy;
-    }
-
-    function inverse$27(xy) {
-        var ll = {
-            x: (xy.x - this.x0) / (this.a * FXC),
-            y: Math.abs(xy.y - this.y0) / (this.a * FYC)
-        };
-
-        if (ll.y >= 1) { // pathologic case
-            ll.x /= COEFS_X[NODES][0];
-            ll.y = xy.y < 0 ? -HALF_PI : HALF_PI;
-        } else {
-            // find table interval
-            var i = Math.floor(ll.y * NODES);
-            if (i < 0) {
-                i = 0;
-            } else if (i >= NODES) {
-                i = NODES - 1;
-            }
-            for (;;) {
-                if (COEFS_Y[i][0] > ll.y) {
-                    --i;
-                } else if (COEFS_Y[i+1][0] <= ll.y) {
-                    ++i;
-                } else {
-                    break;
-                }
-            }
-            // linear interpolation in 5 degree interval
-            var coefs = COEFS_Y[i];
-            var t = 5 * (ll.y - coefs[0]) / (COEFS_Y[i+1][0] - coefs[0]);
-            // find t so that poly3_val(coefs, t) = ll.y
-            t = newton_rapshon(function(x) {
-                return (poly3_val(coefs, x) - ll.y) / poly3_der(coefs, x);
-            }, t, EPSLN, 100);
-
-            ll.x /= poly3_val(COEFS_X[i], t);
-            ll.y = (5 * i + t) * D2R;
-            if (xy.y < 0) {
-                ll.y = -ll.y;
-            }
-        }
-
-        ll.x = adjust_lon(ll.x + this.long0);
-        return ll;
-    }
-
-    var names$29 = ["Robinson", "robin"];
-    var robin = {
-      init: init$28,
-      forward: forward$27,
-      inverse: inverse$27,
-      names: names$29
-    };
-
-    function init$29() {
-        this.name = 'geocent';
-
-    }
-
-    function forward$28(p) {
-        var point = geodeticToGeocentric(p, this.es, this.a);
-        return point;
-    }
-
-    function inverse$28(p) {
-        var point = geocentricToGeodetic(p, this.es, this.a, this.b);
-        return point;
-    }
-
-    var names$30 = ["Geocentric", 'geocentric', "geocent", "Geocent"];
-    var geocent = {
-        init: init$29,
-        forward: forward$28,
-        inverse: inverse$28,
-        names: names$30
-    };
-
-    var includedProjections = function(proj4){
-      proj4.Proj.projections.add(tmerc);
-      proj4.Proj.projections.add(etmerc);
-      proj4.Proj.projections.add(utm);
-      proj4.Proj.projections.add(sterea);
-      proj4.Proj.projections.add(stere);
-      proj4.Proj.projections.add(somerc);
-      proj4.Proj.projections.add(omerc);
-      proj4.Proj.projections.add(lcc);
-      proj4.Proj.projections.add(krovak);
-      proj4.Proj.projections.add(cass);
-      proj4.Proj.projections.add(laea);
-      proj4.Proj.projections.add(aea);
-      proj4.Proj.projections.add(gnom);
-      proj4.Proj.projections.add(cea);
-      proj4.Proj.projections.add(eqc);
-      proj4.Proj.projections.add(poly);
-      proj4.Proj.projections.add(nzmg);
-      proj4.Proj.projections.add(mill);
-      proj4.Proj.projections.add(sinu);
-      proj4.Proj.projections.add(moll);
-      proj4.Proj.projections.add(eqdc);
-      proj4.Proj.projections.add(vandg);
-      proj4.Proj.projections.add(aeqd);
-      proj4.Proj.projections.add(ortho);
-      proj4.Proj.projections.add(qsc);
-      proj4.Proj.projections.add(robin);
-      proj4.Proj.projections.add(geocent);
-    };
-
-    proj4$1.defaultDatum = 'WGS84'; //default datum
-    proj4$1.Proj = Projection;
-    proj4$1.WGS84 = new proj4$1.Proj('WGS84');
-    proj4$1.Point = Point;
-    proj4$1.toPoint = toPoint;
-    proj4$1.defs = defs;
-    proj4$1.transform = transform;
-    proj4$1.mgrs = mgrs;
-    proj4$1.version = '2.6.2';
-    includedProjections(proj4$1);
-
-    return proj4$1;
-
-})));
diff --git a/multiple-extents/dist/proj4leaflet.js b/multiple-extents/dist/proj4leaflet.js
deleted file mode 100644
index c5a00f6..0000000
--- a/multiple-extents/dist/proj4leaflet.js
+++ /dev/null
@@ -1,272 +0,0 @@
-(function (factory) {
-	var L, proj4;
-	if (typeof define === 'function' && define.amd) {
-		// AMD
-		define(['leaflet', 'proj4'], factory);
-	} else if (typeof module === 'object' && typeof module.exports === "object") {
-		// Node/CommonJS
-		L = require('leaflet');
-		proj4 = require('proj4');
-		module.exports = factory(L, proj4);
-	} else {
-		// Browser globals
-		if (typeof window.L === 'undefined' || typeof window.proj4 === 'undefined')
-			throw 'Leaflet and proj4 must be loaded first';
-		factory(window.L, window.proj4);
-	}
-}(function (L, proj4) {
-	if (proj4.__esModule && proj4.default) {
-		// If proj4 was bundled as an ES6 module, unwrap it to get
-		// to the actual main proj4 object.
-		// See discussion in https://github.com/kartena/Proj4Leaflet/pull/147
-		proj4 = proj4.default;
-	}
- 
-	L.Proj = {};
-
-	L.Proj._isProj4Obj = function(a) {
-		return (typeof a.inverse !== 'undefined' &&
-			typeof a.forward !== 'undefined');
-	};
-
-	L.Proj.Projection = L.Class.extend({
-		initialize: function(code, def, bounds) {
-			var isP4 = L.Proj._isProj4Obj(code);
-			this._proj = isP4 ? code : this._projFromCodeDef(code, def);
-			this.bounds = isP4 ? def : bounds;
-		},
-
-		project: function (latlng) {
-			var point = this._proj.forward([latlng.lng, latlng.lat]);
-			return new L.Point(point[0], point[1]);
-		},
-
-		unproject: function (point, unbounded) {
-			var point2 = this._proj.inverse([point.x, point.y]);
-			return new L.LatLng(point2[1] || 0, point2[0] || 0, unbounded);
-		},
-
-		_projFromCodeDef: function(code, def) {
-			if (def) {
-				proj4.defs(code, def);
-			} else if (proj4.defs[code] === undefined) {
-				var urn = code.split(':');
-				if (urn.length > 3) {
-					code = urn[urn.length - 3] + ':' + urn[urn.length - 1];
-				}
-				if (proj4.defs[code] === undefined) {
-					throw 'No projection definition for code ' + code;
-				}
-			}
-
-			return proj4(code);
-		}
-	});
-
-	L.Proj.CRS = L.Class.extend({
-		includes: L.CRS,
-
-		options: {
-			transformation: new L.Transformation(1, 0, -1, 0)
-		},
-
-		initialize: function(a, b, c) {
-			var code,
-			    proj,
-			    def,
-			    options;
-
-			if (L.Proj._isProj4Obj(a)) {
-				proj = a;
-				code = proj.srsCode;
-				options = b || {};
-
-				this.projection = new L.Proj.Projection(proj, options.bounds);
-			} else {
-				code = a;
-				def = b;
-				options = c || {};
-				this.projection = new L.Proj.Projection(code, def, options.bounds);
-			}
-
-			L.Util.setOptions(this, options);
-			this.code = code;
-			this.transformation = this.options.transformation;
-
-			if (this.options.origin) {
-				this.transformation =
-					new L.Transformation(1, -this.options.origin[0],
-						-1, this.options.origin[1]);
-			}
-
-			if (this.options.scales) {
-				this._scales = this.options.scales;
-			} else if (this.options.resolutions) {
-				this._scales = [];
-				for (var i = this.options.resolutions.length - 1; i >= 0; i--) {
-					if (this.options.resolutions[i]) {
-						this._scales[i] = 1 / this.options.resolutions[i];
-					}
-				}
-			}
-
-			this.infinite = !this.options.bounds;
-
-		},
-
-		scale: function(zoom) {
-			var iZoom = Math.floor(zoom),
-				baseScale,
-				nextScale,
-				scaleDiff,
-				zDiff;
-			if (zoom === iZoom) {
-				return this._scales[zoom];
-			} else {
-				// Non-integer zoom, interpolate
-				baseScale = this._scales[iZoom];
-				nextScale = this._scales[iZoom + 1];
-				scaleDiff = nextScale - baseScale;
-				zDiff = (zoom - iZoom);
-				return baseScale + scaleDiff * zDiff;
-			}
-		},
-
-		zoom: function(scale) {
-			// Find closest number in this._scales, down
-			var downScale = this._closestElement(this._scales, scale),
-				downZoom = this._scales.indexOf(downScale),
-				nextScale,
-				nextZoom,
-				scaleDiff;
-			// Check if scale is downScale => return array index
-			if (scale === downScale) {
-				return downZoom;
-			}
-			if (downScale === undefined) {
-				return -Infinity;
-			}
-			// Interpolate
-			nextZoom = downZoom + 1;
-			nextScale = this._scales[nextZoom];
-			if (nextScale === undefined) {
-				return Infinity;
-			}
-			scaleDiff = nextScale - downScale;
-			return (scale - downScale) / scaleDiff + downZoom;
-		},
-
-		distance: L.CRS.Earth.distance,
-
-		R: L.CRS.Earth.R,
-
-		/* Get the closest lowest element in an array */
-		_closestElement: function(array, element) {
-			var low;
-			for (var i = array.length; i--;) {
-				if (array[i] <= element && (low === undefined || low < array[i])) {
-					low = array[i];
-				}
-			}
-			return low;
-		}
-	});
-
-	L.Proj.GeoJSON = L.GeoJSON.extend({
-		initialize: function(geojson, options) {
-			this._callLevel = 0;
-			L.GeoJSON.prototype.initialize.call(this, geojson, options);
-		},
-
-		addData: function(geojson) {
-			var crs;
-
-			if (geojson) {
-				if (geojson.crs && geojson.crs.type === 'name') {
-					crs = new L.Proj.CRS(geojson.crs.properties.name);
-				} else if (geojson.crs && geojson.crs.type) {
-					crs = new L.Proj.CRS(geojson.crs.type + ':' + geojson.crs.properties.code);
-				}
-
-				if (crs !== undefined) {
-					this.options.coordsToLatLng = function(coords) {
-						var point = L.point(coords[0], coords[1]);
-						return crs.projection.unproject(point);
-					};
-				}
-			}
-
-			// Base class' addData might call us recursively, but
-			// CRS shouldn't be cleared in that case, since CRS applies
-			// to the whole GeoJSON, inluding sub-features.
-			this._callLevel++;
-			try {
-				L.GeoJSON.prototype.addData.call(this, geojson);
-			} finally {
-				this._callLevel--;
-				if (this._callLevel === 0) {
-					delete this.options.coordsToLatLng;
-				}
-			}
-		}
-	});
-
-	L.Proj.geoJson = function(geojson, options) {
-		return new L.Proj.GeoJSON(geojson, options);
-	};
-
-	L.Proj.ImageOverlay = L.ImageOverlay.extend({
-		initialize: function (url, bounds, options) {
-			L.ImageOverlay.prototype.initialize.call(this, url, null, options);
-			this._projectedBounds = bounds;
-		},
-
-		// Danger ahead: Overriding internal methods in Leaflet.
-		// Decided to do this rather than making a copy of L.ImageOverlay
-		// and doing very tiny modifications to it.
-		// Future will tell if this was wise or not.
-		_animateZoom: function (event) {
-			var scale = this._map.getZoomScale(event.zoom);
-			var northWest = L.point(this._projectedBounds.min.x, this._projectedBounds.max.y);
-			var offset = this._projectedToNewLayerPoint(northWest, event.zoom, event.center);
-
-			L.DomUtil.setTransform(this._image, offset, scale);
-		},
-
-		_reset: function () {
-			var zoom = this._map.getZoom();
-			var pixelOrigin = this._map.getPixelOrigin();
-			var bounds = L.bounds(
-				this._transform(this._projectedBounds.min, zoom)._subtract(pixelOrigin),
-				this._transform(this._projectedBounds.max, zoom)._subtract(pixelOrigin)
-			);
-			var size = bounds.getSize();
-
-			L.DomUtil.setPosition(this._image, bounds.min);
-			this._image.style.width = size.x + 'px';
-			this._image.style.height = size.y + 'px';
-		},
-
-		_projectedToNewLayerPoint: function (point, zoom, center) {
-			var viewHalf = this._map.getSize()._divideBy(2);
-			var newTopLeft = this._map.project(center, zoom)._subtract(viewHalf)._round();
-			var topLeft = newTopLeft.add(this._map._getMapPanePos());
-
-			return this._transform(point, zoom)._subtract(topLeft);
-		},
-
-		_transform: function (point, zoom) {
-			var crs = this._map.options.crs;
-			var transformation = crs.transformation;
-			var scale = crs.scale(zoom);
-
-			return transformation.transform(point, scale);
-		}
-	});
-
-	L.Proj.imageOverlay = function (url, bounds, options) {
-		return new L.Proj.ImageOverlay(url, bounds, options);
-	};
-
-	return L.Proj;
-}));
diff --git a/multiple-extents/dist/web-map.js b/multiple-extents/dist/web-map.js
deleted file mode 100644
index 0b1bb19..0000000
--- a/multiple-extents/dist/web-map.js
+++ /dev/null
@@ -1,815 +0,0 @@
-import './leaflet-src.js';  // a lightly modified version of Leaflet for use as browser module
-import './proj4-src.js';        // modified version of proj4; could be stripped down for mapml
-import './proj4leaflet.js'; // not modified, seems to adapt proj4 for leaflet use.
-import './mapml.js';       // refactored URI usage, replaced with URL standard
-import { MapLayer } from './layer.js';
-import { MapArea } from './map-area.js';
-
-export class WebMap extends HTMLMapElement {
-  static get observedAttributes() {
-    return ['lat', 'lon', 'zoom', 'projection', 'width', 'height', 'controls'];
-  }
-  // see comments below regarding attributeChangedCallback vs. getter/setter
-  // usage.  Effectively, the user of the element must use the property, not
-  // the getAttribute/setAttribute/removeAttribute DOM API, because the latter
-  // calls don't result in the getter/setter being called (so you have to use
-  // the getter/setter directly)
-  get controls() {
-    return this.hasAttribute('controls');
-  }
-  set controls(value) {
-    const hasControls = Boolean(value);
-    if (hasControls)
-      this.setAttribute('controls', '');
-    else
-      this.removeAttribute('controls');
-    this._toggleControls(hasControls);
-  }
-  get controlslist() {
-    return this.hasAttribute('controlslist') ? this.getAttribute("controlslist") : "";
-  }
-  set controlslist(val) {
-    let options = ["nofullscreen", "nozoom", "nolayer", "noreload"],
-        lowerVal = val.toLowerCase();
-    if (this.controlslist.includes(lowerVal) || !options.includes(lowerVal))return;
-    this.setAttribute("controlslist", this.controlslist+` ${lowerVal}`);
-  }
-  get lat() {
-    return this.hasAttribute("lat") ? this.getAttribute("lat") : "0";
-  }
-  set lat(val) {
-    if (val) {
-      this.setAttribute("lat", val);
-    }
-  }
-  get lon() {
-    return this.hasAttribute("lon") ? this.getAttribute("lon") : "0";
-  }
-  set lon(val) {
-    if (val) {
-      this.setAttribute("lon", val);
-    }
-  }
-  get projection() {
-    return this.hasAttribute("projection") ? this.getAttribute("projection") : "OSMTILE";
-  }
-  set projection(val) {
-    if(val && M[val]){
-      this.setAttribute('projection', val);
-      if (this._map && this._map.options.projection !== val){
-        this._map.options.crs = M[val];
-        this._map.options.projection = val;
-        for(let layer of this.querySelectorAll("layer-")){
-          layer.removeAttribute("disabled");
-          let reAttach = this.removeChild(layer);
-          this.appendChild(reAttach);
-        }
-        if(this._debug) for(let i = 0; i<2;i++) this.toggleDebug();
-      } else this.dispatchEvent(new CustomEvent('createmap'));
-    } else throw new Error("Undefined Projection");
-  }
-  get zoom() {
-    return this.hasAttribute("zoom") ? this.getAttribute("zoom") : 0;
-  }
-  set zoom(val) {
-    var parsedVal = parseInt(val,10);
-    if (!isNaN(parsedVal) && (parsedVal >= 0 && parsedVal <= 25)) {
-      this.setAttribute('zoom', parsedVal);
-    }
-  }
-  get layers() {
-    return this.getElementsByTagName('layer-');
-  }
-  get areas() {
-    return this.getElementsByTagName('area');
-  }
-
-  get extent(){
-    let map = this._map,
-      pcrsBounds = M.pixelToPCRSBounds(
-        map.getPixelBounds(),
-        map.getZoom(),
-        map.options.projection);
-    let formattedExtent = M.convertAndFormatPCRS(pcrsBounds, map);
-    if(map.getMaxZoom() !== Infinity){
-      formattedExtent.zoom = {
-        minZoom:map.getMinZoom(),
-        maxZoom:map.getMaxZoom()
-      };
-    }
-    return (formattedExtent);
-  }
-
-  constructor() {
-    // Always call super first in constructor
-    super();
-
-    this._source = this.outerHTML;
-    let tmpl = document.createElement('template');
-    tmpl.innerHTML = `<link rel="stylesheet" href="${new URL("mapml.css", import.meta.url).href}">`; // jshint ignore:line
-
-    const rootDiv = document.createElement('div');
-    rootDiv.classList.add('mapml-web-map');
-
-    let shadowRoot = rootDiv.attachShadow({mode: 'open'});
-    this._container = document.createElement('div');
-
-    let output = "<output role='status' aria-live='polite' aria-atomic='true' class='mapml-screen-reader-output'></output>";
-    this._container.insertAdjacentHTML("beforeend", output);
-
-    // Set default styles for the map element.
-    let mapDefaultCSS = document.createElement('style');
-    mapDefaultCSS.innerHTML =
-    `[is="web-map"] {` +
-    `all: initial;` + // Reset properties inheritable from html/body, as some inherited styles may cause unexpected issues with the map element's components (https://github.com/Maps4HTML/Web-Map-Custom-Element/issues/140).
-    `contain: layout size;` + // Contain layout and size calculations within the map element.
-    `display: inline-block;` + // This together with dimension properties is required so that Leaflet isn't working with a height=0 box by default.
-    `height: 150px;` + // Provide a "default object size" (https://github.com/Maps4HTML/HTML-Map-Element/issues/31).
-    `width: 300px;` +
-    `border-width: 2px;` + // Set a default border for contrast, similar to UA default for iframes.
-    `border-style: inset;` +
-    `box-sizing: inherit;` + // https://github.com/Maps4HTML/Web-Map-Custom-Element/issues/350#issuecomment-888361985
-    `}` +
-    `[is="web-map"][frameborder="0"] {` +
-  	`border-width: 0;` +
-  	`}` +
-    `[is="web-map"][hidden] {` +
-    `display: none!important;` +
-    `}` +
-    `[is="web-map"] .mapml-web-map {` +
-    `display: contents;` + // This div doesn't have to participate in layout by generating its own box.
-    `}`;
-    
-    let shadowRootCSS = document.createElement('style');
-    shadowRootCSS.innerHTML =
-    `:host .leaflet-control-container {` +
-    `visibility: hidden!important;` + // Visibility hack to improve percieved performance (mitigate FOUC) – visibility is unset in mapml.css! (https://github.com/Maps4HTML/Web-Map-Custom-Element/issues/154).
-    `}`;
-    
-    // Hide all (light DOM) children of the map element except for the
-    // `<area>` and `<div class="mapml-web-map">` (shadow root host) elements.
-    let hideElementsCSS = document.createElement('style');
-    hideElementsCSS.innerHTML =
-    `[is="web-map"] > :not(area):not(.mapml-web-map) {` +
-    `display: none!important;` +
-    `}`;
-    
-    shadowRoot.appendChild(shadowRootCSS);
-    shadowRoot.appendChild(tmpl.content.cloneNode(true));
-    shadowRoot.appendChild(this._container);
-    this.appendChild(rootDiv);
-    this.appendChild(hideElementsCSS);
-    document.head.insertAdjacentElement('afterbegin', mapDefaultCSS);
-    this._toggleState = false;
-    this.controlsListObserver = new MutationObserver((m) => {
-      m.forEach((change)=>{
-        if(change.type==="attributes" && change.attributeName === "controlslist")
-          this.setControls(false,false,false);
-      });
-    });
-    this.controlsListObserver.observe(this, {attributes:true});
-  }
-
-  connectedCallback() {
-    if (this.isConnected) {
-
-      // the dimension attributes win, if they're there. A map does not
-      // have an intrinsic size, unlike an image or video, and so must
-      // have a defined width and height.
-      var s = window.getComputedStyle(this),
-        wpx = s.width, hpx=s.height,
-        w = parseInt(wpx.replace('px','')),
-        h = parseInt(hpx.replace('px',''));
-
-      if (wpx === "" || hpx === "") {
-         return;
-      }
-
-      if (!this.width || this.width !== w) {
-        this._container.style.width = wpx;
-        this.width = w;
-      } else {
-        this._container.style.width = this.width+"px";
-      }
-
-      if (!this.height || this.height !== h) {
-        this._container.style.height = hpx;
-        this.height = h;
-      } else {
-        this._container.style.height = this.height+"px";
-      }
-
-      // create an array to track the history of the map and the current index
-      if(!this._history){
-        this._history = [];
-        this._historyIndex = -1;
-        this._traversalCall = false;
-      }
-
-      this.addEventListener('createmap', ()=>{
-        if (!this._map) {
-          this._map = L.map(this._container, {
-            center: new L.LatLng(this.lat, this.lon),
-            projection: this.projection,
-            query: true,
-            contextMenu: true,
-            announceMovement: M.options.announceMovement,
-            featureIndex: true,
-            mapEl: this,
-            crs: M[this.projection],
-            zoom: this.zoom,
-            zoomControl: false,
-            // because the M.MapMLLayer invokes _tileLayer._onMoveEnd when
-            // the mapml response is received the screen tends to flash.  I'm sure
-            // there is a better configuration than that, but at this moment
-            // I'm not sure how to approach that issue.
-            // See https://github.com/Maps4HTML/MapML-Leaflet-Client/issues/24
-            fadeAnimation: true
-          });
-          this._addToHistory();
-          // the attribution control is not optional
-          this._attributionControl =  this._map.attributionControl.setPrefix('<a href="https://www.w3.org/community/maps4html/" title="W3C Maps for HTML Community Group">Maps4HTML</a> | <a href="https://leafletjs.com" title="A JS library for interactive maps">Leaflet</a>');
-          this._attributionControl.getContainer().setAttribute("role","group");
-          this._attributionControl.getContainer().setAttribute("aria-label","Map data attribution");
-
-          this.setControls(false,false,true);
-          this._crosshair = M.crosshair().addTo(this._map);
-          if (this.hasAttribute('name')) {
-            var name = this.getAttribute('name');
-            if (name) {
-              this.poster = document.querySelector('img[usemap='+'"#'+name+'"]');
-              // firefox has an issue where the attribution control's use of
-              // _container.innerHTML does not work properly if the engine is throwing
-              // exceptions because there are no area element children of the image map
-              // for firefox only, a workaround is to actually remove the image...
-              if (this.poster) {
-                if (L.Browser.gecko) {
-                    this.poster.removeAttribute('usemap');
-                }
-                //this.appendChild(this.poster);
-              }
-            }
-          }
-
-          // undisplay the img in the image map, because it's not needed now.
-          // gives a slight FOUC, unless:
-          // 1) the img is pre-styled (https://github.com/Maps4HTML/Web-Map-Custom-Element/blob/80a4a4e372d2ef61bb7cad6a111e17e396b8e908/index-map-area.html#L35)
-          // 2) placed after the map element
-          if (this.poster) {
-            this.poster.setAttribute('hidden', '');
-          }
-          
-          // https://github.com/Maps4HTML/Web-Map-Custom-Element/issues/274
-          this.setAttribute('role', 'application');
-          // Make the Leaflet container element programmatically identifiable
-          // (https://github.com/Leaflet/Leaflet/issues/7193).
-          this._container.setAttribute('role', 'region');
-          this._container.setAttribute('aria-label', 'Interactive map');
-          
-          this._setUpEvents();
-          // this.fire('load', {target: this});
-        }
-      }, {once:true});
-
-      let custom = !(["CBMTILE","APSTILE","OSMTILE","WGS84"].includes(this.projection));
-      // if the page doesn't use nav.js or isn't custom then dispatch createmap event	
-      if(!custom){	
-        this.dispatchEvent(new CustomEvent('createmap'));
-      }
-    }
-  }
-  disconnectedCallback() {
-    //this._removeEvents();
-    delete this._map;
-  }
-  adoptedCallback() {
-//    console.log('Custom map element moved to new page.');
-  }
-
-  setControls(isToggle, toggleShow, setup){
-    if (this.controls && this._map) {
-      let controls = ["_zoomControl", "_reloadButton", "_fullScreenControl", "_layerControl"],
-          options = ["nozoom", "noreload", "nofullscreen", 'nolayer'],
-          mapSize = this._map.getSize().y,
-          totalSize = 0;
-
-      //removes the left hand controls, if not done they will be re-added in the incorrect order
-      //better to just reset them
-      for(let i = 0 ; i<3;i++){
-        if(this[controls[i]]){
-          this._map.removeControl(this[controls[i]]);
-          delete this[controls[i]];
-        }
-      }
-
-      if (!this.controlslist.toLowerCase().includes("nolayer") && !this._layerControl && this.layers.length > 0){
-        this._layerControl = M.mapMlLayerControl(null,{"collapsed": true, mapEl: this}).addTo(this._map);
-        //if this is the initial setup the layers dont need to be readded, causes issues if they are
-        if(!setup){
-          for (var i=0;i<this.layers.length;i++) {
-            if (!this.layers[i].hidden) {
-              this._layerControl.addOverlay(this.layers[i]._layer, this.layers[i].label);
-              this._map.on('moveend', this.layers[i]._validateDisabled,  this.layers[i]);
-              this.layers[i]._layerControl = this._layerControl;
-            }
-          }
-          this._map.fire("validate");
-        }
-      }
-      if (!this.controlslist.toLowerCase().includes("nozoom") && !this._zoomControl && (totalSize + 93) <= mapSize){
-        totalSize += 93;
-        this._zoomControl = L.control.zoom().addTo(this._map);
-      }
-      if (!this.controlslist.toLowerCase().includes("noreload") && !this._reloadButton && (totalSize + 49) <= mapSize){
-        totalSize += 49;
-        this._reloadButton = M.reloadButton().addTo(this._map);
-      }
-      if (!this.controlslist.toLowerCase().includes("nofullscreen") && !this._fullScreenControl && (totalSize + 49) <= mapSize){
-        totalSize += 49;
-        this._fullScreenControl = M.fullscreenButton().addTo(this._map);
-      }
-      //removes any control layers that are not needed, either by the toggling or by the controlslist attribute
-      for(let i in options){
-        if(this[controls[i]] && (this.controlslist.toLowerCase().includes(options[i]) || (isToggle && !toggleShow ))){
-          this._map.removeControl(this[controls[i]]);
-          delete this[controls[i]];
-        }
-      }
-    }
-  }
-  attributeChangedCallback(name, oldValue, newValue) {
-//    console.log('Attribute: ' + name + ' changed from: '+ oldValue + ' to: '+newValue);
-    // "Best practice": handle side-effects in this callback
-    // https://developers.google.com/web/fundamentals/web-components/best-practices
-    // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
-    // note that the example is misleading, since the user can't use
-    // setAttribute or removeAttribute to set the property, they need to use
-    // the property directly in their API usage, which kinda sucks
-    /*
-  const hasValue = newValue !== null;
-  switch (name) {
-    case 'checked':
-      // Note the attributeChangedCallback is only handling the *side effects*
-      // of setting the attribute.
-      this.setAttribute('aria-checked', hasValue);
-      break;
-    ...
-  }     */
-  }
-  _dropHandler(event) {
-    event.preventDefault();
-    // create a new <layer-> child of this <map> element
-      let l = new MapLayer();
-      l.src = event.dataTransfer.getData("text");
-      l.label = 'Layer';
-      l.checked = 'true';
-      this.appendChild(l);
-      l.addEventListener("error", function () {
-        if (l.parentElement) {
-          // should invoke lifecyle callbacks automatically by removing it from DOM
-          l.parentElement.removeChild(l);
-        }
-        // garbage collect it
-        l = null;
-      });
-  }
-  _dragoverHandler(event) {
-    function contains(list, value) {
-      for( var i = 0; i < list.length; ++i ) {
-        if(list[i] === value) return true;
-      }
-      return false;
-    }
-    // check if the thing being dragged is a URL
-    var isLink = contains( event.dataTransfer.types, "text/uri-list");
-    if (isLink) {
-      event.preventDefault();
-      event.dataTransfer.dropEffect = "copy";
-    }
-  }
-  _removeEvents() {
-    if (this._map) {
-      this._map.off('preclick click dblclick mousemove mouseover mouseout mousedown mouseup contextmenu', false, this);
-      this._map.off('load movestart move moveend zoomstart zoom zoomend', false, this);
-      this.removeEventListener("drop", this._dropHandler, false);
-      this.removeEventListener("dragover", this._dragoverHandler, false);
-    }
-  }
-  _setUpEvents() {
-    this.addEventListener("drop", this._dropHandler, false);
-    this.addEventListener("dragover", this._dragoverHandler, false);
-    this.addEventListener("change",
-    function(e) {
-      if(e.target.tagName === "LAYER-"){
-        this.dispatchEvent(new CustomEvent("layerchange", {details:{target: this, originalEvent: e}}));
-      }
-    }, false);
-
-    this.parentElement.addEventListener('keyup', function (e) {
-      if(e.keyCode === 9 && document.activeElement.nodeName === "MAPML-VIEWER"){
-        document.activeElement.dispatchEvent(new CustomEvent('mapfocused', {detail:
-              {target: this}}));
-      }
-    });
-    this.parentElement.addEventListener('mousedown', function (e) {
-      if(document.activeElement.nodeName === "MAPML-VIEWER"){
-        document.activeElement.dispatchEvent(new CustomEvent('mapfocused', {detail:
-              {target: this}}));
-      }
-    });
-    this._map.on('load',
-      function () {
-        this.dispatchEvent(new CustomEvent('load', {detail: {target: this}}));
-      }, this);
-    this._map.on('preclick',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('preclick', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      }, this);
-    this._map.on('click',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('click', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      }, this);
-    this._map.on('dblclick',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('dblclick', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      }, this);
-    this._map.on('mousemove',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('mousemove', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      }, this);
-    this._map.on('mouseover',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('mouseover', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      }, this);
-    this._map.on('mouseout',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('mouseout', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      }, this);
-    this._map.on('mousedown',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('mousedown', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      },this);
-    this._map.on('mouseup',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('mouseup', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      }, this);
-    this._map.on('contextmenu',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('contextmenu', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      }, this);
-    this._map.on('movestart',
-      function () {
-        this._updateMapCenter();
-        this.dispatchEvent(new CustomEvent('movestart', {detail:
-          {target: this}}));
-      }, this);
-    this._map.on('move',
-      function () {
-        this._updateMapCenter();
-        this.dispatchEvent(new CustomEvent('move', {detail:
-          {target: this}}));
-      }, this);
-    this._map.on('moveend',
-      function () {
-        this._updateMapCenter();
-        this._addToHistory();
-        this.dispatchEvent(new CustomEvent('moveend', {detail:
-          {target: this}}));
-      }, this);
-    this._map.on('zoomstart',
-      function () {
-        this._updateMapCenter();
-        this.dispatchEvent(new CustomEvent('zoomstart', {detail:
-          {target: this}}));
-      }, this);
-    this._map.on('zoom',
-      function () {
-        this._updateMapCenter();
-        this.dispatchEvent(new CustomEvent('zoom', {detail:
-          {target: this}}));
-      }, this);
-    this._map.on('zoomend',
-      function () {
-        this._updateMapCenter();
-        this.dispatchEvent(new CustomEvent('zoomend', {detail:
-          {target: this}}));
-      }, this);
-  }
-  _toggleControls() {
-    if (this._map) {
-        this.setControls(true, this._toggleState, false);
-        this._toggleState = !this._toggleState;
-    }
-  }
-
-  toggleDebug(){
-    if(this._debug){
-      this._debug.remove();
-      this._debug = undefined;
-    } else {
-      this._debug = M.debugOverlay().addTo(this._map);
-    }
-  }
-  
-  _widthChanged(width) {
-    this.style.width = width+"px";
-    this._container.style.width = width+"px";
-    if (this._map) {
-        this._map.invalidateSize(false);
-    }
-  }
-  _heightChanged(height) {
-    this.style.height = height+"px";
-    this._container.style.height = height+"px";
-    if (this._map) {
-        this._map.invalidateSize(false);
-    }
-  }
-  zoomTo(lat, lon, zoom) {
-    zoom = Number.isInteger(+zoom) ? +zoom : this.zoom;
-    let location = new L.LatLng(+lat, +lon);
-    this._map.setView(location, zoom);
-    this.zoom = zoom;
-    this.lat = location.lat;
-    this.lon = location.lng;
-  }
-  _updateMapCenter() {
-    // remember to tell Leaflet event handler that 'this' in here refers to
-    //  something other than the map in this case the custom polymer element
-    this.lat = this._map.getCenter().lat;
-    this.lon = this._map.getCenter().lng;
-    this.zoom = this._map.getZoom();
-  }
-
-  /**
-   * Adds to the maps history on moveends
-   * @private
-   */
-  _addToHistory(){
-    if(this._traversalCall > 0) { // this._traversalCall tracks how many consecutive moveends to ignore from history
-      this._traversalCall--;      // this is useful for ignoring moveends corresponding to back, forward and reload
-      return;
-    }
-
-    let mapLocation = this._map.getPixelBounds().getCenter();
-    let location = {
-      zoom: this._map.getZoom(),
-      x:mapLocation.x,
-      y:mapLocation.y,
-    };
-    this._historyIndex++;
-    this._history.splice(this._historyIndex, 0, location);
-  }
-
-  /**
-   * Allow user to move back in history
-   */
-  back(){
-    let history = this._history;
-    let curr = history[this._historyIndex];
-
-    if(this._historyIndex > 0){
-      this._historyIndex--;
-      let prev = history[this._historyIndex];
-
-      if(prev.zoom !== curr.zoom){
-        this._traversalCall = 2;  // allows the next 2 moveends to be ignored from history
-
-        let currScale = this._map.options.crs.scale(curr.zoom); // gets the scale of the current zoom level
-        let prevScale = this._map.options.crs.scale(prev.zoom); // gets the scale of the previous zoom level
-
-        let scale = currScale / prevScale; // used to convert the previous pixel location to be in terms of the current zoom level
-
-        this._map.panBy([((prev.x * scale) - curr.x), ((prev.y * scale) - curr.y)], {animate: false});
-        this._map.setZoom(prev.zoom);
-      } else {
-        this._traversalCall = 1;
-        this._map.panBy([(prev.x - curr.x), (prev.y - curr.y)]);
-      }
-    }
-  }
-
-  /**
-   * Allows user to move forward in history
-   */
-  forward(){
-    let history = this._history;
-    let curr = history[this._historyIndex];
-    if(this._historyIndex < history.length - 1){
-      this._historyIndex++;
-      let next = history[this._historyIndex];
-
-      if(next.zoom !== curr.zoom){
-        this._traversalCall = 2; // allows the next 2 moveends to be ignored from history
-
-        let currScale = this._map.options.crs.scale(curr.zoom); // gets the scale of the current zoom level
-        let nextScale = this._map.options.crs.scale(next.zoom); // gets the scale of the next zoom level
-
-        let scale = currScale / nextScale; // used to convert the next pixel location to be in terms of the current zoom level
-
-        this._map.panBy([((next.x * scale) - curr.x), ((next.y * scale) - curr.y)], {animate: false});
-        this._map.setZoom(next.zoom);
-      } else {
-        this._traversalCall = 1;
-        this._map.panBy([(next.x - curr.x), (next.y - curr.y)]);
-      }
-    }
-  }
-
-  /**
-   * Allows the user to reload/reset the map's location to it's initial location
-   */
-  reload(){
-    let initialLocation = this._history.shift();
-    let mapLocation = this._map.getPixelBounds().getCenter();
-    let curr = {
-      zoom: this._map.getZoom(),
-      x:mapLocation.x,
-      y:mapLocation.y,
-    };
-
-    this._history = [initialLocation];
-    this._historyIndex = 0;
-
-    if(initialLocation.zoom !== curr.zoom) {
-      this._traversalCall = 2; // ignores the next 2 moveend events
-
-      let currScale = this._map.options.crs.scale(curr.zoom); // gets the scale of the current zoom level
-      let initScale = this._map.options.crs.scale(initialLocation.zoom); // gets the scale of the initial location's zoom
-
-      let scale = currScale / initScale;
-
-      this._map.panBy([((initialLocation.x * scale) - curr.x), ((initialLocation.y * scale) - curr.y)], {animate: false});
-      this._map.setZoom(initialLocation.zoom);
-    } else { // if it's on the same zoom level as the initial location, no need to calculate scales
-      this._traversalCall = 1;
-      this._map.panBy([(initialLocation.x- curr.x), (initialLocation.y - curr.y)]);
-    }
-  }
-
-  viewSource(){
-    let blob = new Blob([this._source],{type:"text/plain"}),
-        url = URL.createObjectURL(blob);
-    window.open(url);
-    URL.revokeObjectURL(url);
-  }
-
-  defineCustomProjection(jsonTemplate) {
-    let t = JSON.parse(jsonTemplate);
-    if (t === undefined || !t.proj4string || !t.projection || !t.resolutions || !t.origin || !t.bounds) throw new Error('Incomplete TCRS Definition');
-    if (t.projection.indexOf(":") >= 0) throw new Error('":" is not permitted in projection name');
-    if (M[t.projection.toUpperCase()]) return t.projection.toUpperCase();
-    let tileSize = [256, 512, 1024, 2048, 4096].includes(t.tilesize)?t.tilesize:256;
-
-    M[t.projection] = new L.Proj.CRS(t.projection, t.proj4string, {
-      origin: t.origin,
-      resolutions: t.resolutions,
-      bounds: L.bounds(t.bounds),
-      crs: {
-        tcrs: {
-          horizontal: {
-            name: "x",
-            min: 0, 
-            max: zoom => (M[t.projection].options.bounds.getSize().x / M[t.projection].options.resolutions[zoom]).toFixed()
-          },
-          vertical: {
-            name: "y",
-            min:0, 
-            max: zoom => (M[t.projection].options.bounds.getSize().y / M[t.projection].options.resolutions[zoom]).toFixed()
-          },
-          bounds: zoom => L.bounds([M[t.projection].options.crs.tcrs.horizontal.min,
-            M[t.projection].options.crs.tcrs.vertical.min],
-            [M[t.projection].options.crs.tcrs.horizontal.max(zoom),
-            M[t.projection].options.crs.tcrs.vertical.max(zoom)])
-        },
-        pcrs: {
-          horizontal: {
-            name: "easting",
-            get min() {return M[t.projection].options.bounds.min.x;},
-            get max() {return M[t.projection].options.bounds.max.x;}
-          }, 
-          vertical: {
-            name: "northing", 
-            get min() {return M[t.projection].options.bounds.min.y;},
-            get max() {return M[t.projection].options.bounds.max.y;}
-          },
-          get bounds() {return M[t.projection].options.bounds;}
-        }, 
-        gcrs: {
-          horizontal: {
-            name: "longitude",
-            // set min/max axis values from EPSG registry area of use, retrieved 2019-07-25
-            get min() {return M[t.projection].unproject(M.OSMTILE.options.bounds.min).lng;},
-            get max() {return M[t.projection].unproject(M.OSMTILE.options.bounds.max).lng;}
-          }, 
-          vertical: {
-            name: "latitude",
-            // set min/max axis values from EPSG registry area of use, retrieved 2019-07-25
-            get min() {return M[t.projection].unproject(M.OSMTILE.options.bounds.min).lat;},
-            get max() {return M[t.projection].unproject(M.OSMTILE.options.bounds.max).lat;}
-          },
-          get bounds() {return L.latLngBounds(
-                [M[t.projection].options.crs.gcrs.vertical.min,M[t.projection].options.crs.gcrs.horizontal.min],
-                [M[t.projection].options.crs.gcrs.vertical.max,M[t.projection].options.crs.gcrs.horizontal.max]);}
-        },
-        map: {
-          horizontal: {
-            name: "i",
-            min: 0,
-            max: map => map.getSize().x
-          },
-          vertical: {
-            name: "j",
-            min: 0,
-            max: map => map.getSize().y
-          },
-          bounds: map => L.bounds(L.point([0,0]),map.getSize())
-        },
-        tile: {
-          horizontal: {
-            name: "i",
-            min: 0,
-            max: tileSize,
-          },
-          vertical: {
-            name: "j",
-            min: 0,
-            max: tileSize,
-          },
-          get bounds() {return L.bounds(
-                    [M[t.projection].options.crs.tile.horizontal.min,M[t.projection].options.crs.tile.vertical.min],
-                    [M[t.projection].options.crs.tile.horizontal.max,M[t.projection].options.crs.tile.vertical.max]);}
-        },
-        tilematrix: {
-          horizontal: {
-            name: "column",
-            min: 0,
-            max: zoom => (M[t.projection].options.crs.tcrs.horizontal.max(zoom) / M[t.projection].options.crs.tile.bounds.getSize().x).toFixed()
-          },
-          vertical: {
-            name: "row",
-            min: 0,
-            max: zoom => (M[t.projection].options.crs.tcrs.vertical.max(zoom) / M[t.projection].options.crs.tile.bounds.getSize().y).toFixed()
-          },
-          bounds: zoom => L.bounds(
-                   [M[t.projection].options.crs.tilematrix.horizontal.min,
-                   M[t.projection].options.crs.tilematrix.vertical.min],
-                   [M[t.projection].options.crs.tilematrix.horizontal.max(zoom),
-                   M[t.projection].options.crs.tilematrix.vertical.max(zoom)])
-        }
-      },
-    });      //creates crs using L.Proj
-    M[t.projection.toUpperCase()] = M[t.projection]; //adds the projection uppercase to global M
-    return t.projection;
-  }
-
-  _ready() {
-    if (this.hasAttribute('name')) {
-      var name = this.getAttribute('name');
-      if (name) {
-        this.poster = document.querySelector('img[usemap='+'"#'+name+'"]');
-        // firefox has an issue where the attribution control's use of
-        // _container.innerHTML does not work properly if the engine is throwing
-        // exceptions because there are no area element children of the image map
-        // for firefox only, a workaround is to actually remove the image...
-        if (this.poster) {
-          if (L.Browser.gecko) {
-            this.poster.removeAttribute('usemap');
-          }
-          this._container.appendChild(this.poster);
-        }
-      }
-    }
-  }
-}
-// need to provide options { extends: ... }  for custom built-in elements
-window.customElements.define('web-map', WebMap,  { extends: 'map' });
-window.customElements.define('layer-', MapLayer);
-window.customElements.define('map-area', MapArea, {extends: 'area'});
diff --git a/multiple-extents/index.html b/multiple-extents/index.html
index 424e6d3..b576194 100644
--- a/multiple-extents/index.html
+++ b/multiple-extents/index.html
@@ -3,33 +3,126 @@
   <head>
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width,initial-scale=1">
-    <title>National Geographic base map</title>
-    <script type="module" src="./dist/mapml-viewer.js"></script>
+    <title>Multi-extent layers</title>
+    <script type="module" src="../dist/mapml-viewer.js"></script>
     <link rel="stylesheet" href="../global.css">
   </head>
   <body>
-    <mapml-viewer zoom="3" lon="0" lat="0" controls projection="OSMTILE">
-      <layer- label="Multiple Extent Elements"  checked>
-        <map-extent label="National Geographic" units="OSMTILE">
-          <map-input name="TileMatrix" type="zoom" value="18" min="0" max="18"></map-input>
-          <map-input name="TileCol" type="location" units="tilematrix" axis="column" min="0" max="262144"></map-input>
-          <map-input name="TileRow" type="location" units="tilematrix" axis="row" min="0" max="262144"></map-input>
-          <map-link rel="tile" tref="https://server.arcgisonline.com/arcgis/rest/services/NatGeo_World_Map/MapServer/WMTS/tile/1.0.0/NatGeo_World_Map/default/default028mm/{TileMatrix}/{TileRow}/{TileCol}.jpg"></map-link>
-        </map-extent>
-        <map-extent label="Labelled Imagery" units="OSMTILE">
-          <map-input name="TileMatrix" type="zoom" value="18" min="0" max="18"></map-input>
-          <map-input name="TileCol" type="location" units="tilematrix" axis="column" min="0" max="262144"></map-input>
-          <map-input name="TileRow" type="location" units="tilematrix" axis="row" min="0" max="262144"></map-input>
-          <map-link rel="tile" tref="https://server.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/WMTS/tile/1.0.0/World_Imagery/default/default028mm/{TileMatrix}/{TileRow}/{TileCol}.jpg"></map-link>
-          <map-link rel="tile" tref="https://services.arcgisonline.com/arcgis/rest/services/Reference/World_Boundaries_and_Places/MapServer/WMTS/tile/1.0.0/Reference_World_Boundaries_and_Places/default/default028mm/{TileMatrix}/{TileRow}/{TileCol}.png"></map-link>
-        </map-extent>
-        <map-extent label="Imagery" units="OSMTILE">
-          <map-input name="TileMatrix" type="zoom" value="18" min="0" max="18"></map-input>
-          <map-input name="TileCol" type="location" units="tilematrix" axis="column" min="0" max="262144"></map-input>
-          <map-input name="TileRow" type="location" units="tilematrix" axis="row" min="0" max="262144"></map-input>
-          <map-link rel="tile" tref="https://server.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/WMTS/tile/1.0.0/World_Imagery/default/default028mm/{TileMatrix}/{TileRow}/{TileCol}.jpg"></map-link>
-        </map-extent>
-      </layer->
-    </mapml-viewer>
-  </body>
+    <!-- spearfish zoom="12" lon="-103.72558592353018" lat="44.42865428227619" -->
+    <!-- restaurants zoom="15" lon="-75.703611" lat="45.411105" -->
+  <mapml-viewer zoom="15" lon="-75.703611" lat="45.411105" controls projection="OSMTILE">
+    <layer- label="National Geographic"  checked>
+      <map-extent label="National Geographic" units="OSMTILE">
+        <map-input name="TileMatrix" type="zoom" value="18" min="0" max="18"></map-input>
+        <map-input name="TileCol" type="location" units="tilematrix" axis="column" min="0" max="262144"></map-input>
+        <map-input name="TileRow" type="location" units="tilematrix" axis="row" min="0" max="262144"></map-input>
+        <map-link rel="tile" tref="https://server.arcgisonline.com/arcgis/rest/services/NatGeo_World_Map/MapServer/WMTS/tile/1.0.0/NatGeo_World_Map/default/default028mm/{TileMatrix}/{TileRow}/{TileCol}.jpg"></map-link>
+      </map-extent>
+      <map-extent label="Labelled Imagery" units="OSMTILE">
+        <map-input name="TileMatrix" type="zoom" value="18" min="0" max="18"></map-input>
+        <map-input name="TileCol" type="location" units="tilematrix" axis="column" min="0" max="262144"></map-input>
+        <map-input name="TileRow" type="location" units="tilematrix" axis="row" min="0" max="262144"></map-input>
+        <map-link rel="tile" tref="https://server.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/WMTS/tile/1.0.0/World_Imagery/default/default028mm/{TileMatrix}/{TileRow}/{TileCol}.jpg"></map-link>
+        <map-link rel="tile" tref="https://services.arcgisonline.com/arcgis/rest/services/Reference/World_Boundaries_and_Places/MapServer/WMTS/tile/1.0.0/Reference_World_Boundaries_and_Places/default/default028mm/{TileMatrix}/{TileRow}/{TileCol}.png"></map-link>
+      </map-extent>
+      <map-extent label="Imagery" units="OSMTILE">
+        <map-input name="TileMatrix" type="zoom" value="18" min="0" max="18"></map-input>
+        <map-input name="TileCol" type="location" units="tilematrix" axis="column" min="0" max="262144"></map-input>
+        <map-input name="TileRow" type="location" units="tilematrix" axis="row" min="0" max="262144"></map-input>
+        <map-link rel="tile" tref="https://server.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/WMTS/tile/1.0.0/World_Imagery/default/default028mm/{TileMatrix}/{TileRow}/{TileCol}.jpg"></map-link>
+      </map-extent>
+    </layer->
+    <layer- label="Restaurants">
+     <map-meta name="extent" content="top-left-easting=-8433179, top-left-northing=5689316, bottom-right-easting=-8420968, bottom-right-northing=5683139"></map-meta>
+      <map-extent units="OSMTILE">
+        <map-select id="restaurants" name="cusine">
+            <map-option value="restaurants" selected="selected">All cuisines</map-option>
+            <map-option value="african">African</map-option>
+            <map-option value="asian">Asian</map-option>
+            <map-option value="cajun">Cajun</map-option>
+            <map-option value="indian">Indian</map-option>
+            <map-option value="italian">Italian</map-option>
+            <map-option value="mexican">Mexican</map-option>
+        </map-select>
+        <map-link tref="../shared/restaurants/{cusine}.mapml" rel="features"/>
+      </map-extent>
+    </layer->
+
+<!--    <layer- label="Spearfish - inline" checked>
+      <map-meta name="extent" content="top-left-easting=-11573304.98,top-left-northing=5545277.52,bottom-right-easting=-11526672.02,bottom-right-northing=5520645.67"></map-meta>
+      <map-meta name="zoom" content="min=6,max=24"></map-meta>
+      <map-extent label="Elevation (m)" units="OSMTILE">
+         the z variable is unreferenced, but because it is found in the extent, it provides min/maxNativeZoom 
+        <map-input name="z" type="zoom" value="18" min="6" max="18"></map-input>
+        <map-input name="xmin" type="location" rel="map" position="top-left" axis="easting" units="pcrs" min="-1.1562867513204884E7" max="-1.1535963887183946E7"></map-input>
+        <map-input name="ymin" type="location" rel="map" position="bottom-left" axis="northing" units="pcrs" min="5522913.211891563" max="5543400.923533295"></map-input>
+        <map-input name="xmax" type="location" rel="map" position="top-right" axis="easting" units="pcrs" min="-1.1562867513204884E7" max="-1.1535963887183946E7"></map-input>
+        <map-input name="ymax" type="location" rel="map" position="top-left" axis="northing" units="pcrs" min="5522913.211891563" max="5543400.923533295"></map-input>
+        <map-input name="w" type="width" min="1" max="10000"></map-input>
+        <map-input name="h" type="height" min="1" max="10000"></map-input>
+        <map-link tref="http://localhost:8081/geoserver/wms?request=GetMap&crs=urn:x-ogc:def:crs:EPSG:3857&service=WMS&bbox={xmin},{ymin},{xmax},{ymax}&layers=sfdem&format=image/png&width={w}&styles=&version=1.3.0&transparent=true&height={h}" rel="image"></map-link>
+        <map-input name="i" type="location" axis="i" units="map"></map-input>
+        <map-input name="j" type="location" axis="j" units="map"></map-input>
+        <map-link tref="http://localhost:8081/geoserver/wms?request=GetFeatureInfo&query_layers=spearfish&crs=urn:x-ogc:def:crs:EPSG:3857&bbox={xmin},{ymin},{xmax},{ymax}&version=1.3.0&transparent=true&service=WMS&layers=spearfish&width={w}&x={i}&feature_count=50&y={j}&styles=&info_format=text/mapml&height={h}" rel="query"></map-link>
+      </map-extent>
+
+      <map-extent label="Streams" units="OSMTILE">
+        <map-input name="z" type="zoom" value="18" min="6" max="18"></map-input>
+        <map-input name="xmin" type="location" rel="map" position="top-left" axis="easting" units="pcrs" min="-1.1563624839736426E7" max="-1.1535237023686884E7"></map-input>
+        <map-input name="ymin" type="location" rel="map" position="bottom-left" axis="northing" units="pcrs" min="5523247.73970007" max="5543497.265261071"></map-input>
+        <map-input name="xmax" type="location" rel="map" position="top-right" axis="easting" units="pcrs" min="-1.1563624839736426E7" max="-1.1535237023686884E7"></map-input>
+        <map-input name="ymax" type="location" rel="map" position="top-left" axis="northing" units="pcrs" min="5523247.73970007" max="5543497.265261071">
+          <map-input name="w" type="width" min="1" max="10000"></map-input>
+          <map-input name="h" type="height" min="1" max="10000"></map-input>
+          <map-link tref="http://localhost:8081/geoserver/wms?request=GetMap&crs=urn:x-ogc:def:crs:EPSG:3857&service=WMS&bbox={xmin},{ymin},{xmax},{ymax}&layers=streams&format=image/png&width={w}&styles=&version=1.3.0&transparent=true&height={h}" rel="image"></map-link>
+      </map-extent>
+
+      <map-extent label="Roads" units="OSMTILE">
+        <map-input name="z" type="zoom" value="18" min="6" max="18"></map-input>
+        <map-input name="xmin" type="location" rel="map" position="top-left" axis="easting" units="pcrs" min="-1.156362320885788E7" max="-1.153522460748034E7"></map-input>
+        <map-input name="ymin" type="location" rel="map" position="bottom-left" axis="northing" units="pcrs" min="5523330.219611262" max="5543486.508318696"></map-input>
+        <map-input name="xmax" type="location" rel="map" position="top-right" axis="easting" units="pcrs" min="-1.156362320885788E7" max="-1.153522460748034E7"></map-input>
+        <map-input name="ymax" type="location" rel="map" position="top-left" axis="northing" units="pcrs" min="5523330.219611262" max="5543486.508318696"></map-input>
+        <map-input name="w" type="width" min="1" max="10000"></map-input>
+        <map-input name="h" type="height" min="1" max="10000"></map-input>
+        <map-link tref="http://localhost:8081/geoserver/wms?request=GetMap&crs=urn:x-ogc:def:crs:EPSG:3857&service=WMS&bbox={xmin},{ymin},{xmax},{ymax}&layers=roads&format=image/png&width={w}&styles=&version=1.3.0&transparent=true&height={h}" rel="image"></map-link>
+      </map-extent>
+
+      <map-extent label="restricted areas" units="OSMTILE">
+        <map-input name="z" type="zoom" value="18" min="6" max="18"></map-input>
+        <map-input name="xmin" type="location" rel="map" position="top-left" axis="easting" units="pcrs" min="-1.1560583766353529E7" max="-1.1549100426349973E7"></map-input>
+        <map-input name="ymin" type="location" rel="map" position="bottom-left" axis="northing" units="pcrs" min="5526678.940140986" max="5540366.703552546"></map-input>
+        <map-input name="xmax" type="location" rel="map" position="top-right" axis="easting" units="pcrs" min="-1.1560583766353529E7" max="-1.1549100426349973E7"></map-input>
+        <map-input name="ymax" type="location" rel="map" position="top-left" axis="northing" units="pcrs" min="5526678.940140986" max="5540366.703552546"></map-input>
+        <map-input name="w" type="width" min="1" max="10000"></map-input>
+        <map-input name="h" type="height" min="1" max="10000"></map-input>
+        <map-link tref="http://localhost:8081/geoserver/wms?request=GetMap&crs=urn:x-ogc:def:crs:EPSG:3857&service=WMS&bbox={xmin},{ymin},{xmax},{ymax}&layers=restricted&format=image/png&width={w}&styles=&version=1.3.0&transparent=true&height={h}" rel="image"></map-link>
+      </map-extent>
+
+      <map-extent label="archsites" units="OSMTILE">
+        <map-input name="z" type="zoom" value="18" min="6" max="18"></map-input>
+        <map-input name="xmin" type="location" rel="map" position="top-left" axis="easting" units="pcrs" min="-1.1563031907938445E7" max="-1.1536913929529054E7"></map-input>
+        <map-input name="ymin" type="location" rel="map" position="bottom-left" axis="northing" units="pcrs" min="5524037.032890486" max="5541285.002383663"></map-input>
+        <map-input name="xmax" type="location" rel="map" position="top-right" axis="easting" units="pcrs" min="-1.1563031907938445E7" max="-1.1536913929529054E7"></map-input>
+        <map-input name="ymax" type="location" rel="map" position="top-left" axis="northing" units="pcrs" min="5524037.032890486" max="5541285.002383663"></map-input>
+        <map-input name="w" type="width" min="1" max="10000"></map-input>
+        <map-input name="h" type="height" min="1" max="10000"></map-input>
+        <map-link tref="http://localhost:8081/geoserver/wms?request=GetMap&crs=urn:x-ogc:def:crs:EPSG:3857&service=WMS&bbox={xmin},{ymin},{xmax},{ymax}&layers=archsites&format=image/png&width={w}&styles=&version=1.3.0&transparent=true&height={h}" rel="image"></map-link>
+      </map-extent>
+
+      <map-extent label="bugsites" units="OSMTILE">
+        <map-input name="z" type="zoom" value="18" min="6" max="18"></map-input>
+        <map-input name="xmin" type="location" rel="map" position="top-left" axis="easting" units="pcrs" min="-1.1562519561378933E7" max="-1.1536890915983597E7"></map-input>
+        <map-input name="ymin" type="location" rel="map" position="bottom-left" axis="northing" units="pcrs" min="5523497.466913541" max="5532885.323946325"></map-input>
+        <map-input name="xmax" type="location" rel="map" position="top-right" axis="easting" units="pcrs" min="-1.1562519561378933E7" max="-1.1536890915983597E7"></map-input>
+        <map-input name="ymax" type="location" rel="map" position="top-left" axis="northing" units="pcrs" min="5523497.466913541" max="5532885.323946325"></map-input>
+        <map-input name="w" type="width" min="1" max="10000"></map-input>
+        <map-input name="h" type="height" min="1" max="10000"></map-input>
+        <map-link tref="http://localhost:8081/geoserver/wms?request=GetMap&crs=urn:x-ogc:def:crs:EPSG:3857&service=WMS&bbox={xmin},{ymin},{xmax},{ymax}&layers=bugsites&format=image/png&width={w}&styles=&version=1.3.0&transparent=true&height={h}" rel="image"></map-link>
+      </map-extent>
+    </layer->-->
+<!--    <layer- label="Spearfish fetch" src="spearfish.mapml" ></layer->-->
+
+</mapml-viewer>
+</body>
 </html>
diff --git a/multiple-extents/spearfish.mapml b/multiple-extents/spearfish.mapml
new file mode 100644
index 0000000..f8885b8
--- /dev/null
+++ b/multiple-extents/spearfish.mapml
@@ -0,0 +1,81 @@
+<mapml- xmlns="http://www.w3.org/1999/xhtml">
+  <map-head>
+    <map-meta charset="utf-8"></map-meta>
+    <map-title>Spearfish</map-title>
+    <map-link href="https://geoserver.org" rel="license" title="GeoServer Project"/>
+      <map-meta name="extent" content="top-left-easting=-11573304.98,top-left-northing=5545277.52,bottom-right-easting=-11526672.02,bottom-right-northing=5520645.67"></map-meta>
+      <map-meta name="zoom" content="min=6,max=24"></map-meta>
+    <map-meta name="projection" content="OSMTILE"></map-meta>
+  </map-head>
+  <map-body>
+      <map-extent label="Elevation (m)" units="OSMTILE">
+        <map-input name="z" type="zoom" value="18" min="6" max="18"></map-input>
+        <map-input name="xmin" type="location" rel="map" position="top-left" axis="easting" units="pcrs" min="-1.1562867513204884E7" max="-1.1535963887183946E7"></map-input>
+        <map-input name="ymin" type="location" rel="map" position="bottom-left" axis="northing" units="pcrs" min="5522913.211891563" max="5543400.923533295"></map-input>
+        <map-input name="xmax" type="location" rel="map" position="top-right" axis="easting" units="pcrs" min="-1.1562867513204884E7" max="-1.1535963887183946E7"></map-input>
+        <map-input name="ymax" type="location" rel="map" position="top-left" axis="northing" units="pcrs" min="5522913.211891563" max="5543400.923533295"></map-input>
+        <map-input name="w" type="width" min="1" max="10000"></map-input>
+        <map-input name="h" type="height" min="1" max="10000"></map-input>
+        <map-link tref="http://localhost:8081/geoserver/wms?request=GetMap&amp;crs=urn:x-ogc:def:crs:EPSG:3857&amp;service=WMS&amp;bbox={xmin},{ymin},{xmax},{ymax}&amp;layers=sfdem&amp;format=image/png&amp;width={w}&amp;styles=&amp;version=1.3.0&amp;transparent=true&amp;height={h}" rel="image"></map-link>
+        <map-input name="i" type="location" axis="i" units="map"></map-input>
+        <map-input name="j" type="location" axis="j" units="map"></map-input>
+        <map-link tref="http://localhost:8081/geoserver/wms?request=GetFeatureInfo&amp;query_layers=spearfish&amp;crs=urn:x-ogc:def:crs:EPSG:3857&amp;bbox={xmin},{ymin},{xmax},{ymax}&amp;version=1.3.0&amp;transparent=true&amp;service=WMS&amp;layers=spearfish&amp;width={w}&amp;x={i}&amp;feature_count=50&amp;y={j}&amp;styles=&amp;info_format=text/mapml&amp;height={h}" rel="query"></map-link>
+      </map-extent>
+
+      <map-extent label="Streams" units="OSMTILE">
+        <map-input name="z" type="zoom" value="18" min="6" max="18"></map-input>
+        <map-input name="xmin" type="location" rel="map" position="top-left" axis="easting" units="pcrs" min="-1.1563624839736426E7" max="-1.1535237023686884E7"></map-input>
+        <map-input name="ymin" type="location" rel="map" position="bottom-left" axis="northing" units="pcrs" min="5523247.73970007" max="5543497.265261071"></map-input>
+        <map-input name="xmax" type="location" rel="map" position="top-right" axis="easting" units="pcrs" min="-1.1563624839736426E7" max="-1.1535237023686884E7"></map-input>
+        <map-input name="ymax" type="location" rel="map" position="top-left" axis="northing" units="pcrs" min="5523247.73970007" max="5543497.265261071"></map-input>
+        <map-input name="w" type="width" min="1" max="10000"></map-input>
+        <map-input name="h" type="height" min="1" max="10000"></map-input>
+        <map-link tref="http://localhost:8081/geoserver/wms?request=GetMap&amp;crs=urn:x-ogc:def:crs:EPSG:3857&amp;service=WMS&amp;bbox={xmin},{ymin},{xmax},{ymax}&amp;layers=streams&amp;format=image/png&amp;width={w}&amp;styles=&amp;version=1.3.0&amp;transparent=true&amp;height={h}" rel="image"></map-link>
+      </map-extent>
+
+      <map-extent label="Roads" units="OSMTILE">
+        <map-input name="z" type="zoom" value="18" min="6" max="18"></map-input>
+        <map-input name="xmin" type="location" rel="map" position="top-left" axis="easting" units="pcrs" min="-1.156362320885788E7" max="-1.153522460748034E7"></map-input>
+        <map-input name="ymin" type="location" rel="map" position="bottom-left" axis="northing" units="pcrs" min="5523330.219611262" max="5543486.508318696"></map-input>
+        <map-input name="xmax" type="location" rel="map" position="top-right" axis="easting" units="pcrs" min="-1.156362320885788E7" max="-1.153522460748034E7"></map-input>
+        <map-input name="ymax" type="location" rel="map" position="top-left" axis="northing" units="pcrs" min="5523330.219611262" max="5543486.508318696"></map-input>
+        <map-input name="w" type="width" min="1" max="10000"></map-input>
+        <map-input name="h" type="height" min="1" max="10000"></map-input>
+        <map-link tref="http://localhost:8081/geoserver/wms?request=GetMap&amp;crs=urn:x-ogc:def:crs:EPSG:3857&amp;service=WMS&amp;bbox={xmin},{ymin},{xmax},{ymax}&amp;layers=roads&amp;format=image/png&amp;width={w}&amp;styles=&amp;version=1.3.0&amp;transparent=true&amp;height={h}" rel="image"></map-link>
+      </map-extent>
+
+      <map-extent label="restricted areas" units="OSMTILE">
+        <map-input name="z" type="zoom" value="18" min="6" max="18"></map-input>
+        <map-input name="xmin" type="location" rel="map" position="top-left" axis="easting" units="pcrs" min="-1.1560583766353529E7" max="-1.1549100426349973E7"></map-input>
+        <map-input name="ymin" type="location" rel="map" position="bottom-left" axis="northing" units="pcrs" min="5526678.940140986" max="5540366.703552546"></map-input>
+        <map-input name="xmax" type="location" rel="map" position="top-right" axis="easting" units="pcrs" min="-1.1560583766353529E7" max="-1.1549100426349973E7"></map-input>
+        <map-input name="ymax" type="location" rel="map" position="top-left" axis="northing" units="pcrs" min="5526678.940140986" max="5540366.703552546"></map-input>
+        <map-input name="w" type="width" min="1" max="10000"></map-input>
+        <map-input name="h" type="height" min="1" max="10000"></map-input>
+        <map-link tref="http://localhost:8081/geoserver/wms?request=GetMap&amp;crs=urn:x-ogc:def:crs:EPSG:3857&amp;service=WMS&amp;bbox={xmin},{ymin},{xmax},{ymax}&amp;layers=restricted&amp;format=image/png&amp;width={w}&amp;styles=&amp;version=1.3.0&amp;transparent=true&amp;height={h}" rel="image"></map-link>
+      </map-extent>
+
+      <map-extent label="archsites" units="OSMTILE">
+        <map-input name="z" type="zoom" value="18" min="6" max="18"></map-input>
+        <map-input name="xmin" type="location" rel="map" position="top-left" axis="easting" units="pcrs" min="-1.1563031907938445E7" max="-1.1536913929529054E7"></map-input>
+        <map-input name="ymin" type="location" rel="map" position="bottom-left" axis="northing" units="pcrs" min="5524037.032890486" max="5541285.002383663"></map-input>
+        <map-input name="xmax" type="location" rel="map" position="top-right" axis="easting" units="pcrs" min="-1.1563031907938445E7" max="-1.1536913929529054E7"></map-input>
+        <map-input name="ymax" type="location" rel="map" position="top-left" axis="northing" units="pcrs" min="5524037.032890486" max="5541285.002383663"></map-input>
+        <map-input name="w" type="width" min="1" max="10000"></map-input>
+        <map-input name="h" type="height" min="1" max="10000"></map-input>
+        <map-link tref="http://localhost:8081/geoserver/wms?request=GetMap&amp;crs=urn:x-ogc:def:crs:EPSG:3857&amp;service=WMS&amp;bbox={xmin},{ymin},{xmax},{ymax}&amp;layers=archsites&amp;format=image/png&amp;width={w}&amp;styles=&amp;version=1.3.0&amp;transparent=true&amp;height={h}" rel="image"></map-link>
+      </map-extent>
+
+      <map-extent label="bugsites" units="OSMTILE">
+        <map-input name="z" type="zoom" value="18" min="6" max="18"></map-input>
+        <map-input name="xmin" type="location" rel="map" position="top-left" axis="easting" units="pcrs" min="-1.1562519561378933E7" max="-1.1536890915983597E7"></map-input>
+        <map-input name="ymin" type="location" rel="map" position="bottom-left" axis="northing" units="pcrs" min="5523497.466913541" max="5532885.323946325"></map-input>
+        <map-input name="xmax" type="location" rel="map" position="top-right" axis="easting" units="pcrs" min="-1.1562519561378933E7" max="-1.1536890915983597E7"></map-input>
+        <map-input name="ymax" type="location" rel="map" position="top-left" axis="northing" units="pcrs" min="5523497.466913541" max="5532885.323946325"></map-input>
+        <map-input name="w" type="width" min="1" max="10000"></map-input>
+        <map-input name="h" type="height" min="1" max="10000"></map-input>
+        <map-link tref="http://localhost:8081/geoserver/wms?request=GetMap&amp;crs=urn:x-ogc:def:crs:EPSG:3857&amp;service=WMS&amp;bbox={xmin},{ymin},{xmax},{ymax}&amp;layers=bugsites&amp;format=image/png&amp;width={w}&amp;styles=&amp;version=1.3.0&amp;transparent=true&amp;height={h}" rel="image"></map-link>
+      </map-extent>
+
+</map-body>      
+</mapml->
\ No newline at end of file
diff --git a/screenreader/closest-restaurants/index.html b/screenreader/closest-restaurants/index.html
index 0e8c9d3..7b6889c 100644
--- a/screenreader/closest-restaurants/index.html
+++ b/screenreader/closest-restaurants/index.html
@@ -146,7 +146,7 @@
             <map-option value="italian">Italian</map-option>
             <map-option value="mexican">Mexican</map-option>
           </map-select>
-          <map-link tref="./restaurants/{cusine}.mapml" rel="features"/>
+          <map-link tref="../../shared/restaurants/{cusine}.mapml" rel="features"/>
         </map-extent>
     </layer->
   </template>
diff --git a/screenreader/feature-index/dist/images/layers-2x.png b/screenreader/feature-index/dist/images/layers-2x.png
deleted file mode 100644
index 200c333dca9652ac4cba004d609e5af4eee168c1..0000000000000000000000000000000000000000
GIT binary patch
diff --git a/screenreader/feature-index/dist/images/layers.png b/screenreader/feature-index/dist/images/layers.png
deleted file mode 100644
index 1a72e5784b2b456eac5d7670738db80697af3377..0000000000000000000000000000000000000000
GIT binary patch
diff --git a/screenreader/feature-index/dist/images/marker-icon-2x.png b/screenreader/feature-index/dist/images/marker-icon-2x.png
deleted file mode 100644
index 88f9e501888c9c6cb29ad340d9a888627dd1b6d8..0000000000000000000000000000000000000000
GIT binary patch
diff --git a/screenreader/feature-index/dist/images/marker-icon.png b/screenreader/feature-index/dist/images/marker-icon.png
deleted file mode 100644
index 950edf24677ded147df13b26f91baa2b0fa70513..0000000000000000000000000000000000000000
GIT binary patch
diff --git a/screenreader/feature-index/dist/images/marker-shadow.png b/screenreader/feature-index/dist/images/marker-shadow.png
deleted file mode 100644
index 9fd2979532a19a15b824ce763c76e04a8dafadfb..0000000000000000000000000000000000000000
GIT binary patch
diff --git a/screenreader/feature-index/dist/index.html b/screenreader/feature-index/dist/index.html
deleted file mode 100644
index 753657e..0000000
--- a/screenreader/feature-index/dist/index.html
+++ /dev/null
@@ -1,79 +0,0 @@
-<!doctype html>
-<html lang="en">
-  <head>
-    <meta charset="utf-8">
-    <meta name="viewport" content="width=device-width,initial-scale=1">
-    <title>index-map.html</title>
-    <script type="module" src="dist/mapml-viewer.js"></script>
-     <style> 
-       html, 
-       body { 
-         height: 100%; 
-       } 
-       * { 
-         margin: 0; 
-         padding: 0; 
-       } 
-        
-       /* Specifying the `:defined` selector is recommended to style the map 
-       element, such that styles don't apply when fallback content is in use 
-       (e.g. when scripting is disabled or when custom/built-in elements isn't 
-       supported in the browser). */ 
-       mapml-viewer:defined { 
-         /* Responsive map. */ 
-          max-width: 100%;  
-          
-         /* Full viewport. */ 
-          width: 100%;  
-          height: 100%;  
-          
-         /* Remove default (native-like) border. */ 
-         border: none;
-         
-         vertical-align: middle;
-       } 
-        
-       /* Pre-style to avoid FOUC of inline layer- and fallback content. */ 
-       mapml-viewer:not(:defined) > * { 
-         display: none; 
-       } 
-       
-       /* Pre-style to avoid Layout Shift. */
-       mapml-viewer:not(:defined) {
-         display: inline-block;
-         contain: size;
-         contain-intrinsic-size: 304px 154px;
-       }
-       
-       /* Ensure inline layer content is hidden if custom/built-in elements isn't 
-       supported, or if javascript is disabled. This needs to be defined separately 
-       from the above, because the `:not(:defined)` selector invalidates the entire 
-       declaration in browsers that do not support it. */ 
-       layer- { 
-         display: none; 
-       } 
-     </style> 
-     <noscript> 
-       <style> 
-         /* Ensure fallback content (children of the map element) is displayed if 
-         custom/built-in elements is supported but javascript is disabled. */ 
-         mapml-viewer:not(:defined) > :not(layer-) { 
-           display: initial; 
-         } 
-         
-         /* "Reset" the properties used to pre-style (to avoid Layout Shift) if
-         custom/built-in elements is supported but javascript is disabled. */
-         mapml-viewer:not(:defined) {
-           display: initial;
-           contain: initial;
-           contain-intrinsic-size: initial;
-         }
-       </style> 
-     </noscript> 
-  </head>
-  <body>
-    <mapml-viewer projection="CBMTILE" zoom="2" lat="45" lon="-90" controls>
-      <layer- label="CBMT" src="https://geogratis.gc.ca/mapml/en/cbmtile/cbmt/" checked></layer->
-    </mapml-viewer>
-  </body>
-</html>
diff --git a/screenreader/feature-index/dist/layer.js b/screenreader/feature-index/dist/layer.js
deleted file mode 100644
index 8abacba..0000000
--- a/screenreader/feature-index/dist/layer.js
+++ /dev/null
@@ -1,359 +0,0 @@
-import './leaflet-src.js';  // a lightly modified version of Leaflet for use as browser module
-import './proj4-src.js';        // modified version of proj4; could be stripped down for mapml
-import './proj4leaflet.js'; // not modified, seems to adapt proj4 for leaflet use. 
-import './mapml.js';       // modified URI to make the function a property of window scope (possibly a bad thing to do).
-
-export class MapLayer extends HTMLElement {
-  static get observedAttributes() {
-    return ['src', 'label', 'checked', 'hidden'];
-  }
-  get src() {
-    return this.hasAttribute('src')?this.getAttribute('src'):'';
-  }
-
-  set src(val) {
-    if (val) {
-      this.setAttribute('src', val);
-      if (this._layer) {
-        let oldOpacity = this.opacity;
-        // go through the same sequence as if the layer had been removed from
-        // the DOM and re-attached with a new URL source.
-        this.disconnectedCallback();
-        var base = this.baseURI ? this.baseURI : document.baseURI;
-        this._layer = M.mapMLLayer(val ? (new URL(val, base)).href: null, this);
-        this._layer.on('extentload', this._onLayerExtentLoad, this);
-        this._setUpEvents();
-        if (this.parentNode) {
-          this.connectedCallback();
-        }
-        this.opacity = oldOpacity;
-      }
-    }
-  }
-  get label() {
-    return this.hasAttribute('label')?this.getAttribute('label'):'';
-  }
-  set label(val) {
-    if (val) {
-      this.setAttribute('label',val);
-    }
-  }
-  get checked() {
-    return this.hasAttribute('checked');
-  }
-  
-  set checked(val) {
-    if (val) {
-      this.setAttribute('checked', '');
-    } else {
-      this.removeAttribute('checked');
-    }
-  }
-  
-  get hidden() {
-    return this.hasAttribute('hidden');
-  }
-
-  set hidden(val) {
-    if (val) {
-      this.setAttribute('hidden', '');
-    } else {
-      this.removeAttribute('hidden');
-    }
-  }
-
-  get opacity(){
-    return this._layer._container.style.opacity || this._layer.options.opacity;
-  }
-
-  set opacity(val) {
-    if(+val > 1 || +val < 0) return;
-    this._layer.changeOpacity(val);
-  }
-
-  constructor() {
-    // Always call super first in constructor
-    super();
-  }
-  disconnectedCallback() {
-//    console.log('Custom map element removed from page.');
-    // if the map-layer node is removed from the dom, the layer should be
-    // removed from the map and the layer control 
-
-    // this is moved up here so that the layer control doesn't respond
-    // to the layer being removed with the _onLayerChange execution
-    // that is set up in _attached:
-    if(this.hasAttribute("data-moving")) return;
-    this._removeEvents();
-    if (this._layer._map) {
-      this._layer._map.removeLayer(this._layer);
-    }
-
-    if (this._layerControl && !this.hidden) {
-      this._layerControl.removeLayer(this._layer);
-    }
-  }
-  connectedCallback() {
-    //creates listener that waits for createmap event, this allows for delayed builds of maps
-    //this allows a safeguard for the case where loading a custom TCRS takes longer than loading mapml-viewer.js/web-map.js
-    if(this.hasAttribute("data-moving")) return;
-    this.parentNode.addEventListener('createmap', ()=>{
-      this._ready();
-      // if the map has been attached, set this layer up wrt Leaflet map
-      if (this.parentNode._map) {
-          this._attachedToMap();
-      }
-      if (this._layerControl && !this.hidden) {
-        this._layerControl.addOrUpdateOverlay(this._layer, this.label);
-      }
-    }, {once:true}); //listener stops listening after event occurs once
-    //if map is already created then dispatch createmap event, allowing layer to be built
-    if(this.parentNode._map)this.parentNode.dispatchEvent(new CustomEvent('createmap'));
-  }
-  adoptedCallback() {
-//    console.log('Custom map element moved to new page.');
-  }
-  attributeChangedCallback(name, oldValue, newValue) {
-    switch(name) {
-      case 'label': 
-        if (oldValue !== newValue) {
-          this.dispatchEvent(new CustomEvent('labelchanged', {detail: 
-            {target: this}}));
-        }
-      break;
-      case 'checked': 
-        if (this._layer) {
-          if (typeof newValue === "string") {
-            this.parentElement._map.addLayer(this._layer);
-          } else {
-            this.parentElement._map.removeLayer(this._layer);
-          }
-          this.dispatchEvent(new Event("change", { bubbles: true }));
-        }
-      break;
-    case 'hidden':
-      var map = this.parentElement && this.parentElement._map;
-      if (map && this.parentElement.controls) {
-          if (typeof newValue === "string") {
-              if (this._layer) {
-                this.parentElement._layerControl.removeLayer(this._layer);
-              }
-          } else {
-              this._layerControl = this.parentElement._layerControl;
-              this._layerControl.addOrUpdateOverlay(this._layer, this.label);
-              this._validateDisabled();
-          }
-      }
-      break;
-    }
-  }
-  _onLayerExtentLoad(e) {
-    // the mapml document associated to this layer can in theory contain many
-    // link[@rel=legend] elements with different @type or other attributes;
-    // currently only support a single link, don't care about type, lang etc.
-    // TODO: add support for full LayerLegend object, and > one link.
-    if (this._layer._legendUrl) {
-      this.legendLinks = 
-        [{ type: 'application/octet-stream',
-           href: this._layer._legendUrl,
-           rel: 'legend',
-           lang: null,
-           hreflang: null,
-           sizes: null }];
-    }
-    if (this._layer._title) {
-      this.label = this._layer._title;
-    }
-    // make sure local content layer has the chance to set its extent properly
-    // which is important for the layer control and the disabled property
-    if (this._layer._map) {
-      this._layer.fire('attached', this._layer);
-    }
-    // TODO ensure the controls in this._layerControl contain 'live' controls
-    // which control the layer, not potentially the previous style / src
-    if (this._layerControl) {
-      this._layerControl.addOrUpdateOverlay(this._layer, this.label);
-    }
-    if (!this._layer.error) {
-      // re-use 'loadedmetadata' event from HTMLMediaElement inteface, applied
-      // to MapML extent as metadata
-      // https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/loadedmetadata_event
-      this.dispatchEvent(new CustomEvent('loadedmetadata', {detail: 
-                {target: this}}));
-    } else {
-      this.dispatchEvent(new CustomEvent('error', {detail: 
-                {target: this}}));
-    }
-  }
-  _validateDisabled() {
-    setTimeout(() => {
-      let layer = this._layer, map = layer._map;
-      if (map) {
-        let count = 0, total=0, layerTypes = ["_staticTileLayer","_imageLayer","_mapmlvectors","_templatedLayer"];
-        if(layer.validProjection){
-          for(let j = 0 ;j<layerTypes.length;j++){
-            let type = layerTypes[j];
-            if(this.checked && layer[type]){
-              if(type === "_templatedLayer"){
-                for(let j =0;j<layer[type]._templates.length;j++){
-                  if(layer[type]._templates[j].rel ==="query") continue;
-                  total++;
-                  if(!(layer[type]._templates[j].layer.isVisible))count++;
-                }
-              } else {
-                total++;
-                  if(!(layer[type].isVisible))count++;
-              }
-            }
-          }
-        } else{
-          count = 1;
-          total = 1;
-        }
-
-        if(count === total && count !== 0){
-          this.setAttribute("disabled", ""); //set a disabled attribute on the layer element
-          this.disabled = true;
-        } else {
-          //might be better not to disable the layer controls, might want to deselect layer even when its out of bounds
-          this.removeAttribute("disabled");
-          this.disabled = false;
-        }
-        map.fire("validate");
-      }
-    }, 0);
-  }
-  _onLayerChange() {
-    if (this._layer._map) {
-     // can't disable observers, have to set a flag telling it where
-     // the 'event' comes from: either the api or a user click/tap
-     // may not be necessary -> this._apiToggleChecked = false;
-     this.checked = this._layer._map.hasLayer(this._layer);
-    }
-  }
-  _ready() {
-    // the layer might not be attached to a map
-    // so we need a way for non-src based layers to establish what their
-    // zoom range, extent and projection are.  meta elements in content to
-    // allow the author to provide this explicitly are one way, they will
-    // be parsed from the second parameter here
-    // IE 11 did not have a value for this.baseURI for some reason
-    var base = this.baseURI ? this.baseURI : document.baseURI;
-    this._layer = M.mapMLLayer(this.src ? (new URL(this.src, base)).href: null, this, {mapprojection:this.parentElement._map.options.projection});
-    this._layer.on('extentload', this._onLayerExtentLoad, this);
-    this._setUpEvents();
-  }
-  _attachedToMap() {
-    // set i to the position of this layer element in the set of layers
-    var i = 0, position = 1;
-    for (var nodes = this.parentNode.children;i < nodes.length;i++) {
-      if (this.parentNode.children[i].nodeName === "LAYER-") {
-        if (this.parentNode.children[i] === this) {
-          position = i + 1;
-        } else if (this.parentNode.children[i]._layer) {
-          this.parentNode.children[i]._layer.setZIndex(i+1);
-        }
-      }
-    }
-    var proj = this.parentNode.projection ? this.parentNode.projection : "OSMTILE";
-    L.setOptions(this._layer, {zIndex: position, mapprojection: proj, opacity: window.getComputedStyle(this).opacity});
-    // make sure the Leaflet layer has a reference to the map
-    this._layer._map = this.parentNode._map;
-    // notify the layer that it is attached to a map (layer._map)
-    this._layer.fire('attached');
-
-    if (this.checked) {
-      this._layer.addTo(this._layer._map);
-    }
-    
-    // add the handler which toggles the 'checked' property based on the
-    // user checking/unchecking the layer from the layer control
-    // this must be done *after* the layer is actually added to the map
-    this._layer.on('add remove', this._onLayerChange,  this);
-    this._layer.on('add remove extentload', this._validateDisabled,  this);
-
-    // if controls option is enabled, insert the layer into the overlays array
-    if (this.parentNode._layerControl && !this.hidden) {
-      this._layerControl = this.parentNode._layerControl;
-      this._layerControl.addOrUpdateOverlay(this._layer, this.label);
-    }
-    // toggle the this.disabled attribute depending on whether the layer
-    // is: same prj as map, within view/zoom of map
-    this._layer._map.on('moveend', this._validateDisabled,  this);
-    this._layer._map.on('checkdisabled', this._validateDisabled, this);
-    // this is necessary to get the layer control to compare the layer
-    // extents with the map extent & zoom, but it needs to be rethought TODO
-    // for one thing, layers which are checked by the author before 
-    // adding to the map are displayed despite that they are not visible
-    // See issue #26
-//        this._layer._map.fire('moveend');
-  }
-  _removeEvents() {
-    if (this._layer) {
-      this._layer.off('loadstart', false, this);
-      this._layer.off('changestyle', false, this);
-      this._layer.off('add remove', this._onLayerChange,  this);
-    }
-  }
-  _setUpEvents() {
-    this._layer.on('loadstart', 
-        function () {
-            this.dispatchEvent(new CustomEvent('loadstart', {detail: 
-              {target: this}}));
-        }, this);      
-    this._layer.on('changestyle',
-        function(e) {
-          this.src = e.src;
-          this.dispatchEvent(new CustomEvent('changestyle', {detail: 
-              {target: this}}));
-        },this);
-    this._layer.on('changeprojection',
-        function(e) {
-          this.src = e.href;
-          this.dispatchEvent(new CustomEvent('changeprojection', {detail: 
-              {target: this}}));
-        },this);
-  }
-  focus(){
-    if(!this.extent) return;
-    let map = this._layer._map,
-      tL = this.extent.topLeft.pcrs,
-      bR = this.extent.bottomRight.pcrs,
-      layerBounds = L.bounds(L.point(tL.horizontal, tL.vertical), L.point(bR.horizontal, bR.vertical)),
-      center = map.options.crs.unproject(layerBounds.getCenter(true)),
-      newZoom = map.getZoom();
-
-    let maxZoom = this.extent.zoom.maxZoom, minZoom = this.extent.zoom.minZoom;
-
-    let scale = map.options.crs.scale(newZoom),
-      mapCenterTCRS = map.options.crs.transformation.transform(layerBounds.getCenter(true), scale);
-
-    let mapHalf = map.getSize().divideBy(2),
-      mapTlNew = mapCenterTCRS.subtract(mapHalf).round(),
-      mapBrNew = mapCenterTCRS.add(mapHalf).round();
-
-    let mapTlPCRSNew = M.pixelToPCRSPoint(mapTlNew, newZoom, map.options.projection),
-      mapBrPCRSNew = M.pixelToPCRSPoint(mapBrNew, newZoom, map.options.projection);
-
-    let mapPCRS = L.bounds(mapTlPCRSNew, mapBrPCRSNew);
-
-    let zOffset = mapPCRS.contains(layerBounds) ? 1 : -1;
-
-    while((zOffset === -1 && !(mapPCRS.contains(layerBounds)) && (newZoom - 1) >= minZoom)  ||
-          (zOffset === 1 && mapPCRS.contains(layerBounds) && (newZoom + 1) <= maxZoom)) {
-      newZoom += zOffset;
-
-      scale = map.options.crs.scale(newZoom);
-      mapCenterTCRS = map.options.crs.transformation.transform(layerBounds.getCenter(true), scale);
-
-      mapTlNew = mapCenterTCRS.subtract(mapHalf).round();
-      mapBrNew = mapCenterTCRS.add(mapHalf).round();
-      mapTlPCRSNew = M.pixelToPCRSPoint(mapTlNew, newZoom, map.options.projection);
-      mapBrPCRSNew = M.pixelToPCRSPoint(mapBrNew, newZoom, map.options.projection);
-
-      mapPCRS = L.bounds(mapTlPCRSNew, mapBrPCRSNew);
-    }
-    if(zOffset === 1 && newZoom - 1 >= 0) newZoom--;
-    map.setView(center, newZoom, {animate: false});
-  }
-}
diff --git a/screenreader/feature-index/dist/leaflet-src.js b/screenreader/feature-index/dist/leaflet-src.js
deleted file mode 100644
index 503e5fc..0000000
--- a/screenreader/feature-index/dist/leaflet-src.js
+++ /dev/null
@@ -1,14062 +0,0 @@
-/* @preserve
- * Leaflet 1.7.1, a JS library for interactive maps. http://leafletjs.com
- * (c) 2010-2019 Vladimir Agafonkin, (c) 2010-2011 CloudMade
- */
-
-(function (global, factory) {
-  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
-  typeof define === 'function' && define.amd ? define(['exports'], factory) :
-  (factory((global.L = {})));
-}(window, (function (exports) { 'use strict';
-
-  var version = "1.7.1";
-
-  /*
-   * @namespace Util
-   *
-   * Various utility functions, used by Leaflet internally.
-   */
-
-  // @function extend(dest: Object, src?: Object): Object
-  // Merges the properties of the `src` object (or multiple objects) into `dest` object and returns the latter. Has an `L.extend` shortcut.
-  function extend(dest) {
-  	var i, j, len, src;
-
-  	for (j = 1, len = arguments.length; j < len; j++) {
-  		src = arguments[j];
-  		for (i in src) {
-  			dest[i] = src[i];
-  		}
-  	}
-  	return dest;
-  }
-
-  // @function create(proto: Object, properties?: Object): Object
-  // Compatibility polyfill for [Object.create](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/create)
-  var create = Object.create || (function () {
-  	function F() {}
-  	return function (proto) {
-  		F.prototype = proto;
-  		return new F();
-  	};
-  })();
-
-  // @function bind(fn: Function, …): Function
-  // Returns a new function bound to the arguments passed, like [Function.prototype.bind](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function/bind).
-  // Has a `L.bind()` shortcut.
-  function bind(fn, obj) {
-  	var slice = Array.prototype.slice;
-
-  	if (fn.bind) {
-  		return fn.bind.apply(fn, slice.call(arguments, 1));
-  	}
-
-  	var args = slice.call(arguments, 2);
-
-  	return function () {
-  		return fn.apply(obj, args.length ? args.concat(slice.call(arguments)) : arguments);
-  	};
-  }
-
-  // @property lastId: Number
-  // Last unique ID used by [`stamp()`](#util-stamp)
-  var lastId = 0;
-
-  // @function stamp(obj: Object): Number
-  // Returns the unique ID of an object, assigning it one if it doesn't have it.
-  function stamp(obj) {
-  	/*eslint-disable */
-  	obj._leaflet_id = obj._leaflet_id || ++lastId;
-  	return obj._leaflet_id;
-  	/* eslint-enable */
-  }
-
-  // @function throttle(fn: Function, time: Number, context: Object): Function
-  // Returns a function which executes function `fn` with the given scope `context`
-  // (so that the `this` keyword refers to `context` inside `fn`'s code). The function
-  // `fn` will be called no more than one time per given amount of `time`. The arguments
-  // received by the bound function will be any arguments passed when binding the
-  // function, followed by any arguments passed when invoking the bound function.
-  // Has an `L.throttle` shortcut.
-  function throttle(fn, time, context) {
-  	var lock, args, wrapperFn, later;
-
-  	later = function () {
-  		// reset lock and call if queued
-  		lock = false;
-  		if (args) {
-  			wrapperFn.apply(context, args);
-  			args = false;
-  		}
-  	};
-
-  	wrapperFn = function () {
-  		if (lock) {
-  			// called too soon, queue to call later
-  			args = arguments;
-
-  		} else {
-  			// call and lock until later
-  			fn.apply(context, arguments);
-  			setTimeout(later, time);
-  			lock = true;
-  		}
-  	};
-
-  	return wrapperFn;
-  }
-
-  // @function wrapNum(num: Number, range: Number[], includeMax?: Boolean): Number
-  // Returns the number `num` modulo `range` in such a way so it lies within
-  // `range[0]` and `range[1]`. The returned value will be always smaller than
-  // `range[1]` unless `includeMax` is set to `true`.
-  function wrapNum(x, range, includeMax) {
-  	var max = range[1],
-  	    min = range[0],
-  	    d = max - min;
-  	return x === max && includeMax ? x : ((x - min) % d + d) % d + min;
-  }
-
-  // @function falseFn(): Function
-  // Returns a function which always returns `false`.
-  function falseFn() { return false; }
-
-  // @function formatNum(num: Number, digits?: Number): Number
-  // Returns the number `num` rounded to `digits` decimals, or to 6 decimals by default.
-  function formatNum(num, digits) {
-  	var pow = Math.pow(10, (digits === undefined ? 6 : digits));
-  	return Math.round(num * pow) / pow;
-  }
-
-  // @function trim(str: String): String
-  // Compatibility polyfill for [String.prototype.trim](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim)
-  function trim(str) {
-  	return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, '');
-  }
-
-  // @function splitWords(str: String): String[]
-  // Trims and splits the string on whitespace and returns the array of parts.
-  function splitWords(str) {
-  	return trim(str).split(/\s+/);
-  }
-
-  // @function setOptions(obj: Object, options: Object): Object
-  // Merges the given properties to the `options` of the `obj` object, returning the resulting options. See `Class options`. Has an `L.setOptions` shortcut.
-  function setOptions(obj, options) {
-  	if (!Object.prototype.hasOwnProperty.call(obj, 'options')) {
-  		obj.options = obj.options ? create(obj.options) : {};
-  	}
-  	for (var i in options) {
-  		obj.options[i] = options[i];
-  	}
-  	return obj.options;
-  }
-
-  // @function getParamString(obj: Object, existingUrl?: String, uppercase?: Boolean): String
-  // Converts an object into a parameter URL string, e.g. `{a: "foo", b: "bar"}`
-  // translates to `'?a=foo&b=bar'`. If `existingUrl` is set, the parameters will
-  // be appended at the end. If `uppercase` is `true`, the parameter names will
-  // be uppercased (e.g. `'?A=foo&B=bar'`)
-  function getParamString(obj, existingUrl, uppercase) {
-  	var params = [];
-  	for (var i in obj) {
-  		params.push(encodeURIComponent(uppercase ? i.toUpperCase() : i) + '=' + encodeURIComponent(obj[i]));
-  	}
-  	return ((!existingUrl || existingUrl.indexOf('?') === -1) ? '?' : '&') + params.join('&');
-  }
-
-  var templateRe = /\{ *([\w_-]+) *\}/g;
-
-  // @function template(str: String, data: Object): String
-  // Simple templating facility, accepts a template string of the form `'Hello {a}, {b}'`
-  // and a data object like `{a: 'foo', b: 'bar'}`, returns evaluated string
-  // `('Hello foo, bar')`. You can also specify functions instead of strings for
-  // data values — they will be evaluated passing `data` as an argument.
-  function template(str, data) {
-  	return str.replace(templateRe, function (str, key) {
-  		var value = data[key];
-
-  		if (value === undefined) {
-  			throw new Error('No value provided for variable ' + str);
-
-  		} else if (typeof value === 'function') {
-  			value = value(data);
-  		}
-  		return value;
-  	});
-  }
-
-  // @function isArray(obj): Boolean
-  // Compatibility polyfill for [Array.isArray](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray)
-  var isArray = Array.isArray || function (obj) {
-  	return (Object.prototype.toString.call(obj) === '[object Array]');
-  };
-
-  // @function indexOf(array: Array, el: Object): Number
-  // Compatibility polyfill for [Array.prototype.indexOf](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf)
-  function indexOf(array, el) {
-  	for (var i = 0; i < array.length; i++) {
-  		if (array[i] === el) { return i; }
-  	}
-  	return -1;
-  }
-
-  // @property emptyImageUrl: String
-  // Data URI string containing a base64-encoded empty GIF image.
-  // Used as a hack to free memory from unused images on WebKit-powered
-  // mobile devices (by setting image `src` to this string).
-  var emptyImageUrl = 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=';
-
-  // inspired by http://paulirish.com/2011/requestanimationframe-for-smart-animating/
-
-  function getPrefixed(name) {
-  	return window['webkit' + name] || window['moz' + name] || window['ms' + name];
-  }
-
-  var lastTime = 0;
-
-  // fallback for IE 7-8
-  function timeoutDefer(fn) {
-  	var time = +new Date(),
-  	    timeToCall = Math.max(0, 16 - (time - lastTime));
-
-  	lastTime = time + timeToCall;
-  	return window.setTimeout(fn, timeToCall);
-  }
-
-  var requestFn = window.requestAnimationFrame || getPrefixed('RequestAnimationFrame') || timeoutDefer;
-  var cancelFn = window.cancelAnimationFrame || getPrefixed('CancelAnimationFrame') ||
-  		getPrefixed('CancelRequestAnimationFrame') || function (id) { window.clearTimeout(id); };
-
-  // @function requestAnimFrame(fn: Function, context?: Object, immediate?: Boolean): Number
-  // Schedules `fn` to be executed when the browser repaints. `fn` is bound to
-  // `context` if given. When `immediate` is set, `fn` is called immediately if
-  // the browser doesn't have native support for
-  // [`window.requestAnimationFrame`](https://developer.mozilla.org/docs/Web/API/window/requestAnimationFrame),
-  // otherwise it's delayed. Returns a request ID that can be used to cancel the request.
-  function requestAnimFrame(fn, context, immediate) {
-  	if (immediate && requestFn === timeoutDefer) {
-  		fn.call(context);
-  	} else {
-  		return requestFn.call(window, bind(fn, context));
-  	}
-  }
-
-  // @function cancelAnimFrame(id: Number): undefined
-  // Cancels a previous `requestAnimFrame`. See also [window.cancelAnimationFrame](https://developer.mozilla.org/docs/Web/API/window/cancelAnimationFrame).
-  function cancelAnimFrame(id) {
-  	if (id) {
-  		cancelFn.call(window, id);
-  	}
-  }
-
-  var Util = ({
-    extend: extend,
-    create: create,
-    bind: bind,
-    lastId: lastId,
-    stamp: stamp,
-    throttle: throttle,
-    wrapNum: wrapNum,
-    falseFn: falseFn,
-    formatNum: formatNum,
-    trim: trim,
-    splitWords: splitWords,
-    setOptions: setOptions,
-    getParamString: getParamString,
-    template: template,
-    isArray: isArray,
-    indexOf: indexOf,
-    emptyImageUrl: emptyImageUrl,
-    requestFn: requestFn,
-    cancelFn: cancelFn,
-    requestAnimFrame: requestAnimFrame,
-    cancelAnimFrame: cancelAnimFrame
-  });
-
-  // @class Class
-  // @aka L.Class
-
-  // @section
-  // @uninheritable
-
-  // Thanks to John Resig and Dean Edwards for inspiration!
-
-  function Class() {}
-
-  Class.extend = function (props) {
-
-  	// @function extend(props: Object): Function
-  	// [Extends the current class](#class-inheritance) given the properties to be included.
-  	// Returns a Javascript function that is a class constructor (to be called with `new`).
-  	var NewClass = function () {
-
-  		// call the constructor
-  		if (this.initialize) {
-  			this.initialize.apply(this, arguments);
-  		}
-
-  		// call all constructor hooks
-  		this.callInitHooks();
-  	};
-
-  	var parentProto = NewClass.__super__ = this.prototype;
-
-  	var proto = create(parentProto);
-  	proto.constructor = NewClass;
-
-  	NewClass.prototype = proto;
-
-  	// inherit parent's statics
-  	for (var i in this) {
-  		if (Object.prototype.hasOwnProperty.call(this, i) && i !== 'prototype' && i !== '__super__') {
-  			NewClass[i] = this[i];
-  		}
-  	}
-
-  	// mix static properties into the class
-  	if (props.statics) {
-  		extend(NewClass, props.statics);
-  		delete props.statics;
-  	}
-
-  	// mix includes into the prototype
-  	if (props.includes) {
-  		checkDeprecatedMixinEvents(props.includes);
-  		extend.apply(null, [proto].concat(props.includes));
-  		delete props.includes;
-  	}
-
-  	// merge options
-  	if (proto.options) {
-  		props.options = extend(create(proto.options), props.options);
-  	}
-
-  	// mix given properties into the prototype
-  	extend(proto, props);
-
-  	proto._initHooks = [];
-
-  	// add method for calling all hooks
-  	proto.callInitHooks = function () {
-
-  		if (this._initHooksCalled) { return; }
-
-  		if (parentProto.callInitHooks) {
-  			parentProto.callInitHooks.call(this);
-  		}
-
-  		this._initHooksCalled = true;
-
-  		for (var i = 0, len = proto._initHooks.length; i < len; i++) {
-  			proto._initHooks[i].call(this);
-  		}
-  	};
-
-  	return NewClass;
-  };
-
-
-  // @function include(properties: Object): this
-  // [Includes a mixin](#class-includes) into the current class.
-  Class.include = function (props) {
-  	extend(this.prototype, props);
-  	return this;
-  };
-
-  // @function mergeOptions(options: Object): this
-  // [Merges `options`](#class-options) into the defaults of the class.
-  Class.mergeOptions = function (options) {
-  	extend(this.prototype.options, options);
-  	return this;
-  };
-
-  // @function addInitHook(fn: Function): this
-  // Adds a [constructor hook](#class-constructor-hooks) to the class.
-  Class.addInitHook = function (fn) { // (Function) || (String, args...)
-  	var args = Array.prototype.slice.call(arguments, 1);
-
-  	var init = typeof fn === 'function' ? fn : function () {
-  		this[fn].apply(this, args);
-  	};
-
-  	this.prototype._initHooks = this.prototype._initHooks || [];
-  	this.prototype._initHooks.push(init);
-  	return this;
-  };
-
-  function checkDeprecatedMixinEvents(includes) {
-  	if (typeof L === 'undefined' || !L || !L.Mixin) { return; }
-
-  	includes = isArray(includes) ? includes : [includes];
-
-  	for (var i = 0; i < includes.length; i++) {
-  		if (includes[i] === L.Mixin.Events) {
-  			console.warn('Deprecated include of L.Mixin.Events: ' +
-  				'this property will be removed in future releases, ' +
-  				'please inherit from L.Evented instead.', new Error().stack);
-  		}
-  	}
-  }
-
-  /*
-   * @class Evented
-   * @aka L.Evented
-   * @inherits Class
-   *
-   * A set of methods shared between event-powered classes (like `Map` and `Marker`). Generally, events allow you to execute some function when something happens with an object (e.g. the user clicks on the map, causing the map to fire `'click'` event).
-   *
-   * @example
-   *
-   * ```js
-   * map.on('click', function(e) {
-   * 	alert(e.latlng);
-   * } );
-   * ```
-   *
-   * Leaflet deals with event listeners by reference, so if you want to add a listener and then remove it, define it as a function:
-   *
-   * ```js
-   * function onClick(e) { ... }
-   *
-   * map.on('click', onClick);
-   * map.off('click', onClick);
-   * ```
-   */
-
-  var Events = {
-  	/* @method on(type: String, fn: Function, context?: Object): this
-  	 * Adds a listener function (`fn`) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. `'click dblclick'`).
-  	 *
-  	 * @alternative
-  	 * @method on(eventMap: Object): this
-  	 * Adds a set of type/listener pairs, e.g. `{click: onClick, mousemove: onMouseMove}`
-  	 */
-  	on: function (types, fn, context) {
-
-  		// types can be a map of types/handlers
-  		if (typeof types === 'object') {
-  			for (var type in types) {
-  				// we don't process space-separated events here for performance;
-  				// it's a hot path since Layer uses the on(obj) syntax
-  				this._on(type, types[type], fn);
-  			}
-
-  		} else {
-  			// types can be a string of space-separated words
-  			types = splitWords(types);
-
-  			for (var i = 0, len = types.length; i < len; i++) {
-  				this._on(types[i], fn, context);
-  			}
-  		}
-
-  		return this;
-  	},
-
-  	/* @method off(type: String, fn?: Function, context?: Object): this
-  	 * Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to `on`, you must pass the same context to `off` in order to remove the listener.
-  	 *
-  	 * @alternative
-  	 * @method off(eventMap: Object): this
-  	 * Removes a set of type/listener pairs.
-  	 *
-  	 * @alternative
-  	 * @method off: this
-  	 * Removes all listeners to all events on the object. This includes implicitly attached events.
-  	 */
-  	off: function (types, fn, context) {
-
-  		if (!types) {
-  			// clear all listeners if called without arguments
-  			delete this._events;
-
-  		} else if (typeof types === 'object') {
-  			for (var type in types) {
-  				this._off(type, types[type], fn);
-  			}
-
-  		} else {
-  			types = splitWords(types);
-
-  			for (var i = 0, len = types.length; i < len; i++) {
-  				this._off(types[i], fn, context);
-  			}
-  		}
-
-  		return this;
-  	},
-
-  	// attach listener (without syntactic sugar now)
-  	_on: function (type, fn, context) {
-  		this._events = this._events || {};
-
-  		/* get/init listeners for type */
-  		var typeListeners = this._events[type];
-  		if (!typeListeners) {
-  			typeListeners = [];
-  			this._events[type] = typeListeners;
-  		}
-
-  		if (context === this) {
-  			// Less memory footprint.
-  			context = undefined;
-  		}
-  		var newListener = {fn: fn, ctx: context},
-  		    listeners = typeListeners;
-
-  		// check if fn already there
-  		for (var i = 0, len = listeners.length; i < len; i++) {
-  			if (listeners[i].fn === fn && listeners[i].ctx === context) {
-  				return;
-  			}
-  		}
-
-  		listeners.push(newListener);
-  	},
-
-  	_off: function (type, fn, context) {
-  		var listeners,
-  		    i,
-  		    len;
-
-  		if (!this._events) { return; }
-
-  		listeners = this._events[type];
-
-  		if (!listeners) {
-  			return;
-  		}
-
-  		if (!fn) {
-  			// Set all removed listeners to noop so they are not called if remove happens in fire
-  			for (i = 0, len = listeners.length; i < len; i++) {
-  				listeners[i].fn = falseFn;
-  			}
-  			// clear all listeners for a type if function isn't specified
-  			delete this._events[type];
-  			return;
-  		}
-
-  		if (context === this) {
-  			context = undefined;
-  		}
-
-  		if (listeners) {
-
-  			// find fn and remove it
-  			for (i = 0, len = listeners.length; i < len; i++) {
-  				var l = listeners[i];
-  				if (l.ctx !== context) { continue; }
-  				if (l.fn === fn) {
-
-  					// set the removed listener to noop so that's not called if remove happens in fire
-  					l.fn = falseFn;
-
-  					if (this._firingCount) {
-  						/* copy array in case events are being fired */
-  						this._events[type] = listeners = listeners.slice();
-  					}
-  					listeners.splice(i, 1);
-
-  					return;
-  				}
-  			}
-  		}
-  	},
-
-  	// @method fire(type: String, data?: Object, propagate?: Boolean): this
-  	// Fires an event of the specified type. You can optionally provide an data
-  	// object — the first argument of the listener function will contain its
-  	// properties. The event can optionally be propagated to event parents.
-  	fire: function (type, data, propagate) {
-  		if (!this.listens(type, propagate)) { return this; }
-
-  		var event = extend({}, data, {
-  			type: type,
-  			target: this,
-  			sourceTarget: data && data.sourceTarget || this
-  		});
-
-  		if (this._events) {
-  			var listeners = this._events[type];
-
-  			if (listeners) {
-  				this._firingCount = (this._firingCount + 1) || 1;
-  				for (var i = 0, len = listeners.length; i < len; i++) {
-  					var l = listeners[i];
-  					l.fn.call(l.ctx || this, event);
-  				}
-
-  				this._firingCount--;
-  			}
-  		}
-
-  		if (propagate) {
-  			// propagate the event to parents (set with addEventParent)
-  			this._propagateEvent(event);
-  		}
-
-  		return this;
-  	},
-
-  	// @method listens(type: String): Boolean
-  	// Returns `true` if a particular event type has any listeners attached to it.
-  	listens: function (type, propagate) {
-  		var listeners = this._events && this._events[type];
-  		if (listeners && listeners.length) { return true; }
-
-  		if (propagate) {
-  			// also check parents for listeners if event propagates
-  			for (var id in this._eventParents) {
-  				if (this._eventParents[id].listens(type, propagate)) { return true; }
-  			}
-  		}
-  		return false;
-  	},
-
-  	// @method once(…): this
-  	// Behaves as [`on(…)`](#evented-on), except the listener will only get fired once and then removed.
-  	once: function (types, fn, context) {
-
-  		if (typeof types === 'object') {
-  			for (var type in types) {
-  				this.once(type, types[type], fn);
-  			}
-  			return this;
-  		}
-
-  		var handler = bind(function () {
-  			this
-  			    .off(types, fn, context)
-  			    .off(types, handler, context);
-  		}, this);
-
-  		// add a listener that's executed once and removed after that
-  		return this
-  		    .on(types, fn, context)
-  		    .on(types, handler, context);
-  	},
-
-  	// @method addEventParent(obj: Evented): this
-  	// Adds an event parent - an `Evented` that will receive propagated events
-  	addEventParent: function (obj) {
-  		this._eventParents = this._eventParents || {};
-  		this._eventParents[stamp(obj)] = obj;
-  		return this;
-  	},
-
-  	// @method removeEventParent(obj: Evented): this
-  	// Removes an event parent, so it will stop receiving propagated events
-  	removeEventParent: function (obj) {
-  		if (this._eventParents) {
-  			delete this._eventParents[stamp(obj)];
-  		}
-  		return this;
-  	},
-
-  	_propagateEvent: function (e) {
-  		for (var id in this._eventParents) {
-  			this._eventParents[id].fire(e.type, extend({
-  				layer: e.target,
-  				propagatedFrom: e.target
-  			}, e), true);
-  		}
-  	}
-  };
-
-  // aliases; we should ditch those eventually
-
-  // @method addEventListener(…): this
-  // Alias to [`on(…)`](#evented-on)
-  Events.addEventListener = Events.on;
-
-  // @method removeEventListener(…): this
-  // Alias to [`off(…)`](#evented-off)
-
-  // @method clearAllEventListeners(…): this
-  // Alias to [`off()`](#evented-off)
-  Events.removeEventListener = Events.clearAllEventListeners = Events.off;
-
-  // @method addOneTimeEventListener(…): this
-  // Alias to [`once(…)`](#evented-once)
-  Events.addOneTimeEventListener = Events.once;
-
-  // @method fireEvent(…): this
-  // Alias to [`fire(…)`](#evented-fire)
-  Events.fireEvent = Events.fire;
-
-  // @method hasEventListeners(…): Boolean
-  // Alias to [`listens(…)`](#evented-listens)
-  Events.hasEventListeners = Events.listens;
-
-  var Evented = Class.extend(Events);
-
-  /*
-   * @class Point
-   * @aka L.Point
-   *
-   * Represents a point with `x` and `y` coordinates in pixels.
-   *
-   * @example
-   *
-   * ```js
-   * var point = L.point(200, 300);
-   * ```
-   *
-   * All Leaflet methods and options that accept `Point` objects also accept them in a simple Array form (unless noted otherwise), so these lines are equivalent:
-   *
-   * ```js
-   * map.panBy([200, 300]);
-   * map.panBy(L.point(200, 300));
-   * ```
-   *
-   * Note that `Point` does not inherit from Leaflet's `Class` object,
-   * which means new classes can't inherit from it, and new methods
-   * can't be added to it with the `include` function.
-   */
-
-  function Point(x, y, round) {
-  	// @property x: Number; The `x` coordinate of the point
-  	this.x = (round ? Math.round(x) : x);
-  	// @property y: Number; The `y` coordinate of the point
-  	this.y = (round ? Math.round(y) : y);
-  }
-
-  var trunc = Math.trunc || function (v) {
-  	return v > 0 ? Math.floor(v) : Math.ceil(v);
-  };
-
-  Point.prototype = {
-
-  	// @method clone(): Point
-  	// Returns a copy of the current point.
-  	clone: function () {
-  		return new Point(this.x, this.y);
-  	},
-
-  	// @method add(otherPoint: Point): Point
-  	// Returns the result of addition of the current and the given points.
-  	add: function (point) {
-  		// non-destructive, returns a new point
-  		return this.clone()._add(toPoint(point));
-  	},
-
-  	_add: function (point) {
-  		// destructive, used directly for performance in situations where it's safe to modify existing point
-  		this.x += point.x;
-  		this.y += point.y;
-  		return this;
-  	},
-
-  	// @method subtract(otherPoint: Point): Point
-  	// Returns the result of subtraction of the given point from the current.
-  	subtract: function (point) {
-  		return this.clone()._subtract(toPoint(point));
-  	},
-
-  	_subtract: function (point) {
-  		this.x -= point.x;
-  		this.y -= point.y;
-  		return this;
-  	},
-
-  	// @method divideBy(num: Number): Point
-  	// Returns the result of division of the current point by the given number.
-  	divideBy: function (num) {
-  		return this.clone()._divideBy(num);
-  	},
-
-  	_divideBy: function (num) {
-  		this.x /= num;
-  		this.y /= num;
-  		return this;
-  	},
-
-  	// @method multiplyBy(num: Number): Point
-  	// Returns the result of multiplication of the current point by the given number.
-  	multiplyBy: function (num) {
-  		return this.clone()._multiplyBy(num);
-  	},
-
-  	_multiplyBy: function (num) {
-  		this.x *= num;
-  		this.y *= num;
-  		return this;
-  	},
-
-  	// @method scaleBy(scale: Point): Point
-  	// Multiply each coordinate of the current point by each coordinate of
-  	// `scale`. In linear algebra terms, multiply the point by the
-  	// [scaling matrix](https://en.wikipedia.org/wiki/Scaling_%28geometry%29#Matrix_representation)
-  	// defined by `scale`.
-  	scaleBy: function (point) {
-  		return new Point(this.x * point.x, this.y * point.y);
-  	},
-
-  	// @method unscaleBy(scale: Point): Point
-  	// Inverse of `scaleBy`. Divide each coordinate of the current point by
-  	// each coordinate of `scale`.
-  	unscaleBy: function (point) {
-  		return new Point(this.x / point.x, this.y / point.y);
-  	},
-
-  	// @method round(): Point
-  	// Returns a copy of the current point with rounded coordinates.
-  	round: function () {
-  		return this.clone()._round();
-  	},
-
-  	_round: function () {
-  		this.x = Math.round(this.x);
-  		this.y = Math.round(this.y);
-  		return this;
-  	},
-
-  	// @method floor(): Point
-  	// Returns a copy of the current point with floored coordinates (rounded down).
-  	floor: function () {
-  		return this.clone()._floor();
-  	},
-
-  	_floor: function () {
-  		this.x = Math.floor(this.x);
-  		this.y = Math.floor(this.y);
-  		return this;
-  	},
-
-  	// @method ceil(): Point
-  	// Returns a copy of the current point with ceiled coordinates (rounded up).
-  	ceil: function () {
-  		return this.clone()._ceil();
-  	},
-
-  	_ceil: function () {
-  		this.x = Math.ceil(this.x);
-  		this.y = Math.ceil(this.y);
-  		return this;
-  	},
-
-  	// @method trunc(): Point
-  	// Returns a copy of the current point with truncated coordinates (rounded towards zero).
-  	trunc: function () {
-  		return this.clone()._trunc();
-  	},
-
-  	_trunc: function () {
-  		this.x = trunc(this.x);
-  		this.y = trunc(this.y);
-  		return this;
-  	},
-
-  	// @method distanceTo(otherPoint: Point): Number
-  	// Returns the cartesian distance between the current and the given points.
-  	distanceTo: function (point) {
-  		point = toPoint(point);
-
-  		var x = point.x - this.x,
-  		    y = point.y - this.y;
-
-  		return Math.sqrt(x * x + y * y);
-  	},
-
-  	// @method equals(otherPoint: Point): Boolean
-  	// Returns `true` if the given point has the same coordinates.
-  	equals: function (point) {
-  		point = toPoint(point);
-
-  		return point.x === this.x &&
-  		       point.y === this.y;
-  	},
-
-  	// @method contains(otherPoint: Point): Boolean
-  	// Returns `true` if both coordinates of the given point are less than the corresponding current point coordinates (in absolute values).
-  	contains: function (point) {
-  		point = toPoint(point);
-
-  		return Math.abs(point.x) <= Math.abs(this.x) &&
-  		       Math.abs(point.y) <= Math.abs(this.y);
-  	},
-
-  	// @method toString(): String
-  	// Returns a string representation of the point for debugging purposes.
-  	toString: function () {
-  		return 'Point(' +
-  		        formatNum(this.x) + ', ' +
-  		        formatNum(this.y) + ')';
-  	}
-  };
-
-  // @factory L.point(x: Number, y: Number, round?: Boolean)
-  // Creates a Point object with the given `x` and `y` coordinates. If optional `round` is set to true, rounds the `x` and `y` values.
-
-  // @alternative
-  // @factory L.point(coords: Number[])
-  // Expects an array of the form `[x, y]` instead.
-
-  // @alternative
-  // @factory L.point(coords: Object)
-  // Expects a plain object of the form `{x: Number, y: Number}` instead.
-  function toPoint(x, y, round) {
-  	if (x instanceof Point) {
-  		return x;
-  	}
-  	if (isArray(x)) {
-  		return new Point(x[0], x[1]);
-  	}
-  	if (x === undefined || x === null) {
-  		return x;
-  	}
-  	if (typeof x === 'object' && 'x' in x && 'y' in x) {
-  		return new Point(x.x, x.y);
-  	}
-  	return new Point(x, y, round);
-  }
-
-  /*
-   * @class Bounds
-   * @aka L.Bounds
-   *
-   * Represents a rectangular area in pixel coordinates.
-   *
-   * @example
-   *
-   * ```js
-   * var p1 = L.point(10, 10),
-   * p2 = L.point(40, 60),
-   * bounds = L.bounds(p1, p2);
-   * ```
-   *
-   * All Leaflet methods that accept `Bounds` objects also accept them in a simple Array form (unless noted otherwise), so the bounds example above can be passed like this:
-   *
-   * ```js
-   * otherBounds.intersects([[10, 10], [40, 60]]);
-   * ```
-   *
-   * Note that `Bounds` does not inherit from Leaflet's `Class` object,
-   * which means new classes can't inherit from it, and new methods
-   * can't be added to it with the `include` function.
-   */
-
-  function Bounds(a, b) {
-  	if (!a) { return; }
-
-  	var points = b ? [a, b] : a;
-
-  	for (var i = 0, len = points.length; i < len; i++) {
-  		this.extend(points[i]);
-  	}
-  }
-
-  Bounds.prototype = {
-  	// @method extend(point: Point): this
-  	// Extends the bounds to contain the given point.
-  	extend: function (point) { // (Point)
-  		point = toPoint(point);
-
-  		// @property min: Point
-  		// The top left corner of the rectangle.
-  		// @property max: Point
-  		// The bottom right corner of the rectangle.
-  		if (!this.min && !this.max) {
-  			this.min = point.clone();
-  			this.max = point.clone();
-  		} else {
-  			this.min.x = Math.min(point.x, this.min.x);
-  			this.max.x = Math.max(point.x, this.max.x);
-  			this.min.y = Math.min(point.y, this.min.y);
-  			this.max.y = Math.max(point.y, this.max.y);
-  		}
-  		return this;
-  	},
-
-  	// @method getCenter(round?: Boolean): Point
-  	// Returns the center point of the bounds.
-  	getCenter: function (round) {
-  		return new Point(
-  		        (this.min.x + this.max.x) / 2,
-  		        (this.min.y + this.max.y) / 2, round);
-  	},
-
-  	// @method getBottomLeft(): Point
-  	// Returns the bottom-left point of the bounds.
-  	getBottomLeft: function () {
-  		return new Point(this.min.x, this.max.y);
-  	},
-
-  	// @method getTopRight(): Point
-  	// Returns the top-right point of the bounds.
-  	getTopRight: function () { // -> Point
-  		return new Point(this.max.x, this.min.y);
-  	},
-
-  	// @method getTopLeft(): Point
-  	// Returns the top-left point of the bounds (i.e. [`this.min`](#bounds-min)).
-  	getTopLeft: function () {
-  		return this.min; // left, top
-  	},
-
-  	// @method getBottomRight(): Point
-  	// Returns the bottom-right point of the bounds (i.e. [`this.max`](#bounds-max)).
-  	getBottomRight: function () {
-  		return this.max; // right, bottom
-  	},
-
-  	// @method getSize(): Point
-  	// Returns the size of the given bounds
-  	getSize: function () {
-  		return this.max.subtract(this.min);
-  	},
-
-  	// @method contains(otherBounds: Bounds): Boolean
-  	// Returns `true` if the rectangle contains the given one.
-  	// @alternative
-  	// @method contains(point: Point): Boolean
-  	// Returns `true` if the rectangle contains the given point.
-  	contains: function (obj) {
-  		var min, max;
-
-  		if (typeof obj[0] === 'number' || obj instanceof Point) {
-  			obj = toPoint(obj);
-  		} else {
-  			obj = toBounds(obj);
-  		}
-
-  		if (obj instanceof Bounds) {
-  			min = obj.min;
-  			max = obj.max;
-  		} else {
-  			min = max = obj;
-  		}
-
-  		return (min.x >= this.min.x) &&
-  		       (max.x <= this.max.x) &&
-  		       (min.y >= this.min.y) &&
-  		       (max.y <= this.max.y);
-  	},
-
-  	// @method intersects(otherBounds: Bounds): Boolean
-  	// Returns `true` if the rectangle intersects the given bounds. Two bounds
-  	// intersect if they have at least one point in common.
-  	intersects: function (bounds) { // (Bounds) -> Boolean
-  		bounds = toBounds(bounds);
-
-  		var min = this.min,
-  		    max = this.max,
-  		    min2 = bounds.min,
-  		    max2 = bounds.max,
-  		    xIntersects = (max2.x >= min.x) && (min2.x <= max.x),
-  		    yIntersects = (max2.y >= min.y) && (min2.y <= max.y);
-
-  		return xIntersects && yIntersects;
-  	},
-
-  	// @method overlaps(otherBounds: Bounds): Boolean
-  	// Returns `true` if the rectangle overlaps the given bounds. Two bounds
-  	// overlap if their intersection is an area.
-  	overlaps: function (bounds) { // (Bounds) -> Boolean
-  		bounds = toBounds(bounds);
-
-  		var min = this.min,
-  		    max = this.max,
-  		    min2 = bounds.min,
-  		    max2 = bounds.max,
-  		    xOverlaps = (max2.x > min.x) && (min2.x < max.x),
-  		    yOverlaps = (max2.y > min.y) && (min2.y < max.y);
-
-  		return xOverlaps && yOverlaps;
-  	},
-
-  	isValid: function () {
-  		return !!(this.min && this.max);
-  	}
-  };
-
-
-  // @factory L.bounds(corner1: Point, corner2: Point)
-  // Creates a Bounds object from two corners coordinate pairs.
-  // @alternative
-  // @factory L.bounds(points: Point[])
-  // Creates a Bounds object from the given array of points.
-  function toBounds(a, b) {
-  	if (!a || a instanceof Bounds) {
-  		return a;
-  	}
-  	return new Bounds(a, b);
-  }
-
-  /*
-   * @class LatLngBounds
-   * @aka L.LatLngBounds
-   *
-   * Represents a rectangular geographical area on a map.
-   *
-   * @example
-   *
-   * ```js
-   * var corner1 = L.latLng(40.712, -74.227),
-   * corner2 = L.latLng(40.774, -74.125),
-   * bounds = L.latLngBounds(corner1, corner2);
-   * ```
-   *
-   * All Leaflet methods that accept LatLngBounds objects also accept them in a simple Array form (unless noted otherwise), so the bounds example above can be passed like this:
-   *
-   * ```js
-   * map.fitBounds([
-   * 	[40.712, -74.227],
-   * 	[40.774, -74.125]
-   * ]);
-   * ```
-   *
-   * Caution: if the area crosses the antimeridian (often confused with the International Date Line), you must specify corners _outside_ the [-180, 180] degrees longitude range.
-   *
-   * Note that `LatLngBounds` does not inherit from Leaflet's `Class` object,
-   * which means new classes can't inherit from it, and new methods
-   * can't be added to it with the `include` function.
-   */
-
-  function LatLngBounds(corner1, corner2) { // (LatLng, LatLng) or (LatLng[])
-  	if (!corner1) { return; }
-
-  	var latlngs = corner2 ? [corner1, corner2] : corner1;
-
-  	for (var i = 0, len = latlngs.length; i < len; i++) {
-  		this.extend(latlngs[i]);
-  	}
-  }
-
-  LatLngBounds.prototype = {
-
-  	// @method extend(latlng: LatLng): this
-  	// Extend the bounds to contain the given point
-
-  	// @alternative
-  	// @method extend(otherBounds: LatLngBounds): this
-  	// Extend the bounds to contain the given bounds
-  	extend: function (obj) {
-  		var sw = this._southWest,
-  		    ne = this._northEast,
-  		    sw2, ne2;
-
-  		if (obj instanceof LatLng) {
-  			sw2 = obj;
-  			ne2 = obj;
-
-  		} else if (obj instanceof LatLngBounds) {
-  			sw2 = obj._southWest;
-  			ne2 = obj._northEast;
-
-  			if (!sw2 || !ne2) { return this; }
-
-  		} else {
-  			return obj ? this.extend(toLatLng(obj) || toLatLngBounds(obj)) : this;
-  		}
-
-  		if (!sw && !ne) {
-  			this._southWest = new LatLng(sw2.lat, sw2.lng);
-  			this._northEast = new LatLng(ne2.lat, ne2.lng);
-  		} else {
-  			sw.lat = Math.min(sw2.lat, sw.lat);
-  			sw.lng = Math.min(sw2.lng, sw.lng);
-  			ne.lat = Math.max(ne2.lat, ne.lat);
-  			ne.lng = Math.max(ne2.lng, ne.lng);
-  		}
-
-  		return this;
-  	},
-
-  	// @method pad(bufferRatio: Number): LatLngBounds
-  	// Returns bounds created by extending or retracting the current bounds by a given ratio in each direction.
-  	// For example, a ratio of 0.5 extends the bounds by 50% in each direction.
-  	// Negative values will retract the bounds.
-  	pad: function (bufferRatio) {
-  		var sw = this._southWest,
-  		    ne = this._northEast,
-  		    heightBuffer = Math.abs(sw.lat - ne.lat) * bufferRatio,
-  		    widthBuffer = Math.abs(sw.lng - ne.lng) * bufferRatio;
-
-  		return new LatLngBounds(
-  		        new LatLng(sw.lat - heightBuffer, sw.lng - widthBuffer),
-  		        new LatLng(ne.lat + heightBuffer, ne.lng + widthBuffer));
-  	},
-
-  	// @method getCenter(): LatLng
-  	// Returns the center point of the bounds.
-  	getCenter: function () {
-  		return new LatLng(
-  		        (this._southWest.lat + this._northEast.lat) / 2,
-  		        (this._southWest.lng + this._northEast.lng) / 2);
-  	},
-
-  	// @method getSouthWest(): LatLng
-  	// Returns the south-west point of the bounds.
-  	getSouthWest: function () {
-  		return this._southWest;
-  	},
-
-  	// @method getNorthEast(): LatLng
-  	// Returns the north-east point of the bounds.
-  	getNorthEast: function () {
-  		return this._northEast;
-  	},
-
-  	// @method getNorthWest(): LatLng
-  	// Returns the north-west point of the bounds.
-  	getNorthWest: function () {
-  		return new LatLng(this.getNorth(), this.getWest());
-  	},
-
-  	// @method getSouthEast(): LatLng
-  	// Returns the south-east point of the bounds.
-  	getSouthEast: function () {
-  		return new LatLng(this.getSouth(), this.getEast());
-  	},
-
-  	// @method getWest(): Number
-  	// Returns the west longitude of the bounds
-  	getWest: function () {
-  		return this._southWest.lng;
-  	},
-
-  	// @method getSouth(): Number
-  	// Returns the south latitude of the bounds
-  	getSouth: function () {
-  		return this._southWest.lat;
-  	},
-
-  	// @method getEast(): Number
-  	// Returns the east longitude of the bounds
-  	getEast: function () {
-  		return this._northEast.lng;
-  	},
-
-  	// @method getNorth(): Number
-  	// Returns the north latitude of the bounds
-  	getNorth: function () {
-  		return this._northEast.lat;
-  	},
-
-  	// @method contains(otherBounds: LatLngBounds): Boolean
-  	// Returns `true` if the rectangle contains the given one.
-
-  	// @alternative
-  	// @method contains (latlng: LatLng): Boolean
-  	// Returns `true` if the rectangle contains the given point.
-  	contains: function (obj) { // (LatLngBounds) or (LatLng) -> Boolean
-  		if (typeof obj[0] === 'number' || obj instanceof LatLng || 'lat' in obj) {
-  			obj = toLatLng(obj);
-  		} else {
-  			obj = toLatLngBounds(obj);
-  		}
-
-  		var sw = this._southWest,
-  		    ne = this._northEast,
-  		    sw2, ne2;
-
-  		if (obj instanceof LatLngBounds) {
-  			sw2 = obj.getSouthWest();
-  			ne2 = obj.getNorthEast();
-  		} else {
-  			sw2 = ne2 = obj;
-  		}
-
-  		return (sw2.lat >= sw.lat) && (ne2.lat <= ne.lat) &&
-  		       (sw2.lng >= sw.lng) && (ne2.lng <= ne.lng);
-  	},
-
-  	// @method intersects(otherBounds: LatLngBounds): Boolean
-  	// Returns `true` if the rectangle intersects the given bounds. Two bounds intersect if they have at least one point in common.
-  	intersects: function (bounds) {
-  		bounds = toLatLngBounds(bounds);
-
-  		var sw = this._southWest,
-  		    ne = this._northEast,
-  		    sw2 = bounds.getSouthWest(),
-  		    ne2 = bounds.getNorthEast(),
-
-  		    latIntersects = (ne2.lat >= sw.lat) && (sw2.lat <= ne.lat),
-  		    lngIntersects = (ne2.lng >= sw.lng) && (sw2.lng <= ne.lng);
-
-  		return latIntersects && lngIntersects;
-  	},
-
-  	// @method overlaps(otherBounds: LatLngBounds): Boolean
-  	// Returns `true` if the rectangle overlaps the given bounds. Two bounds overlap if their intersection is an area.
-  	overlaps: function (bounds) {
-  		bounds = toLatLngBounds(bounds);
-
-  		var sw = this._southWest,
-  		    ne = this._northEast,
-  		    sw2 = bounds.getSouthWest(),
-  		    ne2 = bounds.getNorthEast(),
-
-  		    latOverlaps = (ne2.lat > sw.lat) && (sw2.lat < ne.lat),
-  		    lngOverlaps = (ne2.lng > sw.lng) && (sw2.lng < ne.lng);
-
-  		return latOverlaps && lngOverlaps;
-  	},
-
-  	// @method toBBoxString(): String
-  	// Returns a string with bounding box coordinates in a 'southwest_lng,southwest_lat,northeast_lng,northeast_lat' format. Useful for sending requests to web services that return geo data.
-  	toBBoxString: function () {
-  		return [this.getWest(), this.getSouth(), this.getEast(), this.getNorth()].join(',');
-  	},
-
-  	// @method equals(otherBounds: LatLngBounds, maxMargin?: Number): Boolean
-  	// Returns `true` if the rectangle is equivalent (within a small margin of error) to the given bounds. The margin of error can be overridden by setting `maxMargin` to a small number.
-  	equals: function (bounds, maxMargin) {
-  		if (!bounds) { return false; }
-
-  		bounds = toLatLngBounds(bounds);
-
-  		return this._southWest.equals(bounds.getSouthWest(), maxMargin) &&
-  		       this._northEast.equals(bounds.getNorthEast(), maxMargin);
-  	},
-
-  	// @method isValid(): Boolean
-  	// Returns `true` if the bounds are properly initialized.
-  	isValid: function () {
-  		return !!(this._southWest && this._northEast);
-  	}
-  };
-
-  // TODO International date line?
-
-  // @factory L.latLngBounds(corner1: LatLng, corner2: LatLng)
-  // Creates a `LatLngBounds` object by defining two diagonally opposite corners of the rectangle.
-
-  // @alternative
-  // @factory L.latLngBounds(latlngs: LatLng[])
-  // Creates a `LatLngBounds` object defined by the geographical points it contains. Very useful for zooming the map to fit a particular set of locations with [`fitBounds`](#map-fitbounds).
-  function toLatLngBounds(a, b) {
-  	if (a instanceof LatLngBounds) {
-  		return a;
-  	}
-  	return new LatLngBounds(a, b);
-  }
-
-  /* @class LatLng
-   * @aka L.LatLng
-   *
-   * Represents a geographical point with a certain latitude and longitude.
-   *
-   * @example
-   *
-   * ```
-   * var latlng = L.latLng(50.5, 30.5);
-   * ```
-   *
-   * All Leaflet methods that accept LatLng objects also accept them in a simple Array form and simple object form (unless noted otherwise), so these lines are equivalent:
-   *
-   * ```
-   * map.panTo([50, 30]);
-   * map.panTo({lon: 30, lat: 50});
-   * map.panTo({lat: 50, lng: 30});
-   * map.panTo(L.latLng(50, 30));
-   * ```
-   *
-   * Note that `LatLng` does not inherit from Leaflet's `Class` object,
-   * which means new classes can't inherit from it, and new methods
-   * can't be added to it with the `include` function.
-   */
-
-  function LatLng(lat, lng, alt) {
-  	if (isNaN(lat) || isNaN(lng)) {
-  		throw new Error('Invalid LatLng object: (' + lat + ', ' + lng + ')');
-  	}
-
-  	// @property lat: Number
-  	// Latitude in degrees
-  	this.lat = +lat;
-
-  	// @property lng: Number
-  	// Longitude in degrees
-  	this.lng = +lng;
-
-  	// @property alt: Number
-  	// Altitude in meters (optional)
-  	if (alt !== undefined) {
-  		this.alt = +alt;
-  	}
-  }
-
-  LatLng.prototype = {
-  	// @method equals(otherLatLng: LatLng, maxMargin?: Number): Boolean
-  	// Returns `true` if the given `LatLng` point is at the same position (within a small margin of error). The margin of error can be overridden by setting `maxMargin` to a small number.
-  	equals: function (obj, maxMargin) {
-  		if (!obj) { return false; }
-
-  		obj = toLatLng(obj);
-
-  		var margin = Math.max(
-  		        Math.abs(this.lat - obj.lat),
-  		        Math.abs(this.lng - obj.lng));
-
-  		return margin <= (maxMargin === undefined ? 1.0E-9 : maxMargin);
-  	},
-
-  	// @method toString(): String
-  	// Returns a string representation of the point (for debugging purposes).
-  	toString: function (precision) {
-  		return 'LatLng(' +
-  		        formatNum(this.lat, precision) + ', ' +
-  		        formatNum(this.lng, precision) + ')';
-  	},
-
-  	// @method distanceTo(otherLatLng: LatLng): Number
-  	// Returns the distance (in meters) to the given `LatLng` calculated using the [Spherical Law of Cosines](https://en.wikipedia.org/wiki/Spherical_law_of_cosines).
-  	distanceTo: function (other) {
-  		return Earth.distance(this, toLatLng(other));
-  	},
-
-  	// @method wrap(): LatLng
-  	// Returns a new `LatLng` object with the longitude wrapped so it's always between -180 and +180 degrees.
-  	wrap: function () {
-  		return Earth.wrapLatLng(this);
-  	},
-
-  	// @method toBounds(sizeInMeters: Number): LatLngBounds
-  	// Returns a new `LatLngBounds` object in which each boundary is `sizeInMeters/2` meters apart from the `LatLng`.
-  	toBounds: function (sizeInMeters) {
-  		var latAccuracy = 180 * sizeInMeters / 40075017,
-  		    lngAccuracy = latAccuracy / Math.cos((Math.PI / 180) * this.lat);
-
-  		return toLatLngBounds(
-  		        [this.lat - latAccuracy, this.lng - lngAccuracy],
-  		        [this.lat + latAccuracy, this.lng + lngAccuracy]);
-  	},
-
-  	clone: function () {
-  		return new LatLng(this.lat, this.lng, this.alt);
-  	}
-  };
-
-
-
-  // @factory L.latLng(latitude: Number, longitude: Number, altitude?: Number): LatLng
-  // Creates an object representing a geographical point with the given latitude and longitude (and optionally altitude).
-
-  // @alternative
-  // @factory L.latLng(coords: Array): LatLng
-  // Expects an array of the form `[Number, Number]` or `[Number, Number, Number]` instead.
-
-  // @alternative
-  // @factory L.latLng(coords: Object): LatLng
-  // Expects an plain object of the form `{lat: Number, lng: Number}` or `{lat: Number, lng: Number, alt: Number}` instead.
-
-  function toLatLng(a, b, c) {
-  	if (a instanceof LatLng) {
-  		return a;
-  	}
-  	if (isArray(a) && typeof a[0] !== 'object') {
-  		if (a.length === 3) {
-  			return new LatLng(a[0], a[1], a[2]);
-  		}
-  		if (a.length === 2) {
-  			return new LatLng(a[0], a[1]);
-  		}
-  		return null;
-  	}
-  	if (a === undefined || a === null) {
-  		return a;
-  	}
-  	if (typeof a === 'object' && 'lat' in a) {
-  		return new LatLng(a.lat, 'lng' in a ? a.lng : a.lon, a.alt);
-  	}
-  	if (b === undefined) {
-  		return null;
-  	}
-  	return new LatLng(a, b, c);
-  }
-
-  /*
-   * @namespace CRS
-   * @crs L.CRS.Base
-   * Object that defines coordinate reference systems for projecting
-   * geographical points into pixel (screen) coordinates and back (and to
-   * coordinates in other units for [WMS](https://en.wikipedia.org/wiki/Web_Map_Service) services). See
-   * [spatial reference system](http://en.wikipedia.org/wiki/Coordinate_reference_system).
-   *
-   * Leaflet defines the most usual CRSs by default. If you want to use a
-   * CRS not defined by default, take a look at the
-   * [Proj4Leaflet](https://github.com/kartena/Proj4Leaflet) plugin.
-   *
-   * Note that the CRS instances do not inherit from Leaflet's `Class` object,
-   * and can't be instantiated. Also, new classes can't inherit from them,
-   * and methods can't be added to them with the `include` function.
-   */
-
-  var CRS = {
-  	// @method latLngToPoint(latlng: LatLng, zoom: Number): Point
-  	// Projects geographical coordinates into pixel coordinates for a given zoom.
-  	latLngToPoint: function (latlng, zoom) {
-  		var projectedPoint = this.projection.project(latlng),
-  		    scale = this.scale(zoom);
-
-  		return this.transformation._transform(projectedPoint, scale);
-  	},
-
-  	// @method pointToLatLng(point: Point, zoom: Number): LatLng
-  	// The inverse of `latLngToPoint`. Projects pixel coordinates on a given
-  	// zoom into geographical coordinates.
-  	pointToLatLng: function (point, zoom) {
-  		var scale = this.scale(zoom),
-  		    untransformedPoint = this.transformation.untransform(point, scale);
-
-  		return this.projection.unproject(untransformedPoint);
-  	},
-
-  	// @method project(latlng: LatLng): Point
-  	// Projects geographical coordinates into coordinates in units accepted for
-  	// this CRS (e.g. meters for EPSG:3857, for passing it to WMS services).
-  	project: function (latlng) {
-  		return this.projection.project(latlng);
-  	},
-
-  	// @method unproject(point: Point): LatLng
-  	// Given a projected coordinate returns the corresponding LatLng.
-  	// The inverse of `project`.
-  	unproject: function (point) {
-  		return this.projection.unproject(point);
-  	},
-
-  	// @method scale(zoom: Number): Number
-  	// Returns the scale used when transforming projected coordinates into
-  	// pixel coordinates for a particular zoom. For example, it returns
-  	// `256 * 2^zoom` for Mercator-based CRS.
-  	scale: function (zoom) {
-  		return 256 * Math.pow(2, zoom);
-  	},
-
-  	// @method zoom(scale: Number): Number
-  	// Inverse of `scale()`, returns the zoom level corresponding to a scale
-  	// factor of `scale`.
-  	zoom: function (scale) {
-  		return Math.log(scale / 256) / Math.LN2;
-  	},
-
-  	// @method getProjectedBounds(zoom: Number): Bounds
-  	// Returns the projection's bounds scaled and transformed for the provided `zoom`.
-  	getProjectedBounds: function (zoom) {
-  		if (this.infinite) { return null; }
-
-  		var b = this.projection.bounds,
-  		    s = this.scale(zoom),
-  		    min = this.transformation.transform(b.min, s),
-  		    max = this.transformation.transform(b.max, s);
-
-  		return new Bounds(min, max);
-  	},
-
-  	// @method distance(latlng1: LatLng, latlng2: LatLng): Number
-  	// Returns the distance between two geographical coordinates.
-
-  	// @property code: String
-  	// Standard code name of the CRS passed into WMS services (e.g. `'EPSG:3857'`)
-  	//
-  	// @property wrapLng: Number[]
-  	// An array of two numbers defining whether the longitude (horizontal) coordinate
-  	// axis wraps around a given range and how. Defaults to `[-180, 180]` in most
-  	// geographical CRSs. If `undefined`, the longitude axis does not wrap around.
-  	//
-  	// @property wrapLat: Number[]
-  	// Like `wrapLng`, but for the latitude (vertical) axis.
-
-  	// wrapLng: [min, max],
-  	// wrapLat: [min, max],
-
-  	// @property infinite: Boolean
-  	// If true, the coordinate space will be unbounded (infinite in both axes)
-  	infinite: false,
-
-  	// @method wrapLatLng(latlng: LatLng): LatLng
-  	// Returns a `LatLng` where lat and lng has been wrapped according to the
-  	// CRS's `wrapLat` and `wrapLng` properties, if they are outside the CRS's bounds.
-  	wrapLatLng: function (latlng) {
-  		var lng = this.wrapLng ? wrapNum(latlng.lng, this.wrapLng, true) : latlng.lng,
-  		    lat = this.wrapLat ? wrapNum(latlng.lat, this.wrapLat, true) : latlng.lat,
-  		    alt = latlng.alt;
-
-  		return new LatLng(lat, lng, alt);
-  	},
-
-  	// @method wrapLatLngBounds(bounds: LatLngBounds): LatLngBounds
-  	// Returns a `LatLngBounds` with the same size as the given one, ensuring
-  	// that its center is within the CRS's bounds.
-  	// Only accepts actual `L.LatLngBounds` instances, not arrays.
-  	wrapLatLngBounds: function (bounds) {
-  		var center = bounds.getCenter(),
-  		    newCenter = this.wrapLatLng(center),
-  		    latShift = center.lat - newCenter.lat,
-  		    lngShift = center.lng - newCenter.lng;
-
-  		if (latShift === 0 && lngShift === 0) {
-  			return bounds;
-  		}
-
-  		var sw = bounds.getSouthWest(),
-  		    ne = bounds.getNorthEast(),
-  		    newSw = new LatLng(sw.lat - latShift, sw.lng - lngShift),
-  		    newNe = new LatLng(ne.lat - latShift, ne.lng - lngShift);
-
-  		return new LatLngBounds(newSw, newNe);
-  	}
-  };
-
-  /*
-   * @namespace CRS
-   * @crs L.CRS.Earth
-   *
-   * Serves as the base for CRS that are global such that they cover the earth.
-   * Can only be used as the base for other CRS and cannot be used directly,
-   * since it does not have a `code`, `projection` or `transformation`. `distance()` returns
-   * meters.
-   */
-
-  var Earth = extend({}, CRS, {
-  	wrapLng: [-180, 180],
-
-  	// Mean Earth Radius, as recommended for use by
-  	// the International Union of Geodesy and Geophysics,
-  	// see http://rosettacode.org/wiki/Haversine_formula
-  	R: 6371000,
-
-  	// distance between two geographical points using spherical law of cosines approximation
-  	distance: function (latlng1, latlng2) {
-  		var rad = Math.PI / 180,
-  		    lat1 = latlng1.lat * rad,
-  		    lat2 = latlng2.lat * rad,
-  		    sinDLat = Math.sin((latlng2.lat - latlng1.lat) * rad / 2),
-  		    sinDLon = Math.sin((latlng2.lng - latlng1.lng) * rad / 2),
-  		    a = sinDLat * sinDLat + Math.cos(lat1) * Math.cos(lat2) * sinDLon * sinDLon,
-  		    c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
-  		return this.R * c;
-  	}
-  });
-
-  /*
-   * @namespace Projection
-   * @projection L.Projection.SphericalMercator
-   *
-   * Spherical Mercator projection — the most common projection for online maps,
-   * used by almost all free and commercial tile providers. Assumes that Earth is
-   * a sphere. Used by the `EPSG:3857` CRS.
-   */
-
-  var earthRadius = 6378137;
-
-  var SphericalMercator = {
-
-  	R: earthRadius,
-  	MAX_LATITUDE: 85.0511287798,
-
-  	project: function (latlng) {
-  		var d = Math.PI / 180,
-  		    max = this.MAX_LATITUDE,
-  		    lat = Math.max(Math.min(max, latlng.lat), -max),
-  		    sin = Math.sin(lat * d);
-
-  		return new Point(
-  			this.R * latlng.lng * d,
-  			this.R * Math.log((1 + sin) / (1 - sin)) / 2);
-  	},
-
-  	unproject: function (point) {
-  		var d = 180 / Math.PI;
-
-  		return new LatLng(
-  			(2 * Math.atan(Math.exp(point.y / this.R)) - (Math.PI / 2)) * d,
-  			point.x * d / this.R);
-  	},
-
-  	bounds: (function () {
-  		var d = earthRadius * Math.PI;
-  		return new Bounds([-d, -d], [d, d]);
-  	})()
-  };
-
-  /*
-   * @class Transformation
-   * @aka L.Transformation
-   *
-   * Represents an affine transformation: a set of coefficients `a`, `b`, `c`, `d`
-   * for transforming a point of a form `(x, y)` into `(a*x + b, c*y + d)` and doing
-   * the reverse. Used by Leaflet in its projections code.
-   *
-   * @example
-   *
-   * ```js
-   * var transformation = L.transformation(2, 5, -1, 10),
-   * 	p = L.point(1, 2),
-   * 	p2 = transformation.transform(p), //  L.point(7, 8)
-   * 	p3 = transformation.untransform(p2); //  L.point(1, 2)
-   * ```
-   */
-
-
-  // factory new L.Transformation(a: Number, b: Number, c: Number, d: Number)
-  // Creates a `Transformation` object with the given coefficients.
-  function Transformation(a, b, c, d) {
-  	if (isArray(a)) {
-  		// use array properties
-  		this._a = a[0];
-  		this._b = a[1];
-  		this._c = a[2];
-  		this._d = a[3];
-  		return;
-  	}
-  	this._a = a;
-  	this._b = b;
-  	this._c = c;
-  	this._d = d;
-  }
-
-  Transformation.prototype = {
-  	// @method transform(point: Point, scale?: Number): Point
-  	// Returns a transformed point, optionally multiplied by the given scale.
-  	// Only accepts actual `L.Point` instances, not arrays.
-  	transform: function (point, scale) { // (Point, Number) -> Point
-  		return this._transform(point.clone(), scale);
-  	},
-
-  	// destructive transform (faster)
-  	_transform: function (point, scale) {
-  		scale = scale || 1;
-  		point.x = scale * (this._a * point.x + this._b);
-  		point.y = scale * (this._c * point.y + this._d);
-  		return point;
-  	},
-
-  	// @method untransform(point: Point, scale?: Number): Point
-  	// Returns the reverse transformation of the given point, optionally divided
-  	// by the given scale. Only accepts actual `L.Point` instances, not arrays.
-  	untransform: function (point, scale) {
-  		scale = scale || 1;
-  		return new Point(
-  		        (point.x / scale - this._b) / this._a,
-  		        (point.y / scale - this._d) / this._c);
-  	}
-  };
-
-  // factory L.transformation(a: Number, b: Number, c: Number, d: Number)
-
-  // @factory L.transformation(a: Number, b: Number, c: Number, d: Number)
-  // Instantiates a Transformation object with the given coefficients.
-
-  // @alternative
-  // @factory L.transformation(coefficients: Array): Transformation
-  // Expects an coefficients array of the form
-  // `[a: Number, b: Number, c: Number, d: Number]`.
-
-  function toTransformation(a, b, c, d) {
-  	return new Transformation(a, b, c, d);
-  }
-
-  /*
-   * @namespace CRS
-   * @crs L.CRS.EPSG3857
-   *
-   * The most common CRS for online maps, used by almost all free and commercial
-   * tile providers. Uses Spherical Mercator projection. Set in by default in
-   * Map's `crs` option.
-   */
-
-  var EPSG3857 = extend({}, Earth, {
-  	code: 'EPSG:3857',
-  	projection: SphericalMercator,
-
-  	transformation: (function () {
-  		var scale = 0.5 / (Math.PI * SphericalMercator.R);
-  		return toTransformation(scale, 0.5, -scale, 0.5);
-  	}())
-  });
-
-  var EPSG900913 = extend({}, EPSG3857, {
-  	code: 'EPSG:900913'
-  });
-
-  // @namespace SVG; @section
-  // There are several static functions which can be called without instantiating L.SVG:
-
-  // @function create(name: String): SVGElement
-  // Returns a instance of [SVGElement](https://developer.mozilla.org/docs/Web/API/SVGElement),
-  // corresponding to the class name passed. For example, using 'line' will return
-  // an instance of [SVGLineElement](https://developer.mozilla.org/docs/Web/API/SVGLineElement).
-  function svgCreate(name) {
-  	return document.createElementNS('http://www.w3.org/2000/svg', name);
-  }
-
-  // @function pointsToPath(rings: Point[], closed: Boolean): String
-  // Generates a SVG path string for multiple rings, with each ring turning
-  // into "M..L..L.." instructions
-  function pointsToPath(rings, closed) {
-  	var str = '',
-  	i, j, len, len2, points, p;
-
-  	for (i = 0, len = rings.length; i < len; i++) {
-  		points = rings[i];
-
-  		for (j = 0, len2 = points.length; j < len2; j++) {
-  			p = points[j];
-  			str += (j ? 'L' : 'M') + p.x + ' ' + p.y;
-  		}
-
-  		// closes the ring for polygons; "x" is VML syntax
-  		str += closed ? (svg ? 'z' : 'x') : '';
-  	}
-
-  	// SVG complains about empty path strings
-  	return str || 'M0 0';
-  }
-
-  /*
-   * @namespace Browser
-   * @aka L.Browser
-   *
-   * A namespace with static properties for browser/feature detection used by Leaflet internally.
-   *
-   * @example
-   *
-   * ```js
-   * if (L.Browser.ielt9) {
-   *   alert('Upgrade your browser, dude!');
-   * }
-   * ```
-   */
-
-  var style$1 = document.documentElement.style;
-
-  // @property ie: Boolean; `true` for all Internet Explorer versions (not Edge).
-  var ie = 'ActiveXObject' in window;
-
-  // @property ielt9: Boolean; `true` for Internet Explorer versions less than 9.
-  var ielt9 = ie && !document.addEventListener;
-
-  // @property edge: Boolean; `true` for the Edge web browser.
-  var edge = 'msLaunchUri' in navigator && !('documentMode' in document);
-
-  // @property webkit: Boolean;
-  // `true` for webkit-based browsers like Chrome and Safari (including mobile versions).
-  var webkit = userAgentContains('webkit');
-
-  // @property android: Boolean
-  // `true` for any browser running on an Android platform.
-  var android = userAgentContains('android');
-
-  // @property android23: Boolean; `true` for browsers running on Android 2 or Android 3.
-  var android23 = userAgentContains('android 2') || userAgentContains('android 3');
-
-  /* See https://stackoverflow.com/a/17961266 for details on detecting stock Android */
-  var webkitVer = parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1], 10); // also matches AppleWebKit
-  // @property androidStock: Boolean; `true` for the Android stock browser (i.e. not Chrome)
-  var androidStock = android && userAgentContains('Google') && webkitVer < 537 && !('AudioNode' in window);
-
-  // @property opera: Boolean; `true` for the Opera browser
-  var opera = !!window.opera;
-
-  // @property chrome: Boolean; `true` for the Chrome browser.
-  var chrome = !edge && userAgentContains('chrome');
-
-  // @property gecko: Boolean; `true` for gecko-based browsers like Firefox.
-  var gecko = userAgentContains('gecko') && !webkit && !opera && !ie;
-
-  // @property safari: Boolean; `true` for the Safari browser.
-  var safari = !chrome && userAgentContains('safari');
-
-  var phantom = userAgentContains('phantom');
-
-  // @property opera12: Boolean
-  // `true` for the Opera browser supporting CSS transforms (version 12 or later).
-  var opera12 = 'OTransition' in style$1;
-
-  // @property win: Boolean; `true` when the browser is running in a Windows platform
-  var win = navigator.platform.indexOf('Win') === 0;
-
-  // @property ie3d: Boolean; `true` for all Internet Explorer versions supporting CSS transforms.
-  var ie3d = ie && ('transition' in style$1);
-
-  // @property webkit3d: Boolean; `true` for webkit-based browsers supporting CSS transforms.
-  var webkit3d = ('WebKitCSSMatrix' in window) && ('m11' in new window.WebKitCSSMatrix()) && !android23;
-
-  // @property gecko3d: Boolean; `true` for gecko-based browsers supporting CSS transforms.
-  var gecko3d = 'MozPerspective' in style$1;
-
-  // @property any3d: Boolean
-  // `true` for all browsers supporting CSS transforms.
-  var any3d = !window.L_DISABLE_3D && (ie3d || webkit3d || gecko3d) && !opera12 && !phantom;
-
-  // @property mobile: Boolean; `true` for all browsers running in a mobile device.
-  var mobile = typeof orientation !== 'undefined' || userAgentContains('mobile');
-
-  // @property mobileWebkit: Boolean; `true` for all webkit-based browsers in a mobile device.
-  var mobileWebkit = mobile && webkit;
-
-  // @property mobileWebkit3d: Boolean
-  // `true` for all webkit-based browsers in a mobile device supporting CSS transforms.
-  var mobileWebkit3d = mobile && webkit3d;
-
-  // @property msPointer: Boolean
-  // `true` for browsers implementing the Microsoft touch events model (notably IE10).
-  var msPointer = !window.PointerEvent && window.MSPointerEvent;
-
-  // @property pointer: Boolean
-  // `true` for all browsers supporting [pointer events](https://msdn.microsoft.com/en-us/library/dn433244%28v=vs.85%29.aspx).
-  var pointer = !!(window.PointerEvent || msPointer);
-
-  // @property touch: Boolean
-  // `true` for all browsers supporting [touch events](https://developer.mozilla.org/docs/Web/API/Touch_events).
-  // This does not necessarily mean that the browser is running in a computer with
-  // a touchscreen, it only means that the browser is capable of understanding
-  // touch events.
-  var touch = !window.L_NO_TOUCH && (pointer || 'ontouchstart' in window ||
-  		(window.DocumentTouch && document instanceof window.DocumentTouch));
-
-  // @property mobileOpera: Boolean; `true` for the Opera browser in a mobile device.
-  var mobileOpera = mobile && opera;
-
-  // @property mobileGecko: Boolean
-  // `true` for gecko-based browsers running in a mobile device.
-  var mobileGecko = mobile && gecko;
-
-  // @property retina: Boolean
-  // `true` for browsers on a high-resolution "retina" screen or on any screen when browser's display zoom is more than 100%.
-  var retina = (window.devicePixelRatio || (window.screen.deviceXDPI / window.screen.logicalXDPI)) > 1;
-
-  // @property passiveEvents: Boolean
-  // `true` for browsers that support passive events.
-  var passiveEvents = (function () {
-  	var supportsPassiveOption = false;
-  	try {
-  		var opts = Object.defineProperty({}, 'passive', {
-  			get: function () { // eslint-disable-line getter-return
-  				supportsPassiveOption = true;
-  			}
-  		});
-  		window.addEventListener('testPassiveEventSupport', falseFn, opts);
-  		window.removeEventListener('testPassiveEventSupport', falseFn, opts);
-  	} catch (e) {
-  		// Errors can safely be ignored since this is only a browser support test.
-  	}
-  	return supportsPassiveOption;
-  }());
-
-  // @property canvas: Boolean
-  // `true` when the browser supports [`<canvas>`](https://developer.mozilla.org/docs/Web/API/Canvas_API).
-  var canvas = (function () {
-  	return !!document.createElement('canvas').getContext;
-  }());
-
-  // @property svg: Boolean
-  // `true` when the browser supports [SVG](https://developer.mozilla.org/docs/Web/SVG).
-  var svg = !!(document.createElementNS && svgCreate('svg').createSVGRect);
-
-  // @property vml: Boolean
-  // `true` if the browser supports [VML](https://en.wikipedia.org/wiki/Vector_Markup_Language).
-  var vml = !svg && (function () {
-  	try {
-  		var div = document.createElement('div');
-  		div.innerHTML = '<v:shape adj="1"/>';
-
-  		var shape = div.firstChild;
-  		shape.style.behavior = 'url(#default#VML)';
-
-  		return shape && (typeof shape.adj === 'object');
-
-  	} catch (e) {
-  		return false;
-  	}
-  }());
-
-
-  function userAgentContains(str) {
-  	return navigator.userAgent.toLowerCase().indexOf(str) >= 0;
-  }
-
-  var Browser = ({
-    ie: ie,
-    ielt9: ielt9,
-    edge: edge,
-    webkit: webkit,
-    android: android,
-    android23: android23,
-    androidStock: androidStock,
-    opera: opera,
-    chrome: chrome,
-    gecko: gecko,
-    safari: safari,
-    phantom: phantom,
-    opera12: opera12,
-    win: win,
-    ie3d: ie3d,
-    webkit3d: webkit3d,
-    gecko3d: gecko3d,
-    any3d: any3d,
-    mobile: mobile,
-    mobileWebkit: mobileWebkit,
-    mobileWebkit3d: mobileWebkit3d,
-    msPointer: msPointer,
-    pointer: pointer,
-    touch: touch,
-    mobileOpera: mobileOpera,
-    mobileGecko: mobileGecko,
-    retina: retina,
-    passiveEvents: passiveEvents,
-    canvas: canvas,
-    svg: svg,
-    vml: vml
-  });
-
-  /*
-   * Extends L.DomEvent to provide touch support for Internet Explorer and Windows-based devices.
-   */
-
-
-  var POINTER_DOWN =   msPointer ? 'MSPointerDown'   : 'pointerdown';
-  var POINTER_MOVE =   msPointer ? 'MSPointerMove'   : 'pointermove';
-  var POINTER_UP =     msPointer ? 'MSPointerUp'     : 'pointerup';
-  var POINTER_CANCEL = msPointer ? 'MSPointerCancel' : 'pointercancel';
-
-  var _pointers = {};
-  var _pointerDocListener = false;
-
-  // Provides a touch events wrapper for (ms)pointer events.
-  // ref http://www.w3.org/TR/pointerevents/ https://www.w3.org/Bugs/Public/show_bug.cgi?id=22890
-
-  function addPointerListener(obj, type, handler, id) {
-  	if (type === 'touchstart') {
-  		_addPointerStart(obj, handler, id);
-
-  	} else if (type === 'touchmove') {
-  		_addPointerMove(obj, handler, id);
-
-  	} else if (type === 'touchend') {
-  		_addPointerEnd(obj, handler, id);
-  	}
-
-  	return this;
-  }
-
-  function removePointerListener(obj, type, id) {
-  	var handler = obj['_leaflet_' + type + id];
-
-  	if (type === 'touchstart') {
-  		obj.removeEventListener(POINTER_DOWN, handler, false);
-
-  	} else if (type === 'touchmove') {
-  		obj.removeEventListener(POINTER_MOVE, handler, false);
-
-  	} else if (type === 'touchend') {
-  		obj.removeEventListener(POINTER_UP, handler, false);
-  		obj.removeEventListener(POINTER_CANCEL, handler, false);
-  	}
-
-  	return this;
-  }
-
-  function _addPointerStart(obj, handler, id) {
-  	var onDown = bind(function (e) {
-  		// IE10 specific: MsTouch needs preventDefault. See #2000
-  		if (e.MSPOINTER_TYPE_TOUCH && e.pointerType === e.MSPOINTER_TYPE_TOUCH) {
-  			preventDefault(e);
-  		}
-
-  		_handlePointer(e, handler);
-  	});
-
-  	obj['_leaflet_touchstart' + id] = onDown;
-  	obj.addEventListener(POINTER_DOWN, onDown, false);
-
-  	// need to keep track of what pointers and how many are active to provide e.touches emulation
-  	if (!_pointerDocListener) {
-  		// we listen document as any drags that end by moving the touch off the screen get fired there
-  		document.addEventListener(POINTER_DOWN, _globalPointerDown, true);
-  		document.addEventListener(POINTER_MOVE, _globalPointerMove, true);
-  		document.addEventListener(POINTER_UP, _globalPointerUp, true);
-  		document.addEventListener(POINTER_CANCEL, _globalPointerUp, true);
-
-  		_pointerDocListener = true;
-  	}
-  }
-
-  function _globalPointerDown(e) {
-  	_pointers[e.pointerId] = e;
-  }
-
-  function _globalPointerMove(e) {
-  	if (_pointers[e.pointerId]) {
-  		_pointers[e.pointerId] = e;
-  	}
-  }
-
-  function _globalPointerUp(e) {
-  	delete _pointers[e.pointerId];
-  }
-
-  function _handlePointer(e, handler) {
-  	e.touches = [];
-  	for (var i in _pointers) {
-  		e.touches.push(_pointers[i]);
-  	}
-  	e.changedTouches = [e];
-
-  	handler(e);
-  }
-
-  function _addPointerMove(obj, handler, id) {
-  	var onMove = function (e) {
-  		// don't fire touch moves when mouse isn't down
-  		if ((e.pointerType === (e.MSPOINTER_TYPE_MOUSE || 'mouse')) && e.buttons === 0) {
-  			return;
-  		}
-
-  		_handlePointer(e, handler);
-  	};
-
-  	obj['_leaflet_touchmove' + id] = onMove;
-  	obj.addEventListener(POINTER_MOVE, onMove, false);
-  }
-
-  function _addPointerEnd(obj, handler, id) {
-  	var onUp = function (e) {
-  		_handlePointer(e, handler);
-  	};
-
-  	obj['_leaflet_touchend' + id] = onUp;
-  	obj.addEventListener(POINTER_UP, onUp, false);
-  	obj.addEventListener(POINTER_CANCEL, onUp, false);
-  }
-
-  /*
-   * Extends the event handling code with double tap support for mobile browsers.
-   */
-
-  var _touchstart = msPointer ? 'MSPointerDown' : pointer ? 'pointerdown' : 'touchstart';
-  var _touchend = msPointer ? 'MSPointerUp' : pointer ? 'pointerup' : 'touchend';
-  var _pre = '_leaflet_';
-
-  // inspired by Zepto touch code by Thomas Fuchs
-  function addDoubleTapListener(obj, handler, id) {
-  	var last, touch$$1,
-  	    doubleTap = false,
-  	    delay = 250;
-
-  	function onTouchStart(e) {
-
-  		if (pointer) {
-  			if (!e.isPrimary) { return; }
-  			if (e.pointerType === 'mouse') { return; } // mouse fires native dblclick
-  		} else if (e.touches.length > 1) {
-  			return;
-  		}
-
-  		var now = Date.now(),
-  		    delta = now - (last || now);
-
-  		touch$$1 = e.touches ? e.touches[0] : e;
-  		doubleTap = (delta > 0 && delta <= delay);
-  		last = now;
-  	}
-
-  	function onTouchEnd(e) {
-  		if (doubleTap && !touch$$1.cancelBubble) {
-  			if (pointer) {
-  				if (e.pointerType === 'mouse') { return; }
-  				// work around .type being readonly with MSPointer* events
-  				var newTouch = {},
-  				    prop, i;
-
-  				for (i in touch$$1) {
-  					prop = touch$$1[i];
-  					newTouch[i] = prop && prop.bind ? prop.bind(touch$$1) : prop;
-  				}
-  				touch$$1 = newTouch;
-  			}
-  			touch$$1.type = 'dblclick';
-  			touch$$1.button = 0;
-  			handler(touch$$1);
-  			last = null;
-  		}
-  	}
-
-  	obj[_pre + _touchstart + id] = onTouchStart;
-  	obj[_pre + _touchend + id] = onTouchEnd;
-  	obj[_pre + 'dblclick' + id] = handler;
-
-  	obj.addEventListener(_touchstart, onTouchStart, passiveEvents ? {passive: false} : false);
-  	obj.addEventListener(_touchend, onTouchEnd, passiveEvents ? {passive: false} : false);
-
-  	// On some platforms (notably, chrome<55 on win10 + touchscreen + mouse),
-  	// the browser doesn't fire touchend/pointerup events but does fire
-  	// native dblclicks. See #4127.
-  	// Edge 14 also fires native dblclicks, but only for pointerType mouse, see #5180.
-  	obj.addEventListener('dblclick', handler, false);
-
-  	return this;
-  }
-
-  function removeDoubleTapListener(obj, id) {
-  	var touchstart = obj[_pre + _touchstart + id],
-  	    touchend = obj[_pre + _touchend + id],
-  	    dblclick = obj[_pre + 'dblclick' + id];
-
-  	obj.removeEventListener(_touchstart, touchstart, passiveEvents ? {passive: false} : false);
-  	obj.removeEventListener(_touchend, touchend, passiveEvents ? {passive: false} : false);
-  	obj.removeEventListener('dblclick', dblclick, false);
-
-  	return this;
-  }
-
-  /*
-   * @namespace DomUtil
-   *
-   * Utility functions to work with the [DOM](https://developer.mozilla.org/docs/Web/API/Document_Object_Model)
-   * tree, used by Leaflet internally.
-   *
-   * Most functions expecting or returning a `HTMLElement` also work for
-   * SVG elements. The only difference is that classes refer to CSS classes
-   * in HTML and SVG classes in SVG.
-   */
-
-
-  // @property TRANSFORM: String
-  // Vendor-prefixed transform style name (e.g. `'webkitTransform'` for WebKit).
-  var TRANSFORM = testProp(
-  	['transform', 'webkitTransform', 'OTransform', 'MozTransform', 'msTransform']);
-
-  // webkitTransition comes first because some browser versions that drop vendor prefix don't do
-  // the same for the transitionend event, in particular the Android 4.1 stock browser
-
-  // @property TRANSITION: String
-  // Vendor-prefixed transition style name.
-  var TRANSITION = testProp(
-  	['webkitTransition', 'transition', 'OTransition', 'MozTransition', 'msTransition']);
-
-  // @property TRANSITION_END: String
-  // Vendor-prefixed transitionend event name.
-  var TRANSITION_END =
-  	TRANSITION === 'webkitTransition' || TRANSITION === 'OTransition' ? TRANSITION + 'End' : 'transitionend';
-
-
-  // @function get(id: String|HTMLElement): HTMLElement
-  // Returns an element given its DOM id, or returns the element itself
-  // if it was passed directly.
-  function get(id) {
-  	return typeof id === 'string' ? document.getElementById(id) : id;
-  }
-
-  // @function getStyle(el: HTMLElement, styleAttrib: String): String
-  // Returns the value for a certain style attribute on an element,
-  // including computed values or values set through CSS.
-  function getStyle(el, style) {
-  	var value = el.style[style] || (el.currentStyle && el.currentStyle[style]);
-
-  	if ((!value || value === 'auto') && document.defaultView) {
-  		var css = document.defaultView.getComputedStyle(el, null);
-  		value = css ? css[style] : null;
-  	}
-  	return value === 'auto' ? null : value;
-  }
-
-  // @function create(tagName: String, className?: String, container?: HTMLElement): HTMLElement
-  // Creates an HTML element with `tagName`, sets its class to `className`, and optionally appends it to `container` element.
-  function create$1(tagName, className, container) {
-  	var el = document.createElement(tagName);
-  	el.className = className || '';
-
-  	if (container) {
-  		container.appendChild(el);
-  	}
-  	return el;
-  }
-
-  // @function remove(el: HTMLElement)
-  // Removes `el` from its parent element
-  function remove(el) {
-  	var parent = el.parentNode;
-  	if (parent) {
-  		parent.removeChild(el);
-  	}
-  }
-
-  // @function empty(el: HTMLElement)
-  // Removes all of `el`'s children elements from `el`
-  function empty(el) {
-  	while (el.firstChild) {
-  		el.removeChild(el.firstChild);
-  	}
-  }
-
-  // @function toFront(el: HTMLElement)
-  // Makes `el` the last child of its parent, so it renders in front of the other children.
-  function toFront(el) {
-  	var parent = el.parentNode;
-  	if (parent && parent.lastChild !== el) {
-  		parent.appendChild(el);
-  	}
-  }
-
-  // @function toBack(el: HTMLElement)
-  // Makes `el` the first child of its parent, so it renders behind the other children.
-  function toBack(el) {
-  	var parent = el.parentNode;
-  	if (parent && parent.firstChild !== el) {
-  		parent.insertBefore(el, parent.firstChild);
-  	}
-  }
-
-  // @function hasClass(el: HTMLElement, name: String): Boolean
-  // Returns `true` if the element's class attribute contains `name`.
-  function hasClass(el, name) {
-  	if (el.classList !== undefined) {
-  		return el.classList.contains(name);
-  	}
-  	var className = getClass(el);
-  	return className.length > 0 && new RegExp('(^|\\s)' + name + '(\\s|$)').test(className);
-  }
-
-  // @function addClass(el: HTMLElement, name: String)
-  // Adds `name` to the element's class attribute.
-  function addClass(el, name) {
-  	if (el.classList !== undefined) {
-  		var classes = splitWords(name);
-  		for (var i = 0, len = classes.length; i < len; i++) {
-  			el.classList.add(classes[i]);
-  		}
-  	} else if (!hasClass(el, name)) {
-  		var className = getClass(el);
-  		setClass(el, (className ? className + ' ' : '') + name);
-  	}
-  }
-
-  // @function removeClass(el: HTMLElement, name: String)
-  // Removes `name` from the element's class attribute.
-  function removeClass(el, name) {
-  	if (el.classList !== undefined) {
-  		el.classList.remove(name);
-  	} else {
-  		setClass(el, trim((' ' + getClass(el) + ' ').replace(' ' + name + ' ', ' ')));
-  	}
-  }
-
-  // @function setClass(el: HTMLElement, name: String)
-  // Sets the element's class.
-  function setClass(el, name) {
-  	if (el.className.baseVal === undefined) {
-  		el.className = name;
-  	} else {
-  		// in case of SVG element
-  		el.className.baseVal = name;
-  	}
-  }
-
-  // @function getClass(el: HTMLElement): String
-  // Returns the element's class.
-  function getClass(el) {
-  	// Check if the element is an SVGElementInstance and use the correspondingElement instead
-  	// (Required for linked SVG elements in IE11.)
-  	if (el.correspondingElement) {
-  		el = el.correspondingElement;
-  	}
-  	return el.className.baseVal === undefined ? el.className : el.className.baseVal;
-  }
-
-  // @function setOpacity(el: HTMLElement, opacity: Number)
-  // Set the opacity of an element (including old IE support).
-  // `opacity` must be a number from `0` to `1`.
-  function setOpacity(el, value) {
-  	if ('opacity' in el.style) {
-  		el.style.opacity = value;
-  	} else if ('filter' in el.style) {
-  		_setOpacityIE(el, value);
-  	}
-  }
-
-  function _setOpacityIE(el, value) {
-  	var filter = false,
-  	    filterName = 'DXImageTransform.Microsoft.Alpha';
-
-  	// filters collection throws an error if we try to retrieve a filter that doesn't exist
-  	try {
-  		filter = el.filters.item(filterName);
-  	} catch (e) {
-  		// don't set opacity to 1 if we haven't already set an opacity,
-  		// it isn't needed and breaks transparent pngs.
-  		if (value === 1) { return; }
-  	}
-
-  	value = Math.round(value * 100);
-
-  	if (filter) {
-  		filter.Enabled = (value !== 100);
-  		filter.Opacity = value;
-  	} else {
-  		el.style.filter += ' progid:' + filterName + '(opacity=' + value + ')';
-  	}
-  }
-
-  // @function testProp(props: String[]): String|false
-  // Goes through the array of style names and returns the first name
-  // that is a valid style name for an element. If no such name is found,
-  // it returns false. Useful for vendor-prefixed styles like `transform`.
-  function testProp(props) {
-  	var style = document.documentElement.style;
-
-  	for (var i = 0; i < props.length; i++) {
-  		if (props[i] in style) {
-  			return props[i];
-  		}
-  	}
-  	return false;
-  }
-
-  // @function setTransform(el: HTMLElement, offset: Point, scale?: Number)
-  // Resets the 3D CSS transform of `el` so it is translated by `offset` pixels
-  // and optionally scaled by `scale`. Does not have an effect if the
-  // browser doesn't support 3D CSS transforms.
-  function setTransform(el, offset, scale) {
-  	var pos = offset || new Point(0, 0);
-
-  	el.style[TRANSFORM] =
-  		(ie3d ?
-  			'translate(' + pos.x + 'px,' + pos.y + 'px)' :
-  			'translate3d(' + pos.x + 'px,' + pos.y + 'px,0)') +
-  		(scale ? ' scale(' + scale + ')' : '');
-  }
-
-  // @function setPosition(el: HTMLElement, position: Point)
-  // Sets the position of `el` to coordinates specified by `position`,
-  // using CSS translate or top/left positioning depending on the browser
-  // (used by Leaflet internally to position its layers).
-  function setPosition(el, point) {
-
-  	/*eslint-disable */
-  	el._leaflet_pos = point;
-  	/* eslint-enable */
-
-  	if (any3d) {
-  		setTransform(el, point);
-  	} else {
-  		el.style.left = point.x + 'px';
-  		el.style.top = point.y + 'px';
-  	}
-  }
-
-  // @function getPosition(el: HTMLElement): Point
-  // Returns the coordinates of an element previously positioned with setPosition.
-  function getPosition(el) {
-  	// this method is only used for elements previously positioned using setPosition,
-  	// so it's safe to cache the position for performance
-
-  	return el._leaflet_pos || new Point(0, 0);
-  }
-
-  // @function disableTextSelection()
-  // Prevents the user from generating `selectstart` DOM events, usually generated
-  // when the user drags the mouse through a page with text. Used internally
-  // by Leaflet to override the behaviour of any click-and-drag interaction on
-  // the map. Affects drag interactions on the whole document.
-
-  // @function enableTextSelection()
-  // Cancels the effects of a previous [`L.DomUtil.disableTextSelection`](#domutil-disabletextselection).
-  var disableTextSelection;
-  var enableTextSelection;
-  var _userSelect;
-  if ('onselectstart' in document) {
-  	disableTextSelection = function () {
-  		on(window, 'selectstart', preventDefault);
-  	};
-  	enableTextSelection = function () {
-  		off(window, 'selectstart', preventDefault);
-  	};
-  } else {
-  	var userSelectProperty = testProp(
-  		['userSelect', 'WebkitUserSelect', 'OUserSelect', 'MozUserSelect', 'msUserSelect']);
-
-  	disableTextSelection = function () {
-  		if (userSelectProperty) {
-  			var style = document.documentElement.style;
-  			_userSelect = style[userSelectProperty];
-  			style[userSelectProperty] = 'none';
-  		}
-  	};
-  	enableTextSelection = function () {
-  		if (userSelectProperty) {
-  			document.documentElement.style[userSelectProperty] = _userSelect;
-  			_userSelect = undefined;
-  		}
-  	};
-  }
-
-  // @function disableImageDrag()
-  // As [`L.DomUtil.disableTextSelection`](#domutil-disabletextselection), but
-  // for `dragstart` DOM events, usually generated when the user drags an image.
-  function disableImageDrag() {
-  	on(window, 'dragstart', preventDefault);
-  }
-
-  // @function enableImageDrag()
-  // Cancels the effects of a previous [`L.DomUtil.disableImageDrag`](#domutil-disabletextselection).
-  function enableImageDrag() {
-  	off(window, 'dragstart', preventDefault);
-  }
-
-  var _outlineElement, _outlineStyle;
-  // @function preventOutline(el: HTMLElement)
-  // Makes the [outline](https://developer.mozilla.org/docs/Web/CSS/outline)
-  // of the element `el` invisible. Used internally by Leaflet to prevent
-  // focusable elements from displaying an outline when the user performs a
-  // drag interaction on them.
-  function preventOutline(element) {
-  	while (element.tabIndex === -1) {
-  		element = element.parentNode;
-  	}
-  	if (!element.style) { return; }
-  	restoreOutline();
-  	_outlineElement = element;
-  	_outlineStyle = element.style.outline;
-  	element.style.outline = 'none';
-  	on(window, 'keydown', restoreOutline);
-  }
-
-  // @function restoreOutline()
-  // Cancels the effects of a previous [`L.DomUtil.preventOutline`]().
-  function restoreOutline() {
-  	if (!_outlineElement) { return; }
-  	_outlineElement.style.outline = _outlineStyle;
-  	_outlineElement = undefined;
-  	_outlineStyle = undefined;
-  	off(window, 'keydown', restoreOutline);
-  }
-
-  // @function getSizedParentNode(el: HTMLElement): HTMLElement
-  // Finds the closest parent node which size (width and height) is not null.
-  function getSizedParentNode(element) {
-  	do {
-  		element = element.parentNode;
-  	} while ((!element.offsetWidth || !element.offsetHeight) && element !== document.body);
-  	return element;
-  }
-
-  // @function getScale(el: HTMLElement): Object
-  // Computes the CSS scale currently applied on the element.
-  // Returns an object with `x` and `y` members as horizontal and vertical scales respectively,
-  // and `boundingClientRect` as the result of [`getBoundingClientRect()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect).
-  function getScale(element) {
-  	var rect = element.getBoundingClientRect(); // Read-only in old browsers.
-
-  	return {
-  		x: rect.width / element.offsetWidth || 1,
-  		y: rect.height / element.offsetHeight || 1,
-  		boundingClientRect: rect
-  	};
-  }
-
-  var DomUtil = ({
-    TRANSFORM: TRANSFORM,
-    TRANSITION: TRANSITION,
-    TRANSITION_END: TRANSITION_END,
-    get: get,
-    getStyle: getStyle,
-    create: create$1,
-    remove: remove,
-    empty: empty,
-    toFront: toFront,
-    toBack: toBack,
-    hasClass: hasClass,
-    addClass: addClass,
-    removeClass: removeClass,
-    setClass: setClass,
-    getClass: getClass,
-    setOpacity: setOpacity,
-    testProp: testProp,
-    setTransform: setTransform,
-    setPosition: setPosition,
-    getPosition: getPosition,
-    disableTextSelection: disableTextSelection,
-    enableTextSelection: enableTextSelection,
-    disableImageDrag: disableImageDrag,
-    enableImageDrag: enableImageDrag,
-    preventOutline: preventOutline,
-    restoreOutline: restoreOutline,
-    getSizedParentNode: getSizedParentNode,
-    getScale: getScale
-  });
-
-  /*
-   * @namespace DomEvent
-   * Utility functions to work with the [DOM events](https://developer.mozilla.org/docs/Web/API/Event), used by Leaflet internally.
-   */
-
-  // Inspired by John Resig, Dean Edwards and YUI addEvent implementations.
-
-  // @function on(el: HTMLElement, types: String, fn: Function, context?: Object): this
-  // Adds a listener function (`fn`) to a particular DOM event type of the
-  // element `el`. You can optionally specify the context of the listener
-  // (object the `this` keyword will point to). You can also pass several
-  // space-separated types (e.g. `'click dblclick'`).
-
-  // @alternative
-  // @function on(el: HTMLElement, eventMap: Object, context?: Object): this
-  // Adds a set of type/listener pairs, e.g. `{click: onClick, mousemove: onMouseMove}`
-  function on(obj, types, fn, context) {
-
-  	if (typeof types === 'object') {
-  		for (var type in types) {
-  			addOne(obj, type, types[type], fn);
-  		}
-  	} else {
-  		types = splitWords(types);
-
-  		for (var i = 0, len = types.length; i < len; i++) {
-  			addOne(obj, types[i], fn, context);
-  		}
-  	}
-
-  	return this;
-  }
-
-  var eventsKey = '_leaflet_events';
-
-  // @function off(el: HTMLElement, types: String, fn: Function, context?: Object): this
-  // Removes a previously added listener function.
-  // Note that if you passed a custom context to on, you must pass the same
-  // context to `off` in order to remove the listener.
-
-  // @alternative
-  // @function off(el: HTMLElement, eventMap: Object, context?: Object): this
-  // Removes a set of type/listener pairs, e.g. `{click: onClick, mousemove: onMouseMove}`
-  function off(obj, types, fn, context) {
-
-  	if (typeof types === 'object') {
-  		for (var type in types) {
-  			removeOne(obj, type, types[type], fn);
-  		}
-  	} else if (types) {
-  		types = splitWords(types);
-
-  		for (var i = 0, len = types.length; i < len; i++) {
-  			removeOne(obj, types[i], fn, context);
-  		}
-  	} else {
-  		for (var j in obj[eventsKey]) {
-  			removeOne(obj, j, obj[eventsKey][j]);
-  		}
-  		delete obj[eventsKey];
-  	}
-
-  	return this;
-  }
-
-  function browserFiresNativeDblClick() {
-  	// See https://github.com/w3c/pointerevents/issues/171
-  	if (pointer) {
-  		return !(edge || safari);
-  	}
-  }
-
-  var mouseSubst = {
-  	mouseenter: 'mouseover',
-  	mouseleave: 'mouseout',
-  	wheel: !('onwheel' in window) && 'mousewheel'
-  };
-
-  function addOne(obj, type, fn, context) {
-  	var id = type + stamp(fn) + (context ? '_' + stamp(context) : '');
-
-  	if (obj[eventsKey] && obj[eventsKey][id]) { return this; }
-
-  	var handler = function (e) {
-  		return fn.call(context || obj, e || window.event);
-  	};
-
-  	var originalHandler = handler;
-
-  	if (pointer && type.indexOf('touch') === 0) {
-  		// Needs DomEvent.Pointer.js
-  		addPointerListener(obj, type, handler, id);
-
-  	} else if (touch && (type === 'dblclick') && !browserFiresNativeDblClick()) {
-  		addDoubleTapListener(obj, handler, id);
-
-  	} else if ('addEventListener' in obj) {
-
-  		if (type === 'touchstart' || type === 'touchmove' || type === 'wheel' ||  type === 'mousewheel') {
-  			obj.addEventListener(mouseSubst[type] || type, handler, passiveEvents ? {passive: false} : false);
-
-  		} else if (type === 'mouseenter' || type === 'mouseleave') {
-  			handler = function (e) {
-  				e = e || window.event;
-  				if (isExternalTarget(obj, e)) {
-  					originalHandler(e);
-  				}
-  			};
-  			obj.addEventListener(mouseSubst[type], handler, false);
-
-  		} else {
-  			obj.addEventListener(type, originalHandler, false);
-  		}
-
-  	} else if ('attachEvent' in obj) {
-  		obj.attachEvent('on' + type, handler);
-  	}
-
-  	obj[eventsKey] = obj[eventsKey] || {};
-  	obj[eventsKey][id] = handler;
-  }
-
-  function removeOne(obj, type, fn, context) {
-
-  	var id = type + stamp(fn) + (context ? '_' + stamp(context) : ''),
-  	    handler = obj[eventsKey] && obj[eventsKey][id];
-
-  	if (!handler) { return this; }
-
-  	if (pointer && type.indexOf('touch') === 0) {
-  		removePointerListener(obj, type, id);
-
-  	} else if (touch && (type === 'dblclick') && !browserFiresNativeDblClick()) {
-  		removeDoubleTapListener(obj, id);
-
-  	} else if ('removeEventListener' in obj) {
-
-  		obj.removeEventListener(mouseSubst[type] || type, handler, false);
-
-  	} else if ('detachEvent' in obj) {
-  		obj.detachEvent('on' + type, handler);
-  	}
-
-  	obj[eventsKey][id] = null;
-  }
-
-  // @function stopPropagation(ev: DOMEvent): this
-  // Stop the given event from propagation to parent elements. Used inside the listener functions:
-  // ```js
-  // L.DomEvent.on(div, 'click', function (ev) {
-  // 	L.DomEvent.stopPropagation(ev);
-  // });
-  // ```
-  function stopPropagation(e) {
-
-  	if (e.stopPropagation) {
-  		e.stopPropagation();
-  	} else if (e.originalEvent) {  // In case of Leaflet event.
-  		e.originalEvent._stopped = true;
-  	} else {
-  		e.cancelBubble = true;
-  	}
-  	skipped(e);
-
-  	return this;
-  }
-
-  // @function disableScrollPropagation(el: HTMLElement): this
-  // Adds `stopPropagation` to the element's `'wheel'` events (plus browser variants).
-  function disableScrollPropagation(el) {
-  	addOne(el, 'wheel', stopPropagation);
-  	return this;
-  }
-
-  // @function disableClickPropagation(el: HTMLElement): this
-  // Adds `stopPropagation` to the element's `'click'`, `'doubleclick'`,
-  // `'mousedown'` and `'touchstart'` events (plus browser variants).
-  function disableClickPropagation(el) {
-  	on(el, 'mousedown touchstart dblclick', stopPropagation);
-  	addOne(el, 'click', fakeStop);
-  	return this;
-  }
-
-  // @function preventDefault(ev: DOMEvent): this
-  // Prevents the default action of the DOM Event `ev` from happening (such as
-  // following a link in the href of the a element, or doing a POST request
-  // with page reload when a `<form>` is submitted).
-  // Use it inside listener functions.
-  function preventDefault(e) {
-  	if (e.preventDefault) {
-  		e.preventDefault();
-  	} else {
-  		e.returnValue = false;
-  	}
-  	return this;
-  }
-
-  // @function stop(ev: DOMEvent): this
-  // Does `stopPropagation` and `preventDefault` at the same time.
-  function stop(e) {
-  	preventDefault(e);
-  	stopPropagation(e);
-  	return this;
-  }
-
-  // @function getMousePosition(ev: DOMEvent, container?: HTMLElement): Point
-  // Gets normalized mouse position from a DOM event relative to the
-  // `container` (border excluded) or to the whole page if not specified.
-  function getMousePosition(e, container) {
-  	if (!container) {
-  		return new Point(e.clientX, e.clientY);
-  	}
-
-  	var scale = getScale(container),
-  	    offset = scale.boundingClientRect; // left and top  values are in page scale (like the event clientX/Y)
-
-  	return new Point(
-  		// offset.left/top values are in page scale (like clientX/Y),
-  		// whereas clientLeft/Top (border width) values are the original values (before CSS scale applies).
-  		(e.clientX - offset.left) / scale.x - container.clientLeft,
-  		(e.clientY - offset.top) / scale.y - container.clientTop
-  	);
-  }
-
-  // Chrome on Win scrolls double the pixels as in other platforms (see #4538),
-  // and Firefox scrolls device pixels, not CSS pixels
-  var wheelPxFactor =
-  	(win && chrome) ? 2 * window.devicePixelRatio :
-  	gecko ? window.devicePixelRatio : 1;
-
-  // @function getWheelDelta(ev: DOMEvent): Number
-  // Gets normalized wheel delta from a wheel DOM event, in vertical
-  // pixels scrolled (negative if scrolling down).
-  // Events from pointing devices without precise scrolling are mapped to
-  // a best guess of 60 pixels.
-  function getWheelDelta(e) {
-  	return (edge) ? e.wheelDeltaY / 2 : // Don't trust window-geometry-based delta
-  	       (e.deltaY && e.deltaMode === 0) ? -e.deltaY / wheelPxFactor : // Pixels
-  	       (e.deltaY && e.deltaMode === 1) ? -e.deltaY * 20 : // Lines
-  	       (e.deltaY && e.deltaMode === 2) ? -e.deltaY * 60 : // Pages
-  	       (e.deltaX || e.deltaZ) ? 0 :	// Skip horizontal/depth wheel events
-  	       e.wheelDelta ? (e.wheelDeltaY || e.wheelDelta) / 2 : // Legacy IE pixels
-  	       (e.detail && Math.abs(e.detail) < 32765) ? -e.detail * 20 : // Legacy Moz lines
-  	       e.detail ? e.detail / -32765 * 60 : // Legacy Moz pages
-  	       0;
-  }
-
-  var skipEvents = {};
-
-  function fakeStop(e) {
-  	// fakes stopPropagation by setting a special event flag, checked/reset with skipped(e)
-  	skipEvents[e.type] = true;
-  }
-
-  function skipped(e) {
-  	var events = skipEvents[e.type];
-  	// reset when checking, as it's only used in map container and propagates outside of the map
-  	skipEvents[e.type] = false;
-  	return events;
-  }
-
-  // check if element really left/entered the event target (for mouseenter/mouseleave)
-  function isExternalTarget(el, e) {
-
-  	var related = e.relatedTarget;
-
-  	if (!related) { return true; }
-
-  	try {
-  		while (related && (related !== el)) {
-  			related = related.parentNode;
-  		}
-  	} catch (err) {
-  		return false;
-  	}
-  	return (related !== el);
-  }
-
-  var DomEvent = ({
-    on: on,
-    off: off,
-    stopPropagation: stopPropagation,
-    disableScrollPropagation: disableScrollPropagation,
-    disableClickPropagation: disableClickPropagation,
-    preventDefault: preventDefault,
-    stop: stop,
-    getMousePosition: getMousePosition,
-    getWheelDelta: getWheelDelta,
-    fakeStop: fakeStop,
-    skipped: skipped,
-    isExternalTarget: isExternalTarget,
-    addListener: on,
-    removeListener: off
-  });
-
-  /*
-   * @class PosAnimation
-   * @aka L.PosAnimation
-   * @inherits Evented
-   * Used internally for panning animations, utilizing CSS3 Transitions for modern browsers and a timer fallback for IE6-9.
-   *
-   * @example
-   * ```js
-   * var fx = new L.PosAnimation();
-   * fx.run(el, [300, 500], 0.5);
-   * ```
-   *
-   * @constructor L.PosAnimation()
-   * Creates a `PosAnimation` object.
-   *
-   */
-
-  var PosAnimation = Evented.extend({
-
-  	// @method run(el: HTMLElement, newPos: Point, duration?: Number, easeLinearity?: Number)
-  	// Run an animation of a given element to a new position, optionally setting
-  	// duration in seconds (`0.25` by default) and easing linearity factor (3rd
-  	// argument of the [cubic bezier curve](http://cubic-bezier.com/#0,0,.5,1),
-  	// `0.5` by default).
-  	run: function (el, newPos, duration, easeLinearity) {
-  		this.stop();
-
-  		this._el = el;
-  		this._inProgress = true;
-  		this._duration = duration || 0.25;
-  		this._easeOutPower = 1 / Math.max(easeLinearity || 0.5, 0.2);
-
-  		this._startPos = getPosition(el);
-  		this._offset = newPos.subtract(this._startPos);
-  		this._startTime = +new Date();
-
-  		// @event start: Event
-  		// Fired when the animation starts
-  		this.fire('start');
-
-  		this._animate();
-  	},
-
-  	// @method stop()
-  	// Stops the animation (if currently running).
-  	stop: function () {
-  		if (!this._inProgress) { return; }
-
-  		this._step(true);
-  		this._complete();
-  	},
-
-  	_animate: function () {
-  		// animation loop
-  		this._animId = requestAnimFrame(this._animate, this);
-  		this._step();
-  	},
-
-  	_step: function (round) {
-  		var elapsed = (+new Date()) - this._startTime,
-  		    duration = this._duration * 1000;
-
-  		if (elapsed < duration) {
-  			this._runFrame(this._easeOut(elapsed / duration), round);
-  		} else {
-  			this._runFrame(1);
-  			this._complete();
-  		}
-  	},
-
-  	_runFrame: function (progress, round) {
-  		var pos = this._startPos.add(this._offset.multiplyBy(progress));
-  		if (round) {
-  			pos._round();
-  		}
-  		setPosition(this._el, pos);
-
-  		// @event step: Event
-  		// Fired continuously during the animation.
-  		this.fire('step');
-  	},
-
-  	_complete: function () {
-  		cancelAnimFrame(this._animId);
-
-  		this._inProgress = false;
-  		// @event end: Event
-  		// Fired when the animation ends.
-  		this.fire('end');
-  	},
-
-  	_easeOut: function (t) {
-  		return 1 - Math.pow(1 - t, this._easeOutPower);
-  	}
-  });
-
-  /*
-   * @class Map
-   * @aka L.Map
-   * @inherits Evented
-   *
-   * The central class of the API — it is used to create a map on a page and manipulate it.
-   *
-   * @example
-   *
-   * ```js
-   * // initialize the map on the "map" div with a given center and zoom
-   * var map = L.map('map', {
-   * 	center: [51.505, -0.09],
-   * 	zoom: 13
-   * });
-   * ```
-   *
-   */
-
-  var Map = Evented.extend({
-
-  	options: {
-  		// @section Map State Options
-  		// @option crs: CRS = L.CRS.EPSG3857
-  		// The [Coordinate Reference System](#crs) to use. Don't change this if you're not
-  		// sure what it means.
-  		crs: EPSG3857,
-
-  		// @option center: LatLng = undefined
-  		// Initial geographic center of the map
-  		center: undefined,
-
-  		// @option zoom: Number = undefined
-  		// Initial map zoom level
-  		zoom: undefined,
-
-  		// @option minZoom: Number = *
-  		// Minimum zoom level of the map.
-  		// If not specified and at least one `GridLayer` or `TileLayer` is in the map,
-  		// the lowest of their `minZoom` options will be used instead.
-  		minZoom: undefined,
-
-  		// @option maxZoom: Number = *
-  		// Maximum zoom level of the map.
-  		// If not specified and at least one `GridLayer` or `TileLayer` is in the map,
-  		// the highest of their `maxZoom` options will be used instead.
-  		maxZoom: undefined,
-
-  		// @option layers: Layer[] = []
-  		// Array of layers that will be added to the map initially
-  		layers: [],
-
-  		// @option maxBounds: LatLngBounds = null
-  		// When this option is set, the map restricts the view to the given
-  		// geographical bounds, bouncing the user back if the user tries to pan
-  		// outside the view. To set the restriction dynamically, use
-  		// [`setMaxBounds`](#map-setmaxbounds) method.
-  		maxBounds: undefined,
-
-  		// @option renderer: Renderer = *
-  		// The default method for drawing vector layers on the map. `L.SVG`
-  		// or `L.Canvas` by default depending on browser support.
-  		renderer: undefined,
-
-
-  		// @section Animation Options
-  		// @option zoomAnimation: Boolean = true
-  		// Whether the map zoom animation is enabled. By default it's enabled
-  		// in all browsers that support CSS3 Transitions except Android.
-  		zoomAnimation: true,
-
-  		// @option zoomAnimationThreshold: Number = 4
-  		// Won't animate zoom if the zoom difference exceeds this value.
-  		zoomAnimationThreshold: 4,
-
-  		// @option fadeAnimation: Boolean = true
-  		// Whether the tile fade animation is enabled. By default it's enabled
-  		// in all browsers that support CSS3 Transitions except Android.
-  		fadeAnimation: true,
-
-  		// @option markerZoomAnimation: Boolean = true
-  		// Whether markers animate their zoom with the zoom animation, if disabled
-  		// they will disappear for the length of the animation. By default it's
-  		// enabled in all browsers that support CSS3 Transitions except Android.
-  		markerZoomAnimation: true,
-
-  		// @option transform3DLimit: Number = 2^23
-  		// Defines the maximum size of a CSS translation transform. The default
-  		// value should not be changed unless a web browser positions layers in
-  		// the wrong place after doing a large `panBy`.
-  		transform3DLimit: 8388608, // Precision limit of a 32-bit float
-
-  		// @section Interaction Options
-  		// @option zoomSnap: Number = 1
-  		// Forces the map's zoom level to always be a multiple of this, particularly
-  		// right after a [`fitBounds()`](#map-fitbounds) or a pinch-zoom.
-  		// By default, the zoom level snaps to the nearest integer; lower values
-  		// (e.g. `0.5` or `0.1`) allow for greater granularity. A value of `0`
-  		// means the zoom level will not be snapped after `fitBounds` or a pinch-zoom.
-  		zoomSnap: 1,
-
-  		// @option zoomDelta: Number = 1
-  		// Controls how much the map's zoom level will change after a
-  		// [`zoomIn()`](#map-zoomin), [`zoomOut()`](#map-zoomout), pressing `+`
-  		// or `-` on the keyboard, or using the [zoom controls](#control-zoom).
-  		// Values smaller than `1` (e.g. `0.5`) allow for greater granularity.
-  		zoomDelta: 1,
-
-  		// @option trackResize: Boolean = true
-  		// Whether the map automatically handles browser window resize to update itself.
-  		trackResize: true
-  	},
-
-  	initialize: function (id, options) { // (HTMLElement or String, Object)
-  		options = setOptions(this, options);
-
-  		// Make sure to assign internal flags at the beginning,
-  		// to avoid inconsistent state in some edge cases.
-  		this._handlers = [];
-  		this._layers = {};
-  		this._zoomBoundLayers = {};
-  		this._sizeChanged = true;
-
-  		this._initContainer(id);
-  		this._initLayout();
-
-  		// hack for https://github.com/Leaflet/Leaflet/issues/1980
-  		this._onResize = bind(this._onResize, this);
-
-  		this._initEvents();
-
-  		if (options.maxBounds) {
-  			this.setMaxBounds(options.maxBounds);
-  		}
-
-  		if (options.zoom !== undefined) {
-  			this._zoom = this._limitZoom(options.zoom);
-  		}
-
-  		if (options.center && options.zoom !== undefined) {
-  			this.setView(toLatLng(options.center), options.zoom, {reset: true});
-  		}
-
-  		this.callInitHooks();
-
-  		// don't animate on browsers without hardware-accelerated transitions or old Android/Opera
-  		this._zoomAnimated = TRANSITION && any3d && !mobileOpera &&
-  				this.options.zoomAnimation;
-
-  		// zoom transitions run with the same duration for all layers, so if one of transitionend events
-  		// happens after starting zoom animation (propagating to the map pane), we know that it ended globally
-  		if (this._zoomAnimated) {
-  			this._createAnimProxy();
-  			on(this._proxy, TRANSITION_END, this._catchTransitionEnd, this);
-  		}
-
-  		this._addLayers(this.options.layers);
-  	},
-
-
-  	// @section Methods for modifying map state
-
-  	// @method setView(center: LatLng, zoom: Number, options?: Zoom/pan options): this
-  	// Sets the view of the map (geographical center and zoom) with the given
-  	// animation options.
-  	setView: function (center, zoom, options) {
-
-  		zoom = zoom === undefined ? this._zoom : this._limitZoom(zoom);
-  		center = this._limitCenter(toLatLng(center), zoom, this.options.maxBounds);
-  		options = options || {};
-
-  		this._stop();
-
-  		if (this._loaded && !options.reset && options !== true) {
-
-  			if (options.animate !== undefined) {
-  				options.zoom = extend({animate: options.animate}, options.zoom);
-  				options.pan = extend({animate: options.animate, duration: options.duration}, options.pan);
-  			}
-
-  			// try animating pan or zoom
-  			var moved = (this._zoom !== zoom) ?
-  				this._tryAnimatedZoom && this._tryAnimatedZoom(center, zoom, options.zoom) :
-  				this._tryAnimatedPan(center, options.pan);
-
-  			if (moved) {
-  				// prevent resize handler call, the view will refresh after animation anyway
-  				clearTimeout(this._sizeTimer);
-  				return this;
-  			}
-  		}
-
-  		// animation didn't start, just reset the map view
-  		this._resetView(center, zoom);
-
-  		return this;
-  	},
-
-  	// @method setZoom(zoom: Number, options?: Zoom/pan options): this
-  	// Sets the zoom of the map.
-  	setZoom: function (zoom, options) {
-  		if (!this._loaded) {
-  			this._zoom = zoom;
-  			return this;
-  		}
-  		return this.setView(this.getCenter(), zoom, {zoom: options});
-  	},
-
-  	// @method zoomIn(delta?: Number, options?: Zoom options): this
-  	// Increases the zoom of the map by `delta` ([`zoomDelta`](#map-zoomdelta) by default).
-  	zoomIn: function (delta, options) {
-  		delta = delta || (any3d ? this.options.zoomDelta : 1);
-  		return this.setZoom(this._zoom + delta, options);
-  	},
-
-  	// @method zoomOut(delta?: Number, options?: Zoom options): this
-  	// Decreases the zoom of the map by `delta` ([`zoomDelta`](#map-zoomdelta) by default).
-  	zoomOut: function (delta, options) {
-  		delta = delta || (any3d ? this.options.zoomDelta : 1);
-  		return this.setZoom(this._zoom - delta, options);
-  	},
-
-  	// @method setZoomAround(latlng: LatLng, zoom: Number, options: Zoom options): this
-  	// Zooms the map while keeping a specified geographical point on the map
-  	// stationary (e.g. used internally for scroll zoom and double-click zoom).
-  	// @alternative
-  	// @method setZoomAround(offset: Point, zoom: Number, options: Zoom options): this
-  	// Zooms the map while keeping a specified pixel on the map (relative to the top-left corner) stationary.
-  	setZoomAround: function (latlng, zoom, options) {
-  		var scale = this.getZoomScale(zoom),
-  		    viewHalf = this.getSize().divideBy(2),
-  		    containerPoint = latlng instanceof Point ? latlng : this.latLngToContainerPoint(latlng),
-
-  		    centerOffset = containerPoint.subtract(viewHalf).multiplyBy(1 - 1 / scale),
-  		    newCenter = this.containerPointToLatLng(viewHalf.add(centerOffset));
-
-  		return this.setView(newCenter, zoom, {zoom: options});
-  	},
-
-  	_getBoundsCenterZoom: function (bounds, options) {
-
-  		options = options || {};
-  		bounds = bounds.getBounds ? bounds.getBounds() : toLatLngBounds(bounds);
-
-  		var paddingTL = toPoint(options.paddingTopLeft || options.padding || [0, 0]),
-  		    paddingBR = toPoint(options.paddingBottomRight || options.padding || [0, 0]),
-
-  		    zoom = this.getBoundsZoom(bounds, false, paddingTL.add(paddingBR));
-
-  		zoom = (typeof options.maxZoom === 'number') ? Math.min(options.maxZoom, zoom) : zoom;
-
-  		if (zoom === Infinity) {
-  			return {
-  				center: bounds.getCenter(),
-  				zoom: zoom
-  			};
-  		}
-
-  		var paddingOffset = paddingBR.subtract(paddingTL).divideBy(2),
-
-  		    swPoint = this.project(bounds.getSouthWest(), zoom),
-  		    nePoint = this.project(bounds.getNorthEast(), zoom),
-  		    center = this.unproject(swPoint.add(nePoint).divideBy(2).add(paddingOffset), zoom);
-
-  		return {
-  			center: center,
-  			zoom: zoom
-  		};
-  	},
-
-  	// @method fitBounds(bounds: LatLngBounds, options?: fitBounds options): this
-  	// Sets a map view that contains the given geographical bounds with the
-  	// maximum zoom level possible.
-  	fitBounds: function (bounds, options) {
-
-  		bounds = toLatLngBounds(bounds);
-
-  		if (!bounds.isValid()) {
-  			throw new Error('Bounds are not valid.');
-  		}
-
-  		var target = this._getBoundsCenterZoom(bounds, options);
-  		return this.setView(target.center, target.zoom, options);
-  	},
-
-  	// @method fitWorld(options?: fitBounds options): this
-  	// Sets a map view that mostly contains the whole world with the maximum
-  	// zoom level possible.
-  	fitWorld: function (options) {
-  		return this.fitBounds([[-90, -180], [90, 180]], options);
-  	},
-
-  	// @method panTo(latlng: LatLng, options?: Pan options): this
-  	// Pans the map to a given center.
-  	panTo: function (center, options) { // (LatLng)
-  		return this.setView(center, this._zoom, {pan: options});
-  	},
-
-  	// @method panBy(offset: Point, options?: Pan options): this
-  	// Pans the map by a given number of pixels (animated).
-  	panBy: function (offset, options) {
-  		offset = toPoint(offset).round();
-  		options = options || {};
-
-  		if (!offset.x && !offset.y) {
-  			return this.fire('moveend');
-  		}
-  		// If we pan too far, Chrome gets issues with tiles
-  		// and makes them disappear or appear in the wrong place (slightly offset) #2602
-  		if (options.animate !== true && !this.getSize().contains(offset)) {
-  			this._resetView(this.unproject(this.project(this.getCenter()).add(offset)), this.getZoom());
-  			return this;
-  		}
-
-  		if (!this._panAnim) {
-  			this._panAnim = new PosAnimation();
-
-  			this._panAnim.on({
-  				'step': this._onPanTransitionStep,
-  				'end': this._onPanTransitionEnd
-  			}, this);
-  		}
-
-  		// don't fire movestart if animating inertia
-  		if (!options.noMoveStart) {
-  			this.fire('movestart');
-  		}
-
-  		// animate pan unless animate: false specified
-  		if (options.animate !== false) {
-  			addClass(this._mapPane, 'leaflet-pan-anim');
-
-  			var newPos = this._getMapPanePos().subtract(offset).round();
-  			this._panAnim.run(this._mapPane, newPos, options.duration || 0.25, options.easeLinearity);
-  		} else {
-  			this._rawPanBy(offset);
-  			this.fire('move').fire('moveend');
-  		}
-
-  		return this;
-  	},
-
-  	// @method flyTo(latlng: LatLng, zoom?: Number, options?: Zoom/pan options): this
-  	// Sets the view of the map (geographical center and zoom) performing a smooth
-  	// pan-zoom animation.
-  	flyTo: function (targetCenter, targetZoom, options) {
-
-  		options = options || {};
-  		if (options.animate === false || !any3d) {
-  			return this.setView(targetCenter, targetZoom, options);
-  		}
-
-  		this._stop();
-
-  		var from = this.project(this.getCenter()),
-  		    to = this.project(targetCenter),
-  		    size = this.getSize(),
-  		    startZoom = this._zoom;
-
-  		targetCenter = toLatLng(targetCenter);
-  		targetZoom = targetZoom === undefined ? startZoom : targetZoom;
-
-  		var w0 = Math.max(size.x, size.y),
-  		    w1 = w0 * this.getZoomScale(startZoom, targetZoom),
-  		    u1 = (to.distanceTo(from)) || 1,
-  		    rho = 1.42,
-  		    rho2 = rho * rho;
-
-  		function r(i) {
-  			var s1 = i ? -1 : 1,
-  			    s2 = i ? w1 : w0,
-  			    t1 = w1 * w1 - w0 * w0 + s1 * rho2 * rho2 * u1 * u1,
-  			    b1 = 2 * s2 * rho2 * u1,
-  			    b = t1 / b1,
-  			    sq = Math.sqrt(b * b + 1) - b;
-
-  			    // workaround for floating point precision bug when sq = 0, log = -Infinite,
-  			    // thus triggering an infinite loop in flyTo
-  			    var log = sq < 0.000000001 ? -18 : Math.log(sq);
-
-  			return log;
-  		}
-
-  		function sinh(n) { return (Math.exp(n) - Math.exp(-n)) / 2; }
-  		function cosh(n) { return (Math.exp(n) + Math.exp(-n)) / 2; }
-  		function tanh(n) { return sinh(n) / cosh(n); }
-
-  		var r0 = r(0);
-
-  		function w(s) { return w0 * (cosh(r0) / cosh(r0 + rho * s)); }
-  		function u(s) { return w0 * (cosh(r0) * tanh(r0 + rho * s) - sinh(r0)) / rho2; }
-
-  		function easeOut(t) { return 1 - Math.pow(1 - t, 1.5); }
-
-  		var start = Date.now(),
-  		    S = (r(1) - r0) / rho,
-  		    duration = options.duration ? 1000 * options.duration : 1000 * S * 0.8;
-
-  		function frame() {
-  			var t = (Date.now() - start) / duration,
-  			    s = easeOut(t) * S;
-
-  			if (t <= 1) {
-  				this._flyToFrame = requestAnimFrame(frame, this);
-
-  				this._move(
-  					this.unproject(from.add(to.subtract(from).multiplyBy(u(s) / u1)), startZoom),
-  					this.getScaleZoom(w0 / w(s), startZoom),
-  					{flyTo: true});
-
-  			} else {
-  				this
-  					._move(targetCenter, targetZoom)
-  					._moveEnd(true);
-  			}
-  		}
-
-  		this._moveStart(true, options.noMoveStart);
-
-  		frame.call(this);
-  		return this;
-  	},
-
-  	// @method flyToBounds(bounds: LatLngBounds, options?: fitBounds options): this
-  	// Sets the view of the map with a smooth animation like [`flyTo`](#map-flyto),
-  	// but takes a bounds parameter like [`fitBounds`](#map-fitbounds).
-  	flyToBounds: function (bounds, options) {
-  		var target = this._getBoundsCenterZoom(bounds, options);
-  		return this.flyTo(target.center, target.zoom, options);
-  	},
-
-  	// @method setMaxBounds(bounds: LatLngBounds): this
-  	// Restricts the map view to the given bounds (see the [maxBounds](#map-maxbounds) option).
-  	setMaxBounds: function (bounds) {
-  		bounds = toLatLngBounds(bounds);
-
-  		if (!bounds.isValid()) {
-  			this.options.maxBounds = null;
-  			return this.off('moveend', this._panInsideMaxBounds);
-  		} else if (this.options.maxBounds) {
-  			this.off('moveend', this._panInsideMaxBounds);
-  		}
-
-  		this.options.maxBounds = bounds;
-
-  		if (this._loaded) {
-  			this._panInsideMaxBounds();
-  		}
-
-  		return this.on('moveend', this._panInsideMaxBounds);
-  	},
-
-  	// @method setMinZoom(zoom: Number): this
-  	// Sets the lower limit for the available zoom levels (see the [minZoom](#map-minzoom) option).
-  	setMinZoom: function (zoom) {
-  		var oldZoom = this.options.minZoom;
-  		this.options.minZoom = zoom;
-
-  		if (this._loaded && oldZoom !== zoom) {
-  			this.fire('zoomlevelschange');
-
-  			if (this.getZoom() < this.options.minZoom) {
-  				return this.setZoom(zoom);
-  			}
-  		}
-
-  		return this;
-  	},
-
-  	// @method setMaxZoom(zoom: Number): this
-  	// Sets the upper limit for the available zoom levels (see the [maxZoom](#map-maxzoom) option).
-  	setMaxZoom: function (zoom) {
-  		var oldZoom = this.options.maxZoom;
-  		this.options.maxZoom = zoom;
-
-  		if (this._loaded && oldZoom !== zoom) {
-  			this.fire('zoomlevelschange');
-
-  			if (this.getZoom() > this.options.maxZoom) {
-  				return this.setZoom(zoom);
-  			}
-  		}
-
-  		return this;
-  	},
-
-  	// @method panInsideBounds(bounds: LatLngBounds, options?: Pan options): this
-  	// Pans the map to the closest view that would lie inside the given bounds (if it's not already), controlling the animation using the options specific, if any.
-  	panInsideBounds: function (bounds, options) {
-  		this._enforcingBounds = true;
-  		var center = this.getCenter(),
-  		    newCenter = this._limitCenter(center, this._zoom, toLatLngBounds(bounds));
-
-  		if (!center.equals(newCenter)) {
-  			this.panTo(newCenter, options);
-  		}
-
-  		this._enforcingBounds = false;
-  		return this;
-  	},
-
-  	// @method panInside(latlng: LatLng, options?: options): this
-  	// Pans the map the minimum amount to make the `latlng` visible. Use
-  	// `padding`, `paddingTopLeft` and `paddingTopRight` options to fit
-  	// the display to more restricted bounds, like [`fitBounds`](#map-fitbounds).
-  	// If `latlng` is already within the (optionally padded) display bounds,
-  	// the map will not be panned.
-  	panInside: function (latlng, options) {
-  		options = options || {};
-
-  		var paddingTL = toPoint(options.paddingTopLeft || options.padding || [0, 0]),
-  		    paddingBR = toPoint(options.paddingBottomRight || options.padding || [0, 0]),
-  		    center = this.getCenter(),
-  		    pixelCenter = this.project(center),
-  		    pixelPoint = this.project(latlng),
-  		    pixelBounds = this.getPixelBounds(),
-  		    halfPixelBounds = pixelBounds.getSize().divideBy(2),
-  		    paddedBounds = toBounds([pixelBounds.min.add(paddingTL), pixelBounds.max.subtract(paddingBR)]);
-
-  		if (!paddedBounds.contains(pixelPoint)) {
-  			this._enforcingBounds = true;
-  			var diff = pixelCenter.subtract(pixelPoint),
-  			    newCenter = toPoint(pixelPoint.x + diff.x, pixelPoint.y + diff.y);
-
-  			if (pixelPoint.x < paddedBounds.min.x || pixelPoint.x > paddedBounds.max.x) {
-  				newCenter.x = pixelCenter.x - diff.x;
-  				if (diff.x > 0) {
-  					newCenter.x += halfPixelBounds.x - paddingTL.x;
-  				} else {
-  					newCenter.x -= halfPixelBounds.x - paddingBR.x;
-  				}
-  			}
-  			if (pixelPoint.y < paddedBounds.min.y || pixelPoint.y > paddedBounds.max.y) {
-  				newCenter.y = pixelCenter.y - diff.y;
-  				if (diff.y > 0) {
-  					newCenter.y += halfPixelBounds.y - paddingTL.y;
-  				} else {
-  					newCenter.y -= halfPixelBounds.y - paddingBR.y;
-  				}
-  			}
-  			this.panTo(this.unproject(newCenter), options);
-  			this._enforcingBounds = false;
-  		}
-  		return this;
-  	},
-
-  	// @method invalidateSize(options: Zoom/pan options): this
-  	// Checks if the map container size changed and updates the map if so —
-  	// call it after you've changed the map size dynamically, also animating
-  	// pan by default. If `options.pan` is `false`, panning will not occur.
-  	// If `options.debounceMoveend` is `true`, it will delay `moveend` event so
-  	// that it doesn't happen often even if the method is called many
-  	// times in a row.
-
-  	// @alternative
-  	// @method invalidateSize(animate: Boolean): this
-  	// Checks if the map container size changed and updates the map if so —
-  	// call it after you've changed the map size dynamically, also animating
-  	// pan by default.
-  	invalidateSize: function (options) {
-  		if (!this._loaded) { return this; }
-
-  		options = extend({
-  			animate: false,
-  			pan: true
-  		}, options === true ? {animate: true} : options);
-
-  		var oldSize = this.getSize();
-  		this._sizeChanged = true;
-  		this._lastCenter = null;
-
-  		var newSize = this.getSize(),
-  		    oldCenter = oldSize.divideBy(2).round(),
-  		    newCenter = newSize.divideBy(2).round(),
-  		    offset = oldCenter.subtract(newCenter);
-
-  		if (!offset.x && !offset.y) { return this; }
-
-  		if (options.animate && options.pan) {
-  			this.panBy(offset);
-
-  		} else {
-  			if (options.pan) {
-  				this._rawPanBy(offset);
-  			}
-
-  			this.fire('move');
-
-  			if (options.debounceMoveend) {
-  				clearTimeout(this._sizeTimer);
-  				this._sizeTimer = setTimeout(bind(this.fire, this, 'moveend'), 200);
-  			} else {
-  				this.fire('moveend');
-  			}
-  		}
-
-  		// @section Map state change events
-  		// @event resize: ResizeEvent
-  		// Fired when the map is resized.
-  		return this.fire('resize', {
-  			oldSize: oldSize,
-  			newSize: newSize
-  		});
-  	},
-
-  	// @section Methods for modifying map state
-  	// @method stop(): this
-  	// Stops the currently running `panTo` or `flyTo` animation, if any.
-  	stop: function () {
-  		this.setZoom(this._limitZoom(this._zoom));
-  		if (!this.options.zoomSnap) {
-  			this.fire('viewreset');
-  		}
-  		return this._stop();
-  	},
-
-  	// @section Geolocation methods
-  	// @method locate(options?: Locate options): this
-  	// Tries to locate the user using the Geolocation API, firing a [`locationfound`](#map-locationfound)
-  	// event with location data on success or a [`locationerror`](#map-locationerror) event on failure,
-  	// and optionally sets the map view to the user's location with respect to
-  	// detection accuracy (or to the world view if geolocation failed).
-  	// Note that, if your page doesn't use HTTPS, this method will fail in
-  	// modern browsers ([Chrome 50 and newer](https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-powerful-features-on-insecure-origins))
-  	// See `Locate options` for more details.
-  	locate: function (options) {
-
-  		options = this._locateOptions = extend({
-  			timeout: 10000,
-  			watch: false
-  			// setView: false
-  			// maxZoom: <Number>
-  			// maximumAge: 0
-  			// enableHighAccuracy: false
-  		}, options);
-
-  		if (!('geolocation' in navigator)) {
-  			this._handleGeolocationError({
-  				code: 0,
-  				message: 'Geolocation not supported.'
-  			});
-  			return this;
-  		}
-
-  		var onResponse = bind(this._handleGeolocationResponse, this),
-  		    onError = bind(this._handleGeolocationError, this);
-
-  		if (options.watch) {
-  			this._locationWatchId =
-  			        navigator.geolocation.watchPosition(onResponse, onError, options);
-  		} else {
-  			navigator.geolocation.getCurrentPosition(onResponse, onError, options);
-  		}
-  		return this;
-  	},
-
-  	// @method stopLocate(): this
-  	// Stops watching location previously initiated by `map.locate({watch: true})`
-  	// and aborts resetting the map view if map.locate was called with
-  	// `{setView: true}`.
-  	stopLocate: function () {
-  		if (navigator.geolocation && navigator.geolocation.clearWatch) {
-  			navigator.geolocation.clearWatch(this._locationWatchId);
-  		}
-  		if (this._locateOptions) {
-  			this._locateOptions.setView = false;
-  		}
-  		return this;
-  	},
-
-  	_handleGeolocationError: function (error) {
-  		var c = error.code,
-  		    message = error.message ||
-  		            (c === 1 ? 'permission denied' :
-  		            (c === 2 ? 'position unavailable' : 'timeout'));
-
-  		if (this._locateOptions.setView && !this._loaded) {
-  			this.fitWorld();
-  		}
-
-  		// @section Location events
-  		// @event locationerror: ErrorEvent
-  		// Fired when geolocation (using the [`locate`](#map-locate) method) failed.
-  		this.fire('locationerror', {
-  			code: c,
-  			message: 'Geolocation error: ' + message + '.'
-  		});
-  	},
-
-  	_handleGeolocationResponse: function (pos) {
-  		var lat = pos.coords.latitude,
-  		    lng = pos.coords.longitude,
-  		    latlng = new LatLng(lat, lng),
-  		    bounds = latlng.toBounds(pos.coords.accuracy * 2),
-  		    options = this._locateOptions;
-
-  		if (options.setView) {
-  			var zoom = this.getBoundsZoom(bounds);
-  			this.setView(latlng, options.maxZoom ? Math.min(zoom, options.maxZoom) : zoom);
-  		}
-
-  		var data = {
-  			latlng: latlng,
-  			bounds: bounds,
-  			timestamp: pos.timestamp
-  		};
-
-  		for (var i in pos.coords) {
-  			if (typeof pos.coords[i] === 'number') {
-  				data[i] = pos.coords[i];
-  			}
-  		}
-
-  		// @event locationfound: LocationEvent
-  		// Fired when geolocation (using the [`locate`](#map-locate) method)
-  		// went successfully.
-  		this.fire('locationfound', data);
-  	},
-
-  	// TODO Appropriate docs section?
-  	// @section Other Methods
-  	// @method addHandler(name: String, HandlerClass: Function): this
-  	// Adds a new `Handler` to the map, given its name and constructor function.
-  	addHandler: function (name, HandlerClass) {
-  		if (!HandlerClass) { return this; }
-
-  		var handler = this[name] = new HandlerClass(this);
-
-  		this._handlers.push(handler);
-
-  		if (this.options[name]) {
-  			handler.enable();
-  		}
-
-  		return this;
-  	},
-
-  	// @method remove(): this
-  	// Destroys the map and clears all related event listeners.
-  	remove: function () {
-
-  		this._initEvents(true);
-  		this.off('moveend', this._panInsideMaxBounds);
-
-  		if (this._containerId !== this._container._leaflet_id) {
-  			throw new Error('Map container is being reused by another instance');
-  		}
-
-  		try {
-  			// throws error in IE6-8
-  			delete this._container._leaflet_id;
-  			delete this._containerId;
-  		} catch (e) {
-  			/*eslint-disable */
-  			this._container._leaflet_id = undefined;
-  			/* eslint-enable */
-  			this._containerId = undefined;
-  		}
-
-  		if (this._locationWatchId !== undefined) {
-  			this.stopLocate();
-  		}
-
-  		this._stop();
-
-  		remove(this._mapPane);
-
-  		if (this._clearControlPos) {
-  			this._clearControlPos();
-  		}
-  		if (this._resizeRequest) {
-  			cancelAnimFrame(this._resizeRequest);
-  			this._resizeRequest = null;
-  		}
-
-  		this._clearHandlers();
-
-  		if (this._loaded) {
-  			// @section Map state change events
-  			// @event unload: Event
-  			// Fired when the map is destroyed with [remove](#map-remove) method.
-  			this.fire('unload');
-  		}
-
-  		var i;
-  		for (i in this._layers) {
-  			this._layers[i].remove();
-  		}
-  		for (i in this._panes) {
-  			remove(this._panes[i]);
-  		}
-
-  		this._layers = [];
-  		this._panes = [];
-  		delete this._mapPane;
-  		delete this._renderer;
-
-  		return this;
-  	},
-
-  	// @section Other Methods
-  	// @method createPane(name: String, container?: HTMLElement): HTMLElement
-  	// Creates a new [map pane](#map-pane) with the given name if it doesn't exist already,
-  	// then returns it. The pane is created as a child of `container`, or
-  	// as a child of the main map pane if not set.
-  	createPane: function (name, container) {
-  		var className = 'leaflet-pane' + (name ? ' leaflet-' + name.replace('Pane', '') + '-pane' : ''),
-  		    pane = create$1('div', className, container || this._mapPane);
-
-  		if (name) {
-  			this._panes[name] = pane;
-  		}
-  		return pane;
-  	},
-
-  	// @section Methods for Getting Map State
-
-  	// @method getCenter(): LatLng
-  	// Returns the geographical center of the map view
-  	getCenter: function () {
-  		this._checkIfLoaded();
-
-  		if (this._lastCenter && !this._moved()) {
-  			return this._lastCenter;
-  		}
-  		return this.layerPointToLatLng(this._getCenterLayerPoint());
-  	},
-
-  	// @method getZoom(): Number
-  	// Returns the current zoom level of the map view
-  	getZoom: function () {
-  		return this._zoom;
-  	},
-
-  	// @method getBounds(): LatLngBounds
-  	// Returns the geographical bounds visible in the current map view
-  	getBounds: function () {
-  		var bounds = this.getPixelBounds(),
-  		    sw = this.unproject(bounds.getBottomLeft()),
-  		    ne = this.unproject(bounds.getTopRight());
-
-  		return new LatLngBounds(sw, ne);
-  	},
-
-  	// @method getMinZoom(): Number
-  	// Returns the minimum zoom level of the map (if set in the `minZoom` option of the map or of any layers), or `0` by default.
-  	getMinZoom: function () {
-  		return this.options.minZoom === undefined ? this._layersMinZoom || 0 : this.options.minZoom;
-  	},
-
-  	// @method getMaxZoom(): Number
-  	// Returns the maximum zoom level of the map (if set in the `maxZoom` option of the map or of any layers).
-  	getMaxZoom: function () {
-  		return this.options.maxZoom === undefined ?
-  			(this._layersMaxZoom === undefined ? Infinity : this._layersMaxZoom) :
-  			this.options.maxZoom;
-  	},
-
-  	// @method getBoundsZoom(bounds: LatLngBounds, inside?: Boolean, padding?: Point): Number
-  	// Returns the maximum zoom level on which the given bounds fit to the map
-  	// view in its entirety. If `inside` (optional) is set to `true`, the method
-  	// instead returns the minimum zoom level on which the map view fits into
-  	// the given bounds in its entirety.
-  	getBoundsZoom: function (bounds, inside, padding) { // (LatLngBounds[, Boolean, Point]) -> Number
-  		bounds = toLatLngBounds(bounds);
-  		padding = toPoint(padding || [0, 0]);
-
-  		var zoom = this.getZoom() || 0,
-  		    min = this.getMinZoom(),
-  		    max = this.getMaxZoom(),
-  		    nw = bounds.getNorthWest(),
-  		    se = bounds.getSouthEast(),
-  		    size = this.getSize().subtract(padding),
-  		    boundsSize = toBounds(this.project(se, zoom), this.project(nw, zoom)).getSize(),
-  		    snap = any3d ? this.options.zoomSnap : 1,
-  		    scalex = size.x / boundsSize.x,
-  		    scaley = size.y / boundsSize.y,
-  		    scale = inside ? Math.max(scalex, scaley) : Math.min(scalex, scaley);
-
-  		zoom = this.getScaleZoom(scale, zoom);
-
-  		if (snap) {
-  			zoom = Math.round(zoom / (snap / 100)) * (snap / 100); // don't jump if within 1% of a snap level
-  			zoom = inside ? Math.ceil(zoom / snap) * snap : Math.floor(zoom / snap) * snap;
-  		}
-
-  		return Math.max(min, Math.min(max, zoom));
-  	},
-
-  	// @method getSize(): Point
-  	// Returns the current size of the map container (in pixels).
-  	getSize: function () {
-  		if (!this._size || this._sizeChanged) {
-  			this._size = new Point(
-  				this._container.clientWidth || 0,
-  				this._container.clientHeight || 0);
-
-  			this._sizeChanged = false;
-  		}
-  		return this._size.clone();
-  	},
-
-  	// @method getPixelBounds(): Bounds
-  	// Returns the bounds of the current map view in projected pixel
-  	// coordinates (sometimes useful in layer and overlay implementations).
-  	getPixelBounds: function (center, zoom) {
-  		var topLeftPoint = this._getTopLeftPoint(center, zoom);
-  		return new Bounds(topLeftPoint, topLeftPoint.add(this.getSize()));
-  	},
-
-  	// TODO: Check semantics - isn't the pixel origin the 0,0 coord relative to
-  	// the map pane? "left point of the map layer" can be confusing, specially
-  	// since there can be negative offsets.
-  	// @method getPixelOrigin(): Point
-  	// Returns the projected pixel coordinates of the top left point of
-  	// the map layer (useful in custom layer and overlay implementations).
-  	getPixelOrigin: function () {
-  		this._checkIfLoaded();
-  		return this._pixelOrigin;
-  	},
-
-  	// @method getPixelWorldBounds(zoom?: Number): Bounds
-  	// Returns the world's bounds in pixel coordinates for zoom level `zoom`.
-  	// If `zoom` is omitted, the map's current zoom level is used.
-  	getPixelWorldBounds: function (zoom) {
-  		return this.options.crs.getProjectedBounds(zoom === undefined ? this.getZoom() : zoom);
-  	},
-
-  	// @section Other Methods
-
-  	// @method getPane(pane: String|HTMLElement): HTMLElement
-  	// Returns a [map pane](#map-pane), given its name or its HTML element (its identity).
-  	getPane: function (pane) {
-  		return typeof pane === 'string' ? this._panes[pane] : pane;
-  	},
-
-  	// @method getPanes(): Object
-  	// Returns a plain object containing the names of all [panes](#map-pane) as keys and
-  	// the panes as values.
-  	getPanes: function () {
-  		return this._panes;
-  	},
-
-  	// @method getContainer: HTMLElement
-  	// Returns the HTML element that contains the map.
-  	getContainer: function () {
-  		return this._container;
-  	},
-
-
-  	// @section Conversion Methods
-
-  	// @method getZoomScale(toZoom: Number, fromZoom: Number): Number
-  	// Returns the scale factor to be applied to a map transition from zoom level
-  	// `fromZoom` to `toZoom`. Used internally to help with zoom animations.
-  	getZoomScale: function (toZoom, fromZoom) {
-  		// TODO replace with universal implementation after refactoring projections
-  		var crs = this.options.crs;
-  		fromZoom = fromZoom === undefined ? this._zoom : fromZoom;
-  		return crs.scale(toZoom) / crs.scale(fromZoom);
-  	},
-
-  	// @method getScaleZoom(scale: Number, fromZoom: Number): Number
-  	// Returns the zoom level that the map would end up at, if it is at `fromZoom`
-  	// level and everything is scaled by a factor of `scale`. Inverse of
-  	// [`getZoomScale`](#map-getZoomScale).
-  	getScaleZoom: function (scale, fromZoom) {
-  		var crs = this.options.crs;
-  		fromZoom = fromZoom === undefined ? this._zoom : fromZoom;
-  		var zoom = crs.zoom(scale * crs.scale(fromZoom));
-  		return isNaN(zoom) ? Infinity : zoom;
-  	},
-
-  	// @method project(latlng: LatLng, zoom: Number): Point
-  	// Projects a geographical coordinate `LatLng` according to the projection
-  	// of the map's CRS, then scales it according to `zoom` and the CRS's
-  	// `Transformation`. The result is pixel coordinate relative to
-  	// the CRS origin.
-  	project: function (latlng, zoom) {
-  		zoom = zoom === undefined ? this._zoom : zoom;
-  		return this.options.crs.latLngToPoint(toLatLng(latlng), zoom);
-  	},
-
-  	// @method unproject(point: Point, zoom: Number): LatLng
-  	// Inverse of [`project`](#map-project).
-  	unproject: function (point, zoom) {
-  		zoom = zoom === undefined ? this._zoom : zoom;
-  		return this.options.crs.pointToLatLng(toPoint(point), zoom);
-  	},
-
-  	// @method layerPointToLatLng(point: Point): LatLng
-  	// Given a pixel coordinate relative to the [origin pixel](#map-getpixelorigin),
-  	// returns the corresponding geographical coordinate (for the current zoom level).
-  	layerPointToLatLng: function (point) {
-  		var projectedPoint = toPoint(point).add(this.getPixelOrigin());
-  		return this.unproject(projectedPoint);
-  	},
-
-  	// @method latLngToLayerPoint(latlng: LatLng): Point
-  	// Given a geographical coordinate, returns the corresponding pixel coordinate
-  	// relative to the [origin pixel](#map-getpixelorigin).
-  	latLngToLayerPoint: function (latlng) {
-  		var projectedPoint = this.project(toLatLng(latlng))._round();
-  		return projectedPoint._subtract(this.getPixelOrigin());
-  	},
-
-  	// @method wrapLatLng(latlng: LatLng): LatLng
-  	// Returns a `LatLng` where `lat` and `lng` has been wrapped according to the
-  	// map's CRS's `wrapLat` and `wrapLng` properties, if they are outside the
-  	// CRS's bounds.
-  	// By default this means longitude is wrapped around the dateline so its
-  	// value is between -180 and +180 degrees.
-  	wrapLatLng: function (latlng) {
-  		return this.options.crs.wrapLatLng(toLatLng(latlng));
-  	},
-
-  	// @method wrapLatLngBounds(bounds: LatLngBounds): LatLngBounds
-  	// Returns a `LatLngBounds` with the same size as the given one, ensuring that
-  	// its center is within the CRS's bounds.
-  	// By default this means the center longitude is wrapped around the dateline so its
-  	// value is between -180 and +180 degrees, and the majority of the bounds
-  	// overlaps the CRS's bounds.
-  	wrapLatLngBounds: function (latlng) {
-  		return this.options.crs.wrapLatLngBounds(toLatLngBounds(latlng));
-  	},
-
-  	// @method distance(latlng1: LatLng, latlng2: LatLng): Number
-  	// Returns the distance between two geographical coordinates according to
-  	// the map's CRS. By default this measures distance in meters.
-  	distance: function (latlng1, latlng2) {
-  		return this.options.crs.distance(toLatLng(latlng1), toLatLng(latlng2));
-  	},
-
-  	// @method containerPointToLayerPoint(point: Point): Point
-  	// Given a pixel coordinate relative to the map container, returns the corresponding
-  	// pixel coordinate relative to the [origin pixel](#map-getpixelorigin).
-  	containerPointToLayerPoint: function (point) { // (Point)
-  		return toPoint(point).subtract(this._getMapPanePos());
-  	},
-
-  	// @method layerPointToContainerPoint(point: Point): Point
-  	// Given a pixel coordinate relative to the [origin pixel](#map-getpixelorigin),
-  	// returns the corresponding pixel coordinate relative to the map container.
-  	layerPointToContainerPoint: function (point) { // (Point)
-  		return toPoint(point).add(this._getMapPanePos());
-  	},
-
-  	// @method containerPointToLatLng(point: Point): LatLng
-  	// Given a pixel coordinate relative to the map container, returns
-  	// the corresponding geographical coordinate (for the current zoom level).
-  	containerPointToLatLng: function (point) {
-  		var layerPoint = this.containerPointToLayerPoint(toPoint(point));
-  		return this.layerPointToLatLng(layerPoint);
-  	},
-
-  	// @method latLngToContainerPoint(latlng: LatLng): Point
-  	// Given a geographical coordinate, returns the corresponding pixel coordinate
-  	// relative to the map container.
-  	latLngToContainerPoint: function (latlng) {
-  		return this.layerPointToContainerPoint(this.latLngToLayerPoint(toLatLng(latlng)));
-  	},
-
-  	// @method mouseEventToContainerPoint(ev: MouseEvent): Point
-  	// Given a MouseEvent object, returns the pixel coordinate relative to the
-  	// map container where the event took place.
-  	mouseEventToContainerPoint: function (e) {
-  		return getMousePosition(e, this._container);
-  	},
-
-  	// @method mouseEventToLayerPoint(ev: MouseEvent): Point
-  	// Given a MouseEvent object, returns the pixel coordinate relative to
-  	// the [origin pixel](#map-getpixelorigin) where the event took place.
-  	mouseEventToLayerPoint: function (e) {
-  		return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(e));
-  	},
-
-  	// @method mouseEventToLatLng(ev: MouseEvent): LatLng
-  	// Given a MouseEvent object, returns geographical coordinate where the
-  	// event took place.
-  	mouseEventToLatLng: function (e) { // (MouseEvent)
-  		return this.layerPointToLatLng(this.mouseEventToLayerPoint(e));
-  	},
-
-
-  	// map initialization methods
-
-  	_initContainer: function (id) {
-  		var container = this._container = get(id);
-
-  		if (!container) {
-  			throw new Error('Map container not found.');
-  		} else if (container._leaflet_id) {
-  			throw new Error('Map container is already initialized.');
-  		}
-
-  		on(container, 'scroll', this._onScroll, this);
-  		this._containerId = stamp(container);
-  	},
-
-  	_initLayout: function () {
-  		var container = this._container;
-
-  		this._fadeAnimated = this.options.fadeAnimation && any3d;
-
-  		addClass(container, 'leaflet-container' +
-  			(touch ? ' leaflet-touch' : '') +
-  			(retina ? ' leaflet-retina' : '') +
-  			(ielt9 ? ' leaflet-oldie' : '') +
-  			(safari ? ' leaflet-safari' : '') +
-  			(this._fadeAnimated ? ' leaflet-fade-anim' : ''));
-
-  		var position = getStyle(container, 'position');
-
-  		if (position !== 'absolute' && position !== 'relative' && position !== 'fixed') {
-  			container.style.position = 'relative';
-  		}
-
-  		this._initPanes();
-
-  		if (this._initControlPos) {
-  			this._initControlPos();
-  		}
-  	},
-
-  	_initPanes: function () {
-  		var panes = this._panes = {};
-  		this._paneRenderers = {};
-
-  		// @section
-  		//
-  		// Panes are DOM elements used to control the ordering of layers on the map. You
-  		// can access panes with [`map.getPane`](#map-getpane) or
-  		// [`map.getPanes`](#map-getpanes) methods. New panes can be created with the
-  		// [`map.createPane`](#map-createpane) method.
-  		//
-  		// Every map has the following default panes that differ only in zIndex.
-  		//
-  		// @pane mapPane: HTMLElement = 'auto'
-  		// Pane that contains all other map panes
-
-  		this._mapPane = this.createPane('mapPane', this._container);
-  		setPosition(this._mapPane, new Point(0, 0));
-
-  		// @pane tilePane: HTMLElement = 200
-  		// Pane for `GridLayer`s and `TileLayer`s
-  		this.createPane('tilePane');
-  		// @pane overlayPane: HTMLElement = 400
-  		// Pane for overlay shadows (e.g. `Marker` shadows)
-  		this.createPane('shadowPane');
-  		// @pane shadowPane: HTMLElement = 500
-  		// Pane for vectors (`Path`s, like `Polyline`s and `Polygon`s), `ImageOverlay`s and `VideoOverlay`s
-  		this.createPane('overlayPane');
-  		// @pane markerPane: HTMLElement = 600
-  		// Pane for `Icon`s of `Marker`s
-  		this.createPane('markerPane');
-  		// @pane tooltipPane: HTMLElement = 650
-  		// Pane for `Tooltip`s.
-  		this.createPane('tooltipPane');
-  		// @pane popupPane: HTMLElement = 700
-  		// Pane for `Popup`s.
-  		this.createPane('popupPane');
-
-  		if (!this.options.markerZoomAnimation) {
-  			addClass(panes.markerPane, 'leaflet-zoom-hide');
-  			addClass(panes.shadowPane, 'leaflet-zoom-hide');
-  		}
-  	},
-
-
-  	// private methods that modify map state
-
-  	// @section Map state change events
-  	_resetView: function (center, zoom) {
-  		setPosition(this._mapPane, new Point(0, 0));
-
-  		var loading = !this._loaded;
-  		this._loaded = true;
-  		zoom = this._limitZoom(zoom);
-
-  		this.fire('viewprereset');
-
-  		var zoomChanged = this._zoom !== zoom;
-  		this
-  			._moveStart(zoomChanged, false)
-  			._move(center, zoom)
-  			._moveEnd(zoomChanged);
-
-  		// @event viewreset: Event
-  		// Fired when the map needs to redraw its content (this usually happens
-  		// on map zoom or load). Very useful for creating custom overlays.
-  		this.fire('viewreset');
-
-  		// @event load: Event
-  		// Fired when the map is initialized (when its center and zoom are set
-  		// for the first time).
-  		if (loading) {
-  			this.fire('load');
-  		}
-  	},
-
-  	_moveStart: function (zoomChanged, noMoveStart) {
-  		// @event zoomstart: Event
-  		// Fired when the map zoom is about to change (e.g. before zoom animation).
-  		// @event movestart: Event
-  		// Fired when the view of the map starts changing (e.g. user starts dragging the map).
-  		if (zoomChanged) {
-  			this.fire('zoomstart');
-  		}
-  		if (!noMoveStart) {
-  			this.fire('movestart');
-  		}
-  		return this;
-  	},
-
-  	_move: function (center, zoom, data) {
-  		if (zoom === undefined) {
-  			zoom = this._zoom;
-  		}
-  		var zoomChanged = this._zoom !== zoom;
-
-  		this._zoom = zoom;
-  		this._lastCenter = center;
-  		this._pixelOrigin = this._getNewPixelOrigin(center);
-
-  		// @event zoom: Event
-  		// Fired repeatedly during any change in zoom level, including zoom
-  		// and fly animations.
-  		if (zoomChanged || (data && data.pinch)) {	// Always fire 'zoom' if pinching because #3530
-  			this.fire('zoom', data);
-  		}
-
-  		// @event move: Event
-  		// Fired repeatedly during any movement of the map, including pan and
-  		// fly animations.
-  		return this.fire('move', data);
-  	},
-
-  	_moveEnd: function (zoomChanged) {
-  		// @event zoomend: Event
-  		// Fired when the map has changed, after any animations.
-  		if (zoomChanged) {
-  			this.fire('zoomend');
-  		}
-
-  		// @event moveend: Event
-  		// Fired when the center of the map stops changing (e.g. user stopped
-  		// dragging the map).
-  		return this.fire('moveend');
-  	},
-
-  	_stop: function () {
-  		cancelAnimFrame(this._flyToFrame);
-  		if (this._panAnim) {
-  			this._panAnim.stop();
-  		}
-  		return this;
-  	},
-
-  	_rawPanBy: function (offset) {
-  		setPosition(this._mapPane, this._getMapPanePos().subtract(offset));
-  	},
-
-  	_getZoomSpan: function () {
-  		return this.getMaxZoom() - this.getMinZoom();
-  	},
-
-  	_panInsideMaxBounds: function () {
-  		if (!this._enforcingBounds) {
-  			this.panInsideBounds(this.options.maxBounds);
-  		}
-  	},
-
-  	_checkIfLoaded: function () {
-  		if (!this._loaded) {
-  			throw new Error('Set map center and zoom first.');
-  		}
-  	},
-
-  	// DOM event handling
-
-  	// @section Interaction events
-  	_initEvents: function (remove$$1) {
-  		this._targets = {};
-  		this._targets[stamp(this._container)] = this;
-
-  		var onOff = remove$$1 ? off : on;
-
-  		// @event click: MouseEvent
-  		// Fired when the user clicks (or taps) the map.
-  		// @event dblclick: MouseEvent
-  		// Fired when the user double-clicks (or double-taps) the map.
-  		// @event mousedown: MouseEvent
-  		// Fired when the user pushes the mouse button on the map.
-  		// @event mouseup: MouseEvent
-  		// Fired when the user releases the mouse button on the map.
-  		// @event mouseover: MouseEvent
-  		// Fired when the mouse enters the map.
-  		// @event mouseout: MouseEvent
-  		// Fired when the mouse leaves the map.
-  		// @event mousemove: MouseEvent
-  		// Fired while the mouse moves over the map.
-  		// @event contextmenu: MouseEvent
-  		// Fired when the user pushes the right mouse button on the map, prevents
-  		// default browser context menu from showing if there are listeners on
-  		// this event. Also fired on mobile when the user holds a single touch
-  		// for a second (also called long press).
-  		// @event keypress: KeyboardEvent
-  		// Fired when the user presses a key from the keyboard that produces a character value while the map is focused.
-  		// @event keydown: KeyboardEvent
-  		// Fired when the user presses a key from the keyboard while the map is focused. Unlike the `keypress` event,
-  		// the `keydown` event is fired for keys that produce a character value and for keys
-  		// that do not produce a character value.
-  		// @event keyup: KeyboardEvent
-  		// Fired when the user releases a key from the keyboard while the map is focused.
-  		onOff(this._container, 'click dblclick mousedown mouseup ' +
-  			'mouseover mouseout mousemove contextmenu keypress keydown keyup', this._handleDOMEvent, this);
-
-  		if (this.options.trackResize) {
-  			onOff(window, 'resize', this._onResize, this);
-  		}
-
-  		if (any3d && this.options.transform3DLimit) {
-  			(remove$$1 ? this.off : this.on).call(this, 'moveend', this._onMoveEnd);
-  		}
-  	},
-
-  	_onResize: function () {
-  		cancelAnimFrame(this._resizeRequest);
-  		this._resizeRequest = requestAnimFrame(
-  		        function () { this.invalidateSize({debounceMoveend: true}); }, this);
-  	},
-
-  	_onScroll: function () {
-  		this._container.scrollTop  = 0;
-  		this._container.scrollLeft = 0;
-  	},
-
-  	_onMoveEnd: function () {
-  		var pos = this._getMapPanePos();
-  		if (Math.max(Math.abs(pos.x), Math.abs(pos.y)) >= this.options.transform3DLimit) {
-  			// https://bugzilla.mozilla.org/show_bug.cgi?id=1203873 but Webkit also have
-  			// a pixel offset on very high values, see: http://jsfiddle.net/dg6r5hhb/
-  			this._resetView(this.getCenter(), this.getZoom());
-  		}
-  	},
-
-  	_findEventTargets: function (e, type) {
-  		var targets = [],
-  		    target,
-  		    isHover = type === 'mouseout' || type === 'mouseover',
-  		    src = e.target || e.srcElement,
-  		    dragging = false;
-
-  		while (src) {
-  			target = this._targets[stamp(src)];
-  			if (target && (type === 'click' || type === 'preclick') && !e._simulated && this._draggableMoved(target)) {
-  				// Prevent firing click after you just dragged an object.
-  				dragging = true;
-  				break;
-  			}
-  			if (target && target.listens(type, true)) {
-  				if (isHover && !isExternalTarget(src, e)) { break; }
-  				targets.push(target);
-  				if (isHover) { break; }
-  			}
-  			if (src === this._container) { break; }
-  			src = src.parentNode;
-  		}
-  		if (!targets.length && !dragging && !isHover && isExternalTarget(src, e)) {
-  			targets = [this];
-  		}
-  		return targets;
-  	},
-
-  	_handleDOMEvent: function (e) {
-  		if (!this._loaded || skipped(e)) { return; }
-
-  		var type = e.type;
-
-  		if (type === 'mousedown' || type === 'keypress' || type === 'keyup' || type === 'keydown') {
-  			// prevents outline when clicking on keyboard-focusable element
-  			preventOutline(e.target || e.srcElement);
-  		}
-
-  		this._fireDOMEvent(e, type);
-  	},
-
-  	_mouseEvents: ['click', 'dblclick', 'mouseover', 'mouseout', 'contextmenu'],
-
-  	_fireDOMEvent: function (e, type, targets) {
-
-  		if (e.type === 'click') {
-  			// Fire a synthetic 'preclick' event which propagates up (mainly for closing popups).
-  			// @event preclick: MouseEvent
-  			// Fired before mouse click on the map (sometimes useful when you
-  			// want something to happen on click before any existing click
-  			// handlers start running).
-  			var synth = extend({}, e);
-  			synth.type = 'preclick';
-  			this._fireDOMEvent(synth, synth.type, targets);
-  		}
-
-  		if (e._stopped) { return; }
-
-  		// Find the layer the event is propagating from and its parents.
-  		targets = (targets || []).concat(this._findEventTargets(e, type));
-
-  		if (!targets.length) { return; }
-
-  		var target = targets[0];
-  		if (type === 'contextmenu' && target.listens(type, true)) {
-  			preventDefault(e);
-  		}
-
-  		var data = {
-  			originalEvent: e
-  		};
-
-  		if (e.type !== 'keypress' && e.type !== 'keydown' && e.type !== 'keyup') {
-  			var isMarker = target.getLatLng && (!target._radius || target._radius <= 10);
-  			data.containerPoint = isMarker ?
-  				this.latLngToContainerPoint(target.getLatLng()) : this.mouseEventToContainerPoint(e);
-  			data.layerPoint = this.containerPointToLayerPoint(data.containerPoint);
-  			data.latlng = isMarker ? target.getLatLng() : this.layerPointToLatLng(data.layerPoint);
-  		}
-
-  		for (var i = 0; i < targets.length; i++) {
-  			targets[i].fire(type, data, true);
-  			if (data.originalEvent._stopped ||
-  				(targets[i].options.bubblingMouseEvents === false && indexOf(this._mouseEvents, type) !== -1)) { return; }
-  		}
-  	},
-
-  	_draggableMoved: function (obj) {
-  		obj = obj.dragging && obj.dragging.enabled() ? obj : this;
-  		return (obj.dragging && obj.dragging.moved()) || (this.boxZoom && this.boxZoom.moved());
-  	},
-
-  	_clearHandlers: function () {
-  		for (var i = 0, len = this._handlers.length; i < len; i++) {
-  			this._handlers[i].disable();
-  		}
-  	},
-
-  	// @section Other Methods
-
-  	// @method whenReady(fn: Function, context?: Object): this
-  	// Runs the given function `fn` when the map gets initialized with
-  	// a view (center and zoom) and at least one layer, or immediately
-  	// if it's already initialized, optionally passing a function context.
-  	whenReady: function (callback, context) {
-  		if (this._loaded) {
-  			callback.call(context || this, {target: this});
-  		} else {
-  			this.on('load', callback, context);
-  		}
-  		return this;
-  	},
-
-
-  	// private methods for getting map state
-
-  	_getMapPanePos: function () {
-  		return getPosition(this._mapPane) || new Point(0, 0);
-  	},
-
-  	_moved: function () {
-  		var pos = this._getMapPanePos();
-  		return pos && !pos.equals([0, 0]);
-  	},
-
-  	_getTopLeftPoint: function (center, zoom) {
-  		var pixelOrigin = center && zoom !== undefined ?
-  			this._getNewPixelOrigin(center, zoom) :
-  			this.getPixelOrigin();
-  		return pixelOrigin.subtract(this._getMapPanePos());
-  	},
-
-  	_getNewPixelOrigin: function (center, zoom) {
-  		var viewHalf = this.getSize()._divideBy(2);
-  		return this.project(center, zoom)._subtract(viewHalf)._add(this._getMapPanePos())._round();
-  	},
-
-  	_latLngToNewLayerPoint: function (latlng, zoom, center) {
-  		var topLeft = this._getNewPixelOrigin(center, zoom);
-  		return this.project(latlng, zoom)._subtract(topLeft);
-  	},
-
-  	_latLngBoundsToNewLayerBounds: function (latLngBounds, zoom, center) {
-  		var topLeft = this._getNewPixelOrigin(center, zoom);
-  		return toBounds([
-  			this.project(latLngBounds.getSouthWest(), zoom)._subtract(topLeft),
-  			this.project(latLngBounds.getNorthWest(), zoom)._subtract(topLeft),
-  			this.project(latLngBounds.getSouthEast(), zoom)._subtract(topLeft),
-  			this.project(latLngBounds.getNorthEast(), zoom)._subtract(topLeft)
-  		]);
-  	},
-
-  	// layer point of the current center
-  	_getCenterLayerPoint: function () {
-  		return this.containerPointToLayerPoint(this.getSize()._divideBy(2));
-  	},
-
-  	// offset of the specified place to the current center in pixels
-  	_getCenterOffset: function (latlng) {
-  		return this.latLngToLayerPoint(latlng).subtract(this._getCenterLayerPoint());
-  	},
-
-  	// adjust center for view to get inside bounds
-  	_limitCenter: function (center, zoom, bounds) {
-
-  		if (!bounds) { return center; }
-
-  		var centerPoint = this.project(center, zoom),
-  		    viewHalf = this.getSize().divideBy(2),
-  		    viewBounds = new Bounds(centerPoint.subtract(viewHalf), centerPoint.add(viewHalf)),
-  		    offset = this._getBoundsOffset(viewBounds, bounds, zoom);
-
-  		// If offset is less than a pixel, ignore.
-  		// This prevents unstable projections from getting into
-  		// an infinite loop of tiny offsets.
-  		if (offset.round().equals([0, 0])) {
-  			return center;
-  		}
-
-  		return this.unproject(centerPoint.add(offset), zoom);
-  	},
-
-  	// adjust offset for view to get inside bounds
-  	_limitOffset: function (offset, bounds) {
-  		if (!bounds) { return offset; }
-
-  		var viewBounds = this.getPixelBounds(),
-  		    newBounds = new Bounds(viewBounds.min.add(offset), viewBounds.max.add(offset));
-
-  		return offset.add(this._getBoundsOffset(newBounds, bounds));
-  	},
-
-  	// returns offset needed for pxBounds to get inside maxBounds at a specified zoom
-  	_getBoundsOffset: function (pxBounds, maxBounds, zoom) {
-  		var projectedMaxBounds = toBounds(
-  		        this.project(maxBounds.getNorthEast(), zoom),
-  		        this.project(maxBounds.getSouthWest(), zoom)
-  		    ),
-  		    minOffset = projectedMaxBounds.min.subtract(pxBounds.min),
-  		    maxOffset = projectedMaxBounds.max.subtract(pxBounds.max),
-
-  		    dx = this._rebound(minOffset.x, -maxOffset.x),
-  		    dy = this._rebound(minOffset.y, -maxOffset.y);
-
-  		return new Point(dx, dy);
-  	},
-
-  	_rebound: function (left, right) {
-  		return left + right > 0 ?
-  			Math.round(left - right) / 2 :
-  			Math.max(0, Math.ceil(left)) - Math.max(0, Math.floor(right));
-  	},
-
-  	_limitZoom: function (zoom) {
-  		var min = this.getMinZoom(),
-  		    max = this.getMaxZoom(),
-  		    snap = any3d ? this.options.zoomSnap : 1;
-  		if (snap) {
-  			zoom = Math.round(zoom / snap) * snap;
-  		}
-  		return Math.max(min, Math.min(max, zoom));
-  	},
-
-  	_onPanTransitionStep: function () {
-  		this.fire('move');
-  	},
-
-  	_onPanTransitionEnd: function () {
-  		removeClass(this._mapPane, 'leaflet-pan-anim');
-  		this.fire('moveend');
-  	},
-
-  	_tryAnimatedPan: function (center, options) {
-  		// difference between the new and current centers in pixels
-  		var offset = this._getCenterOffset(center)._trunc();
-
-  		// don't animate too far unless animate: true specified in options
-  		if ((options && options.animate) !== true && !this.getSize().contains(offset)) { return false; }
-
-  		this.panBy(offset, options);
-
-  		return true;
-  	},
-
-  	_createAnimProxy: function () {
-
-  		var proxy = this._proxy = create$1('div', 'leaflet-proxy leaflet-zoom-animated');
-  		this._panes.mapPane.appendChild(proxy);
-
-  		this.on('zoomanim', function (e) {
-  			var prop = TRANSFORM,
-  			    transform = this._proxy.style[prop];
-
-  			setTransform(this._proxy, this.project(e.center, e.zoom), this.getZoomScale(e.zoom, 1));
-
-  			// workaround for case when transform is the same and so transitionend event is not fired
-  			if (transform === this._proxy.style[prop] && this._animatingZoom) {
-  				this._onZoomTransitionEnd();
-  			}
-  		}, this);
-
-  		this.on('load moveend', this._animMoveEnd, this);
-
-  		this._on('unload', this._destroyAnimProxy, this);
-  	},
-
-  	_destroyAnimProxy: function () {
-  		remove(this._proxy);
-  		this.off('load moveend', this._animMoveEnd, this);
-  		delete this._proxy;
-  	},
-
-  	_animMoveEnd: function () {
-  		var c = this.getCenter(),
-  		    z = this.getZoom();
-  		setTransform(this._proxy, this.project(c, z), this.getZoomScale(z, 1));
-  	},
-
-  	_catchTransitionEnd: function (e) {
-  		if (this._animatingZoom && e.propertyName.indexOf('transform') >= 0) {
-  			this._onZoomTransitionEnd();
-  		}
-  	},
-
-  	_nothingToAnimate: function () {
-  		return !this._container.getElementsByClassName('leaflet-zoom-animated').length;
-  	},
-
-  	_tryAnimatedZoom: function (center, zoom, options) {
-
-  		if (this._animatingZoom) { return true; }
-
-  		options = options || {};
-
-  		// don't animate if disabled, not supported or zoom difference is too large
-  		if (!this._zoomAnimated || options.animate === false || this._nothingToAnimate() ||
-  		        Math.abs(zoom - this._zoom) > this.options.zoomAnimationThreshold) { return false; }
-
-  		// offset is the pixel coords of the zoom origin relative to the current center
-  		var scale = this.getZoomScale(zoom),
-  		    offset = this._getCenterOffset(center)._divideBy(1 - 1 / scale);
-
-  		// don't animate if the zoom origin isn't within one screen from the current center, unless forced
-  		if (options.animate !== true && !this.getSize().contains(offset)) { return false; }
-
-  		requestAnimFrame(function () {
-  			this
-  			    ._moveStart(true, false)
-  			    ._animateZoom(center, zoom, true);
-  		}, this);
-
-  		return true;
-  	},
-
-  	_animateZoom: function (center, zoom, startAnim, noUpdate) {
-  		if (!this._mapPane) { return; }
-
-  		if (startAnim) {
-  			this._animatingZoom = true;
-
-  			// remember what center/zoom to set after animation
-  			this._animateToCenter = center;
-  			this._animateToZoom = zoom;
-
-  			addClass(this._mapPane, 'leaflet-zoom-anim');
-  		}
-
-  		// @section Other Events
-  		// @event zoomanim: ZoomAnimEvent
-  		// Fired at least once per zoom animation. For continuous zoom, like pinch zooming, fired once per frame during zoom.
-  		this.fire('zoomanim', {
-  			center: center,
-  			zoom: zoom,
-  			noUpdate: noUpdate
-  		});
-
-  		// Work around webkit not firing 'transitionend', see https://github.com/Leaflet/Leaflet/issues/3689, 2693
-  		setTimeout(bind(this._onZoomTransitionEnd, this), 250);
-  	},
-
-  	_onZoomTransitionEnd: function () {
-  		if (!this._animatingZoom) { return; }
-
-  		if (this._mapPane) {
-  			removeClass(this._mapPane, 'leaflet-zoom-anim');
-  		}
-
-  		this._animatingZoom = false;
-
-  		this._move(this._animateToCenter, this._animateToZoom);
-
-  		// This anim frame should prevent an obscure iOS webkit tile loading race condition.
-  		requestAnimFrame(function () {
-  			this._moveEnd(true);
-  		}, this);
-  	}
-  });
-
-  // @section
-
-  // @factory L.map(id: String, options?: Map options)
-  // Instantiates a map object given the DOM ID of a `<div>` element
-  // and optionally an object literal with `Map options`.
-  //
-  // @alternative
-  // @factory L.map(el: HTMLElement, options?: Map options)
-  // Instantiates a map object given an instance of a `<div>` HTML element
-  // and optionally an object literal with `Map options`.
-  function createMap(id, options) {
-  	return new Map(id, options);
-  }
-
-  /*
-   * @class Control
-   * @aka L.Control
-   * @inherits Class
-   *
-   * L.Control is a base class for implementing map controls. Handles positioning.
-   * All other controls extend from this class.
-   */
-
-  var Control = Class.extend({
-  	// @section
-  	// @aka Control options
-  	options: {
-  		// @option position: String = 'topright'
-  		// The position of the control (one of the map corners). Possible values are `'topleft'`,
-  		// `'topright'`, `'bottomleft'` or `'bottomright'`
-  		position: 'topright'
-  	},
-
-  	initialize: function (options) {
-  		setOptions(this, options);
-  	},
-
-  	/* @section
-  	 * Classes extending L.Control will inherit the following methods:
-  	 *
-  	 * @method getPosition: string
-  	 * Returns the position of the control.
-  	 */
-  	getPosition: function () {
-  		return this.options.position;
-  	},
-
-  	// @method setPosition(position: string): this
-  	// Sets the position of the control.
-  	setPosition: function (position) {
-  		var map = this._map;
-
-  		if (map) {
-  			map.removeControl(this);
-  		}
-
-  		this.options.position = position;
-
-  		if (map) {
-  			map.addControl(this);
-  		}
-
-  		return this;
-  	},
-
-  	// @method getContainer: HTMLElement
-  	// Returns the HTMLElement that contains the control.
-  	getContainer: function () {
-  		return this._container;
-  	},
-
-  	// @method addTo(map: Map): this
-  	// Adds the control to the given map.
-  	addTo: function (map) {
-  		this.remove();
-  		this._map = map;
-
-  		var container = this._container = this.onAdd(map),
-  		    pos = this.getPosition(),
-  		    corner = map._controlCorners[pos];
-
-  		addClass(container, 'leaflet-control');
-
-  		if (pos.indexOf('bottom') !== -1) {
-  			corner.insertBefore(container, corner.firstChild);
-  		} else {
-  			corner.appendChild(container);
-  		}
-
-  		this._map.on('unload', this.remove, this);
-
-  		return this;
-  	},
-
-  	// @method remove: this
-  	// Removes the control from the map it is currently active on.
-  	remove: function () {
-  		if (!this._map) {
-  			return this;
-  		}
-
-  		remove(this._container);
-
-  		if (this.onRemove) {
-  			this.onRemove(this._map);
-  		}
-
-  		this._map.off('unload', this.remove, this);
-  		this._map = null;
-
-  		return this;
-  	},
-
-  	_refocusOnMap: function (e) {
-  		// if map exists and event is not a keyboard event
-  		if (this._map && e && e.screenX > 0 && e.screenY > 0) {
-  			this._map.getContainer().focus();
-  		}
-  	}
-  });
-
-  var control = function (options) {
-  	return new Control(options);
-  };
-
-  /* @section Extension methods
-   * @uninheritable
-   *
-   * Every control should extend from `L.Control` and (re-)implement the following methods.
-   *
-   * @method onAdd(map: Map): HTMLElement
-   * Should return the container DOM element for the control and add listeners on relevant map events. Called on [`control.addTo(map)`](#control-addTo).
-   *
-   * @method onRemove(map: Map)
-   * Optional method. Should contain all clean up code that removes the listeners previously added in [`onAdd`](#control-onadd). Called on [`control.remove()`](#control-remove).
-   */
-
-  /* @namespace Map
-   * @section Methods for Layers and Controls
-   */
-  Map.include({
-  	// @method addControl(control: Control): this
-  	// Adds the given control to the map
-  	addControl: function (control) {
-  		control.addTo(this);
-  		return this;
-  	},
-
-  	// @method removeControl(control: Control): this
-  	// Removes the given control from the map
-  	removeControl: function (control) {
-  		control.remove();
-  		return this;
-  	},
-
-  	_initControlPos: function () {
-  		var corners = this._controlCorners = {},
-  		    l = 'leaflet-',
-  		    container = this._controlContainer =
-  		            create$1('div', l + 'control-container', this._container);
-
-  		function createCorner(vSide, hSide) {
-  			var className = l + vSide + ' ' + l + hSide;
-
-  			corners[vSide + hSide] = create$1('div', className, container);
-  		}
-
-  		createCorner('top', 'left');
-  		createCorner('top', 'right');
-  		createCorner('bottom', 'left');
-  		createCorner('bottom', 'right');
-  	},
-
-  	_clearControlPos: function () {
-  		for (var i in this._controlCorners) {
-  			remove(this._controlCorners[i]);
-  		}
-  		remove(this._controlContainer);
-  		delete this._controlCorners;
-  		delete this._controlContainer;
-  	}
-  });
-
-  /*
-   * @class Control.Layers
-   * @aka L.Control.Layers
-   * @inherits Control
-   *
-   * The layers control gives users the ability to switch between different base layers and switch overlays on/off (check out the [detailed example](http://leafletjs.com/examples/layers-control/)). Extends `Control`.
-   *
-   * @example
-   *
-   * ```js
-   * var baseLayers = {
-   * 	"Mapbox": mapbox,
-   * 	"OpenStreetMap": osm
-   * };
-   *
-   * var overlays = {
-   * 	"Marker": marker,
-   * 	"Roads": roadsLayer
-   * };
-   *
-   * L.control.layers(baseLayers, overlays).addTo(map);
-   * ```
-   *
-   * The `baseLayers` and `overlays` parameters are object literals with layer names as keys and `Layer` objects as values:
-   *
-   * ```js
-   * {
-   *     "<someName1>": layer1,
-   *     "<someName2>": layer2
-   * }
-   * ```
-   *
-   * The layer names can contain HTML, which allows you to add additional styling to the items:
-   *
-   * ```js
-   * {"<img src='my-layer-icon' /> <span class='my-layer-item'>My Layer</span>": myLayer}
-   * ```
-   */
-
-  var Layers = Control.extend({
-  	// @section
-  	// @aka Control.Layers options
-  	options: {
-  		// @option collapsed: Boolean = true
-  		// If `true`, the control will be collapsed into an icon and expanded on mouse hover or touch.
-  		collapsed: true,
-  		position: 'topright',
-
-  		// @option autoZIndex: Boolean = true
-  		// If `true`, the control will assign zIndexes in increasing order to all of its layers so that the order is preserved when switching them on/off.
-  		autoZIndex: true,
-
-  		// @option hideSingleBase: Boolean = false
-  		// If `true`, the base layers in the control will be hidden when there is only one.
-  		hideSingleBase: false,
-
-  		// @option sortLayers: Boolean = false
-  		// Whether to sort the layers. When `false`, layers will keep the order
-  		// in which they were added to the control.
-  		sortLayers: false,
-
-  		// @option sortFunction: Function = *
-  		// A [compare function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/sort)
-  		// that will be used for sorting the layers, when `sortLayers` is `true`.
-  		// The function receives both the `L.Layer` instances and their names, as in
-  		// `sortFunction(layerA, layerB, nameA, nameB)`.
-  		// By default, it sorts layers alphabetically by their name.
-  		sortFunction: function (layerA, layerB, nameA, nameB) {
-  			return nameA < nameB ? -1 : (nameB < nameA ? 1 : 0);
-  		}
-  	},
-
-  	initialize: function (baseLayers, overlays, options) {
-  		setOptions(this, options);
-
-  		this._layerControlInputs = [];
-  		this._layers = [];
-  		this._lastZIndex = 0;
-  		this._handlingClick = false;
-
-  		for (var i in baseLayers) {
-  			this._addLayer(baseLayers[i], i);
-  		}
-
-  		for (i in overlays) {
-  			this._addLayer(overlays[i], i, true);
-  		}
-  	},
-
-  	onAdd: function (map) {
-  		this._initLayout();
-  		this._update();
-
-  		this._map = map;
-  		map.on('zoomend', this._checkDisabledLayers, this);
-
-  		for (var i = 0; i < this._layers.length; i++) {
-  			this._layers[i].layer.on('add remove', this._onLayerChange, this);
-  		}
-
-  		return this._container;
-  	},
-
-  	addTo: function (map) {
-  		Control.prototype.addTo.call(this, map);
-  		// Trigger expand after Layers Control has been inserted into DOM so that is now has an actual height.
-  		return this._expandIfNotCollapsed();
-  	},
-
-  	onRemove: function () {
-  		this._map.off('zoomend', this._checkDisabledLayers, this);
-
-  		for (var i = 0; i < this._layers.length; i++) {
-  			this._layers[i].layer.off('add remove', this._onLayerChange, this);
-  		}
-  	},
-
-  	// @method addBaseLayer(layer: Layer, name: String): this
-  	// Adds a base layer (radio button entry) with the given name to the control.
-  	addBaseLayer: function (layer, name) {
-  		this._addLayer(layer, name);
-  		return (this._map) ? this._update() : this;
-  	},
-
-  	// @method addOverlay(layer: Layer, name: String): this
-  	// Adds an overlay (checkbox entry) with the given name to the control.
-  	addOverlay: function (layer, name) {
-  		this._addLayer(layer, name, true);
-  		return (this._map) ? this._update() : this;
-  	},
-
-  	// @method removeLayer(layer: Layer): this
-  	// Remove the given layer from the control.
-  	removeLayer: function (layer) {
-  		layer.off('add remove', this._onLayerChange, this);
-
-  		var obj = this._getLayer(stamp(layer));
-  		if (obj) {
-  			this._layers.splice(this._layers.indexOf(obj), 1);
-  		}
-  		return (this._map) ? this._update() : this;
-  	},
-
-  	// @method expand(): this
-  	// Expand the control container if collapsed.
-  	expand: function () {
-  		addClass(this._container, 'leaflet-control-layers-expanded');
-  		this._section.style.height = null;
-  		var acceptableHeight = this._map.getSize().y - (this._container.offsetTop + 50);
-  		if (acceptableHeight < this._section.clientHeight) {
-  			addClass(this._section, 'leaflet-control-layers-scrollbar');
-  			this._section.style.height = acceptableHeight + 'px';
-  		} else {
-  			removeClass(this._section, 'leaflet-control-layers-scrollbar');
-  		}
-  		this._checkDisabledLayers();
-  		return this;
-  	},
-
-  	// @method collapse(): this
-  	// Collapse the control container if expanded.
-  	collapse: function () {
-  		removeClass(this._container, 'leaflet-control-layers-expanded');
-  		return this;
-  	},
-
-  	_initLayout: function () {
-  		var className = 'leaflet-control-layers',
-  		    container = this._container = create$1('div', className),
-  		    collapsed = this.options.collapsed;
-
-  		// makes this work on IE touch devices by stopping it from firing a mouseout event when the touch is released
-  		container.setAttribute('aria-haspopup', true);
-
-  		disableClickPropagation(container);
-  		disableScrollPropagation(container);
-
-  		var section = this._section = create$1('section', className + '-list');
-
-  		if (collapsed) {
-  			this._map.on('click', this.collapse, this);
-
-  			if (!android) {
-  				on(container, {
-  					mouseenter: this.expand,
-  					mouseleave: this.collapse
-  				}, this);
-  			}
-  		}
-
-  		var link = this._layersLink = create$1('a', className + '-toggle', container);
-  		link.href = '#';
-  		link.title = 'Layers';
-
-  		if (touch) {
-  			on(link, 'click', stop);
-  			on(link, 'click', this.expand, this);
-  		} else {
-  			on(link, 'focus', this.expand, this);
-  		}
-
-  		if (!collapsed) {
-  			this.expand();
-  		}
-
-  		this._baseLayersList = create$1('div', className + '-base', section);
-  		this._separator = create$1('div', className + '-separator', section);
-  		this._overlaysList = create$1('div', className + '-overlays', section);
-
-  		container.appendChild(section);
-  	},
-
-  	_getLayer: function (id) {
-  		for (var i = 0; i < this._layers.length; i++) {
-
-  			if (this._layers[i] && stamp(this._layers[i].layer) === id) {
-  				return this._layers[i];
-  			}
-  		}
-  	},
-
-  	_addLayer: function (layer, name, overlay) {
-  		if (this._map) {
-  			layer.on('add remove', this._onLayerChange, this);
-  		}
-
-  		this._layers.push({
-  			layer: layer,
-  			name: name,
-  			overlay: overlay
-  		});
-
-  		if (this.options.sortLayers) {
-  			this._layers.sort(bind(function (a, b) {
-  				return this.options.sortFunction(a.layer, b.layer, a.name, b.name);
-  			}, this));
-  		}
-
-  		if (this.options.autoZIndex && layer.setZIndex) {
-  			this._lastZIndex++;
-  			layer.setZIndex(this._lastZIndex);
-  		}
-
-  		this._expandIfNotCollapsed();
-  	},
-
-  	_update: function () {
-  		if (!this._container) { return this; }
-
-  		empty(this._baseLayersList);
-  		empty(this._overlaysList);
-
-  		this._layerControlInputs = [];
-  		var baseLayersPresent, overlaysPresent, i, obj, baseLayersCount = 0;
-
-  		for (i = 0; i < this._layers.length; i++) {
-  			obj = this._layers[i];
-  			this._addItem(obj);
-  			overlaysPresent = overlaysPresent || obj.overlay;
-  			baseLayersPresent = baseLayersPresent || !obj.overlay;
-  			baseLayersCount += !obj.overlay ? 1 : 0;
-  		}
-
-  		// Hide base layers section if there's only one layer.
-  		if (this.options.hideSingleBase) {
-  			baseLayersPresent = baseLayersPresent && baseLayersCount > 1;
-  			this._baseLayersList.style.display = baseLayersPresent ? '' : 'none';
-  		}
-
-  		this._separator.style.display = overlaysPresent && baseLayersPresent ? '' : 'none';
-
-  		return this;
-  	},
-
-  	_onLayerChange: function (e) {
-  		if (!this._handlingClick) {
-  			this._update();
-  		}
-
-  		var obj = this._getLayer(stamp(e.target));
-
-  		// @namespace Map
-  		// @section Layer events
-  		// @event baselayerchange: LayersControlEvent
-  		// Fired when the base layer is changed through the [layers control](#control-layers).
-  		// @event overlayadd: LayersControlEvent
-  		// Fired when an overlay is selected through the [layers control](#control-layers).
-  		// @event overlayremove: LayersControlEvent
-  		// Fired when an overlay is deselected through the [layers control](#control-layers).
-  		// @namespace Control.Layers
-  		var type = obj.overlay ?
-  			(e.type === 'add' ? 'overlayadd' : 'overlayremove') :
-  			(e.type === 'add' ? 'baselayerchange' : null);
-
-  		if (type) {
-  			this._map.fire(type, obj);
-  		}
-  	},
-
-  	// IE7 bugs out if you create a radio dynamically, so you have to do it this hacky way (see http://bit.ly/PqYLBe)
-  	_createRadioElement: function (name, checked) {
-
-  		var radioHtml = '<input type="radio" class="leaflet-control-layers-selector" name="' +
-  				name + '"' + (checked ? ' checked="checked"' : '') + '/>';
-
-  		var radioFragment = document.createElement('div');
-  		radioFragment.innerHTML = radioHtml;
-
-  		return radioFragment.firstChild;
-  	},
-
-  	_addItem: function (obj) {
-  		var label = document.createElement('label'),
-  		    checked = this._map.hasLayer(obj.layer),
-  		    input;
-
-  		if (obj.overlay) {
-  			input = document.createElement('input');
-  			input.type = 'checkbox';
-  			input.className = 'leaflet-control-layers-selector';
-  			input.defaultChecked = checked;
-  		} else {
-  			input = this._createRadioElement('leaflet-base-layers_' + stamp(this), checked);
-  		}
-
-  		this._layerControlInputs.push(input);
-  		input.layerId = stamp(obj.layer);
-
-  		on(input, 'click', this._onInputClick, this);
-
-  		var name = document.createElement('span');
-  		name.innerHTML = ' ' + obj.name;
-
-  		// Helps from preventing layer control flicker when checkboxes are disabled
-  		// https://github.com/Leaflet/Leaflet/issues/2771
-  		var holder = document.createElement('div');
-
-  		label.appendChild(holder);
-  		holder.appendChild(input);
-  		holder.appendChild(name);
-
-  		var container = obj.overlay ? this._overlaysList : this._baseLayersList;
-  		container.appendChild(label);
-
-  		this._checkDisabledLayers();
-  		return label;
-  	},
-
-  	_onInputClick: function () {
-  		var inputs = this._layerControlInputs,
-  		    input, layer;
-  		var addedLayers = [],
-  		    removedLayers = [];
-
-  		this._handlingClick = true;
-
-  		for (var i = inputs.length - 1; i >= 0; i--) {
-  			input = inputs[i];
-  			layer = this._getLayer(input.layerId).layer;
-
-  			if (input.checked) {
-  				addedLayers.push(layer);
-  			} else if (!input.checked) {
-  				removedLayers.push(layer);
-  			}
-  		}
-
-  		// Bugfix issue 2318: Should remove all old layers before readding new ones
-  		for (i = 0; i < removedLayers.length; i++) {
-  			if (this._map.hasLayer(removedLayers[i])) {
-  				this._map.removeLayer(removedLayers[i]);
-  			}
-  		}
-  		for (i = 0; i < addedLayers.length; i++) {
-  			if (!this._map.hasLayer(addedLayers[i])) {
-  				this._map.addLayer(addedLayers[i]);
-  			}
-  		}
-
-  		this._handlingClick = false;
-
-  		this._refocusOnMap();
-  	},
-
-  	_checkDisabledLayers: function () {
-  		var inputs = this._layerControlInputs,
-  		    input,
-  		    layer,
-  		    zoom = this._map.getZoom();
-
-  		for (var i = inputs.length - 1; i >= 0; i--) {
-  			input = inputs[i];
-  			layer = this._getLayer(input.layerId).layer;
-  			input.disabled = (layer.options.minZoom !== undefined && zoom < layer.options.minZoom) ||
-  			                 (layer.options.maxZoom !== undefined && zoom > layer.options.maxZoom);
-
-  		}
-  	},
-
-  	_expandIfNotCollapsed: function () {
-  		if (this._map && !this.options.collapsed) {
-  			this.expand();
-  		}
-  		return this;
-  	},
-
-  	_expand: function () {
-  		// Backward compatibility, remove me in 1.1.
-  		return this.expand();
-  	},
-
-  	_collapse: function () {
-  		// Backward compatibility, remove me in 1.1.
-  		return this.collapse();
-  	}
-
-  });
-
-
-  // @factory L.control.layers(baselayers?: Object, overlays?: Object, options?: Control.Layers options)
-  // Creates a layers control with the given layers. Base layers will be switched with radio buttons, while overlays will be switched with checkboxes. Note that all base layers should be passed in the base layers object, but only one should be added to the map during map instantiation.
-  var layers = function (baseLayers, overlays, options) {
-  	return new Layers(baseLayers, overlays, options);
-  };
-
-  /*
-   * @class Control.Zoom
-   * @aka L.Control.Zoom
-   * @inherits Control
-   *
-   * A basic zoom control with two buttons (zoom in and zoom out). It is put on the map by default unless you set its [`zoomControl` option](#map-zoomcontrol) to `false`. Extends `Control`.
-   */
-
-  var Zoom = Control.extend({
-  	// @section
-  	// @aka Control.Zoom options
-  	options: {
-  		position: 'topleft',
-
-  		// @option zoomInText: String = '+'
-  		// The text set on the 'zoom in' button.
-  		zoomInText: '+',
-
-  		// @option zoomInTitle: String = 'Zoom in'
-  		// The title set on the 'zoom in' button.
-  		zoomInTitle: 'Zoom in',
-
-  		// @option zoomOutText: String = '&#x2212;'
-  		// The text set on the 'zoom out' button.
-  		zoomOutText: '&#x2212;',
-
-  		// @option zoomOutTitle: String = 'Zoom out'
-  		// The title set on the 'zoom out' button.
-  		zoomOutTitle: 'Zoom out'
-  	},
-
-  	onAdd: function (map) {
-  		var zoomName = 'leaflet-control-zoom',
-  		    container = create$1('div', zoomName + ' leaflet-bar'),
-  		    options = this.options;
-
-  		this._zoomInButton  = this._createButton(options.zoomInText, options.zoomInTitle,
-  		        zoomName + '-in',  container, this._zoomIn);
-  		this._zoomOutButton = this._createButton(options.zoomOutText, options.zoomOutTitle,
-  		        zoomName + '-out', container, this._zoomOut);
-
-  		this._updateDisabled();
-  		map.on('zoomend zoomlevelschange', this._updateDisabled, this);
-
-  		return container;
-  	},
-
-  	onRemove: function (map) {
-  		map.off('zoomend zoomlevelschange', this._updateDisabled, this);
-  	},
-
-  	disable: function () {
-  		this._disabled = true;
-  		this._updateDisabled();
-  		return this;
-  	},
-
-  	enable: function () {
-  		this._disabled = false;
-  		this._updateDisabled();
-  		return this;
-  	},
-
-  	_zoomIn: function (e) {
-  		if (!this._disabled && this._map._zoom < this._map.getMaxZoom()) {
-  			this._map.zoomIn(this._map.options.zoomDelta * (e.shiftKey ? 3 : 1));
-  		}
-  	},
-
-  	_zoomOut: function (e) {
-  		if (!this._disabled && this._map._zoom > this._map.getMinZoom()) {
-  			this._map.zoomOut(this._map.options.zoomDelta * (e.shiftKey ? 3 : 1));
-  		}
-  	},
-
-  	_createButton: function (html, title, className, container, fn) {
-  		var link = create$1('a', className, container);
-  		link.innerHTML = html;
-  		link.href = '#';
-  		link.title = title;
-
-  		/*
-  		 * Will force screen readers like VoiceOver to read this as "Zoom in - button"
-  		 */
-  		link.setAttribute('role', 'button');
-  		link.setAttribute('aria-label', title);
-
-  		disableClickPropagation(link);
-  		on(link, 'click', stop);
-  		on(link, 'click', fn, this);
-  		on(link, 'click', this._refocusOnMap, this);
-
-  		return link;
-  	},
-
-  	_updateDisabled: function () {
-  		var map = this._map,
-  		    className = 'leaflet-disabled';
-
-  		removeClass(this._zoomInButton, className);
-  		removeClass(this._zoomOutButton, className);
-
-  		if (this._disabled || map._zoom === map.getMinZoom()) {
-  			addClass(this._zoomOutButton, className);
-  		}
-  		if (this._disabled || map._zoom === map.getMaxZoom()) {
-  			addClass(this._zoomInButton, className);
-  		}
-  	}
-  });
-
-  // @namespace Map
-  // @section Control options
-  // @option zoomControl: Boolean = true
-  // Whether a [zoom control](#control-zoom) is added to the map by default.
-  Map.mergeOptions({
-  	zoomControl: true
-  });
-
-  Map.addInitHook(function () {
-  	if (this.options.zoomControl) {
-  		// @section Controls
-  		// @property zoomControl: Control.Zoom
-  		// The default zoom control (only available if the
-  		// [`zoomControl` option](#map-zoomcontrol) was `true` when creating the map).
-  		this.zoomControl = new Zoom();
-  		this.addControl(this.zoomControl);
-  	}
-  });
-
-  // @namespace Control.Zoom
-  // @factory L.control.zoom(options: Control.Zoom options)
-  // Creates a zoom control
-  var zoom = function (options) {
-  	return new Zoom(options);
-  };
-
-  /*
-   * @class Control.Scale
-   * @aka L.Control.Scale
-   * @inherits Control
-   *
-   * A simple scale control that shows the scale of the current center of screen in metric (m/km) and imperial (mi/ft) systems. Extends `Control`.
-   *
-   * @example
-   *
-   * ```js
-   * L.control.scale().addTo(map);
-   * ```
-   */
-
-  var Scale = Control.extend({
-  	// @section
-  	// @aka Control.Scale options
-  	options: {
-  		position: 'bottomleft',
-
-  		// @option maxWidth: Number = 100
-  		// Maximum width of the control in pixels. The width is set dynamically to show round values (e.g. 100, 200, 500).
-  		maxWidth: 100,
-
-  		// @option metric: Boolean = True
-  		// Whether to show the metric scale line (m/km).
-  		metric: true,
-
-  		// @option imperial: Boolean = True
-  		// Whether to show the imperial scale line (mi/ft).
-  		imperial: true
-
-  		// @option updateWhenIdle: Boolean = false
-  		// If `true`, the control is updated on [`moveend`](#map-moveend), otherwise it's always up-to-date (updated on [`move`](#map-move)).
-  	},
-
-  	onAdd: function (map) {
-  		var className = 'leaflet-control-scale',
-  		    container = create$1('div', className),
-  		    options = this.options;
-
-  		this._addScales(options, className + '-line', container);
-
-  		map.on(options.updateWhenIdle ? 'moveend' : 'move', this._update, this);
-  		map.whenReady(this._update, this);
-
-  		return container;
-  	},
-
-  	onRemove: function (map) {
-  		map.off(this.options.updateWhenIdle ? 'moveend' : 'move', this._update, this);
-  	},
-
-  	_addScales: function (options, className, container) {
-  		if (options.metric) {
-  			this._mScale = create$1('div', className, container);
-  		}
-  		if (options.imperial) {
-  			this._iScale = create$1('div', className, container);
-  		}
-  	},
-
-  	_update: function () {
-  		var map = this._map,
-  		    y = map.getSize().y / 2;
-
-  		var maxMeters = map.distance(
-  			map.containerPointToLatLng([0, y]),
-  			map.containerPointToLatLng([this.options.maxWidth, y]));
-
-  		this._updateScales(maxMeters);
-  	},
-
-  	_updateScales: function (maxMeters) {
-  		if (this.options.metric && maxMeters) {
-  			this._updateMetric(maxMeters);
-  		}
-  		if (this.options.imperial && maxMeters) {
-  			this._updateImperial(maxMeters);
-  		}
-  	},
-
-  	_updateMetric: function (maxMeters) {
-  		var meters = this._getRoundNum(maxMeters),
-  		    label = meters < 1000 ? meters + ' m' : (meters / 1000) + ' km';
-
-  		this._updateScale(this._mScale, label, meters / maxMeters);
-  	},
-
-  	_updateImperial: function (maxMeters) {
-  		var maxFeet = maxMeters * 3.2808399,
-  		    maxMiles, miles, feet;
-
-  		if (maxFeet > 5280) {
-  			maxMiles = maxFeet / 5280;
-  			miles = this._getRoundNum(maxMiles);
-  			this._updateScale(this._iScale, miles + ' mi', miles / maxMiles);
-
-  		} else {
-  			feet = this._getRoundNum(maxFeet);
-  			this._updateScale(this._iScale, feet + ' ft', feet / maxFeet);
-  		}
-  	},
-
-  	_updateScale: function (scale, text, ratio) {
-  		scale.style.width = Math.round(this.options.maxWidth * ratio) + 'px';
-  		scale.innerHTML = text;
-  	},
-
-  	_getRoundNum: function (num) {
-  		var pow10 = Math.pow(10, (Math.floor(num) + '').length - 1),
-  		    d = num / pow10;
-
-  		d = d >= 10 ? 10 :
-  		    d >= 5 ? 5 :
-  		    d >= 3 ? 3 :
-  		    d >= 2 ? 2 : 1;
-
-  		return pow10 * d;
-  	}
-  });
-
-
-  // @factory L.control.scale(options?: Control.Scale options)
-  // Creates an scale control with the given options.
-  var scale = function (options) {
-  	return new Scale(options);
-  };
-
-  /*
-   * @class Control.Attribution
-   * @aka L.Control.Attribution
-   * @inherits Control
-   *
-   * The attribution control allows you to display attribution data in a small text box on a map. It is put on the map by default unless you set its [`attributionControl` option](#map-attributioncontrol) to `false`, and it fetches attribution texts from layers with the [`getAttribution` method](#layer-getattribution) automatically. Extends Control.
-   */
-
-  var Attribution = Control.extend({
-  	// @section
-  	// @aka Control.Attribution options
-  	options: {
-  		position: 'bottomright',
-
-  		// @option prefix: String = 'Leaflet'
-  		// The HTML text shown before the attributions. Pass `false` to disable.
-  		prefix: '<a href="https://leafletjs.com" title="A JS library for interactive maps">Leaflet</a>'
-  	},
-
-  	initialize: function (options) {
-  		setOptions(this, options);
-
-  		this._attributions = {};
-  	},
-
-  	onAdd: function (map) {
-  		map.attributionControl = this;
-  		this._container = create$1('div', 'leaflet-control-attribution');
-  		disableClickPropagation(this._container);
-
-  		// TODO ugly, refactor
-  		for (var i in map._layers) {
-  			if (map._layers[i].getAttribution) {
-  				this.addAttribution(map._layers[i].getAttribution());
-  			}
-  		}
-
-  		this._update();
-
-  		return this._container;
-  	},
-
-  	// @method setPrefix(prefix: String): this
-  	// Sets the text before the attributions.
-  	setPrefix: function (prefix) {
-  		this.options.prefix = prefix;
-  		this._update();
-  		return this;
-  	},
-
-  	// @method addAttribution(text: String): this
-  	// Adds an attribution text (e.g. `'Vector data &copy; Mapbox'`).
-  	addAttribution: function (text) {
-  		if (!text) { return this; }
-
-  		if (!this._attributions[text]) {
-  			this._attributions[text] = 0;
-  		}
-  		this._attributions[text]++;
-
-  		this._update();
-
-  		return this;
-  	},
-
-  	// @method removeAttribution(text: String): this
-  	// Removes an attribution text.
-  	removeAttribution: function (text) {
-  		if (!text) { return this; }
-
-  		if (this._attributions[text]) {
-  			this._attributions[text]--;
-  			this._update();
-  		}
-
-  		return this;
-  	},
-
-  	_update: function () {
-  		if (!this._map) { return; }
-
-  		var attribs = [];
-
-  		for (var i in this._attributions) {
-  			if (this._attributions[i]) {
-  				attribs.push(i);
-  			}
-  		}
-
-  		var prefixAndAttribs = [];
-
-  		if (this.options.prefix) {
-  			prefixAndAttribs.push(this.options.prefix);
-  		}
-  		if (attribs.length) {
-  			prefixAndAttribs.push(attribs.join(', '));
-  		}
-
-  		this._container.innerHTML = prefixAndAttribs.join(' | ');
-  	}
-  });
-
-  // @namespace Map
-  // @section Control options
-  // @option attributionControl: Boolean = true
-  // Whether a [attribution control](#control-attribution) is added to the map by default.
-  Map.mergeOptions({
-  	attributionControl: true
-  });
-
-  Map.addInitHook(function () {
-  	if (this.options.attributionControl) {
-  		new Attribution().addTo(this);
-  	}
-  });
-
-  // @namespace Control.Attribution
-  // @factory L.control.attribution(options: Control.Attribution options)
-  // Creates an attribution control.
-  var attribution = function (options) {
-  	return new Attribution(options);
-  };
-
-  Control.Layers = Layers;
-  Control.Zoom = Zoom;
-  Control.Scale = Scale;
-  Control.Attribution = Attribution;
-
-  control.layers = layers;
-  control.zoom = zoom;
-  control.scale = scale;
-  control.attribution = attribution;
-
-  /*
-  	L.Handler is a base class for handler classes that are used internally to inject
-  	interaction features like dragging to classes like Map and Marker.
-  */
-
-  // @class Handler
-  // @aka L.Handler
-  // Abstract class for map interaction handlers
-
-  var Handler = Class.extend({
-  	initialize: function (map) {
-  		this._map = map;
-  	},
-
-  	// @method enable(): this
-  	// Enables the handler
-  	enable: function () {
-  		if (this._enabled) { return this; }
-
-  		this._enabled = true;
-  		this.addHooks();
-  		return this;
-  	},
-
-  	// @method disable(): this
-  	// Disables the handler
-  	disable: function () {
-  		if (!this._enabled) { return this; }
-
-  		this._enabled = false;
-  		this.removeHooks();
-  		return this;
-  	},
-
-  	// @method enabled(): Boolean
-  	// Returns `true` if the handler is enabled
-  	enabled: function () {
-  		return !!this._enabled;
-  	}
-
-  	// @section Extension methods
-  	// Classes inheriting from `Handler` must implement the two following methods:
-  	// @method addHooks()
-  	// Called when the handler is enabled, should add event hooks.
-  	// @method removeHooks()
-  	// Called when the handler is disabled, should remove the event hooks added previously.
-  });
-
-  // @section There is static function which can be called without instantiating L.Handler:
-  // @function addTo(map: Map, name: String): this
-  // Adds a new Handler to the given map with the given name.
-  Handler.addTo = function (map, name) {
-  	map.addHandler(name, this);
-  	return this;
-  };
-
-  var Mixin = {Events: Events};
-
-  /*
-   * @class Draggable
-   * @aka L.Draggable
-   * @inherits Evented
-   *
-   * A class for making DOM elements draggable (including touch support).
-   * Used internally for map and marker dragging. Only works for elements
-   * that were positioned with [`L.DomUtil.setPosition`](#domutil-setposition).
-   *
-   * @example
-   * ```js
-   * var draggable = new L.Draggable(elementToDrag);
-   * draggable.enable();
-   * ```
-   */
-
-  var START = touch ? 'touchstart mousedown' : 'mousedown';
-  var END = {
-  	mousedown: 'mouseup',
-  	touchstart: 'touchend',
-  	pointerdown: 'touchend',
-  	MSPointerDown: 'touchend'
-  };
-  var MOVE = {
-  	mousedown: 'mousemove',
-  	touchstart: 'touchmove',
-  	pointerdown: 'touchmove',
-  	MSPointerDown: 'touchmove'
-  };
-
-
-  var Draggable = Evented.extend({
-
-  	options: {
-  		// @section
-  		// @aka Draggable options
-  		// @option clickTolerance: Number = 3
-  		// The max number of pixels a user can shift the mouse pointer during a click
-  		// for it to be considered a valid click (as opposed to a mouse drag).
-  		clickTolerance: 3
-  	},
-
-  	// @constructor L.Draggable(el: HTMLElement, dragHandle?: HTMLElement, preventOutline?: Boolean, options?: Draggable options)
-  	// Creates a `Draggable` object for moving `el` when you start dragging the `dragHandle` element (equals `el` itself by default).
-  	initialize: function (element, dragStartTarget, preventOutline$$1, options) {
-  		setOptions(this, options);
-
-  		this._element = element;
-  		this._dragStartTarget = dragStartTarget || element;
-  		this._preventOutline = preventOutline$$1;
-  	},
-
-  	// @method enable()
-  	// Enables the dragging ability
-  	enable: function () {
-  		if (this._enabled) { return; }
-
-  		on(this._dragStartTarget, START, this._onDown, this);
-
-  		this._enabled = true;
-  	},
-
-  	// @method disable()
-  	// Disables the dragging ability
-  	disable: function () {
-  		if (!this._enabled) { return; }
-
-  		// If we're currently dragging this draggable,
-  		// disabling it counts as first ending the drag.
-  		if (Draggable._dragging === this) {
-  			this.finishDrag();
-  		}
-
-  		off(this._dragStartTarget, START, this._onDown, this);
-
-  		this._enabled = false;
-  		this._moved = false;
-  	},
-
-  	_onDown: function (e) {
-  		// Ignore simulated events, since we handle both touch and
-  		// mouse explicitly; otherwise we risk getting duplicates of
-  		// touch events, see #4315.
-  		// Also ignore the event if disabled; this happens in IE11
-  		// under some circumstances, see #3666.
-  		if (e._simulated || !this._enabled) { return; }
-
-  		this._moved = false;
-
-  		if (hasClass(this._element, 'leaflet-zoom-anim')) { return; }
-
-  		if (Draggable._dragging || e.shiftKey || ((e.which !== 1) && (e.button !== 1) && !e.touches)) { return; }
-  		Draggable._dragging = this;  // Prevent dragging multiple objects at once.
-
-  		if (this._preventOutline) {
-  			preventOutline(this._element);
-  		}
-
-  		disableImageDrag();
-  		disableTextSelection();
-
-  		if (this._moving) { return; }
-
-  		// @event down: Event
-  		// Fired when a drag is about to start.
-  		this.fire('down');
-
-  		var first = e.touches ? e.touches[0] : e,
-  		    sizedParent = getSizedParentNode(this._element);
-
-  		this._startPoint = new Point(first.clientX, first.clientY);
-
-  		// Cache the scale, so that we can continuously compensate for it during drag (_onMove).
-  		this._parentScale = getScale(sizedParent);
-
-  		on(document, MOVE[e.type], this._onMove, this);
-  		on(document, END[e.type], this._onUp, this);
-  	},
-
-  	_onMove: function (e) {
-  		// Ignore simulated events, since we handle both touch and
-  		// mouse explicitly; otherwise we risk getting duplicates of
-  		// touch events, see #4315.
-  		// Also ignore the event if disabled; this happens in IE11
-  		// under some circumstances, see #3666.
-  		if (e._simulated || !this._enabled) { return; }
-
-  		if (e.touches && e.touches.length > 1) {
-  			this._moved = true;
-  			return;
-  		}
-
-  		var first = (e.touches && e.touches.length === 1 ? e.touches[0] : e),
-  		    offset = new Point(first.clientX, first.clientY)._subtract(this._startPoint);
-
-  		if (!offset.x && !offset.y) { return; }
-  		if (Math.abs(offset.x) + Math.abs(offset.y) < this.options.clickTolerance) { return; }
-
-  		// We assume that the parent container's position, border and scale do not change for the duration of the drag.
-  		// Therefore there is no need to account for the position and border (they are eliminated by the subtraction)
-  		// and we can use the cached value for the scale.
-  		offset.x /= this._parentScale.x;
-  		offset.y /= this._parentScale.y;
-
-  		preventDefault(e);
-
-  		if (!this._moved) {
-  			// @event dragstart: Event
-  			// Fired when a drag starts
-  			this.fire('dragstart');
-
-  			this._moved = true;
-  			this._startPos = getPosition(this._element).subtract(offset);
-
-  			addClass(document.body, 'leaflet-dragging');
-
-  			this._lastTarget = e.target || e.srcElement;
-  			// IE and Edge do not give the <use> element, so fetch it
-  			// if necessary
-  			if (window.SVGElementInstance && this._lastTarget instanceof window.SVGElementInstance) {
-  				this._lastTarget = this._lastTarget.correspondingUseElement;
-  			}
-  			addClass(this._lastTarget, 'leaflet-drag-target');
-  		}
-
-  		this._newPos = this._startPos.add(offset);
-  		this._moving = true;
-
-  		cancelAnimFrame(this._animRequest);
-  		this._lastEvent = e;
-  		this._animRequest = requestAnimFrame(this._updatePosition, this, true);
-  	},
-
-  	_updatePosition: function () {
-  		var e = {originalEvent: this._lastEvent};
-
-  		// @event predrag: Event
-  		// Fired continuously during dragging *before* each corresponding
-  		// update of the element's position.
-  		this.fire('predrag', e);
-  		setPosition(this._element, this._newPos);
-
-  		// @event drag: Event
-  		// Fired continuously during dragging.
-  		this.fire('drag', e);
-  	},
-
-  	_onUp: function (e) {
-  		// Ignore simulated events, since we handle both touch and
-  		// mouse explicitly; otherwise we risk getting duplicates of
-  		// touch events, see #4315.
-  		// Also ignore the event if disabled; this happens in IE11
-  		// under some circumstances, see #3666.
-  		if (e._simulated || !this._enabled) { return; }
-  		this.finishDrag();
-  	},
-
-  	finishDrag: function () {
-  		removeClass(document.body, 'leaflet-dragging');
-
-  		if (this._lastTarget) {
-  			removeClass(this._lastTarget, 'leaflet-drag-target');
-  			this._lastTarget = null;
-  		}
-
-  		for (var i in MOVE) {
-  			off(document, MOVE[i], this._onMove, this);
-  			off(document, END[i], this._onUp, this);
-  		}
-
-  		enableImageDrag();
-  		enableTextSelection();
-
-  		if (this._moved && this._moving) {
-  			// ensure drag is not fired after dragend
-  			cancelAnimFrame(this._animRequest);
-
-  			// @event dragend: DragEndEvent
-  			// Fired when the drag ends.
-  			this.fire('dragend', {
-  				distance: this._newPos.distanceTo(this._startPos)
-  			});
-  		}
-
-  		this._moving = false;
-  		Draggable._dragging = false;
-  	}
-
-  });
-
-  /*
-   * @namespace LineUtil
-   *
-   * Various utility functions for polyline points processing, used by Leaflet internally to make polylines lightning-fast.
-   */
-
-  // Simplify polyline with vertex reduction and Douglas-Peucker simplification.
-  // Improves rendering performance dramatically by lessening the number of points to draw.
-
-  // @function simplify(points: Point[], tolerance: Number): Point[]
-  // Dramatically reduces the number of points in a polyline while retaining
-  // its shape and returns a new array of simplified points, using the
-  // [Douglas-Peucker algorithm](http://en.wikipedia.org/wiki/Douglas-Peucker_algorithm).
-  // Used for a huge performance boost when processing/displaying Leaflet polylines for
-  // each zoom level and also reducing visual noise. tolerance affects the amount of
-  // simplification (lesser value means higher quality but slower and with more points).
-  // Also released as a separated micro-library [Simplify.js](http://mourner.github.com/simplify-js/).
-  function simplify(points, tolerance) {
-  	if (!tolerance || !points.length) {
-  		return points.slice();
-  	}
-
-  	var sqTolerance = tolerance * tolerance;
-
-  	    // stage 1: vertex reduction
-  	    points = _reducePoints(points, sqTolerance);
-
-  	    // stage 2: Douglas-Peucker simplification
-  	    points = _simplifyDP(points, sqTolerance);
-
-  	return points;
-  }
-
-  // @function pointToSegmentDistance(p: Point, p1: Point, p2: Point): Number
-  // Returns the distance between point `p` and segment `p1` to `p2`.
-  function pointToSegmentDistance(p, p1, p2) {
-  	return Math.sqrt(_sqClosestPointOnSegment(p, p1, p2, true));
-  }
-
-  // @function closestPointOnSegment(p: Point, p1: Point, p2: Point): Number
-  // Returns the closest point from a point `p` on a segment `p1` to `p2`.
-  function closestPointOnSegment(p, p1, p2) {
-  	return _sqClosestPointOnSegment(p, p1, p2);
-  }
-
-  // Douglas-Peucker simplification, see http://en.wikipedia.org/wiki/Douglas-Peucker_algorithm
-  function _simplifyDP(points, sqTolerance) {
-
-  	var len = points.length,
-  	    ArrayConstructor = typeof Uint8Array !== undefined + '' ? Uint8Array : Array,
-  	    markers = new ArrayConstructor(len);
-
-  	    markers[0] = markers[len - 1] = 1;
-
-  	_simplifyDPStep(points, markers, sqTolerance, 0, len - 1);
-
-  	var i,
-  	    newPoints = [];
-
-  	for (i = 0; i < len; i++) {
-  		if (markers[i]) {
-  			newPoints.push(points[i]);
-  		}
-  	}
-
-  	return newPoints;
-  }
-
-  function _simplifyDPStep(points, markers, sqTolerance, first, last) {
-
-  	var maxSqDist = 0,
-  	index, i, sqDist;
-
-  	for (i = first + 1; i <= last - 1; i++) {
-  		sqDist = _sqClosestPointOnSegment(points[i], points[first], points[last], true);
-
-  		if (sqDist > maxSqDist) {
-  			index = i;
-  			maxSqDist = sqDist;
-  		}
-  	}
-
-  	if (maxSqDist > sqTolerance) {
-  		markers[index] = 1;
-
-  		_simplifyDPStep(points, markers, sqTolerance, first, index);
-  		_simplifyDPStep(points, markers, sqTolerance, index, last);
-  	}
-  }
-
-  // reduce points that are too close to each other to a single point
-  function _reducePoints(points, sqTolerance) {
-  	var reducedPoints = [points[0]];
-
-  	for (var i = 1, prev = 0, len = points.length; i < len; i++) {
-  		if (_sqDist(points[i], points[prev]) > sqTolerance) {
-  			reducedPoints.push(points[i]);
-  			prev = i;
-  		}
-  	}
-  	if (prev < len - 1) {
-  		reducedPoints.push(points[len - 1]);
-  	}
-  	return reducedPoints;
-  }
-
-  var _lastCode;
-
-  // @function clipSegment(a: Point, b: Point, bounds: Bounds, useLastCode?: Boolean, round?: Boolean): Point[]|Boolean
-  // Clips the segment a to b by rectangular bounds with the
-  // [Cohen-Sutherland algorithm](https://en.wikipedia.org/wiki/Cohen%E2%80%93Sutherland_algorithm)
-  // (modifying the segment points directly!). Used by Leaflet to only show polyline
-  // points that are on the screen or near, increasing performance.
-  function clipSegment(a, b, bounds, useLastCode, round) {
-  	var codeA = useLastCode ? _lastCode : _getBitCode(a, bounds),
-  	    codeB = _getBitCode(b, bounds),
-
-  	    codeOut, p, newCode;
-
-  	    // save 2nd code to avoid calculating it on the next segment
-  	    _lastCode = codeB;
-
-  	while (true) {
-  		// if a,b is inside the clip window (trivial accept)
-  		if (!(codeA | codeB)) {
-  			return [a, b];
-  		}
-
-  		// if a,b is outside the clip window (trivial reject)
-  		if (codeA & codeB) {
-  			return false;
-  		}
-
-  		// other cases
-  		codeOut = codeA || codeB;
-  		p = _getEdgeIntersection(a, b, codeOut, bounds, round);
-  		newCode = _getBitCode(p, bounds);
-
-  		if (codeOut === codeA) {
-  			a = p;
-  			codeA = newCode;
-  		} else {
-  			b = p;
-  			codeB = newCode;
-  		}
-  	}
-  }
-
-  function _getEdgeIntersection(a, b, code, bounds, round) {
-  	var dx = b.x - a.x,
-  	    dy = b.y - a.y,
-  	    min = bounds.min,
-  	    max = bounds.max,
-  	    x, y;
-
-  	if (code & 8) { // top
-  		x = a.x + dx * (max.y - a.y) / dy;
-  		y = max.y;
-
-  	} else if (code & 4) { // bottom
-  		x = a.x + dx * (min.y - a.y) / dy;
-  		y = min.y;
-
-  	} else if (code & 2) { // right
-  		x = max.x;
-  		y = a.y + dy * (max.x - a.x) / dx;
-
-  	} else if (code & 1) { // left
-  		x = min.x;
-  		y = a.y + dy * (min.x - a.x) / dx;
-  	}
-
-  	return new Point(x, y, round);
-  }
-
-  function _getBitCode(p, bounds) {
-  	var code = 0;
-
-  	if (p.x < bounds.min.x) { // left
-  		code |= 1;
-  	} else if (p.x > bounds.max.x) { // right
-  		code |= 2;
-  	}
-
-  	if (p.y < bounds.min.y) { // bottom
-  		code |= 4;
-  	} else if (p.y > bounds.max.y) { // top
-  		code |= 8;
-  	}
-
-  	return code;
-  }
-
-  // square distance (to avoid unnecessary Math.sqrt calls)
-  function _sqDist(p1, p2) {
-  	var dx = p2.x - p1.x,
-  	    dy = p2.y - p1.y;
-  	return dx * dx + dy * dy;
-  }
-
-  // return closest point on segment or distance to that point
-  function _sqClosestPointOnSegment(p, p1, p2, sqDist) {
-  	var x = p1.x,
-  	    y = p1.y,
-  	    dx = p2.x - x,
-  	    dy = p2.y - y,
-  	    dot = dx * dx + dy * dy,
-  	    t;
-
-  	if (dot > 0) {
-  		t = ((p.x - x) * dx + (p.y - y) * dy) / dot;
-
-  		if (t > 1) {
-  			x = p2.x;
-  			y = p2.y;
-  		} else if (t > 0) {
-  			x += dx * t;
-  			y += dy * t;
-  		}
-  	}
-
-  	dx = p.x - x;
-  	dy = p.y - y;
-
-  	return sqDist ? dx * dx + dy * dy : new Point(x, y);
-  }
-
-
-  // @function isFlat(latlngs: LatLng[]): Boolean
-  // Returns true if `latlngs` is a flat array, false is nested.
-  function isFlat(latlngs) {
-  	return !isArray(latlngs[0]) || (typeof latlngs[0][0] !== 'object' && typeof latlngs[0][0] !== 'undefined');
-  }
-
-  function _flat(latlngs) {
-  	console.warn('Deprecated use of _flat, please use L.LineUtil.isFlat instead.');
-  	return isFlat(latlngs);
-  }
-
-  var LineUtil = ({
-    simplify: simplify,
-    pointToSegmentDistance: pointToSegmentDistance,
-    closestPointOnSegment: closestPointOnSegment,
-    clipSegment: clipSegment,
-    _getEdgeIntersection: _getEdgeIntersection,
-    _getBitCode: _getBitCode,
-    _sqClosestPointOnSegment: _sqClosestPointOnSegment,
-    isFlat: isFlat,
-    _flat: _flat
-  });
-
-  /*
-   * @namespace PolyUtil
-   * Various utility functions for polygon geometries.
-   */
-
-  /* @function clipPolygon(points: Point[], bounds: Bounds, round?: Boolean): Point[]
-   * Clips the polygon geometry defined by the given `points` by the given bounds (using the [Sutherland-Hodgman algorithm](https://en.wikipedia.org/wiki/Sutherland%E2%80%93Hodgman_algorithm)).
-   * Used by Leaflet to only show polygon points that are on the screen or near, increasing
-   * performance. Note that polygon points needs different algorithm for clipping
-   * than polyline, so there's a separate method for it.
-   */
-  function clipPolygon(points, bounds, round) {
-  	var clippedPoints,
-  	    edges = [1, 4, 2, 8],
-  	    i, j, k,
-  	    a, b,
-  	    len, edge, p;
-
-  	for (i = 0, len = points.length; i < len; i++) {
-  		points[i]._code = _getBitCode(points[i], bounds);
-  	}
-
-  	// for each edge (left, bottom, right, top)
-  	for (k = 0; k < 4; k++) {
-  		edge = edges[k];
-  		clippedPoints = [];
-
-  		for (i = 0, len = points.length, j = len - 1; i < len; j = i++) {
-  			a = points[i];
-  			b = points[j];
-
-  			// if a is inside the clip window
-  			if (!(a._code & edge)) {
-  				// if b is outside the clip window (a->b goes out of screen)
-  				if (b._code & edge) {
-  					p = _getEdgeIntersection(b, a, edge, bounds, round);
-  					p._code = _getBitCode(p, bounds);
-  					clippedPoints.push(p);
-  				}
-  				clippedPoints.push(a);
-
-  			// else if b is inside the clip window (a->b enters the screen)
-  			} else if (!(b._code & edge)) {
-  				p = _getEdgeIntersection(b, a, edge, bounds, round);
-  				p._code = _getBitCode(p, bounds);
-  				clippedPoints.push(p);
-  			}
-  		}
-  		points = clippedPoints;
-  	}
-
-  	return points;
-  }
-
-  var PolyUtil = ({
-    clipPolygon: clipPolygon
-  });
-
-  /*
-   * @namespace Projection
-   * @section
-   * Leaflet comes with a set of already defined Projections out of the box:
-   *
-   * @projection L.Projection.LonLat
-   *
-   * Equirectangular, or Plate Carree projection — the most simple projection,
-   * mostly used by GIS enthusiasts. Directly maps `x` as longitude, and `y` as
-   * latitude. Also suitable for flat worlds, e.g. game maps. Used by the
-   * `EPSG:4326` and `Simple` CRS.
-   */
-
-  var LonLat = {
-  	project: function (latlng) {
-  		return new Point(latlng.lng, latlng.lat);
-  	},
-
-  	unproject: function (point) {
-  		return new LatLng(point.y, point.x);
-  	},
-
-  	bounds: new Bounds([-180, -90], [180, 90])
-  };
-
-  /*
-   * @namespace Projection
-   * @projection L.Projection.Mercator
-   *
-   * Elliptical Mercator projection — more complex than Spherical Mercator. Assumes that Earth is an ellipsoid. Used by the EPSG:3395 CRS.
-   */
-
-  var Mercator = {
-  	R: 6378137,
-  	R_MINOR: 6356752.314245179,
-
-  	bounds: new Bounds([-20037508.34279, -15496570.73972], [20037508.34279, 18764656.23138]),
-
-  	project: function (latlng) {
-  		var d = Math.PI / 180,
-  		    r = this.R,
-  		    y = latlng.lat * d,
-  		    tmp = this.R_MINOR / r,
-  		    e = Math.sqrt(1 - tmp * tmp),
-  		    con = e * Math.sin(y);
-
-  		var ts = Math.tan(Math.PI / 4 - y / 2) / Math.pow((1 - con) / (1 + con), e / 2);
-  		y = -r * Math.log(Math.max(ts, 1E-10));
-
-  		return new Point(latlng.lng * d * r, y);
-  	},
-
-  	unproject: function (point) {
-  		var d = 180 / Math.PI,
-  		    r = this.R,
-  		    tmp = this.R_MINOR / r,
-  		    e = Math.sqrt(1 - tmp * tmp),
-  		    ts = Math.exp(-point.y / r),
-  		    phi = Math.PI / 2 - 2 * Math.atan(ts);
-
-  		for (var i = 0, dphi = 0.1, con; i < 15 && Math.abs(dphi) > 1e-7; i++) {
-  			con = e * Math.sin(phi);
-  			con = Math.pow((1 - con) / (1 + con), e / 2);
-  			dphi = Math.PI / 2 - 2 * Math.atan(ts * con) - phi;
-  			phi += dphi;
-  		}
-
-  		return new LatLng(phi * d, point.x * d / r);
-  	}
-  };
-
-  /*
-   * @class Projection
-
-   * An object with methods for projecting geographical coordinates of the world onto
-   * a flat surface (and back). See [Map projection](http://en.wikipedia.org/wiki/Map_projection).
-
-   * @property bounds: Bounds
-   * The bounds (specified in CRS units) where the projection is valid
-
-   * @method project(latlng: LatLng): Point
-   * Projects geographical coordinates into a 2D point.
-   * Only accepts actual `L.LatLng` instances, not arrays.
-
-   * @method unproject(point: Point): LatLng
-   * The inverse of `project`. Projects a 2D point into a geographical location.
-   * Only accepts actual `L.Point` instances, not arrays.
-
-   * Note that the projection instances do not inherit from Leaflet's `Class` object,
-   * and can't be instantiated. Also, new classes can't inherit from them,
-   * and methods can't be added to them with the `include` function.
-
-   */
-
-  var index = ({
-    LonLat: LonLat,
-    Mercator: Mercator,
-    SphericalMercator: SphericalMercator
-  });
-
-  /*
-   * @namespace CRS
-   * @crs L.CRS.EPSG3395
-   *
-   * Rarely used by some commercial tile providers. Uses Elliptical Mercator projection.
-   */
-  var EPSG3395 = extend({}, Earth, {
-  	code: 'EPSG:3395',
-  	projection: Mercator,
-
-  	transformation: (function () {
-  		var scale = 0.5 / (Math.PI * Mercator.R);
-  		return toTransformation(scale, 0.5, -scale, 0.5);
-  	}())
-  });
-
-  /*
-   * @namespace CRS
-   * @crs L.CRS.EPSG4326
-   *
-   * A common CRS among GIS enthusiasts. Uses simple Equirectangular projection.
-   *
-   * Leaflet 1.0.x complies with the [TMS coordinate scheme for EPSG:4326](https://wiki.osgeo.org/wiki/Tile_Map_Service_Specification#global-geodetic),
-   * which is a breaking change from 0.7.x behaviour.  If you are using a `TileLayer`
-   * with this CRS, ensure that there are two 256x256 pixel tiles covering the
-   * whole earth at zoom level zero, and that the tile coordinate origin is (-180,+90),
-   * or (-180,-90) for `TileLayer`s with [the `tms` option](#tilelayer-tms) set.
-   */
-
-  var EPSG4326 = extend({}, Earth, {
-  	code: 'EPSG:4326',
-  	projection: LonLat,
-  	transformation: toTransformation(1 / 180, 1, -1 / 180, 0.5)
-  });
-
-  /*
-   * @namespace CRS
-   * @crs L.CRS.Simple
-   *
-   * A simple CRS that maps longitude and latitude into `x` and `y` directly.
-   * May be used for maps of flat surfaces (e.g. game maps). Note that the `y`
-   * axis should still be inverted (going from bottom to top). `distance()` returns
-   * simple euclidean distance.
-   */
-
-  var Simple = extend({}, CRS, {
-  	projection: LonLat,
-  	transformation: toTransformation(1, 0, -1, 0),
-
-  	scale: function (zoom) {
-  		return Math.pow(2, zoom);
-  	},
-
-  	zoom: function (scale) {
-  		return Math.log(scale) / Math.LN2;
-  	},
-
-  	distance: function (latlng1, latlng2) {
-  		var dx = latlng2.lng - latlng1.lng,
-  		    dy = latlng2.lat - latlng1.lat;
-
-  		return Math.sqrt(dx * dx + dy * dy);
-  	},
-
-  	infinite: true
-  });
-
-  CRS.Earth = Earth;
-  CRS.EPSG3395 = EPSG3395;
-  CRS.EPSG3857 = EPSG3857;
-  CRS.EPSG900913 = EPSG900913;
-  CRS.EPSG4326 = EPSG4326;
-  CRS.Simple = Simple;
-
-  /*
-   * @class Layer
-   * @inherits Evented
-   * @aka L.Layer
-   * @aka ILayer
-   *
-   * A set of methods from the Layer base class that all Leaflet layers use.
-   * Inherits all methods, options and events from `L.Evented`.
-   *
-   * @example
-   *
-   * ```js
-   * var layer = L.marker(latlng).addTo(map);
-   * layer.addTo(map);
-   * layer.remove();
-   * ```
-   *
-   * @event add: Event
-   * Fired after the layer is added to a map
-   *
-   * @event remove: Event
-   * Fired after the layer is removed from a map
-   */
-
-
-  var Layer = Evented.extend({
-
-  	// Classes extending `L.Layer` will inherit the following options:
-  	options: {
-  		// @option pane: String = 'overlayPane'
-  		// By default the layer will be added to the map's [overlay pane](#map-overlaypane). Overriding this option will cause the layer to be placed on another pane by default.
-  		pane: 'overlayPane',
-
-  		// @option attribution: String = null
-  		// String to be shown in the attribution control, e.g. "© OpenStreetMap contributors". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.
-  		attribution: null,
-
-  		bubblingMouseEvents: true
-  	},
-
-  	/* @section
-  	 * Classes extending `L.Layer` will inherit the following methods:
-  	 *
-  	 * @method addTo(map: Map|LayerGroup): this
-  	 * Adds the layer to the given map or layer group.
-  	 */
-  	addTo: function (map) {
-  		map.addLayer(this);
-  		return this;
-  	},
-
-  	// @method remove: this
-  	// Removes the layer from the map it is currently active on.
-  	remove: function () {
-  		return this.removeFrom(this._map || this._mapToAdd);
-  	},
-
-  	// @method removeFrom(map: Map): this
-  	// Removes the layer from the given map
-  	//
-  	// @alternative
-  	// @method removeFrom(group: LayerGroup): this
-  	// Removes the layer from the given `LayerGroup`
-  	removeFrom: function (obj) {
-  		if (obj) {
-  			obj.removeLayer(this);
-  		}
-  		return this;
-  	},
-
-  	// @method getPane(name? : String): HTMLElement
-  	// Returns the `HTMLElement` representing the named pane on the map. If `name` is omitted, returns the pane for this layer.
-  	getPane: function (name) {
-  		return this._map.getPane(name ? (this.options[name] || name) : this.options.pane);
-  	},
-
-  	addInteractiveTarget: function (targetEl) {
-  		this._map._targets[stamp(targetEl)] = this;
-  		return this;
-  	},
-
-  	removeInteractiveTarget: function (targetEl) {
-  		delete this._map._targets[stamp(targetEl)];
-  		return this;
-  	},
-
-  	// @method getAttribution: String
-  	// Used by the `attribution control`, returns the [attribution option](#gridlayer-attribution).
-  	getAttribution: function () {
-  		return this.options.attribution;
-  	},
-
-  	_layerAdd: function (e) {
-  		var map = e.target;
-
-  		// check in case layer gets added and then removed before the map is ready
-  		if (!map.hasLayer(this)) { return; }
-
-  		this._map = map;
-  		this._zoomAnimated = map._zoomAnimated;
-
-  		if (this.getEvents) {
-  			var events = this.getEvents();
-  			map.on(events, this);
-  			this.once('remove', function () {
-  				map.off(events, this);
-  			}, this);
-  		}
-
-  		this.onAdd(map);
-
-  		if (this.getAttribution && map.attributionControl) {
-  			map.attributionControl.addAttribution(this.getAttribution());
-  		}
-
-  		this.fire('add');
-  		map.fire('layeradd', {layer: this});
-  	}
-  });
-
-  /* @section Extension methods
-   * @uninheritable
-   *
-   * Every layer should extend from `L.Layer` and (re-)implement the following methods.
-   *
-   * @method onAdd(map: Map): this
-   * Should contain code that creates DOM elements for the layer, adds them to `map panes` where they should belong and puts listeners on relevant map events. Called on [`map.addLayer(layer)`](#map-addlayer).
-   *
-   * @method onRemove(map: Map): this
-   * Should contain all clean up code that removes the layer's elements from the DOM and removes listeners previously added in [`onAdd`](#layer-onadd). Called on [`map.removeLayer(layer)`](#map-removelayer).
-   *
-   * @method getEvents(): Object
-   * This optional method should return an object like `{ viewreset: this._reset }` for [`addEventListener`](#evented-addeventlistener). The event handlers in this object will be automatically added and removed from the map with your layer.
-   *
-   * @method getAttribution(): String
-   * This optional method should return a string containing HTML to be shown on the `Attribution control` whenever the layer is visible.
-   *
-   * @method beforeAdd(map: Map): this
-   * Optional method. Called on [`map.addLayer(layer)`](#map-addlayer), before the layer is added to the map, before events are initialized, without waiting until the map is in a usable state. Use for early initialization only.
-   */
-
-
-  /* @namespace Map
-   * @section Layer events
-   *
-   * @event layeradd: LayerEvent
-   * Fired when a new layer is added to the map.
-   *
-   * @event layerremove: LayerEvent
-   * Fired when some layer is removed from the map
-   *
-   * @section Methods for Layers and Controls
-   */
-  Map.include({
-  	// @method addLayer(layer: Layer): this
-  	// Adds the given layer to the map
-  	addLayer: function (layer) {
-  		if (!layer._layerAdd) {
-  			throw new Error('The provided object is not a Layer.');
-  		}
-
-  		var id = stamp(layer);
-  		if (this._layers[id]) { return this; }
-  		this._layers[id] = layer;
-
-  		layer._mapToAdd = this;
-
-  		if (layer.beforeAdd) {
-  			layer.beforeAdd(this);
-  		}
-
-  		this.whenReady(layer._layerAdd, layer);
-
-  		return this;
-  	},
-
-  	// @method removeLayer(layer: Layer): this
-  	// Removes the given layer from the map.
-  	removeLayer: function (layer) {
-  		var id = stamp(layer);
-
-  		if (!this._layers[id]) { return this; }
-
-  		if (this._loaded) {
-  			layer.onRemove(this);
-  		}
-
-  		if (layer.getAttribution && this.attributionControl) {
-  			this.attributionControl.removeAttribution(layer.getAttribution());
-  		}
-
-  		delete this._layers[id];
-
-  		if (this._loaded) {
-  			this.fire('layerremove', {layer: layer});
-  			layer.fire('remove');
-  		}
-
-  		layer._map = layer._mapToAdd = null;
-
-  		return this;
-  	},
-
-  	// @method hasLayer(layer: Layer): Boolean
-  	// Returns `true` if the given layer is currently added to the map
-  	hasLayer: function (layer) {
-  		return !!layer && (stamp(layer) in this._layers);
-  	},
-
-  	/* @method eachLayer(fn: Function, context?: Object): this
-  	 * Iterates over the layers of the map, optionally specifying context of the iterator function.
-  	 * ```
-  	 * map.eachLayer(function(layer){
-  	 *     layer.bindPopup('Hello');
-  	 * });
-  	 * ```
-  	 */
-  	eachLayer: function (method, context) {
-  		for (var i in this._layers) {
-  			method.call(context, this._layers[i]);
-  		}
-  		return this;
-  	},
-
-  	_addLayers: function (layers) {
-  		layers = layers ? (isArray(layers) ? layers : [layers]) : [];
-
-  		for (var i = 0, len = layers.length; i < len; i++) {
-  			this.addLayer(layers[i]);
-  		}
-  	},
-
-  	_addZoomLimit: function (layer) {
-  		if (isNaN(layer.options.maxZoom) || !isNaN(layer.options.minZoom)) {
-  			this._zoomBoundLayers[stamp(layer)] = layer;
-  			this._updateZoomLevels();
-  		}
-  	},
-
-  	_removeZoomLimit: function (layer) {
-  		var id = stamp(layer);
-
-  		if (this._zoomBoundLayers[id]) {
-  			delete this._zoomBoundLayers[id];
-  			this._updateZoomLevels();
-  		}
-  	},
-
-  	_updateZoomLevels: function () {
-  		var minZoom = Infinity,
-  		    maxZoom = -Infinity,
-  		    oldZoomSpan = this._getZoomSpan();
-
-  		for (var i in this._zoomBoundLayers) {
-  			var options = this._zoomBoundLayers[i].options;
-
-  			minZoom = options.minZoom === undefined ? minZoom : Math.min(minZoom, options.minZoom);
-  			maxZoom = options.maxZoom === undefined ? maxZoom : Math.max(maxZoom, options.maxZoom);
-  		}
-
-  		this._layersMaxZoom = maxZoom === -Infinity ? undefined : maxZoom;
-  		this._layersMinZoom = minZoom === Infinity ? undefined : minZoom;
-
-  		// @section Map state change events
-  		// @event zoomlevelschange: Event
-  		// Fired when the number of zoomlevels on the map is changed due
-  		// to adding or removing a layer.
-  		if (oldZoomSpan !== this._getZoomSpan()) {
-  			this.fire('zoomlevelschange');
-  		}
-
-  		if (this.options.maxZoom === undefined && this._layersMaxZoom && this.getZoom() > this._layersMaxZoom) {
-  			this.setZoom(this._layersMaxZoom);
-  		}
-  		if (this.options.minZoom === undefined && this._layersMinZoom && this.getZoom() < this._layersMinZoom) {
-  			this.setZoom(this._layersMinZoom);
-  		}
-  	}
-  });
-
-  /*
-   * @class LayerGroup
-   * @aka L.LayerGroup
-   * @inherits Layer
-   *
-   * Used to group several layers and handle them as one. If you add it to the map,
-   * any layers added or removed from the group will be added/removed on the map as
-   * well. Extends `Layer`.
-   *
-   * @example
-   *
-   * ```js
-   * L.layerGroup([marker1, marker2])
-   * 	.addLayer(polyline)
-   * 	.addTo(map);
-   * ```
-   */
-
-  var LayerGroup = Layer.extend({
-
-  	initialize: function (layers, options) {
-  		setOptions(this, options);
-
-  		this._layers = {};
-
-  		var i, len;
-
-  		if (layers) {
-  			for (i = 0, len = layers.length; i < len; i++) {
-  				this.addLayer(layers[i]);
-  			}
-  		}
-  	},
-
-  	// @method addLayer(layer: Layer): this
-  	// Adds the given layer to the group.
-  	addLayer: function (layer) {
-  		var id = this.getLayerId(layer);
-
-  		this._layers[id] = layer;
-
-  		if (this._map) {
-  			this._map.addLayer(layer);
-  		}
-
-  		return this;
-  	},
-
-  	// @method removeLayer(layer: Layer): this
-  	// Removes the given layer from the group.
-  	// @alternative
-  	// @method removeLayer(id: Number): this
-  	// Removes the layer with the given internal ID from the group.
-  	removeLayer: function (layer) {
-  		var id = layer in this._layers ? layer : this.getLayerId(layer);
-
-  		if (this._map && this._layers[id]) {
-  			this._map.removeLayer(this._layers[id]);
-  		}
-
-  		delete this._layers[id];
-
-  		return this;
-  	},
-
-  	// @method hasLayer(layer: Layer): Boolean
-  	// Returns `true` if the given layer is currently added to the group.
-  	// @alternative
-  	// @method hasLayer(id: Number): Boolean
-  	// Returns `true` if the given internal ID is currently added to the group.
-  	hasLayer: function (layer) {
-  		if (!layer) { return false; }
-  		var layerId = typeof layer === 'number' ? layer : this.getLayerId(layer);
-  		return layerId in this._layers;
-  	},
-
-  	// @method clearLayers(): this
-  	// Removes all the layers from the group.
-  	clearLayers: function () {
-  		return this.eachLayer(this.removeLayer, this);
-  	},
-
-  	// @method invoke(methodName: String, …): this
-  	// Calls `methodName` on every layer contained in this group, passing any
-  	// additional parameters. Has no effect if the layers contained do not
-  	// implement `methodName`.
-  	invoke: function (methodName) {
-  		var args = Array.prototype.slice.call(arguments, 1),
-  		    i, layer;
-
-  		for (i in this._layers) {
-  			layer = this._layers[i];
-
-  			if (layer[methodName]) {
-  				layer[methodName].apply(layer, args);
-  			}
-  		}
-
-  		return this;
-  	},
-
-  	onAdd: function (map) {
-  		this.eachLayer(map.addLayer, map);
-  	},
-
-  	onRemove: function (map) {
-  		this.eachLayer(map.removeLayer, map);
-  	},
-
-  	// @method eachLayer(fn: Function, context?: Object): this
-  	// Iterates over the layers of the group, optionally specifying context of the iterator function.
-  	// ```js
-  	// group.eachLayer(function (layer) {
-  	// 	layer.bindPopup('Hello');
-  	// });
-  	// ```
-  	eachLayer: function (method, context) {
-  		for (var i in this._layers) {
-  			method.call(context, this._layers[i]);
-  		}
-  		return this;
-  	},
-
-  	// @method getLayer(id: Number): Layer
-  	// Returns the layer with the given internal ID.
-  	getLayer: function (id) {
-  		return this._layers[id];
-  	},
-
-  	// @method getLayers(): Layer[]
-  	// Returns an array of all the layers added to the group.
-  	getLayers: function () {
-  		var layers = [];
-  		this.eachLayer(layers.push, layers);
-  		return layers;
-  	},
-
-  	// @method setZIndex(zIndex: Number): this
-  	// Calls `setZIndex` on every layer contained in this group, passing the z-index.
-  	setZIndex: function (zIndex) {
-  		return this.invoke('setZIndex', zIndex);
-  	},
-
-  	// @method getLayerId(layer: Layer): Number
-  	// Returns the internal ID for a layer
-  	getLayerId: function (layer) {
-  		return stamp(layer);
-  	}
-  });
-
-
-  // @factory L.layerGroup(layers?: Layer[], options?: Object)
-  // Create a layer group, optionally given an initial set of layers and an `options` object.
-  var layerGroup = function (layers, options) {
-  	return new LayerGroup(layers, options);
-  };
-
-  /*
-   * @class FeatureGroup
-   * @aka L.FeatureGroup
-   * @inherits LayerGroup
-   *
-   * Extended `LayerGroup` that makes it easier to do the same thing to all its member layers:
-   *  * [`bindPopup`](#layer-bindpopup) binds a popup to all of the layers at once (likewise with [`bindTooltip`](#layer-bindtooltip))
-   *  * Events are propagated to the `FeatureGroup`, so if the group has an event
-   * handler, it will handle events from any of the layers. This includes mouse events
-   * and custom events.
-   *  * Has `layeradd` and `layerremove` events
-   *
-   * @example
-   *
-   * ```js
-   * L.featureGroup([marker1, marker2, polyline])
-   * 	.bindPopup('Hello world!')
-   * 	.on('click', function() { alert('Clicked on a member of the group!'); })
-   * 	.addTo(map);
-   * ```
-   */
-
-  var FeatureGroup = LayerGroup.extend({
-
-  	addLayer: function (layer) {
-  		if (this.hasLayer(layer)) {
-  			return this;
-  		}
-
-  		layer.addEventParent(this);
-
-  		LayerGroup.prototype.addLayer.call(this, layer);
-
-  		// @event layeradd: LayerEvent
-  		// Fired when a layer is added to this `FeatureGroup`
-  		return this.fire('layeradd', {layer: layer});
-  	},
-
-  	removeLayer: function (layer) {
-  		if (!this.hasLayer(layer)) {
-  			return this;
-  		}
-  		if (layer in this._layers) {
-  			layer = this._layers[layer];
-  		}
-
-  		layer.removeEventParent(this);
-
-  		LayerGroup.prototype.removeLayer.call(this, layer);
-
-  		// @event layerremove: LayerEvent
-  		// Fired when a layer is removed from this `FeatureGroup`
-  		return this.fire('layerremove', {layer: layer});
-  	},
-
-  	// @method setStyle(style: Path options): this
-  	// Sets the given path options to each layer of the group that has a `setStyle` method.
-  	setStyle: function (style) {
-  		return this.invoke('setStyle', style);
-  	},
-
-  	// @method bringToFront(): this
-  	// Brings the layer group to the top of all other layers
-  	bringToFront: function () {
-  		return this.invoke('bringToFront');
-  	},
-
-  	// @method bringToBack(): this
-  	// Brings the layer group to the back of all other layers
-  	bringToBack: function () {
-  		return this.invoke('bringToBack');
-  	},
-
-  	// @method getBounds(): LatLngBounds
-  	// Returns the LatLngBounds of the Feature Group (created from bounds and coordinates of its children).
-  	getBounds: function () {
-  		var bounds = new LatLngBounds();
-
-  		for (var id in this._layers) {
-  			var layer = this._layers[id];
-  			bounds.extend(layer.getBounds ? layer.getBounds() : layer.getLatLng());
-  		}
-  		return bounds;
-  	}
-  });
-
-  // @factory L.featureGroup(layers?: Layer[], options?: Object)
-  // Create a feature group, optionally given an initial set of layers and an `options` object.
-  var featureGroup = function (layers, options) {
-  	return new FeatureGroup(layers, options);
-  };
-
-  /*
-   * @class Icon
-   * @aka L.Icon
-   *
-   * Represents an icon to provide when creating a marker.
-   *
-   * @example
-   *
-   * ```js
-   * var myIcon = L.icon({
-   *     iconUrl: 'my-icon.png',
-   *     iconRetinaUrl: 'my-icon@2x.png',
-   *     iconSize: [38, 95],
-   *     iconAnchor: [22, 94],
-   *     popupAnchor: [-3, -76],
-   *     shadowUrl: 'my-icon-shadow.png',
-   *     shadowRetinaUrl: 'my-icon-shadow@2x.png',
-   *     shadowSize: [68, 95],
-   *     shadowAnchor: [22, 94]
-   * });
-   *
-   * L.marker([50.505, 30.57], {icon: myIcon}).addTo(map);
-   * ```
-   *
-   * `L.Icon.Default` extends `L.Icon` and is the blue icon Leaflet uses for markers by default.
-   *
-   */
-
-  var Icon = Class.extend({
-
-  	/* @section
-  	 * @aka Icon options
-  	 *
-  	 * @option iconUrl: String = null
-  	 * **(required)** The URL to the icon image (absolute or relative to your script path).
-  	 *
-  	 * @option iconRetinaUrl: String = null
-  	 * The URL to a retina sized version of the icon image (absolute or relative to your
-  	 * script path). Used for Retina screen devices.
-  	 *
-  	 * @option iconSize: Point = null
-  	 * Size of the icon image in pixels.
-  	 *
-  	 * @option iconAnchor: Point = null
-  	 * The coordinates of the "tip" of the icon (relative to its top left corner). The icon
-  	 * will be aligned so that this point is at the marker's geographical location. Centered
-  	 * by default if size is specified, also can be set in CSS with negative margins.
-  	 *
-  	 * @option popupAnchor: Point = [0, 0]
-  	 * The coordinates of the point from which popups will "open", relative to the icon anchor.
-  	 *
-  	 * @option tooltipAnchor: Point = [0, 0]
-  	 * The coordinates of the point from which tooltips will "open", relative to the icon anchor.
-  	 *
-  	 * @option shadowUrl: String = null
-  	 * The URL to the icon shadow image. If not specified, no shadow image will be created.
-  	 *
-  	 * @option shadowRetinaUrl: String = null
-  	 *
-  	 * @option shadowSize: Point = null
-  	 * Size of the shadow image in pixels.
-  	 *
-  	 * @option shadowAnchor: Point = null
-  	 * The coordinates of the "tip" of the shadow (relative to its top left corner) (the same
-  	 * as iconAnchor if not specified).
-  	 *
-  	 * @option className: String = ''
-  	 * A custom class name to assign to both icon and shadow images. Empty by default.
-  	 */
-
-  	options: {
-  		popupAnchor: [0, 0],
-  		tooltipAnchor: [0, 0]
-  	},
-
-  	initialize: function (options) {
-  		setOptions(this, options);
-  	},
-
-  	// @method createIcon(oldIcon?: HTMLElement): HTMLElement
-  	// Called internally when the icon has to be shown, returns a `<img>` HTML element
-  	// styled according to the options.
-  	createIcon: function (oldIcon) {
-  		return this._createIcon('icon', oldIcon);
-  	},
-
-  	// @method createShadow(oldIcon?: HTMLElement): HTMLElement
-  	// As `createIcon`, but for the shadow beneath it.
-  	createShadow: function (oldIcon) {
-  		return this._createIcon('shadow', oldIcon);
-  	},
-
-  	_createIcon: function (name, oldIcon) {
-  		var src = this._getIconUrl(name);
-
-  		if (!src) {
-  			if (name === 'icon') {
-  				throw new Error('iconUrl not set in Icon options (see the docs).');
-  			}
-  			return null;
-  		}
-
-  		var img = this._createImg(src, oldIcon && oldIcon.tagName === 'IMG' ? oldIcon : null);
-  		this._setIconStyles(img, name);
-
-  		return img;
-  	},
-
-  	_setIconStyles: function (img, name) {
-  		var options = this.options;
-  		var sizeOption = options[name + 'Size'];
-
-  		if (typeof sizeOption === 'number') {
-  			sizeOption = [sizeOption, sizeOption];
-  		}
-
-  		var size = toPoint(sizeOption),
-  		    anchor = toPoint(name === 'shadow' && options.shadowAnchor || options.iconAnchor ||
-  		            size && size.divideBy(2, true));
-
-  		img.className = 'leaflet-marker-' + name + ' ' + (options.className || '');
-
-  		if (anchor) {
-  			img.style.marginLeft = (-anchor.x) + 'px';
-  			img.style.marginTop  = (-anchor.y) + 'px';
-  		}
-
-  		if (size) {
-  			img.style.width  = size.x + 'px';
-  			img.style.height = size.y + 'px';
-  		}
-  	},
-
-  	_createImg: function (src, el) {
-  		el = el || document.createElement('img');
-  		el.src = src;
-  		return el;
-  	},
-
-  	_getIconUrl: function (name) {
-  		return retina && this.options[name + 'RetinaUrl'] || this.options[name + 'Url'];
-  	}
-  });
-
-
-  // @factory L.icon(options: Icon options)
-  // Creates an icon instance with the given options.
-  function icon(options) {
-  	return new Icon(options);
-  }
-
-  /*
-   * @miniclass Icon.Default (Icon)
-   * @aka L.Icon.Default
-   * @section
-   *
-   * A trivial subclass of `Icon`, represents the icon to use in `Marker`s when
-   * no icon is specified. Points to the blue marker image distributed with Leaflet
-   * releases.
-   *
-   * In order to customize the default icon, just change the properties of `L.Icon.Default.prototype.options`
-   * (which is a set of `Icon options`).
-   *
-   * If you want to _completely_ replace the default icon, override the
-   * `L.Marker.prototype.options.icon` with your own icon instead.
-   */
-
-  var IconDefault = Icon.extend({
-
-  	options: {
-  		iconUrl:       'marker-icon.png',
-  		iconRetinaUrl: 'marker-icon-2x.png',
-  		shadowUrl:     'marker-shadow.png',
-  		iconSize:    [25, 41],
-  		iconAnchor:  [12, 41],
-  		popupAnchor: [1, -34],
-  		tooltipAnchor: [16, -28],
-  		shadowSize:  [41, 41]
-  	},
-
-  	_getIconUrl: function (name) {
-  		if (!IconDefault.imagePath) {	// Deprecated, backwards-compatibility only
-  			IconDefault.imagePath = this._detectIconPath();
-  		}
-
-  		// @option imagePath: String
-  		// `Icon.Default` will try to auto-detect the location of the
-  		// blue icon images. If you are placing these images in a non-standard
-  		// way, set this option to point to the right path.
-  		return (this.options.imagePath || IconDefault.imagePath) + Icon.prototype._getIconUrl.call(this, name);
-  	},
-
-  	_detectIconPath: function () {
-  		var el = create$1('div',  'leaflet-default-icon-path', document.body);
-  		var path = getStyle(el, 'background-image') ||
-  		           getStyle(el, 'backgroundImage');	// IE8
-
-  		document.body.removeChild(el);
-
-  		if (path === null || path.indexOf('url') !== 0) {
-  			path = '';
-  		} else {
-  			path = path.replace(/^url\(["']?/, '').replace(/marker-icon\.png["']?\)$/, '');
-  		}
-
-  		return path;
-  	}
-  });
-
-  /*
-   * L.Handler.MarkerDrag is used internally by L.Marker to make the markers draggable.
-   */
-
-
-  /* @namespace Marker
-   * @section Interaction handlers
-   *
-   * Interaction handlers are properties of a marker instance that allow you to control interaction behavior in runtime, enabling or disabling certain features such as dragging (see `Handler` methods). Example:
-   *
-   * ```js
-   * marker.dragging.disable();
-   * ```
-   *
-   * @property dragging: Handler
-   * Marker dragging handler (by both mouse and touch). Only valid when the marker is on the map (Otherwise set [`marker.options.draggable`](#marker-draggable)).
-   */
-
-  var MarkerDrag = Handler.extend({
-  	initialize: function (marker) {
-  		this._marker = marker;
-  	},
-
-  	addHooks: function () {
-  		var icon = this._marker._icon;
-
-  		if (!this._draggable) {
-  			this._draggable = new Draggable(icon, icon, true);
-  		}
-
-  		this._draggable.on({
-  			dragstart: this._onDragStart,
-  			predrag: this._onPreDrag,
-  			drag: this._onDrag,
-  			dragend: this._onDragEnd
-  		}, this).enable();
-
-  		addClass(icon, 'leaflet-marker-draggable');
-  	},
-
-  	removeHooks: function () {
-  		this._draggable.off({
-  			dragstart: this._onDragStart,
-  			predrag: this._onPreDrag,
-  			drag: this._onDrag,
-  			dragend: this._onDragEnd
-  		}, this).disable();
-
-  		if (this._marker._icon) {
-  			removeClass(this._marker._icon, 'leaflet-marker-draggable');
-  		}
-  	},
-
-  	moved: function () {
-  		return this._draggable && this._draggable._moved;
-  	},
-
-  	_adjustPan: function (e) {
-  		var marker = this._marker,
-  		    map = marker._map,
-  		    speed = this._marker.options.autoPanSpeed,
-  		    padding = this._marker.options.autoPanPadding,
-  		    iconPos = getPosition(marker._icon),
-  		    bounds = map.getPixelBounds(),
-  		    origin = map.getPixelOrigin();
-
-  		var panBounds = toBounds(
-  			bounds.min._subtract(origin).add(padding),
-  			bounds.max._subtract(origin).subtract(padding)
-  		);
-
-  		if (!panBounds.contains(iconPos)) {
-  			// Compute incremental movement
-  			var movement = toPoint(
-  				(Math.max(panBounds.max.x, iconPos.x) - panBounds.max.x) / (bounds.max.x - panBounds.max.x) -
-  				(Math.min(panBounds.min.x, iconPos.x) - panBounds.min.x) / (bounds.min.x - panBounds.min.x),
-
-  				(Math.max(panBounds.max.y, iconPos.y) - panBounds.max.y) / (bounds.max.y - panBounds.max.y) -
-  				(Math.min(panBounds.min.y, iconPos.y) - panBounds.min.y) / (bounds.min.y - panBounds.min.y)
-  			).multiplyBy(speed);
-
-  			map.panBy(movement, {animate: false});
-
-  			this._draggable._newPos._add(movement);
-  			this._draggable._startPos._add(movement);
-
-  			setPosition(marker._icon, this._draggable._newPos);
-  			this._onDrag(e);
-
-  			this._panRequest = requestAnimFrame(this._adjustPan.bind(this, e));
-  		}
-  	},
-
-  	_onDragStart: function () {
-  		// @section Dragging events
-  		// @event dragstart: Event
-  		// Fired when the user starts dragging the marker.
-
-  		// @event movestart: Event
-  		// Fired when the marker starts moving (because of dragging).
-
-  		this._oldLatLng = this._marker.getLatLng();
-
-  		// When using ES6 imports it could not be set when `Popup` was not imported as well
-  		this._marker.closePopup && this._marker.closePopup();
-
-  		this._marker
-  			.fire('movestart')
-  			.fire('dragstart');
-  	},
-
-  	_onPreDrag: function (e) {
-  		if (this._marker.options.autoPan) {
-  			cancelAnimFrame(this._panRequest);
-  			this._panRequest = requestAnimFrame(this._adjustPan.bind(this, e));
-  		}
-  	},
-
-  	_onDrag: function (e) {
-  		var marker = this._marker,
-  		    shadow = marker._shadow,
-  		    iconPos = getPosition(marker._icon),
-  		    latlng = marker._map.layerPointToLatLng(iconPos);
-
-  		// update shadow position
-  		if (shadow) {
-  			setPosition(shadow, iconPos);
-  		}
-
-  		marker._latlng = latlng;
-  		e.latlng = latlng;
-  		e.oldLatLng = this._oldLatLng;
-
-  		// @event drag: Event
-  		// Fired repeatedly while the user drags the marker.
-  		marker
-  		    .fire('move', e)
-  		    .fire('drag', e);
-  	},
-
-  	_onDragEnd: function (e) {
-  		// @event dragend: DragEndEvent
-  		// Fired when the user stops dragging the marker.
-
-  		 cancelAnimFrame(this._panRequest);
-
-  		// @event moveend: Event
-  		// Fired when the marker stops moving (because of dragging).
-  		delete this._oldLatLng;
-  		this._marker
-  		    .fire('moveend')
-  		    .fire('dragend', e);
-  	}
-  });
-
-  /*
-   * @class Marker
-   * @inherits Interactive layer
-   * @aka L.Marker
-   * L.Marker is used to display clickable/draggable icons on the map. Extends `Layer`.
-   *
-   * @example
-   *
-   * ```js
-   * L.marker([50.5, 30.5]).addTo(map);
-   * ```
-   */
-
-  var Marker = Layer.extend({
-
-  	// @section
-  	// @aka Marker options
-  	options: {
-  		// @option icon: Icon = *
-  		// Icon instance to use for rendering the marker.
-  		// See [Icon documentation](#L.Icon) for details on how to customize the marker icon.
-  		// If not specified, a common instance of `L.Icon.Default` is used.
-  		icon: new IconDefault(),
-
-  		// Option inherited from "Interactive layer" abstract class
-  		interactive: true,
-
-  		// @option keyboard: Boolean = true
-  		// Whether the marker can be tabbed to with a keyboard and clicked by pressing enter.
-  		keyboard: true,
-
-  		// @option title: String = ''
-  		// Text for the browser tooltip that appear on marker hover (no tooltip by default).
-  		title: '',
-
-  		// @option alt: String = ''
-  		// Text for the `alt` attribute of the icon image (useful for accessibility).
-  		alt: '',
-
-  		// @option zIndexOffset: Number = 0
-  		// By default, marker images zIndex is set automatically based on its latitude. Use this option if you want to put the marker on top of all others (or below), specifying a high value like `1000` (or high negative value, respectively).
-  		zIndexOffset: 0,
-
-  		// @option opacity: Number = 1.0
-  		// The opacity of the marker.
-  		opacity: 1,
-
-  		// @option riseOnHover: Boolean = false
-  		// If `true`, the marker will get on top of others when you hover the mouse over it.
-  		riseOnHover: false,
-
-  		// @option riseOffset: Number = 250
-  		// The z-index offset used for the `riseOnHover` feature.
-  		riseOffset: 250,
-
-  		// @option pane: String = 'markerPane'
-  		// `Map pane` where the markers icon will be added.
-  		pane: 'markerPane',
-
-  		// @option shadowPane: String = 'shadowPane'
-  		// `Map pane` where the markers shadow will be added.
-  		shadowPane: 'shadowPane',
-
-  		// @option bubblingMouseEvents: Boolean = false
-  		// When `true`, a mouse event on this marker will trigger the same event on the map
-  		// (unless [`L.DomEvent.stopPropagation`](#domevent-stoppropagation) is used).
-  		bubblingMouseEvents: false,
-
-  		// @section Draggable marker options
-  		// @option draggable: Boolean = false
-  		// Whether the marker is draggable with mouse/touch or not.
-  		draggable: false,
-
-  		// @option autoPan: Boolean = false
-  		// Whether to pan the map when dragging this marker near its edge or not.
-  		autoPan: false,
-
-  		// @option autoPanPadding: Point = Point(50, 50)
-  		// Distance (in pixels to the left/right and to the top/bottom) of the
-  		// map edge to start panning the map.
-  		autoPanPadding: [50, 50],
-
-  		// @option autoPanSpeed: Number = 10
-  		// Number of pixels the map should pan by.
-  		autoPanSpeed: 10
-  	},
-
-  	/* @section
-  	 *
-  	 * In addition to [shared layer methods](#Layer) like `addTo()` and `remove()` and [popup methods](#Popup) like bindPopup() you can also use the following methods:
-  	 */
-
-  	initialize: function (latlng, options) {
-  		setOptions(this, options);
-  		this._latlng = toLatLng(latlng);
-  	},
-
-  	onAdd: function (map) {
-  		this._zoomAnimated = this._zoomAnimated && map.options.markerZoomAnimation;
-
-  		if (this._zoomAnimated) {
-  			map.on('zoomanim', this._animateZoom, this);
-  		}
-
-  		this._initIcon();
-  		this.update();
-  	},
-
-  	onRemove: function (map) {
-  		if (this.dragging && this.dragging.enabled()) {
-  			this.options.draggable = true;
-  			this.dragging.removeHooks();
-  		}
-  		delete this.dragging;
-
-  		if (this._zoomAnimated) {
-  			map.off('zoomanim', this._animateZoom, this);
-  		}
-
-  		this._removeIcon();
-  		this._removeShadow();
-  	},
-
-  	getEvents: function () {
-  		return {
-  			zoom: this.update,
-  			viewreset: this.update
-  		};
-  	},
-
-  	// @method getLatLng: LatLng
-  	// Returns the current geographical position of the marker.
-  	getLatLng: function () {
-  		return this._latlng;
-  	},
-
-  	// @method setLatLng(latlng: LatLng): this
-  	// Changes the marker position to the given point.
-  	setLatLng: function (latlng) {
-  		var oldLatLng = this._latlng;
-  		this._latlng = toLatLng(latlng);
-  		this.update();
-
-  		// @event move: Event
-  		// Fired when the marker is moved via [`setLatLng`](#marker-setlatlng) or by [dragging](#marker-dragging). Old and new coordinates are included in event arguments as `oldLatLng`, `latlng`.
-  		return this.fire('move', {oldLatLng: oldLatLng, latlng: this._latlng});
-  	},
-
-  	// @method setZIndexOffset(offset: Number): this
-  	// Changes the [zIndex offset](#marker-zindexoffset) of the marker.
-  	setZIndexOffset: function (offset) {
-  		this.options.zIndexOffset = offset;
-  		return this.update();
-  	},
-
-  	// @method getIcon: Icon
-  	// Returns the current icon used by the marker
-  	getIcon: function () {
-  		return this.options.icon;
-  	},
-
-  	// @method setIcon(icon: Icon): this
-  	// Changes the marker icon.
-  	setIcon: function (icon) {
-
-  		this.options.icon = icon;
-
-  		if (this._map) {
-  			this._initIcon();
-  			this.update();
-  		}
-
-  		if (this._popup) {
-  			this.bindPopup(this._popup, this._popup.options);
-  		}
-
-  		return this;
-  	},
-
-  	getElement: function () {
-  		return this._icon;
-  	},
-
-  	update: function () {
-
-  		if (this._icon && this._map) {
-  			var pos = this._map.latLngToLayerPoint(this._latlng).round();
-  			this._setPos(pos);
-  		}
-
-  		return this;
-  	},
-
-  	_initIcon: function () {
-  		var options = this.options,
-  		    classToAdd = 'leaflet-zoom-' + (this._zoomAnimated ? 'animated' : 'hide');
-
-  		var icon = options.icon.createIcon(this._icon),
-  		    addIcon = false;
-
-  		// if we're not reusing the icon, remove the old one and init new one
-  		if (icon !== this._icon) {
-  			if (this._icon) {
-  				this._removeIcon();
-  			}
-  			addIcon = true;
-
-  			if (options.title) {
-  				icon.title = options.title;
-  			}
-
-  			if (icon.tagName === 'IMG') {
-  				icon.alt = options.alt || '';
-  			}
-  		}
-
-  		addClass(icon, classToAdd);
-
-  		if (options.keyboard) {
-  			icon.tabIndex = '0';
-  		}
-
-  		this._icon = icon;
-
-  		if (options.riseOnHover) {
-  			this.on({
-  				mouseover: this._bringToFront,
-  				mouseout: this._resetZIndex
-  			});
-  		}
-
-  		var newShadow = options.icon.createShadow(this._shadow),
-  		    addShadow = false;
-
-  		if (newShadow !== this._shadow) {
-  			this._removeShadow();
-  			addShadow = true;
-  		}
-
-  		if (newShadow) {
-  			addClass(newShadow, classToAdd);
-  			newShadow.alt = '';
-  		}
-  		this._shadow = newShadow;
-
-
-  		if (options.opacity < 1) {
-  			this._updateOpacity();
-  		}
-
-
-  		if (addIcon) {
-  			this.getPane().appendChild(this._icon);
-  		}
-  		this._initInteraction();
-  		if (newShadow && addShadow) {
-  			this.getPane(options.shadowPane).appendChild(this._shadow);
-  		}
-  	},
-
-  	_removeIcon: function () {
-  		if (this.options.riseOnHover) {
-  			this.off({
-  				mouseover: this._bringToFront,
-  				mouseout: this._resetZIndex
-  			});
-  		}
-
-  		remove(this._icon);
-  		this.removeInteractiveTarget(this._icon);
-
-  		this._icon = null;
-  	},
-
-  	_removeShadow: function () {
-  		if (this._shadow) {
-  			remove(this._shadow);
-  		}
-  		this._shadow = null;
-  	},
-
-  	_setPos: function (pos) {
-
-  		if (this._icon) {
-  			setPosition(this._icon, pos);
-  		}
-
-  		if (this._shadow) {
-  			setPosition(this._shadow, pos);
-  		}
-
-  		this._zIndex = pos.y + this.options.zIndexOffset;
-
-  		this._resetZIndex();
-  	},
-
-  	_updateZIndex: function (offset) {
-  		if (this._icon) {
-  			this._icon.style.zIndex = this._zIndex + offset;
-  		}
-  	},
-
-  	_animateZoom: function (opt) {
-  		var pos = this._map._latLngToNewLayerPoint(this._latlng, opt.zoom, opt.center).round();
-
-  		this._setPos(pos);
-  	},
-
-  	_initInteraction: function () {
-
-  		if (!this.options.interactive) { return; }
-
-  		addClass(this._icon, 'leaflet-interactive');
-
-  		this.addInteractiveTarget(this._icon);
-
-  		if (MarkerDrag) {
-  			var draggable = this.options.draggable;
-  			if (this.dragging) {
-  				draggable = this.dragging.enabled();
-  				this.dragging.disable();
-  			}
-
-  			this.dragging = new MarkerDrag(this);
-
-  			if (draggable) {
-  				this.dragging.enable();
-  			}
-  		}
-  	},
-
-  	// @method setOpacity(opacity: Number): this
-  	// Changes the opacity of the marker.
-  	setOpacity: function (opacity) {
-  		this.options.opacity = opacity;
-  		if (this._map) {
-  			this._updateOpacity();
-  		}
-
-  		return this;
-  	},
-
-  	_updateOpacity: function () {
-  		var opacity = this.options.opacity;
-
-  		if (this._icon) {
-  			setOpacity(this._icon, opacity);
-  		}
-
-  		if (this._shadow) {
-  			setOpacity(this._shadow, opacity);
-  		}
-  	},
-
-  	_bringToFront: function () {
-  		this._updateZIndex(this.options.riseOffset);
-  	},
-
-  	_resetZIndex: function () {
-  		this._updateZIndex(0);
-  	},
-
-  	_getPopupAnchor: function () {
-  		return this.options.icon.options.popupAnchor;
-  	},
-
-  	_getTooltipAnchor: function () {
-  		return this.options.icon.options.tooltipAnchor;
-  	}
-  });
-
-
-  // factory L.marker(latlng: LatLng, options? : Marker options)
-
-  // @factory L.marker(latlng: LatLng, options? : Marker options)
-  // Instantiates a Marker object given a geographical point and optionally an options object.
-  function marker(latlng, options) {
-  	return new Marker(latlng, options);
-  }
-
-  /*
-   * @class Path
-   * @aka L.Path
-   * @inherits Interactive layer
-   *
-   * An abstract class that contains options and constants shared between vector
-   * overlays (Polygon, Polyline, Circle). Do not use it directly. Extends `Layer`.
-   */
-
-  var Path = Layer.extend({
-
-  	// @section
-  	// @aka Path options
-  	options: {
-  		// @option stroke: Boolean = true
-  		// Whether to draw stroke along the path. Set it to `false` to disable borders on polygons or circles.
-  		stroke: true,
-
-  		// @option color: String = '#3388ff'
-  		// Stroke color
-  		color: '#3388ff',
-
-  		// @option weight: Number = 3
-  		// Stroke width in pixels
-  		weight: 3,
-
-  		// @option opacity: Number = 1.0
-  		// Stroke opacity
-  		opacity: 1,
-
-  		// @option lineCap: String= 'round'
-  		// A string that defines [shape to be used at the end](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-linecap) of the stroke.
-  		lineCap: 'round',
-
-  		// @option lineJoin: String = 'round'
-  		// A string that defines [shape to be used at the corners](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-linejoin) of the stroke.
-  		lineJoin: 'round',
-
-  		// @option dashArray: String = null
-  		// A string that defines the stroke [dash pattern](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-dasharray). Doesn't work on `Canvas`-powered layers in [some old browsers](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/setLineDash#Browser_compatibility).
-  		dashArray: null,
-
-  		// @option dashOffset: String = null
-  		// A string that defines the [distance into the dash pattern to start the dash](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-dashoffset). Doesn't work on `Canvas`-powered layers in [some old browsers](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/setLineDash#Browser_compatibility).
-  		dashOffset: null,
-
-  		// @option fill: Boolean = depends
-  		// Whether to fill the path with color. Set it to `false` to disable filling on polygons or circles.
-  		fill: false,
-
-  		// @option fillColor: String = *
-  		// Fill color. Defaults to the value of the [`color`](#path-color) option
-  		fillColor: null,
-
-  		// @option fillOpacity: Number = 0.2
-  		// Fill opacity.
-  		fillOpacity: 0.2,
-
-  		// @option fillRule: String = 'evenodd'
-  		// A string that defines [how the inside of a shape](https://developer.mozilla.org/docs/Web/SVG/Attribute/fill-rule) is determined.
-  		fillRule: 'evenodd',
-
-  		// className: '',
-
-  		// Option inherited from "Interactive layer" abstract class
-  		interactive: true,
-
-  		// @option bubblingMouseEvents: Boolean = true
-  		// When `true`, a mouse event on this path will trigger the same event on the map
-  		// (unless [`L.DomEvent.stopPropagation`](#domevent-stoppropagation) is used).
-  		bubblingMouseEvents: true
-  	},
-
-  	beforeAdd: function (map) {
-  		// Renderer is set here because we need to call renderer.getEvents
-  		// before this.getEvents.
-  		this._renderer = map.getRenderer(this);
-  	},
-
-  	onAdd: function () {
-  		this._renderer._initPath(this);
-  		this._reset();
-  		this._renderer._addPath(this);
-  	},
-
-  	onRemove: function () {
-  		this._renderer._removePath(this);
-  	},
-
-  	// @method redraw(): this
-  	// Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.
-  	redraw: function () {
-  		if (this._map) {
-  			this._renderer._updatePath(this);
-  		}
-  		return this;
-  	},
-
-  	// @method setStyle(style: Path options): this
-  	// Changes the appearance of a Path based on the options in the `Path options` object.
-  	setStyle: function (style) {
-  		setOptions(this, style);
-  		if (this._renderer) {
-  			this._renderer._updateStyle(this);
-  			if (this.options.stroke && style && Object.prototype.hasOwnProperty.call(style, 'weight')) {
-  				this._updateBounds();
-  			}
-  		}
-  		return this;
-  	},
-
-  	// @method bringToFront(): this
-  	// Brings the layer to the top of all path layers.
-  	bringToFront: function () {
-  		if (this._renderer) {
-  			this._renderer._bringToFront(this);
-  		}
-  		return this;
-  	},
-
-  	// @method bringToBack(): this
-  	// Brings the layer to the bottom of all path layers.
-  	bringToBack: function () {
-  		if (this._renderer) {
-  			this._renderer._bringToBack(this);
-  		}
-  		return this;
-  	},
-
-  	getElement: function () {
-  		return this._path;
-  	},
-
-  	_reset: function () {
-  		// defined in child classes
-  		this._project();
-  		this._update();
-  	},
-
-  	_clickTolerance: function () {
-  		// used when doing hit detection for Canvas layers
-  		return (this.options.stroke ? this.options.weight / 2 : 0) + this._renderer.options.tolerance;
-  	}
-  });
-
-  /*
-   * @class CircleMarker
-   * @aka L.CircleMarker
-   * @inherits Path
-   *
-   * A circle of a fixed size with radius specified in pixels. Extends `Path`.
-   */
-
-  var CircleMarker = Path.extend({
-
-  	// @section
-  	// @aka CircleMarker options
-  	options: {
-  		fill: true,
-
-  		// @option radius: Number = 10
-  		// Radius of the circle marker, in pixels
-  		radius: 10
-  	},
-
-  	initialize: function (latlng, options) {
-  		setOptions(this, options);
-  		this._latlng = toLatLng(latlng);
-  		this._radius = this.options.radius;
-  	},
-
-  	// @method setLatLng(latLng: LatLng): this
-  	// Sets the position of a circle marker to a new location.
-  	setLatLng: function (latlng) {
-  		var oldLatLng = this._latlng;
-  		this._latlng = toLatLng(latlng);
-  		this.redraw();
-
-  		// @event move: Event
-  		// Fired when the marker is moved via [`setLatLng`](#circlemarker-setlatlng). Old and new coordinates are included in event arguments as `oldLatLng`, `latlng`.
-  		return this.fire('move', {oldLatLng: oldLatLng, latlng: this._latlng});
-  	},
-
-  	// @method getLatLng(): LatLng
-  	// Returns the current geographical position of the circle marker
-  	getLatLng: function () {
-  		return this._latlng;
-  	},
-
-  	// @method setRadius(radius: Number): this
-  	// Sets the radius of a circle marker. Units are in pixels.
-  	setRadius: function (radius) {
-  		this.options.radius = this._radius = radius;
-  		return this.redraw();
-  	},
-
-  	// @method getRadius(): Number
-  	// Returns the current radius of the circle
-  	getRadius: function () {
-  		return this._radius;
-  	},
-
-  	setStyle : function (options) {
-  		var radius = options && options.radius || this._radius;
-  		Path.prototype.setStyle.call(this, options);
-  		this.setRadius(radius);
-  		return this;
-  	},
-
-  	_project: function () {
-  		this._point = this._map.latLngToLayerPoint(this._latlng);
-  		this._updateBounds();
-  	},
-
-  	_updateBounds: function () {
-  		var r = this._radius,
-  		    r2 = this._radiusY || r,
-  		    w = this._clickTolerance(),
-  		    p = [r + w, r2 + w];
-  		this._pxBounds = new Bounds(this._point.subtract(p), this._point.add(p));
-  	},
-
-  	_update: function () {
-  		if (this._map) {
-  			this._updatePath();
-  		}
-  	},
-
-  	_updatePath: function () {
-  		this._renderer._updateCircle(this);
-  	},
-
-  	_empty: function () {
-  		return this._radius && !this._renderer._bounds.intersects(this._pxBounds);
-  	},
-
-  	// Needed by the `Canvas` renderer for interactivity
-  	_containsPoint: function (p) {
-  		return p.distanceTo(this._point) <= this._radius + this._clickTolerance();
-  	}
-  });
-
-
-  // @factory L.circleMarker(latlng: LatLng, options?: CircleMarker options)
-  // Instantiates a circle marker object given a geographical point, and an optional options object.
-  function circleMarker(latlng, options) {
-  	return new CircleMarker(latlng, options);
-  }
-
-  /*
-   * @class Circle
-   * @aka L.Circle
-   * @inherits CircleMarker
-   *
-   * A class for drawing circle overlays on a map. Extends `CircleMarker`.
-   *
-   * It's an approximation and starts to diverge from a real circle closer to poles (due to projection distortion).
-   *
-   * @example
-   *
-   * ```js
-   * L.circle([50.5, 30.5], {radius: 200}).addTo(map);
-   * ```
-   */
-
-  var Circle = CircleMarker.extend({
-
-  	initialize: function (latlng, options, legacyOptions) {
-  		if (typeof options === 'number') {
-  			// Backwards compatibility with 0.7.x factory (latlng, radius, options?)
-  			options = extend({}, legacyOptions, {radius: options});
-  		}
-  		setOptions(this, options);
-  		this._latlng = toLatLng(latlng);
-
-  		if (isNaN(this.options.radius)) { throw new Error('Circle radius cannot be NaN'); }
-
-  		// @section
-  		// @aka Circle options
-  		// @option radius: Number; Radius of the circle, in meters.
-  		this._mRadius = this.options.radius;
-  	},
-
-  	// @method setRadius(radius: Number): this
-  	// Sets the radius of a circle. Units are in meters.
-  	setRadius: function (radius) {
-  		this._mRadius = radius;
-  		return this.redraw();
-  	},
-
-  	// @method getRadius(): Number
-  	// Returns the current radius of a circle. Units are in meters.
-  	getRadius: function () {
-  		return this._mRadius;
-  	},
-
-  	// @method getBounds(): LatLngBounds
-  	// Returns the `LatLngBounds` of the path.
-  	getBounds: function () {
-  		var half = [this._radius, this._radiusY || this._radius];
-
-  		return new LatLngBounds(
-  			this._map.layerPointToLatLng(this._point.subtract(half)),
-  			this._map.layerPointToLatLng(this._point.add(half)));
-  	},
-
-  	setStyle: Path.prototype.setStyle,
-
-  	_project: function () {
-
-  		var lng = this._latlng.lng,
-  		    lat = this._latlng.lat,
-  		    map = this._map,
-  		    crs = map.options.crs;
-
-  		if (crs.distance === Earth.distance) {
-  			var d = Math.PI / 180,
-  			    latR = (this._mRadius / Earth.R) / d,
-  			    top = map.project([lat + latR, lng]),
-  			    bottom = map.project([lat - latR, lng]),
-  			    p = top.add(bottom).divideBy(2),
-  			    lat2 = map.unproject(p).lat,
-  			    lngR = Math.acos((Math.cos(latR * d) - Math.sin(lat * d) * Math.sin(lat2 * d)) /
-  			            (Math.cos(lat * d) * Math.cos(lat2 * d))) / d;
-
-  			if (isNaN(lngR) || lngR === 0) {
-  				lngR = latR / Math.cos(Math.PI / 180 * lat); // Fallback for edge case, #2425
-  			}
-
-  			this._point = p.subtract(map.getPixelOrigin());
-  			this._radius = isNaN(lngR) ? 0 : p.x - map.project([lat2, lng - lngR]).x;
-  			this._radiusY = p.y - top.y;
-
-  		} else {
-  			var latlng2 = crs.unproject(crs.project(this._latlng).subtract([this._mRadius, 0]));
-
-  			this._point = map.latLngToLayerPoint(this._latlng);
-  			this._radius = this._point.x - map.latLngToLayerPoint(latlng2).x;
-  		}
-
-  		this._updateBounds();
-  	}
-  });
-
-  // @factory L.circle(latlng: LatLng, options?: Circle options)
-  // Instantiates a circle object given a geographical point, and an options object
-  // which contains the circle radius.
-  // @alternative
-  // @factory L.circle(latlng: LatLng, radius: Number, options?: Circle options)
-  // Obsolete way of instantiating a circle, for compatibility with 0.7.x code.
-  // Do not use in new applications or plugins.
-  function circle(latlng, options, legacyOptions) {
-  	return new Circle(latlng, options, legacyOptions);
-  }
-
-  /*
-   * @class Polyline
-   * @aka L.Polyline
-   * @inherits Path
-   *
-   * A class for drawing polyline overlays on a map. Extends `Path`.
-   *
-   * @example
-   *
-   * ```js
-   * // create a red polyline from an array of LatLng points
-   * var latlngs = [
-   * 	[45.51, -122.68],
-   * 	[37.77, -122.43],
-   * 	[34.04, -118.2]
-   * ];
-   *
-   * var polyline = L.polyline(latlngs, {color: 'red'}).addTo(map);
-   *
-   * // zoom the map to the polyline
-   * map.fitBounds(polyline.getBounds());
-   * ```
-   *
-   * You can also pass a multi-dimensional array to represent a `MultiPolyline` shape:
-   *
-   * ```js
-   * // create a red polyline from an array of arrays of LatLng points
-   * var latlngs = [
-   * 	[[45.51, -122.68],
-   * 	 [37.77, -122.43],
-   * 	 [34.04, -118.2]],
-   * 	[[40.78, -73.91],
-   * 	 [41.83, -87.62],
-   * 	 [32.76, -96.72]]
-   * ];
-   * ```
-   */
-
-
-  var Polyline = Path.extend({
-
-  	// @section
-  	// @aka Polyline options
-  	options: {
-  		// @option smoothFactor: Number = 1.0
-  		// How much to simplify the polyline on each zoom level. More means
-  		// better performance and smoother look, and less means more accurate representation.
-  		smoothFactor: 1.0,
-
-  		// @option noClip: Boolean = false
-  		// Disable polyline clipping.
-  		noClip: false
-  	},
-
-  	initialize: function (latlngs, options) {
-  		setOptions(this, options);
-  		this._setLatLngs(latlngs);
-  	},
-
-  	// @method getLatLngs(): LatLng[]
-  	// Returns an array of the points in the path, or nested arrays of points in case of multi-polyline.
-  	getLatLngs: function () {
-  		return this._latlngs;
-  	},
-
-  	// @method setLatLngs(latlngs: LatLng[]): this
-  	// Replaces all the points in the polyline with the given array of geographical points.
-  	setLatLngs: function (latlngs) {
-  		this._setLatLngs(latlngs);
-  		return this.redraw();
-  	},
-
-  	// @method isEmpty(): Boolean
-  	// Returns `true` if the Polyline has no LatLngs.
-  	isEmpty: function () {
-  		return !this._latlngs.length;
-  	},
-
-  	// @method closestLayerPoint(p: Point): Point
-  	// Returns the point closest to `p` on the Polyline.
-  	closestLayerPoint: function (p) {
-  		var minDistance = Infinity,
-  		    minPoint = null,
-  		    closest = _sqClosestPointOnSegment,
-  		    p1, p2;
-
-  		for (var j = 0, jLen = this._parts.length; j < jLen; j++) {
-  			var points = this._parts[j];
-
-  			for (var i = 1, len = points.length; i < len; i++) {
-  				p1 = points[i - 1];
-  				p2 = points[i];
-
-  				var sqDist = closest(p, p1, p2, true);
-
-  				if (sqDist < minDistance) {
-  					minDistance = sqDist;
-  					minPoint = closest(p, p1, p2);
-  				}
-  			}
-  		}
-  		if (minPoint) {
-  			minPoint.distance = Math.sqrt(minDistance);
-  		}
-  		return minPoint;
-  	},
-
-  	// @method getCenter(): LatLng
-  	// Returns the center ([centroid](http://en.wikipedia.org/wiki/Centroid)) of the polyline.
-  	getCenter: function () {
-  		// throws error when not yet added to map as this center calculation requires projected coordinates
-  		if (!this._map) {
-  			throw new Error('Must add layer to map before using getCenter()');
-  		}
-
-  		var i, halfDist, segDist, dist, p1, p2, ratio,
-  		    points = this._rings[0],
-  		    len = points.length;
-
-  		if (!len) { return null; }
-
-  		// polyline centroid algorithm; only uses the first ring if there are multiple
-
-  		for (i = 0, halfDist = 0; i < len - 1; i++) {
-  			halfDist += points[i].distanceTo(points[i + 1]) / 2;
-  		}
-
-  		// The line is so small in the current view that all points are on the same pixel.
-  		if (halfDist === 0) {
-  			return this._map.layerPointToLatLng(points[0]);
-  		}
-
-  		for (i = 0, dist = 0; i < len - 1; i++) {
-  			p1 = points[i];
-  			p2 = points[i + 1];
-  			segDist = p1.distanceTo(p2);
-  			dist += segDist;
-
-  			if (dist > halfDist) {
-  				ratio = (dist - halfDist) / segDist;
-  				return this._map.layerPointToLatLng([
-  					p2.x - ratio * (p2.x - p1.x),
-  					p2.y - ratio * (p2.y - p1.y)
-  				]);
-  			}
-  		}
-  	},
-
-  	// @method getBounds(): LatLngBounds
-  	// Returns the `LatLngBounds` of the path.
-  	getBounds: function () {
-  		return this._bounds;
-  	},
-
-  	// @method addLatLng(latlng: LatLng, latlngs?: LatLng[]): this
-  	// Adds a given point to the polyline. By default, adds to the first ring of
-  	// the polyline in case of a multi-polyline, but can be overridden by passing
-  	// a specific ring as a LatLng array (that you can earlier access with [`getLatLngs`](#polyline-getlatlngs)).
-  	addLatLng: function (latlng, latlngs) {
-  		latlngs = latlngs || this._defaultShape();
-  		latlng = toLatLng(latlng);
-  		latlngs.push(latlng);
-  		this._bounds.extend(latlng);
-  		return this.redraw();
-  	},
-
-  	_setLatLngs: function (latlngs) {
-  		this._bounds = new LatLngBounds();
-  		this._latlngs = this._convertLatLngs(latlngs);
-  	},
-
-  	_defaultShape: function () {
-  		return isFlat(this._latlngs) ? this._latlngs : this._latlngs[0];
-  	},
-
-  	// recursively convert latlngs input into actual LatLng instances; calculate bounds along the way
-  	_convertLatLngs: function (latlngs) {
-  		var result = [],
-  		    flat = isFlat(latlngs);
-
-  		for (var i = 0, len = latlngs.length; i < len; i++) {
-  			if (flat) {
-  				result[i] = toLatLng(latlngs[i]);
-  				this._bounds.extend(result[i]);
-  			} else {
-  				result[i] = this._convertLatLngs(latlngs[i]);
-  			}
-  		}
-
-  		return result;
-  	},
-
-  	_project: function () {
-  		var pxBounds = new Bounds();
-  		this._rings = [];
-  		this._projectLatlngs(this._latlngs, this._rings, pxBounds);
-
-  		if (this._bounds.isValid() && pxBounds.isValid()) {
-  			this._rawPxBounds = pxBounds;
-  			this._updateBounds();
-  		}
-  	},
-
-  	_updateBounds: function () {
-  		var w = this._clickTolerance(),
-  		    p = new Point(w, w);
-  		this._pxBounds = new Bounds([
-  			this._rawPxBounds.min.subtract(p),
-  			this._rawPxBounds.max.add(p)
-  		]);
-  	},
-
-  	// recursively turns latlngs into a set of rings with projected coordinates
-  	_projectLatlngs: function (latlngs, result, projectedBounds) {
-  		var flat = latlngs[0] instanceof LatLng,
-  		    len = latlngs.length,
-  		    i, ring;
-
-  		if (flat) {
-  			ring = [];
-  			for (i = 0; i < len; i++) {
-  				ring[i] = this._map.latLngToLayerPoint(latlngs[i]);
-  				projectedBounds.extend(ring[i]);
-  			}
-  			result.push(ring);
-  		} else {
-  			for (i = 0; i < len; i++) {
-  				this._projectLatlngs(latlngs[i], result, projectedBounds);
-  			}
-  		}
-  	},
-
-  	// clip polyline by renderer bounds so that we have less to render for performance
-  	_clipPoints: function () {
-  		var bounds = this._renderer._bounds;
-
-  		this._parts = [];
-  		if (!this._pxBounds || !this._pxBounds.intersects(bounds)) {
-  			return;
-  		}
-
-  		if (this.options.noClip) {
-  			this._parts = this._rings;
-  			return;
-  		}
-
-  		var parts = this._parts,
-  		    i, j, k, len, len2, segment, points;
-
-  		for (i = 0, k = 0, len = this._rings.length; i < len; i++) {
-  			points = this._rings[i];
-
-  			for (j = 0, len2 = points.length; j < len2 - 1; j++) {
-  				segment = clipSegment(points[j], points[j + 1], bounds, j, true);
-
-  				if (!segment) { continue; }
-
-  				parts[k] = parts[k] || [];
-  				parts[k].push(segment[0]);
-
-  				// if segment goes out of screen, or it's the last one, it's the end of the line part
-  				if ((segment[1] !== points[j + 1]) || (j === len2 - 2)) {
-  					parts[k].push(segment[1]);
-  					k++;
-  				}
-  			}
-  		}
-  	},
-
-  	// simplify each clipped part of the polyline for performance
-  	_simplifyPoints: function () {
-  		var parts = this._parts,
-  		    tolerance = this.options.smoothFactor;
-
-  		for (var i = 0, len = parts.length; i < len; i++) {
-  			parts[i] = simplify(parts[i], tolerance);
-  		}
-  	},
-
-  	_update: function () {
-  		if (!this._map) { return; }
-
-  		this._clipPoints();
-  		this._simplifyPoints();
-  		this._updatePath();
-  	},
-
-  	_updatePath: function () {
-  		this._renderer._updatePoly(this);
-  	},
-
-  	// Needed by the `Canvas` renderer for interactivity
-  	_containsPoint: function (p, closed) {
-  		var i, j, k, len, len2, part,
-  		    w = this._clickTolerance();
-
-  		if (!this._pxBounds || !this._pxBounds.contains(p)) { return false; }
-
-  		// hit detection for polylines
-  		for (i = 0, len = this._parts.length; i < len; i++) {
-  			part = this._parts[i];
-
-  			for (j = 0, len2 = part.length, k = len2 - 1; j < len2; k = j++) {
-  				if (!closed && (j === 0)) { continue; }
-
-  				if (pointToSegmentDistance(p, part[k], part[j]) <= w) {
-  					return true;
-  				}
-  			}
-  		}
-  		return false;
-  	}
-  });
-
-  // @factory L.polyline(latlngs: LatLng[], options?: Polyline options)
-  // Instantiates a polyline object given an array of geographical points and
-  // optionally an options object. You can create a `Polyline` object with
-  // multiple separate lines (`MultiPolyline`) by passing an array of arrays
-  // of geographic points.
-  function polyline(latlngs, options) {
-  	return new Polyline(latlngs, options);
-  }
-
-  // Retrocompat. Allow plugins to support Leaflet versions before and after 1.1.
-  Polyline._flat = _flat;
-
-  /*
-   * @class Polygon
-   * @aka L.Polygon
-   * @inherits Polyline
-   *
-   * A class for drawing polygon overlays on a map. Extends `Polyline`.
-   *
-   * Note that points you pass when creating a polygon shouldn't have an additional last point equal to the first one — it's better to filter out such points.
-   *
-   *
-   * @example
-   *
-   * ```js
-   * // create a red polygon from an array of LatLng points
-   * var latlngs = [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]];
-   *
-   * var polygon = L.polygon(latlngs, {color: 'red'}).addTo(map);
-   *
-   * // zoom the map to the polygon
-   * map.fitBounds(polygon.getBounds());
-   * ```
-   *
-   * You can also pass an array of arrays of latlngs, with the first array representing the outer shape and the other arrays representing holes in the outer shape:
-   *
-   * ```js
-   * var latlngs = [
-   *   [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring
-   *   [[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole
-   * ];
-   * ```
-   *
-   * Additionally, you can pass a multi-dimensional array to represent a MultiPolygon shape.
-   *
-   * ```js
-   * var latlngs = [
-   *   [ // first polygon
-   *     [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring
-   *     [[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole
-   *   ],
-   *   [ // second polygon
-   *     [[41, -111.03],[45, -111.04],[45, -104.05],[41, -104.05]]
-   *   ]
-   * ];
-   * ```
-   */
-
-  var Polygon = Polyline.extend({
-
-  	options: {
-  		fill: true
-  	},
-
-  	isEmpty: function () {
-  		return !this._latlngs.length || !this._latlngs[0].length;
-  	},
-
-  	getCenter: function () {
-  		// throws error when not yet added to map as this center calculation requires projected coordinates
-  		if (!this._map) {
-  			throw new Error('Must add layer to map before using getCenter()');
-  		}
-
-  		var i, j, p1, p2, f, area, x, y, center,
-  		    points = this._rings[0],
-  		    len = points.length;
-
-  		if (!len) { return null; }
-
-  		// polygon centroid algorithm; only uses the first ring if there are multiple
-
-  		area = x = y = 0;
-
-  		for (i = 0, j = len - 1; i < len; j = i++) {
-  			p1 = points[i];
-  			p2 = points[j];
-
-  			f = p1.y * p2.x - p2.y * p1.x;
-  			x += (p1.x + p2.x) * f;
-  			y += (p1.y + p2.y) * f;
-  			area += f * 3;
-  		}
-
-  		if (area === 0) {
-  			// Polygon is so small that all points are on same pixel.
-  			center = points[0];
-  		} else {
-  			center = [x / area, y / area];
-  		}
-  		return this._map.layerPointToLatLng(center);
-  	},
-
-  	_convertLatLngs: function (latlngs) {
-  		var result = Polyline.prototype._convertLatLngs.call(this, latlngs),
-  		    len = result.length;
-
-  		// remove last point if it equals first one
-  		if (len >= 2 && result[0] instanceof LatLng && result[0].equals(result[len - 1])) {
-  			result.pop();
-  		}
-  		return result;
-  	},
-
-  	_setLatLngs: function (latlngs) {
-  		Polyline.prototype._setLatLngs.call(this, latlngs);
-  		if (isFlat(this._latlngs)) {
-  			this._latlngs = [this._latlngs];
-  		}
-  	},
-
-  	_defaultShape: function () {
-  		return isFlat(this._latlngs[0]) ? this._latlngs[0] : this._latlngs[0][0];
-  	},
-
-  	_clipPoints: function () {
-  		// polygons need a different clipping algorithm so we redefine that
-
-  		var bounds = this._renderer._bounds,
-  		    w = this.options.weight,
-  		    p = new Point(w, w);
-
-  		// increase clip padding by stroke width to avoid stroke on clip edges
-  		bounds = new Bounds(bounds.min.subtract(p), bounds.max.add(p));
-
-  		this._parts = [];
-  		if (!this._pxBounds || !this._pxBounds.intersects(bounds)) {
-  			return;
-  		}
-
-  		if (this.options.noClip) {
-  			this._parts = this._rings;
-  			return;
-  		}
-
-  		for (var i = 0, len = this._rings.length, clipped; i < len; i++) {
-  			clipped = clipPolygon(this._rings[i], bounds, true);
-  			if (clipped.length) {
-  				this._parts.push(clipped);
-  			}
-  		}
-  	},
-
-  	_updatePath: function () {
-  		this._renderer._updatePoly(this, true);
-  	},
-
-  	// Needed by the `Canvas` renderer for interactivity
-  	_containsPoint: function (p) {
-  		var inside = false,
-  		    part, p1, p2, i, j, k, len, len2;
-
-  		if (!this._pxBounds || !this._pxBounds.contains(p)) { return false; }
-
-  		// ray casting algorithm for detecting if point is in polygon
-  		for (i = 0, len = this._parts.length; i < len; i++) {
-  			part = this._parts[i];
-
-  			for (j = 0, len2 = part.length, k = len2 - 1; j < len2; k = j++) {
-  				p1 = part[j];
-  				p2 = part[k];
-
-  				if (((p1.y > p.y) !== (p2.y > p.y)) && (p.x < (p2.x - p1.x) * (p.y - p1.y) / (p2.y - p1.y) + p1.x)) {
-  					inside = !inside;
-  				}
-  			}
-  		}
-
-  		// also check if it's on polygon stroke
-  		return inside || Polyline.prototype._containsPoint.call(this, p, true);
-  	}
-
-  });
-
-
-  // @factory L.polygon(latlngs: LatLng[], options?: Polyline options)
-  function polygon(latlngs, options) {
-  	return new Polygon(latlngs, options);
-  }
-
-  /*
-   * @class GeoJSON
-   * @aka L.GeoJSON
-   * @inherits FeatureGroup
-   *
-   * Represents a GeoJSON object or an array of GeoJSON objects. Allows you to parse
-   * GeoJSON data and display it on the map. Extends `FeatureGroup`.
-   *
-   * @example
-   *
-   * ```js
-   * L.geoJSON(data, {
-   * 	style: function (feature) {
-   * 		return {color: feature.properties.color};
-   * 	}
-   * }).bindPopup(function (layer) {
-   * 	return layer.feature.properties.description;
-   * }).addTo(map);
-   * ```
-   */
-
-  var GeoJSON = FeatureGroup.extend({
-
-  	/* @section
-  	 * @aka GeoJSON options
-  	 *
-  	 * @option pointToLayer: Function = *
-  	 * A `Function` defining how GeoJSON points spawn Leaflet layers. It is internally
-  	 * called when data is added, passing the GeoJSON point feature and its `LatLng`.
-  	 * The default is to spawn a default `Marker`:
-  	 * ```js
-  	 * function(geoJsonPoint, latlng) {
-  	 * 	return L.marker(latlng);
-  	 * }
-  	 * ```
-  	 *
-  	 * @option style: Function = *
-  	 * A `Function` defining the `Path options` for styling GeoJSON lines and polygons,
-  	 * called internally when data is added.
-  	 * The default value is to not override any defaults:
-  	 * ```js
-  	 * function (geoJsonFeature) {
-  	 * 	return {}
-  	 * }
-  	 * ```
-  	 *
-  	 * @option onEachFeature: Function = *
-  	 * A `Function` that will be called once for each created `Feature`, after it has
-  	 * been created and styled. Useful for attaching events and popups to features.
-  	 * The default is to do nothing with the newly created layers:
-  	 * ```js
-  	 * function (feature, layer) {}
-  	 * ```
-  	 *
-  	 * @option filter: Function = *
-  	 * A `Function` that will be used to decide whether to include a feature or not.
-  	 * The default is to include all features:
-  	 * ```js
-  	 * function (geoJsonFeature) {
-  	 * 	return true;
-  	 * }
-  	 * ```
-  	 * Note: dynamically changing the `filter` option will have effect only on newly
-  	 * added data. It will _not_ re-evaluate already included features.
-  	 *
-  	 * @option coordsToLatLng: Function = *
-  	 * A `Function` that will be used for converting GeoJSON coordinates to `LatLng`s.
-  	 * The default is the `coordsToLatLng` static method.
-  	 *
-  	 * @option markersInheritOptions: Boolean = false
-  	 * Whether default Markers for "Point" type Features inherit from group options.
-  	 */
-
-  	initialize: function (geojson, options) {
-  		setOptions(this, options);
-
-  		this._layers = {};
-
-  		if (geojson) {
-  			this.addData(geojson);
-  		}
-  	},
-
-  	// @method addData( <GeoJSON> data ): this
-  	// Adds a GeoJSON object to the layer.
-  	addData: function (geojson) {
-  		var features = isArray(geojson) ? geojson : geojson.features,
-  		    i, len, feature;
-
-  		if (features) {
-  			for (i = 0, len = features.length; i < len; i++) {
-  				// only add this if geometry or geometries are set and not null
-  				feature = features[i];
-  				if (feature.geometries || feature.geometry || feature.features || feature.coordinates) {
-  					this.addData(feature);
-  				}
-  			}
-  			return this;
-  		}
-
-  		var options = this.options;
-
-  		if (options.filter && !options.filter(geojson)) { return this; }
-
-  		var layer = geometryToLayer(geojson, options);
-  		if (!layer) {
-  			return this;
-  		}
-  		layer.feature = asFeature(geojson);
-
-  		layer.defaultOptions = layer.options;
-  		this.resetStyle(layer);
-
-  		if (options.onEachFeature) {
-  			options.onEachFeature(geojson, layer);
-  		}
-
-  		return this.addLayer(layer);
-  	},
-
-  	// @method resetStyle( <Path> layer? ): this
-  	// Resets the given vector layer's style to the original GeoJSON style, useful for resetting style after hover events.
-  	// If `layer` is omitted, the style of all features in the current layer is reset.
-  	resetStyle: function (layer) {
-  		if (layer === undefined) {
-  			return this.eachLayer(this.resetStyle, this);
-  		}
-  		// reset any custom styles
-  		layer.options = extend({}, layer.defaultOptions);
-  		this._setLayerStyle(layer, this.options.style);
-  		return this;
-  	},
-
-  	// @method setStyle( <Function> style ): this
-  	// Changes styles of GeoJSON vector layers with the given style function.
-  	setStyle: function (style) {
-  		return this.eachLayer(function (layer) {
-  			this._setLayerStyle(layer, style);
-  		}, this);
-  	},
-
-  	_setLayerStyle: function (layer, style) {
-  		if (layer.setStyle) {
-  			if (typeof style === 'function') {
-  				style = style(layer.feature);
-  			}
-  			layer.setStyle(style);
-  		}
-  	}
-  });
-
-  // @section
-  // There are several static functions which can be called without instantiating L.GeoJSON:
-
-  // @function geometryToLayer(featureData: Object, options?: GeoJSON options): Layer
-  // Creates a `Layer` from a given GeoJSON feature. Can use a custom
-  // [`pointToLayer`](#geojson-pointtolayer) and/or [`coordsToLatLng`](#geojson-coordstolatlng)
-  // functions if provided as options.
-  function geometryToLayer(geojson, options) {
-
-  	var geometry = geojson.type === 'Feature' ? geojson.geometry : geojson,
-  	    coords = geometry ? geometry.coordinates : null,
-  	    layers = [],
-  	    pointToLayer = options && options.pointToLayer,
-  	    _coordsToLatLng = options && options.coordsToLatLng || coordsToLatLng,
-  	    latlng, latlngs, i, len;
-
-  	if (!coords && !geometry) {
-  		return null;
-  	}
-
-  	switch (geometry.type) {
-  	case 'Point':
-  		latlng = _coordsToLatLng(coords);
-  		return _pointToLayer(pointToLayer, geojson, latlng, options);
-
-  	case 'MultiPoint':
-  		for (i = 0, len = coords.length; i < len; i++) {
-  			latlng = _coordsToLatLng(coords[i]);
-  			layers.push(_pointToLayer(pointToLayer, geojson, latlng, options));
-  		}
-  		return new FeatureGroup(layers);
-
-  	case 'LineString':
-  	case 'MultiLineString':
-  		latlngs = coordsToLatLngs(coords, geometry.type === 'LineString' ? 0 : 1, _coordsToLatLng);
-  		return new Polyline(latlngs, options);
-
-  	case 'Polygon':
-  	case 'MultiPolygon':
-  		latlngs = coordsToLatLngs(coords, geometry.type === 'Polygon' ? 1 : 2, _coordsToLatLng);
-  		return new Polygon(latlngs, options);
-
-  	case 'GeometryCollection':
-  		for (i = 0, len = geometry.geometries.length; i < len; i++) {
-  			var layer = geometryToLayer({
-  				geometry: geometry.geometries[i],
-  				type: 'Feature',
-  				properties: geojson.properties
-  			}, options);
-
-  			if (layer) {
-  				layers.push(layer);
-  			}
-  		}
-  		return new FeatureGroup(layers);
-
-  	default:
-  		throw new Error('Invalid GeoJSON object.');
-  	}
-  }
-
-  function _pointToLayer(pointToLayerFn, geojson, latlng, options) {
-  	return pointToLayerFn ?
-  		pointToLayerFn(geojson, latlng) :
-  		new Marker(latlng, options && options.markersInheritOptions && options);
-  }
-
-  // @function coordsToLatLng(coords: Array): LatLng
-  // Creates a `LatLng` object from an array of 2 numbers (longitude, latitude)
-  // or 3 numbers (longitude, latitude, altitude) used in GeoJSON for points.
-  function coordsToLatLng(coords) {
-  	return new LatLng(coords[1], coords[0], coords[2]);
-  }
-
-  // @function coordsToLatLngs(coords: Array, levelsDeep?: Number, coordsToLatLng?: Function): Array
-  // Creates a multidimensional array of `LatLng`s from a GeoJSON coordinates array.
-  // `levelsDeep` specifies the nesting level (0 is for an array of points, 1 for an array of arrays of points, etc., 0 by default).
-  // Can use a custom [`coordsToLatLng`](#geojson-coordstolatlng) function.
-  function coordsToLatLngs(coords, levelsDeep, _coordsToLatLng) {
-  	var latlngs = [];
-
-  	for (var i = 0, len = coords.length, latlng; i < len; i++) {
-  		latlng = levelsDeep ?
-  			coordsToLatLngs(coords[i], levelsDeep - 1, _coordsToLatLng) :
-  			(_coordsToLatLng || coordsToLatLng)(coords[i]);
-
-  		latlngs.push(latlng);
-  	}
-
-  	return latlngs;
-  }
-
-  // @function latLngToCoords(latlng: LatLng, precision?: Number): Array
-  // Reverse of [`coordsToLatLng`](#geojson-coordstolatlng)
-  function latLngToCoords(latlng, precision) {
-  	precision = typeof precision === 'number' ? precision : 6;
-  	return latlng.alt !== undefined ?
-  		[formatNum(latlng.lng, precision), formatNum(latlng.lat, precision), formatNum(latlng.alt, precision)] :
-  		[formatNum(latlng.lng, precision), formatNum(latlng.lat, precision)];
-  }
-
-  // @function latLngsToCoords(latlngs: Array, levelsDeep?: Number, closed?: Boolean): Array
-  // Reverse of [`coordsToLatLngs`](#geojson-coordstolatlngs)
-  // `closed` determines whether the first point should be appended to the end of the array to close the feature, only used when `levelsDeep` is 0. False by default.
-  function latLngsToCoords(latlngs, levelsDeep, closed, precision) {
-  	var coords = [];
-
-  	for (var i = 0, len = latlngs.length; i < len; i++) {
-  		coords.push(levelsDeep ?
-  			latLngsToCoords(latlngs[i], levelsDeep - 1, closed, precision) :
-  			latLngToCoords(latlngs[i], precision));
-  	}
-
-  	if (!levelsDeep && closed) {
-  		coords.push(coords[0]);
-  	}
-
-  	return coords;
-  }
-
-  function getFeature(layer, newGeometry) {
-  	return layer.feature ?
-  		extend({}, layer.feature, {geometry: newGeometry}) :
-  		asFeature(newGeometry);
-  }
-
-  // @function asFeature(geojson: Object): Object
-  // Normalize GeoJSON geometries/features into GeoJSON features.
-  function asFeature(geojson) {
-  	if (geojson.type === 'Feature' || geojson.type === 'FeatureCollection') {
-  		return geojson;
-  	}
-
-  	return {
-  		type: 'Feature',
-  		properties: {},
-  		geometry: geojson
-  	};
-  }
-
-  var PointToGeoJSON = {
-  	toGeoJSON: function (precision) {
-  		return getFeature(this, {
-  			type: 'Point',
-  			coordinates: latLngToCoords(this.getLatLng(), precision)
-  		});
-  	}
-  };
-
-  // @namespace Marker
-  // @section Other methods
-  // @method toGeoJSON(precision?: Number): Object
-  // `precision` is the number of decimal places for coordinates.
-  // The default value is 6 places.
-  // Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the marker (as a GeoJSON `Point` Feature).
-  Marker.include(PointToGeoJSON);
-
-  // @namespace CircleMarker
-  // @method toGeoJSON(precision?: Number): Object
-  // `precision` is the number of decimal places for coordinates.
-  // The default value is 6 places.
-  // Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the circle marker (as a GeoJSON `Point` Feature).
-  Circle.include(PointToGeoJSON);
-  CircleMarker.include(PointToGeoJSON);
-
-
-  // @namespace Polyline
-  // @method toGeoJSON(precision?: Number): Object
-  // `precision` is the number of decimal places for coordinates.
-  // The default value is 6 places.
-  // Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the polyline (as a GeoJSON `LineString` or `MultiLineString` Feature).
-  Polyline.include({
-  	toGeoJSON: function (precision) {
-  		var multi = !isFlat(this._latlngs);
-
-  		var coords = latLngsToCoords(this._latlngs, multi ? 1 : 0, false, precision);
-
-  		return getFeature(this, {
-  			type: (multi ? 'Multi' : '') + 'LineString',
-  			coordinates: coords
-  		});
-  	}
-  });
-
-  // @namespace Polygon
-  // @method toGeoJSON(precision?: Number): Object
-  // `precision` is the number of decimal places for coordinates.
-  // The default value is 6 places.
-  // Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the polygon (as a GeoJSON `Polygon` or `MultiPolygon` Feature).
-  Polygon.include({
-  	toGeoJSON: function (precision) {
-  		var holes = !isFlat(this._latlngs),
-  		    multi = holes && !isFlat(this._latlngs[0]);
-
-  		var coords = latLngsToCoords(this._latlngs, multi ? 2 : holes ? 1 : 0, true, precision);
-
-  		if (!holes) {
-  			coords = [coords];
-  		}
-
-  		return getFeature(this, {
-  			type: (multi ? 'Multi' : '') + 'Polygon',
-  			coordinates: coords
-  		});
-  	}
-  });
-
-
-  // @namespace LayerGroup
-  LayerGroup.include({
-  	toMultiPoint: function (precision) {
-  		var coords = [];
-
-  		this.eachLayer(function (layer) {
-  			coords.push(layer.toGeoJSON(precision).geometry.coordinates);
-  		});
-
-  		return getFeature(this, {
-  			type: 'MultiPoint',
-  			coordinates: coords
-  		});
-  	},
-
-  	// @method toGeoJSON(precision?: Number): Object
-  	// `precision` is the number of decimal places for coordinates.
-  	// The default value is 6 places.
-  	// Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the layer group (as a GeoJSON `FeatureCollection`, `GeometryCollection`, or `MultiPoint`).
-  	toGeoJSON: function (precision) {
-
-  		var type = this.feature && this.feature.geometry && this.feature.geometry.type;
-
-  		if (type === 'MultiPoint') {
-  			return this.toMultiPoint(precision);
-  		}
-
-  		var isGeometryCollection = type === 'GeometryCollection',
-  		    jsons = [];
-
-  		this.eachLayer(function (layer) {
-  			if (layer.toGeoJSON) {
-  				var json = layer.toGeoJSON(precision);
-  				if (isGeometryCollection) {
-  					jsons.push(json.geometry);
-  				} else {
-  					var feature = asFeature(json);
-  					// Squash nested feature collections
-  					if (feature.type === 'FeatureCollection') {
-  						jsons.push.apply(jsons, feature.features);
-  					} else {
-  						jsons.push(feature);
-  					}
-  				}
-  			}
-  		});
-
-  		if (isGeometryCollection) {
-  			return getFeature(this, {
-  				geometries: jsons,
-  				type: 'GeometryCollection'
-  			});
-  		}
-
-  		return {
-  			type: 'FeatureCollection',
-  			features: jsons
-  		};
-  	}
-  });
-
-  // @namespace GeoJSON
-  // @factory L.geoJSON(geojson?: Object, options?: GeoJSON options)
-  // Creates a GeoJSON layer. Optionally accepts an object in
-  // [GeoJSON format](https://tools.ietf.org/html/rfc7946) to display on the map
-  // (you can alternatively add it later with `addData` method) and an `options` object.
-  function geoJSON(geojson, options) {
-  	return new GeoJSON(geojson, options);
-  }
-
-  // Backward compatibility.
-  var geoJson = geoJSON;
-
-  /*
-   * @class ImageOverlay
-   * @aka L.ImageOverlay
-   * @inherits Interactive layer
-   *
-   * Used to load and display a single image over specific bounds of the map. Extends `Layer`.
-   *
-   * @example
-   *
-   * ```js
-   * var imageUrl = 'http://www.lib.utexas.edu/maps/historical/newark_nj_1922.jpg',
-   * 	imageBounds = [[40.712216, -74.22655], [40.773941, -74.12544]];
-   * L.imageOverlay(imageUrl, imageBounds).addTo(map);
-   * ```
-   */
-
-  var ImageOverlay = Layer.extend({
-
-  	// @section
-  	// @aka ImageOverlay options
-  	options: {
-  		// @option opacity: Number = 1.0
-  		// The opacity of the image overlay.
-  		opacity: 1,
-
-  		// @option alt: String = ''
-  		// Text for the `alt` attribute of the image (useful for accessibility).
-  		alt: '',
-
-  		// @option interactive: Boolean = false
-  		// If `true`, the image overlay will emit [mouse events](#interactive-layer) when clicked or hovered.
-  		interactive: false,
-
-  		// @option crossOrigin: Boolean|String = false
-  		// Whether the crossOrigin attribute will be added to the image.
-  		// If a String is provided, the image will have its crossOrigin attribute set to the String provided. This is needed if you want to access image pixel data.
-  		// Refer to [CORS Settings](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes) for valid String values.
-  		crossOrigin: false,
-
-  		// @option errorOverlayUrl: String = ''
-  		// URL to the overlay image to show in place of the overlay that failed to load.
-  		errorOverlayUrl: '',
-
-  		// @option zIndex: Number = 1
-  		// The explicit [zIndex](https://developer.mozilla.org/docs/Web/CSS/CSS_Positioning/Understanding_z_index) of the overlay layer.
-  		zIndex: 1,
-
-  		// @option className: String = ''
-  		// A custom class name to assign to the image. Empty by default.
-  		className: ''
-  	},
-
-  	initialize: function (url, bounds, options) { // (String, LatLngBounds, Object)
-  		this._url = url;
-  		this._bounds = toLatLngBounds(bounds);
-
-  		setOptions(this, options);
-  	},
-
-  	onAdd: function () {
-  		if (!this._image) {
-  			this._initImage();
-
-  			if (this.options.opacity < 1) {
-  				this._updateOpacity();
-  			}
-  		}
-
-  		if (this.options.interactive) {
-  			addClass(this._image, 'leaflet-interactive');
-  			this.addInteractiveTarget(this._image);
-  		}
-
-  		this.getPane().appendChild(this._image);
-  		this._reset();
-  	},
-
-  	onRemove: function () {
-  		remove(this._image);
-  		if (this.options.interactive) {
-  			this.removeInteractiveTarget(this._image);
-  		}
-  	},
-
-  	// @method setOpacity(opacity: Number): this
-  	// Sets the opacity of the overlay.
-  	setOpacity: function (opacity) {
-  		this.options.opacity = opacity;
-
-  		if (this._image) {
-  			this._updateOpacity();
-  		}
-  		return this;
-  	},
-
-  	setStyle: function (styleOpts) {
-  		if (styleOpts.opacity) {
-  			this.setOpacity(styleOpts.opacity);
-  		}
-  		return this;
-  	},
-
-  	// @method bringToFront(): this
-  	// Brings the layer to the top of all overlays.
-  	bringToFront: function () {
-  		if (this._map) {
-  			toFront(this._image);
-  		}
-  		return this;
-  	},
-
-  	// @method bringToBack(): this
-  	// Brings the layer to the bottom of all overlays.
-  	bringToBack: function () {
-  		if (this._map) {
-  			toBack(this._image);
-  		}
-  		return this;
-  	},
-
-  	// @method setUrl(url: String): this
-  	// Changes the URL of the image.
-  	setUrl: function (url) {
-  		this._url = url;
-
-  		if (this._image) {
-  			this._image.src = url;
-  		}
-  		return this;
-  	},
-
-  	// @method setBounds(bounds: LatLngBounds): this
-  	// Update the bounds that this ImageOverlay covers
-  	setBounds: function (bounds) {
-  		this._bounds = toLatLngBounds(bounds);
-
-  		if (this._map) {
-  			this._reset();
-  		}
-  		return this;
-  	},
-
-  	getEvents: function () {
-  		var events = {
-  			zoom: this._reset,
-  			viewreset: this._reset
-  		};
-
-  		if (this._zoomAnimated) {
-  			events.zoomanim = this._animateZoom;
-  		}
-
-  		return events;
-  	},
-
-  	// @method setZIndex(value: Number): this
-  	// Changes the [zIndex](#imageoverlay-zindex) of the image overlay.
-  	setZIndex: function (value) {
-  		this.options.zIndex = value;
-  		this._updateZIndex();
-  		return this;
-  	},
-
-  	// @method getBounds(): LatLngBounds
-  	// Get the bounds that this ImageOverlay covers
-  	getBounds: function () {
-  		return this._bounds;
-  	},
-
-  	// @method getElement(): HTMLElement
-  	// Returns the instance of [`HTMLImageElement`](https://developer.mozilla.org/docs/Web/API/HTMLImageElement)
-  	// used by this overlay.
-  	getElement: function () {
-  		return this._image;
-  	},
-
-  	_initImage: function () {
-  		var wasElementSupplied = this._url.tagName === 'IMG';
-  		var img = this._image = wasElementSupplied ? this._url : create$1('img');
-
-  		addClass(img, 'leaflet-image-layer');
-  		if (this._zoomAnimated) { addClass(img, 'leaflet-zoom-animated'); }
-  		if (this.options.className) { addClass(img, this.options.className); }
-
-  		img.onselectstart = falseFn;
-  		img.onmousemove = falseFn;
-
-  		// @event load: Event
-  		// Fired when the ImageOverlay layer has loaded its image
-  		img.onload = bind(this.fire, this, 'load');
-  		img.onerror = bind(this._overlayOnError, this, 'error');
-
-  		if (this.options.crossOrigin || this.options.crossOrigin === '') {
-  			img.crossOrigin = this.options.crossOrigin === true ? '' : this.options.crossOrigin;
-  		}
-
-  		if (this.options.zIndex) {
-  			this._updateZIndex();
-  		}
-
-  		if (wasElementSupplied) {
-  			this._url = img.src;
-  			return;
-  		}
-
-  		img.src = this._url;
-  		img.alt = this.options.alt;
-  	},
-
-  	_animateZoom: function (e) {
-  		var scale = this._map.getZoomScale(e.zoom),
-  		    offset = this._map._latLngBoundsToNewLayerBounds(this._bounds, e.zoom, e.center).min;
-
-  		setTransform(this._image, offset, scale);
-  	},
-
-  	_reset: function () {
-  		var image = this._image,
-  		    bounds = new Bounds(
-  		        this._map.latLngToLayerPoint(this._bounds.getNorthWest()),
-  		        this._map.latLngToLayerPoint(this._bounds.getSouthEast())),
-  		    size = bounds.getSize();
-
-  		setPosition(image, bounds.min);
-
-  		image.style.width  = size.x + 'px';
-  		image.style.height = size.y + 'px';
-  	},
-
-  	_updateOpacity: function () {
-  		setOpacity(this._image, this.options.opacity);
-  	},
-
-  	_updateZIndex: function () {
-  		if (this._image && this.options.zIndex !== undefined && this.options.zIndex !== null) {
-  			this._image.style.zIndex = this.options.zIndex;
-  		}
-  	},
-
-  	_overlayOnError: function () {
-  		// @event error: Event
-  		// Fired when the ImageOverlay layer fails to load its image
-  		this.fire('error');
-
-  		var errorUrl = this.options.errorOverlayUrl;
-  		if (errorUrl && this._url !== errorUrl) {
-  			this._url = errorUrl;
-  			this._image.src = errorUrl;
-  		}
-  	}
-  });
-
-  // @factory L.imageOverlay(imageUrl: String, bounds: LatLngBounds, options?: ImageOverlay options)
-  // Instantiates an image overlay object given the URL of the image and the
-  // geographical bounds it is tied to.
-  var imageOverlay = function (url, bounds, options) {
-  	return new ImageOverlay(url, bounds, options);
-  };
-
-  /*
-   * @class VideoOverlay
-   * @aka L.VideoOverlay
-   * @inherits ImageOverlay
-   *
-   * Used to load and display a video player over specific bounds of the map. Extends `ImageOverlay`.
-   *
-   * A video overlay uses the [`<video>`](https://developer.mozilla.org/docs/Web/HTML/Element/video)
-   * HTML5 element.
-   *
-   * @example
-   *
-   * ```js
-   * var videoUrl = 'https://www.mapbox.com/bites/00188/patricia_nasa.webm',
-   * 	videoBounds = [[ 32, -130], [ 13, -100]];
-   * L.videoOverlay(videoUrl, videoBounds ).addTo(map);
-   * ```
-   */
-
-  var VideoOverlay = ImageOverlay.extend({
-
-  	// @section
-  	// @aka VideoOverlay options
-  	options: {
-  		// @option autoplay: Boolean = true
-  		// Whether the video starts playing automatically when loaded.
-  		autoplay: true,
-
-  		// @option loop: Boolean = true
-  		// Whether the video will loop back to the beginning when played.
-  		loop: true,
-
-  		// @option keepAspectRatio: Boolean = true
-  		// Whether the video will save aspect ratio after the projection.
-  		// Relevant for supported browsers. Browser compatibility- https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit
-  		keepAspectRatio: true,
-
-  		// @option muted: Boolean = false
-  		// Whether the video starts on mute when loaded.
-  		muted: false
-  	},
-
-  	_initImage: function () {
-  		var wasElementSupplied = this._url.tagName === 'VIDEO';
-  		var vid = this._image = wasElementSupplied ? this._url : create$1('video');
-
-  		addClass(vid, 'leaflet-image-layer');
-  		if (this._zoomAnimated) { addClass(vid, 'leaflet-zoom-animated'); }
-  		if (this.options.className) { addClass(vid, this.options.className); }
-
-  		vid.onselectstart = falseFn;
-  		vid.onmousemove = falseFn;
-
-  		// @event load: Event
-  		// Fired when the video has finished loading the first frame
-  		vid.onloadeddata = bind(this.fire, this, 'load');
-
-  		if (wasElementSupplied) {
-  			var sourceElements = vid.getElementsByTagName('source');
-  			var sources = [];
-  			for (var j = 0; j < sourceElements.length; j++) {
-  				sources.push(sourceElements[j].src);
-  			}
-
-  			this._url = (sourceElements.length > 0) ? sources : [vid.src];
-  			return;
-  		}
-
-  		if (!isArray(this._url)) { this._url = [this._url]; }
-
-  		if (!this.options.keepAspectRatio && Object.prototype.hasOwnProperty.call(vid.style, 'objectFit')) {
-  			vid.style['objectFit'] = 'fill';
-  		}
-  		vid.autoplay = !!this.options.autoplay;
-  		vid.loop = !!this.options.loop;
-  		vid.muted = !!this.options.muted;
-  		for (var i = 0; i < this._url.length; i++) {
-  			var source = create$1('source');
-  			source.src = this._url[i];
-  			vid.appendChild(source);
-  		}
-  	}
-
-  	// @method getElement(): HTMLVideoElement
-  	// Returns the instance of [`HTMLVideoElement`](https://developer.mozilla.org/docs/Web/API/HTMLVideoElement)
-  	// used by this overlay.
-  });
-
-
-  // @factory L.videoOverlay(video: String|Array|HTMLVideoElement, bounds: LatLngBounds, options?: VideoOverlay options)
-  // Instantiates an image overlay object given the URL of the video (or array of URLs, or even a video element) and the
-  // geographical bounds it is tied to.
-
-  function videoOverlay(video, bounds, options) {
-  	return new VideoOverlay(video, bounds, options);
-  }
-
-  /*
-   * @class SVGOverlay
-   * @aka L.SVGOverlay
-   * @inherits ImageOverlay
-   *
-   * Used to load, display and provide DOM access to an SVG file over specific bounds of the map. Extends `ImageOverlay`.
-   *
-   * An SVG overlay uses the [`<svg>`](https://developer.mozilla.org/docs/Web/SVG/Element/svg) element.
-   *
-   * @example
-   *
-   * ```js
-   * var svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
-   * svgElement.setAttribute('xmlns', "http://www.w3.org/2000/svg");
-   * svgElement.setAttribute('viewBox', "0 0 200 200");
-   * svgElement.innerHTML = '<rect width="200" height="200"/><rect x="75" y="23" width="50" height="50" style="fill:red"/><rect x="75" y="123" width="50" height="50" style="fill:#0013ff"/>';
-   * var svgElementBounds = [ [ 32, -130 ], [ 13, -100 ] ];
-   * L.svgOverlay(svgElement, svgElementBounds).addTo(map);
-   * ```
-   */
-
-  var SVGOverlay = ImageOverlay.extend({
-  	_initImage: function () {
-  		var el = this._image = this._url;
-
-  		addClass(el, 'leaflet-image-layer');
-  		if (this._zoomAnimated) { addClass(el, 'leaflet-zoom-animated'); }
-  		if (this.options.className) { addClass(el, this.options.className); }
-
-  		el.onselectstart = falseFn;
-  		el.onmousemove = falseFn;
-  	}
-
-  	// @method getElement(): SVGElement
-  	// Returns the instance of [`SVGElement`](https://developer.mozilla.org/docs/Web/API/SVGElement)
-  	// used by this overlay.
-  });
-
-
-  // @factory L.svgOverlay(svg: String|SVGElement, bounds: LatLngBounds, options?: SVGOverlay options)
-  // Instantiates an image overlay object given an SVG element and the geographical bounds it is tied to.
-  // A viewBox attribute is required on the SVG element to zoom in and out properly.
-
-  function svgOverlay(el, bounds, options) {
-  	return new SVGOverlay(el, bounds, options);
-  }
-
-  /*
-   * @class DivOverlay
-   * @inherits Layer
-   * @aka L.DivOverlay
-   * Base model for L.Popup and L.Tooltip. Inherit from it for custom popup like plugins.
-   */
-
-  // @namespace DivOverlay
-  var DivOverlay = Layer.extend({
-
-  	// @section
-  	// @aka DivOverlay options
-  	options: {
-  		// @option offset: Point = Point(0, 7)
-  		// The offset of the popup position. Useful to control the anchor
-  		// of the popup when opening it on some overlays.
-  		offset: [0, 7],
-
-  		// @option className: String = ''
-  		// A custom CSS class name to assign to the popup.
-  		className: '',
-
-  		// @option pane: String = 'popupPane'
-  		// `Map pane` where the popup will be added.
-  		pane: 'popupPane'
-  	},
-
-  	initialize: function (options, source) {
-  		setOptions(this, options);
-
-  		this._source = source;
-  	},
-
-  	onAdd: function (map) {
-  		this._zoomAnimated = map._zoomAnimated;
-
-  		if (!this._container) {
-  			this._initLayout();
-  		}
-
-  		if (map._fadeAnimated) {
-  			setOpacity(this._container, 0);
-  		}
-
-  		clearTimeout(this._removeTimeout);
-  		this.getPane().appendChild(this._container);
-  		this.update();
-
-  		if (map._fadeAnimated) {
-  			setOpacity(this._container, 1);
-  		}
-
-  		this.bringToFront();
-  	},
-
-  	onRemove: function (map) {
-  		if (map._fadeAnimated) {
-  			setOpacity(this._container, 0);
-  			this._removeTimeout = setTimeout(bind(remove, undefined, this._container), 200);
-  		} else {
-  			remove(this._container);
-  		}
-  	},
-
-  	// @namespace Popup
-  	// @method getLatLng: LatLng
-  	// Returns the geographical point of popup.
-  	getLatLng: function () {
-  		return this._latlng;
-  	},
-
-  	// @method setLatLng(latlng: LatLng): this
-  	// Sets the geographical point where the popup will open.
-  	setLatLng: function (latlng) {
-  		this._latlng = toLatLng(latlng);
-  		if (this._map) {
-  			this._updatePosition();
-  			this._adjustPan();
-  		}
-  		return this;
-  	},
-
-  	// @method getContent: String|HTMLElement
-  	// Returns the content of the popup.
-  	getContent: function () {
-  		return this._content;
-  	},
-
-  	// @method setContent(htmlContent: String|HTMLElement|Function): this
-  	// Sets the HTML content of the popup. If a function is passed the source layer will be passed to the function. The function should return a `String` or `HTMLElement` to be used in the popup.
-  	setContent: function (content) {
-  		this._content = content;
-  		this.update();
-  		return this;
-  	},
-
-  	// @method getElement: String|HTMLElement
-  	// Returns the HTML container of the popup.
-  	getElement: function () {
-  		return this._container;
-  	},
-
-  	// @method update: null
-  	// Updates the popup content, layout and position. Useful for updating the popup after something inside changed, e.g. image loaded.
-  	update: function () {
-  		if (!this._map) { return; }
-
-  		this._container.style.visibility = 'hidden';
-
-  		this._updateContent();
-  		this._updateLayout();
-  		this._updatePosition();
-
-  		this._container.style.visibility = '';
-
-  		this._adjustPan();
-  	},
-
-  	getEvents: function () {
-  		var events = {
-  			zoom: this._updatePosition,
-  			viewreset: this._updatePosition
-  		};
-
-  		if (this._zoomAnimated) {
-  			events.zoomanim = this._animateZoom;
-  		}
-  		return events;
-  	},
-
-  	// @method isOpen: Boolean
-  	// Returns `true` when the popup is visible on the map.
-  	isOpen: function () {
-  		return !!this._map && this._map.hasLayer(this);
-  	},
-
-  	// @method bringToFront: this
-  	// Brings this popup in front of other popups (in the same map pane).
-  	bringToFront: function () {
-  		if (this._map) {
-  			toFront(this._container);
-  		}
-  		return this;
-  	},
-
-  	// @method bringToBack: this
-  	// Brings this popup to the back of other popups (in the same map pane).
-  	bringToBack: function () {
-  		if (this._map) {
-  			toBack(this._container);
-  		}
-  		return this;
-  	},
-
-  	_prepareOpen: function (parent, layer, latlng) {
-  		if (!(layer instanceof Layer)) {
-  			latlng = layer;
-  			layer = parent;
-  		}
-
-  		if (layer instanceof FeatureGroup) {
-  			for (var id in parent._layers) {
-  				layer = parent._layers[id];
-  				break;
-  			}
-  		}
-
-  		if (!latlng) {
-  			if (layer.getCenter) {
-  				latlng = layer.getCenter();
-  			} else if (layer.getLatLng) {
-  				latlng = layer.getLatLng();
-  			} else {
-  				throw new Error('Unable to get source layer LatLng.');
-  			}
-  		}
-
-  		// set overlay source to this layer
-  		this._source = layer;
-
-  		// update the overlay (content, layout, ect...)
-  		this.update();
-
-  		return latlng;
-  	},
-
-  	_updateContent: function () {
-  		if (!this._content) { return; }
-
-  		var node = this._contentNode;
-  		var content = (typeof this._content === 'function') ? this._content(this._source || this) : this._content;
-
-  		if (typeof content === 'string') {
-  			node.innerHTML = content;
-  		} else {
-  			while (node.hasChildNodes()) {
-  				node.removeChild(node.firstChild);
-  			}
-  			node.appendChild(content);
-  		}
-  		this.fire('contentupdate');
-  	},
-
-  	_updatePosition: function () {
-  		if (!this._map) { return; }
-
-  		var pos = this._map.latLngToLayerPoint(this._latlng),
-  		    offset = toPoint(this.options.offset),
-  		    anchor = this._getAnchor();
-
-  		if (this._zoomAnimated) {
-  			setPosition(this._container, pos.add(anchor));
-  		} else {
-  			offset = offset.add(pos).add(anchor);
-  		}
-
-  		var bottom = this._containerBottom = -offset.y,
-  		    left = this._containerLeft = -Math.round(this._containerWidth / 2) + offset.x;
-
-  		// bottom position the popup in case the height of the popup changes (images loading etc)
-  		this._container.style.bottom = bottom + 'px';
-  		this._container.style.left = left + 'px';
-  	},
-
-  	_getAnchor: function () {
-  		return [0, 0];
-  	}
-
-  });
-
-  /*
-   * @class Popup
-   * @inherits DivOverlay
-   * @aka L.Popup
-   * Used to open popups in certain places of the map. Use [Map.openPopup](#map-openpopup) to
-   * open popups while making sure that only one popup is open at one time
-   * (recommended for usability), or use [Map.addLayer](#map-addlayer) to open as many as you want.
-   *
-   * @example
-   *
-   * If you want to just bind a popup to marker click and then open it, it's really easy:
-   *
-   * ```js
-   * marker.bindPopup(popupContent).openPopup();
-   * ```
-   * Path overlays like polylines also have a `bindPopup` method.
-   * Here's a more complicated way to open a popup on a map:
-   *
-   * ```js
-   * var popup = L.popup()
-   * 	.setLatLng(latlng)
-   * 	.setContent('<p>Hello world!<br />This is a nice popup.</p>')
-   * 	.openOn(map);
-   * ```
-   */
-
-
-  // @namespace Popup
-  var Popup = DivOverlay.extend({
-
-  	// @section
-  	// @aka Popup options
-  	options: {
-  		// @option maxWidth: Number = 300
-  		// Max width of the popup, in pixels.
-  		maxWidth: 300,
-
-  		// @option minWidth: Number = 50
-  		// Min width of the popup, in pixels.
-  		minWidth: 50,
-
-  		// @option maxHeight: Number = null
-  		// If set, creates a scrollable container of the given height
-  		// inside a popup if its content exceeds it.
-  		maxHeight: null,
-
-  		// @option autoPan: Boolean = true
-  		// Set it to `false` if you don't want the map to do panning animation
-  		// to fit the opened popup.
-  		autoPan: true,
-
-  		// @option autoPanPaddingTopLeft: Point = null
-  		// The margin between the popup and the top left corner of the map
-  		// view after autopanning was performed.
-  		autoPanPaddingTopLeft: null,
-
-  		// @option autoPanPaddingBottomRight: Point = null
-  		// The margin between the popup and the bottom right corner of the map
-  		// view after autopanning was performed.
-  		autoPanPaddingBottomRight: null,
-
-  		// @option autoPanPadding: Point = Point(5, 5)
-  		// Equivalent of setting both top left and bottom right autopan padding to the same value.
-  		autoPanPadding: [5, 5],
-
-  		// @option keepInView: Boolean = false
-  		// Set it to `true` if you want to prevent users from panning the popup
-  		// off of the screen while it is open.
-  		keepInView: false,
-
-  		// @option closeButton: Boolean = true
-  		// Controls the presence of a close button in the popup.
-  		closeButton: true,
-
-  		// @option autoClose: Boolean = true
-  		// Set it to `false` if you want to override the default behavior of
-  		// the popup closing when another popup is opened.
-  		autoClose: true,
-
-  		// @option closeOnEscapeKey: Boolean = true
-  		// Set it to `false` if you want to override the default behavior of
-  		// the ESC key for closing of the popup.
-  		closeOnEscapeKey: true,
-
-  		// @option closeOnClick: Boolean = *
-  		// Set it if you want to override the default behavior of the popup closing when user clicks
-  		// on the map. Defaults to the map's [`closePopupOnClick`](#map-closepopuponclick) option.
-
-  		// @option className: String = ''
-  		// A custom CSS class name to assign to the popup.
-  		className: ''
-  	},
-
-  	// @namespace Popup
-  	// @method openOn(map: Map): this
-  	// Adds the popup to the map and closes the previous one. The same as `map.openPopup(popup)`.
-  	openOn: function (map) {
-  		map.openPopup(this);
-  		return this;
-  	},
-
-  	onAdd: function (map) {
-  		DivOverlay.prototype.onAdd.call(this, map);
-
-  		// @namespace Map
-  		// @section Popup events
-  		// @event popupopen: PopupEvent
-  		// Fired when a popup is opened in the map
-  		map.fire('popupopen', {popup: this});
-
-  		if (this._source) {
-  			// @namespace Layer
-  			// @section Popup events
-  			// @event popupopen: PopupEvent
-  			// Fired when a popup bound to this layer is opened
-  			this._source.fire('popupopen', {popup: this}, true);
-  			// For non-path layers, we toggle the popup when clicking
-  			// again the layer, so prevent the map to reopen it.
-  			if (!(this._source instanceof Path)) {
-  				this._source.on('preclick', stopPropagation);
-  			}
-  		}
-  	},
-
-  	onRemove: function (map) {
-  		DivOverlay.prototype.onRemove.call(this, map);
-
-  		// @namespace Map
-  		// @section Popup events
-  		// @event popupclose: PopupEvent
-  		// Fired when a popup in the map is closed
-  		map.fire('popupclose', {popup: this});
-
-  		if (this._source) {
-  			// @namespace Layer
-  			// @section Popup events
-  			// @event popupclose: PopupEvent
-  			// Fired when a popup bound to this layer is closed
-  			this._source.fire('popupclose', {popup: this}, true);
-  			if (!(this._source instanceof Path)) {
-  				this._source.off('preclick', stopPropagation);
-  			}
-  		}
-  	},
-
-  	getEvents: function () {
-  		var events = DivOverlay.prototype.getEvents.call(this);
-
-  		if (this.options.closeOnClick !== undefined ? this.options.closeOnClick : this._map.options.closePopupOnClick) {
-  			events.preclick = this._close;
-  		}
-
-  		if (this.options.keepInView) {
-  			events.moveend = this._adjustPan;
-  		}
-
-  		return events;
-  	},
-
-  	_close: function () {
-  		if (this._map) {
-  			this._map.closePopup(this);
-  		}
-  	},
-
-  	_initLayout: function () {
-  		var prefix = 'leaflet-popup',
-  		    container = this._container = create$1('div',
-  			prefix + ' ' + (this.options.className || '') +
-  			' leaflet-zoom-animated');
-
-  		var wrapper = this._wrapper = create$1('div', prefix + '-content-wrapper', container);
-  		this._contentNode = create$1('div', prefix + '-content', wrapper);
-
-  		disableClickPropagation(container);
-  		disableScrollPropagation(this._contentNode);
-  		on(container, 'contextmenu', stopPropagation);
-
-  		this._tipContainer = create$1('div', prefix + '-tip-container', container);
-  		this._tip = create$1('div', prefix + '-tip', this._tipContainer);
-
-  		if (this.options.closeButton) {
-  			var closeButton = this._closeButton = create$1('a', prefix + '-close-button', container);
-  			closeButton.href = '#close';
-  			closeButton.innerHTML = '&#215;';
-
-  			on(closeButton, 'click', this._onCloseButtonClick, this);
-  		}
-  	},
-
-  	_updateLayout: function () {
-  		var container = this._contentNode,
-  		    style = container.style;
-
-  		style.width = '';
-  		style.whiteSpace = 'nowrap';
-
-  		var width = container.offsetWidth;
-  		width = Math.min(width, this.options.maxWidth);
-  		width = Math.max(width, this.options.minWidth);
-
-  		style.width = (width + 1) + 'px';
-  		style.whiteSpace = '';
-
-  		style.height = '';
-
-  		var height = container.offsetHeight,
-  		    maxHeight = this.options.maxHeight,
-  		    scrolledClass = 'leaflet-popup-scrolled';
-
-  		if (maxHeight && height > maxHeight) {
-  			style.height = maxHeight + 'px';
-  			addClass(container, scrolledClass);
-  		} else {
-  			removeClass(container, scrolledClass);
-  		}
-
-  		this._containerWidth = this._container.offsetWidth;
-  	},
-
-  	_animateZoom: function (e) {
-  		var pos = this._map._latLngToNewLayerPoint(this._latlng, e.zoom, e.center),
-  		    anchor = this._getAnchor();
-  		setPosition(this._container, pos.add(anchor));
-  	},
-
-  	_adjustPan: function () {
-  		if (!this.options.autoPan) { return; }
-  		if (this._map._panAnim) { this._map._panAnim.stop(); }
-
-  		var map = this._map,
-  		    marginBottom = parseInt(getStyle(this._container, 'marginBottom'), 10) || 0,
-  		    containerHeight = this._container.offsetHeight + marginBottom,
-  		    containerWidth = this._containerWidth,
-  		    layerPos = new Point(this._containerLeft, -containerHeight - this._containerBottom);
-
-  		layerPos._add(getPosition(this._container));
-
-  		var containerPos = map.layerPointToContainerPoint(layerPos),
-  		    padding = toPoint(this.options.autoPanPadding),
-  		    paddingTL = toPoint(this.options.autoPanPaddingTopLeft || padding),
-  		    paddingBR = toPoint(this.options.autoPanPaddingBottomRight || padding),
-  		    size = map.getSize(),
-  		    dx = 0,
-  		    dy = 0;
-
-  		if (containerPos.x + containerWidth + paddingBR.x > size.x) { // right
-  			dx = containerPos.x + containerWidth - size.x + paddingBR.x;
-  		}
-  		if (containerPos.x - dx - paddingTL.x < 0) { // left
-  			dx = containerPos.x - paddingTL.x;
-  		}
-  		if (containerPos.y + containerHeight + paddingBR.y > size.y) { // bottom
-  			dy = containerPos.y + containerHeight - size.y + paddingBR.y;
-  		}
-  		if (containerPos.y - dy - paddingTL.y < 0) { // top
-  			dy = containerPos.y - paddingTL.y;
-  		}
-
-  		// @namespace Map
-  		// @section Popup events
-  		// @event autopanstart: Event
-  		// Fired when the map starts autopanning when opening a popup.
-  		if (dx || dy) {
-  			map
-  			    .fire('autopanstart')
-  			    .panBy([dx, dy]);
-  		}
-  	},
-
-  	_onCloseButtonClick: function (e) {
-  		this._close();
-  		stop(e);
-  	},
-
-  	_getAnchor: function () {
-  		// Where should we anchor the popup on the source layer?
-  		return toPoint(this._source && this._source._getPopupAnchor ? this._source._getPopupAnchor() : [0, 0]);
-  	}
-
-  });
-
-  // @namespace Popup
-  // @factory L.popup(options?: Popup options, source?: Layer)
-  // Instantiates a `Popup` object given an optional `options` object that describes its appearance and location and an optional `source` object that is used to tag the popup with a reference to the Layer to which it refers.
-  var popup = function (options, source) {
-  	return new Popup(options, source);
-  };
-
-
-  /* @namespace Map
-   * @section Interaction Options
-   * @option closePopupOnClick: Boolean = true
-   * Set it to `false` if you don't want popups to close when user clicks the map.
-   */
-  Map.mergeOptions({
-  	closePopupOnClick: true
-  });
-
-
-  // @namespace Map
-  // @section Methods for Layers and Controls
-  Map.include({
-  	// @method openPopup(popup: Popup): this
-  	// Opens the specified popup while closing the previously opened (to make sure only one is opened at one time for usability).
-  	// @alternative
-  	// @method openPopup(content: String|HTMLElement, latlng: LatLng, options?: Popup options): this
-  	// Creates a popup with the specified content and options and opens it in the given point on a map.
-  	openPopup: function (popup, latlng, options) {
-  		if (!(popup instanceof Popup)) {
-  			popup = new Popup(options).setContent(popup);
-  		}
-
-  		if (latlng) {
-  			popup.setLatLng(latlng);
-  		}
-
-  		if (this.hasLayer(popup)) {
-  			return this;
-  		}
-
-  		if (this._popup && this._popup.options.autoClose) {
-  			this.closePopup();
-  		}
-
-  		this._popup = popup;
-  		return this.addLayer(popup);
-  	},
-
-  	// @method closePopup(popup?: Popup): this
-  	// Closes the popup previously opened with [openPopup](#map-openpopup) (or the given one).
-  	closePopup: function (popup) {
-  		if (!popup || popup === this._popup) {
-  			popup = this._popup;
-  			this._popup = null;
-  		}
-  		if (popup) {
-  			this.removeLayer(popup);
-  		}
-  		return this;
-  	}
-  });
-
-  /*
-   * @namespace Layer
-   * @section Popup methods example
-   *
-   * All layers share a set of methods convenient for binding popups to it.
-   *
-   * ```js
-   * var layer = L.Polygon(latlngs).bindPopup('Hi There!').addTo(map);
-   * layer.openPopup();
-   * layer.closePopup();
-   * ```
-   *
-   * Popups will also be automatically opened when the layer is clicked on and closed when the layer is removed from the map or another popup is opened.
-   */
-
-  // @section Popup methods
-  Layer.include({
-
-  	// @method bindPopup(content: String|HTMLElement|Function|Popup, options?: Popup options): this
-  	// Binds a popup to the layer with the passed `content` and sets up the
-  	// necessary event listeners. If a `Function` is passed it will receive
-  	// the layer as the first argument and should return a `String` or `HTMLElement`.
-  	bindPopup: function (content, options) {
-
-  		if (content instanceof Popup) {
-  			setOptions(content, options);
-  			this._popup = content;
-  			content._source = this;
-  		} else {
-  			if (!this._popup || options) {
-  				this._popup = new Popup(options, this);
-  			}
-  			this._popup.setContent(content);
-  		}
-
-  		if (!this._popupHandlersAdded) {
-  			this.on({
-  				click: this._openPopup,
-  				keypress: this._onKeyPress,
-  				remove: this.closePopup,
-  				move: this._movePopup
-  			});
-  			this._popupHandlersAdded = true;
-  		}
-
-  		return this;
-  	},
-
-  	// @method unbindPopup(): this
-  	// Removes the popup previously bound with `bindPopup`.
-  	unbindPopup: function () {
-  		if (this._popup) {
-  			this.off({
-  				click: this._openPopup,
-  				keypress: this._onKeyPress,
-  				remove: this.closePopup,
-  				move: this._movePopup
-  			});
-  			this._popupHandlersAdded = false;
-  			this._popup = null;
-  		}
-  		return this;
-  	},
-
-  	// @method openPopup(latlng?: LatLng): this
-  	// Opens the bound popup at the specified `latlng` or at the default popup anchor if no `latlng` is passed.
-  	openPopup: function (layer, latlng) {
-  		if (this._popup && this._map) {
-  			latlng = this._popup._prepareOpen(this, layer, latlng);
-
-  			// open the popup on the map
-  			this._map.openPopup(this._popup, latlng);
-  		}
-
-  		return this;
-  	},
-
-  	// @method closePopup(): this
-  	// Closes the popup bound to this layer if it is open.
-  	closePopup: function () {
-  		if (this._popup) {
-  			this._popup._close();
-  		}
-  		return this;
-  	},
-
-  	// @method togglePopup(): this
-  	// Opens or closes the popup bound to this layer depending on its current state.
-  	togglePopup: function (target) {
-  		if (this._popup) {
-  			if (this._popup._map) {
-  				this.closePopup();
-  			} else {
-  				this.openPopup(target);
-  			}
-  		}
-  		return this;
-  	},
-
-  	// @method isPopupOpen(): boolean
-  	// Returns `true` if the popup bound to this layer is currently open.
-  	isPopupOpen: function () {
-  		return (this._popup ? this._popup.isOpen() : false);
-  	},
-
-  	// @method setPopupContent(content: String|HTMLElement|Popup): this
-  	// Sets the content of the popup bound to this layer.
-  	setPopupContent: function (content) {
-  		if (this._popup) {
-  			this._popup.setContent(content);
-  		}
-  		return this;
-  	},
-
-  	// @method getPopup(): Popup
-  	// Returns the popup bound to this layer.
-  	getPopup: function () {
-  		return this._popup;
-  	},
-
-  	_openPopup: function (e) {
-  		var layer = e.layer || e.target;
-
-  		if (!this._popup) {
-  			return;
-  		}
-
-  		if (!this._map) {
-  			return;
-  		}
-
-  		// prevent map click
-  		stop(e);
-
-  		// if this inherits from Path its a vector and we can just
-  		// open the popup at the new location
-  		if (layer instanceof Path) {
-  			this.openPopup(e.layer || e.target, e.latlng);
-  			return;
-  		}
-
-  		// otherwise treat it like a marker and figure out
-  		// if we should toggle it open/closed
-  		if (this._map.hasLayer(this._popup) && this._popup._source === layer) {
-  			this.closePopup();
-  		} else {
-  			this.openPopup(layer, e.latlng);
-  		}
-  	},
-
-  	_movePopup: function (e) {
-  		this._popup.setLatLng(e.latlng);
-  	},
-
-  	_onKeyPress: function (e) {
-  		if (e.originalEvent.keyCode === 13) {
-  			this._openPopup(e);
-  		}
-  	}
-  });
-
-  /*
-   * @class Tooltip
-   * @inherits DivOverlay
-   * @aka L.Tooltip
-   * Used to display small texts on top of map layers.
-   *
-   * @example
-   *
-   * ```js
-   * marker.bindTooltip("my tooltip text").openTooltip();
-   * ```
-   * Note about tooltip offset. Leaflet takes two options in consideration
-   * for computing tooltip offsetting:
-   * - the `offset` Tooltip option: it defaults to [0, 0], and it's specific to one tooltip.
-   *   Add a positive x offset to move the tooltip to the right, and a positive y offset to
-   *   move it to the bottom. Negatives will move to the left and top.
-   * - the `tooltipAnchor` Icon option: this will only be considered for Marker. You
-   *   should adapt this value if you use a custom icon.
-   */
-
-
-  // @namespace Tooltip
-  var Tooltip = DivOverlay.extend({
-
-  	// @section
-  	// @aka Tooltip options
-  	options: {
-  		// @option pane: String = 'tooltipPane'
-  		// `Map pane` where the tooltip will be added.
-  		pane: 'tooltipPane',
-
-  		// @option offset: Point = Point(0, 0)
-  		// Optional offset of the tooltip position.
-  		offset: [0, 0],
-
-  		// @option direction: String = 'auto'
-  		// Direction where to open the tooltip. Possible values are: `right`, `left`,
-  		// `top`, `bottom`, `center`, `auto`.
-  		// `auto` will dynamically switch between `right` and `left` according to the tooltip
-  		// position on the map.
-  		direction: 'auto',
-
-  		// @option permanent: Boolean = false
-  		// Whether to open the tooltip permanently or only on mouseover.
-  		permanent: false,
-
-  		// @option sticky: Boolean = false
-  		// If true, the tooltip will follow the mouse instead of being fixed at the feature center.
-  		sticky: false,
-
-  		// @option interactive: Boolean = false
-  		// If true, the tooltip will listen to the feature events.
-  		interactive: false,
-
-  		// @option opacity: Number = 0.9
-  		// Tooltip container opacity.
-  		opacity: 0.9
-  	},
-
-  	onAdd: function (map) {
-  		DivOverlay.prototype.onAdd.call(this, map);
-  		this.setOpacity(this.options.opacity);
-
-  		// @namespace Map
-  		// @section Tooltip events
-  		// @event tooltipopen: TooltipEvent
-  		// Fired when a tooltip is opened in the map.
-  		map.fire('tooltipopen', {tooltip: this});
-
-  		if (this._source) {
-  			// @namespace Layer
-  			// @section Tooltip events
-  			// @event tooltipopen: TooltipEvent
-  			// Fired when a tooltip bound to this layer is opened.
-  			this._source.fire('tooltipopen', {tooltip: this}, true);
-  		}
-  	},
-
-  	onRemove: function (map) {
-  		DivOverlay.prototype.onRemove.call(this, map);
-
-  		// @namespace Map
-  		// @section Tooltip events
-  		// @event tooltipclose: TooltipEvent
-  		// Fired when a tooltip in the map is closed.
-  		map.fire('tooltipclose', {tooltip: this});
-
-  		if (this._source) {
-  			// @namespace Layer
-  			// @section Tooltip events
-  			// @event tooltipclose: TooltipEvent
-  			// Fired when a tooltip bound to this layer is closed.
-  			this._source.fire('tooltipclose', {tooltip: this}, true);
-  		}
-  	},
-
-  	getEvents: function () {
-  		var events = DivOverlay.prototype.getEvents.call(this);
-
-  		if (touch && !this.options.permanent) {
-  			events.preclick = this._close;
-  		}
-
-  		return events;
-  	},
-
-  	_close: function () {
-  		if (this._map) {
-  			this._map.closeTooltip(this);
-  		}
-  	},
-
-  	_initLayout: function () {
-  		var prefix = 'leaflet-tooltip',
-  		    className = prefix + ' ' + (this.options.className || '') + ' leaflet-zoom-' + (this._zoomAnimated ? 'animated' : 'hide');
-
-  		this._contentNode = this._container = create$1('div', className);
-  	},
-
-  	_updateLayout: function () {},
-
-  	_adjustPan: function () {},
-
-  	_setPosition: function (pos) {
-  		var subX, subY,
-  		    map = this._map,
-  		    container = this._container,
-  		    centerPoint = map.latLngToContainerPoint(map.getCenter()),
-  		    tooltipPoint = map.layerPointToContainerPoint(pos),
-  		    direction = this.options.direction,
-  		    tooltipWidth = container.offsetWidth,
-  		    tooltipHeight = container.offsetHeight,
-  		    offset = toPoint(this.options.offset),
-  		    anchor = this._getAnchor();
-
-  		if (direction === 'top') {
-  			subX = tooltipWidth / 2;
-  			subY = tooltipHeight;
-  		} else if (direction === 'bottom') {
-  			subX = tooltipWidth / 2;
-  			subY = 0;
-  		} else if (direction === 'center') {
-  			subX = tooltipWidth / 2;
-  			subY = tooltipHeight / 2;
-  		} else if (direction === 'right') {
-  			subX = 0;
-  			subY = tooltipHeight / 2;
-  		} else if (direction === 'left') {
-  			subX = tooltipWidth;
-  			subY = tooltipHeight / 2;
-  		} else if (tooltipPoint.x < centerPoint.x) {
-  			direction = 'right';
-  			subX = 0;
-  			subY = tooltipHeight / 2;
-  		} else {
-  			direction = 'left';
-  			subX = tooltipWidth + (offset.x + anchor.x) * 2;
-  			subY = tooltipHeight / 2;
-  		}
-
-  		pos = pos.subtract(toPoint(subX, subY, true)).add(offset).add(anchor);
-
-  		removeClass(container, 'leaflet-tooltip-right');
-  		removeClass(container, 'leaflet-tooltip-left');
-  		removeClass(container, 'leaflet-tooltip-top');
-  		removeClass(container, 'leaflet-tooltip-bottom');
-  		addClass(container, 'leaflet-tooltip-' + direction);
-  		setPosition(container, pos);
-  	},
-
-  	_updatePosition: function () {
-  		var pos = this._map.latLngToLayerPoint(this._latlng);
-  		this._setPosition(pos);
-  	},
-
-  	setOpacity: function (opacity) {
-  		this.options.opacity = opacity;
-
-  		if (this._container) {
-  			setOpacity(this._container, opacity);
-  		}
-  	},
-
-  	_animateZoom: function (e) {
-  		var pos = this._map._latLngToNewLayerPoint(this._latlng, e.zoom, e.center);
-  		this._setPosition(pos);
-  	},
-
-  	_getAnchor: function () {
-  		// Where should we anchor the tooltip on the source layer?
-  		return toPoint(this._source && this._source._getTooltipAnchor && !this.options.sticky ? this._source._getTooltipAnchor() : [0, 0]);
-  	}
-
-  });
-
-  // @namespace Tooltip
-  // @factory L.tooltip(options?: Tooltip options, source?: Layer)
-  // Instantiates a Tooltip object given an optional `options` object that describes its appearance and location and an optional `source` object that is used to tag the tooltip with a reference to the Layer to which it refers.
-  var tooltip = function (options, source) {
-  	return new Tooltip(options, source);
-  };
-
-  // @namespace Map
-  // @section Methods for Layers and Controls
-  Map.include({
-
-  	// @method openTooltip(tooltip: Tooltip): this
-  	// Opens the specified tooltip.
-  	// @alternative
-  	// @method openTooltip(content: String|HTMLElement, latlng: LatLng, options?: Tooltip options): this
-  	// Creates a tooltip with the specified content and options and open it.
-  	openTooltip: function (tooltip, latlng, options) {
-  		if (!(tooltip instanceof Tooltip)) {
-  			tooltip = new Tooltip(options).setContent(tooltip);
-  		}
-
-  		if (latlng) {
-  			tooltip.setLatLng(latlng);
-  		}
-
-  		if (this.hasLayer(tooltip)) {
-  			return this;
-  		}
-
-  		return this.addLayer(tooltip);
-  	},
-
-  	// @method closeTooltip(tooltip?: Tooltip): this
-  	// Closes the tooltip given as parameter.
-  	closeTooltip: function (tooltip) {
-  		if (tooltip) {
-  			this.removeLayer(tooltip);
-  		}
-  		return this;
-  	}
-
-  });
-
-  /*
-   * @namespace Layer
-   * @section Tooltip methods example
-   *
-   * All layers share a set of methods convenient for binding tooltips to it.
-   *
-   * ```js
-   * var layer = L.Polygon(latlngs).bindTooltip('Hi There!').addTo(map);
-   * layer.openTooltip();
-   * layer.closeTooltip();
-   * ```
-   */
-
-  // @section Tooltip methods
-  Layer.include({
-
-  	// @method bindTooltip(content: String|HTMLElement|Function|Tooltip, options?: Tooltip options): this
-  	// Binds a tooltip to the layer with the passed `content` and sets up the
-  	// necessary event listeners. If a `Function` is passed it will receive
-  	// the layer as the first argument and should return a `String` or `HTMLElement`.
-  	bindTooltip: function (content, options) {
-
-  		if (content instanceof Tooltip) {
-  			setOptions(content, options);
-  			this._tooltip = content;
-  			content._source = this;
-  		} else {
-  			if (!this._tooltip || options) {
-  				this._tooltip = new Tooltip(options, this);
-  			}
-  			this._tooltip.setContent(content);
-
-  		}
-
-  		this._initTooltipInteractions();
-
-  		if (this._tooltip.options.permanent && this._map && this._map.hasLayer(this)) {
-  			this.openTooltip();
-  		}
-
-  		return this;
-  	},
-
-  	// @method unbindTooltip(): this
-  	// Removes the tooltip previously bound with `bindTooltip`.
-  	unbindTooltip: function () {
-  		if (this._tooltip) {
-  			this._initTooltipInteractions(true);
-  			this.closeTooltip();
-  			this._tooltip = null;
-  		}
-  		return this;
-  	},
-
-  	_initTooltipInteractions: function (remove$$1) {
-  		if (!remove$$1 && this._tooltipHandlersAdded) { return; }
-  		var onOff = remove$$1 ? 'off' : 'on',
-  		    events = {
-  			remove: this.closeTooltip,
-  			move: this._moveTooltip
-  		    };
-  		if (!this._tooltip.options.permanent) {
-  			events.mouseover = this._openTooltip;
-  			events.mouseout = this.closeTooltip;
-  			if (this._tooltip.options.sticky) {
-  				events.mousemove = this._moveTooltip;
-  			}
-  			if (touch) {
-  				events.click = this._openTooltip;
-  			}
-  		} else {
-  			events.add = this._openTooltip;
-  		}
-  		this[onOff](events);
-  		this._tooltipHandlersAdded = !remove$$1;
-  	},
-
-  	// @method openTooltip(latlng?: LatLng): this
-  	// Opens the bound tooltip at the specified `latlng` or at the default tooltip anchor if no `latlng` is passed.
-  	openTooltip: function (layer, latlng) {
-  		if (this._tooltip && this._map) {
-  			latlng = this._tooltip._prepareOpen(this, layer, latlng);
-
-  			// open the tooltip on the map
-  			this._map.openTooltip(this._tooltip, latlng);
-
-  			// Tooltip container may not be defined if not permanent and never
-  			// opened.
-  			if (this._tooltip.options.interactive && this._tooltip._container) {
-  				addClass(this._tooltip._container, 'leaflet-clickable');
-  				this.addInteractiveTarget(this._tooltip._container);
-  			}
-  		}
-
-  		return this;
-  	},
-
-  	// @method closeTooltip(): this
-  	// Closes the tooltip bound to this layer if it is open.
-  	closeTooltip: function () {
-  		if (this._tooltip) {
-  			this._tooltip._close();
-  			if (this._tooltip.options.interactive && this._tooltip._container) {
-  				removeClass(this._tooltip._container, 'leaflet-clickable');
-  				this.removeInteractiveTarget(this._tooltip._container);
-  			}
-  		}
-  		return this;
-  	},
-
-  	// @method toggleTooltip(): this
-  	// Opens or closes the tooltip bound to this layer depending on its current state.
-  	toggleTooltip: function (target) {
-  		if (this._tooltip) {
-  			if (this._tooltip._map) {
-  				this.closeTooltip();
-  			} else {
-  				this.openTooltip(target);
-  			}
-  		}
-  		return this;
-  	},
-
-  	// @method isTooltipOpen(): boolean
-  	// Returns `true` if the tooltip bound to this layer is currently open.
-  	isTooltipOpen: function () {
-  		return this._tooltip.isOpen();
-  	},
-
-  	// @method setTooltipContent(content: String|HTMLElement|Tooltip): this
-  	// Sets the content of the tooltip bound to this layer.
-  	setTooltipContent: function (content) {
-  		if (this._tooltip) {
-  			this._tooltip.setContent(content);
-  		}
-  		return this;
-  	},
-
-  	// @method getTooltip(): Tooltip
-  	// Returns the tooltip bound to this layer.
-  	getTooltip: function () {
-  		return this._tooltip;
-  	},
-
-  	_openTooltip: function (e) {
-  		var layer = e.layer || e.target;
-
-  		if (!this._tooltip || !this._map) {
-  			return;
-  		}
-  		this.openTooltip(layer, this._tooltip.options.sticky ? e.latlng : undefined);
-  	},
-
-  	_moveTooltip: function (e) {
-  		var latlng = e.latlng, containerPoint, layerPoint;
-  		if (this._tooltip.options.sticky && e.originalEvent) {
-  			containerPoint = this._map.mouseEventToContainerPoint(e.originalEvent);
-  			layerPoint = this._map.containerPointToLayerPoint(containerPoint);
-  			latlng = this._map.layerPointToLatLng(layerPoint);
-  		}
-  		this._tooltip.setLatLng(latlng);
-  	}
-  });
-
-  /*
-   * @class DivIcon
-   * @aka L.DivIcon
-   * @inherits Icon
-   *
-   * Represents a lightweight icon for markers that uses a simple `<div>`
-   * element instead of an image. Inherits from `Icon` but ignores the `iconUrl` and shadow options.
-   *
-   * @example
-   * ```js
-   * var myIcon = L.divIcon({className: 'my-div-icon'});
-   * // you can set .my-div-icon styles in CSS
-   *
-   * L.marker([50.505, 30.57], {icon: myIcon}).addTo(map);
-   * ```
-   *
-   * By default, it has a 'leaflet-div-icon' CSS class and is styled as a little white square with a shadow.
-   */
-
-  var DivIcon = Icon.extend({
-  	options: {
-  		// @section
-  		// @aka DivIcon options
-  		iconSize: [12, 12], // also can be set through CSS
-
-  		// iconAnchor: (Point),
-  		// popupAnchor: (Point),
-
-  		// @option html: String|HTMLElement = ''
-  		// Custom HTML code to put inside the div element, empty by default. Alternatively,
-  		// an instance of `HTMLElement`.
-  		html: false,
-
-  		// @option bgPos: Point = [0, 0]
-  		// Optional relative position of the background, in pixels
-  		bgPos: null,
-
-  		className: 'leaflet-div-icon'
-  	},
-
-  	createIcon: function (oldIcon) {
-  		var div = (oldIcon && oldIcon.tagName === 'DIV') ? oldIcon : document.createElement('div'),
-  		    options = this.options;
-
-  		if (options.html instanceof Element) {
-  			empty(div);
-  			div.appendChild(options.html);
-  		} else {
-  			div.innerHTML = options.html !== false ? options.html : '';
-  		}
-
-  		if (options.bgPos) {
-  			var bgPos = toPoint(options.bgPos);
-  			div.style.backgroundPosition = (-bgPos.x) + 'px ' + (-bgPos.y) + 'px';
-  		}
-  		this._setIconStyles(div, 'icon');
-
-  		return div;
-  	},
-
-  	createShadow: function () {
-  		return null;
-  	}
-  });
-
-  // @factory L.divIcon(options: DivIcon options)
-  // Creates a `DivIcon` instance with the given options.
-  function divIcon(options) {
-  	return new DivIcon(options);
-  }
-
-  Icon.Default = IconDefault;
-
-  /*
-   * @class GridLayer
-   * @inherits Layer
-   * @aka L.GridLayer
-   *
-   * Generic class for handling a tiled grid of HTML elements. This is the base class for all tile layers and replaces `TileLayer.Canvas`.
-   * GridLayer can be extended to create a tiled grid of HTML elements like `<canvas>`, `<img>` or `<div>`. GridLayer will handle creating and animating these DOM elements for you.
-   *
-   *
-   * @section Synchronous usage
-   * @example
-   *
-   * To create a custom layer, extend GridLayer and implement the `createTile()` method, which will be passed a `Point` object with the `x`, `y`, and `z` (zoom level) coordinates to draw your tile.
-   *
-   * ```js
-   * var CanvasLayer = L.GridLayer.extend({
-   *     createTile: function(coords){
-   *         // create a <canvas> element for drawing
-   *         var tile = L.DomUtil.create('canvas', 'leaflet-tile');
-   *
-   *         // setup tile width and height according to the options
-   *         var size = this.getTileSize();
-   *         tile.width = size.x;
-   *         tile.height = size.y;
-   *
-   *         // get a canvas context and draw something on it using coords.x, coords.y and coords.z
-   *         var ctx = tile.getContext('2d');
-   *
-   *         // return the tile so it can be rendered on screen
-   *         return tile;
-   *     }
-   * });
-   * ```
-   *
-   * @section Asynchronous usage
-   * @example
-   *
-   * Tile creation can also be asynchronous, this is useful when using a third-party drawing library. Once the tile is finished drawing it can be passed to the `done()` callback.
-   *
-   * ```js
-   * var CanvasLayer = L.GridLayer.extend({
-   *     createTile: function(coords, done){
-   *         var error;
-   *
-   *         // create a <canvas> element for drawing
-   *         var tile = L.DomUtil.create('canvas', 'leaflet-tile');
-   *
-   *         // setup tile width and height according to the options
-   *         var size = this.getTileSize();
-   *         tile.width = size.x;
-   *         tile.height = size.y;
-   *
-   *         // draw something asynchronously and pass the tile to the done() callback
-   *         setTimeout(function() {
-   *             done(error, tile);
-   *         }, 1000);
-   *
-   *         return tile;
-   *     }
-   * });
-   * ```
-   *
-   * @section
-   */
-
-
-  var GridLayer = Layer.extend({
-
-  	// @section
-  	// @aka GridLayer options
-  	options: {
-  		// @option tileSize: Number|Point = 256
-  		// Width and height of tiles in the grid. Use a number if width and height are equal, or `L.point(width, height)` otherwise.
-  		tileSize: 256,
-
-  		// @option opacity: Number = 1.0
-  		// Opacity of the tiles. Can be used in the `createTile()` function.
-  		opacity: 1,
-
-  		// @option updateWhenIdle: Boolean = (depends)
-  		// Load new tiles only when panning ends.
-  		// `true` by default on mobile browsers, in order to avoid too many requests and keep smooth navigation.
-  		// `false` otherwise in order to display new tiles _during_ panning, since it is easy to pan outside the
-  		// [`keepBuffer`](#gridlayer-keepbuffer) option in desktop browsers.
-  		updateWhenIdle: mobile,
-
-  		// @option updateWhenZooming: Boolean = true
-  		// By default, a smooth zoom animation (during a [touch zoom](#map-touchzoom) or a [`flyTo()`](#map-flyto)) will update grid layers every integer zoom level. Setting this option to `false` will update the grid layer only when the smooth animation ends.
-  		updateWhenZooming: true,
-
-  		// @option updateInterval: Number = 200
-  		// Tiles will not update more than once every `updateInterval` milliseconds when panning.
-  		updateInterval: 200,
-
-  		// @option zIndex: Number = 1
-  		// The explicit zIndex of the tile layer.
-  		zIndex: 1,
-
-  		// @option bounds: LatLngBounds = undefined
-  		// If set, tiles will only be loaded inside the set `LatLngBounds`.
-  		bounds: null,
-
-  		// @option minZoom: Number = 0
-  		// The minimum zoom level down to which this layer will be displayed (inclusive).
-  		minZoom: 0,
-
-  		// @option maxZoom: Number = undefined
-  		// The maximum zoom level up to which this layer will be displayed (inclusive).
-  		maxZoom: undefined,
-
-  		// @option maxNativeZoom: Number = undefined
-  		// Maximum zoom number the tile source has available. If it is specified,
-  		// the tiles on all zoom levels higher than `maxNativeZoom` will be loaded
-  		// from `maxNativeZoom` level and auto-scaled.
-  		maxNativeZoom: undefined,
-
-  		// @option minNativeZoom: Number = undefined
-  		// Minimum zoom number the tile source has available. If it is specified,
-  		// the tiles on all zoom levels lower than `minNativeZoom` will be loaded
-  		// from `minNativeZoom` level and auto-scaled.
-  		minNativeZoom: undefined,
-
-  		// @option noWrap: Boolean = false
-  		// Whether the layer is wrapped around the antimeridian. If `true`, the
-  		// GridLayer will only be displayed once at low zoom levels. Has no
-  		// effect when the [map CRS](#map-crs) doesn't wrap around. Can be used
-  		// in combination with [`bounds`](#gridlayer-bounds) to prevent requesting
-  		// tiles outside the CRS limits.
-  		noWrap: false,
-
-  		// @option pane: String = 'tilePane'
-  		// `Map pane` where the grid layer will be added.
-  		pane: 'tilePane',
-
-  		// @option className: String = ''
-  		// A custom class name to assign to the tile layer. Empty by default.
-  		className: '',
-
-  		// @option keepBuffer: Number = 2
-  		// When panning the map, keep this many rows and columns of tiles before unloading them.
-  		keepBuffer: 2
-  	},
-
-  	initialize: function (options) {
-  		setOptions(this, options);
-  	},
-
-  	onAdd: function () {
-  		this._initContainer();
-
-  		this._levels = {};
-  		this._tiles = {};
-
-  		this._resetView();
-  		this._update();
-  	},
-
-  	beforeAdd: function (map) {
-  		map._addZoomLimit(this);
-  	},
-
-  	onRemove: function (map) {
-  		this._removeAllTiles();
-  		remove(this._container);
-  		map._removeZoomLimit(this);
-  		this._container = null;
-  		this._tileZoom = undefined;
-  	},
-
-  	// @method bringToFront: this
-  	// Brings the tile layer to the top of all tile layers.
-  	bringToFront: function () {
-  		if (this._map) {
-  			toFront(this._container);
-  			this._setAutoZIndex(Math.max);
-  		}
-  		return this;
-  	},
-
-  	// @method bringToBack: this
-  	// Brings the tile layer to the bottom of all tile layers.
-  	bringToBack: function () {
-  		if (this._map) {
-  			toBack(this._container);
-  			this._setAutoZIndex(Math.min);
-  		}
-  		return this;
-  	},
-
-  	// @method getContainer: HTMLElement
-  	// Returns the HTML element that contains the tiles for this layer.
-  	getContainer: function () {
-  		return this._container;
-  	},
-
-  	// @method setOpacity(opacity: Number): this
-  	// Changes the [opacity](#gridlayer-opacity) of the grid layer.
-  	setOpacity: function (opacity) {
-  		this.options.opacity = opacity;
-  		this._updateOpacity();
-  		return this;
-  	},
-
-  	// @method setZIndex(zIndex: Number): this
-  	// Changes the [zIndex](#gridlayer-zindex) of the grid layer.
-  	setZIndex: function (zIndex) {
-  		this.options.zIndex = zIndex;
-  		this._updateZIndex();
-
-  		return this;
-  	},
-
-  	// @method isLoading: Boolean
-  	// Returns `true` if any tile in the grid layer has not finished loading.
-  	isLoading: function () {
-  		return this._loading;
-  	},
-
-  	// @method redraw: this
-  	// Causes the layer to clear all the tiles and request them again.
-  	redraw: function () {
-  		if (this._map) {
-  			this._removeAllTiles();
-  			this._update();
-  		}
-  		return this;
-  	},
-
-  	getEvents: function () {
-  		var events = {
-  			viewprereset: this._invalidateAll,
-  			viewreset: this._resetView,
-  			zoom: this._resetView,
-  			moveend: this._onMoveEnd
-  		};
-
-  		if (!this.options.updateWhenIdle) {
-  			// update tiles on move, but not more often than once per given interval
-  			if (!this._onMove) {
-  				this._onMove = throttle(this._onMoveEnd, this.options.updateInterval, this);
-  			}
-
-  			events.move = this._onMove;
-  		}
-
-  		if (this._zoomAnimated) {
-  			events.zoomanim = this._animateZoom;
-  		}
-
-  		return events;
-  	},
-
-  	// @section Extension methods
-  	// Layers extending `GridLayer` shall reimplement the following method.
-  	// @method createTile(coords: Object, done?: Function): HTMLElement
-  	// Called only internally, must be overridden by classes extending `GridLayer`.
-  	// Returns the `HTMLElement` corresponding to the given `coords`. If the `done` callback
-  	// is specified, it must be called when the tile has finished loading and drawing.
-  	createTile: function () {
-  		return document.createElement('div');
-  	},
-
-  	// @section
-  	// @method getTileSize: Point
-  	// Normalizes the [tileSize option](#gridlayer-tilesize) into a point. Used by the `createTile()` method.
-  	getTileSize: function () {
-  		var s = this.options.tileSize;
-  		return s instanceof Point ? s : new Point(s, s);
-  	},
-
-  	_updateZIndex: function () {
-  		if (this._container && this.options.zIndex !== undefined && this.options.zIndex !== null) {
-  			this._container.style.zIndex = this.options.zIndex;
-  		}
-  	},
-
-  	_setAutoZIndex: function (compare) {
-  		// go through all other layers of the same pane, set zIndex to max + 1 (front) or min - 1 (back)
-
-  		var layers = this.getPane().children,
-  		    edgeZIndex = -compare(-Infinity, Infinity); // -Infinity for max, Infinity for min
-
-  		for (var i = 0, len = layers.length, zIndex; i < len; i++) {
-
-  			zIndex = layers[i].style.zIndex;
-
-  			if (layers[i] !== this._container && zIndex) {
-  				edgeZIndex = compare(edgeZIndex, +zIndex);
-  			}
-  		}
-
-  		if (isFinite(edgeZIndex)) {
-  			this.options.zIndex = edgeZIndex + compare(-1, 1);
-  			this._updateZIndex();
-  		}
-  	},
-
-  	_updateOpacity: function () {
-  		if (!this._map) { return; }
-
-  		// IE doesn't inherit filter opacity properly, so we're forced to set it on tiles
-  		if (ielt9) { return; }
-
-  		setOpacity(this._container, this.options.opacity);
-
-  		var now = +new Date(),
-  		    nextFrame = false,
-  		    willPrune = false;
-
-  		for (var key in this._tiles) {
-  			var tile = this._tiles[key];
-  			if (!tile.current || !tile.loaded) { continue; }
-
-  			var fade = Math.min(1, (now - tile.loaded) / 200);
-
-  			setOpacity(tile.el, fade);
-  			if (fade < 1) {
-  				nextFrame = true;
-  			} else {
-  				if (tile.active) {
-  					willPrune = true;
-  				} else {
-  					this._onOpaqueTile(tile);
-  				}
-  				tile.active = true;
-  			}
-  		}
-
-  		if (willPrune && !this._noPrune) { this._pruneTiles(); }
-
-  		if (nextFrame) {
-  			cancelAnimFrame(this._fadeFrame);
-  			this._fadeFrame = requestAnimFrame(this._updateOpacity, this);
-  		}
-  	},
-
-  	_onOpaqueTile: falseFn,
-
-  	_initContainer: function () {
-  		if (this._container) { return; }
-
-  		this._container = create$1('div', 'leaflet-layer ' + (this.options.className || ''));
-  		this._updateZIndex();
-
-  		if (this.options.opacity < 1) {
-  			this._updateOpacity();
-  		}
-
-  		this.getPane().appendChild(this._container);
-  	},
-
-  	_updateLevels: function () {
-
-  		var zoom = this._tileZoom,
-  		    maxZoom = this.options.maxZoom;
-
-  		if (zoom === undefined) { return undefined; }
-
-  		for (var z in this._levels) {
-  			z = Number(z);
-  			if (this._levels[z].el.children.length || z === zoom) {
-  				this._levels[z].el.style.zIndex = maxZoom - Math.abs(zoom - z);
-  				this._onUpdateLevel(z);
-  			} else {
-  				remove(this._levels[z].el);
-  				this._removeTilesAtZoom(z);
-  				this._onRemoveLevel(z);
-  				delete this._levels[z];
-  			}
-  		}
-
-  		var level = this._levels[zoom],
-  		    map = this._map;
-
-  		if (!level) {
-  			level = this._levels[zoom] = {};
-
-  			level.el = create$1('div', 'leaflet-tile-container leaflet-zoom-animated', this._container);
-  			level.el.style.zIndex = maxZoom;
-
-  			level.origin = map.project(map.unproject(map.getPixelOrigin()), zoom).round();
-  			level.zoom = zoom;
-
-  			this._setZoomTransform(level, map.getCenter(), map.getZoom());
-
-  			// force the browser to consider the newly added element for transition
-  			falseFn(level.el.offsetWidth);
-
-  			this._onCreateLevel(level);
-  		}
-
-  		this._level = level;
-
-  		return level;
-  	},
-
-  	_onUpdateLevel: falseFn,
-
-  	_onRemoveLevel: falseFn,
-
-  	_onCreateLevel: falseFn,
-
-  	_pruneTiles: function () {
-  		if (!this._map) {
-  			return;
-  		}
-
-  		var key, tile;
-
-  		var zoom = this._map.getZoom();
-  		if (zoom > this.options.maxZoom ||
-  			zoom < this.options.minZoom) {
-  			this._removeAllTiles();
-  			return;
-  		}
-
-  		for (key in this._tiles) {
-  			tile = this._tiles[key];
-  			tile.retain = tile.current;
-  		}
-
-  		for (key in this._tiles) {
-  			tile = this._tiles[key];
-  			if (tile.current && !tile.active) {
-  				var coords = tile.coords;
-  				if (!this._retainParent(coords.x, coords.y, coords.z, coords.z - 5)) {
-  					this._retainChildren(coords.x, coords.y, coords.z, coords.z + 2);
-  				}
-  			}
-  		}
-
-  		for (key in this._tiles) {
-  			if (!this._tiles[key].retain) {
-  				this._removeTile(key);
-  			}
-  		}
-  	},
-
-  	_removeTilesAtZoom: function (zoom) {
-  		for (var key in this._tiles) {
-  			if (this._tiles[key].coords.z !== zoom) {
-  				continue;
-  			}
-  			this._removeTile(key);
-  		}
-  	},
-
-  	_removeAllTiles: function () {
-  		for (var key in this._tiles) {
-  			this._removeTile(key);
-  		}
-  	},
-
-  	_invalidateAll: function () {
-  		for (var z in this._levels) {
-  			remove(this._levels[z].el);
-  			this._onRemoveLevel(Number(z));
-  			delete this._levels[z];
-  		}
-  		this._removeAllTiles();
-
-  		this._tileZoom = undefined;
-  	},
-
-  	_retainParent: function (x, y, z, minZoom) {
-  		var x2 = Math.floor(x / 2),
-  		    y2 = Math.floor(y / 2),
-  		    z2 = z - 1,
-  		    coords2 = new Point(+x2, +y2);
-  		coords2.z = +z2;
-
-  		var key = this._tileCoordsToKey(coords2),
-  		    tile = this._tiles[key];
-
-  		if (tile && tile.active) {
-  			tile.retain = true;
-  			return true;
-
-  		} else if (tile && tile.loaded) {
-  			tile.retain = true;
-  		}
-
-  		if (z2 > minZoom) {
-  			return this._retainParent(x2, y2, z2, minZoom);
-  		}
-
-  		return false;
-  	},
-
-  	_retainChildren: function (x, y, z, maxZoom) {
-
-  		for (var i = 2 * x; i < 2 * x + 2; i++) {
-  			for (var j = 2 * y; j < 2 * y + 2; j++) {
-
-  				var coords = new Point(i, j);
-  				coords.z = z + 1;
-
-  				var key = this._tileCoordsToKey(coords),
-  				    tile = this._tiles[key];
-
-  				if (tile && tile.active) {
-  					tile.retain = true;
-  					continue;
-
-  				} else if (tile && tile.loaded) {
-  					tile.retain = true;
-  				}
-
-  				if (z + 1 < maxZoom) {
-  					this._retainChildren(i, j, z + 1, maxZoom);
-  				}
-  			}
-  		}
-  	},
-
-  	_resetView: function (e) {
-  		var animating = e && (e.pinch || e.flyTo);
-  		this._setView(this._map.getCenter(), this._map.getZoom(), animating, animating);
-  	},
-
-  	_animateZoom: function (e) {
-  		this._setView(e.center, e.zoom, true, e.noUpdate);
-  	},
-
-  	_clampZoom: function (zoom) {
-  		var options = this.options;
-
-  		if (undefined !== options.minNativeZoom && zoom < options.minNativeZoom) {
-  			return options.minNativeZoom;
-  		}
-
-  		if (undefined !== options.maxNativeZoom && options.maxNativeZoom < zoom) {
-  			return options.maxNativeZoom;
-  		}
-
-  		return zoom;
-  	},
-
-  	_setView: function (center, zoom, noPrune, noUpdate) {
-  		var tileZoom = Math.round(zoom);
-  		if ((this.options.maxZoom !== undefined && tileZoom > this.options.maxZoom) ||
-  		    (this.options.minZoom !== undefined && tileZoom < this.options.minZoom)) {
-  			tileZoom = undefined;
-  		} else {
-  			tileZoom = this._clampZoom(tileZoom);
-  		}
-
-  		var tileZoomChanged = this.options.updateWhenZooming && (tileZoom !== this._tileZoom);
-
-  		if (!noUpdate || tileZoomChanged) {
-
-  			this._tileZoom = tileZoom;
-
-  			if (this._abortLoading) {
-  				this._abortLoading();
-  			}
-
-  			this._updateLevels();
-  			this._resetGrid();
-
-  			if (tileZoom !== undefined) {
-  				this._update(center);
-  			}
-
-  			if (!noPrune) {
-  				this._pruneTiles();
-  			}
-
-  			// Flag to prevent _updateOpacity from pruning tiles during
-  			// a zoom anim or a pinch gesture
-  			this._noPrune = !!noPrune;
-  		}
-
-  		this._setZoomTransforms(center, zoom);
-  	},
-
-  	_setZoomTransforms: function (center, zoom) {
-  		for (var i in this._levels) {
-  			this._setZoomTransform(this._levels[i], center, zoom);
-  		}
-  	},
-
-  	_setZoomTransform: function (level, center, zoom) {
-  		var scale = this._map.getZoomScale(zoom, level.zoom),
-  		    translate = level.origin.multiplyBy(scale)
-  		        .subtract(this._map._getNewPixelOrigin(center, zoom)).round();
-
-  		if (any3d) {
-  			setTransform(level.el, translate, scale);
-  		} else {
-  			setPosition(level.el, translate);
-  		}
-  	},
-
-  	_resetGrid: function () {
-  		var map = this._map,
-  		    crs = map.options.crs,
-  		    tileSize = this._tileSize = this.getTileSize(),
-  		    tileZoom = this._tileZoom;
-
-  		var bounds = this._map.getPixelWorldBounds(this._tileZoom);
-  		if (bounds) {
-  			this._globalTileRange = this._pxBoundsToTileRange(bounds);
-  		}
-
-  		this._wrapX = crs.wrapLng && !this.options.noWrap && [
-  			Math.floor(map.project([0, crs.wrapLng[0]], tileZoom).x / tileSize.x),
-  			Math.ceil(map.project([0, crs.wrapLng[1]], tileZoom).x / tileSize.y)
-  		];
-  		this._wrapY = crs.wrapLat && !this.options.noWrap && [
-  			Math.floor(map.project([crs.wrapLat[0], 0], tileZoom).y / tileSize.x),
-  			Math.ceil(map.project([crs.wrapLat[1], 0], tileZoom).y / tileSize.y)
-  		];
-  	},
-
-  	_onMoveEnd: function () {
-  		if (!this._map || this._map._animatingZoom) { return; }
-
-  		this._update();
-  	},
-
-  	_getTiledPixelBounds: function (center) {
-  		var map = this._map,
-  		    mapZoom = map._animatingZoom ? Math.max(map._animateToZoom, map.getZoom()) : map.getZoom(),
-  		    scale = map.getZoomScale(mapZoom, this._tileZoom),
-  		    pixelCenter = map.project(center, this._tileZoom).floor(),
-  		    halfSize = map.getSize().divideBy(scale * 2);
-
-  		return new Bounds(pixelCenter.subtract(halfSize), pixelCenter.add(halfSize));
-  	},
-
-  	// Private method to load tiles in the grid's active zoom level according to map bounds
-  	_update: function (center) {
-  		var map = this._map;
-  		if (!map) { return; }
-  		var zoom = this._clampZoom(map.getZoom());
-
-  		if (center === undefined) { center = map.getCenter(); }
-  		if (this._tileZoom === undefined) { return; }	// if out of minzoom/maxzoom
-
-  		var pixelBounds = this._getTiledPixelBounds(center),
-  		    tileRange = this._pxBoundsToTileRange(pixelBounds),
-  		    tileCenter = tileRange.getCenter(),
-  		    queue = [],
-  		    margin = this.options.keepBuffer,
-  		    noPruneRange = new Bounds(tileRange.getBottomLeft().subtract([margin, -margin]),
-  		                              tileRange.getTopRight().add([margin, -margin]));
-
-  		// Sanity check: panic if the tile range contains Infinity somewhere.
-  		if (!(isFinite(tileRange.min.x) &&
-  		      isFinite(tileRange.min.y) &&
-  		      isFinite(tileRange.max.x) &&
-  		      isFinite(tileRange.max.y))) { throw new Error('Attempted to load an infinite number of tiles'); }
-
-  		for (var key in this._tiles) {
-  			var c = this._tiles[key].coords;
-  			if (c.z !== this._tileZoom || !noPruneRange.contains(new Point(c.x, c.y))) {
-  				this._tiles[key].current = false;
-  			}
-  		}
-
-  		// _update just loads more tiles. If the tile zoom level differs too much
-  		// from the map's, let _setView reset levels and prune old tiles.
-  		if (Math.abs(zoom - this._tileZoom) > 1) { this._setView(center, zoom); return; }
-
-  		// create a queue of coordinates to load tiles from
-  		for (var j = tileRange.min.y; j <= tileRange.max.y; j++) {
-  			for (var i = tileRange.min.x; i <= tileRange.max.x; i++) {
-  				var coords = new Point(i, j);
-  				coords.z = this._tileZoom;
-
-  				if (!this._isValidTile(coords)) { continue; }
-
-  				var tile = this._tiles[this._tileCoordsToKey(coords)];
-  				if (tile) {
-  					tile.current = true;
-  				} else {
-  					queue.push(coords);
-  				}
-  			}
-  		}
-
-  		// sort tile queue to load tiles in order of their distance to center
-  		queue.sort(function (a, b) {
-  			return a.distanceTo(tileCenter) - b.distanceTo(tileCenter);
-  		});
-
-  		if (queue.length !== 0) {
-  			// if it's the first batch of tiles to load
-  			if (!this._loading) {
-  				this._loading = true;
-  				// @event loading: Event
-  				// Fired when the grid layer starts loading tiles.
-  				this.fire('loading');
-  			}
-
-  			// create DOM fragment to append tiles in one batch
-  			var fragment = document.createDocumentFragment();
-
-  			for (i = 0; i < queue.length; i++) {
-  				this._addTile(queue[i], fragment);
-  			}
-
-  			this._level.el.appendChild(fragment);
-  		}
-  	},
-
-  	_isValidTile: function (coords) {
-  		var crs = this._map.options.crs;
-
-  		if (!crs.infinite) {
-  			// don't load tile if it's out of bounds and not wrapped
-  			var bounds = this._globalTileRange;
-  			if ((!crs.wrapLng && (coords.x < bounds.min.x || coords.x > bounds.max.x)) ||
-  			    (!crs.wrapLat && (coords.y < bounds.min.y || coords.y > bounds.max.y))) { return false; }
-  		}
-
-  		if (!this.options.bounds) { return true; }
-
-  		// don't load tile if it doesn't intersect the bounds in options
-  		var tileBounds = this._tileCoordsToBounds(coords);
-  		return toLatLngBounds(this.options.bounds).overlaps(tileBounds);
-  	},
-
-  	_keyToBounds: function (key) {
-  		return this._tileCoordsToBounds(this._keyToTileCoords(key));
-  	},
-
-  	_tileCoordsToNwSe: function (coords) {
-  		var map = this._map,
-  		    tileSize = this.getTileSize(),
-  		    nwPoint = coords.scaleBy(tileSize),
-  		    sePoint = nwPoint.add(tileSize),
-  		    nw = map.unproject(nwPoint, coords.z),
-  		    se = map.unproject(sePoint, coords.z);
-  		return [nw, se];
-  	},
-
-  	// converts tile coordinates to its geographical bounds
-  	_tileCoordsToBounds: function (coords) {
-  		var bp = this._tileCoordsToNwSe(coords),
-  		    bounds = new LatLngBounds(bp[0], bp[1]);
-
-  		if (!this.options.noWrap) {
-  			bounds = this._map.wrapLatLngBounds(bounds);
-  		}
-  		return bounds;
-  	},
-  	// converts tile coordinates to key for the tile cache
-  	_tileCoordsToKey: function (coords) {
-  		return coords.x + ':' + coords.y + ':' + coords.z;
-  	},
-
-  	// converts tile cache key to coordinates
-  	_keyToTileCoords: function (key) {
-  		var k = key.split(':'),
-  		    coords = new Point(+k[0], +k[1]);
-  		coords.z = +k[2];
-  		return coords;
-  	},
-
-  	_removeTile: function (key) {
-  		var tile = this._tiles[key];
-  		if (!tile) { return; }
-
-  		remove(tile.el);
-
-  		delete this._tiles[key];
-
-  		// @event tileunload: TileEvent
-  		// Fired when a tile is removed (e.g. when a tile goes off the screen).
-  		this.fire('tileunload', {
-  			tile: tile.el,
-  			coords: this._keyToTileCoords(key)
-  		});
-  	},
-
-  	_initTile: function (tile) {
-  		addClass(tile, 'leaflet-tile');
-
-  		var tileSize = this.getTileSize();
-  		tile.style.width = tileSize.x + 'px';
-  		tile.style.height = tileSize.y + 'px';
-
-  		tile.onselectstart = falseFn;
-  		tile.onmousemove = falseFn;
-
-  		// update opacity on tiles in IE7-8 because of filter inheritance problems
-  		if (ielt9 && this.options.opacity < 1) {
-  			setOpacity(tile, this.options.opacity);
-  		}
-
-  		// without this hack, tiles disappear after zoom on Chrome for Android
-  		// https://github.com/Leaflet/Leaflet/issues/2078
-  		if (android && !android23) {
-  			tile.style.WebkitBackfaceVisibility = 'hidden';
-  		}
-  	},
-
-  	_addTile: function (coords, container) {
-  		var tilePos = this._getTilePos(coords),
-  		    key = this._tileCoordsToKey(coords);
-
-  		var tile = this.createTile(this._wrapCoords(coords), bind(this._tileReady, this, coords));
-
-  		this._initTile(tile);
-
-  		// if createTile is defined with a second argument ("done" callback),
-  		// we know that tile is async and will be ready later; otherwise
-  		if (this.createTile.length < 2) {
-  			// mark tile as ready, but delay one frame for opacity animation to happen
-  			requestAnimFrame(bind(this._tileReady, this, coords, null, tile));
-  		}
-
-  		setPosition(tile, tilePos);
-
-  		// save tile in cache
-  		this._tiles[key] = {
-  			el: tile,
-  			coords: coords,
-  			current: true
-  		};
-
-  		container.appendChild(tile);
-  		// @event tileloadstart: TileEvent
-  		// Fired when a tile is requested and starts loading.
-  		this.fire('tileloadstart', {
-  			tile: tile,
-  			coords: coords
-  		});
-  	},
-
-  	_tileReady: function (coords, err, tile) {
-  		if (err) {
-  			// @event tileerror: TileErrorEvent
-  			// Fired when there is an error loading a tile.
-  			this.fire('tileerror', {
-  				error: err,
-  				tile: tile,
-  				coords: coords
-  			});
-  		}
-
-  		var key = this._tileCoordsToKey(coords);
-
-  		tile = this._tiles[key];
-  		if (!tile) { return; }
-
-  		tile.loaded = +new Date();
-  		if (this._map._fadeAnimated) {
-  			setOpacity(tile.el, 0);
-  			cancelAnimFrame(this._fadeFrame);
-  			this._fadeFrame = requestAnimFrame(this._updateOpacity, this);
-  		} else {
-  			tile.active = true;
-  			this._pruneTiles();
-  		}
-
-  		if (!err) {
-  			addClass(tile.el, 'leaflet-tile-loaded');
-
-  			// @event tileload: TileEvent
-  			// Fired when a tile loads.
-  			this.fire('tileload', {
-  				tile: tile.el,
-  				coords: coords
-  			});
-  		}
-
-  		if (this._noTilesToLoad()) {
-  			this._loading = false;
-  			// @event load: Event
-  			// Fired when the grid layer loaded all visible tiles.
-  			this.fire('load');
-
-  			if (ielt9 || !this._map._fadeAnimated) {
-  				requestAnimFrame(this._pruneTiles, this);
-  			} else {
-  				// Wait a bit more than 0.2 secs (the duration of the tile fade-in)
-  				// to trigger a pruning.
-  				setTimeout(bind(this._pruneTiles, this), 250);
-  			}
-  		}
-  	},
-
-  	_getTilePos: function (coords) {
-  		return coords.scaleBy(this.getTileSize()).subtract(this._level.origin);
-  	},
-
-  	_wrapCoords: function (coords) {
-  		var newCoords = new Point(
-  			this._wrapX ? wrapNum(coords.x, this._wrapX) : coords.x,
-  			this._wrapY ? wrapNum(coords.y, this._wrapY) : coords.y);
-  		newCoords.z = coords.z;
-  		return newCoords;
-  	},
-
-  	_pxBoundsToTileRange: function (bounds) {
-  		var tileSize = this.getTileSize();
-  		return new Bounds(
-  			bounds.min.unscaleBy(tileSize).floor(),
-  			bounds.max.unscaleBy(tileSize).ceil().subtract([1, 1]));
-  	},
-
-  	_noTilesToLoad: function () {
-  		for (var key in this._tiles) {
-  			if (!this._tiles[key].loaded) { return false; }
-  		}
-  		return true;
-  	}
-  });
-
-  // @factory L.gridLayer(options?: GridLayer options)
-  // Creates a new instance of GridLayer with the supplied options.
-  function gridLayer(options) {
-  	return new GridLayer(options);
-  }
-
-  /*
-   * @class TileLayer
-   * @inherits GridLayer
-   * @aka L.TileLayer
-   * Used to load and display tile layers on the map. Note that most tile servers require attribution, which you can set under `Layer`. Extends `GridLayer`.
-   *
-   * @example
-   *
-   * ```js
-   * L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png?{foo}', {foo: 'bar', attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>'}).addTo(map);
-   * ```
-   *
-   * @section URL template
-   * @example
-   *
-   * A string of the following form:
-   *
-   * ```
-   * 'http://{s}.somedomain.com/blabla/{z}/{x}/{y}{r}.png'
-   * ```
-   *
-   * `{s}` means one of the available subdomains (used sequentially to help with browser parallel requests per domain limitation; subdomain values are specified in options; `a`, `b` or `c` by default, can be omitted), `{z}` — zoom level, `{x}` and `{y}` — tile coordinates. `{r}` can be used to add "&commat;2x" to the URL to load retina tiles.
-   *
-   * You can use custom keys in the template, which will be [evaluated](#util-template) from TileLayer options, like this:
-   *
-   * ```
-   * L.tileLayer('http://{s}.somedomain.com/{foo}/{z}/{x}/{y}.png', {foo: 'bar'});
-   * ```
-   */
-
-
-  var TileLayer = GridLayer.extend({
-
-  	// @section
-  	// @aka TileLayer options
-  	options: {
-  		// @option minZoom: Number = 0
-  		// The minimum zoom level down to which this layer will be displayed (inclusive).
-  		minZoom: 0,
-
-  		// @option maxZoom: Number = 18
-  		// The maximum zoom level up to which this layer will be displayed (inclusive).
-  		maxZoom: 18,
-
-  		// @option subdomains: String|String[] = 'abc'
-  		// Subdomains of the tile service. Can be passed in the form of one string (where each letter is a subdomain name) or an array of strings.
-  		subdomains: 'abc',
-
-  		// @option errorTileUrl: String = ''
-  		// URL to the tile image to show in place of the tile that failed to load.
-  		errorTileUrl: '',
-
-  		// @option zoomOffset: Number = 0
-  		// The zoom number used in tile URLs will be offset with this value.
-  		zoomOffset: 0,
-
-  		// @option tms: Boolean = false
-  		// If `true`, inverses Y axis numbering for tiles (turn this on for [TMS](https://en.wikipedia.org/wiki/Tile_Map_Service) services).
-  		tms: false,
-
-  		// @option zoomReverse: Boolean = false
-  		// If set to true, the zoom number used in tile URLs will be reversed (`maxZoom - zoom` instead of `zoom`)
-  		zoomReverse: false,
-
-  		// @option detectRetina: Boolean = false
-  		// If `true` and user is on a retina display, it will request four tiles of half the specified size and a bigger zoom level in place of one to utilize the high resolution.
-  		detectRetina: false,
-
-  		// @option crossOrigin: Boolean|String = false
-  		// Whether the crossOrigin attribute will be added to the tiles.
-  		// If a String is provided, all tiles will have their crossOrigin attribute set to the String provided. This is needed if you want to access tile pixel data.
-  		// Refer to [CORS Settings](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes) for valid String values.
-  		crossOrigin: false
-  	},
-
-  	initialize: function (url, options) {
-
-  		this._url = url;
-
-  		options = setOptions(this, options);
-
-  		// detecting retina displays, adjusting tileSize and zoom levels
-  		if (options.detectRetina && retina && options.maxZoom > 0) {
-
-  			options.tileSize = Math.floor(options.tileSize / 2);
-
-  			if (!options.zoomReverse) {
-  				options.zoomOffset++;
-  				options.maxZoom--;
-  			} else {
-  				options.zoomOffset--;
-  				options.minZoom++;
-  			}
-
-  			options.minZoom = Math.max(0, options.minZoom);
-  		}
-
-  		if (typeof options.subdomains === 'string') {
-  			options.subdomains = options.subdomains.split('');
-  		}
-
-  		// for https://github.com/Leaflet/Leaflet/issues/137
-  		if (!android) {
-  			this.on('tileunload', this._onTileRemove);
-  		}
-  	},
-
-  	// @method setUrl(url: String, noRedraw?: Boolean): this
-  	// Updates the layer's URL template and redraws it (unless `noRedraw` is set to `true`).
-  	// If the URL does not change, the layer will not be redrawn unless
-  	// the noRedraw parameter is set to false.
-  	setUrl: function (url, noRedraw) {
-  		if (this._url === url && noRedraw === undefined) {
-  			noRedraw = true;
-  		}
-
-  		this._url = url;
-
-  		if (!noRedraw) {
-  			this.redraw();
-  		}
-  		return this;
-  	},
-
-  	// @method createTile(coords: Object, done?: Function): HTMLElement
-  	// Called only internally, overrides GridLayer's [`createTile()`](#gridlayer-createtile)
-  	// to return an `<img>` HTML element with the appropriate image URL given `coords`. The `done`
-  	// callback is called when the tile has been loaded.
-  	createTile: function (coords, done) {
-  		var tile = document.createElement('img');
-
-  		on(tile, 'load', bind(this._tileOnLoad, this, done, tile));
-  		on(tile, 'error', bind(this._tileOnError, this, done, tile));
-
-  		if (this.options.crossOrigin || this.options.crossOrigin === '') {
-  			tile.crossOrigin = this.options.crossOrigin === true ? '' : this.options.crossOrigin;
-  		}
-
-  		/*
-  		 Alt tag is set to empty string to keep screen readers from reading URL and for compliance reasons
-  		 http://www.w3.org/TR/WCAG20-TECHS/H67
-  		*/
-  		tile.alt = '';
-
-  		/*
-  		 Set role="presentation" to force screen readers to ignore this
-  		 https://www.w3.org/TR/wai-aria/roles#textalternativecomputation
-  		*/
-  		tile.setAttribute('role', 'presentation');
-
-  		tile.src = this.getTileUrl(coords);
-
-  		return tile;
-  	},
-
-  	// @section Extension methods
-  	// @uninheritable
-  	// Layers extending `TileLayer` might reimplement the following method.
-  	// @method getTileUrl(coords: Object): String
-  	// Called only internally, returns the URL for a tile given its coordinates.
-  	// Classes extending `TileLayer` can override this function to provide custom tile URL naming schemes.
-  	getTileUrl: function (coords) {
-  		var data = {
-  			r: retina ? '@2x' : '',
-  			s: this._getSubdomain(coords),
-  			x: coords.x,
-  			y: coords.y,
-  			z: this._getZoomForUrl()
-  		};
-  		if (this._map && !this._map.options.crs.infinite) {
-  			var invertedY = this._globalTileRange.max.y - coords.y;
-  			if (this.options.tms) {
-  				data['y'] = invertedY;
-  			}
-  			data['-y'] = invertedY;
-  		}
-
-  		return template(this._url, extend(data, this.options));
-  	},
-
-  	_tileOnLoad: function (done, tile) {
-  		// For https://github.com/Leaflet/Leaflet/issues/3332
-  		if (ielt9) {
-  			setTimeout(bind(done, this, null, tile), 0);
-  		} else {
-  			done(null, tile);
-  		}
-  	},
-
-  	_tileOnError: function (done, tile, e) {
-  		var errorUrl = this.options.errorTileUrl;
-  		if (errorUrl && tile.getAttribute('src') !== errorUrl) {
-  			tile.src = errorUrl;
-  		}
-  		done(e, tile);
-  	},
-
-  	_onTileRemove: function (e) {
-  		e.tile.onload = null;
-  	},
-
-  	_getZoomForUrl: function () {
-  		var zoom = this._tileZoom,
-  		maxZoom = this.options.maxZoom,
-  		zoomReverse = this.options.zoomReverse,
-  		zoomOffset = this.options.zoomOffset;
-
-  		if (zoomReverse) {
-  			zoom = maxZoom - zoom;
-  		}
-
-  		return zoom + zoomOffset;
-  	},
-
-  	_getSubdomain: function (tilePoint) {
-  		var index = Math.abs(tilePoint.x + tilePoint.y) % this.options.subdomains.length;
-  		return this.options.subdomains[index];
-  	},
-
-  	// stops loading all tiles in the background layer
-  	_abortLoading: function () {
-  		var i, tile;
-  		for (i in this._tiles) {
-  			if (this._tiles[i].coords.z !== this._tileZoom) {
-  				tile = this._tiles[i].el;
-
-  				tile.onload = falseFn;
-  				tile.onerror = falseFn;
-
-  				if (!tile.complete) {
-  					tile.src = emptyImageUrl;
-  					remove(tile);
-  					delete this._tiles[i];
-  				}
-  			}
-  		}
-  	},
-
-  	_removeTile: function (key) {
-  		var tile = this._tiles[key];
-  		if (!tile) { return; }
-
-  		// Cancels any pending http requests associated with the tile
-  		// unless we're on Android's stock browser,
-  		// see https://github.com/Leaflet/Leaflet/issues/137
-  		if (!androidStock) {
-  			tile.el.setAttribute('src', emptyImageUrl);
-  		}
-
-  		return GridLayer.prototype._removeTile.call(this, key);
-  	},
-
-  	_tileReady: function (coords, err, tile) {
-  		if (!this._map || (tile && tile.getAttribute('src') === emptyImageUrl)) {
-  			return;
-  		}
-
-  		return GridLayer.prototype._tileReady.call(this, coords, err, tile);
-  	}
-  });
-
-
-  // @factory L.tilelayer(urlTemplate: String, options?: TileLayer options)
-  // Instantiates a tile layer object given a `URL template` and optionally an options object.
-
-  function tileLayer(url, options) {
-  	return new TileLayer(url, options);
-  }
-
-  /*
-   * @class TileLayer.WMS
-   * @inherits TileLayer
-   * @aka L.TileLayer.WMS
-   * Used to display [WMS](https://en.wikipedia.org/wiki/Web_Map_Service) services as tile layers on the map. Extends `TileLayer`.
-   *
-   * @example
-   *
-   * ```js
-   * var nexrad = L.tileLayer.wms("http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi", {
-   * 	layers: 'nexrad-n0r-900913',
-   * 	format: 'image/png',
-   * 	transparent: true,
-   * 	attribution: "Weather data © 2012 IEM Nexrad"
-   * });
-   * ```
-   */
-
-  var TileLayerWMS = TileLayer.extend({
-
-  	// @section
-  	// @aka TileLayer.WMS options
-  	// If any custom options not documented here are used, they will be sent to the
-  	// WMS server as extra parameters in each request URL. This can be useful for
-  	// [non-standard vendor WMS parameters](http://docs.geoserver.org/stable/en/user/services/wms/vendor.html).
-  	defaultWmsParams: {
-  		service: 'WMS',
-  		request: 'GetMap',
-
-  		// @option layers: String = ''
-  		// **(required)** Comma-separated list of WMS layers to show.
-  		layers: '',
-
-  		// @option styles: String = ''
-  		// Comma-separated list of WMS styles.
-  		styles: '',
-
-  		// @option format: String = 'image/jpeg'
-  		// WMS image format (use `'image/png'` for layers with transparency).
-  		format: 'image/jpeg',
-
-  		// @option transparent: Boolean = false
-  		// If `true`, the WMS service will return images with transparency.
-  		transparent: false,
-
-  		// @option version: String = '1.1.1'
-  		// Version of the WMS service to use
-  		version: '1.1.1'
-  	},
-
-  	options: {
-  		// @option crs: CRS = null
-  		// Coordinate Reference System to use for the WMS requests, defaults to
-  		// map CRS. Don't change this if you're not sure what it means.
-  		crs: null,
-
-  		// @option uppercase: Boolean = false
-  		// If `true`, WMS request parameter keys will be uppercase.
-  		uppercase: false
-  	},
-
-  	initialize: function (url, options) {
-
-  		this._url = url;
-
-  		var wmsParams = extend({}, this.defaultWmsParams);
-
-  		// all keys that are not TileLayer options go to WMS params
-  		for (var i in options) {
-  			if (!(i in this.options)) {
-  				wmsParams[i] = options[i];
-  			}
-  		}
-
-  		options = setOptions(this, options);
-
-  		var realRetina = options.detectRetina && retina ? 2 : 1;
-  		var tileSize = this.getTileSize();
-  		wmsParams.width = tileSize.x * realRetina;
-  		wmsParams.height = tileSize.y * realRetina;
-
-  		this.wmsParams = wmsParams;
-  	},
-
-  	onAdd: function (map) {
-
-  		this._crs = this.options.crs || map.options.crs;
-  		this._wmsVersion = parseFloat(this.wmsParams.version);
-
-  		var projectionKey = this._wmsVersion >= 1.3 ? 'crs' : 'srs';
-  		this.wmsParams[projectionKey] = this._crs.code;
-
-  		TileLayer.prototype.onAdd.call(this, map);
-  	},
-
-  	getTileUrl: function (coords) {
-
-  		var tileBounds = this._tileCoordsToNwSe(coords),
-  		    crs = this._crs,
-  		    bounds = toBounds(crs.project(tileBounds[0]), crs.project(tileBounds[1])),
-  		    min = bounds.min,
-  		    max = bounds.max,
-  		    bbox = (this._wmsVersion >= 1.3 && this._crs === EPSG4326 ?
-  		    [min.y, min.x, max.y, max.x] :
-  		    [min.x, min.y, max.x, max.y]).join(','),
-  		    url = TileLayer.prototype.getTileUrl.call(this, coords);
-  		return url +
-  			getParamString(this.wmsParams, url, this.options.uppercase) +
-  			(this.options.uppercase ? '&BBOX=' : '&bbox=') + bbox;
-  	},
-
-  	// @method setParams(params: Object, noRedraw?: Boolean): this
-  	// Merges an object with the new parameters and re-requests tiles on the current screen (unless `noRedraw` was set to true).
-  	setParams: function (params, noRedraw) {
-
-  		extend(this.wmsParams, params);
-
-  		if (!noRedraw) {
-  			this.redraw();
-  		}
-
-  		return this;
-  	}
-  });
-
-
-  // @factory L.tileLayer.wms(baseUrl: String, options: TileLayer.WMS options)
-  // Instantiates a WMS tile layer object given a base URL of the WMS service and a WMS parameters/options object.
-  function tileLayerWMS(url, options) {
-  	return new TileLayerWMS(url, options);
-  }
-
-  TileLayer.WMS = TileLayerWMS;
-  tileLayer.wms = tileLayerWMS;
-
-  /*
-   * @class Renderer
-   * @inherits Layer
-   * @aka L.Renderer
-   *
-   * Base class for vector renderer implementations (`SVG`, `Canvas`). Handles the
-   * DOM container of the renderer, its bounds, and its zoom animation.
-   *
-   * A `Renderer` works as an implicit layer group for all `Path`s - the renderer
-   * itself can be added or removed to the map. All paths use a renderer, which can
-   * be implicit (the map will decide the type of renderer and use it automatically)
-   * or explicit (using the [`renderer`](#path-renderer) option of the path).
-   *
-   * Do not use this class directly, use `SVG` and `Canvas` instead.
-   *
-   * @event update: Event
-   * Fired when the renderer updates its bounds, center and zoom, for example when
-   * its map has moved
-   */
-
-  var Renderer = Layer.extend({
-
-  	// @section
-  	// @aka Renderer options
-  	options: {
-  		// @option padding: Number = 0.1
-  		// How much to extend the clip area around the map view (relative to its size)
-  		// e.g. 0.1 would be 10% of map view in each direction
-  		padding: 0.1,
-
-  		// @option tolerance: Number = 0
-  		// How much to extend click tolerance round a path/object on the map
-  		tolerance : 0
-  	},
-
-  	initialize: function (options) {
-  		setOptions(this, options);
-  		stamp(this);
-  		this._layers = this._layers || {};
-  	},
-
-  	onAdd: function () {
-  		if (!this._container) {
-  			this._initContainer(); // defined by renderer implementations
-
-  			if (this._zoomAnimated) {
-  				addClass(this._container, 'leaflet-zoom-animated');
-  			}
-  		}
-
-  		this.getPane().appendChild(this._container);
-  		this._update();
-  		this.on('update', this._updatePaths, this);
-  	},
-
-  	onRemove: function () {
-  		this.off('update', this._updatePaths, this);
-  		this._destroyContainer();
-  	},
-
-  	getEvents: function () {
-  		var events = {
-  			viewreset: this._reset,
-  			zoom: this._onZoom,
-  			moveend: this._update,
-  			zoomend: this._onZoomEnd
-  		};
-  		if (this._zoomAnimated) {
-  			events.zoomanim = this._onAnimZoom;
-  		}
-  		return events;
-  	},
-
-  	_onAnimZoom: function (ev) {
-  		this._updateTransform(ev.center, ev.zoom);
-  	},
-
-  	_onZoom: function () {
-  		this._updateTransform(this._map.getCenter(), this._map.getZoom());
-  	},
-
-  	_updateTransform: function (center, zoom) {
-  		var scale = this._map.getZoomScale(zoom, this._zoom),
-  		    position = getPosition(this._container),
-  		    viewHalf = this._map.getSize().multiplyBy(0.5 + this.options.padding),
-  		    currentCenterPoint = this._map.project(this._center, zoom),
-  		    destCenterPoint = this._map.project(center, zoom),
-  		    centerOffset = destCenterPoint.subtract(currentCenterPoint),
-
-  		    topLeftOffset = viewHalf.multiplyBy(-scale).add(position).add(viewHalf).subtract(centerOffset);
-
-  		if (any3d) {
-  			setTransform(this._container, topLeftOffset, scale);
-  		} else {
-  			setPosition(this._container, topLeftOffset);
-  		}
-  	},
-
-  	_reset: function () {
-  		this._update();
-  		this._updateTransform(this._center, this._zoom);
-
-  		for (var id in this._layers) {
-  			this._layers[id]._reset();
-  		}
-  	},
-
-  	_onZoomEnd: function () {
-  		for (var id in this._layers) {
-  			this._layers[id]._project();
-  		}
-  	},
-
-  	_updatePaths: function () {
-  		for (var id in this._layers) {
-  			this._layers[id]._update();
-  		}
-  	},
-
-  	_update: function () {
-  		// Update pixel bounds of renderer container (for positioning/sizing/clipping later)
-  		// Subclasses are responsible of firing the 'update' event.
-  		var p = this.options.padding,
-  		    size = this._map.getSize(),
-  		    min = this._map.containerPointToLayerPoint(size.multiplyBy(-p)).round();
-
-  		this._bounds = new Bounds(min, min.add(size.multiplyBy(1 + p * 2)).round());
-
-  		this._center = this._map.getCenter();
-  		this._zoom = this._map.getZoom();
-  	}
-  });
-
-  /*
-   * @class Canvas
-   * @inherits Renderer
-   * @aka L.Canvas
-   *
-   * Allows vector layers to be displayed with [`<canvas>`](https://developer.mozilla.org/docs/Web/API/Canvas_API).
-   * Inherits `Renderer`.
-   *
-   * Due to [technical limitations](http://caniuse.com/#search=canvas), Canvas is not
-   * available in all web browsers, notably IE8, and overlapping geometries might
-   * not display properly in some edge cases.
-   *
-   * @example
-   *
-   * Use Canvas by default for all paths in the map:
-   *
-   * ```js
-   * var map = L.map('map', {
-   * 	renderer: L.canvas()
-   * });
-   * ```
-   *
-   * Use a Canvas renderer with extra padding for specific vector geometries:
-   *
-   * ```js
-   * var map = L.map('map');
-   * var myRenderer = L.canvas({ padding: 0.5 });
-   * var line = L.polyline( coordinates, { renderer: myRenderer } );
-   * var circle = L.circle( center, { renderer: myRenderer } );
-   * ```
-   */
-
-  var Canvas = Renderer.extend({
-  	getEvents: function () {
-  		var events = Renderer.prototype.getEvents.call(this);
-  		events.viewprereset = this._onViewPreReset;
-  		return events;
-  	},
-
-  	_onViewPreReset: function () {
-  		// Set a flag so that a viewprereset+moveend+viewreset only updates&redraws once
-  		this._postponeUpdatePaths = true;
-  	},
-
-  	onAdd: function () {
-  		Renderer.prototype.onAdd.call(this);
-
-  		// Redraw vectors since canvas is cleared upon removal,
-  		// in case of removing the renderer itself from the map.
-  		this._draw();
-  	},
-
-  	_initContainer: function () {
-  		var container = this._container = document.createElement('canvas');
-
-  		on(container, 'mousemove', this._onMouseMove, this);
-  		on(container, 'click dblclick mousedown mouseup contextmenu', this._onClick, this);
-  		on(container, 'mouseout', this._handleMouseOut, this);
-
-  		this._ctx = container.getContext('2d');
-  	},
-
-  	_destroyContainer: function () {
-  		cancelAnimFrame(this._redrawRequest);
-  		delete this._ctx;
-  		remove(this._container);
-  		off(this._container);
-  		delete this._container;
-  	},
-
-  	_updatePaths: function () {
-  		if (this._postponeUpdatePaths) { return; }
-
-  		var layer;
-  		this._redrawBounds = null;
-  		for (var id in this._layers) {
-  			layer = this._layers[id];
-  			layer._update();
-  		}
-  		this._redraw();
-  	},
-
-  	_update: function () {
-  		if (this._map._animatingZoom && this._bounds) { return; }
-
-  		Renderer.prototype._update.call(this);
-
-  		var b = this._bounds,
-  		    container = this._container,
-  		    size = b.getSize(),
-  		    m = retina ? 2 : 1;
-
-  		setPosition(container, b.min);
-
-  		// set canvas size (also clearing it); use double size on retina
-  		container.width = m * size.x;
-  		container.height = m * size.y;
-  		container.style.width = size.x + 'px';
-  		container.style.height = size.y + 'px';
-
-  		if (retina) {
-  			this._ctx.scale(2, 2);
-  		}
-
-  		// translate so we use the same path coordinates after canvas element moves
-  		this._ctx.translate(-b.min.x, -b.min.y);
-
-  		// Tell paths to redraw themselves
-  		this.fire('update');
-  	},
-
-  	_reset: function () {
-  		Renderer.prototype._reset.call(this);
-
-  		if (this._postponeUpdatePaths) {
-  			this._postponeUpdatePaths = false;
-  			this._updatePaths();
-  		}
-  	},
-
-  	_initPath: function (layer) {
-  		this._updateDashArray(layer);
-  		this._layers[stamp(layer)] = layer;
-
-  		var order = layer._order = {
-  			layer: layer,
-  			prev: this._drawLast,
-  			next: null
-  		};
-  		if (this._drawLast) { this._drawLast.next = order; }
-  		this._drawLast = order;
-  		this._drawFirst = this._drawFirst || this._drawLast;
-  	},
-
-  	_addPath: function (layer) {
-  		this._requestRedraw(layer);
-  	},
-
-  	_removePath: function (layer) {
-  		var order = layer._order;
-  		var next = order.next;
-  		var prev = order.prev;
-
-  		if (next) {
-  			next.prev = prev;
-  		} else {
-  			this._drawLast = prev;
-  		}
-  		if (prev) {
-  			prev.next = next;
-  		} else {
-  			this._drawFirst = next;
-  		}
-
-  		delete layer._order;
-
-  		delete this._layers[stamp(layer)];
-
-  		this._requestRedraw(layer);
-  	},
-
-  	_updatePath: function (layer) {
-  		// Redraw the union of the layer's old pixel
-  		// bounds and the new pixel bounds.
-  		this._extendRedrawBounds(layer);
-  		layer._project();
-  		layer._update();
-  		// The redraw will extend the redraw bounds
-  		// with the new pixel bounds.
-  		this._requestRedraw(layer);
-  	},
-
-  	_updateStyle: function (layer) {
-  		this._updateDashArray(layer);
-  		this._requestRedraw(layer);
-  	},
-
-  	_updateDashArray: function (layer) {
-  		if (typeof layer.options.dashArray === 'string') {
-  			var parts = layer.options.dashArray.split(/[, ]+/),
-  			    dashArray = [],
-  			    dashValue,
-  			    i;
-  			for (i = 0; i < parts.length; i++) {
-  				dashValue = Number(parts[i]);
-  				// Ignore dash array containing invalid lengths
-  				if (isNaN(dashValue)) { return; }
-  				dashArray.push(dashValue);
-  			}
-  			layer.options._dashArray = dashArray;
-  		} else {
-  			layer.options._dashArray = layer.options.dashArray;
-  		}
-  	},
-
-  	_requestRedraw: function (layer) {
-  		if (!this._map) { return; }
-
-  		this._extendRedrawBounds(layer);
-  		this._redrawRequest = this._redrawRequest || requestAnimFrame(this._redraw, this);
-  	},
-
-  	_extendRedrawBounds: function (layer) {
-  		if (layer._pxBounds) {
-  			var padding = (layer.options.weight || 0) + 1;
-  			this._redrawBounds = this._redrawBounds || new Bounds();
-  			this._redrawBounds.extend(layer._pxBounds.min.subtract([padding, padding]));
-  			this._redrawBounds.extend(layer._pxBounds.max.add([padding, padding]));
-  		}
-  	},
-
-  	_redraw: function () {
-  		this._redrawRequest = null;
-
-  		if (this._redrawBounds) {
-  			this._redrawBounds.min._floor();
-  			this._redrawBounds.max._ceil();
-  		}
-
-  		this._clear(); // clear layers in redraw bounds
-  		this._draw(); // draw layers
-
-  		this._redrawBounds = null;
-  	},
-
-  	_clear: function () {
-  		var bounds = this._redrawBounds;
-  		if (bounds) {
-  			var size = bounds.getSize();
-  			this._ctx.clearRect(bounds.min.x, bounds.min.y, size.x, size.y);
-  		} else {
-  			this._ctx.save();
-  			this._ctx.setTransform(1, 0, 0, 1, 0, 0);
-  			this._ctx.clearRect(0, 0, this._container.width, this._container.height);
-  			this._ctx.restore();
-  		}
-  	},
-
-  	_draw: function () {
-  		var layer, bounds = this._redrawBounds;
-  		this._ctx.save();
-  		if (bounds) {
-  			var size = bounds.getSize();
-  			this._ctx.beginPath();
-  			this._ctx.rect(bounds.min.x, bounds.min.y, size.x, size.y);
-  			this._ctx.clip();
-  		}
-
-  		this._drawing = true;
-
-  		for (var order = this._drawFirst; order; order = order.next) {
-  			layer = order.layer;
-  			if (!bounds || (layer._pxBounds && layer._pxBounds.intersects(bounds))) {
-  				layer._updatePath();
-  			}
-  		}
-
-  		this._drawing = false;
-
-  		this._ctx.restore();  // Restore state before clipping.
-  	},
-
-  	_updatePoly: function (layer, closed) {
-  		if (!this._drawing) { return; }
-
-  		var i, j, len2, p,
-  		    parts = layer._parts,
-  		    len = parts.length,
-  		    ctx = this._ctx;
-
-  		if (!len) { return; }
-
-  		ctx.beginPath();
-
-  		for (i = 0; i < len; i++) {
-  			for (j = 0, len2 = parts[i].length; j < len2; j++) {
-  				p = parts[i][j];
-  				ctx[j ? 'lineTo' : 'moveTo'](p.x, p.y);
-  			}
-  			if (closed) {
-  				ctx.closePath();
-  			}
-  		}
-
-  		this._fillStroke(ctx, layer);
-
-  		// TODO optimization: 1 fill/stroke for all features with equal style instead of 1 for each feature
-  	},
-
-  	_updateCircle: function (layer) {
-
-  		if (!this._drawing || layer._empty()) { return; }
-
-  		var p = layer._point,
-  		    ctx = this._ctx,
-  		    r = Math.max(Math.round(layer._radius), 1),
-  		    s = (Math.max(Math.round(layer._radiusY), 1) || r) / r;
-
-  		if (s !== 1) {
-  			ctx.save();
-  			ctx.scale(1, s);
-  		}
-
-  		ctx.beginPath();
-  		ctx.arc(p.x, p.y / s, r, 0, Math.PI * 2, false);
-
-  		if (s !== 1) {
-  			ctx.restore();
-  		}
-
-  		this._fillStroke(ctx, layer);
-  	},
-
-  	_fillStroke: function (ctx, layer) {
-  		var options = layer.options;
-
-  		if (options.fill) {
-  			ctx.globalAlpha = options.fillOpacity;
-  			ctx.fillStyle = options.fillColor || options.color;
-  			ctx.fill(options.fillRule || 'evenodd');
-  		}
-
-  		if (options.stroke && options.weight !== 0) {
-  			if (ctx.setLineDash) {
-  				ctx.setLineDash(layer.options && layer.options._dashArray || []);
-  			}
-  			ctx.globalAlpha = options.opacity;
-  			ctx.lineWidth = options.weight;
-  			ctx.strokeStyle = options.color;
-  			ctx.lineCap = options.lineCap;
-  			ctx.lineJoin = options.lineJoin;
-  			ctx.stroke();
-  		}
-  	},
-
-  	// Canvas obviously doesn't have mouse events for individual drawn objects,
-  	// so we emulate that by calculating what's under the mouse on mousemove/click manually
-
-  	_onClick: function (e) {
-  		var point = this._map.mouseEventToLayerPoint(e), layer, clickedLayer;
-
-  		for (var order = this._drawFirst; order; order = order.next) {
-  			layer = order.layer;
-  			if (layer.options.interactive && layer._containsPoint(point)) {
-  				if (!(e.type === 'click' || e.type !== 'preclick') || !this._map._draggableMoved(layer)) {
-  					clickedLayer = layer;
-  				}
-  			}
-  		}
-  		if (clickedLayer)  {
-  			fakeStop(e);
-  			this._fireEvent([clickedLayer], e);
-  		}
-  	},
-
-  	_onMouseMove: function (e) {
-  		if (!this._map || this._map.dragging.moving() || this._map._animatingZoom) { return; }
-
-  		var point = this._map.mouseEventToLayerPoint(e);
-  		this._handleMouseHover(e, point);
-  	},
-
-
-  	_handleMouseOut: function (e) {
-  		var layer = this._hoveredLayer;
-  		if (layer) {
-  			// if we're leaving the layer, fire mouseout
-  			removeClass(this._container, 'leaflet-interactive');
-  			this._fireEvent([layer], e, 'mouseout');
-  			this._hoveredLayer = null;
-  			this._mouseHoverThrottled = false;
-  		}
-  	},
-
-  	_handleMouseHover: function (e, point) {
-  		if (this._mouseHoverThrottled) {
-  			return;
-  		}
-
-  		var layer, candidateHoveredLayer;
-
-  		for (var order = this._drawFirst; order; order = order.next) {
-  			layer = order.layer;
-  			if (layer.options.interactive && layer._containsPoint(point)) {
-  				candidateHoveredLayer = layer;
-  			}
-  		}
-
-  		if (candidateHoveredLayer !== this._hoveredLayer) {
-  			this._handleMouseOut(e);
-
-  			if (candidateHoveredLayer) {
-  				addClass(this._container, 'leaflet-interactive'); // change cursor
-  				this._fireEvent([candidateHoveredLayer], e, 'mouseover');
-  				this._hoveredLayer = candidateHoveredLayer;
-  			}
-  		}
-
-  		if (this._hoveredLayer) {
-  			this._fireEvent([this._hoveredLayer], e);
-  		}
-
-  		this._mouseHoverThrottled = true;
-  		setTimeout(bind(function () {
-  			this._mouseHoverThrottled = false;
-  		}, this), 32);
-  	},
-
-  	_fireEvent: function (layers, e, type) {
-  		this._map._fireDOMEvent(e, type || e.type, layers);
-  	},
-
-  	_bringToFront: function (layer) {
-  		var order = layer._order;
-
-  		if (!order) { return; }
-
-  		var next = order.next;
-  		var prev = order.prev;
-
-  		if (next) {
-  			next.prev = prev;
-  		} else {
-  			// Already last
-  			return;
-  		}
-  		if (prev) {
-  			prev.next = next;
-  		} else if (next) {
-  			// Update first entry unless this is the
-  			// single entry
-  			this._drawFirst = next;
-  		}
-
-  		order.prev = this._drawLast;
-  		this._drawLast.next = order;
-
-  		order.next = null;
-  		this._drawLast = order;
-
-  		this._requestRedraw(layer);
-  	},
-
-  	_bringToBack: function (layer) {
-  		var order = layer._order;
-
-  		if (!order) { return; }
-
-  		var next = order.next;
-  		var prev = order.prev;
-
-  		if (prev) {
-  			prev.next = next;
-  		} else {
-  			// Already first
-  			return;
-  		}
-  		if (next) {
-  			next.prev = prev;
-  		} else if (prev) {
-  			// Update last entry unless this is the
-  			// single entry
-  			this._drawLast = prev;
-  		}
-
-  		order.prev = null;
-
-  		order.next = this._drawFirst;
-  		this._drawFirst.prev = order;
-  		this._drawFirst = order;
-
-  		this._requestRedraw(layer);
-  	}
-  });
-
-  // @factory L.canvas(options?: Renderer options)
-  // Creates a Canvas renderer with the given options.
-  function canvas$1(options) {
-  	return canvas ? new Canvas(options) : null;
-  }
-
-  /*
-   * Thanks to Dmitry Baranovsky and his Raphael library for inspiration!
-   */
-
-
-  var vmlCreate = (function () {
-  	try {
-  		document.namespaces.add('lvml', 'urn:schemas-microsoft-com:vml');
-  		return function (name) {
-  			return document.createElement('<lvml:' + name + ' class="lvml">');
-  		};
-  	} catch (e) {
-  		return function (name) {
-  			return document.createElement('<' + name + ' xmlns="urn:schemas-microsoft.com:vml" class="lvml">');
-  		};
-  	}
-  })();
-
-
-  /*
-   * @class SVG
-   *
-   *
-   * VML was deprecated in 2012, which means VML functionality exists only for backwards compatibility
-   * with old versions of Internet Explorer.
-   */
-
-  // mixin to redefine some SVG methods to handle VML syntax which is similar but with some differences
-  var vmlMixin = {
-
-  	_initContainer: function () {
-  		this._container = create$1('div', 'leaflet-vml-container');
-  	},
-
-  	_update: function () {
-  		if (this._map._animatingZoom) { return; }
-  		Renderer.prototype._update.call(this);
-  		this.fire('update');
-  	},
-
-  	_initPath: function (layer) {
-  		var container = layer._container = vmlCreate('shape');
-
-  		addClass(container, 'leaflet-vml-shape ' + (this.options.className || ''));
-
-  		container.coordsize = '1 1';
-
-  		layer._path = vmlCreate('path');
-  		container.appendChild(layer._path);
-
-  		this._updateStyle(layer);
-  		this._layers[stamp(layer)] = layer;
-  	},
-
-  	_addPath: function (layer) {
-  		var container = layer._container;
-  		this._container.appendChild(container);
-
-  		if (layer.options.interactive) {
-  			layer.addInteractiveTarget(container);
-  		}
-  	},
-
-  	_removePath: function (layer) {
-  		var container = layer._container;
-  		remove(container);
-  		layer.removeInteractiveTarget(container);
-  		delete this._layers[stamp(layer)];
-  	},
-
-  	_updateStyle: function (layer) {
-  		var stroke = layer._stroke,
-  		    fill = layer._fill,
-  		    options = layer.options,
-  		    container = layer._container;
-
-  		container.stroked = !!options.stroke;
-  		container.filled = !!options.fill;
-
-  		if (options.stroke) {
-  			if (!stroke) {
-  				stroke = layer._stroke = vmlCreate('stroke');
-  			}
-  			container.appendChild(stroke);
-  			stroke.weight = options.weight + 'px';
-  			stroke.color = options.color;
-  			stroke.opacity = options.opacity;
-
-  			if (options.dashArray) {
-  				stroke.dashStyle = isArray(options.dashArray) ?
-  				    options.dashArray.join(' ') :
-  				    options.dashArray.replace(/( *, *)/g, ' ');
-  			} else {
-  				stroke.dashStyle = '';
-  			}
-  			stroke.endcap = options.lineCap.replace('butt', 'flat');
-  			stroke.joinstyle = options.lineJoin;
-
-  		} else if (stroke) {
-  			container.removeChild(stroke);
-  			layer._stroke = null;
-  		}
-
-  		if (options.fill) {
-  			if (!fill) {
-  				fill = layer._fill = vmlCreate('fill');
-  			}
-  			container.appendChild(fill);
-  			fill.color = options.fillColor || options.color;
-  			fill.opacity = options.fillOpacity;
-
-  		} else if (fill) {
-  			container.removeChild(fill);
-  			layer._fill = null;
-  		}
-  	},
-
-  	_updateCircle: function (layer) {
-  		var p = layer._point.round(),
-  		    r = Math.round(layer._radius),
-  		    r2 = Math.round(layer._radiusY || r);
-
-  		this._setPath(layer, layer._empty() ? 'M0 0' :
-  			'AL ' + p.x + ',' + p.y + ' ' + r + ',' + r2 + ' 0,' + (65535 * 360));
-  	},
-
-  	_setPath: function (layer, path) {
-  		layer._path.v = path;
-  	},
-
-  	_bringToFront: function (layer) {
-  		toFront(layer._container);
-  	},
-
-  	_bringToBack: function (layer) {
-  		toBack(layer._container);
-  	}
-  };
-
-  var create$2 = vml ? vmlCreate : svgCreate;
-
-  /*
-   * @class SVG
-   * @inherits Renderer
-   * @aka L.SVG
-   *
-   * Allows vector layers to be displayed with [SVG](https://developer.mozilla.org/docs/Web/SVG).
-   * Inherits `Renderer`.
-   *
-   * Due to [technical limitations](http://caniuse.com/#search=svg), SVG is not
-   * available in all web browsers, notably Android 2.x and 3.x.
-   *
-   * Although SVG is not available on IE7 and IE8, these browsers support
-   * [VML](https://en.wikipedia.org/wiki/Vector_Markup_Language)
-   * (a now deprecated technology), and the SVG renderer will fall back to VML in
-   * this case.
-   *
-   * @example
-   *
-   * Use SVG by default for all paths in the map:
-   *
-   * ```js
-   * var map = L.map('map', {
-   * 	renderer: L.svg()
-   * });
-   * ```
-   *
-   * Use a SVG renderer with extra padding for specific vector geometries:
-   *
-   * ```js
-   * var map = L.map('map');
-   * var myRenderer = L.svg({ padding: 0.5 });
-   * var line = L.polyline( coordinates, { renderer: myRenderer } );
-   * var circle = L.circle( center, { renderer: myRenderer } );
-   * ```
-   */
-
-  var SVG = Renderer.extend({
-
-  	getEvents: function () {
-  		var events = Renderer.prototype.getEvents.call(this);
-  		events.zoomstart = this._onZoomStart;
-  		return events;
-  	},
-
-  	_initContainer: function () {
-  		this._container = create$2('svg');
-
-  		// makes it possible to click through svg root; we'll reset it back in individual paths
-  		this._container.setAttribute('pointer-events', 'none');
-
-  		this._rootGroup = create$2('g');
-  		this._container.appendChild(this._rootGroup);
-  	},
-
-  	_destroyContainer: function () {
-  		remove(this._container);
-  		off(this._container);
-  		delete this._container;
-  		delete this._rootGroup;
-  		delete this._svgSize;
-  	},
-
-  	_onZoomStart: function () {
-  		// Drag-then-pinch interactions might mess up the center and zoom.
-  		// In this case, the easiest way to prevent this is re-do the renderer
-  		//   bounds and padding when the zooming starts.
-  		this._update();
-  	},
-
-  	_update: function () {
-  		if (this._map._animatingZoom && this._bounds) { return; }
-
-  		Renderer.prototype._update.call(this);
-
-  		var b = this._bounds,
-  		    size = b.getSize(),
-  		    container = this._container;
-
-  		// set size of svg-container if changed
-  		if (!this._svgSize || !this._svgSize.equals(size)) {
-  			this._svgSize = size;
-  			container.setAttribute('width', size.x);
-  			container.setAttribute('height', size.y);
-  		}
-
-  		// movement: update container viewBox so that we don't have to change coordinates of individual layers
-  		setPosition(container, b.min);
-  		container.setAttribute('viewBox', [b.min.x, b.min.y, size.x, size.y].join(' '));
-
-  		this.fire('update');
-  	},
-
-  	// methods below are called by vector layers implementations
-
-  	_initPath: function (layer) {
-  		var path = layer._path = create$2('path');
-
-  		// @namespace Path
-  		// @option className: String = null
-  		// Custom class name set on an element. Only for SVG renderer.
-  		if (layer.options.className) {
-  			addClass(path, layer.options.className);
-  		}
-
-  		if (layer.options.interactive) {
-  			addClass(path, 'leaflet-interactive');
-  		}
-
-  		this._updateStyle(layer);
-  		this._layers[stamp(layer)] = layer;
-  	},
-
-  	_addPath: function (layer) {
-  		if (!this._rootGroup) { this._initContainer(); }
-  		this._rootGroup.appendChild(layer._path);
-  		layer.addInteractiveTarget(layer._path);
-  	},
-
-  	_removePath: function (layer) {
-  		remove(layer._path);
-  		layer.removeInteractiveTarget(layer._path);
-  		delete this._layers[stamp(layer)];
-  	},
-
-  	_updatePath: function (layer) {
-  		layer._project();
-  		layer._update();
-  	},
-
-  	_updateStyle: function (layer) {
-  		var path = layer._path,
-  		    options = layer.options;
-
-  		if (!path) { return; }
-
-  		if (options.stroke) {
-  			path.setAttribute('stroke', options.color);
-  			path.setAttribute('stroke-opacity', options.opacity);
-  			path.setAttribute('stroke-width', options.weight);
-  			path.setAttribute('stroke-linecap', options.lineCap);
-  			path.setAttribute('stroke-linejoin', options.lineJoin);
-
-  			if (options.dashArray) {
-  				path.setAttribute('stroke-dasharray', options.dashArray);
-  			} else {
-  				path.removeAttribute('stroke-dasharray');
-  			}
-
-  			if (options.dashOffset) {
-  				path.setAttribute('stroke-dashoffset', options.dashOffset);
-  			} else {
-  				path.removeAttribute('stroke-dashoffset');
-  			}
-  		} else {
-  			path.setAttribute('stroke', 'none');
-  		}
-
-  		if (options.fill) {
-  			path.setAttribute('fill', options.fillColor || options.color);
-  			path.setAttribute('fill-opacity', options.fillOpacity);
-  			path.setAttribute('fill-rule', options.fillRule || 'evenodd');
-  		} else {
-  			path.setAttribute('fill', 'none');
-  		}
-  	},
-
-  	_updatePoly: function (layer, closed) {
-  		this._setPath(layer, pointsToPath(layer._parts, closed));
-  	},
-
-  	_updateCircle: function (layer) {
-  		var p = layer._point,
-  		    r = Math.max(Math.round(layer._radius), 1),
-  		    r2 = Math.max(Math.round(layer._radiusY), 1) || r,
-  		    arc = 'a' + r + ',' + r2 + ' 0 1,0 ';
-
-  		// drawing a circle with two half-arcs
-  		var d = layer._empty() ? 'M0 0' :
-  			'M' + (p.x - r) + ',' + p.y +
-  			arc + (r * 2) + ',0 ' +
-  			arc + (-r * 2) + ',0 ';
-
-  		this._setPath(layer, d);
-  	},
-
-  	_setPath: function (layer, path) {
-  		layer._path.setAttribute('d', path);
-  	},
-
-  	// SVG does not have the concept of zIndex so we resort to changing the DOM order of elements
-  	_bringToFront: function (layer) {
-  		toFront(layer._path);
-  	},
-
-  	_bringToBack: function (layer) {
-  		toBack(layer._path);
-  	}
-  });
-
-  if (vml) {
-  	SVG.include(vmlMixin);
-  }
-
-  // @namespace SVG
-  // @factory L.svg(options?: Renderer options)
-  // Creates a SVG renderer with the given options.
-  function svg$1(options) {
-  	return svg || vml ? new SVG(options) : null;
-  }
-
-  Map.include({
-  	// @namespace Map; @method getRenderer(layer: Path): Renderer
-  	// Returns the instance of `Renderer` that should be used to render the given
-  	// `Path`. It will ensure that the `renderer` options of the map and paths
-  	// are respected, and that the renderers do exist on the map.
-  	getRenderer: function (layer) {
-  		// @namespace Path; @option renderer: Renderer
-  		// Use this specific instance of `Renderer` for this path. Takes
-  		// precedence over the map's [default renderer](#map-renderer).
-  		var renderer = layer.options.renderer || this._getPaneRenderer(layer.options.pane) || this.options.renderer || this._renderer;
-
-  		if (!renderer) {
-  			renderer = this._renderer = this._createRenderer();
-  		}
-
-  		if (!this.hasLayer(renderer)) {
-  			this.addLayer(renderer);
-  		}
-  		return renderer;
-  	},
-
-  	_getPaneRenderer: function (name) {
-  		if (name === 'overlayPane' || name === undefined) {
-  			return false;
-  		}
-
-  		var renderer = this._paneRenderers[name];
-  		if (renderer === undefined) {
-  			renderer = this._createRenderer({pane: name});
-  			this._paneRenderers[name] = renderer;
-  		}
-  		return renderer;
-  	},
-
-  	_createRenderer: function (options) {
-  		// @namespace Map; @option preferCanvas: Boolean = false
-  		// Whether `Path`s should be rendered on a `Canvas` renderer.
-  		// By default, all `Path`s are rendered in a `SVG` renderer.
-  		return (this.options.preferCanvas && canvas$1(options)) || svg$1(options);
-  	}
-  });
-
-  /*
-   * L.Rectangle extends Polygon and creates a rectangle when passed a LatLngBounds object.
-   */
-
-  /*
-   * @class Rectangle
-   * @aka L.Rectangle
-   * @inherits Polygon
-   *
-   * A class for drawing rectangle overlays on a map. Extends `Polygon`.
-   *
-   * @example
-   *
-   * ```js
-   * // define rectangle geographical bounds
-   * var bounds = [[54.559322, -5.767822], [56.1210604, -3.021240]];
-   *
-   * // create an orange rectangle
-   * L.rectangle(bounds, {color: "#ff7800", weight: 1}).addTo(map);
-   *
-   * // zoom the map to the rectangle bounds
-   * map.fitBounds(bounds);
-   * ```
-   *
-   */
-
-
-  var Rectangle = Polygon.extend({
-  	initialize: function (latLngBounds, options) {
-  		Polygon.prototype.initialize.call(this, this._boundsToLatLngs(latLngBounds), options);
-  	},
-
-  	// @method setBounds(latLngBounds: LatLngBounds): this
-  	// Redraws the rectangle with the passed bounds.
-  	setBounds: function (latLngBounds) {
-  		return this.setLatLngs(this._boundsToLatLngs(latLngBounds));
-  	},
-
-  	_boundsToLatLngs: function (latLngBounds) {
-  		latLngBounds = toLatLngBounds(latLngBounds);
-  		return [
-  			latLngBounds.getSouthWest(),
-  			latLngBounds.getNorthWest(),
-  			latLngBounds.getNorthEast(),
-  			latLngBounds.getSouthEast()
-  		];
-  	}
-  });
-
-
-  // @factory L.rectangle(latLngBounds: LatLngBounds, options?: Polyline options)
-  function rectangle(latLngBounds, options) {
-  	return new Rectangle(latLngBounds, options);
-  }
-
-  SVG.create = create$2;
-  SVG.pointsToPath = pointsToPath;
-
-  GeoJSON.geometryToLayer = geometryToLayer;
-  GeoJSON.coordsToLatLng = coordsToLatLng;
-  GeoJSON.coordsToLatLngs = coordsToLatLngs;
-  GeoJSON.latLngToCoords = latLngToCoords;
-  GeoJSON.latLngsToCoords = latLngsToCoords;
-  GeoJSON.getFeature = getFeature;
-  GeoJSON.asFeature = asFeature;
-
-  /*
-   * L.Handler.BoxZoom is used to add shift-drag zoom interaction to the map
-   * (zoom to a selected bounding box), enabled by default.
-   */
-
-  // @namespace Map
-  // @section Interaction Options
-  Map.mergeOptions({
-  	// @option boxZoom: Boolean = true
-  	// Whether the map can be zoomed to a rectangular area specified by
-  	// dragging the mouse while pressing the shift key.
-  	boxZoom: true
-  });
-
-  var BoxZoom = Handler.extend({
-  	initialize: function (map) {
-  		this._map = map;
-  		this._container = map._container;
-  		this._pane = map._panes.overlayPane;
-  		this._resetStateTimeout = 0;
-  		map.on('unload', this._destroy, this);
-  	},
-
-  	addHooks: function () {
-  		on(this._container, 'mousedown', this._onMouseDown, this);
-  	},
-
-  	removeHooks: function () {
-  		off(this._container, 'mousedown', this._onMouseDown, this);
-  	},
-
-  	moved: function () {
-  		return this._moved;
-  	},
-
-  	_destroy: function () {
-  		remove(this._pane);
-  		delete this._pane;
-  	},
-
-  	_resetState: function () {
-  		this._resetStateTimeout = 0;
-  		this._moved = false;
-  	},
-
-  	_clearDeferredResetState: function () {
-  		if (this._resetStateTimeout !== 0) {
-  			clearTimeout(this._resetStateTimeout);
-  			this._resetStateTimeout = 0;
-  		}
-  	},
-
-  	_onMouseDown: function (e) {
-  		if (!e.shiftKey || ((e.which !== 1) && (e.button !== 1))) { return false; }
-
-  		// Clear the deferred resetState if it hasn't executed yet, otherwise it
-  		// will interrupt the interaction and orphan a box element in the container.
-  		this._clearDeferredResetState();
-  		this._resetState();
-
-  		disableTextSelection();
-  		disableImageDrag();
-
-  		this._startPoint = this._map.mouseEventToContainerPoint(e);
-
-  		on(document, {
-  			contextmenu: stop,
-  			mousemove: this._onMouseMove,
-  			mouseup: this._onMouseUp,
-  			keydown: this._onKeyDown
-  		}, this);
-  	},
-
-  	_onMouseMove: function (e) {
-  		if (!this._moved) {
-  			this._moved = true;
-
-  			this._box = create$1('div', 'leaflet-zoom-box', this._container);
-  			addClass(this._container, 'leaflet-crosshair');
-
-  			this._map.fire('boxzoomstart');
-  		}
-
-  		this._point = this._map.mouseEventToContainerPoint(e);
-
-  		var bounds = new Bounds(this._point, this._startPoint),
-  		    size = bounds.getSize();
-
-  		setPosition(this._box, bounds.min);
-
-  		this._box.style.width  = size.x + 'px';
-  		this._box.style.height = size.y + 'px';
-  	},
-
-  	_finish: function () {
-  		if (this._moved) {
-  			remove(this._box);
-  			removeClass(this._container, 'leaflet-crosshair');
-  		}
-
-  		enableTextSelection();
-  		enableImageDrag();
-
-  		off(document, {
-  			contextmenu: stop,
-  			mousemove: this._onMouseMove,
-  			mouseup: this._onMouseUp,
-  			keydown: this._onKeyDown
-  		}, this);
-  	},
-
-  	_onMouseUp: function (e) {
-  		if ((e.which !== 1) && (e.button !== 1)) { return; }
-
-  		this._finish();
-
-  		if (!this._moved) { return; }
-  		// Postpone to next JS tick so internal click event handling
-  		// still see it as "moved".
-  		this._clearDeferredResetState();
-  		this._resetStateTimeout = setTimeout(bind(this._resetState, this), 0);
-
-  		var bounds = new LatLngBounds(
-  		        this._map.containerPointToLatLng(this._startPoint),
-  		        this._map.containerPointToLatLng(this._point));
-
-  		this._map
-  			.fitBounds(bounds)
-  			.fire('boxzoomend', {boxZoomBounds: bounds});
-  	},
-
-  	_onKeyDown: function (e) {
-  		if (e.keyCode === 27) {
-  			this._finish();
-  		}
-  	}
-  });
-
-  // @section Handlers
-  // @property boxZoom: Handler
-  // Box (shift-drag with mouse) zoom handler.
-  Map.addInitHook('addHandler', 'boxZoom', BoxZoom);
-
-  /*
-   * L.Handler.DoubleClickZoom is used to handle double-click zoom on the map, enabled by default.
-   */
-
-  // @namespace Map
-  // @section Interaction Options
-
-  Map.mergeOptions({
-  	// @option doubleClickZoom: Boolean|String = true
-  	// Whether the map can be zoomed in by double clicking on it and
-  	// zoomed out by double clicking while holding shift. If passed
-  	// `'center'`, double-click zoom will zoom to the center of the
-  	//  view regardless of where the mouse was.
-  	doubleClickZoom: true
-  });
-
-  var DoubleClickZoom = Handler.extend({
-  	addHooks: function () {
-  		this._map.on('dblclick', this._onDoubleClick, this);
-  	},
-
-  	removeHooks: function () {
-  		this._map.off('dblclick', this._onDoubleClick, this);
-  	},
-
-  	_onDoubleClick: function (e) {
-  		var map = this._map,
-  		    oldZoom = map.getZoom(),
-  		    delta = map.options.zoomDelta,
-  		    zoom = e.originalEvent.shiftKey ? oldZoom - delta : oldZoom + delta;
-
-  		if (map.options.doubleClickZoom === 'center') {
-  			map.setZoom(zoom);
-  		} else {
-  			map.setZoomAround(e.containerPoint, zoom);
-  		}
-  	}
-  });
-
-  // @section Handlers
-  //
-  // Map properties include interaction handlers that allow you to control
-  // interaction behavior in runtime, enabling or disabling certain features such
-  // as dragging or touch zoom (see `Handler` methods). For example:
-  //
-  // ```js
-  // map.doubleClickZoom.disable();
-  // ```
-  //
-  // @property doubleClickZoom: Handler
-  // Double click zoom handler.
-  Map.addInitHook('addHandler', 'doubleClickZoom', DoubleClickZoom);
-
-  /*
-   * L.Handler.MapDrag is used to make the map draggable (with panning inertia), enabled by default.
-   */
-
-  // @namespace Map
-  // @section Interaction Options
-  Map.mergeOptions({
-  	// @option dragging: Boolean = true
-  	// Whether the map be draggable with mouse/touch or not.
-  	dragging: true,
-
-  	// @section Panning Inertia Options
-  	// @option inertia: Boolean = *
-  	// If enabled, panning of the map will have an inertia effect where
-  	// the map builds momentum while dragging and continues moving in
-  	// the same direction for some time. Feels especially nice on touch
-  	// devices. Enabled by default unless running on old Android devices.
-  	inertia: !android23,
-
-  	// @option inertiaDeceleration: Number = 3000
-  	// The rate with which the inertial movement slows down, in pixels/second².
-  	inertiaDeceleration: 3400, // px/s^2
-
-  	// @option inertiaMaxSpeed: Number = Infinity
-  	// Max speed of the inertial movement, in pixels/second.
-  	inertiaMaxSpeed: Infinity, // px/s
-
-  	// @option easeLinearity: Number = 0.2
-  	easeLinearity: 0.2,
-
-  	// TODO refactor, move to CRS
-  	// @option worldCopyJump: Boolean = false
-  	// With this option enabled, the map tracks when you pan to another "copy"
-  	// of the world and seamlessly jumps to the original one so that all overlays
-  	// like markers and vector layers are still visible.
-  	worldCopyJump: false,
-
-  	// @option maxBoundsViscosity: Number = 0.0
-  	// If `maxBounds` is set, this option will control how solid the bounds
-  	// are when dragging the map around. The default value of `0.0` allows the
-  	// user to drag outside the bounds at normal speed, higher values will
-  	// slow down map dragging outside bounds, and `1.0` makes the bounds fully
-  	// solid, preventing the user from dragging outside the bounds.
-  	maxBoundsViscosity: 0.0
-  });
-
-  var Drag = Handler.extend({
-  	addHooks: function () {
-  		if (!this._draggable) {
-  			var map = this._map;
-
-  			this._draggable = new Draggable(map._mapPane, map._container);
-
-  			this._draggable.on({
-  				dragstart: this._onDragStart,
-  				drag: this._onDrag,
-  				dragend: this._onDragEnd
-  			}, this);
-
-  			this._draggable.on('predrag', this._onPreDragLimit, this);
-  			if (map.options.worldCopyJump) {
-  				this._draggable.on('predrag', this._onPreDragWrap, this);
-  				map.on('zoomend', this._onZoomEnd, this);
-
-  				map.whenReady(this._onZoomEnd, this);
-  			}
-  		}
-  		addClass(this._map._container, 'leaflet-grab leaflet-touch-drag');
-  		this._draggable.enable();
-  		this._positions = [];
-  		this._times = [];
-  	},
-
-  	removeHooks: function () {
-  		removeClass(this._map._container, 'leaflet-grab');
-  		removeClass(this._map._container, 'leaflet-touch-drag');
-  		this._draggable.disable();
-  	},
-
-  	moved: function () {
-  		return this._draggable && this._draggable._moved;
-  	},
-
-  	moving: function () {
-  		return this._draggable && this._draggable._moving;
-  	},
-
-  	_onDragStart: function () {
-  		var map = this._map;
-
-  		map._stop();
-  		if (this._map.options.maxBounds && this._map.options.maxBoundsViscosity) {
-  			var bounds = toLatLngBounds(this._map.options.maxBounds);
-
-  			this._offsetLimit = toBounds(
-  				this._map.latLngToContainerPoint(bounds.getNorthWest()).multiplyBy(-1),
-  				this._map.latLngToContainerPoint(bounds.getSouthEast()).multiplyBy(-1)
-  					.add(this._map.getSize()));
-
-  			this._viscosity = Math.min(1.0, Math.max(0.0, this._map.options.maxBoundsViscosity));
-  		} else {
-  			this._offsetLimit = null;
-  		}
-
-  		map
-  		    .fire('movestart')
-  		    .fire('dragstart');
-
-  		if (map.options.inertia) {
-  			this._positions = [];
-  			this._times = [];
-  		}
-  	},
-
-  	_onDrag: function (e) {
-  		if (this._map.options.inertia) {
-  			var time = this._lastTime = +new Date(),
-  			    pos = this._lastPos = this._draggable._absPos || this._draggable._newPos;
-
-  			this._positions.push(pos);
-  			this._times.push(time);
-
-  			this._prunePositions(time);
-  		}
-
-  		this._map
-  		    .fire('move', e)
-  		    .fire('drag', e);
-  	},
-
-  	_prunePositions: function (time) {
-  		while (this._positions.length > 1 && time - this._times[0] > 50) {
-  			this._positions.shift();
-  			this._times.shift();
-  		}
-  	},
-
-  	_onZoomEnd: function () {
-  		var pxCenter = this._map.getSize().divideBy(2),
-  		    pxWorldCenter = this._map.latLngToLayerPoint([0, 0]);
-
-  		this._initialWorldOffset = pxWorldCenter.subtract(pxCenter).x;
-  		this._worldWidth = this._map.getPixelWorldBounds().getSize().x;
-  	},
-
-  	_viscousLimit: function (value, threshold) {
-  		return value - (value - threshold) * this._viscosity;
-  	},
-
-  	_onPreDragLimit: function () {
-  		if (!this._viscosity || !this._offsetLimit) { return; }
-
-  		var offset = this._draggable._newPos.subtract(this._draggable._startPos);
-
-  		var limit = this._offsetLimit;
-  		if (offset.x < limit.min.x) { offset.x = this._viscousLimit(offset.x, limit.min.x); }
-  		if (offset.y < limit.min.y) { offset.y = this._viscousLimit(offset.y, limit.min.y); }
-  		if (offset.x > limit.max.x) { offset.x = this._viscousLimit(offset.x, limit.max.x); }
-  		if (offset.y > limit.max.y) { offset.y = this._viscousLimit(offset.y, limit.max.y); }
-
-  		this._draggable._newPos = this._draggable._startPos.add(offset);
-  	},
-
-  	_onPreDragWrap: function () {
-  		// TODO refactor to be able to adjust map pane position after zoom
-  		var worldWidth = this._worldWidth,
-  		    halfWidth = Math.round(worldWidth / 2),
-  		    dx = this._initialWorldOffset,
-  		    x = this._draggable._newPos.x,
-  		    newX1 = (x - halfWidth + dx) % worldWidth + halfWidth - dx,
-  		    newX2 = (x + halfWidth + dx) % worldWidth - halfWidth - dx,
-  		    newX = Math.abs(newX1 + dx) < Math.abs(newX2 + dx) ? newX1 : newX2;
-
-  		this._draggable._absPos = this._draggable._newPos.clone();
-  		this._draggable._newPos.x = newX;
-  	},
-
-  	_onDragEnd: function (e) {
-  		var map = this._map,
-  		    options = map.options,
-
-  		    noInertia = !options.inertia || this._times.length < 2;
-
-  		map.fire('dragend', e);
-
-  		if (noInertia) {
-  			map.fire('moveend');
-
-  		} else {
-  			this._prunePositions(+new Date());
-
-  			var direction = this._lastPos.subtract(this._positions[0]),
-  			    duration = (this._lastTime - this._times[0]) / 1000,
-  			    ease = options.easeLinearity,
-
-  			    speedVector = direction.multiplyBy(ease / duration),
-  			    speed = speedVector.distanceTo([0, 0]),
-
-  			    limitedSpeed = Math.min(options.inertiaMaxSpeed, speed),
-  			    limitedSpeedVector = speedVector.multiplyBy(limitedSpeed / speed),
-
-  			    decelerationDuration = limitedSpeed / (options.inertiaDeceleration * ease),
-  			    offset = limitedSpeedVector.multiplyBy(-decelerationDuration / 2).round();
-
-  			if (!offset.x && !offset.y) {
-  				map.fire('moveend');
-
-  			} else {
-  				offset = map._limitOffset(offset, map.options.maxBounds);
-
-  				requestAnimFrame(function () {
-  					map.panBy(offset, {
-  						duration: decelerationDuration,
-  						easeLinearity: ease,
-  						noMoveStart: true,
-  						animate: true
-  					});
-  				});
-  			}
-  		}
-  	}
-  });
-
-  // @section Handlers
-  // @property dragging: Handler
-  // Map dragging handler (by both mouse and touch).
-  Map.addInitHook('addHandler', 'dragging', Drag);
-
-  /*
-   * L.Map.Keyboard is handling keyboard interaction with the map, enabled by default.
-   */
-
-  // @namespace Map
-  // @section Keyboard Navigation Options
-  Map.mergeOptions({
-  	// @option keyboard: Boolean = true
-  	// Makes the map focusable and allows users to navigate the map with keyboard
-  	// arrows and `+`/`-` keys.
-  	keyboard: true,
-
-  	// @option keyboardPanDelta: Number = 80
-  	// Amount of pixels to pan when pressing an arrow key.
-  	keyboardPanDelta: 80
-  });
-
-  var Keyboard = Handler.extend({
-
-  	keyCodes: {
-  		left:    [37],
-  		right:   [39],
-  		down:    [40],
-  		up:      [38],
-  		zoomIn:  [187, 107, 61, 171],
-  		zoomOut: [189, 109, 54, 173]
-  	},
-
-  	initialize: function (map) {
-  		this._map = map;
-
-  		this._setPanDelta(map.options.keyboardPanDelta);
-  		this._setZoomDelta(map.options.zoomDelta);
-  	},
-
-  	addHooks: function () {
-  		var container = this._map._container;
-
-  		// make the container focusable by tabbing
-  		if (container.tabIndex <= 0) {
-  			container.tabIndex = '0';
-  		}
-
-  		on(container, {
-  			focus: this._onFocus,
-  			blur: this._onBlur,
-  			mousedown: this._onMouseDown
-  		}, this);
-
-  		this._map.on({
-  			focus: this._addHooks,
-  			blur: this._removeHooks
-  		}, this);
-  	},
-
-  	removeHooks: function () {
-  		this._removeHooks();
-
-  		off(this._map._container, {
-  			focus: this._onFocus,
-  			blur: this._onBlur,
-  			mousedown: this._onMouseDown
-  		}, this);
-
-  		this._map.off({
-  			focus: this._addHooks,
-  			blur: this._removeHooks
-  		}, this);
-  	},
-
-  	_onMouseDown: function () {
-  		if (this._focused) { return; }
-
-  		var body = document.body,
-  		    docEl = document.documentElement,
-  		    top = body.scrollTop || docEl.scrollTop,
-  		    left = body.scrollLeft || docEl.scrollLeft;
-
-  		this._map._container.focus();
-
-  		window.scrollTo(left, top);
-  	},
-
-  	_onFocus: function () {
-  		this._focused = true;
-  		this._map.fire('focus');
-  	},
-
-  	_onBlur: function () {
-  		this._focused = false;
-  		this._map.fire('blur');
-  	},
-
-  	_setPanDelta: function (panDelta) {
-  		var keys = this._panKeys = {},
-  		    codes = this.keyCodes,
-  		    i, len;
-
-  		for (i = 0, len = codes.left.length; i < len; i++) {
-  			keys[codes.left[i]] = [-1 * panDelta, 0];
-  		}
-  		for (i = 0, len = codes.right.length; i < len; i++) {
-  			keys[codes.right[i]] = [panDelta, 0];
-  		}
-  		for (i = 0, len = codes.down.length; i < len; i++) {
-  			keys[codes.down[i]] = [0, panDelta];
-  		}
-  		for (i = 0, len = codes.up.length; i < len; i++) {
-  			keys[codes.up[i]] = [0, -1 * panDelta];
-  		}
-  	},
-
-  	_setZoomDelta: function (zoomDelta) {
-  		var keys = this._zoomKeys = {},
-  		    codes = this.keyCodes,
-  		    i, len;
-
-  		for (i = 0, len = codes.zoomIn.length; i < len; i++) {
-  			keys[codes.zoomIn[i]] = zoomDelta;
-  		}
-  		for (i = 0, len = codes.zoomOut.length; i < len; i++) {
-  			keys[codes.zoomOut[i]] = -zoomDelta;
-  		}
-  	},
-
-  	_addHooks: function () {
-  		on(document, 'keydown', this._onKeyDown, this);
-  	},
-
-  	_removeHooks: function () {
-  		off(document, 'keydown', this._onKeyDown, this);
-  	},
-
-  	_onKeyDown: function (e) {
-  		if (e.altKey || e.ctrlKey || e.metaKey) { return; }
-
-  		var key = e.keyCode,
-  		    map = this._map,
-  		    offset;
-
-  		if (key in this._panKeys) {
-  			if (!map._panAnim || !map._panAnim._inProgress) {
-  				offset = this._panKeys[key];
-  				if (e.shiftKey) {
-  					offset = toPoint(offset).multiplyBy(3);
-  				}
-
-  				map.panBy(offset);
-
-  				if (map.options.maxBounds) {
-  					map.panInsideBounds(map.options.maxBounds);
-  				}
-  			}
-  		} else if (key in this._zoomKeys) {
-  			map.setZoom(map.getZoom() + (e.shiftKey ? 3 : 1) * this._zoomKeys[key]);
-
-  		} else if (key === 27 && map._popup && map._popup.options.closeOnEscapeKey) {
-  			map.closePopup();
-
-  		} else {
-  			return;
-  		}
-
-  		stop(e);
-  	}
-  });
-
-  // @section Handlers
-  // @section Handlers
-  // @property keyboard: Handler
-  // Keyboard navigation handler.
-  Map.addInitHook('addHandler', 'keyboard', Keyboard);
-
-  /*
-   * L.Handler.ScrollWheelZoom is used by L.Map to enable mouse scroll wheel zoom on the map.
-   */
-
-  // @namespace Map
-  // @section Interaction Options
-  Map.mergeOptions({
-  	// @section Mouse wheel options
-  	// @option scrollWheelZoom: Boolean|String = true
-  	// Whether the map can be zoomed by using the mouse wheel. If passed `'center'`,
-  	// it will zoom to the center of the view regardless of where the mouse was.
-  	scrollWheelZoom: true,
-
-  	// @option wheelDebounceTime: Number = 40
-  	// Limits the rate at which a wheel can fire (in milliseconds). By default
-  	// user can't zoom via wheel more often than once per 40 ms.
-  	wheelDebounceTime: 40,
-
-  	// @option wheelPxPerZoomLevel: Number = 60
-  	// How many scroll pixels (as reported by [L.DomEvent.getWheelDelta](#domevent-getwheeldelta))
-  	// mean a change of one full zoom level. Smaller values will make wheel-zooming
-  	// faster (and vice versa).
-  	wheelPxPerZoomLevel: 60
-  });
-
-  var ScrollWheelZoom = Handler.extend({
-  	addHooks: function () {
-  		on(this._map._container, 'wheel', this._onWheelScroll, this);
-
-  		this._delta = 0;
-  	},
-
-  	removeHooks: function () {
-  		off(this._map._container, 'wheel', this._onWheelScroll, this);
-  	},
-
-  	_onWheelScroll: function (e) {
-  		var delta = getWheelDelta(e);
-
-  		var debounce = this._map.options.wheelDebounceTime;
-
-  		this._delta += delta;
-  		this._lastMousePos = this._map.mouseEventToContainerPoint(e);
-
-  		if (!this._startTime) {
-  			this._startTime = +new Date();
-  		}
-
-  		var left = Math.max(debounce - (+new Date() - this._startTime), 0);
-
-  		clearTimeout(this._timer);
-  		this._timer = setTimeout(bind(this._performZoom, this), left);
-
-  		stop(e);
-  	},
-
-  	_performZoom: function () {
-  		var map = this._map,
-  		    zoom = map.getZoom(),
-  		    snap = this._map.options.zoomSnap || 0;
-
-  		map._stop(); // stop panning and fly animations if any
-
-  		// map the delta with a sigmoid function to -4..4 range leaning on -1..1
-  		var d2 = this._delta / (this._map.options.wheelPxPerZoomLevel * 4),
-  		    d3 = 4 * Math.log(2 / (1 + Math.exp(-Math.abs(d2)))) / Math.LN2,
-  		    d4 = snap ? Math.ceil(d3 / snap) * snap : d3,
-  		    delta = map._limitZoom(zoom + (this._delta > 0 ? d4 : -d4)) - zoom;
-
-  		this._delta = 0;
-  		this._startTime = null;
-
-  		if (!delta) { return; }
-
-  		if (map.options.scrollWheelZoom === 'center') {
-  			map.setZoom(zoom + delta);
-  		} else {
-  			map.setZoomAround(this._lastMousePos, zoom + delta);
-  		}
-  	}
-  });
-
-  // @section Handlers
-  // @property scrollWheelZoom: Handler
-  // Scroll wheel zoom handler.
-  Map.addInitHook('addHandler', 'scrollWheelZoom', ScrollWheelZoom);
-
-  /*
-   * L.Map.Tap is used to enable mobile hacks like quick taps and long hold.
-   */
-
-  // @namespace Map
-  // @section Interaction Options
-  Map.mergeOptions({
-  	// @section Touch interaction options
-  	// @option tap: Boolean = true
-  	// Enables mobile hacks for supporting instant taps (fixing 200ms click
-  	// delay on iOS/Android) and touch holds (fired as `contextmenu` events).
-  	tap: true,
-
-  	// @option tapTolerance: Number = 15
-  	// The max number of pixels a user can shift his finger during touch
-  	// for it to be considered a valid tap.
-  	tapTolerance: 15
-  });
-
-  var Tap = Handler.extend({
-  	addHooks: function () {
-  		on(this._map._container, 'touchstart', this._onDown, this);
-  	},
-
-  	removeHooks: function () {
-  		off(this._map._container, 'touchstart', this._onDown, this);
-  	},
-
-  	_onDown: function (e) {
-  		if (!e.touches) { return; }
-
-  		preventDefault(e);
-
-  		this._fireClick = true;
-
-  		// don't simulate click or track longpress if more than 1 touch
-  		if (e.touches.length > 1) {
-  			this._fireClick = false;
-  			clearTimeout(this._holdTimeout);
-  			return;
-  		}
-
-  		var first = e.touches[0],
-  		    el = first.target;
-
-  		this._startPos = this._newPos = new Point(first.clientX, first.clientY);
-
-  		// if touching a link, highlight it
-  		if (el.tagName && el.tagName.toLowerCase() === 'a') {
-  			addClass(el, 'leaflet-active');
-  		}
-
-  		// simulate long hold but setting a timeout
-  		this._holdTimeout = setTimeout(bind(function () {
-  			if (this._isTapValid()) {
-  				this._fireClick = false;
-  				this._onUp();
-  				this._simulateEvent('contextmenu', first);
-  			}
-  		}, this), 1000);
-
-  		this._simulateEvent('mousedown', first);
-
-  		on(document, {
-  			touchmove: this._onMove,
-  			touchend: this._onUp
-  		}, this);
-  	},
-
-  	_onUp: function (e) {
-  		clearTimeout(this._holdTimeout);
-
-  		off(document, {
-  			touchmove: this._onMove,
-  			touchend: this._onUp
-  		}, this);
-
-  		if (this._fireClick && e && e.changedTouches) {
-
-  			var first = e.changedTouches[0],
-  			    el = first.target;
-
-  			if (el && el.tagName && el.tagName.toLowerCase() === 'a') {
-  				removeClass(el, 'leaflet-active');
-  			}
-
-  			this._simulateEvent('mouseup', first);
-
-  			// simulate click if the touch didn't move too much
-  			if (this._isTapValid()) {
-  				this._simulateEvent('click', first);
-  			}
-  		}
-  	},
-
-  	_isTapValid: function () {
-  		return this._newPos.distanceTo(this._startPos) <= this._map.options.tapTolerance;
-  	},
-
-  	_onMove: function (e) {
-  		var first = e.touches[0];
-  		this._newPos = new Point(first.clientX, first.clientY);
-  		this._simulateEvent('mousemove', first);
-  	},
-
-  	_simulateEvent: function (type, e) {
-  		var simulatedEvent = document.createEvent('MouseEvents');
-
-  		simulatedEvent._simulated = true;
-  		e.target._simulatedClick = true;
-
-  		simulatedEvent.initMouseEvent(
-  		        type, true, true, window, 1,
-  		        e.screenX, e.screenY,
-  		        e.clientX, e.clientY,
-  		        false, false, false, false, 0, null);
-
-  		e.target.dispatchEvent(simulatedEvent);
-  	}
-  });
-
-  // @section Handlers
-  // @property tap: Handler
-  // Mobile touch hacks (quick tap and touch hold) handler.
-  if (touch && (!pointer || safari)) {
-  	Map.addInitHook('addHandler', 'tap', Tap);
-  }
-
-  /*
-   * L.Handler.TouchZoom is used by L.Map to add pinch zoom on supported mobile browsers.
-   */
-
-  // @namespace Map
-  // @section Interaction Options
-  Map.mergeOptions({
-  	// @section Touch interaction options
-  	// @option touchZoom: Boolean|String = *
-  	// Whether the map can be zoomed by touch-dragging with two fingers. If
-  	// passed `'center'`, it will zoom to the center of the view regardless of
-  	// where the touch events (fingers) were. Enabled for touch-capable web
-  	// browsers except for old Androids.
-  	touchZoom: touch && !android23,
-
-  	// @option bounceAtZoomLimits: Boolean = true
-  	// Set it to false if you don't want the map to zoom beyond min/max zoom
-  	// and then bounce back when pinch-zooming.
-  	bounceAtZoomLimits: true
-  });
-
-  var TouchZoom = Handler.extend({
-  	addHooks: function () {
-  		addClass(this._map._container, 'leaflet-touch-zoom');
-  		on(this._map._container, 'touchstart', this._onTouchStart, this);
-  	},
-
-  	removeHooks: function () {
-  		removeClass(this._map._container, 'leaflet-touch-zoom');
-  		off(this._map._container, 'touchstart', this._onTouchStart, this);
-  	},
-
-  	_onTouchStart: function (e) {
-  		var map = this._map;
-  		if (!e.touches || e.touches.length !== 2 || map._animatingZoom || this._zooming) { return; }
-
-  		var p1 = map.mouseEventToContainerPoint(e.touches[0]),
-  		    p2 = map.mouseEventToContainerPoint(e.touches[1]);
-
-  		this._centerPoint = map.getSize()._divideBy(2);
-  		this._startLatLng = map.containerPointToLatLng(this._centerPoint);
-  		if (map.options.touchZoom !== 'center') {
-  			this._pinchStartLatLng = map.containerPointToLatLng(p1.add(p2)._divideBy(2));
-  		}
-
-  		this._startDist = p1.distanceTo(p2);
-  		this._startZoom = map.getZoom();
-
-  		this._moved = false;
-  		this._zooming = true;
-
-  		map._stop();
-
-  		on(document, 'touchmove', this._onTouchMove, this);
-  		on(document, 'touchend', this._onTouchEnd, this);
-
-  		preventDefault(e);
-  	},
-
-  	_onTouchMove: function (e) {
-  		if (!e.touches || e.touches.length !== 2 || !this._zooming) { return; }
-
-  		var map = this._map,
-  		    p1 = map.mouseEventToContainerPoint(e.touches[0]),
-  		    p2 = map.mouseEventToContainerPoint(e.touches[1]),
-  		    scale = p1.distanceTo(p2) / this._startDist;
-
-  		this._zoom = map.getScaleZoom(scale, this._startZoom);
-
-  		if (!map.options.bounceAtZoomLimits && (
-  			(this._zoom < map.getMinZoom() && scale < 1) ||
-  			(this._zoom > map.getMaxZoom() && scale > 1))) {
-  			this._zoom = map._limitZoom(this._zoom);
-  		}
-
-  		if (map.options.touchZoom === 'center') {
-  			this._center = this._startLatLng;
-  			if (scale === 1) { return; }
-  		} else {
-  			// Get delta from pinch to center, so centerLatLng is delta applied to initial pinchLatLng
-  			var delta = p1._add(p2)._divideBy(2)._subtract(this._centerPoint);
-  			if (scale === 1 && delta.x === 0 && delta.y === 0) { return; }
-  			this._center = map.unproject(map.project(this._pinchStartLatLng, this._zoom).subtract(delta), this._zoom);
-  		}
-
-  		if (!this._moved) {
-  			map._moveStart(true, false);
-  			this._moved = true;
-  		}
-
-  		cancelAnimFrame(this._animRequest);
-
-  		var moveFn = bind(map._move, map, this._center, this._zoom, {pinch: true, round: false});
-  		this._animRequest = requestAnimFrame(moveFn, this, true);
-
-  		preventDefault(e);
-  	},
-
-  	_onTouchEnd: function () {
-  		if (!this._moved || !this._zooming) {
-  			this._zooming = false;
-  			return;
-  		}
-
-  		this._zooming = false;
-  		cancelAnimFrame(this._animRequest);
-
-  		off(document, 'touchmove', this._onTouchMove, this);
-  		off(document, 'touchend', this._onTouchEnd, this);
-
-  		// Pinch updates GridLayers' levels only when zoomSnap is off, so zoomSnap becomes noUpdate.
-  		if (this._map.options.zoomAnimation) {
-  			this._map._animateZoom(this._center, this._map._limitZoom(this._zoom), true, this._map.options.zoomSnap);
-  		} else {
-  			this._map._resetView(this._center, this._map._limitZoom(this._zoom));
-  		}
-  	}
-  });
-
-  // @section Handlers
-  // @property touchZoom: Handler
-  // Touch zoom handler.
-  Map.addInitHook('addHandler', 'touchZoom', TouchZoom);
-
-  Map.BoxZoom = BoxZoom;
-  Map.DoubleClickZoom = DoubleClickZoom;
-  Map.Drag = Drag;
-  Map.Keyboard = Keyboard;
-  Map.ScrollWheelZoom = ScrollWheelZoom;
-  Map.Tap = Tap;
-  Map.TouchZoom = TouchZoom;
-
-  exports.version = version;
-  exports.Control = Control;
-  exports.control = control;
-  exports.Browser = Browser;
-  exports.Evented = Evented;
-  exports.Mixin = Mixin;
-  exports.Util = Util;
-  exports.Class = Class;
-  exports.Handler = Handler;
-  exports.extend = extend;
-  exports.bind = bind;
-  exports.stamp = stamp;
-  exports.setOptions = setOptions;
-  exports.DomEvent = DomEvent;
-  exports.DomUtil = DomUtil;
-  exports.PosAnimation = PosAnimation;
-  exports.Draggable = Draggable;
-  exports.LineUtil = LineUtil;
-  exports.PolyUtil = PolyUtil;
-  exports.Point = Point;
-  exports.point = toPoint;
-  exports.Bounds = Bounds;
-  exports.bounds = toBounds;
-  exports.Transformation = Transformation;
-  exports.transformation = toTransformation;
-  exports.Projection = index;
-  exports.LatLng = LatLng;
-  exports.latLng = toLatLng;
-  exports.LatLngBounds = LatLngBounds;
-  exports.latLngBounds = toLatLngBounds;
-  exports.CRS = CRS;
-  exports.GeoJSON = GeoJSON;
-  exports.geoJSON = geoJSON;
-  exports.geoJson = geoJson;
-  exports.Layer = Layer;
-  exports.LayerGroup = LayerGroup;
-  exports.layerGroup = layerGroup;
-  exports.FeatureGroup = FeatureGroup;
-  exports.featureGroup = featureGroup;
-  exports.ImageOverlay = ImageOverlay;
-  exports.imageOverlay = imageOverlay;
-  exports.VideoOverlay = VideoOverlay;
-  exports.videoOverlay = videoOverlay;
-  exports.SVGOverlay = SVGOverlay;
-  exports.svgOverlay = svgOverlay;
-  exports.DivOverlay = DivOverlay;
-  exports.Popup = Popup;
-  exports.popup = popup;
-  exports.Tooltip = Tooltip;
-  exports.tooltip = tooltip;
-  exports.Icon = Icon;
-  exports.icon = icon;
-  exports.DivIcon = DivIcon;
-  exports.divIcon = divIcon;
-  exports.Marker = Marker;
-  exports.marker = marker;
-  exports.TileLayer = TileLayer;
-  exports.tileLayer = tileLayer;
-  exports.GridLayer = GridLayer;
-  exports.gridLayer = gridLayer;
-  exports.SVG = SVG;
-  exports.svg = svg$1;
-  exports.Renderer = Renderer;
-  exports.Canvas = Canvas;
-  exports.canvas = canvas$1;
-  exports.Path = Path;
-  exports.CircleMarker = CircleMarker;
-  exports.circleMarker = circleMarker;
-  exports.Circle = Circle;
-  exports.circle = circle;
-  exports.Polyline = Polyline;
-  exports.polyline = polyline;
-  exports.Polygon = Polygon;
-  exports.polygon = polygon;
-  exports.Rectangle = Rectangle;
-  exports.rectangle = rectangle;
-  exports.Map = Map;
-  exports.map = createMap;
-
-  var oldL = window.L;
-  exports.noConflict = function() {
-  	window.L = oldL;
-  	return this;
-  }
-
-  // Always export us to window global (see #2364)
-  window.L = exports;
-
-})));
-//# sourceMappingURL=leaflet-src.js.map
diff --git a/screenreader/feature-index/dist/map-area.js b/screenreader/feature-index/dist/map-area.js
deleted file mode 100644
index 6d1fa47..0000000
--- a/screenreader/feature-index/dist/map-area.js
+++ /dev/null
@@ -1,176 +0,0 @@
-import './leaflet-src.js';  // a lightly modified version of Leaflet for use as browser module
-import './proj4-src.js';        // modified version of proj4; could be stripped down for mapml
-import './proj4leaflet.js'; // not modified, seems to adapt proj4 for leaflet use. 
-import './mapml.js';       // refactored URI usage, replaced with URL standard
-
-export class MapArea extends HTMLAreaElement {
-  static get observedAttributes() {
-    return ['coords','alt','href','shape','rel','type','target'];
-  }
-  // see comments below regarding attributeChangedCallback vs. getter/setter 
-  // usage.  Effectively, the user of the element must use the property, not
-  // the getAttribute/setAttribute/removeAttribute DOM API, because the latter
-  // calls don't result in the getter/setter being called (so you have to use
-  // the getter/setter directly)
-  get alt() {
-    return this.hasAttribute('alt') ?  this.getAttribute('alt') : "";
-  }
-  set alt(value) {
-    this.setAttribute('controls', value);
-  }
-  get coords() {
-    return this.hasAttribute('coords') ? this.getAttribute('coords') : "";
-  }
-  set coords(coordinates) {
-    // what to do.  Probably replace the feature with a new one, without changing 
-    // anything else...
-  }
-  get href() {
-    return this.hasAttribute('href') ?  this.getAttribute('href') : "";
-  }
-  set href(url) {
-    this.href = url;
-  }
-  get shape() {
-    return this.hasAttribute('shape') ?  this.getAttribute('shape') : "default";
-  }
-  set shape(shape) {
-    shape = shape.toLowerCase();
-    var re = /default|circle|rect|poly/;
-    if (shape.search(re)) {
-      this.shape = shape;
-    }
-  }
-  get rel() {
-    return this.hasAttribute('rel') ?  this.getAttribute('rel') : "";
-  }
-  set rel(rel) {
-    this.rel = rel;
-  }
-  get type() {
-    return this.hasAttribute('type') ?  this.getAttribute('type') : "";
-  }
-  set type(type) {
-    this.type = type;
-  }
-  get target() {
-    return this.hasAttribute('target') ?  this.getAttribute('target') : "";
-  }
-  constructor() {
-    // Always call super first in constructor
-    super();
-  }
-  attributeChangedCallback(name, oldValue, newValue) {
-    
-  }
-  connectedCallback() {
-    // if the map has been attached, set this layer up wrt Leaflet map
-    if (this.parentElement._map) {
-        this._attachedToMap();
-    }
-  }
-  _attachedToMap() {
-    // need the map to convert container points to LatLngs
-    this._map = this.parentElement._map;
-    var map = this.parentElement._map;
-
-    // don't go through this if already done
-    if (!this._feature) {
-      // Scale this.coords if the this._map.poster exists because
-      // the img might have been scaled by CSS.
-      // compute the style properties to be applied to the feature
-      var options = this._styleToPathOptions(window.getComputedStyle(this)),
-          points = this.coords ? this._coordsToArray(this.coords): null;
-      // scale points if the poster exists because responsive areas
-      if (points && this.parentElement.poster) {
-        var worig = this.parentElement.poster.width, 
-            wresp = this.parentElement.width, 
-            wadjstmnt = (worig - wresp)/2,
-            horig = this.parentElement.poster.height, 
-            hresp = this.parentElement.height, 
-            hadjstmnt = (horig - hresp)/2;
-        for (var i = 0; i< points.length;i++) {
-          points[i][0] = points[i][0] - wadjstmnt;
-          points[i][1] = points[i][1] - hadjstmnt;
-        }
-      }
-
-      if (this.shape === 'circle') {
-        var pixelRadius = parseInt(this.coords.split(",")[2]), 
-            pointOnCirc = L.point(points[0]).add(L.point(0,pixelRadius)),
-            latLngOnCirc = map.containerPointToLatLng(pointOnCirc),
-            latLngCenter = map.containerPointToLatLng(points[0]),
-            radiusInMeters = map.distance(latLngCenter, latLngOnCirc);
-        this._feature = L.circle(latLngCenter, radiusInMeters, options).addTo(map);
-      } else if (!this.shape || this.shape === 'rect') {
-        var bounds = L.latLngBounds(map.containerPointToLatLng(points[0]), map.containerPointToLatLng(points[1]));
-        this._feature = L.rectangle(bounds, options).addTo(map);
-      } else if (this.shape === 'poly') {
-        this._feature = L.polygon(this._pointsToLatLngs(points),options).addTo(map);
-      } else {
-        // whole initial area of map is a hyperlink
-        this._feature = L.rectangle(map.getBounds(),options).addTo(map);
-      }
-      if (this.alt) {
-        // other Leaflet features are implemented via SVG.  SVG displays tooltips
-        // based on the <svg:title> graphics child element.
-        var title = L.SVG.create('title'),
-            titleText = document.createTextNode(this.alt);
-            title.appendChild(titleText);
-            this._feature._path.appendChild(title);
-      }
-      if (this.href) {
-        // conditionally act on click on an area link.  If no link it should be an
-        // inert area, but Leaflet doesn't quite support this.  For a full
-        // implementation, we could actually use an image map replete with area
-        // children which would provide the linking / cursor change behaviours
-        // that are familiar to HTML authors versed in image maps.
-        this._feature.on('click', function() {if (this.href) {window.open(this.href);}}, this);
-      }
-    }
-  }  
-  disconnectedCallback() {
-    this._map.removeLayer(this._feature);
-    delete this._feature;
-  }
-  _coordsToArray(containerPoints) {
-    // returns an array of arrays of coordinate pairs coordsToArray("1,2,3,4") -> [[1,2],[3,4]]
-    for (var i=1, points = [], coords = containerPoints.split(",");i<coords.length;i+=2) {
-      points.push([parseInt(coords[i-1]),parseInt(coords[i])]);
-    }
-    return points;
-  }
-  _pointsToLatLngs(points) {
-    // points should be an array of nested container coordinates [[x1,y1],[x2,y2](,[xN,yN])]
-    var latLngArray = [];
-    if (this._map) {
-      for (var i=0,map = this._map;i<points.length;i++) {
-        latLngArray.push(map.containerPointToLatLng(points[i]));
-      }
-    }
-    return latLngArray;
-  }
-  _styleToPathOptions(style) {
-    var options = {};
-    if(style.stroke !== 'none') {
-      options.stroke = true;
-      options.color = style.stroke;
-      options.opacity = style.strokeOpacity;
-      options.weight = parseInt(style.strokeWidth);
-      options.dashArray = style.strokeDasharray;
-      options.lineCap = style.strokeLinecap;
-      options.lineJoin = style.strokeLinejoin;
-    } else {
-      options.stroke = false;
-    }
-    if (style.fill !== 'none') {
-      options.fill = true;
-      options.fillColor = style.fill;
-      options.fillOpacity = style.fillOpacity;
-      options.fillRule = style.fillRule;
-    } else {
-      options.fill = false;
-    }
-    return options;
-  }
-}
diff --git a/screenreader/feature-index/dist/mapml-viewer.js b/screenreader/feature-index/dist/mapml-viewer.js
deleted file mode 100644
index 88fb1be..0000000
--- a/screenreader/feature-index/dist/mapml-viewer.js
+++ /dev/null
@@ -1,755 +0,0 @@
-import './leaflet-src.js';  // a (very slightly) modified version of Leaflet for use as browser module
-import './proj4-src.js';        // modified version of proj4; could be stripped down for mapml
-import './proj4leaflet.js'; // not modified, seems to adapt proj4 for leaflet use.
-import './mapml.js';       // refactored URI usage, replaced with URL standard
-import { MapLayer } from './layer.js';
-
-export class MapViewer extends HTMLElement {
-  static get observedAttributes() {
-    return ['lat', 'lon', 'zoom', 'projection', 'width', 'height', 'controls'];
-  }
-  // see comments below regarding attributeChangedCallback vs. getter/setter
-  // usage.  Effectively, the user of the element must use the property, not
-  // the getAttribute/setAttribute/removeAttribute DOM API, because the latter
-  // calls don't result in the getter/setter being called (so you have to use
-  // the getter/setter directly)
-  get controls() {
-    return this.hasAttribute('controls');
-  }
-  set controls(value) {
-    const hasControls = Boolean(value);
-    if (hasControls)
-      this.setAttribute('controls', '');
-    else
-      this.removeAttribute('controls');
-    this._toggleControls(hasControls);
-  }
-  get controlslist() {
-    return this.hasAttribute('controlslist') ? this.getAttribute("controlslist") : "";
-  }
-  set controlslist(val) {
-    let options = ["nofullscreen", "nozoom", "nolayer", "noreload"],
-        lowerVal = val.toLowerCase();
-    if (this.controlslist.includes(lowerVal) || !options.includes(lowerVal))return;
-    this.setAttribute("controlslist", this.controlslist+` ${lowerVal}`);
-  }
-  get lat() {
-    return this.hasAttribute("lat") ? this.getAttribute("lat") : "0";
-  }
-  set lat(val) {
-    if (val) {
-      this.setAttribute("lat", val);
-    }
-  }
-  get lon() {
-    return this.hasAttribute("lon") ? this.getAttribute("lon") : "0";
-  }
-  set lon(val) {
-    if (val) {
-      this.setAttribute("lon", val);
-    }
-  }
-  get projection() {
-    return this.hasAttribute("projection") ? this.getAttribute("projection") : "";
-  }
-  set projection(val) {
-    if(val && M[val]){
-      this.setAttribute('projection', val);
-      if (this._map && this._map.options.projection !== val){
-        this._map.options.crs = M[val];
-        this._map.options.projection = val;
-        for(let layer of this.querySelectorAll("layer-")){
-          layer.removeAttribute("disabled");
-          let reAttach = this.removeChild(layer);
-          this.appendChild(reAttach);
-        }
-        if(this._debug) for(let i = 0; i<2;i++) this.toggleDebug();
-      } else this.dispatchEvent(new CustomEvent('createmap'));
-    } else throw new Error("Undefined Projection");
-  }
-  get zoom() {
-    return this.hasAttribute("zoom") ? this.getAttribute("zoom") : 0;
-  }
-  set zoom(val) {
-      var parsedVal = parseInt(val,10);
-      if (!isNaN(parsedVal) && (parsedVal >= 0 && parsedVal <= 25)) {
-        this.setAttribute('zoom', parsedVal);
-      }
-  }
-  get layers() {
-    return this.getElementsByTagName('layer-');
-  }
-
-  get extent(){
-    let map = this._map,
-      pcrsBounds = M.pixelToPCRSBounds(
-        map.getPixelBounds(),
-        map.getZoom(),
-        map.options.projection);
-    let formattedExtent = M.convertAndFormatPCRS(pcrsBounds, map);
-    if(map.getMaxZoom() !== Infinity){
-      formattedExtent.zoom = {
-        minZoom:map.getMinZoom(),
-        maxZoom:map.getMaxZoom()
-      };
-    }
-    return (formattedExtent);
-  }
-
-  constructor() {
-    // Always call super first in constructor
-    super();
-    this._source = this.outerHTML;
-    let tmpl = document.createElement('template');
-    tmpl.innerHTML = `<link rel="stylesheet" href="${new URL("mapml.css", import.meta.url).href}">`; // jshint ignore:line
-    
-    let shadowRoot = this.attachShadow({mode: 'open'});
-    this._container = document.createElement('div');
-
-    let output = "<output role='status' aria-live='polite' aria-atomic='true' class='mapml-screen-reader-output'></output>";
-    this._container.insertAdjacentHTML("beforeend", output);
-
-    // Set default styles for the map element.
-    let mapDefaultCSS = document.createElement('style');
-    mapDefaultCSS.innerHTML =
-    `:host {` +
-    `all: initial;` + // Reset properties inheritable from html/body, as some inherited styles may cause unexpected issues with the map element's components (https://github.com/Maps4HTML/Web-Map-Custom-Element/issues/140).
-    `contain: layout size;` + // Contain layout and size calculations within the map element.
-    `display: inline-block;` + // This together with dimension properties is required so that Leaflet isn't working with a height=0 box by default.
-    `height: 150px;` + // Provide a "default object size" (https://github.com/Maps4HTML/HTML-Map-Element/issues/31).
-    `width: 300px;` +
-    `border-width: 2px;` + // Set a default border for contrast, similar to UA default for iframes.
-    `border-style: inset;` +
-    `}` +
-    `:host([frameborder="0"]) {` +
-    `border-width: 0;` +
-    `}` +
-    `:host([hidden]) {` +
-    `display: none!important;` +
-    `}` +
-    `:host .leaflet-control-container {` +
-    `visibility: hidden!important;` + // Visibility hack to improve percieved performance (mitigate FOUC) – visibility is unset in mapml.css! (https://github.com/Maps4HTML/Web-Map-Custom-Element/issues/154).
-    `}`;
-    
-    // Hide all (light DOM) children of the map element.
-    let hideElementsCSS = document.createElement('style');
-    hideElementsCSS.innerHTML =
-    `mapml-viewer > * {` +
-    `display: none!important;` +
-    `}`;
-
-    shadowRoot.appendChild(mapDefaultCSS);
-    shadowRoot.appendChild(tmpl.content.cloneNode(true));
-    shadowRoot.appendChild(this._container);
-
-    this.appendChild(hideElementsCSS);
-
-    this._toggleState = false;
-    this.controlsListObserver = new MutationObserver((m) => {
-      m.forEach((change)=>{
-        if(change.type==="attributes" && change.attributeName === "controlslist")
-          this.setControls(false,false,false);
-      });
-    });
-    this.controlsListObserver.observe(this, {attributes:true});
-  }
-  connectedCallback() {
-    if (this.isConnected) {
-
-      // the dimension attributes win, if they're there. A map does not
-      // have an intrinsic size, unlike an image or video, and so must
-      // have a defined width and height.
-      var s = window.getComputedStyle(this),
-        wpx = s.width, hpx=s.height,
-        w = parseInt(wpx.replace('px','')),
-        h = parseInt(hpx.replace('px',''));
-
-      if (wpx === "" || hpx === "") {
-         return;
-      }
-
-      if (!this.width || this.width !== w) {
-        this._container.style.width = wpx;
-        this.width = w;
-      } else {
-        this._container.style.width = this.width+"px";
-      }
-
-      if (!this.height || this.height !== h) {
-        this._container.style.height = hpx;
-        this.height = h;
-      } else {
-        this._container.style.height = this.height+"px";
-      }
-
-      // create an array to track the history of the map and the current index
-      if(!this._history){
-        this._history = [];
-        this._historyIndex = -1;
-        this._traversalCall = false;
-      }
-
-      // wait for createmap event before creating leaflet map
-      // this allows a safeguard for the case where loading a custom TCRS takes longer than loading mapml-viewer.js/web-map.js
-      this.addEventListener('createmap', ()=>{
-        if (!this._map) {
-          this._map = L.map(this._container, {
-            center: new L.LatLng(this.lat, this.lon),
-            projection: this.projection,
-            query: true,
-            contextMenu: true,
-            announceMovement: M.options.announceMovement,
-            mapEl: this,
-            crs: M[this.projection],
-            zoom: this.zoom,
-            zoomControl: false,
-            // because the M.MapMLLayer invokes _tileLayer._onMoveEnd when
-            // the mapml response is received the screen tends to flash.  I'm sure
-            // there is a better configuration than that, but at this moment
-            // I'm not sure how to approach that issue.
-            // See https://github.com/Maps4HTML/MapML-Leaflet-Client/issues/24
-            fadeAnimation: true
-          });
-          this._addToHistory();
-          // the attribution control is not optional
-          this._attributionControl =  this._map.attributionControl.setPrefix('<a href="https://www.w3.org/community/maps4html/" title="W3C Maps for HTML Community Group">Maps4HTML</a> | <a href="https://leafletjs.com" title="A JS library for interactive maps">Leaflet</a>');
-          this._attributionControl.getContainer().setAttribute("role","group");
-          this._attributionControl.getContainer().setAttribute("aria-label","Map data attribution");
-
-          this.setControls(false,false,true);
-          this._crosshair = M.crosshair().addTo(this._map);
-          this._featureIndex = M.featureIndex().addTo(this._map);
-          // https://github.com/Maps4HTML/Web-Map-Custom-Element/issues/274
-          this.setAttribute('role', 'application');
-          // Make the Leaflet container element programmatically identifiable
-          // (https://github.com/Leaflet/Leaflet/issues/7193).
-          this._container.setAttribute('role', 'region');
-          this._container.setAttribute('aria-label', 'Interactive map');
-    
-          this._setUpEvents();
-          // this.fire('load', {target: this});
-        }
-      }, {once:true});
- 
-      let custom = !(["CBMTILE","APSTILE","OSMTILE","WGS84"].includes(this.projection));
-      // if the page doesn't use nav.js or isn't custom then dispatch createmap event	
-      if(!custom){	
-        this.dispatchEvent(new CustomEvent('createmap'));
-      }
-    }
-  }
-  disconnectedCallback() {
-    //this._removeEvents();
-    delete this._map;
-  }
-  adoptedCallback() {
-//    console.log('Custom map element moved to new page.');
-  }
-
-  setControls(isToggle, toggleShow, setup){
-    if (this.controls && this._map) {
-      let controls = ["_zoomControl", "_reloadButton", "_fullScreenControl", "_layerControl"],
-          options = ["nozoom", "noreload", "nofullscreen", 'nolayer'],
-          mapSize = this._map.getSize().y,
-          totalSize = 0;
-
-      //removes the left hand controls, if not done they will be re-added in the incorrect order
-      //better to just reset them
-      for(let i = 0 ; i<3;i++){
-        if(this[controls[i]]){
-          this._map.removeControl(this[controls[i]]);
-          delete this[controls[i]];
-        }
-      }
-
-      if (!this.controlslist.toLowerCase().includes("nolayer") && !this._layerControl && this.layers.length > 0){
-        this._layerControl = M.mapMlLayerControl(null,{"collapsed": true, mapEl: this}).addTo(this._map);
-        //if this is the initial setup the layers dont need to be readded, causes issues if they are
-        if(!setup){
-          for (var i=0;i<this.layers.length;i++) {
-            if (!this.layers[i].hidden) {
-              this._layerControl.addOverlay(this.layers[i]._layer, this.layers[i].label);
-              this._map.on('moveend', this.layers[i]._validateDisabled,  this.layers[i]);
-              this.layers[i]._layerControl = this._layerControl;
-            }
-          }
-          this._map.fire("validate");
-        }
-      }
-      if (!this.controlslist.toLowerCase().includes("nozoom") && !this._zoomControl && (totalSize + 93) <= mapSize){
-        totalSize += 93;
-        this._zoomControl = L.control.zoom().addTo(this._map);
-      }
-      if (!this.controlslist.toLowerCase().includes("noreload") && !this._reloadButton && (totalSize + 49) <= mapSize){
-        totalSize += 49;
-        this._reloadButton = M.reloadButton().addTo(this._map);
-      }
-      if (!this.controlslist.toLowerCase().includes("nofullscreen") && !this._fullScreenControl && (totalSize + 49) <= mapSize){
-        totalSize += 49;
-        this._fullScreenControl = M.fullscreenButton().addTo(this._map);
-      }
-      //removes any control layers that are not needed, either by the toggling or by the controlslist attribute
-      for(let i in options){
-        if(this[controls[i]] && (this.controlslist.toLowerCase().includes(options[i]) || (isToggle && !toggleShow ))){
-          this._map.removeControl(this[controls[i]]);
-          delete this[controls[i]];
-        }
-      }
-    }
-  }
-  attributeChangedCallback(name, oldValue, newValue) {
-//    console.log('Attribute: ' + name + ' changed from: '+ oldValue + ' to: '+newValue);
-    // "Best practice": handle side-effects in this callback
-    // https://developers.google.com/web/fundamentals/web-components/best-practices
-    // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
-    // note that the example is misleading, since the user can't use
-    // setAttribute or removeAttribute to set the property, they need to use
-    // the property directly in their API usage, which kinda sucks
-    /*
-  const hasValue = newValue !== null;
-  switch (name) {
-    case 'checked':
-      // Note the attributeChangedCallback is only handling the *side effects*
-      // of setting the attribute.
-      this.setAttribute('aria-checked', hasValue);
-      break;
-    ...
-  }     */
-  }
-  _dropHandler(event) {
-    event.preventDefault();
-    // create a new <layer-> child of this <mapml-viewer> element
-      let l = new MapLayer();
-      l.src = event.dataTransfer.getData("text");
-      l.label = 'Layer';
-      l.checked = 'true';
-      this.appendChild(l);
-      l.addEventListener("error", function () {
-        if (l.parentElement) {
-          // should invoke lifecyle callbacks automatically by removing it from DOM
-          l.parentElement.removeChild(l);
-        }
-        // garbage collect it
-        l = null;
-      });
-  }
-  _dragoverHandler(event) {
-    function contains(list, value) {
-      for( var i = 0; i < list.length; ++i ) {
-        if(list[i] === value) return true;
-      }
-      return false;
-    }
-    // check if the thing being dragged is a URL
-    var isLink = contains( event.dataTransfer.types, "text/uri-list");
-    if (isLink) {
-      event.preventDefault();
-      event.dataTransfer.dropEffect = "copy";
-    }
-  }
-  _removeEvents() {
-    if (this._map) {
-      this._map.off('preclick click dblclick mousemove mouseover mouseout mousedown mouseup contextmenu', false, this);
-      this._map.off('load movestart move moveend zoomstart zoom zoomend', false, this);
-      this.removeEventListener("drop", this._dropHandler, false);
-      this.removeEventListener("dragover", this._dragoverHandler, false);
-    }
-  }
-  _setUpEvents() {
-    this.addEventListener("drop", this._dropHandler, false);
-    this.addEventListener("dragover", this._dragoverHandler, false);
-    this.addEventListener("change",
-    function(e) {
-      if(e.target.tagName === "LAYER-"){
-        this.dispatchEvent(new CustomEvent("layerchange", {details:{target: this, originalEvent: e}}));
-      }
-    }, false);
-
-    this.parentElement.addEventListener('keyup', function (e) {
-      if(e.keyCode === 9 && document.activeElement.nodeName === "MAPML-VIEWER"){
-        document.activeElement.dispatchEvent(new CustomEvent('mapfocused', {detail:
-              {target: this}}));
-      }
-    });
-    this.parentElement.addEventListener('mousedown', function (e) {
-      if(document.activeElement.nodeName === "MAPML-VIEWER"){
-        document.activeElement.dispatchEvent(new CustomEvent('mapfocused', {detail:
-              {target: this}}));
-      }
-    });
-    this._map.on('load',
-      function () {
-        this.dispatchEvent(new CustomEvent('load', {detail: {target: this}}));
-      }, this);
-    this._map.on('preclick',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('preclick', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      }, this);
-    this._map.on('click',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('click', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      }, this);
-    this._map.on('dblclick',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('dblclick', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      }, this);
-    this._map.on('mousemove',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('mousemove', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      }, this);
-    this._map.on('mouseover',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('mouseover', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      }, this);
-    this._map.on('mouseout',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('mouseout', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      }, this);
-    this._map.on('mousedown',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('mousedown', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      },this);
-    this._map.on('mouseup',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('mouseup', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      }, this);
-    this._map.on('contextmenu',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('contextmenu', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      }, this);
-    this._map.on('movestart',
-      function () {
-        this._updateMapCenter();
-        this.dispatchEvent(new CustomEvent('movestart', {detail:
-          {target: this}}));
-      }, this);
-    this._map.on('move',
-      function () {
-        this._updateMapCenter();
-        this.dispatchEvent(new CustomEvent('move', {detail:
-          {target: this}}));
-      }, this);
-    this._map.on('moveend',
-      function () {
-        this._updateMapCenter();
-        this._addToHistory();
-        this.dispatchEvent(new CustomEvent('moveend', {detail:
-          {target: this}}));
-      }, this);
-    this._map.on('zoomstart',
-      function () {
-        this._updateMapCenter();
-        this.dispatchEvent(new CustomEvent('zoomstart', {detail:
-          {target: this}}));
-      }, this);
-    this._map.on('zoom',
-      function () {
-        this._updateMapCenter();
-        this.dispatchEvent(new CustomEvent('zoom', {detail:
-          {target: this}}));
-      }, this);
-    this._map.on('zoomend',
-      function () {
-        this._updateMapCenter();
-        this.dispatchEvent(new CustomEvent('zoomend', {detail:
-          {target: this}}));
-      }, this);
-  }
-  _toggleControls() {
-    if (this._map) {
-      this.setControls(true, this._toggleState, false);
-      this._toggleState = !this._toggleState;
-    }
-  }
-
-  toggleDebug(){
-    if(this._debug){
-      this._debug.remove();
-      this._debug = undefined;
-    } else {
-      this._debug = M.debugOverlay().addTo(this._map);
-    }
-  }
-  
-  _widthChanged(width) {
-    this.style.width = width+"px";
-    this._container.style.width = width+"px";
-    if (this._map) {
-        this._map.invalidateSize(false);
-    }
-  }
-  _heightChanged(height) {
-    this.style.height = height+"px";
-    this._container.style.height = height+"px";
-    if (this._map) {
-        this._map.invalidateSize(false);
-    }
-  }
-  zoomTo(lat, lon, zoom) {
-    zoom = Number.isInteger(+zoom) ? +zoom : this.zoom;
-    let location = new L.LatLng(+lat, +lon);
-    this._map.setView(location, zoom);
-    this.zoom = zoom;
-    this.lat = location.lat;
-    this.lon = location.lng;
-  }
-  _updateMapCenter() {
-    // remember to tell Leaflet event handler that 'this' in here refers to
-    //  something other than the map in this case the custom polymer element
-    this.lat = this._map.getCenter().lat;
-    this.lon = this._map.getCenter().lng;
-    this.zoom = this._map.getZoom();
-  }
-
-  /**
-   * Adds to the maps history on moveends
-   * @private
-   */
-  _addToHistory(){
-    if(this._traversalCall > 0) { // this._traversalCall tracks how many consecutive moveends to ignore from history
-      this._traversalCall--;      // this is useful for ignoring moveends corresponding to back, forward and reload
-      return;
-    }
-
-    let mapLocation = this._map.getPixelBounds().getCenter();
-    let location = {
-      zoom: this._map.getZoom(),
-      x:mapLocation.x,
-      y:mapLocation.y,
-    };
-    this._historyIndex++;
-    this._history.splice(this._historyIndex, 0, location);
-  }
-
-  /**
-   * Allow user to move back in history
-   */
-  back(){
-    let history = this._history;
-    let curr = history[this._historyIndex];
-
-    if(this._historyIndex > 0){
-      this._historyIndex--;
-      let prev = history[this._historyIndex];
-
-      if(prev.zoom !== curr.zoom){
-        this._traversalCall = 2;  // allows the next 2 moveends to be ignored from history
-
-        let currScale = this._map.options.crs.scale(curr.zoom); // gets the scale of the current zoom level
-        let prevScale = this._map.options.crs.scale(prev.zoom); // gets the scale of the previous zoom level
-
-        let scale = currScale / prevScale; // used to convert the previous pixel location to be in terms of the current zoom level
-
-        this._map.panBy([((prev.x * scale) - curr.x), ((prev.y * scale) - curr.y)], {animate: false});
-        this._map.setZoom(prev.zoom);
-      } else {
-        this._traversalCall = 1;
-        this._map.panBy([(prev.x - curr.x), (prev.y - curr.y)]);
-      }
-    }
-  }
-
-  /**
-   * Allows user to move forward in history
-   */
-  forward(){
-    let history = this._history;
-    let curr = history[this._historyIndex];
-    if(this._historyIndex < history.length - 1){
-      this._historyIndex++;
-      let next = history[this._historyIndex];
-
-      if(next.zoom !== curr.zoom){
-        this._traversalCall = 2; // allows the next 2 moveends to be ignored from history
-
-        let currScale = this._map.options.crs.scale(curr.zoom); // gets the scale of the current zoom level
-        let nextScale = this._map.options.crs.scale(next.zoom); // gets the scale of the next zoom level
-
-        let scale = currScale / nextScale; // used to convert the next pixel location to be in terms of the current zoom level
-
-        this._map.panBy([((next.x * scale) - curr.x), ((next.y * scale) - curr.y)], {animate: false});
-        this._map.setZoom(next.zoom);
-      } else {
-        this._traversalCall = 1;
-        this._map.panBy([(next.x - curr.x), (next.y - curr.y)]);
-      }
-    }
-  }
-
-  /**
-   * Allows the user to reload/reset the map's location to it's initial location
-   */
-  reload(){
-    let initialLocation = this._history.shift();
-    let mapLocation = this._map.getPixelBounds().getCenter();
-    let curr = {
-      zoom: this._map.getZoom(),
-      x:mapLocation.x,
-      y:mapLocation.y,
-    };
-
-    this._history = [initialLocation];
-    this._historyIndex = 0;
-
-    if(initialLocation.zoom !== curr.zoom) {
-      this._traversalCall = 2; // ignores the next 2 moveend events
-
-      let currScale = this._map.options.crs.scale(curr.zoom); // gets the scale of the current zoom level
-      let initScale = this._map.options.crs.scale(initialLocation.zoom); // gets the scale of the initial location's zoom
-
-      let scale = currScale / initScale;
-
-      this._map.panBy([((initialLocation.x * scale) - curr.x), ((initialLocation.y * scale) - curr.y)], {animate: false});
-      this._map.setZoom(initialLocation.zoom);
-    } else { // if it's on the same zoom level as the initial location, no need to calculate scales
-      this._traversalCall = 1;
-      this._map.panBy([(initialLocation.x- curr.x), (initialLocation.y - curr.y)]);
-    }
-  }
-
-  viewSource(){
-    let blob = new Blob([this._source],{type:"text/plain"}),
-        url = URL.createObjectURL(blob);
-    window.open(url);
-    URL.revokeObjectURL(url);
-  }
-
-  defineCustomProjection(jsonTemplate) {
-    let t = JSON.parse(jsonTemplate);
-    if (t === undefined || !t.proj4string || !t.projection || !t.resolutions || !t.origin || !t.bounds) throw new Error('Incomplete TCRS Definition');
-    if (t.projection.indexOf(":") >= 0) throw new Error('":" is not permitted in projection name');
-    if (M[t.projection.toUpperCase()]) return t.projection.toUpperCase();
-    let tileSize = [256, 512, 1024, 2048, 4096].includes(t.tilesize)?t.tilesize:256;
-
-    M[t.projection] = new L.Proj.CRS(t.projection, t.proj4string, {
-      origin: t.origin,
-      resolutions: t.resolutions,
-      bounds: L.bounds(t.bounds),
-      crs: {
-        tcrs: {
-          horizontal: {
-            name: "x",
-            min: 0, 
-            max: zoom => (M[t.projection].options.bounds.getSize().x / M[t.projection].options.resolutions[zoom]).toFixed()
-          },
-          vertical: {
-            name: "y",
-            min:0, 
-            max: zoom => (M[t.projection].options.bounds.getSize().y / M[t.projection].options.resolutions[zoom]).toFixed()
-          },
-          bounds: zoom => L.bounds([M[t.projection].options.crs.tcrs.horizontal.min,
-            M[t.projection].options.crs.tcrs.vertical.min],
-            [M[t.projection].options.crs.tcrs.horizontal.max(zoom),
-            M[t.projection].options.crs.tcrs.vertical.max(zoom)])
-        },
-        pcrs: {
-          horizontal: {
-            name: "easting",
-            get min() {return M[t.projection].options.bounds.min.x;},
-            get max() {return M[t.projection].options.bounds.max.x;}
-          }, 
-          vertical: {
-            name: "northing", 
-            get min() {return M[t.projection].options.bounds.min.y;},
-            get max() {return M[t.projection].options.bounds.max.y;}
-          },
-          get bounds() {return M[t.projection].options.bounds;}
-        }, 
-        gcrs: {
-          horizontal: {
-            name: "longitude",
-            // set min/max axis values from EPSG registry area of use, retrieved 2019-07-25
-            get min() {return M[t.projection].unproject(M.OSMTILE.options.bounds.min).lng;},
-            get max() {return M[t.projection].unproject(M.OSMTILE.options.bounds.max).lng;}
-          }, 
-          vertical: {
-            name: "latitude",
-            // set min/max axis values from EPSG registry area of use, retrieved 2019-07-25
-            get min() {return M[t.projection].unproject(M.OSMTILE.options.bounds.min).lat;},
-            get max() {return M[t.projection].unproject(M.OSMTILE.options.bounds.max).lat;}
-          },
-          get bounds() {return L.latLngBounds(
-                [M[t.projection].options.crs.gcrs.vertical.min,M[t.projection].options.crs.gcrs.horizontal.min],
-                [M[t.projection].options.crs.gcrs.vertical.max,M[t.projection].options.crs.gcrs.horizontal.max]);}
-        },
-        map: {
-          horizontal: {
-            name: "i",
-            min: 0,
-            max: map => map.getSize().x
-          },
-          vertical: {
-            name: "j",
-            min: 0,
-            max: map => map.getSize().y
-          },
-          bounds: map => L.bounds(L.point([0,0]),map.getSize())
-        },
-        tile: {
-          horizontal: {
-            name: "i",
-            min: 0,
-            max: tileSize,
-          },
-          vertical: {
-            name: "j",
-            min: 0,
-            max: tileSize,
-          },
-          get bounds() {return L.bounds(
-                    [M[t.projection].options.crs.tile.horizontal.min,M[t.projection].options.crs.tile.vertical.min],
-                    [M[t.projection].options.crs.tile.horizontal.max,M[t.projection].options.crs.tile.vertical.max]);}
-        },
-        tilematrix: {
-          horizontal: {
-            name: "column",
-            min: 0,
-            max: zoom => (M[t.projection].options.crs.tcrs.horizontal.max(zoom) / M[t.projection].options.crs.tile.bounds.getSize().x).toFixed()
-          },
-          vertical: {
-            name: "row",
-            min: 0,
-            max: zoom => (M[t.projection].options.crs.tcrs.vertical.max(zoom) / M[t.projection].options.crs.tile.bounds.getSize().y).toFixed()
-          },
-          bounds: zoom => L.bounds(
-                   [M[t.projection].options.crs.tilematrix.horizontal.min,
-                   M[t.projection].options.crs.tilematrix.vertical.min],
-                   [M[t.projection].options.crs.tilematrix.horizontal.max(zoom),
-                   M[t.projection].options.crs.tilematrix.vertical.max(zoom)])
-        }
-      },
-    });      //creates crs using L.Proj
-    M[t.projection.toUpperCase()] = M[t.projection]; //adds the projection uppercase to global M
-    return t.projection;
-  }
-}
-// need to provide options { extends: ... }  for custom built-in elements
-window.customElements.define('mapml-viewer', MapViewer);
-window.customElements.define('layer-', MapLayer);
diff --git a/screenreader/feature-index/dist/mapml.css b/screenreader/feature-index/dist/mapml.css
deleted file mode 100644
index bea3da6..0000000
--- a/screenreader/feature-index/dist/mapml.css
+++ /dev/null
@@ -1,5 +0,0 @@
-.leaflet-image-layer,.leaflet-layer,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-pane,.leaflet-pane>canvas,.leaflet-pane>svg,.leaflet-tile,.leaflet-tile-container,.leaflet-zoom-box{position:absolute;left:0;top:0}.leaflet-container{overflow:hidden}.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile{-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-user-drag:none}.leaflet-tile::selection{background:0 0}.leaflet-safari .leaflet-tile{image-rendering:-webkit-optimize-contrast}.leaflet-safari .leaflet-tile-container{width:1600px;height:1600px;-webkit-transform-origin:0 0}.leaflet-marker-icon,.leaflet-marker-shadow{display:block}.leaflet-container .leaflet-marker-pane img,.leaflet-container .leaflet-overlay-pane svg,.leaflet-container .leaflet-shadow-pane img,.leaflet-container .leaflet-tile,.leaflet-container .leaflet-tile-pane img,.leaflet-container img.leaflet-image-layer{max-width:none!important;max-height:none!important}.leaflet-container.leaflet-touch-zoom{-ms-touch-action:pan-x pan-y;touch-action:pan-x pan-y}.leaflet-container.leaflet-touch-drag{-ms-touch-action:pinch-zoom;touch-action:none;touch-action:pinch-zoom}.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom{-ms-touch-action:none;touch-action:none}.leaflet-container{-webkit-tap-highlight-color:transparent}.leaflet-container a{-webkit-tap-highlight-color:rgba(51,181,229,0.4)}.leaflet-tile{filter:inherit;visibility:hidden}.leaflet-tile-loaded{visibility:inherit}.leaflet-zoom-box{width:0;height:0;-moz-box-sizing:border-box;box-sizing:border-box;z-index:800}.leaflet-overlay-pane svg{-moz-user-select:none}.leaflet-pane{z-index:400}.leaflet-tile-pane{z-index:200}.leaflet-overlay-pane{z-index:400}.leaflet-shadow-pane{z-index:500}.leaflet-marker-pane{z-index:600}.leaflet-tooltip-pane{z-index:650}.leaflet-popup-pane{z-index:700}.leaflet-map-pane canvas{z-index:100}.leaflet-map-pane svg{z-index:200}.leaflet-vml-shape{width:1px;height:1px}.lvml{behavior:url(#default#VML);display:inline-block;position:absolute}.leaflet-control{position:relative;z-index:800;pointer-events:visiblePainted;pointer-events:auto}.leaflet-bottom,.leaflet-top{position:absolute;z-index:1000;pointer-events:none}.leaflet-top{top:0}.leaflet-right{right:0}.leaflet-bottom{bottom:0}.leaflet-left{left:0}.leaflet-control{float:left;clear:both}.leaflet-right .leaflet-control{float:right}.leaflet-top .leaflet-control{margin-top:10px}.leaflet-bottom .leaflet-control{margin-bottom:10px}.leaflet-left .leaflet-control{margin-left:10px}.leaflet-right .leaflet-control{margin-right:10px}.leaflet-fade-anim .leaflet-tile{will-change:opacity}.leaflet-fade-anim .leaflet-popup{opacity:0;-webkit-transition:opacity .2s linear;-moz-transition:opacity .2s linear;transition:opacity .2s linear}.leaflet-fade-anim .leaflet-map-pane .leaflet-popup{opacity:1}.leaflet-zoom-animated{-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0}.leaflet-zoom-anim .leaflet-zoom-animated{will-change:transform}.leaflet-zoom-anim .leaflet-zoom-animated{-webkit-transition:-webkit-transform .25s cubic-bezier(0,0,.25,1);-moz-transition:-moz-transform .25s cubic-bezier(0,0,.25,1);transition:transform .25s cubic-bezier(0,0,.25,1)}.leaflet-pan-anim .leaflet-tile,.leaflet-zoom-anim .leaflet-tile{-webkit-transition:none;-moz-transition:none;transition:none}.leaflet-zoom-anim .leaflet-zoom-hide{visibility:hidden}.leaflet-interactive{cursor:pointer}.leaflet-grab{cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.leaflet-crosshair,.leaflet-crosshair .leaflet-interactive{cursor:crosshair}.leaflet-control,.leaflet-popup-pane{cursor:auto}.leaflet-dragging .leaflet-grab,.leaflet-dragging .leaflet-grab .leaflet-interactive,.leaflet-dragging .leaflet-marker-draggable{cursor:move;cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.leaflet-image-layer,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-pane>svg path,.leaflet-tile-container{pointer-events:none}.leaflet-image-layer.leaflet-interactive,.leaflet-marker-icon.leaflet-interactive,.leaflet-pane>svg path.leaflet-interactive,svg.leaflet-image-layer.leaflet-interactive path{pointer-events:visiblePainted;pointer-events:auto}.leaflet-container{background:#ddd;outline:0}.leaflet-container a{color:#0078a8}.leaflet-container a.leaflet-active{outline:2px solid orange}.leaflet-zoom-box{border:2px dotted #38f;background:rgba(255,255,255,.5)}.leaflet-container{font:12px/1.5 "Helvetica Neue",Arial,Helvetica,sans-serif}.leaflet-bar{box-shadow:0 1px 5px rgba(0,0,0,.65);border-radius:4px}.leaflet-bar a,.leaflet-bar a:hover{background-color:#fff;border-bottom:1px solid #ccc;width:26px;height:26px;line-height:26px;display:block;text-align:center;text-decoration:none;color:#000}.leaflet-bar a,.leaflet-control-layers-toggle{background-position:50% 50%;background-repeat:no-repeat;display:block}.leaflet-bar a:hover{background-color:#f4f4f4}.leaflet-bar a:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.leaflet-bar a:last-child{border-bottom-left-radius:4px;border-bottom-right-radius:4px;border-bottom:none}.leaflet-bar a.leaflet-disabled{cursor:default;background-color:#f4f4f4;color:#bbb}.leaflet-touch .leaflet-bar a{width:30px;height:30px;line-height:30px}.leaflet-touch .leaflet-bar a:first-child{border-top-left-radius:2px;border-top-right-radius:2px}.leaflet-touch .leaflet-bar a:last-child{border-bottom-left-radius:2px;border-bottom-right-radius:2px}.leaflet-control-zoom-in,.leaflet-control-zoom-out{font:bold 18px 'Lucida Console',Monaco,monospace;text-indent:1px}.leaflet-touch .leaflet-control-zoom-in,.leaflet-touch .leaflet-control-zoom-out{font-size:22px}.leaflet-control-layers{box-shadow:0 1px 5px rgba(0,0,0,.4);background:#fff;border-radius:5px}.leaflet-control-layers-toggle{background-image:url(images/layers.png);width:36px;height:36px}.leaflet-retina .leaflet-control-layers-toggle{background-image:url(images/layers-2x.png);background-size:26px 26px}.leaflet-touch .leaflet-control-layers-toggle{width:44px;height:44px}.leaflet-control-layers .leaflet-control-layers-list,.leaflet-control-layers-expanded .leaflet-control-layers-toggle{display:none}.leaflet-control-layers-expanded .leaflet-control-layers-list{display:block;position:relative}.leaflet-control-layers-expanded{padding:6px 10px 6px 6px;color:#333;background:#fff}.leaflet-control-layers-scrollbar{overflow-y:scroll;overflow-x:hidden;padding-right:5px}.leaflet-control-layers-selector{margin-top:2px;position:relative;top:1px}.leaflet-control-layers label{display:block}.leaflet-control-layers-separator{height:0;border-top:1px solid #ddd;margin:5px -10px 5px -6px}.leaflet-default-icon-path{background-image:url(images/marker-icon.png)}.leaflet-container .leaflet-control-attribution{background:#fff;background:rgba(255,255,255,.7);margin:0}.leaflet-control-attribution,.leaflet-control-scale-line{padding:0 5px;color:#333}.leaflet-control-attribution a{text-decoration:none}.leaflet-control-attribution a:hover{text-decoration:underline}.leaflet-container .leaflet-control-attribution,.leaflet-container .leaflet-control-scale{font-size:11px}.leaflet-left .leaflet-control-scale{margin-left:5px}.leaflet-bottom .leaflet-control-scale{margin-bottom:5px}.leaflet-control-scale-line{border:2px solid #777;border-top:none;line-height:1.1;padding:2px 5px 1px;font-size:11px;white-space:nowrap;overflow:hidden;-moz-box-sizing:border-box;box-sizing:border-box;background:#fff;background:rgba(255,255,255,.5)}.leaflet-control-scale-line:not(:first-child){border-top:2px solid #777;border-bottom:none;margin-top:-2px}.leaflet-control-scale-line:not(:first-child):not(:last-child){border-bottom:2px solid #777}.leaflet-touch .leaflet-bar,.leaflet-touch .leaflet-control-attribution,.leaflet-touch .leaflet-control-layers{box-shadow:none}.leaflet-touch .leaflet-bar,.leaflet-touch .leaflet-control-layers{border:2px solid rgba(0,0,0,.2);background-clip:padding-box}.leaflet-popup{position:absolute;text-align:center;margin-bottom:20px}.leaflet-popup-content-wrapper{padding:1px;text-align:left;border-radius:12px}.leaflet-popup-content{margin:13px 19px;line-height:1.4}.leaflet-popup-content p{margin:18px 0}.leaflet-popup-tip-container{width:40px;height:20px;position:absolute;left:50%;margin-left:-20px;overflow:hidden;pointer-events:none}.leaflet-popup-tip{width:17px;height:17px;padding:1px;margin:-10px auto 0;-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.leaflet-popup-content-wrapper,.leaflet-popup-tip{background:#fff;color:#333;box-shadow:0 3px 14px rgba(0,0,0,.4)}.leaflet-container a.leaflet-popup-close-button{position:absolute;top:0;right:0;padding:4px 4px 0 0;border:none;text-align:center;width:18px;height:14px;font:16px/14px Tahoma,Verdana,sans-serif;color:#c3c3c3;text-decoration:none;font-weight:700;background:0 0}.leaflet-container a.leaflet-popup-close-button:hover{color:#999}.leaflet-popup-scrolled{overflow:auto;border-bottom:1px solid #ddd;border-top:1px solid #ddd}.leaflet-oldie .leaflet-popup-content-wrapper{-ms-zoom:1}.leaflet-oldie .leaflet-popup-tip{width:24px;margin:0 auto}.leaflet-oldie .leaflet-popup-tip-container{margin-top:-1px}.leaflet-oldie .leaflet-control-layers,.leaflet-oldie .leaflet-control-zoom,.leaflet-oldie .leaflet-popup-content-wrapper,.leaflet-oldie .leaflet-popup-tip{border:1px solid #999}.leaflet-div-icon{background:#fff;border:1px solid #666}.leaflet-tooltip{position:absolute;padding:6px;background-color:#fff;border:1px solid #fff;border-radius:3px;color:#222;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;box-shadow:0 1px 3px rgba(0,0,0,.4)}.leaflet-tooltip.leaflet-clickable{cursor:pointer;pointer-events:auto}.leaflet-tooltip-bottom:before,.leaflet-tooltip-left:before,.leaflet-tooltip-right:before,.leaflet-tooltip-top:before{position:absolute;pointer-events:none;border:6px solid transparent;background:0 0;content:""}.leaflet-tooltip-bottom{margin-top:6px}.leaflet-tooltip-top{margin-top:-6px}.leaflet-tooltip-bottom:before,.leaflet-tooltip-top:before{left:50%;margin-left:-6px}.leaflet-tooltip-top:before{bottom:0;margin-bottom:-12px;border-top-color:#fff}.leaflet-tooltip-bottom:before{top:0;margin-top:-12px;margin-left:-6px;border-bottom-color:#fff}.leaflet-tooltip-left{margin-left:-6px}.leaflet-tooltip-right{margin-left:6px}.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{top:50%;margin-top:-6px}.leaflet-tooltip-left:before{right:0;margin-right:-12px;border-left-color:#fff}.leaflet-tooltip-right:before{left:0;margin-left:-12px;border-right-color:#fff}.leaflet-container{background-color:transparent;max-height:100%;max-width:100%;min-height:100%;min-width:100%;width:100%!important;height:100%!important}.leaflet-tile img{position:absolute;left:0;top:0}.leaflet-fade-anim .leaflet-image-layer{will-change:opacity}.leaflet-image-layer{visibility:hidden}.leaflet-image-loaded{visibility:inherit}.leaflet-container .leaflet-control-attribution,.leaflet-container .leaflet-control-scale,.leaflet-control-scale-line{font-size:12px}.mapml-button{background-color:transparent;border:none;border-radius:0;color:inherit;font:inherit;line-height:inherit;margin:0;padding:0;overflow:hidden;text-align:inherit;text-transform:none;-webkit-appearance:none;-moz-appearance:none;appearance:none}.leaflet-container a{color:revert}.leaflet-container a.leaflet-popup-close-button,.leaflet-container a.leaflet-popup-close-button:hover,.leaflet-control-container a,.mapml-reload-button{color:#000}.mapml-layer-item-name a{color:revert}.leaflet-top .leaflet-control{margin-top:5px}.leaflet-left .leaflet-control{margin-left:5px}.leaflet-bar a,.mapml-reload-button{background-color:#fff;box-sizing:border-box;width:44px!important;height:44px!important;line-height:44px!important;font-size:34px!important;font-weight:400;text-align:center}.mapml-reload-button:not([aria-disabled=true]):hover{background-color:#f4f4f4}.mapml-reload-button[aria-disabled=true]{color:#bbb;cursor:default}.leaflet-control-layers-toggle{width:44px!important;height:44px!important}.leaflet-bar a,.leaflet-control-layers,.mapml-reload-button{border-color:#e3e3e3!important}.leaflet-control-layers,.mapml-reload-button{border-radius:4px!important}.leaflet-touch .leaflet-bar a:last-child{border-bottom-left-radius:4px!important;border-bottom-right-radius:4px!important}.leaflet-touch .leaflet-bar a:first-child{border-top-left-radius:4px!important;border-top-right-radius:4px!important}.leaflet-touch .leaflet-bar,.leaflet-touch .leaflet-control-layers{border-style:inherit}.leaflet-bar,.leaflet-control-layers,.leaflet-popup-content-wrapper,.leaflet-popup-tip,.leaflet-tooltip-pane .leaflet-tooltip,.leaflet-touch .leaflet-bar,.leaflet-touch .leaflet-control-layers,.mapml-contextmenu,.mapml-debug{box-shadow:0 1px 3px rgba(0,0,0,.2),0 1px 2px rgb(0,0,0,.3)}.leaflet-container .leaflet-control-attribution{background-color:rgba(255,255,255,.95)}.leaflet-control-attribution a{color:revert;text-decoration:revert}.leaflet-control-zoom-in,.leaflet-control-zoom-out{text-indent:unset}.leaflet-control-fullscreen a{background-image:url("data:image/svg+xml,%0A%3Csvg width='26' height='52' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg transform='translate(0 -1000.4)'%3E%3Cuse transform='translate(0 26)' width='100%25' height='100%25' xlink:href='%23a'/%3E%3Cuse transform='translate(0 26)' width='100%25' height='100%25' xlink:href='%23b'/%3E%3Cuse transform='translate(0 26)' width='100%25' height='100%25' xlink:href='%23c'/%3E%3Cuse transform='translate(0 26)' width='100%25' height='100%25' xlink:href='%23d'/%3E%3Cpath id='a' transform='translate(0 1000.4)' d='M5 15v6h6v-2H7v-4z' color='%23000' fill='%23404040'/%3E%3Cpath id='b' transform='translate(0 1000.4)' d='M21 15v6h-6v-2h4v-4z' color='%23000' fill='%23404040'/%3E%3Cpath d='M10 1037.4v4l1 1h4l1-1v-4l-1-1h-4z' color='%23000' fill='%23404040'/%3E%3Cpath id='d' d='M5 1011.4v-6h6v2H7v4z' color='%23000' fill='%23404040'/%3E%3Cpath id='c' d='M21 1011.4v-6h-6v2h4v4z' color='%23000' fill='%23404040'/%3E%3C/g%3E%3C/svg%3E");background-repeat:no-repeat;background-size:38px 76px;background-position:3px 3px}:host(.mapml-fullscreen-on) .leaflet-control-fullscreen a{background-position:3px -35px}:host(:-webkit-full-screen){width:100%!important;height:100%!important}:host(.mapml-fullscreen-on){width:100%!important;height:100%!important}:host(.leaflet-pseudo-fullscreen){position:fixed!important;width:100%!important;height:100%!important;top:0!important;left:0!important;z-index:99999}.leaflet-control-layers.leaflet-control{margin-right:5px;margin-left:5px;padding:0}.leaflet-control-layers-list{padding:0;text-transform:capitalize}.leaflet-control-layers fieldset{margin:0;padding:0;min-height:44px}.leaflet-control-layers label{display:inline}.mapml-control-layers>:not(summary){display:block;margin-block-start:5px;margin-inline-start:15px;width:calc(100% - 15px)}.mapml-layer-item-style>div{display:flex}.mapml-layer-item-style input{margin-inline-start:0}.leaflet-control .leaflet-control-layers-toggle{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M0 0h24v24H0V0z' fill='none'/%3E%3Cpath d='m11.99 18.54-7.37-5.73L3 14.07l9 7 9-7-1.63-1.27zM12 16l7.36-5.73L21 9l-9-7-9 7 1.63 1.27L12 16zm0-11.47L17.74 9 12 13.47 6.26 9 12 4.53z'/%3E%3C/svg%3E");background-size:34px}.leaflet-control-layers-selector{margin-top:revert;position:revert}.mapml-contextmenu{border-radius:4px;padding:4px 0;background-color:#fff;cursor:default;position:absolute;width:160px;z-index:10001}.mapml-contextmenu button.mapml-contextmenu-item{color:#222;font-size:12px;line-height:20px;text-decoration:none;padding:0 12px;border-top:1px solid transparent;border-bottom:1px solid transparent;cursor:default;width:100%}.mapml-contextmenu button.mapml-contextmenu-item.over{background-color:#f4f4f4;border-top:1px solid #f0f0f0;border-bottom:1px solid #f0f0f0}.mapml-contextmenu-separator{border-bottom:1px solid #e3e3e3;margin:5px 0}.mapml-contextmenu.mapml-submenu{width:80px;margin-bottom:-2rem}@supports (contain:layout){.mapml-contextmenu{position:fixed}.mapml-contextmenu.mapml-submenu{position:absolute}}.mapml-contextmenu-item[aria-controls] span::after{content:">"}@supports (list-style-type:disclosure-open){.mapml-contextmenu-item[aria-controls] span{display:inline-block}.mapml-contextmenu-item[aria-controls] span::after{content:"";display:list-item;list-style-type:disclosure-closed;margin-inline-start:20px}}.mapml-debug{contain:content;max-height:100%;max-width:100%;border-radius:4px;padding:5px 10px;background-color:#fff;cursor:default;z-index:1000;position:absolute;display:block;top:auto;right:5px;bottom:5px;left:5px;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;font:inherit}.mapml-debug-banner{font-weight:700;text-transform:uppercase;display:inline-block;text-align:left;text-align:inline-start;line-height:2}.mapml-debug-grid,.mapml-debug-panel{font-family:monospace}.mapml-debug-tile{text-indent:6px;line-height:1.8}.mapml-debug-coordinates{padding-left:4px;padding-right:4px}.mapml-debug,.mapml-debug *{border-collapse:collapse;border-spacing:0}.mapml-debug-coordinates:empty{display:none}.mapml-debug-coordinates>*{display:inline}:host(.mapml-fullscreen-on) .mapml-debug-grid{color:#fff;text-shadow:1px 1px 1px #000,1px 1px 1px #000}:host(.leaflet-drag-target) .leaflet-grab{cursor:move;cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}:host(.leaflet-drag-target) .leaflet-control{pointer-events:none}.leaflet-control :not([draggable=true]),.leaflet-popup-close-button,.mapml-contextmenu :not([draggable=true]),.mapml-popup-button{-webkit-user-drag:none}.leaflet-control,.mapml-contextmenu,.mapml-debug,.mapml-focus-buttons,.mapml-layer-item-settings summary{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.leaflet-control a::selection,.leaflet-control-attribution::selection,.leaflet-popup-close-button::selection{background-color:transparent}.leaflet-crosshair *,.leaflet-tooltip,.mapml-contextmenu-item>*,.mapml-layer-item-settings .mapml-control-layers summary label,.mapml-link-preview{pointer-events:none!important}.leaflet-container :focus{outline-color:-webkit-focus-ring-color!important;outline-style:auto!important;outline-width:thin!important;outline:revert!important}.leaflet-active:not(:focus){outline:unset!important}.leaflet-container:not(:focus-within) .mapml-outline{outline:0}.leaflet-container:not(:focus-within) .mapml-crosshair{display:none}.leaflet-control a{-webkit-tap-highlight-color:initial}.leaflet-zoom-box{border:thin dotted;background-color:rgba(255,255,255,.33)}button,input,label,summary{cursor:pointer}.mapml-draggable,.mapml-draggable *{cursor:row-resize}.leaflet-crosshair{cursor:crosshair}[hidden]{display:none!important}.leaflet-container .leaflet-control-container,.leaflet-container .mapml-contextmenu{visibility:unset!important}.mapml-crosshair{margin:-36px 0 0 -36px;width:72px;height:72px;left:50%;top:50%;position:absolute;z-index:10000}.mapml-popup-button{padding:0 4px 0 4px;border:none;text-align:center;font:16px/14px Tahoma,Verdana,sans-serif;color:inherit;text-decoration:none;font-weight:700;background:0 0;white-space:nowrap;box-sizing:border-box;width:44px;height:44px;line-height:44px}.mapml-focus-buttons{white-space:nowrap}.mapml-feature-count{display:inline;white-space:nowrap;text-align:center;padding:2px}.leaflet-container a.leaflet-popup-close-button,.mapml-focus-buttons button{width:44px;height:44px;min-width:44px;min-height:44px;line-height:44px}.leaflet-popup-content{margin:0;min-width:min-content}.mapml-popup-content{padding-top:44px}.mapml-focus-buttons{display:block;text-align:center}.mapml-focus-buttons button{display:inline-block;padding:0}.leaflet-container a.leaflet-popup-close-button{padding:0;font-size:20px}.leaflet-popup-content .mapml-feature-count{margin:0;padding:0 5px;line-height:44px}.mapml-popup-content hr:last-of-type{margin-bottom:0;border-bottom:0;border-top:1px solid #e3e3e3}.mapml-popup-content :first-child{margin-top:0;padding-top:0}.mapml-popup-content>:not(.mapml-focus-buttons){padding:0 1rem}.leaflet-popup-tip-container{margin-top:-1px}.mapml-outline{outline-style:auto;outline-offset:-2px;z-index:1000;pointer-events:none;position:absolute;height:100%;width:100%;color:initial}@media print{.leaflet-control{-webkit-print-color-adjust:exact;color-adjust:exact}}.leaflet-pane>svg g.leaflet-interactive,svg.leaflet-image-layer.leaflet-interactive g{pointer-events:visiblePainted;pointer-events:auto}.mapml-link-preview{position:absolute;left:0;bottom:0;background-color:#dee1e6;border-radius:0 5px 0 0;z-index:1050}.mapml-link-preview>p{margin:3px 5px 2px 3px;color:#3c4043}.mapml-button[aria-disabled=true],.mapml-layer-item:disabled button.mapml-button,button.mapml-button:disabled{opacity:.3}.mapml-button-icon{pointer-events:none}.mapml-button-icon svg{fill:currentColor}.mapml-layer-item,.mapml-layer-item *{box-sizing:border-box}.mapml-layer-item{background-color:#fff;border:1px solid #fff;margin:0;padding:0}.mapml-layer-item:not(:last-of-type){border-bottom:1px solid #e3e3e3}.mapml-layer-item[aria-grabbed=true]{border:1px solid #e3e3e3;border-radius:0}.mapml-layer-item:first-of-type{border-top-left-radius:4px;border-top-right-radius:4px}.mapml-layer-item:last-of-type{border-bottom-left-radius:4px;border-bottom-right-radius:4px}.mapml-layer-item-properties{align-items:center;display:flex;justify-content:space-between;padding-inline-start:.5rem}.mapml-layer-item-controls{margin-inline-start:auto}.mapml-layer-item-controls button span{font-size:large;font-weight:900;vertical-align:middle}.mapml-layer-item-controls button svg{vertical-align:text-bottom}.mapml-layer-item-controls,.mapml-layer-item-remove-control,.mapml-layer-item-settings-control{align-items:center;display:flex;justify-content:center}.mapml-layer-item-remove-control,.mapml-layer-item-settings-control{min-height:44px;min-width:44px;height:44px;width:44px}label.mapml-layer-item-toggle{display:inline-flex;align-items:center;width:100%;min-height:44px}.mapml-layer-item-name{word-break:break-word;padding-block-start:.25rem;padding-block-end:.25rem;padding-inline-start:.25rem;padding-inline-end:1rem}.mapml-layer-item-settings>*{display:block;padding-block-start:.25rem;padding-block-end:.25rem;padding-inline-start:2rem;padding-inline-end:1rem}.mapml-screen-reader-output{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}.mapml-vector-container svg :is(
-[role=link]:focus,[role=link]:hover,[role=link]:focus path,[role=link]:hover path,[role=link] path:focus,[role=link] path:hover,[role=button]:focus,[role=button]:hover,[role=button]:focus path,[role=button]:hover path,[role=button] path:focus,[role=button] path:hover,path[tabindex="0"]:focus
-){stroke:#0000EE;stroke:LinkText}.mapml-vector-container svg :is(
-[role=link]:focus:not(:focus-visible),[role=link]:focus:not(:focus-visible) path,[role=link] path:focus:not(:focus-visible),[role=button]:focus:not(:focus-visible),[role=button]:focus:not(:focus-visible) path,[role=button] path:focus:not(:focus-visible),path[tabindex="0"]:focus:not(:focus-visible)
-){outline:0!important}.mapml-feature-index-box{margin:-36px 0 0 -36px;width:72px;height:72px;left:50%;top:50%;content:'';display:block;position:absolute;z-index:10000}.mapml-feature-index{contain:content;max-height:100%;max-width:100%;border-radius:4px;background-color:#fff;cursor:default;z-index:1000;position:absolute;display:block;top:auto;right:5px;bottom:5px;left:5px;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;font:inherit}.mapml-feature-index-more-content{display:inline-block}.mapml-feature-index-more-content>span{padding:5px 10px 5px 0;display:inline-block}.mapml-feature-index-content{padding:5px 10px;display:inline-block}.mapml-feature-index-content>span,.mapml-feature-index-more-content>span>span{display:block;font-family:monospace}.mapml-feature-index-header{font-weight:700;text-transform:uppercase;display:inline-block;text-align:left;text-align:inline-start;line-height:2}
\ No newline at end of file
diff --git a/screenreader/feature-index/dist/mapml.js b/screenreader/feature-index/dist/mapml.js
deleted file mode 100644
index 538c3fd..0000000
--- a/screenreader/feature-index/dist/mapml.js
+++ /dev/null
@@ -1,6742 +0,0 @@
-(function () {
-  'use strict';
-
-  var MapMLStaticTileLayer = L.GridLayer.extend({
-
-    initialize: function (options) {
-      this.zoomBounds = this._getZoomBounds(options.tileContainer,options.maxZoomBound);
-      L.extend(options, this.zoomBounds);
-      L.setOptions(this, options);
-      this._groups = this._groupTiles(this.options.tileContainer.getElementsByTagName('map-tile'));
-    },
-
-    onAdd: function(){
-      this._bounds = this._getLayerBounds(this._groups,this._map.options.projection); //stores meter values of bounds
-      this.layerBounds = this._bounds[Object.keys(this._bounds)[0]];
-      for(let key of Object.keys(this._bounds)){
-        this.layerBounds.extend(this._bounds[key].min);
-        this.layerBounds.extend(this._bounds[key].max);
-      }
-      L.GridLayer.prototype.onAdd.call(this,this._map);
-      this._handleMoveEnd();
-    },
-    
-    getEvents: function(){
-      let events = L.GridLayer.prototype.getEvents.call(this,this._map);
-      this._parentOnMoveEnd = events.moveend;
-      events.moveend = this._handleMoveEnd;
-      events.move = ()=>{}; //needed to prevent moveend from running
-      return events;
-    },
-
-
-    //sets the bounds flag of the layer and calls default moveEnd if within bounds
-    //its the zoom level is between the nativeZoom and zoom then it uses the nativeZoom value to get the bound its checking
-    _handleMoveEnd : function(e){
-      let mapZoom = this._map.getZoom();
-      let zoomLevel = mapZoom;
-      zoomLevel = zoomLevel > this.options.maxNativeZoom? this.options.maxNativeZoom: zoomLevel;
-      zoomLevel = zoomLevel < this.options.minNativeZoom? this.options.minNativeZoom: zoomLevel;
-      this.isVisible = mapZoom <= this.zoomBounds.maxZoom && mapZoom >= this.zoomBounds.minZoom && 
-                        this._bounds[zoomLevel] && this._bounds[zoomLevel]
-                        .overlaps(M.pixelToPCRSBounds(
-                          this._map.getPixelBounds(),
-                          this._map.getZoom(),
-                          this._map.options.projection));
-      if(!(this.isVisible))return; //onMoveEnd still gets fired even when layer is out of bounds??, most likely need to overrride _onMoveEnd
-      this._parentOnMoveEnd();
-    },
-
-    _isValidTile(coords) {
-      return this._groups[this._tileCoordsToKey(coords)];
-    },
-
-    createTile: function (coords) {
-      let tileGroup = this._groups[this._tileCoordsToKey(coords)] || [],
-          tileElem = document.createElement('map-tile'), tileSize = this.getTileSize();
-      tileElem.setAttribute("col",coords.x);
-      tileElem.setAttribute("row",coords.y);
-      tileElem.setAttribute("zoom",coords.z);
-      
-      for(let i = 0;i<tileGroup.length;i++){
-        let tile= document.createElement('img');
-        tile.width = tileSize.x;
-        tile.height = tileSize.y;
-        tile.alt = '';
-        tile.setAttribute("role","presentation");
-        tile.src = tileGroup[i].src;
-        tileElem.appendChild(tile);
-      }
-      return tileElem;
-    },
-
-    _getLayerBounds: function(tileGroups, projection){
-      let layerBounds = {}, tileSize = M[projection].options.crs.tile.bounds.max.x;
-      for(let tile in tileGroups){
-        let sCoords = tile.split(":"), pixelCoords = {};
-        pixelCoords.x = +sCoords[0] * tileSize;
-        pixelCoords.y = +sCoords[1] * tileSize;
-        pixelCoords.z = +sCoords[2]; //+String same as parseInt(String)
-        if(sCoords[2] in layerBounds){
-
-          layerBounds[sCoords[2]].extend(L.point(pixelCoords.x ,pixelCoords.y ));
-          layerBounds[sCoords[2]].extend(L.point(((pixelCoords.x+tileSize) ),((pixelCoords.y+tileSize) )));
-        } else {
-          layerBounds[sCoords[2]] = L.bounds(
-                                      L.point(pixelCoords.x ,pixelCoords.y ),
-                                      L.point(((pixelCoords.x+tileSize) ),((pixelCoords.y+tileSize) )));
-        }
-      }
-      // TODO: optimize by removing 2nd loop, add util function to convert point in pixels to point in pcrs, use that instead then this loop
-      // won't be needed
-      for(let pixelBounds in layerBounds){
-        let zoom = +pixelBounds;
-        layerBounds[pixelBounds] = M.pixelToPCRSBounds(layerBounds[pixelBounds],zoom,projection);
-      }
-
-      return layerBounds;
-    },
-
-    _getZoomBounds: function(container, maxZoomBound){
-      if(!container) return null;
-      let meta = M.metaContentToObject(container.getElementsByTagName('map-tiles')[0].getAttribute('zoom')),
-          zoom = {},tiles = container.getElementsByTagName("map-tile");
-      zoom.nativeZoom = +meta.value || 0;
-      zoom.maxNativeZoom = 0;
-      zoom.minNativeZoom = maxZoomBound;
-      for (let i=0;i<tiles.length;i++) {
-        let lZoom = +tiles[i].getAttribute('zoom');
-        if(!tiles[i].getAttribute('zoom')) lZoom = zoom.nativeZoom;
-        zoom.minNativeZoom = Math.min(zoom.minNativeZoom, lZoom);
-        zoom.maxNativeZoom = Math.max(zoom.maxNativeZoom, lZoom);
-      }
-
-      //hard coded to only natively zoom out 2 levels, any more and too many tiles are going to be loaded in at one time
-      //lagging the users computer
-      zoom.minZoom = zoom.minNativeZoom - 2 <= 0? 0: zoom.minNativeZoom - 2;
-      zoom.maxZoom = maxZoomBound;
-      if(meta.min)zoom.minZoom = +meta.min < (zoom.minNativeZoom - 2)?(zoom.minNativeZoom - 2):+meta.min;
-      if(meta.max)zoom.maxZoom = +meta.max;
-      return zoom;
-    },
-
-    _groupTiles: function (tiles) {
-      let tileMap = {};
-      for (let i=0;i<tiles.length;i++) {
-        let tile = {};
-        tile.row = +tiles[i].getAttribute('row');
-        tile.col = +tiles[i].getAttribute('col');
-        tile.zoom = +tiles[i].getAttribute('zoom') || this.options.nativeZoom;
-        tile.src = tiles[i].getAttribute('src');
-        let tileCode = tile.col+":"+tile.row+":"+tile.zoom;
-        if(tileCode in tileMap){
-          tileMap[tileCode].push(tile);
-        } else {
-          tileMap[tileCode]=[tile];
-        }
-      }
-      return tileMap;
-    },
-  });
-
-  var mapMLStaticTileLayer = function(options) {
-    return new MapMLStaticTileLayer(options);
-  };
-
-  var MapMLLayerControl = L.Control.Layers.extend({
-      /* removes 'base' layers as a concept */
-      options: {
-        autoZIndex: false,
-        sortLayers: true,
-        sortFunction: function (layerA, layerB) {
-          return layerA.options.zIndex < layerB.options.zIndex ? -1 : (layerA.options.zIndex > layerB.options.zIndex ? 1 : 0);
-        }
-      },
-      initialize: function (overlays, options) {
-          L.setOptions(this, options);
-          
-          // the _layers array contains objects like {layer: layer, name: "name", overlay: true}
-          // the array index is the id of the layer returned by L.stamp(layer) which I guess is a unique hash
-          this._layerControlInputs = [];
-          this._layers = [];
-          this._lastZIndex = 0;
-          this._handlingClick = false;
-
-          for (var i in overlays) {
-              this._addLayer(overlays[i], i, true);
-          }
-      },
-      onAdd: function () {
-          this._initLayout();
-          this._map.on('validate', this._validateInput, this);
-          L.DomEvent.on(this.options.mapEl, "layerchange", this._validateInput, this);
-          L.DomEvent.on(this._container, 'keydown', this._focusFirstLayer, this._container);
-          this._update();
-          //this._validateExtents();
-          if(this._layers.length < 1 && !this._map._showControls){
-            this._container.setAttribute("hidden","");
-          } else {
-            this._map._showControls = true;
-          }
-          return this._container;
-      },
-      onRemove: function (map) {
-          map.off('validate', this._validateInput, this);
-          L.DomEvent.off(this._container, 'keydown', this._focusFirstLayer, this._container);
-          // remove layer-registerd event handlers so that if the control is not
-          // on the map it does not generate layer events
-          for (var i = 0; i < this._layers.length; i++) {
-            this._layers[i].layer.off('add remove', this._onLayerChange, this);
-            this._layers[i].layer.off('extentload', this._validateInput, this);
-          }
-      },
-      addOrUpdateOverlay: function (layer, name) {
-        var alreadyThere = false;
-        for (var i=0;i<this._layers.length;i++) {
-          if (this._layers[i].layer === layer) {
-            alreadyThere = true;
-            this._layers[i].name = name;
-            // replace the controls with updated controls if necessary.
-            break;
-          }
-        }
-        if (!alreadyThere) {
-          this.addOverlay(layer, name);
-        }
-        if(this._layers.length > 0){
-          this._container.removeAttribute("hidden");
-          this._map._showControls = true;
-        }
-        return (this._map) ? this._update() : this;
-      },
-      removeLayer: function (layer) {
-        L.Control.Layers.prototype.removeLayer.call(this, layer);
-        if(this._layers.length === 0){
-          this._container.setAttribute("hidden", "");
-        }
-      },
-      _validateInput: function (e) {
-        for (let i = 0; i < this._layers.length; i++) {
-          if(!this._layers[i].input.labels[0])continue;
-          let label = this._layers[i].input.labels[0].getElementsByTagName("span"),
-              input = this._layers[i].input.labels[0].getElementsByTagName("input");
-          input[0].checked = this._layers[i].layer._layerEl.checked;
-          if(this._layers[i].layer._layerEl.disabled && this._layers[i].layer._layerEl.checked){
-            input[0].closest("fieldset").disabled = true;
-            label[0].style.fontStyle = "italic";
-          } else {
-            input[0].closest("fieldset").disabled = false;
-            label[0].style.fontStyle = "normal";
-          }
-        }
-
-      },
-
-      // focus the first layer in the layer control when enter is pressed
-      _focusFirstLayer: function(e){
-        if(e.key === 'Enter' && this.className != 'leaflet-control-layers leaflet-control leaflet-control-layers-expanded'){
-          var elem = this.children[1].children[2].children[0].children[0].children[0].children[0];
-          if(elem) setTimeout(() => elem.focus(), 0);
-          }
-      },
-      
-      _withinZoomBounds: function(zoom, range) {
-          return range.min <= zoom && zoom <= range.max;
-      },
-      _addItem: function (obj) {
-        var layercontrols  =  obj.layer.getLayerUserControlsHTML();
-        // the input is required by Leaflet...
-        obj.input = layercontrols.querySelector('input');
-
-        this._layerControlInputs.push(obj.input);
-      		obj.input.layerId = L.stamp(obj.layer);
-
-        L.DomEvent.on(obj.input, 'click', this._onInputClick, this);
-        // this is necessary because when there are several layers in the
-        // layer control, the response to the last one can be a long time
-        // after the info is first displayed, so we have to go back and
-        // verify the layer element is not disabled and can have an enabled input.
-        obj.layer.on('extentload', this._validateInput, this);
-        this._overlaysList.appendChild(layercontrols);
-        return layercontrols;
-      },
-
-      //overrides collapse and conditionally collapses the panel
-      collapse: function(e){
-        if (
-          e.target.tagName === "SELECT" ||
-          e.relatedTarget &&
-          e.relatedTarget.parentElement &&
-          (
-            e.relatedTarget.className === "mapml-contextmenu mapml-layer-menu" ||
-            e.relatedTarget.parentElement.className === "mapml-contextmenu mapml-layer-menu"
-          ) ||
-          (this._map && this._map.contextMenu._layerMenu.style.display === "block")
-        ) return this;
-
-        L.DomUtil.removeClass(this._container, 'leaflet-control-layers-expanded');
-  		  return this;
-      }
-  });
-  var mapMlLayerControl = function (layers, options) {
-  	return new MapMLLayerControl(layers, options);
-  };
-
-  const FALLBACK_PROJECTION = "OSMTILE";
-  const FALLBACK_CS = "TILEMATRIX";
-  const BLANK_TT_TREF = "mapmltemplatedtileplaceholder";
-
-  var MapMLFeatures = L.FeatureGroup.extend({
-    /*
-     * M.MapML turns any MapML feature data into a Leaflet layer. Based on L.GeoJSON.
-     */
-      initialize: function (mapml, options) {
-
-        L.setOptions(this, options);
-        if(this.options.static) {
-          this._container = L.DomUtil.create('div', 'leaflet-layer', this.options.pane);
-          // must have leaflet-pane class because of new/changed rule in leaflet.css
-          // info: https://github.com/Leaflet/Leaflet/pull/4597
-          L.DomUtil.addClass(this._container, 'leaflet-pane mapml-vector-container');
-          L.setOptions(this.options.renderer, {pane: this._container});
-        }
-
-        this._layers = {};
-        if(this.options.query){
-          this._mapmlFeatures = mapml;
-          this.isVisible = true;
-          let native = this._getNativeVariables(mapml);
-          this.options.nativeZoom = native.zoom;
-          this.options.nativeCS = native.cs;
-        }
-        if (mapml && !this.options.query) {
-          let native = this._getNativeVariables(mapml);
-          //needed to check if the feature is static or not, since this method is used by templated also
-          if(!mapml.querySelector('map-extent') && mapml.querySelector('map-feature') && this.options.static){
-            this._features = {};
-            this._staticFeature = true;
-            this.isVisible = true; //placeholder for when this actually gets updated in the future
-            this.zoomBounds = this._getZoomBounds(mapml, native.zoom);
-            this.layerBounds = this._getLayerBounds(mapml);
-            L.extend(this.options, this.zoomBounds);
-          }
-          this.addData(mapml, native.cs, native.zoom);
-          if(this._staticFeature){
-            this._resetFeatures(this._clampZoom(this.options._leafletLayer._map.getZoom()));
-
-            this.options._leafletLayer._map._addZoomLimit(this);
-          }
-        }
-      },
-
-      onAdd: function(map){
-        L.FeatureGroup.prototype.onAdd.call(this, map);
-        if(this._mapmlFeatures)map.on("featurepagination", this.showPaginationFeature, this);
-      },
-
-      onRemove: function(map){
-        if(this._mapmlFeatures){
-          map.off("featurepagination", this.showPaginationFeature, this);
-          delete this._mapmlFeatures;
-          L.DomUtil.remove(this._container);
-        }
-        L.FeatureGroup.prototype.onRemove.call(this, map);
-      },
-
-      getEvents: function(){
-        if(this._staticFeature){
-          return {
-            'moveend':this._handleMoveEnd,
-            'zoomend' : this._handleZoomEnd,
-          };
-        }
-        return {
-          'moveend':this._removeCSS
-        };
-      },
-
-
-      showPaginationFeature: function(e){
-        if(this.options.query && this._mapmlFeatures.querySelectorAll("map-feature")[e.i]){
-          let feature = this._mapmlFeatures.querySelectorAll("map-feature")[e.i];
-          this.clearLayers();
-          this.addData(feature, this.options.nativeCS, this.options.nativeZoom);
-          e.popup._navigationBar.querySelector("p").innerText = (e.i + 1) + "/" + this.options._leafletLayer._totalFeatureCount;
-          e.popup._content.querySelector("iframe").setAttribute("sandbox", "allow-same-origin allow-forms");
-          e.popup._content.querySelector("iframe").srcdoc = feature.querySelector("map-properties").innerHTML;
-        }
-      },
-
-      _getNativeVariables: function(mapml){
-        let nativeZoom = mapml.querySelector("map-meta[name=zoom]") &&
-            +M.metaContentToObject(mapml.querySelector("map-meta[name=zoom]").getAttribute("content")).value || 0;
-        let nativeCS = mapml.querySelector("map-meta[name=cs]") &&
-            M.metaContentToObject(mapml.querySelector("map-meta[name=cs]").getAttribute("content")).content || "GCRS";
-        return {zoom:nativeZoom, cs: nativeCS};
-      },
-
-      _handleMoveEnd : function(){
-        let mapZoom = this._map.getZoom(),
-            withinZoom = mapZoom <= this.zoomBounds.maxZoom && mapZoom >= this.zoomBounds.minZoom;   
-        this.isVisible = withinZoom && this._layers && this.layerBounds && 
-                          this.layerBounds.overlaps(
-                            M.pixelToPCRSBounds(
-                              this._map.getPixelBounds(),
-                              mapZoom,this._map.options.projection));
-        this._removeCSS();
-      },
-
-      _handleZoomEnd: function(e){
-        let mapZoom = this._map.getZoom();
-        if(mapZoom > this.zoomBounds.maxZoom || mapZoom < this.zoomBounds.minZoom){
-          this.clearLayers();
-          return;
-        }
-        let clampZoom = this._clampZoom(mapZoom);
-        this._resetFeatures(clampZoom);
-      },
-
-      //sets default if any are missing, better to only replace ones that are missing
-      _getLayerBounds : function(container) {
-        if (!container) return null;
-        let cs = FALLBACK_CS,
-            projection = container.querySelector('map-meta[name=projection]') &&
-                      M.metaContentToObject(
-                        container.querySelector('map-meta[name=projection]').getAttribute('content'))
-                        .content.toUpperCase() || FALLBACK_PROJECTION;
-        try{
-
-          let meta = container.querySelector('map-meta[name=extent]') &&
-                      M.metaContentToObject(
-                        container.querySelector('map-meta[name=extent]').getAttribute('content'));
-
-          let zoom = meta.zoom || 0;
-          
-          let metaKeys = Object.keys(meta);
-          for(let i =0;i<metaKeys.length;i++){
-            if(!metaKeys[i].includes("zoom")){
-              cs = M.axisToCS(metaKeys[i].split("-")[2]);
-              break;
-            }
-          }
-          let axes = M.csToAxes(cs);
-          return M.boundsToPCRSBounds(
-                  L.bounds(L.point(+meta[`top-left-${axes[0]}`],+meta[`top-left-${axes[1]}`]),
-                  L.point(+meta[`bottom-right-${axes[0]}`],+meta[`bottom-right-${axes[1]}`])),
-                  zoom,projection,cs);
-        } catch (error){
-          //if error then by default set the layer to osm and bounds to the entire map view
-          return M.boundsToPCRSBounds(M[projection].options.crs.tilematrix.bounds(0),0,projection, cs);
-        }
-      },
-
-      _resetFeatures : function (zoom){
-        this.clearLayers();
-        if(this._features && this._features[zoom]){
-          for(let k =0;k < this._features[zoom].length;k++){
-            this.addLayer(this._features[zoom][k]);
-          }
-        }
-      },
-
-      _clampZoom : function(zoom){
-        if(zoom > this.zoomBounds.maxZoom || zoom < this.zoomBounds.minZoom) return zoom;
-        if (undefined !== this.zoomBounds.minNativeZoom && zoom < this.zoomBounds.minNativeZoom) {
-          return this.zoomBounds.minNativeZoom;
-        }
-        if (undefined !== this.zoomBounds.maxNativeZoom && this.zoomBounds.maxNativeZoom < zoom) {
-          return this.zoomBounds.maxNativeZoom;
-        }
-
-        return zoom;
-      },
-
-      _setZoomTransform: function(center, clampZoom){
-        var scale = this._map.getZoomScale(this._map.getZoom(),clampZoom),
-  		    translate = center.multiplyBy(scale)
-  		        .subtract(this._map._getNewPixelOrigin(center, this._map.getZoom())).round();
-
-        if (any3d) {
-          L.setTransform(this._layers[clampZoom], translate, scale);
-        } else {
-          L.setPosition(this._layers[clampZoom], translate);
-        }
-      },
-
-      _getZoomBounds: function(container, nativeZoom){
-        if (!container) return null;
-        let nMin = 100,nMax=0, features = container.getElementsByTagName('map-feature'),meta,projection;
-        for(let i =0;i<features.length;i++){
-          let lZoom = +features[i].getAttribute('zoom');
-          if(!features[i].getAttribute('zoom'))lZoom = nativeZoom;
-          nMax = Math.max(nMax, lZoom);
-          nMin = Math.min(nMin, lZoom);
-        }
-        try{
-          projection = M.metaContentToObject(container.querySelector('map-meta[name=projection]').getAttribute('content')).content;
-          meta = M.metaContentToObject(container.querySelector('map-meta[name=zoom]').getAttribute('content'));
-        } catch(error){
-          return {
-            minZoom:0,
-            maxZoom: M[projection || FALLBACK_PROJECTION].options.resolutions.length - 1,
-            minNativeZoom:nMin,
-            maxNativeZoom:nMax
-          };
-        }
-        return {
-          minZoom:+meta.min ,
-          maxZoom:+meta.max ,
-          minNativeZoom:nMin,
-          maxNativeZoom:nMax
-        };
-      },
-
-      addData: function (mapml, nativeCS, nativeZoom) {
-        var features = mapml.nodeType === Node.DOCUMENT_NODE || mapml.nodeName === "LAYER-" ? mapml.getElementsByTagName("map-feature") : null,
-            i, len, feature;
-
-        var linkedStylesheets = mapml.nodeType === Node.DOCUMENT_NODE ? mapml.querySelector("map-link[rel=stylesheet],map-style") : null;
-        if (linkedStylesheets) {
-          var base = mapml.querySelector('map-base') && mapml.querySelector('map-base').hasAttribute('href') ? 
-              new URL(mapml.querySelector('map-base').getAttribute('href')).href : 
-              mapml.URL;
-          M.parseStylesheetAsHTML(mapml,base,this._container);
-        }
-        if (features) {
-         for (i = 0, len = features.length; i < len; i++) {
-          // Only add this if geometry is set and not null
-          feature = features[i];
-          var geometriesExist = feature.getElementsByTagName("map-geometry").length && feature.getElementsByTagName("map-coordinates").length;
-          if (geometriesExist) {
-           this.addData(feature, nativeCS, nativeZoom);
-          }
-         }
-         return this; //if templated this runs
-        }
-
-        //if its a mapml with no more links this runs
-        var options = this.options;
-
-        if (options.filter && !options.filter(mapml)) { return; }
-        
-        if (mapml.classList.length) {
-          options.className = mapml.classList.value;
-        }
-        let zoom = mapml.getAttribute("zoom") || nativeZoom, title = mapml.querySelector("map-featurecaption");
-        title = title ? title.innerHTML : "Feature";
-
-        if(mapml.querySelector("map-properties")) {
-          options.properties = document.createElement('div');
-          options.properties.classList.add("mapml-popup-content");
-          options.properties.insertAdjacentHTML('afterbegin', mapml.querySelector("map-properties").innerHTML);
-        }
-
-        let layer = this.geometryToLayer(mapml, options, nativeCS, +zoom, title);
-        if (layer) {
-          // if the layer is being used as a query handler output, it will have
-          // a color option set.  Otherwise, copy classes from the feature
-          if (!layer.options.color && mapml.hasAttribute('class')) {
-            layer.options.className = mapml.getAttribute('class');
-          }
-          layer.defaultOptions = layer.options;
-          this.resetStyle(layer);
-
-          if (options.onEachFeature) {
-            layer.bindTooltip(title, { interactive:true, sticky: true, });
-          }
-          if(this._staticFeature){
-            let featureZoom = mapml.getAttribute('zoom') || nativeZoom;
-            if(featureZoom in this._features){
-              this._features[featureZoom].push(layer);
-            } else {
-              this._features[featureZoom]=[layer];
-            }
-            return;
-          } else {
-            return this.addLayer(layer);
-          }
-        }
-      },
-          
-      resetStyle: function (layer) {
-        var style = this.options.style;
-        if (style) {
-         // reset any custom styles
-         L.Util.extend(layer.options, layer.defaultOptions);
-         this._setLayerStyle(layer, style);
-        }
-      },
-
-      setStyle: function (style) {
-        this.eachLayer(function (layer) {
-          this._setLayerStyle(layer, style);
-        }, this);
-      },
-
-      _setLayerStyle: function (layer, style) {
-        if (typeof style === 'function') {
-          style = style(layer.feature);
-        }
-        if (layer.setStyle) {
-          layer.setStyle(style);
-        }
-      },
-      _removeCSS: function(){
-        let toDelete = this._container.querySelectorAll("link[rel=stylesheet],style");
-        for(let i = 0; i < toDelete.length;i++){
-          this._container.removeChild(toDelete[i]);
-        }
-      },
-    geometryToLayer: function (mapml, vectorOptions, nativeCS, zoom, title) {
-      let geometry = mapml.tagName.toUpperCase() === 'MAP-FEATURE' ? mapml.getElementsByTagName('map-geometry')[0] : mapml,
-          cs = geometry.getAttribute("cs") || nativeCS, group = [], svgGroup = L.SVG.create('g'), copyOptions = Object.assign({}, vectorOptions);
-      for(let geo of geometry.querySelectorAll('map-polygon, map-linestring, map-multilinestring, map-point, map-multipoint')){
-        group.push(M.feature(geo, Object.assign(copyOptions,
-          { nativeCS: cs,
-            nativeZoom: zoom,
-            projection: this.options.projection,
-            featureID: mapml.id,
-            group: svgGroup,
-            wrappers: this._getGeometryParents(geo.parentElement),
-            featureLayer: this,
-            _leafletLayer: this.options._leafletLayer,
-          })));
-      }
-      let groupOptions = {group:svgGroup, featureID: mapml.id, accessibleTitle: title, onEachFeature: vectorOptions.onEachFeature, properties: vectorOptions.properties, _leafletLayer: this.options._leafletLayer,},
-        collections = geometry.querySelector('map-multipolygon') || geometry.querySelector('map-geometrycollection');
-      if(collections) groupOptions.wrappers = this._getGeometryParents(collections.parentElement);
-
-      return M.featureGroup(group, groupOptions);
-    },
-
-    _getGeometryParents: function(subType, elems = []){
-      if(subType && subType.tagName.toUpperCase() !== "MAP-GEOMETRY"){
-        if(subType.tagName.toUpperCase() === "MAP-MULTIPOLYGON" || subType.tagName.toUpperCase() === "MAP-GEOMETRYCOLLECTION")
-          return this._getGeometryParents(subType.parentElement, elems);
-        return this._getGeometryParents(subType.parentElement, elems.concat([subType]));
-      } else {
-        return elems;
-      }
-    },
-  });
-  var mapMlFeatures = function (mapml, options) {
-  	return new MapMLFeatures(mapml, options);
-  };
-
-  var TemplatedTileLayer = L.TileLayer.extend({
-      // a TemplateTileLayer is similar to a L.TileLayer except its templates are
-      // defined by the <map-extent><template/></map-extent>
-      // content found in the MapML document.  As such, the client map does not
-      // 'revisit' the server for more MapML content, it simply fills the map extent
-      // with tiles for which it generates requests on demand (as the user pans/zooms/resizes
-      // the map)
-      initialize: function(template, options) {
-        // _setUpTileTemplateVars needs options.crs, not available unless we set
-        // options first...
-        let inputData = M.extractInputBounds(template);
-        this.zoomBounds = inputData.zoomBounds;
-        this.layerBounds=inputData.bounds;
-        this.isVisible = true;
-        L.extend(options, this.zoomBounds);
-        options.tms = template.tms;
-        L.setOptions(this, options);
-        this._setUpTileTemplateVars(template);
-
-        if (template.tile.subdomains) {
-          L.setOptions(this, L.extend(this.options, {subdomains: template.tile.subdomains}));
-        }
-        this._template = template;
-        this._initContainer();
-        // call the parent constructor with the template tref value, per the 
-        // Leaflet tutorial: http://leafletjs.com/examples/extending/extending-1-classes.html#methods-of-the-parent-class
-        L.TileLayer.prototype.initialize.call(this, template.template, L.extend(options, {pane: this._container}));
-      },
-      onAdd : function(){
-        this._map._addZoomLimit(this);
-        L.TileLayer.prototype.onAdd.call(this,this._map);
-        this._handleMoveEnd();
-      },
-
-      getEvents: function(){
-        let events = L.TileLayer.prototype.getEvents.call(this,this._map);
-        this._parentOnMoveEnd = events.moveend;
-        events.moveend = this._handleMoveEnd;
-        return events;
-      },
-
-      _initContainer: function () {
-        if (this._container) { return; }
-
-        this._container = L.DomUtil.create('div', 'leaflet-layer', this.options.pane);
-        L.DomUtil.addClass(this._container,'mapml-templated-tile-container');
-        this._updateZIndex();
-
-        if (this.options.opacity < 1) {
-          this._updateOpacity();
-        }
-      },
-      _handleMoveEnd : function(e){
-        let mapZoom = this._map.getZoom();
-        let mapBounds = M.pixelToPCRSBounds(this._map.getPixelBounds(),mapZoom,this._map.options.projection);
-        this.isVisible = mapZoom <= this.options.maxZoom && mapZoom >= this.options.minZoom && 
-                          this.layerBounds.overlaps(mapBounds);
-          if(!(this.isVisible))return;
-        this._parentOnMoveEnd();
-      },
-      createTile: function (coords) {
-        let tileGroup = document.createElement("DIV"),
-            tileSize = this.getTileSize();
-        L.DomUtil.addClass(tileGroup, "mapml-tile-group");
-        L.DomUtil.addClass(tileGroup, "leaflet-tile");
-
-        this._template.linkEl.dispatchEvent(new CustomEvent('tileloadstart', {
-          detail:{
-            x:coords.x,
-            y:coords.y,
-            zoom:coords.z,
-            appendTile: (elem)=>{tileGroup.appendChild(elem);},
-          },
-        }));
-
-        if (this._template.type.startsWith('image/')) {
-          let tile = L.TileLayer.prototype.createTile.call(this, coords, function(){});
-          tile.width = tileSize.x;
-          tile.height = tileSize.y;
-          tileGroup.appendChild(tile);
-        } else if(!this._url.includes(BLANK_TT_TREF)) {
-          // tiles of type="text/mapml" will have to fetch content while creating
-          // the tile here, unless there can be a callback associated to the element
-          // that will render the content in the alread-placed tile
-          // var tile = L.DomUtil.create('canvas', 'leaflet-tile');
-          this._fetchTile(coords, tileGroup);
-        }
-        return tileGroup;
-      },
-      _mapmlTileReady: function(tile) {
-          L.DomUtil.addClass(tile,'leaflet-tile-loaded');
-      },
-      // instead of being child of a pane, the TemplatedTileLayers are 'owned' by the group,
-      // and so are DOM children of the group, not the pane element (the MapMLLayer is
-      // a child of the overlay pane and always has a set of sub-layers)
-      getPane: function() {
-        return this.options.pane;
-      },
-      _fetchTile:  function (coords, tile) {
-         fetch(this.getTileUrl(coords),{redirect: 'follow'}).then(
-            function(response) {
-              if (response.status >= 200 && response.status < 300) {
-                return Promise.resolve(response);
-              } else {
-                console.log('Looks like there was a problem. Status Code: ' + response.status);
-                return Promise.reject(response);
-              }
-            }).then(function(response) {
-              return response.text();
-            }).then(text => {
-              var parser = new DOMParser();
-                  return parser.parseFromString(text, "application/xml");
-            }).then(mapml => {
-              this._createFeatures(mapml, coords, tile);
-              this._mapmlTileReady(tile);
-            }).catch(err => {console.log("Error Creating Tile");});
-      },
-
-      _createFeatures: function(markup, coords, tile){
-        let stylesheets = markup.querySelector('map-link[rel=stylesheet],map-style');
-        if (stylesheets) {
-          let base = markup.querySelector('map-base') && markup.querySelector('map-base').hasAttribute('href') ?
-            new URL(markup.querySelector('map-base').getAttribute('href')).href :
-            markup.URL;
-          M.parseStylesheetAsHTML(markup,base,tile);
-        }
-
-        let svg = L.SVG.create('svg'), g = L.SVG.create('g'), tileSize = this._map.options.crs.options.crs.tile.bounds.max.x,
-            xOffset = coords.x * tileSize, yOffset = coords.y * tileSize;
-
-        let tileFeatures = M.mapMlFeatures(markup, {
-          projection: this._map.options.projection,
-          static: false,
-          interactive: false,
-        });
-
-        for(let groupID in tileFeatures._layers){
-          for(let featureID in tileFeatures._layers[groupID]._layers){
-            let layer = tileFeatures._layers[groupID]._layers[featureID];
-            M.FeatureRenderer.prototype._initPath(layer, false);
-            layer._project(this._map, L.point([xOffset, yOffset]), coords.z);
-            M.FeatureRenderer.prototype._addPath(layer, g, false);
-            M.FeatureRenderer.prototype._updateFeature(layer);
-          }
-        }
-        svg.setAttribute('width', tileSize.toString());
-        svg.setAttribute('height', tileSize.toString());
-        svg.appendChild(g);
-        tile.appendChild(svg);
-      },
-
-      getTileUrl: function (coords) {
-          if (coords.z >= this._template.tilematrix.bounds.length || 
-                  !this._template.tilematrix.bounds[coords.z].contains(coords)) {
-            return '';
-          }
-          var obj = {};
-          obj[this._template.tilematrix.col.name] = coords.x;
-          obj[this._template.tilematrix.row.name] = coords.y;
-          obj[this._template.zoom.name] = this._getZoomForUrl();
-          obj[this._template.pcrs.easting.left] = this._tileMatrixToPCRSPosition(coords, 'top-left').x;
-          obj[this._template.pcrs.easting.right] = this._tileMatrixToPCRSPosition(coords, 'top-right').x;
-          obj[this._template.pcrs.northing.top] = this._tileMatrixToPCRSPosition(coords, 'top-left').y;
-          obj[this._template.pcrs.northing.bottom] = this._tileMatrixToPCRSPosition(coords, 'bottom-left').y;
-          obj[this._template.tile.server] = this._getSubdomain(coords);
-          for (var v in this._template.tile) {
-              if (["row","col","zoom","left","right","top","bottom"].indexOf(v) < 0) {
-                  obj[v] = this._template.tile[v];
-              }
-          }
-          if (this._map && !this._map.options.crs.infinite) {
-            let invertedY = this._globalTileRange.max.y - coords.y;
-            if (this.options.tms) {
-              obj[this._template.tilematrix.row.name] = invertedY;
-            }
-            //obj[`-${this._template.tilematrix.row.name}`] = invertedY; //leaflet has this but I dont see a use in storing row and -row as it doesnt follow that pattern
-          }
-          obj.r = this.options.detectRetina && L.Browser.retina && this.options.maxZoom > 0 ? '@2x' : '';
-          return L.Util.template(this._url, obj);
-      },
-      _tileMatrixToPCRSPosition: function (coords, pos) {
-  // this is a tile:
-  // 
-  //   top-left         top-center           top-right
-  //      +------------------+------------------+
-  //      |                  |                  |
-  //      |                  |                  |
-  //      |                  |                  |
-  //      |                  |                  |
-  //      |                  |                  |
-  //      |                  |                  |
-  //      + center-left    center               + center-right
-  //      |                  |                  |
-  //      |                  |                  |
-  //      |                  |                  |
-  //      |                  |                  |
-  //      |                  |                  |
-  //      |                  |                  |
-  //      |                  |                  |
-  //      +------------------+------------------+
-  //   bottom-left     bottom-center      bottom-right
-
-    var map = this._map,
-        crs = map.options.crs,
-        tileSize = this.getTileSize(),
-
-        nwPoint = coords.scaleBy(tileSize),
-        sePoint = nwPoint.add(tileSize),
-        centrePoint = nwPoint.add(Math.floor(tileSize / 2)),
-
-        nw = crs.transformation.untransform(nwPoint,crs.scale(coords.z)),
-        se = crs.transformation.untransform(sePoint,crs.scale(coords.z)),
-        cen = crs.transformation.untransform(centrePoint, crs.scale(coords.z)),
-        result = null;
-
-        switch (pos) {
-          case('top-left'):
-            result = nw;
-            break;
-          case('bottom-left'):
-            result = new L.Point(nw.x,se.y);
-            break;
-          case('center-left'):
-            result = new L.Point(nw.x,cen.y);
-            break;
-          case('top-right'):
-            result = new L.Point(se.x,nw.y);
-            break;
-          case('bottom-right'):
-            result = se;
-            break;
-          case('center-right'):
-            result = new L.Point(se.x,cen.y);
-            break;
-          case('top-center'):
-            result = new L.Point(cen.x,nw.y);
-            break;
-          case('bottom-center'):
-            result = new L.Point(cen.x,se.y);
-            break;
-          case('center'):
-            result = cen;
-            break;
-        }
-        return result;
-      },
-      _setUpTileTemplateVars: function(template) {
-        // process the inputs associated to template and create an object named
-        // tile with member properties as follows:
-        // {row: 'rowvarname', 
-        //  col: 'colvarname', 
-        //  left: 'leftvarname', 
-        //  right: 'rightvarname', 
-        //  top: 'topvarname', 
-        //  bottom: 'bottomvarname'}
-        template.tile = {};
-        var inputs = template.values,
-            crs = this.options.crs.options,
-            zoom, east, north, row, col;
-        
-        for (var i=0;i<template.values.length;i++) {
-          var type = inputs[i].getAttribute("type"), 
-              units = inputs[i].getAttribute("units"), 
-              axis = inputs[i].getAttribute("axis"), 
-              name = inputs[i].getAttribute("name"), 
-              position = inputs[i].getAttribute("position"),
-              shard = (type === "hidden" && inputs[i].hasAttribute("shard")),
-              select = (inputs[i].tagName.toLowerCase() === "map-select"),
-              value = inputs[i].getAttribute("value"),
-              min = inputs[i].getAttribute("min"),
-              max = inputs[i].getAttribute("max");
-          if (type === "location" && units === "tilematrix") {
-            switch (axis) {
-              case("column"):
-                col = {
-                  name: name,
-                  min: crs.crs.tilematrix.horizontal.min,
-                  max: crs.crs.tilematrix.horizontal.max(crs.resolutions.length-1)
-                };
-                if (!isNaN(Number.parseFloat(min))) {
-                  col.min = Number.parseFloat(min);
-                }
-                if (!isNaN(Number.parseFloat(max))) {
-                  col.max = Number.parseFloat(max);
-                }
-                break;
-              case("row"):
-                row = {
-                  name: name,
-                  min: crs.crs.tilematrix.vertical.min,
-                  max:  crs.crs.tilematrix.vertical.max(crs.resolutions.length-1)
-                };
-                if (!isNaN(Number.parseFloat(min))) {
-                  row.min = Number.parseFloat(min);
-                }
-                if (!isNaN(Number.parseFloat(max))) {
-                  row.max = Number.parseFloat(max);
-                }
-                break;
-              case('longitude'):
-              case("easting"):
-                if (!east) {
-                  east = {
-                    min: crs.crs.pcrs.horizontal.min,
-                    max: crs.crs.pcrs.horizontal.max
-                  };
-                }
-                if (!isNaN(Number.parseFloat(min))) {
-                  east.min = Number.parseFloat(min);
-                }
-                if (!isNaN(Number.parseFloat(max))) {
-                  east.max = Number.parseFloat(max);
-                }
-                if (position) {
-                  if (position.match(/.*?-left/i)) {
-                    east.left = name;
-                  } else if (position.match(/.*?-right/i)) {
-                    east.right = name;
-                  }
-                }
-                break;
-              case('latitude'):
-              case("northing"):
-                if (!north) {
-                  north = {
-                    min: crs.crs.pcrs.vertical.min,
-                    max: crs.crs.pcrs.vertical.max
-                  };
-                }
-                if (!isNaN(Number.parseFloat(min))) {
-                  north.min = Number.parseFloat(min);
-                }
-                if (!isNaN(Number.parseFloat(max))) {
-                  north.max = Number.parseFloat(max);
-                }
-                if (position) {
-                  if (position.match(/top-.*?/i)) {
-                    north.top = name;
-                  } else if (position.match(/bottom-.*?/i)) {
-                    north.bottom = name;
-                  }
-                } 
-                break;
-                // unsuportted axis value
-            }
-          } else if (type && type.toLowerCase() === "zoom") {
-            //<input name="..." type="zoom" value="0" min="0" max="17">
-             zoom = {
-               name: name,
-               min: 0, 
-               max: crs.resolutions.length,
-               value: crs.resolutions.length 
-             };
-             if (!isNaN(Number.parseInt(value,10)) && 
-                     Number.parseInt(value,10) >= zoom.min && 
-                     Number.parseInt(value,10) <= zoom.max) {
-               zoom.value = Number.parseInt(value,10);
-             } else {
-               zoom.value = zoom.max;
-             }
-             if (!isNaN(Number.parseInt(min,10)) && 
-                     Number.parseInt(min,10) >= zoom.min && 
-                     Number.parseInt(min,10) <= zoom.max) {
-               zoom.min = Number.parseInt(min,10);
-             }
-             if (!isNaN(Number.parseInt(max,10)) && 
-                     Number.parseInt(max,10) >= zoom.min && 
-                     Number.parseInt(max,10) <= zoom.max) {
-               zoom.max = Number.parseInt(max,10);
-             }
-             template.zoom = zoom;
-          } else if (shard) {
-            template.tile.server = name;
-            template.tile.subdomains = inputs[i].servers.slice();
-          } else if (select) {
-              /*jshint -W104 */
-            const parsedselect = inputs[i].htmlselect;
-            template.tile[name] = function() {
-                return parsedselect.value;
-            };
-          } else {
-             // needs to be a const otherwise it gets overwritten
-            /*jshint -W104 */
-            const input = inputs[i];
-            template.tile[name] = function () {
-                return input.getAttribute("value");
-            };
-          }
-        }
-        var transformation = this.options.crs.transformation,
-            tileSize = this.options.crs.options.crs.tile.bounds.max.x,
-            scale = L.bind(this.options.crs.scale, this.options.crs),
-        pcrs2tilematrix = function(c,zoom) {
-          return transformation.transform(c, scale(zoom)).divideBy(tileSize).floor();
-        };
-        if (east && north) {
-          
-          template.pcrs = {};
-          template.pcrs.bounds = L.bounds([east.min,north.min],[east.max,north.max]);
-          template.pcrs.easting = east;
-          template.pcrs.northing = north;
-          
-        } else if ( col && row && !isNaN(zoom.value)) {
-            
-            // convert the tile bounds at this zoom to a pcrs bounds, then 
-            // go through the zoom min/max and create a tile-based bounds
-            // at each zoom that applies to the col/row values that constrain what tiles
-            // will be requested so that we don't generate too many 404s
-            if (!template.pcrs) {
-              template.pcrs = {};
-              template.pcrs.easting = '';
-              template.pcrs.northing = '';
-            }
-            
-            template.pcrs.bounds =  M.boundsToPCRSBounds(
-                        L.bounds(L.point([col.min,row.min]),
-                        L.point([col.max,row.max])),
-                        zoom.value, this.options.crs, M.axisToCS("column"));
-            
-            template.tilematrix = {};
-            template.tilematrix.col = col;
-            template.tilematrix.row = row;
-
-        } else {
-          console.log('Unable to determine bounds for tile template: ' + template.template);
-        }
-        
-        if (!template.tilematrix) {
-          template.tilematrix = {};
-          template.tilematrix.col = {};
-          template.tilematrix.row = {};
-        }
-        template.tilematrix.bounds = [];
-        var pcrsBounds = template.pcrs.bounds;
-        // the template should _always_ have a zoom, because we force it to
-        // by first processing the extent to determine the zoom and if none, adding
-        // one and second by copying that zoom into the set of template variable inputs
-        // even if it is not referenced by one of the template's variable references
-        var zmin = template.zoom?template.zoom.min:0,
-            zmax = template.zoom?template.zoom.max:crs.resolutions.length;
-        for (var z=0; z <= zmax; z++) {
-          template.tilematrix.bounds[z] = (z >= zmin ?
-              L.bounds(pcrs2tilematrix(pcrsBounds.min,z),
-                pcrs2tilematrix(pcrsBounds.max,z)) :
-                        L.bounds(L.point([-1,-1]),L.point([-1,-1])));
-        }
-      }
-  });
-  var templatedTileLayer = function(template, options) {
-    return new TemplatedTileLayer(template, options);
-  };
-
-  var TemplatedLayer = L.Layer.extend({
-    initialize: function(templates, options) {
-      this._templates =  templates;
-      L.setOptions(this, options);
-      this._container = L.DomUtil.create('div', 'leaflet-layer', options.pane);
-      L.DomUtil.addClass(this._container,'mapml-templatedlayer-container');
-
-      for (var i=0;i<templates.length;i++) {
-        if (templates[i].rel === 'tile') {
-            this._templates[i].layer = M.templatedTileLayer(templates[i], 
-              L.Util.extend(options, {errorTileUrl: "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==", zIndex: i, pane: this._container}));
-        } else if (templates[i].rel === 'image') {
-            this._templates[i].layer = M.templatedImageLayer(templates[i], L.Util.extend(options, {zIndex: i, pane: this._container}));
-        } else if (templates[i].rel === 'features') {
-            this._templates[i].layer = M.templatedFeaturesLayer(templates[i], L.Util.extend(options, {zIndex: i, pane: this._container}));
-        } else if (templates[i].rel === 'query') {
-            // add template to array of queryies to be added to map and processed
-            // on click/tap events
-            this.hasSetBoundsHandler = true;
-            if (!this._queries) {
-              this._queries = [];
-            }
-            let inputData = M.extractInputBounds(templates[i]);
-            templates[i].layerBounds = inputData.bounds;
-            templates[i].zoomBounds = inputData.zoomBounds;
-            this._queries.push(L.extend(templates[i], this._setupQueryVars(templates[i])));
-        }
-      }
-    },
-    getEvents: function() {
-        return {
-            zoomstart: this._onZoomStart
-        };
-    },
-    redraw: function() {
-      this.closePopup();
-      for (var i=0;i<this._templates.length;i++) {
-        if (this._templates[i].rel === 'tile' || this._templates[i].rel === 'image' || this._templates[i].rel === 'features') {
-            this._templates[i].layer.redraw();
-        }
-      }
-    },
-    _onZoomStart: function() {
-        this.closePopup();
-    },
-
-
-    _setupQueryVars: function(template) {
-        // process the inputs associated to template and create an object named
-        // query with member properties as follows:
-        // {width: 'widthvarname', 
-        //  height: 'heightvarname', 
-        //  left: 'leftvarname', 
-        //  right: 'rightvarname', 
-        //  top: 'topvarname', 
-        //  bottom: 'bottomvarname'
-        //  i: 'ivarname'
-        //  j: 'jvarname'}
-        //  x: 'xvarname' x being the tcrs x axis
-        //  y: 'yvarname' y being the tcrs y axis
-        //  z: 'zvarname' zoom
-        //  title: link title
-
-        var queryVarNames = {query:{}},
-            inputs = template.values;
-        
-        for (var i=0;i<template.values.length;i++) {
-          var type = inputs[i].getAttribute("type"), 
-              units = inputs[i].getAttribute("units"), 
-              axis = inputs[i].getAttribute("axis"), 
-              name = inputs[i].getAttribute("name"), 
-              position = inputs[i].getAttribute("position"),
-              rel = inputs[i].getAttribute("rel"),
-              select = (inputs[i].tagName.toLowerCase() === "map-select");
-          if (type === "width") {
-                queryVarNames.query.width = name;
-          } else if ( type === "height") {
-                queryVarNames.query.height = name;
-          } else if (type === "location") { 
-            switch (axis) {
-              case('x'):
-              case('y'):
-              case("column"): 
-              case("row"):
-                queryVarNames.query[axis] = name;
-                break;
-              case ('longitude'):
-              case ('easting'):
-                if (position) {
-                    if (position.match(/.*?-left/i)) {
-                      if (rel === "pixel") {
-                        queryVarNames.query.pixelleft = name;
-                      } else if (rel === "tile") {
-                        queryVarNames.query.tileleft = name;
-                      } else {
-                        queryVarNames.query.mapleft = name;
-                      }
-                    } else if (position.match(/.*?-right/i)) {
-                      if (rel === "pixel") {
-                        queryVarNames.query.pixelright = name;
-                      } else if (rel === "tile") {
-                        queryVarNames.query.tileright = name;
-                      } else {
-                        queryVarNames.query.mapright = name;
-                      }
-                    }
-                } else {
-                    queryVarNames.query[axis] = name;
-                }
-                break;
-              case ('latitude'):
-              case ('northing'):
-                if (position) {
-                    if (position.match(/top-.*?/i)) {
-                      if (rel === "pixel") {
-                        queryVarNames.query.pixeltop = name;
-                      } else if (rel === "tile") {
-                        queryVarNames.query.tiletop = name;
-                      } else {
-                        queryVarNames.query.maptop = name;
-                      }
-                    } else if (position.match(/bottom-.*?/i)) {
-                      if (rel === "pixel") {
-                        queryVarNames.query.pixelbottom = name;
-                      } else if (rel === "tile") {
-                        queryVarNames.query.tilebottom = name;
-                      } else {
-                        queryVarNames.query.mapbottom = name;
-                      }
-                    }
-                } else {
-                  queryVarNames.query[axis] = name;
-                }
-                break;
-              case('i'):
-                if (units === "tile") {
-                  queryVarNames.query.tilei = name;
-                } else {
-                  queryVarNames.query.mapi = name;
-                }
-                break;
-              case('j'):
-                if (units === "tile") {
-                  queryVarNames.query.tilej = name;
-                } else {
-                  queryVarNames.query.mapj = name;
-                }
-                break;
-                // unsuportted axis value
-            }
-          } else if (type === "zoom") {
-            //<input name="..." type="zoom" value="0" min="0" max="17">
-             queryVarNames.query.zoom = name;
-          } else if (select) {
-              /*jshint -W104 */
-            const parsedselect = inputs[i].htmlselect;
-            queryVarNames.query[name] = function() {
-                return parsedselect.value;
-            };
-          } else {
-              /*jshint -W104 */
-              const input = inputs[i];
-             queryVarNames.query[name] = function () {
-                return input.getAttribute("value");
-             };
-          }
-        }
-        queryVarNames.query.title = template.title;
-        return queryVarNames;
-    },
-    reset: function (templates) {
-      if (!templates) {return;}
-      if (!this._map) {return;}
-      var addToMap = this._map && this._map.hasLayer(this),
-          old_templates = this._templates;
-      delete this._queries;
-      this._map.off('click', null, this);
-
-      this._templates = templates;
-      for (var i=0;i<templates.length;i++) {
-        if (templates[i].rel === 'tile') {
-            this._templates[i].layer = M.templatedTileLayer(templates[i],
-              L.Util.extend(this.options, {errorTileUrl: "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==", zIndex: i, pane: this._container}));
-        } else if (templates[i].rel === 'image') {
-            this._templates[i].layer = M.templatedImageLayer(templates[i], L.Util.extend(this.options, {zIndex: i, pane: this._container}));
-        } else if (templates[i].rel === 'features') {
-            this._templates[i].layer = M.templatedFeaturesLayer(templates[i], L.Util.extend(this.options, {zIndex: i, pane: this._container}));
-        } else if (templates[i].rel === 'query') {
-            if (!this._queries) {
-              this._queries = [];
-            }
-            this._queries.push(L.extend(templates[i], this._setupQueryVars(templates[i])));
-        }
-        if (addToMap) {
-          this.onAdd(this._map);
-        }
-      }
-      for (i=0;i<old_templates.length;i++) {
-        if (this._map.hasLayer(old_templates[i].layer)) {
-          this._map.removeLayer(old_templates[i].layer);
-        }
-      }
-    },
-    onAdd: function (map) {
-      for (var i=0;i<this._templates.length;i++) {
-        if (this._templates[i].rel !== 'query') {
-          map.addLayer(this._templates[i].layer);
-        }
-      }
-    },
-  //  setZIndex: function (zIndex) {
-  //      this.options.zIndex = zIndex;
-  //      this._updateZIndex();
-  //
-  //      return this;
-  //  },
-  //  _updateZIndex: function () {
-  //      if (this._container && this.options.zIndex !== undefined && this.options.zIndex !== null) {
-  //          this._container.style.zIndex = this.options.zIndex;
-  //      }
-  //  },
-    onRemove: function (map) {
-      L.DomUtil.remove(this._container);
-      for (var i=0;i<this._templates.length;i++) {
-        if (this._templates[i].rel !== 'query') {
-          map.removeLayer(this._templates[i].layer);
-        }
-      }
-    },
-
-    _previousFeature: function(e){
-      if(this._count + -1 >= 0){
-        this._count--;
-        this._map.fire("featurepagination", {i: this._count, popup: this});
-      }
-    },
-    
-    _nextFeature: function(e){
-      if(this._count + 1 < this._source._totalFeatureCount){
-        this._count++;
-        this._map.fire("featurepagination", {i: this._count, popup: this});
-      }
-    },
-
-  });
-  var templatedLayer = function(templates, options) {
-    // templates is an array of template objects
-    // a template object contains the template, plus associated <input> elements
-    // which need to be processed just prior to creating a url from the template 
-    // with the values of the inputs
-    return new TemplatedLayer(templates, options);
-  };
-
-  var TemplatedFeaturesLayer =  L.Layer.extend({
-    // this and M.ImageLayer could be merged or inherit from a common parent
-      initialize: function(template, options) {
-        let inputData = M.extractInputBounds(template);
-        this.zoomBounds = inputData.zoomBounds;
-        this.layerBounds=inputData.bounds;
-        this.isVisible = true;
-        this._template = template;
-        this._container = L.DomUtil.create('div', 'leaflet-layer', options.pane);
-        L.extend(options, this.zoomBounds);
-        L.DomUtil.addClass(this._container, 'mapml-features-container');
-        L.setOptions(this, L.extend(options,this._setUpFeaturesTemplateVars(template)));
-      },
-      getEvents: function () {
-          var events = {
-              moveend: this._onMoveEnd
-          };
-          return events;
-      },
-      onAdd: function () {
-        this._map._addZoomLimit(this);
-        var mapml, headers = new Headers({'Accept': 'text/mapml'});
-            var parser = new DOMParser(),
-            opacity = this.options.opacity || 1,
-            container = this._container,
-            map = this._map;
-        if (!this._features) {
-          this._features = M.mapMlFeatures( null, {
-            // pass the vector layer a renderer of its own, otherwise leaflet
-            // puts everything into the overlayPane
-            renderer: M.featureRenderer(),
-            // pass the vector layer the container for the parent into which
-            // it will append its own container for rendering into
-            pane: container,
-            opacity: opacity,
-            projection:map.options.projection,
-            static: true,
-            onEachFeature: function(properties, geometry) {
-              // need to parse as HTML to preserve semantics and styles
-              var c = document.createElement('div');
-              c.classList.add("mapml-popup-content");
-              c.insertAdjacentHTML('afterbegin', properties.innerHTML);
-              geometry.bindPopup(c, {autoClose: false, minWidth: 108});
-            }
-          });
-        }
-        // this was tricky...recursion alwasy breaks my brain
-        var features = this._features,
-            _pullFeatureFeed = function (url, limit) {
-              return (fetch (url,{redirect: 'follow',headers: headers})
-                      .then( function (response) {return response.text();})
-                      .then( function (text) {
-                mapml = parser.parseFromString(text,"application/xml");
-                var base = (new URL(mapml.querySelector('map-base') ? mapml.querySelector('map-base').getAttribute('href') : url)).href;
-                url = mapml.querySelector('map-link[rel=next]')? mapml.querySelector('map-link[rel=next]').getAttribute('href') : null;
-                url =  url ? (new URL(url, base)).href: null;
-                let nativeZoom = mapml.querySelector("map-meta[name=zoom]") &&
-                  +M.metaContentToObject(mapml.querySelector("map-meta[name=zoom]").getAttribute("content")).value || 0;
-                let nativeCS = mapml.querySelector("map-meta[name=cs]") &&
-                        M.metaContentToObject(mapml.querySelector("map-meta[name=cs]").getAttribute("content")).content || "GCRS";
-                features.addData(mapml, nativeCS, nativeZoom);
-                if (url && --limit) {
-                  return _pullFeatureFeed(url, limit);
-                }
-              }));
-            };
-        _pullFeatureFeed(this._getfeaturesUrl(), 10)
-          .then(function() { 
-                map.addLayer(features);
-                map.fire('moveend');  // TODO: replace with moveend handler for layer and not entire map
-          })
-          .catch(function (error) { console.log(error);});
-      },
-      redraw: function() {
-          this._onMoveEnd();
-      },
-
-      _onMoveEnd: function() {
-        let mapZoom = this._map.getZoom();
-        let mapBounds = M.pixelToPCRSBounds(this._map.getPixelBounds(),mapZoom,this._map.options.projection);
-        this.isVisible = mapZoom <= this.zoomBounds.maxZoom && mapZoom >= this.zoomBounds.minZoom && 
-                          this.layerBounds.overlaps(mapBounds);
-        
-        this._features.clearLayers();
-        if(!(this.isVisible)){
-          return;
-        }
-
-        // TODO add preference with a bit less weight than that for text/mapml; 0.8 for application/geo+json; 0.6
-        var mapml, headers = new Headers({'Accept': 'text/mapml;q=0.9,application/geo+json;q=0.8'}),
-            parser = new DOMParser(),
-            features = this._features,
-            map = this._map,
-            context = this,
-            MAX_PAGES = 10,
-          _pullFeatureFeed = function (url, limit) {
-            return (fetch (url,{redirect: 'follow',headers: headers})
-                    .then( function (response) {return response.text();})
-                    .then( function (text) {
-                      //TODO wrap this puppy in a try/catch/finally to parse application/geo+json if necessary
-                mapml = parser.parseFromString(text,"application/xml");
-                var base = (new URL(mapml.querySelector('map-base') ? mapml.querySelector('map-base').getAttribute('href') : url)).href;
-                url = mapml.querySelector('map-link[rel=next]')? mapml.querySelector('map-link[rel=next]').getAttribute('href') : null;
-                url =  url ? (new URL(url, base)).href: null;
-                // TODO if the xml parser barfed but the response is application/geo+json, use the parent addData method
-              let nativeZoom = mapml.querySelector("map-meta[name=zoom]") &&
-                                +M.metaContentToObject(mapml.querySelector("map-meta[name=zoom]").getAttribute("content")).value || 0;
-              let nativeCS = mapml.querySelector("map-meta[name=cs]") &&
-                                M.metaContentToObject(mapml.querySelector("map-meta[name=cs]").getAttribute("content")).content || "GCRS";
-              features.addData(mapml, nativeCS, nativeZoom);
-              if (url && --limit) {
-                return _pullFeatureFeed(url, limit);
-              }
-            }));
-          };
-        _pullFeatureFeed(this._getfeaturesUrl(), MAX_PAGES)
-          .then(function() { 
-            map.addLayer(features);
-            M.TemplatedFeaturesLayer.prototype._updateTabIndex(context);
-          })
-          .catch(function (error) { console.log(error);});
-      },
-      setZIndex: function (zIndex) {
-          this.options.zIndex = zIndex;
-          this._updateZIndex();
-          return this;
-      },
-      _updateTabIndex: function(context){
-        let c = context || this;
-        for(let layerNum in c._features._layers){
-          let layer = c._features._layers[layerNum];
-          if(layer._path){
-            if(layer._path.getAttribute("d") !== "M0 0"){
-              layer._path.setAttribute("tabindex", 0);
-            } else {
-              layer._path.removeAttribute("tabindex");
-            }
-            if(layer._path.childElementCount === 0) {
-              let title = document.createElement("title");
-              title.innerText = "Feature";
-              layer._path.appendChild(title);
-            }
-          }
-        }
-      },
-      _updateZIndex: function () {
-          if (this._container && this.options.zIndex !== undefined && this.options.zIndex !== null) {
-              this._container.style.zIndex = this.options.zIndex;
-          }
-      },
-      onRemove: function () {
-        this._map.removeLayer(this._features);
-      },
-      _getfeaturesUrl: function() {
-          var obj = {};
-          if (this.options.feature.zoom) {
-            obj[this.options.feature.zoom] = this._map.getZoom();
-          }
-          if (this.options.feature.width) {
-            obj[this.options.feature.width] = this._map.getSize().x;
-          }
-          if (this.options.feature.height) {
-            obj[this.options.feature.height] = this._map.getSize().y;
-          }
-          if (this.options.feature.bottom) {
-            obj[this.options.feature.bottom] = this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).y;
-          }
-          if (this.options.feature.left) {
-            obj[this.options.feature.left] = this._TCRSToPCRS(this._map.getPixelBounds().min, this._map.getZoom()).x;
-          }
-          if (this.options.feature.top) {
-            obj[this.options.feature.top] = this._TCRSToPCRS(this._map.getPixelBounds().min, this._map.getZoom()).y;
-          }
-          if (this.options.feature.right) {
-            obj[this.options.feature.right] = this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).x;
-          }
-          // hidden and other variables that may be associated
-          for (var v in this.options.feature) {
-              if (["width","height","left","right","top","bottom","zoom"].indexOf(v) < 0) {
-                  obj[v] = this.options.feature[v];
-                }
-          }
-          return L.Util.template(this._template.template, obj);
-      },
-      _TCRSToPCRS: function(coords, zoom) {
-        // TCRS pixel point to Projected CRS point (in meters, presumably)
-        var map = this._map,
-            crs = map.options.crs,
-            loc = crs.transformation.untransform(coords,crs.scale(zoom));
-            return loc;
-      },
-      _setUpFeaturesTemplateVars: function(template) {
-        // process the inputs and create an object named "extent"
-        // with member properties as follows:
-        // {width: {name: 'widthvarname'}, // value supplied by map if necessary
-        //  height: {name: 'heightvarname'}, // value supplied by map if necessary
-        //  left: {name: 'leftvarname', axis: 'leftaxisname'}, // axis name drives (coordinate system of) the value supplied by the map
-        //  right: {name: 'rightvarname', axis: 'rightaxisname'}, // axis name (coordinate system of) drives the value supplied by the map
-        //  top: {name: 'topvarname', axis: 'topaxisname'}, // axis name drives (coordinate system of) the value supplied by the map
-        //  bottom: {name: 'bottomvarname', axis: 'bottomaxisname'} // axis name drives (coordinate system of) the value supplied by the map
-        //  zoom: {name: 'zoomvarname'}
-        //  hidden: [{name: name, value: value}]}
-
-        var featuresVarNames = {feature:{}},
-            inputs = template.values;
-        featuresVarNames.feature.hidden = [];
-        for (var i=0;i<inputs.length;i++) {
-          // this can be removed when the spec removes the deprecated inputs...
-          var type = inputs[i].getAttribute("type"), 
-              units = inputs[i].getAttribute("units"), 
-              axis = inputs[i].getAttribute("axis"), 
-              name = inputs[i].getAttribute("name"), 
-              position = inputs[i].getAttribute("position"),
-              value = inputs[i].getAttribute("value"),
-              select = (inputs[i].tagName.toLowerCase() === "map-select");
-          if (type === "width") {
-                featuresVarNames.feature.width = name;
-          } else if ( type === "height") {
-                featuresVarNames.feature.height = name;
-          } else if (type === "zoom") {
-                featuresVarNames.feature.zoom = name;
-          } else if (type === "location" && (units === "pcrs" || units ==="gcrs") ) {
-            //<input name="..." units="pcrs" type="location" position="top|bottom-left|right" axis="northing|easting">
-            switch (axis) {
-              case ('x'):
-              case ('longitude'):
-              case ('easting'):
-                if (position) {
-                    if (position.match(/.*?-left/i)) {
-                      featuresVarNames.feature.left = name;
-                    } else if (position.match(/.*?-right/i)) {
-                      featuresVarNames.feature.right = name;
-                    }
-                }
-                break;
-              case ('y'):
-              case ('latitude'):
-              case ('northing'):
-                if (position) {
-                  if (position.match(/top-.*?/i)) {
-                    featuresVarNames.feature.top = name;
-                  } else if (position.match(/bottom-.*?/i)) {
-                    featuresVarNames.feature.bottom = name;
-                  }
-                }
-                break;
-            }
-           } else if (select) {
-              /*jshint -W104 */
-            const parsedselect = inputs[i].htmlselect;
-            featuresVarNames.feature[name] = function() {
-                return parsedselect.value;
-            };
-           // projection is deprecated, make it hidden
-          } else {
-              /*jshint -W104 */
-              const input = inputs[i];
-              featuresVarNames.feature[name] = function() {
-                  return input.getAttribute("value");
-              };
-          }
-        }
-        return featuresVarNames;
-      }
-  });
-  var templatedFeaturesLayer = function(template, options) {
-      return new TemplatedFeaturesLayer(template, options);
-  };
-
-  var TemplatedImageLayer =  L.Layer.extend({
-      initialize: function(template, options) {
-          this._template = template;
-          this._container = L.DomUtil.create('div', 'leaflet-layer', options.pane);
-          L.DomUtil.addClass(this._container, 'mapml-image-container');
-          let inputData = M.extractInputBounds(template);
-          this.zoomBounds = inputData.zoomBounds;
-          this.layerBounds=inputData.bounds;
-          this.isVisible = true;
-          L.extend(options, this.zoomBounds);
-          L.setOptions(this, L.extend(options,this._setUpExtentTemplateVars(template)));
-      },
-      getEvents: function () {
-          var events = {
-              moveend: this._onMoveEnd
-          };
-          return events;
-      },
-      onAdd: function () {
-          this._map._addZoomLimit(this);  //used to set the zoom limit of the map
-          this.setZIndex(this.options.zIndex);
-          this._onMoveEnd();
-      },
-      redraw: function() {
-          this._onMoveEnd();
-      },
-
-      _clearLayer: function(){
-        let containerImages = this._container.querySelectorAll('img');
-        for(let i = 0; i< containerImages.length;i++){
-          this._container.removeChild(containerImages[i]);
-        }
-      },
-
-      _onMoveEnd: function() {
-        let mapZoom = this._map.getZoom();
-        let mapBounds = M.pixelToPCRSBounds(this._map.getPixelBounds(),mapZoom,this._map.options.projection);
-        this.isVisible = mapZoom <= this.zoomBounds.maxZoom && mapZoom >= this.zoomBounds.minZoom && 
-                          this.layerBounds.overlaps(mapBounds);
-        if(!(this.isVisible)){
-          this._clearLayer();
-          return;
-        }
-        var map = this._map,
-          loc = map.getPixelBounds().min.subtract(map.getPixelOrigin()),
-          size = map.getSize(),
-          src = this.getImageUrl(),
-          overlayToRemove = this._imageOverlay;
-          this._imageOverlay = M.imageOverlay(src,loc,size,0,this._container);
-            
-        this._imageOverlay.addTo(map);
-        if (overlayToRemove) {
-          this._imageOverlay.on('load error', function () {map.removeLayer(overlayToRemove);});
-        }
-      },
-      setZIndex: function (zIndex) {
-          this.options.zIndex = zIndex;
-          this._updateZIndex();
-
-          return this;
-      },
-      _updateZIndex: function () {
-          if (this._container && this.options.zIndex !== undefined && this.options.zIndex !== null) {
-              this._container.style.zIndex = this.options.zIndex;
-          }
-      },
-      onRemove: function (map) {
-        this._clearLayer();
-        map._removeZoomLimit(this);
-        this._container = null;
-      },
-      getImageUrl: function() {
-          var obj = {};
-          obj[this.options.extent.width] = this._map.getSize().x;
-          obj[this.options.extent.height] = this._map.getSize().y;
-          obj[this.options.extent.bottom] = this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).y;
-          obj[this.options.extent.left] = this._TCRSToPCRS(this._map.getPixelBounds().min, this._map.getZoom()).x;
-          obj[this.options.extent.top] = this._TCRSToPCRS(this._map.getPixelBounds().min, this._map.getZoom()).y;
-          obj[this.options.extent.right] = this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).x;
-          // hidden and other variables that may be associated
-          for (var v in this.options.extent) {
-              if (["width","height","left","right","top","bottom"].indexOf(v) < 0) {
-                  obj[v] = this.options.extent[v];
-                }
-          }
-          return L.Util.template(this._template.template, obj);
-      },
-      _TCRSToPCRS: function(coords, zoom) {
-        // TCRS pixel point to Projected CRS point (in meters, presumably)
-        var map = this._map,
-            crs = map.options.crs,
-            loc = crs.transformation.untransform(coords,crs.scale(zoom));
-            return loc;
-      },
-      _setUpExtentTemplateVars: function(template) {
-        // process the inputs associated to template and create an object named
-        // extent with member properties as follows:
-        // {width: 'widthvarname', 
-        //  height: 'heightvarname', 
-        //  left: 'leftvarname', 
-        //  right: 'rightvarname', 
-        //  top: 'topvarname', 
-        //  bottom: 'bottomvarname'}
-
-        var extentVarNames = {extent:{}},
-            inputs = template.values;
-        
-        for (var i=0;i<template.values.length;i++) {
-          var type = inputs[i].getAttribute("type"), 
-              units = inputs[i].getAttribute("units"), 
-              axis = inputs[i].getAttribute("axis"), 
-              name = inputs[i].getAttribute("name"), 
-              position = inputs[i].getAttribute("position"),
-              select = (inputs[i].tagName.toLowerCase() === "map-select");
-          if (type === "width") {
-                extentVarNames.extent.width = name;
-          } else if ( type === "height") {
-                extentVarNames.extent.height = name;
-          } else if (type === "location" && (units === "pcrs" || units ==="gcrs") ) {
-            //<input name="..." units="pcrs" type="location" position="top|bottom-left|right" axis="northing|easting|latitude|longitude">
-            switch (axis) {
-              case ('longitude'):
-              case ('easting'):
-                if (position) {
-                    if (position.match(/.*?-left/i)) {
-                      extentVarNames.extent.left = name;
-                    } else if (position.match(/.*?-right/i)) {
-                      extentVarNames.extent.right = name;
-                    }
-                }
-                break;
-              case ('latitude'):
-              case ('northing'):
-                if (position) {
-                  if (position.match(/top-.*?/i)) {
-                    extentVarNames.extent.top = name;
-                  } else if (position.match(/bottom-.*?/i)) {
-                    extentVarNames.extent.bottom = name;
-                  }
-                }
-                break;
-            }
-          } else if (select) {
-              /*jshint -W104 */
-            const parsedselect = inputs[i].htmlselect;
-            extentVarNames.extent[name] = function() {
-                return parsedselect.value;
-            };
-          } else {
-              /*jshint -W104 */
-              const input = inputs[i];
-              extentVarNames.extent[name] = function() {
-                  return input.getAttribute("value");
-              };
-          }
-        }
-        return extentVarNames;
-      },
-  });
-  var templatedImageLayer = function(template, options) {
-      return new TemplatedImageLayer(template, options);
-  };
-
-  var ImageOverlay = L.ImageOverlay.extend({
-  	initialize: function (url, location, size, angle, container, options) { // (String, Point, Point, Number, Element, Object)
-                  this._container = container;
-  		this._url = url;
-                  // instead of calculating where the image goes, put it at 0,0
-  		//this._location = L.point(location);
-                  // the location for WMS requests will be the upper left hand
-                  // corner of the map.  When the map is initialized, that is 0,0,
-                  // but as the user pans, of course the
-  		this._location = location;
-                  this._size = L.point(size);
-                  this._angle = angle;
-
-  		L.setOptions(this, options);
-  	},
-          getEvents: function() {
-  		var events = {
-  			viewreset: this._reset
-  		};
-
-  		if (this._zoomAnimated) {
-  			events.zoomanim = this._animateZoom;
-  		}
-
-  		return events;
-          },
-  	onAdd: function () {
-                  this.on({ 
-                    load: this._onImageLoad
-                    });
-
-  		if (!this._image) {
-                      this._initImage();
-  		}
-
-  		if (this.options.interactive) {
-  			L.DomUtil.addClass(this._image, 'leaflet-interactive');
-  			this.addInteractiveTarget(this._image);
-  		}
-
-  		this._container.appendChild(this._image);
-  		this._reset();
-  	},
-  	onRemove: function () {
-  		L.DomUtil.remove(this._image);
-  		if (this.options.interactive) {
-  			this.removeInteractiveTarget(this._image);
-  		}
-  	},
-          _onImageLoad: function () {
-              if (!this._image) { return; }
-              this._image.loaded =  +new Date();
-              this._updateOpacity();
-          },
-  	_animateZoom: function (e) {
-  		var scale = this._map.getZoomScale(e.zoom),
-  		    translate = this._map.getPixelOrigin().add(this._location).multiplyBy(scale)
-  		        .subtract(this._map._getNewPixelOrigin(e.center, e.zoom)).round();
-
-  		if (L.Browser.any3d) {
-  			L.DomUtil.setTransform(this._image, translate, scale);
-  		} else {
-  			L.DomUtil.setPosition(this._image, translate);
-  		}
-  	},
-          _reset: function () {
-  		var image = this._image,
-  		    location = this._location,
-                      size = this._size;
-
-                  // TBD use the angle to establish the image rotation in CSS
-
-  		L.DomUtil.setPosition(image, location);
-
-  		image.style.width  = size.x + 'px';
-  		image.style.height = size.y + 'px';
-          },
-  	_updateOpacity: function () {
-  		if (!this._map) { return; }
-
-  		//L.DomUtil.setOpacity(this._image, this.options.opacity);
-
-  		var now = +new Date(),
-  		    nextFrame = false;
-
-                  var image = this._image;
-
-                  var fade = Math.min(1, (now - image.loaded) / 200);
-
-                  L.DomUtil.setOpacity(image, fade);
-                  if (fade < 1) {
-                          nextFrame = true;
-                  } 
-  		if (nextFrame) {
-  			L.Util.cancelAnimFrame(this._fadeFrame);
-  			this._fadeFrame = L.Util.requestAnimFrame(this._updateOpacity, this);
-  		}
-                  L.DomUtil.addClass(image, 'leaflet-image-loaded');
-  	}
-          
-  });
-  var imageOverlay = function (url, location, size, angle, container, options) {
-          return new ImageOverlay(url, location, size, angle, container, options);
-  };
-
-  var MapMLLayer = L.Layer.extend({
-      // zIndex has to be set, for the case where the layer is added to the
-      // map before the layercontrol is used to control it (where autoZindex is used)
-      // e.g. in the raw MapML-Leaflet-Client index.html page.
-      options: {
-          maxNext: 10,
-          zIndex: 0,
-          maxZoom: 25
-      },
-      // initialize is executed before the layer is added to a map
-      initialize: function (href, content, options) {
-          // in the custom element, the attribute is actually 'src'
-          // the _href version is the URL received from layer-@src
-          var mapml;
-          if (href) {
-              this._href = href;
-          }
-          if (content) {
-            this._layerEl = content;
-            mapml = content.querySelector('map-feature,map-tile,map-extent') ? true : false;
-            if (!href && mapml) {
-                this._content = content;
-            }
-          }
-          L.setOptions(this, options);
-          this._container = L.DomUtil.create('div', 'leaflet-layer');
-          L.DomUtil.addClass(this._container,'mapml-layer');
-          this._imageContainer = L.DomUtil.create('div', 'leaflet-layer', this._container);
-          L.DomUtil.addClass(this._imageContainer,'mapml-image-container');
-          
-          // this layer 'owns' a mapmlTileLayer, which is a subclass of L.GridLayer
-          // it 'passes' what tiles to load via the content of this._mapmlTileContainer
-          this._mapmlTileContainer = L.DomUtil.create('div', 'mapml-tile-container', this._container);
-          // hit the service to determine what its extent might be
-          // OR use the extent of the content provided
-
-          if (!mapml && content && content.hasAttribute('label')) this._title = content.getAttribute('label');
-          this._initCount = 0;
-          this._initExtent(mapml ? content : null);
-          
-          // a default extent can't be correctly set without the map to provide
-          // its bounds , projection, zoom range etc, so if that stuff's not
-          // established by metadata in the content, we should use map properties
-          // to set the extent, but the map won't be available until the <layer>
-          // element is attached to the <map> element, wait for that to happen.
-          this.on('attached', this._validateExtent, this );
-          // weirdness.  options is actually undefined here, despite the hardcoded
-          // options above. If you use this.options, you see the options defined
-          // above.  Not going to change this, but failing to understand ATM.
-          // may revisit some time.
-          this.validProjection = true; 
-      },
-      setZIndex: function (zIndex) {
-          this.options.zIndex = zIndex;
-          this._updateZIndex();
-
-          return this;
-      },
-      _updateZIndex: function () {
-          if (this._container && this.options.zIndex !== undefined && this.options.zIndex !== null) {
-              this._container.style.zIndex = this.options.zIndex;
-          }
-      },
-      _changeOpacity: function(e) {
-        if (e && e.target && e.target.value >=0 && e.target.value <= 1.0) {
-          this.changeOpacity(e.target.value);
-        }
-      },
-      changeOpacity: function(opacity) {
-          this._container.style.opacity = opacity;
-          if(this.opacityEl) this.opacityEl.value = opacity;
-      },
-      onAdd: function (map) {
-          if(this._extent && !this._validProjection(map)){
-            this.validProjection = false;
-            return;
-          }
-          this._map = map;
-          if(this._content){
-            if (!this._mapmlvectors) {
-              this._mapmlvectors = M.mapMlFeatures(this._content, {
-                // pass the vector layer a renderer of its own, otherwise leaflet
-                // puts everything into the overlayPane
-                renderer: M.featureRenderer(),
-                // pass the vector layer the container for the parent into which
-                // it will append its own container for rendering into
-                pane: this._container,
-                opacity: this.options.opacity,
-                projection:map.options.projection,
-                // each owned child layer gets a reference to the root layer
-                _leafletLayer: this,
-                static: true,
-                onEachFeature: function(properties, geometry) {
-                  // need to parse as HTML to preserve semantics and styles
-                  if (properties) {
-                    var c = document.createElement('div');
-                    c.classList.add("mapml-popup-content");
-                    c.insertAdjacentHTML('afterbegin', properties.innerHTML);
-                    geometry.bindPopup(c, {autoClose: false, minWidth: 165});
-                  }
-                }
-              });
-            }
-            map.addLayer(this._mapmlvectors);
-          } else {
-            this.once('extentload', function() {
-              if(!this._validProjection(map)){
-                this.validProjection = false;
-                return;
-              }
-              if (!this._mapmlvectors) {
-                this._mapmlvectors = M.mapMlFeatures(this._content, {
-                    // pass the vector layer a renderer of its own, otherwise leaflet
-                    // puts everything into the overlayPane
-                    renderer: M.featureRenderer(),
-                    // pass the vector layer the container for the parent into which
-                    // it will append its own container for rendering into
-                    pane: this._container,
-                    opacity: this.options.opacity,
-                    projection:map.options.projection,
-                    // each owned child layer gets a reference to the root layer
-                    _leafletLayer: this,
-                    static: true,
-                    onEachFeature: function(properties, geometry) {
-                      // need to parse as HTML to preserve semantics and styles
-                      if (properties) {
-                        var c = document.createElement('div');
-                        c.classList.add("mapml-popup-content");
-                        c.insertAdjacentHTML('afterbegin', properties.innerHTML);
-                        geometry.bindPopup(c, {autoClose: false, minWidth: 165});
-                      }
-                    }
-                  }).addTo(map);
-              }
-              this._setLayerElExtent();
-            },this);
-          }
-          
-          
-          
-          if (!this._imageLayer) {
-              this._imageLayer = L.layerGroup();
-          }
-          map.addLayer(this._imageLayer);
-          // the layer._imageContainer property contains an element in which
-          // content will be maintained
-          
-          //only add the layer if there are tiles to be rendered
-          if((!this._staticTileLayer || this._staticTileLayer._container === null) && 
-            this._mapmlTileContainer.getElementsByTagName("map-tiles").length > 0)
-          {
-            this._staticTileLayer = M.mapMLStaticTileLayer({
-              pane:this._container,
-              _leafletLayer: this,
-              className:"mapml-static-tile-layer",
-              tileContainer:this._mapmlTileContainer,
-              maxZoomBound:map.options.crs.options.resolutions.length - 1,
-              tileSize: map.options.crs.options.crs.tile.bounds.max.x,
-            });
-            map.addLayer(this._staticTileLayer);
-          }
-
-          // if the extent has been initialized and received, update the map,
-          if (this._extent) {
-              if (this._templateVars) {
-                this._templatedLayer = M.templatedLayer(this._templateVars, 
-                { pane: this._container,
-                  _leafletLayer: this,
-                  crs: this.crs
-                }).addTo(map);
-              }
-          } else {
-              this.once('extentload', function() {
-                  if(!this._validProjection(map)){
-                    this.validProjection = false;
-                    return;
-                  }
-                  if (this._templateVars) {
-                    this._templatedLayer = M.templatedLayer(this._templateVars, 
-                    { pane: this._container,
-                      _leafletLayer: this,
-                      crs: this.crs
-                    }).addTo(map);
-                    this._setLayerElExtent();
-                  }
-                }, this);
-          }
-          this._setLayerElExtent();
-          this.setZIndex(this.options.zIndex);
-          this.getPane().appendChild(this._container);
-          setTimeout(() => {
-            map.fire('checkdisabled');
-          }, 0);
-          map.on("popupopen", this._attachSkipButtons, this);
-      },
-
-      _validProjection : function(map){
-        let noLayer = false;
-        if(this._templateVars){
-          for(let template of this._templateVars)
-            if(!template.projectionMatch && template.projection !== map.options.projection) noLayer = true;
-        }
-        return !(noLayer || this.getProjection() !== map.options.projection.toUpperCase());
-      },
-
-      //sets the <layer-> elements .bounds property 
-      _setLayerElExtent: function(){
-        let localBounds, localZoomRanges;
-        let layerTypes = ["_staticTileLayer","_imageLayer","_mapmlvectors","_templatedLayer"];
-        layerTypes.forEach((type) =>{
-          if(this[type]){
-            if(type === "_templatedLayer"){
-              for(let j =0;j<this[type]._templates.length;j++){
-                if(this[type]._templates[j].rel === "query") continue;
-                if(this[type]._templates[j].layer.layerBounds){
-                  if(!localBounds){
-                    localBounds = this[type]._templates[j].layer.layerBounds;
-                    localZoomRanges = this[type]._templates[j].layer.zoomBounds;
-                  } else {
-                    localBounds.extend(this[type]._templates[j].layer.layerBounds.min);
-                    localBounds.extend(this[type]._templates[j].layer.layerBounds.max);
-                  }
-                }
-              }
-            } else {
-              if(this[type].layerBounds){
-                if(!localBounds){
-                  localBounds = this[type].layerBounds;
-                  localZoomRanges = this[type].zoomBounds;
-                } else {
-                  localBounds.extend(this[type].layerBounds.min);
-                  localBounds.extend(this[type].layerBounds.max);
-                }
-              } 
-            }
-          }
-        });
-
-        if(localBounds){
-          //assigns the formatted extent object to .extent and spreads the zoom ranges to .extent also
-          this._layerEl.extent = (Object.assign(
-                                    M.convertAndFormatPCRS(localBounds,this._map),
-                                    {zoom:localZoomRanges}));
-        }
-      },
-
-      addTo: function (map) {
-          map.addLayer(this);
-          return this;
-      },
-      getEvents: function () {
-          return {zoomanim: this._onZoomAnim};
-      },
-      redraw: function() {
-        // for now, only redraw templated layers.
-          if (this._templatedLayer) {
-            this._templatedLayer.redraw();
-          }
-      },
-      _onZoomAnim: function(e) {
-        var toZoom = e.zoom,
-            zoom = this._extent ? this._extent.querySelector("map-input[type=zoom]") : null, 
-            min = zoom && zoom.hasAttribute("min") ? parseInt(zoom.getAttribute("min")) : this._map.getMinZoom(),
-            max =  zoom && zoom.hasAttribute("max") ? parseInt(zoom.getAttribute("max")) : this._map.getMaxZoom(),
-            canZoom = (toZoom < min && this._extent.zoomout) || (toZoom > max && this._extent.zoomin);
-        if (!(min <= toZoom && toZoom <= max)){
-          if (this._extent.zoomin && toZoom > max) {
-            // this._href is the 'original' url from which this layer came
-            // since we are following a zoom link we will be getting a new
-            // layer almost, resetting child content as appropriate
-            this._href = this._extent.zoomin;
-            this._layerEl.src = this._extent.zoomin;
-            // this.href is the "public" property. When a dynamic layer is
-            // accessed, this value changes with every new extent received
-            this.href = this._extent.zoomin;
-            this._layerEl.src = this._extent.zoomin;
-          } else if (this._extent.zoomout && toZoom < min) {
-            this._href = this._extent.zoomout;
-            this.href = this._extent.zoomout;
-            this._layerEl.src = this._extent.zoomout;
-          }
-        }
-        if (this._templatedLayer && canZoom ) ;
-      },
-      onRemove: function (map) {
-          L.DomUtil.remove(this._container);
-          if(this._staticTileLayer) map.removeLayer(this._staticTileLayer);
-          if(this._mapmlvectors) map.removeLayer(this._mapmlvectors);
-          if(this._imageLayer) map.removeLayer(this._imageLayer);
-          if (this._templatedLayer) map.removeLayer(this._templatedLayer);
-
-          map.fire("checkdisabled");
-          map.off("popupopen", this._attachSkipButtons);
-      },
-      getZoomBounds: function () {
-          var ext = this._extent;
-          var zoom = ext ? ext.querySelector('[type=zoom]') : undefined,
-              min = zoom && zoom.hasAttribute('min') ? zoom.getAttribute('min') : this._map.getMinZoom(),
-              max = zoom && zoom.hasAttribute('max') ? zoom.getAttribute('max') : this._map.getMaxZoom();
-          var bounds = {};
-          bounds.min = Math.min(min,max);
-          bounds.max = Math.max(min,max);
-          return bounds;
-      },
-      _transformDeprectatedInput: function (i) {
-        var type = i.getAttribute("type").toLowerCase();
-        if (type === "xmin" || type === "ymin" || type === "xmax" || type === "ymax") {
-          i.setAttribute("type", "location");
-          i.setAttribute("units","tcrs");
-          switch (type) {
-            case "xmin":
-              i.setAttribute("axis","x");
-              i.setAttribute("position","top-left");
-              break;
-            case "ymin":
-              i.setAttribute("axis","y");
-              i.setAttribute("position","top-left");
-              break;
-            case "xmax":
-              i.setAttribute("axis","x");
-              i.setAttribute("position","bottom-right");
-              break;
-            case "ymax":
-              i.setAttribute("axis","y");
-              i.setAttribute("position","bottom-right");
-              break;
-          }
-        } 
-      },
-      // retrieve the (projected, scaled) layer extent for the current map zoom level
-      getLayerExtentBounds: function(map) {
-          
-          if (!this._extent) return;
-          var zoom = map.getZoom(), projection = map.options.projection,
-              ep = this._extent.getAttribute("units"),
-              projecting = (projection !== ep),
-              p;
-          
-          var xmin,ymin,xmax,ymax,v1,v2,extentZoomValue;
-          
-          // todo: create an array of min values, converted to tcrs units
-          // take the Math.min of all of them.
-          v1 = this._extent.querySelector('[type=xmin]').getAttribute('min');
-          v2 = this._extent.querySelector('[type=xmax]').getAttribute('min');
-          xmin = Math.min(v1,v2);
-          v1 = this._extent.querySelector('[type=xmin]').getAttribute('max');
-          v2 = this._extent.querySelector('[type=xmax]').getAttribute('max');
-          xmax = Math.max(v1,v2);
-          v1 = this._extent.querySelector('[type=ymin]').getAttribute('min');
-          v2 = this._extent.querySelector('[type=ymax]').getAttribute('min');
-          ymin = Math.min(v1,v2);
-          v1 = this._extent.querySelector('[type=ymin]').getAttribute('max');
-          v2 = this._extent.querySelector('[type=ymax]').getAttribute('max');
-          ymax = Math.max(v1,v2);
-          // WGS84 can be converted to Tiled CRS units
-          if (projecting) {
-              //project and scale to M[projection] from WGS84
-              p = M[projection];
-              var corners = [
-                p.latLngToPoint(L.latLng([ymin,xmin]),zoom),
-                p.latLngToPoint(L.latLng([ymax,xmax]),zoom), 
-                p.latLngToPoint(L.latLng([ymin,xmin]),zoom), 
-                p.latLngToPoint(L.latLng([ymin,xmax]),zoom)
-              ];
-              return L.bounds(corners);
-          } else {
-              // if the zoom level of the extent does not match that of the map
-              extentZoomValue = parseInt(this._extent.querySelector('[type=zoom]').getAttribute('value'));
-              if (extentZoomValue !== zoom) {
-                  // convert the extent bounds to corresponding bounds at the current map zoom
-                  p = M[projection];
-                  return L.bounds(
-                      p.latLngToPoint(p.pointToLatLng(L.point(xmin,ymin),extentZoomValue),zoom),
-                      p.latLngToPoint(p.pointToLatLng(L.point(xmax,ymax),extentZoomValue),zoom));
-              } else {
-                  // the extent's zoom value === map.getZoom(), return the bounds
-                  return L.bounds(L.point(xmin,ymin), L.point(xmax,ymax));
-              }
-          }
-      },
-      getAttribution: function () {
-          return this.options.attribution;
-      },
-      getLayerUserControlsHTML: function () {
-        var fieldset = L.DomUtil.create('fieldset', 'mapml-layer-item'),
-          input = L.DomUtil.create('input'),
-          layerItemName = L.DomUtil.create('span', 'mapml-layer-item-name'),
-          settingsButtonNameIcon = L.DomUtil.create('span'),
-          layerItemProperty = L.DomUtil.create('div', 'mapml-layer-item-properties', fieldset),
-          layerItemSettings = L.DomUtil.create('div', 'mapml-layer-item-settings', fieldset),
-          itemToggleLabel = L.DomUtil.create('label', 'mapml-layer-item-toggle', layerItemProperty),
-          layerItemControls = L.DomUtil.create('div', 'mapml-layer-item-controls', layerItemProperty),
-          opacityControl = L.DomUtil.create('details', 'mapml-layer-item-opacity mapml-control-layers', layerItemSettings),
-          opacity = L.DomUtil.create('input'),
-          opacityControlSummary = L.DomUtil.create('summary'),
-          svgSettingsControlIcon = L.SVG.create('svg'),
-          settingsControlPath1 = L.SVG.create('path'),
-          settingsControlPath2 = L.SVG.create('path'),
-          mapEl = this._layerEl.parentNode;
-          this.opacityEl = opacity;
-
-          // append the paths in svg for the remove layer and toggle icons
-          svgSettingsControlIcon.setAttribute('viewBox', '0 0 24 24');
-          svgSettingsControlIcon.setAttribute('height', '22');
-          svgSettingsControlIcon.setAttribute('width', '22');
-          settingsControlPath1.setAttribute('d', 'M0 0h24v24H0z');
-          settingsControlPath1.setAttribute('fill', 'none');
-          settingsControlPath2.setAttribute('d', 'M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z');
-          svgSettingsControlIcon.appendChild(settingsControlPath1);
-          svgSettingsControlIcon.appendChild(settingsControlPath2);
-          
-          layerItemSettings.hidden = true;
-          settingsButtonNameIcon.setAttribute('aria-hidden', true);
-          
-          let removeControlButton = L.DomUtil.create('button', 'mapml-layer-item-remove-control', layerItemControls);
-          removeControlButton.type = 'button';
-          removeControlButton.title = 'Remove Layer';
-          removeControlButton.innerHTML = "<span aria-hidden='true'>&#10005;</span>";
-          removeControlButton.classList.add('mapml-button');
-          //L.DomEvent.disableClickPropagation(removeControlButton);
-          L.DomEvent.on(removeControlButton, 'click', L.DomEvent.stop);
-          L.DomEvent.on(removeControlButton, 'click', (e)=>{
-            let fieldset = 0, elem, root;
-            root = mapEl.tagName === "MAPML-VIEWER" ? mapEl.shadowRoot : mapEl.querySelector(".mapml-web-map").shadowRoot;
-            if(e.target.closest("fieldset").nextElementSibling && !e.target.closest("fieldset").nextElementSibling.disbaled){
-              elem = e.target.closest("fieldset").previousElementSibling;
-              while(elem){
-                fieldset += 2; // find the next layer menu item
-                elem = elem.previousElementSibling;
-              }
-            } else {
-              // focus on the link
-              elem = "link";
-            }
-            mapEl.removeChild(e.target.closest("fieldset").querySelector("span").layer._layerEl);
-            elem = elem ? root.querySelector(".leaflet-control-attribution").firstElementChild: elem = root.querySelectorAll('input')[fieldset];
-            elem.focus();
-          }, this);
-
-          let itemSettingControlButton = L.DomUtil.create('button', 'mapml-layer-item-settings-control', layerItemControls);
-          itemSettingControlButton.type = 'button';
-          itemSettingControlButton.title = 'Layer Settings';
-          itemSettingControlButton.setAttribute('aria-expanded', false);
-          itemSettingControlButton.classList.add('mapml-button');
-          L.DomEvent.on(itemSettingControlButton, 'click', (e)=>{
-            if(layerItemSettings.hidden == true){
-              itemSettingControlButton.setAttribute('aria-expanded', true);
-              layerItemSettings.hidden = false;
-            } else {
-              itemSettingControlButton.setAttribute('aria-expanded', false);
-              layerItemSettings.hidden = true;
-            }
-          }, this);
-
-          input.defaultChecked = this._map ? true: false;
-          input.type = 'checkbox';
-          layerItemName.layer = this;
-
-          if (this._legendUrl) {
-            var legendLink = document.createElement('a');
-            legendLink.text = ' ' + this._title;
-            legendLink.href = this._legendUrl;
-            legendLink.target = '_blank';
-            legendLink.draggable = false;
-            layerItemName.appendChild(legendLink);
-          } else {
-            layerItemName.innerHTML = this._title;
-          }
-          layerItemName.id = 'mapml-layer-item-name-{' + L.stamp(layerItemName) + '}';
-          opacityControlSummary.innerText = 'Opacity';
-          opacityControlSummary.id = 'mapml-layer-item-opacity-' + L.stamp(opacityControlSummary);
-          opacityControl.appendChild(opacityControlSummary);
-          opacityControl.appendChild(opacity);
-          opacity.setAttribute('type','range');
-          opacity.setAttribute('min', '0');
-          opacity.setAttribute('max','1.0');
-          opacity.setAttribute('value', this._container.style.opacity || '1.0');
-          opacity.setAttribute('step','0.1');
-          opacity.setAttribute('aria-labelledby', opacityControlSummary.id);
-          opacity.value = this._container.style.opacity || '1.0';
-
-          fieldset.setAttribute("aria-grabbed", "false");
-          fieldset.setAttribute('aria-labelledby', layerItemName.id);
-
-          fieldset.onmousedown = (downEvent) => {
-            if(downEvent.target.tagName.toLowerCase() === "input" || downEvent.target.tagName.toLowerCase() === "select") return;
-            downEvent.preventDefault();
-            let control = fieldset,
-                controls = fieldset.parentNode,
-                moving = false, yPos = downEvent.clientY;
-
-            document.body.onmousemove = (moveEvent) => {
-              moveEvent.preventDefault();
-
-              // Fixes flickering by only moving element when there is enough space
-              let offset = moveEvent.clientY - yPos;
-              moving = Math.abs(offset) > 5 || moving;
-              if( (controls && !moving) || (controls && controls.childElementCount <= 1) || 
-                  controls.getBoundingClientRect().top > control.getBoundingClientRect().bottom || 
-                  controls.getBoundingClientRect().bottom < control.getBoundingClientRect().top){
-                    return;
-                  }
-              
-              controls.classList.add("mapml-draggable");
-              control.style.transform = "translateY("+ offset +"px)";
-              control.style.pointerEvents = "none";
-
-              let x = moveEvent.clientX, y = moveEvent.clientY,
-                  root = mapEl.tagName === "MAPML-VIEWER" ? mapEl.shadowRoot : mapEl.querySelector(".mapml-web-map").shadowRoot,
-                  elementAt = root.elementFromPoint(x, y),
-                  swapControl = !elementAt || !elementAt.closest("fieldset") ? control : elementAt.closest("fieldset");
-        
-              swapControl =  Math.abs(offset) <= swapControl.offsetHeight ? control : swapControl;
-              
-              control.setAttribute("aria-grabbed", 'true');
-              control.setAttribute("aria-dropeffect", "move");
-              if(swapControl && controls === swapControl.parentNode){
-                swapControl = swapControl !== control.nextSibling? swapControl : swapControl.nextSibling;
-                if(control !== swapControl){ 
-                  yPos = moveEvent.clientY;
-                  control.style.transform = null;
-                }
-                controls.insertBefore(control, swapControl);
-              }
-            };
-
-            document.body.onmouseup = () => {
-              control.setAttribute("aria-grabbed", "false");
-              control.removeAttribute("aria-dropeffect");
-              control.style.pointerEvents = null;
-              control.style.transform = null;
-              let controlsElems = controls.children,
-                  zIndex = 1;
-              for(let c of controlsElems){
-                let layerEl = c.querySelector("span").layer._layerEl;
-                
-                layerEl.setAttribute("data-moving","");
-                mapEl.insertAdjacentElement("beforeend", layerEl);
-                layerEl.removeAttribute("data-moving");
-
-                
-                layerEl._layer.setZIndex(zIndex);
-                zIndex++;
-              }
-              controls.classList.remove("mapml-draggable");
-              document.body.onmousemove = document.body.onmouseup = null;
-            };
-          };
-
-          L.DomEvent.on(opacity,'change', this._changeOpacity, this);
-
-          itemToggleLabel.appendChild(input);
-          itemToggleLabel.appendChild(layerItemName);
-          itemSettingControlButton.appendChild(settingsButtonNameIcon);
-          settingsButtonNameIcon.appendChild(svgSettingsControlIcon);
-
-          if (this._styles) {
-            layerItemSettings.appendChild(this._styles);
-          }
-          if (this._userInputs) {
-            var frag = document.createDocumentFragment();
-            var templates = this._templateVars;
-            if (templates) {
-              for (var i=0;i<templates.length;i++) {
-                var template = templates[i];
-                for (var j=0;j<template.values.length;j++) {
-                  var mapmlInput = template.values[j],
-                      id = '#'+mapmlInput.getAttribute('id');
-                  // don't add it again if it is referenced > once
-                  if (mapmlInput.tagName.toLowerCase() === 'map-select' && !frag.querySelector(id)) {
-                    // generate a <details><summary></summary><select...></details>
-                    var selectdetails = L.DomUtil.create('details', 'mapml-layer-item-time mapml-control-layers', frag),
-                        selectsummary = L.DomUtil.create('summary'),
-                        selectSummaryLabel = L.DomUtil.create('label');
-                        selectSummaryLabel.innerText = mapmlInput.getAttribute('name');
-                        selectSummaryLabel.setAttribute('for', mapmlInput.getAttribute('id'));
-                        selectsummary.appendChild(selectSummaryLabel);
-                        selectdetails.appendChild(selectsummary);
-                        selectdetails.appendChild(mapmlInput.htmlselect);
-                  }
-                }
-              }
-            }
-            layerItemSettings.appendChild(frag);
-          }
-          return fieldset;
-      },
-      _initExtent: function(content) {
-          if (!this._href && !content) {return;}
-          var layer = this;
-          // the this._href (comes from layer@src) should take precedence over 
-          // content of the <layer> element, but if no this._href / src is provided
-          // but there *is* child content of the <layer> element (which is copied/
-          // referred to by this._content), we should use that content.
-          if (this._href) {
-              var xhr = new XMLHttpRequest();
-  //            xhr.withCredentials = true;
-              _get(this._href, _processInitialExtent);
-          } else if (content) {
-              // may not set this._extent if it can't be done from the content
-              // (eg a single point) and there's no map to provide a default yet
-              _processInitialExtent.call(this, content);
-          }
-          function _get(url, fCallback  ) {
-              xhr.onreadystatechange = function () { 
-                if(this.readyState === this.DONE) {
-                  if (this.status === 400 || 
-                      this.status === 404 || 
-                      this.status === 500 || 
-                      this.status === 406) {
-                      layer.error = true;
-                      layer.fire('extentload', layer, true);
-                      xhr.abort();
-                  }
-                }};
-              xhr.onload = fCallback;
-              xhr.onerror = function () { 
-                layer.error = true;
-                layer.fire('extentload', layer, true);
-              };
-              xhr.open("GET", url);
-              xhr.setRequestHeader("Accept",M.mime);
-              xhr.overrideMimeType("text/xml");
-              xhr.send();
-          }
-          function transcribe(element) {
-              var select = document.createElement("select");
-              var elementAttrNames = element.getAttributeNames();
-
-              for(let i = 0; i < elementAttrNames.length; i++){
-                  select.setAttribute(elementAttrNames[i], element.getAttribute(elementAttrNames[i]));
-              }
-
-              var options = element.children;
-
-              for(let i = 0; i < options.length; i++){
-                  var option = document.createElement("option");
-                  var optionAttrNames = options[i].getAttributeNames();
-
-                  for (let j = 0; j < optionAttrNames.length; j++){
-                      option.setAttribute(optionAttrNames[j], options[i].getAttribute(optionAttrNames[j]));
-                  }
-
-                  option.innerHTML = options[i].innerHTML;
-                  select.appendChild(option);
-              }
-              return select;
-          }
-
-          function _processInitialExtent(content) {
-              var mapml = this.responseXML || content;
-              if(mapml.querySelector && mapml.querySelector('map-feature'))layer._content = mapml;
-              if(!this.responseXML && this.responseText) mapml = new DOMParser().parseFromString(this.responseText,'text/xml');
-              if (this.readyState === this.DONE && mapml.querySelector && !mapml.querySelector("parsererror")) {
-                  var serverExtent = mapml.querySelector('map-extent') || mapml.querySelector('map-meta[name=projection]'), projection;
-
-                  if (serverExtent.tagName.toLowerCase() === "map-extent" && serverExtent.hasAttribute('units')){
-                    projection = serverExtent.getAttribute("units");
-                  } else if (serverExtent.tagName.toLowerCase() === "map-meta" && serverExtent.hasAttribute('content')) {
-                    projection = M.metaContentToObject(serverExtent.getAttribute('content')).content;
-                  }
-                      
-                  var projectionMatch = projection && projection === layer.options.mapprojection,
-                      metaExtent = mapml.querySelector('map-meta[name=extent]'),
-                      selectedAlternate = !projectionMatch && mapml.querySelector('map-head map-link[rel=alternate][projection='+layer.options.mapprojection+']'),
-                      
-                      base = 
-        (new URL(mapml.querySelector('map-base') ? mapml.querySelector('map-base').getAttribute('href') : mapml.baseURI || this.responseURL, this.responseURL)).href;
-                  
-                  if (!serverExtent) {
-                      serverExtent = layer._synthesizeExtent(mapml);
-                      // the mapml resource does not have a (complete) extent form, save
-                      // its content if any so we don't have to revisit the server, ever.
-                      if (mapml.querySelector('map-feature,map-tile')) {
-                          layer._content = mapml;
-                      }
-                  } else if (!projectionMatch && selectedAlternate && selectedAlternate.hasAttribute('href')) {
-                       
-                      layer.fire('changeprojection', {href:  (new URL(selectedAlternate.getAttribute('href'), base)).href}, false);
-                      return;
-                  } else if (!projectionMatch && layer._map && layer._map.options.mapEl.querySelectorAll("layer-").length === 1){
-                    layer._map.options.mapEl.projection = projection;
-                    return;
-                  } else if (serverExtent.querySelector('map-link[rel=tile],map-link[rel=image],map-link[rel=features],map-link[rel=query]') &&
-                          serverExtent.hasAttribute("units")) {
-                    layer._templateVars = [];
-                    // set up the URL template and associated inputs (which yield variable values when processed)
-                    var tlist = serverExtent.querySelectorAll('map-link[rel=tile],map-link[rel=image],map-link[rel=features],map-link[rel=query]'),
-                        varNamesRe = (new RegExp('(?:\{)(.*?)(?:\})','g')),
-                        zoomInput = serverExtent.querySelector('map-input[type="zoom" i]'),
-                        includesZoom = false, extentFallback = {};
-
-                    extentFallback.zoom = 0;
-                    if (metaExtent){
-                      // if the extent is not in PCRS or GCRS, the user should supply
-                      // a zoom=n key within the meta content, so that the PCRS bounds
-                      // can be calculated
-                      let content = M.metaContentToObject(metaExtent.getAttribute("content"));
-                      
-                      // the extentFallback.zoom is used to calculate the PCRS bounds
-                      extentFallback.zoom = content.zoom || extentFallback.zoom;
-      
-                      let metaKeys = Object.keys(content);
-                      for(let i =0;i<metaKeys.length;i++){
-                        if(!metaKeys[i].includes("zoom")){
-                          // deduce the CS from the first recognized axis name, quit
-                          extentFallback.cs = M.axisToCS(metaKeys[i].split("-")[2]);
-                          break;
-                        }
-                      }
-                      let axes = M.csToAxes(extentFallback.cs);
-                      extentFallback.bounds = M.boundsToPCRSBounds(
-                        L.bounds(L.point(+content[`top-left-${axes[0]}`],+content[`top-left-${axes[1]}`]),
-                        L.point(+content[`bottom-right-${axes[0]}`],+content[`bottom-right-${axes[1]}`])),
-                        extentFallback.zoom, projection, extentFallback.cs);
-                      
-                    } else {
-                      extentFallback.bounds = M[projection].options.crs.pcrs.bounds;
-                      extentFallback.cs = "PCRS";
-                    }
-                      
-                    for (var i=0;i< tlist.length;i++) {
-                      var t = tlist[i], template = t.getAttribute('tref'); 
-                      if(!template){
-                        template = BLANK_TT_TREF;
-                        let blankInputs = mapml.querySelectorAll('map-input');
-                        for (let i of blankInputs){
-                          template += `{${i.getAttribute("name")}}`;
-                        }
-                      }
-                      
-                      var v,
-                          title = t.hasAttribute('title') ? t.getAttribute('title') : 'Query this layer',
-                          vcount=template.match(varNamesRe),
-                          trel = (!t.hasAttribute('rel') || t.getAttribute('rel').toLowerCase() === 'tile') ? 'tile' : t.getAttribute('rel').toLowerCase(),
-                          ttype = (!t.hasAttribute('type')? 'image/*':t.getAttribute('type').toLowerCase()),
-                          inputs = [],
-                          tms = t && t.hasAttribute("tms");
-                          var zoomBounds = mapml.querySelector('map-meta[name=zoom]')?
-                                            M.metaContentToObject(mapml.querySelector('map-meta[name=zoom]').getAttribute('content')):
-                                            undefined;
-                      while ((v = varNamesRe.exec(template)) !== null) {
-                        var varName = v[1],
-                            inp = serverExtent.querySelector('map-input[name='+varName+'],map-select[name='+varName+']');
-                        if (inp) {
-                          // if location input is missing min/max, force set the
-                          // fallback min/max from the extentFallback
-                          if ((inp.hasAttribute("type") && inp.getAttribute("type")==="location") && 
-                              (!inp.hasAttribute("min" )) && 
-                              (inp.hasAttribute("axis") && !["i","j"].includes(inp.getAttribute("axis").toLowerCase()))){
-                            zoomInput.setAttribute("value", extentFallback.zoom);
-                            // set location input min/max axis values based on calculated 
-                            // and potentially converted from PCRS bounds read
-                            // from the <map-meta> element.  This is a fallback, but it only
-                            // works when the file includes location inputs.
-                            let axis = inp.getAttribute("axis"), 
-                                axisBounds = M.convertPCRSBounds(extentFallback.bounds, extentFallback.zoom, projection, M.axisToCS(axis));
-                            inp.setAttribute("min", axisBounds.min[M.axisToXY(axis)]);
-                            inp.setAttribute("max", axisBounds.max[M.axisToXY(axis)]);
-                          }
-
-                          inputs.push(inp);
-                          includesZoom = includesZoom || inp.hasAttribute("type") && inp.getAttribute("type").toLowerCase() === "zoom";
-                          if (inp.hasAttribute('shard')) {
-                            var id = inp.getAttribute('list');
-                            inp.servers = [];
-                            var servers = serverExtent.querySelectorAll('map-datalist#'+id + ' > map-option');
-                            if (servers.length === 0 && inp.hasAttribute('value')) {
-                              servers = inp.getAttribute('value').split('');
-                            }
-                            for (var s=0;s < servers.length;s++) {
-                              if (servers[s].getAttribute) {
-                                inp.servers.push(servers[s].getAttribute('value'));
-                              } else {
-                                inp.servers.push(servers[s]);
-                              }
-                            }
-                          } else if (inp.tagName.toLowerCase() === 'map-select') {
-                            // use a throwaway div to parse the input from MapML into HTML
-                            var div =document.createElement("div");
-                            div.insertAdjacentHTML("afterbegin",inp.outerHTML);
-                            // parse
-                            inp.htmlselect = div.querySelector("map-select");
-                            inp.htmlselect = transcribe(inp.htmlselect);
-
-                            // this goes into the layer control, so add a listener
-                            L.DomEvent.on(inp.htmlselect, 'change', layer.redraw, layer);
-                            if (!layer._userInputs) {
-                              layer._userInputs = [];
-                            }
-                            layer._userInputs.push(inp.htmlselect);
-                          }
-                          // TODO: if this is an input@type=location 
-                          // get the TCRS min,max attribute values at the identified zoom level 
-                          // save this information as properties of the serverExtent,
-                          // perhaps as a bounds object so that it can be easily used
-                          // later by the layer control to determine when to enable
-                          // disable the layer for drawing.
-                        } else {
-                          console.log('input with name='+varName+' not found for template variable of same name');
-                          // no match found, template won't be used
-                          break;
-                        }
-                      }
-                      if (template && vcount.length === inputs.length || template === BLANK_TT_TREF) {
-                        if (trel === 'query') {
-                          layer.queryable = true;
-                        }
-                        if(!includesZoom && zoomInput) {
-                          inputs.push(zoomInput);
-                        }
-                        // template has a matching input for every variable reference {varref}
-                        layer._templateVars.push({
-                          template:decodeURI(new URL(template, base)), 
-                          linkEl: t,
-                          title:title, 
-                          rel: trel, 
-                          type: ttype, 
-                          values: inputs, 
-                          zoomBounds:zoomBounds, 
-                          extentPCRSFallback: {bounds: extentFallback.bounds}, 
-                          projectionMatch: projectionMatch || selectedAlternate,
-                          projection:serverExtent.getAttribute("units") || FALLBACK_PROJECTION,
-                          tms:tms,
-                        });
-                      }
-                    }
-                  }
-                  layer._parseLicenseAndLegend(mapml, layer);
-                  layer._extent = serverExtent;
-                  
-                  
-                  var zoomin = mapml.querySelector('map-link[rel=zoomin]'),
-                      zoomout = mapml.querySelector('map-link[rel=zoomout]');
-                  delete layer._extent.zoomin;
-                  delete layer._extent.zoomout;
-                  if (zoomin) {
-                      layer._extent.zoomin = (new URL(zoomin.getAttribute('href'), base)).href;
-                  }
-                  if (zoomout) {
-                      layer._extent.zoomout = (new URL(zoomout.getAttribute('href'), base)).href;
-                  }
-                  if (layer._templatedLayer) {
-                    layer._templatedLayer.reset(layer._templateVars);
-                  }
-                  if (mapml.querySelector('map-tile')) {
-                    var tiles = document.createElement("map-tiles"),
-                      zoom = mapml.querySelector('map-meta[name=zoom][content]') || mapml.querySelector('map-input[type=zoom][value]');
-                    tiles.setAttribute("zoom", zoom && zoom.getAttribute('content') || zoom && zoom.getAttribute('value') || "0");
-                    var newTiles = mapml.getElementsByTagName('map-tile');
-                    for (var nt=0;nt<newTiles.length;nt++) {
-                        tiles.appendChild(document.importNode(newTiles[nt], true));
-                    }
-                    layer._mapmlTileContainer.appendChild(tiles);
-                  }
-                  M.parseStylesheetAsHTML(mapml, base, layer._container);
-                  var styleLinks = mapml.querySelectorAll('map-link[rel=style],map-link[rel="self style"],map-link[rel="style self"]');
-                  if (styleLinks.length > 1) {
-                    var stylesControl = document.createElement('details'),
-                    stylesControlSummary = document.createElement('summary');
-                    stylesControlSummary.innerText = 'Style';
-                    stylesControl.appendChild(stylesControlSummary);
-                    var changeStyle = function (e) {
-                        layer.fire('changestyle', {src: e.target.getAttribute("data-href")}, false);
-                    };
-
-                    for (var j=0;j<styleLinks.length;j++) {
-                      var styleOption = document.createElement('div'),
-                      styleOptionInput = styleOption.appendChild(document.createElement('input'));
-                      styleOptionInput.setAttribute("type", "radio");
-                      styleOptionInput.setAttribute("id", "rad-"+L.stamp(styleOptionInput));
-                      styleOptionInput.setAttribute("name", "styles-"+layer._title);
-                      styleOptionInput.setAttribute("value", styleLinks[j].getAttribute('title'));
-                      styleOptionInput.setAttribute("data-href", new URL(styleLinks[j].getAttribute('href'),base).href);
-                      var styleOptionLabel = styleOption.appendChild(document.createElement('label'));
-                      styleOptionLabel.setAttribute("for", "rad-"+L.stamp(styleOptionInput));
-                      styleOptionLabel.innerText = styleLinks[j].getAttribute('title');
-                      if (styleLinks[j].getAttribute("rel") === "style self" || styleLinks[j].getAttribute("rel") === "self style") {
-                        styleOptionInput.checked = true;
-                      }
-                      stylesControl.appendChild(styleOption);
-                      L.DomUtil.addClass(stylesControl,'mapml-layer-item-style mapml-control-layers');
-                      L.DomEvent.on(styleOptionInput,'click', changeStyle, layer);
-                    }
-                    layer._styles = stylesControl;
-                  }
-                  
-                  if (mapml.querySelector('map-title')) {
-                    layer._title = mapml.querySelector('map-title').textContent.trim();
-                  } else if (mapml instanceof Element && mapml.hasAttribute('label')) {
-                    layer._title = mapml.getAttribute('label').trim();
-                  }
-                  if (layer._map) {
-                      layer._validateExtent();
-                      // if the layer is checked in the layer control, force the addition
-                      // of the attribution just received
-                      if (layer._map.hasLayer(layer)) {
-                          layer._map.attributionControl.addAttribution(layer.getAttribution());
-                      }
-                      //layer._map.fire('moveend', layer);
-                  }
-              } else {
-                  layer.error = true;
-              }
-              layer.fire('extentload', layer, false);
-              layer._layerEl.dispatchEvent(new CustomEvent('extentload', {detail: layer,}));
-          }
-      },
-      _createExtent: function () {
-      
-          var extent = document.createElement('map-extent'),
-              xminInput = document.createElement('map-input'),
-              yminInput = document.createElement('map-input'),
-              xmaxInput = document.createElement('map-input'),
-              ymaxInput = document.createElement('map-input'),
-              zoom = document.createElement('map-input'),
-              projection = document.createElement('map-input');
-      
-          zoom.setAttribute('type','zoom');
-          zoom.setAttribute('min','0');
-          zoom.setAttribute('max','0');
-          
-          xminInput.setAttribute('type','xmin');
-          xminInput.setAttribute('min','');
-          xminInput.setAttribute('max','');
-          
-          yminInput.setAttribute('type','ymin');
-          yminInput.setAttribute('min','');
-          yminInput.setAttribute('max','');
-          
-          xmaxInput.setAttribute('type','xmax');
-          xmaxInput.setAttribute('min','');
-          xmaxInput.setAttribute('max','');
-
-          ymaxInput.setAttribute('type','ymax');
-          ymaxInput.setAttribute('min','');
-          ymaxInput.setAttribute('max','');
-          
-          projection.setAttribute('type','projection');
-          projection.setAttribute('value','WGS84');
-          
-          extent.appendChild(xminInput);
-          extent.appendChild(yminInput);
-          extent.appendChild(xmaxInput);
-          extent.appendChild(ymaxInput);
-          extent.appendChild(zoom);
-          extent.appendChild(projection);
-
-          return extent;
-      },
-      _validateExtent: function () {
-        // TODO: change so that the _extent bounds are set based on inputs
-          var serverExtent = this._extent;
-          if (!serverExtent || !serverExtent.querySelector || !this._map) {
-              return;
-          }
-          if (serverExtent.querySelector('[type=xmin][min=""], [type=xmin][max=""], [type=xmax][min=""], [type=xmax][max=""], [type=ymin][min=""], [type=ymin][max=""]')) {
-              var xmin = serverExtent.querySelector('[type=xmin]'),
-                  ymin = serverExtent.querySelector('[type=ymin]'),
-                  xmax = serverExtent.querySelector('[type=xmax]'),
-                  ymax = serverExtent.querySelector('[type=ymax]'),
-                  proj = serverExtent.querySelector('[type=projection][value]'),
-                  bounds, projection;
-              if (proj) {
-                  projection = proj.getAttribute('value');
-                  if (projection && projection === 'WGS84') {
-                      bounds = this._map.getBounds();
-                      xmin.setAttribute('min',bounds.getWest());
-                      xmin.setAttribute('max',bounds.getEast());
-                      ymin.setAttribute('min',bounds.getSouth());
-                      ymin.setAttribute('max',bounds.getNorth());
-                      xmax.setAttribute('min',bounds.getWest());
-                      xmax.setAttribute('max',bounds.getEast());
-                      ymax.setAttribute('min',bounds.getSouth());
-                      ymax.setAttribute('max',bounds.getNorth());
-                  } else if (projection) {
-                      // needs testing.  Also, this will likely be
-                      // messing with a server-generated extent.
-                      bounds = this._map.getPixelBounds();
-                      xmin.setAttribute('min',bounds.getBottomLeft().x);
-                      xmin.setAttribute('max',bounds.getTopRight().x);
-                      ymin.setAttribute('min',bounds.getTopRight().y);
-                      ymin.setAttribute('max',bounds.getBottomLeft().y);
-                      xmax.setAttribute('min',bounds.getBottomLeft().x);
-                      xmax.setAttribute('max',bounds.getTopRight().x);
-                      ymax.setAttribute('min',bounds.getTopRight().y);
-                      ymax.setAttribute('max',bounds.getBottomLeft().y);
-                  }
-              } else {
-                  this.error = true;
-              }
-
-          }
-          if (serverExtent.querySelector('[type=zoom][min=""], [type=zoom][max=""]')) {
-              var zoom = serverExtent.querySelector('[type=zoom]');
-              zoom.setAttribute('min',this._map.getMinZoom());
-              zoom.setAttribute('max',this._map.getMaxZoom());
-          }
-          var lp = serverExtent.hasAttribute("units") ? serverExtent.getAttribute("units") : null;
-          if (lp && M[lp]) {
-            this.crs = M[lp];
-          } else {
-            this.crs = M.OSMTILE;
-          }
-      },
-      _getMapMLExtent: function (bounds, zooms, proj) {
-          
-          var extent = this._createExtent(),
-              zoom = extent.querySelector('map-input[type=zoom]'),
-              xminInput = extent.querySelector('map-input[type=xmin]'),
-              yminInput = extent.querySelector('map-input[type=ymin]'),
-              xmaxInput = extent.querySelector('map-input[type=xmax]'),
-              ymaxInput = extent.querySelector('map-input[type=ymax]'),
-              projection = extent.querySelector('map-input[type=projection]'),
-              zmin = zooms[0] !== undefined && zooms[1] !== undefined ? Math.min(zooms[0],zooms[1]) : '',
-              zmax = zooms[0] !== undefined && zooms[1] !== undefined ? Math.max(zooms[0],zooms[1]) : '',
-              xmin = bounds ? bounds._southWest ? bounds.getWest() : bounds.getBottomLeft().x : '',
-              ymin = bounds ? bounds._southWest ? bounds.getSouth() : bounds.getTopRight().y : '',
-              xmax = bounds ? bounds._southWest ? bounds.getEast() : bounds.getTopRight().x : '',
-              ymax = bounds ? bounds._southWest ? bounds.getNorth() : bounds.getBottomLeft().y : '';
-      
-          zoom.setAttribute('min', typeof(zmin) === 'number' && isNaN(zmin)? '' : zmin);
-          zoom.setAttribute('max', typeof(zmax) === 'number' && isNaN(zmax)? '' : zmax);
-          
-          xminInput.setAttribute('min',xmin);
-          xminInput.setAttribute('max',xmax);
-          
-          yminInput.setAttribute('min',ymin);
-          yminInput.setAttribute('max',ymax);
-          
-          xmaxInput.setAttribute('min',xmin);
-          xmaxInput.setAttribute('max',xmax);
-
-          ymaxInput.setAttribute('min',ymin);
-          ymaxInput.setAttribute('max',ymax);
-          
-          projection.setAttribute('value',bounds && bounds._southWest && !proj ? 'WGS84' : proj);
-
-          return extent;
-      },
-      _synthesizeExtent: function (mapml) {
-          var metaZoom = mapml.querySelectorAll('map-meta[name=zoom]')[0],
-              metaExtent = mapml.querySelector('map-meta[name=extent]'),
-              metaProjection = mapml.querySelector('map-meta[name=projection]'),
-              proj = metaProjection ? metaProjection.getAttribute('content'): FALLBACK_PROJECTION,
-              i,expressions,bounds,zmin,zmax,xmin,ymin,xmax,ymax,expr,lhs,rhs;
-          if (metaZoom) {
-              expressions = metaZoom.getAttribute('content').split(',');
-              for (i=0;i<expressions.length;i++) {
-                expr = expressions[i].split('=');
-                lhs = expr[0];
-                rhs=expr[1];
-                if (lhs === 'min') {
-                  zmin = parseInt(rhs);
-                }
-                if (lhs === 'max') {
-                  zmax = parseInt(rhs);
-                }
-              }
-          }  
-          if (metaExtent) {
-              expressions = metaExtent.getAttribute('content').split(',');
-              for (i=0;i<expressions.length;i++) {
-                expr = expressions[i].split('=');
-                lhs = expr[0];
-                rhs=expr[1];
-                if (lhs === 'xmin') {
-                  xmin = parseFloat(rhs);
-                }
-                if (lhs === 'xmax') {
-                  xmax = parseFloat(rhs);
-                }
-                if (lhs === 'ymin') {
-                  ymin = parseFloat(rhs);
-                }
-                if (lhs === 'ymax') {
-                  ymax = parseFloat(rhs);
-                }
-              }
-          }
-          if (xmin && ymin && xmax && ymax && proj === 'WGS84') {
-              var sw = L.latLng(ymin,xmin), ne = L.latLng(ymax,xmax);
-              bounds = L.latLngBounds(sw,ne);
-          } else if (xmin && ymin && xmax && ymax) {
-              // needs testing
-              bounds = L.bounds([[xmin,ymin],[xmax,ymax]]);
-          }
-          return this._getMapMLExtent(bounds, [zmin,zmax], proj);
-      },
-      // a layer must share a projection with the map so that all the layers can
-      // be overlayed in one coordinate space.  WGS84 is a 'wildcard', sort of.
-      getProjection: function () {
-        let extent = this._extent;
-        if(!extent) return FALLBACK_PROJECTION;
-        switch (extent.tagName.toUpperCase()) {
-          case "MAP-EXTENT":
-            if(extent.hasAttribute('units'))
-              return extent.getAttribute('units').toUpperCase();
-            break;
-          case "MAP-INPUT":
-            if(extent.hasAttribute('value'))
-              return extent.getAttribute('value').toUpperCase();
-            break;
-          case "MAP-META":
-            if(extent.hasAttribute('content'))
-              return M.metaContentToObject(extent.getAttribute('content')).content.toUpperCase(); 
-            break;
-          default:
-            return FALLBACK_PROJECTION; 
-        }
-        return FALLBACK_PROJECTION;
-      },
-      _parseLicenseAndLegend: function (xml, layer) {
-          var licenseLink =  xml.querySelector('map-link[rel=license]'), licenseTitle, licenseUrl, attText;
-          if (licenseLink) {
-              licenseTitle = licenseLink.getAttribute('title');
-              licenseUrl = licenseLink.getAttribute('href');
-              attText = '<a href="' + licenseUrl + '" title="'+licenseTitle+'">'+licenseTitle+'</a>';
-          }
-          L.setOptions(layer,{attribution:attText});
-          var legendLink = xml.querySelector('map-link[rel=legend]');
-          if (legendLink) {
-            layer._legendUrl = legendLink.getAttribute('href');
-          }
-      },
-      // return the LatLngBounds of the map unprojected such that the whole
-      // map is covered, not just a band defined by the projected map bounds.
-      _getUnprojectedMapLatLngBounds: function(map) {
-        
-          map = map||this._map; 
-          var origin = map.getPixelOrigin(),
-            bounds = map.getPixelBounds(),
-            nw = map.unproject(origin),
-            sw = map.unproject(bounds.getBottomLeft()),
-            ne = map.unproject(bounds.getTopRight()),
-            se = map.unproject(origin.add(map.getSize()));
-          return L.latLngBounds(sw,ne).extend(se).extend(nw);
-      },
-      // this takes into account that WGS84 is considered a wildcard match.
-      _projectionMatches: function(map) {
-          map = map||this._map;
-          var projection = this.getProjection();
-          if (!map.options.projection || projection !== 'WGS84' && map.options.projection !== projection) return false;
-          return true;
-      },
-      getQueryTemplates: function() {
-          if (this._templatedLayer && this._templatedLayer._queries) {
-            return this._templatedLayer._queries;
-          }
-      },
-      _attachSkipButtons: function(e){
-        let popup = e.popup, map = e.target, layer, group,
-            content = popup._container.getElementsByClassName("mapml-popup-content")[0];
-
-        popup._container.setAttribute("role", "dialog");
-        content.setAttribute("tabindex", "-1");
-        // https://github.com/Maps4HTML/Web-Map-Custom-Element/pull/467#issuecomment-844307818
-        content.setAttribute("role", "document");
-        popup._count = 0; // used for feature pagination
-
-        if(popup._source._eventParents){ // check if the popup is for a feature or query
-          layer = popup._source._eventParents[Object.keys(popup._source._eventParents)[0]]; // get first parent of feature, there should only be one
-          group = popup._source.group;
-        } else {
-          layer = popup._source._templatedLayer;
-        }
-
-        if(popup._container.querySelector('nav[class="mapml-focus-buttons"]')){
-          L.DomUtil.remove(popup._container.querySelector('nav[class="mapml-focus-buttons"]'));
-          L.DomUtil.remove(popup._container.querySelector('hr'));
-        }
-        //add when popopen event happens instead
-        let div = L.DomUtil.create("nav", "mapml-focus-buttons");
-
-        // creates |< button, focuses map
-        let mapFocusButton = L.DomUtil.create("button", "mapml-popup-button", div);
-        mapFocusButton.type = "button";
-        mapFocusButton.title = "Focus Map";
-        mapFocusButton.innerHTML = "<span aria-hidden='true'>|&#10094;</span>";
-        L.DomEvent.disableClickPropagation(mapFocusButton);
-        L.DomEvent.on(mapFocusButton, 'click', L.DomEvent.stop);
-        L.DomEvent.on(mapFocusButton, 'click', (e)=>{
-          map.closePopup();
-          map._container.focus();
-        }, popup);
-
-        // creates < button, focuses previous feature, if none exists focuses the current feature
-        let previousButton = L.DomUtil.create("button", "mapml-popup-button", div);
-        previousButton.type = "button";
-        previousButton.title = "Previous Feature";
-        previousButton.innerHTML = "<span aria-hidden='true'>&#10094;</span>";
-        L.DomEvent.disableClickPropagation(previousButton);
-        L.DomEvent.on(previousButton, 'click', L.DomEvent.stop);
-        L.DomEvent.on(previousButton, 'click', layer._previousFeature, popup);
-
-        // static feature counter that 1/1
-        let featureCount = L.DomUtil.create("p", "mapml-feature-count", div),
-            totalFeatures = this._totalFeatureCount ? this._totalFeatureCount : 1;
-        featureCount.innerText = (popup._count + 1)+"/"+totalFeatures;
-
-        // creates > button, focuses next feature, if none exists focuses the current feature
-        let nextButton = L.DomUtil.create("button", "mapml-popup-button", div);
-        nextButton.type = "button";
-        nextButton.title = "Next Feature";
-        nextButton.innerHTML = "<span aria-hidden='true'>&#10095;</span>";
-        L.DomEvent.disableClickPropagation(nextButton);
-        L.DomEvent.on(nextButton, 'click', L.DomEvent.stop);
-        L.DomEvent.on(nextButton, 'click', layer._nextFeature, popup);
-        
-        // creates >| button, focuses map controls
-        let controlFocusButton = L.DomUtil.create("button", "mapml-popup-button", div);
-        controlFocusButton.type = "button";
-        controlFocusButton.title = "Focus Controls";
-        controlFocusButton.innerHTML = "<span aria-hidden='true'>&#10095;|</span>";
-        L.DomEvent.disableClickPropagation(controlFocusButton);
-        L.DomEvent.on(controlFocusButton, 'click', L.DomEvent.stop);
-        L.DomEvent.on(controlFocusButton, 'click', (e) => {
-          map.closePopup();
-          map._controlContainer.querySelector("A").focus();
-        }, popup);
-    
-        let divider = L.DomUtil.create("hr");
-
-        popup._navigationBar = div;
-        popup._content.appendChild(divider);
-        popup._content.appendChild(div);
-        
-        content.focus();
-
-        if(group) {
-          // e.target = this._map
-          // Looks for keydown, more specifically tab and shift tab
-          group.setAttribute("aria-expanded", "true");
-          map.on("keydown", focusFeature);
-        } else {
-          map.on("keydown", focusMap);
-        }
-        // When popup is open, what gets focused with tab needs to be done using JS as the DOM order is not in an accessibility friendly manner
-        function focusFeature(focusEvent){
-          let path = focusEvent.originalEvent.path || focusEvent.originalEvent.composedPath();
-          let isTab = focusEvent.originalEvent.keyCode === 9,
-              shiftPressed = focusEvent.originalEvent.shiftKey;
-          if((path[0].classList.contains("leaflet-popup-close-button") && isTab && !shiftPressed) || focusEvent.originalEvent.keyCode === 27){
-            L.DomEvent.stop(focusEvent);
-            map.closePopup(popup);
-            group.focus();
-          } else if ((path[0].title==="Focus Map" || path[0].classList.contains("mapml-popup-content")) && isTab && shiftPressed){
-            setTimeout(() => { //timeout needed so focus of the feature is done even after the keypressup event occurs
-              L.DomEvent.stop(focusEvent);
-              map.closePopup(popup);
-              group.focus();
-            }, 0);
-          }
-        }
-
-        function focusMap(focusEvent){
-          let path = focusEvent.originalEvent.path || focusEvent.originalEvent.composedPath();
-          let isTab = focusEvent.originalEvent.keyCode === 9,
-          shiftPressed = focusEvent.originalEvent.shiftKey;
-
-          if((focusEvent.originalEvent.keyCode === 13 && path[0].classList.contains("leaflet-popup-close-button")) || focusEvent.originalEvent.keyCode === 27 ){
-            L.DomEvent.stopPropagation(focusEvent);
-            map._container.focus();
-            map.closePopup(popup);
-            if(focusEvent.originalEvent.keyCode !== 27)map._popupClosed = true;
-          } else if (isTab && path[0].classList.contains("leaflet-popup-close-button")){
-            map.closePopup(popup);
-          } else if ((path[0].title==="Focus Map" || path[0].classList.contains("mapml-popup-content")) && isTab && shiftPressed){
-            setTimeout(() => { //timeout needed so focus of the feature is done even after the keypressup event occurs
-              L.DomEvent.stop(focusEvent);
-              map.closePopup(popup);
-              map._container.focus();
-            }, 0);
-          }
-        }
-
-        // if popup closes then the focusFeature handler can be removed
-        map.on("popupclose", removeHandlers);
-        function removeHandlers(removeEvent){
-          if (removeEvent.popup === popup){
-            map.off("keydown", focusFeature);
-            map.off("keydown", focusMap);
-            map.off('popupclose', removeHandlers);
-            if(group) group.setAttribute("aria-expanded", "false");
-          }
-        }
-      },
-  });
-  var mapMLLayer = function (url, node, options) {
-    if (!url && !node) return null;
-  	return new MapMLLayer(url, node, options);
-  };
-
-  var DebugOverlay = L.Layer.extend({
-
-    onAdd: function (map) {
-
-      let mapSize = map.getSize();
-
-      //conditionally show container for debug panel/banner only when the map has enough space for it
-      if (mapSize.x > 400 || mapSize.y > 300) {
-        this._container = L.DomUtil.create("table", "mapml-debug", map._container);
-
-        this._panel = debugPanel({
-          className: "mapml-debug-panel",
-          pane: this._container,
-        });
-        map.addLayer(this._panel);
-
-      }
-
-      this._grid = debugGrid({
-        className: "mapml-debug-grid",
-        pane: map._panes.mapPane,
-        zIndex: 400,
-        tileSize: map.options.crs.options.crs.tile.bounds.max.x,
-      });
-      map.addLayer(this._grid);
-
-      this._vectors = debugVectors({
-        className: "mapml-debug-vectors",
-        pane: map._panes.mapPane,
-        toolPane: this._container,
-      });
-      map.addLayer(this._vectors);
-    },
-
-    onRemove: function (map) {
-      map.removeLayer(this._grid);
-      map.removeLayer(this._vectors);
-      if (this._panel) {  //conditionally remove the panel, as it's not always added
-        map.removeLayer(this._panel);
-        L.DomUtil.remove(this._container);
-      }
-    },
-
-  });
-
-  var debugOverlay = function () {
-    return new DebugOverlay();
-  };
-
-  var DebugPanel = L.Layer.extend({
-
-    initialize: function (options) {
-      L.setOptions(this, options);
-    },
-
-    onAdd: function (map) {
-
-      this._title = L.DomUtil.create("caption", "mapml-debug-banner", this.options.pane);
-      this._title.innerHTML = "Debug mode";
-
-      map.debug = {};
-      map.debug._infoContainer = this._debugContainer = L.DomUtil.create("tbody", "mapml-debug-panel", this.options.pane);
-
-      let infoContainer = map.debug._infoContainer;
-
-      map.debug._tileCoord = L.DomUtil.create("tr", "mapml-debug-coordinates", infoContainer);
-      map.debug._tileMatrixCoord = L.DomUtil.create("tr", "mapml-debug-coordinates", infoContainer);
-      map.debug._mapCoord = L.DomUtil.create("tr", "mapml-debug-coordinates", infoContainer);
-      map.debug._tcrsCoord = L.DomUtil.create("tr", "mapml-debug-coordinates", infoContainer);
-      map.debug._pcrsCoord = L.DomUtil.create("tr", "mapml-debug-coordinates", infoContainer);
-      map.debug._gcrsCoord = L.DomUtil.create("tr", "mapml-debug-coordinates", infoContainer);
-
-      this._map.on("mousemove", this._updateCoords);
-
-    },
-    onRemove: function () {
-      L.DomUtil.remove(this._title);
-      if (this._debugContainer) {
-        L.DomUtil.remove(this._debugContainer);
-        this._map.off("mousemove", this._updateCoords);
-      }
-    },
-    _updateCoords: function (e) {
-      if (this.contextMenu._visible) return;
-      let mapEl = this.options.mapEl,
-        point = mapEl._map.project(e.latlng),
-        scale = mapEl._map.options.crs.scale(+mapEl.zoom),
-        pcrs = mapEl._map.options.crs.transformation.untransform(point, scale),
-        tileSize = mapEl._map.options.crs.options.crs.tile.bounds.max.x,
-        pointI = point.x % tileSize, pointJ = point.y % tileSize;
-
-      if (pointI < 0) pointI += tileSize;
-      if (pointJ < 0) pointJ += tileSize;
-
-      this.debug._tileCoord.innerHTML = `
-      <th scope="row">tile: </th>
-      <td>i: ${Math.trunc(pointI)}, </td>
-      <td>j: ${Math.trunc(pointJ)}</td>
-      `;
-      this.debug._mapCoord.innerHTML = `
-      <th scope="row">map: </th>
-      <td>i: ${Math.trunc(e.containerPoint.x)}, </td>
-      <td>j: ${Math.trunc(e.containerPoint.y)}</td>
-      `;
-      this.debug._gcrsCoord.innerHTML = `
-      <th scope="row">gcrs: </th>
-      <td>lon: ${e.latlng.lng.toFixed(6)}, </td>
-      <td>lat: ${e.latlng.lat.toFixed(6)}</td>
-      `;
-      this.debug._tcrsCoord.innerHTML = `
-      <th scope="row">tcrs: </th>
-      <td>x: ${Math.trunc(point.x)}, </td>
-      <td>y: ${Math.trunc(point.y)}</td>
-      `;
-      this.debug._tileMatrixCoord.innerHTML = `
-      <th scope="row">tilematrix: </th>
-      <td>column: ${Math.trunc(point.x / tileSize)}, </td>
-      <td>row: ${Math.trunc(point.y / tileSize)}</td>
-      `;
-      this.debug._pcrsCoord.innerHTML = `
-      <th scope="row">pcrs: </th>
-      <td>easting: ${pcrs.x.toFixed(2)}, </td>
-      <td>northing: ${pcrs.y.toFixed(2)}</td>
-      `;
-    },
-
-  });
-
-  var debugPanel = function (options) {
-    return new DebugPanel(options);
-  };
-
-  var DebugGrid = L.GridLayer.extend({
-
-    initialize: function (options) {
-      L.setOptions(this, options);
-      L.GridLayer.prototype.initialize.call(this, this._map);
-    },
-
-    createTile: function (coords) {
-      let tile = L.DomUtil.create("div", "mapml-debug-tile");
-      tile.setAttribute("col", coords.x);
-      tile.setAttribute("row", coords.y);
-      tile.setAttribute("zoom", coords.z);
-      tile.innerHTML = [`col: ${coords.x}`, `row: ${coords.y}`, `zoom: ${coords.z}`].join(', ');
-
-      tile.style.outline = '1px dashed red';
-      return tile;
-    },
-  });
-
-  var debugGrid = function (options) {
-    return new DebugGrid(options);
-  };
-
-  var DebugVectors = L.LayerGroup.extend({
-    initialize: function (options) {
-      L.setOptions(this, options);
-      L.LayerGroup.prototype.initialize.call(this, this._map, options);
-    },
-    onAdd: function (map) {
-      map.on('overlayremove', this._mapLayerUpdate, this);
-      map.on('overlayadd', this._mapLayerUpdate, this);
-      let center = map.options.crs.transformation.transform(L.point(0, 0), map.options.crs.scale(0));
-      this._centerVector = L.circle(map.options.crs.pointToLatLng(center, 0), { radius: 250 });
-      this._centerVector.bindTooltip("Projection Center");
-
-      this._addBounds(map);
-    },
-    onRemove: function (map) {
-      this.clearLayers();
-    },
-
-    _addBounds: function (map) {
-      let id = Object.keys(map._layers),
-        layers = map._layers,
-        colors = ["#FF5733", "#8DFF33", "#3397FF", "#E433FF", "#F3FF33"],
-        j = 0;
-
-      this.addLayer(this._centerVector);
-
-      for (let i of id) {
-        if (layers[i].layerBounds) {
-          let boundsArray = [
-            layers[i].layerBounds.min,
-            L.point(layers[i].layerBounds.max.x, layers[i].layerBounds.min.y),
-            layers[i].layerBounds.max,
-            L.point(layers[i].layerBounds.min.x, layers[i].layerBounds.max.y)
-          ];
-          let boundsRect = projectedExtent(boundsArray, {
-            color: colors[j % colors.length],
-            weight: 2,
-            opacity: 1,
-            fillOpacity: 0.01,
-            fill: true,
-          });
-          if (layers[i].options._leafletLayer)
-            boundsRect.bindTooltip(layers[i].options._leafletLayer._title, { sticky: true });
-          this.addLayer(boundsRect);
-          j++;
-        }
-      }
-
-      if(map.totalLayerBounds){
-        let totalBoundsArray = [
-          map.totalLayerBounds.min,
-          L.point(map.totalLayerBounds.max.x, map.totalLayerBounds.min.y),
-          map.totalLayerBounds.max,
-          L.point(map.totalLayerBounds.min.x, map.totalLayerBounds.max.y)
-        ];
-
-        let totalBounds = projectedExtent(
-            totalBoundsArray,
-            {color: "#808080", weight: 5, opacity: 0.5, fill: false});
-        this.addLayer(totalBounds);
-      }
-    },
-
-    _mapLayerUpdate: function (e) {
-      this.clearLayers();
-      this._addBounds(e.target);
-    },
-  });
-
-  var debugVectors = function (options) {
-    return new DebugVectors(options);
-  };
-
-
-  var ProjectedExtent = L.Path.extend({
-    options: {
-      className: "mapml-debug-extent",
-    },
-    initialize: function (locations, options) {
-      //locations passed in as pcrs coordinates
-      this._locations = locations;
-      L.setOptions(this, options);
-    },
-
-    _project: function () {
-      this._rings = [];
-      let scale = this._map.options.crs.scale(this._map.getZoom()),
-        map = this._map;
-      for (let i = 0; i < this._locations.length; i++) {
-        let point = map.options.crs.transformation.transform(this._locations[i], scale);
-        //substract the pixel origin from the pixel coordinates to get the location relative to map viewport
-        this._rings.push(L.point(point.x, point.y)._subtract(map.getPixelOrigin()));
-      }
-      //leaflet SVG renderer looks for and array of arrays to build polygons,
-      //in this case it only deals with a rectangle so one closed array or points
-      this._parts = [this._rings];
-    },
-
-    _update: function () {
-      if (!this._map) return;
-      this._renderer._updatePoly(this, true); //passing true creates a closed path i.e. a rectangle
-    },
-
-  });
-
-  var projectedExtent = function (locations, options) {
-    return new ProjectedExtent(locations, options);
-  };
-
-  var QueryHandler = L.Handler.extend({
-      addHooks: function() {
-          // get a reference to the actual <map> element, so we can 
-          // use its layers property to iterate the layers from top down
-          // evaluating if they are 'on the map' (enabled)
-          L.setOptions(this, {mapEl: this._map.options.mapEl});
-          L.DomEvent.on(this._map, 'click', this._queryTopLayer, this);
-          L.DomEvent.on(this._map, 'keypress', this._queryTopLayerAtMapCenter, this);
-      },
-      removeHooks: function() {
-          L.DomEvent.off(this._map, 'click', this._queryTopLayer, this);
-          L.DomEvent.on(this._map, 'keypress', this._queryTopLayerAtMapCenter, this);
-      },
-      _getTopQueryableLayer: function() {
-          var layers = this.options.mapEl.layers;
-          // work backwards in document order (top down)
-          for (var l=layers.length-1;l>=0;l--) {
-            var mapmlLayer = layers[l]._layer;
-            if (layers[l].checked && mapmlLayer.queryable) {
-                return mapmlLayer;
-            }
-          }
-      },
-      _queryTopLayerAtMapCenter: function (event) {
-        setTimeout(() => {
-          if (this._map.isFocused && !this._map._popupClosed && (event.originalEvent.key === " " || +event.originalEvent.keyCode === 13)) {
-            this._map.fire('click', { 
-                latlng: this._map.getCenter(),
-                layerPoint: this._map.latLngToLayerPoint(this._map.getCenter()),
-                containerPoint: this._map.latLngToContainerPoint(this._map.getCenter())
-            });
-          } else {
-            delete this._map._popupClosed;
-          }
-        }, 0);
-      },
-      _queryTopLayer: function(event) {
-          var layer = this._getTopQueryableLayer();
-          if (layer) {
-              this._query(event, layer);
-          }
-      },
-      _query(e, layer) {
-        var obj = {},
-            template = layer.getQueryTemplates()[0],
-            zoom = e.target.getZoom(),
-            map = this._map,
-            crs = layer.crs,
-            tileSize = map.options.crs.options.crs.tile.bounds.max.x,
-            container = layer._container,
-            popupOptions = {autoClose: false, autoPan: true, maxHeight: (map.getSize().y * 0.5) - 50},
-            tcrs2pcrs = function (c) {
-              return crs.transformation.untransform(c,crs.scale(zoom));
-            },
-            tcrs2gcrs = function (c) {
-              return crs.unproject(crs.transformation.untransform(c,crs.scale(zoom)),zoom);
-            };
-        var tcrsClickLoc = crs.latLngToPoint(e.latlng, zoom),
-            tileMatrixClickLoc = tcrsClickLoc.divideBy(tileSize).floor(),
-            tileBounds = new L.Bounds(tcrsClickLoc.divideBy(tileSize).floor().multiplyBy(tileSize), 
-            tcrsClickLoc.divideBy(tileSize).ceil().multiplyBy(tileSize));
-    
-        // all of the following are locations that might be used in a query, I think.
-        obj[template.query.tilei] = tcrsClickLoc.x.toFixed() - (tileMatrixClickLoc.x * tileSize);
-        obj[template.query.tilej] = tcrsClickLoc.y.toFixed() - (tileMatrixClickLoc.y * tileSize);
-        
-        // this forces the click to the centre of the map extent in the layer crs
-        obj[template.query.mapi] = (map.getSize().divideBy(2)).x.toFixed();
-        obj[template.query.mapj] = (map.getSize().divideBy(2)).y.toFixed();
-        
-        obj[template.query.pixelleft] = crs.pointToLatLng(tcrsClickLoc, zoom).lng;
-        obj[template.query.pixeltop] = crs.pointToLatLng(tcrsClickLoc, zoom).lat;
-        obj[template.query.pixelright] = crs.pointToLatLng(tcrsClickLoc.add([1,1]), zoom).lng;
-        obj[template.query.pixelbottom] = crs.pointToLatLng(tcrsClickLoc.add([1,1]), zoom).lat;
-        
-        obj[template.query.column] = tileMatrixClickLoc.x;
-        obj[template.query.row] = tileMatrixClickLoc.y;
-        obj[template.query.x] = tcrsClickLoc.x.toFixed();
-        obj[template.query.y] = tcrsClickLoc.y.toFixed();
-        
-        // whereas the layerPoint is calculated relative to the origin plus / minus any
-        // pan movements so is equal to containerPoint at first before any pans, but
-        // changes as the map pans. 
-        obj[template.query.easting] =  tcrs2pcrs(tcrsClickLoc).x;
-        obj[template.query.northing] = tcrs2pcrs(tcrsClickLoc).y;
-        obj[template.query.longitude] =  tcrs2gcrs(tcrsClickLoc).lng;
-        obj[template.query.latitude] = tcrs2gcrs(tcrsClickLoc).lat;
-        obj[template.query.zoom] = zoom;
-        obj[template.query.width] = map.getSize().x;
-        obj[template.query.height] = map.getSize().y;
-        // assumes the click is at the centre of the map, per template.query.mapi, mapj above
-        obj[template.query.mapbottom] = tcrs2pcrs(tcrsClickLoc.add(map.getSize().divideBy(2))).y;
-        obj[template.query.mapleft] = tcrs2pcrs(tcrsClickLoc.subtract(map.getSize().divideBy(2))).x;
-        obj[template.query.maptop] = tcrs2pcrs(tcrsClickLoc.subtract(map.getSize().divideBy(2))).y;
-        obj[template.query.mapright] = tcrs2pcrs(tcrsClickLoc.add(map.getSize().divideBy(2))).x;
-        
-        obj[template.query.tilebottom] = tcrs2pcrs(tileBounds.max).y;
-        obj[template.query.tileleft] = tcrs2pcrs(tileBounds.min).x;
-        obj[template.query.tiletop] = tcrs2pcrs(tileBounds.min).y;
-        obj[template.query.tileright] = tcrs2pcrs(tileBounds.max).x;
-        // add hidden or other variables that may be present into the values to
-        // be processed by L.Util.template below.
-        for (var v in template.query) {
-            if (["mapi","mapj","tilei","tilej","row","col","x","y","easting","northing","longitude","latitude","width","height","zoom","mapleft","mapright",",maptop","mapbottom","tileleft","tileright","tiletop","tilebottom","pixeltop","pixelbottom","pixelleft","pixelright"].indexOf(v) < 0) {
-                obj[v] = template.query[v];
-            }
-        }
-
-        let point = this._map.project(e.latlng),
-            scale = this._map.options.crs.scale(this._map.getZoom()),
-            pcrsClick = this._map.options.crs.transformation.untransform(point,scale),
-            contenttype;
-
-        if(template.layerBounds.contains(pcrsClick)){
-          fetch(L.Util.template(template.template, obj), { redirect: 'follow' }).then((response) => {
-            contenttype = response.headers.get("Content-Type");
-            if (response.status >= 200 && response.status < 300) {
-              return response.text();
-            } else {
-              throw new Error(response.status);
-            }
-          }).then((mapml) => {
-            if (contenttype.startsWith("text/mapml")) {
-              return handleMapMLResponse(mapml, e.latlng);
-            } else {
-              return handleOtherResponse(mapml, layer, e.latlng);
-            }
-          }).catch((err) => {
-            console.log('Looks like there was a problem. Status: ' + err.message);
-          });
-        }
-        function handleMapMLResponse(mapml, loc) {
-          let parser = new DOMParser(),
-            mapmldoc = parser.parseFromString(mapml, "application/xml");
-
-          for(let feature of mapmldoc.querySelectorAll('map-feature')){
-            if(!feature.querySelector('map-geometry')){
-              let geo = document.createElement('map-geometry'), point = document.createElement('map-point'),
-                coords = document.createElement('map-coordinates');
-              geo.setAttribute("cs", "gcrs");
-              coords.innerHTML = `${loc.lng} ${loc.lat}`;
-              point.appendChild(coords);
-              geo.appendChild(point);
-              feature.appendChild(geo);
-            }
-          }
-
-          let f = M.mapMlFeatures(mapmldoc, {
-              // pass the vector layer a renderer of its own, otherwise leaflet
-              // puts everything into the overlayPane
-              renderer: M.featureRenderer(),
-              // pass the vector layer the container for the parent into which
-              // it will append its own container for rendering into
-              pane: container,
-              //color: 'yellow',
-              // instead of unprojecting and then projecting and scaling,
-              // a much smarter approach would be to scale at the current
-              // zoom
-              projection: map.options.projection,
-              _leafletLayer: layer,
-              query: true,
-              static:true,
-          });
-          f.addTo(map);
-
-          let div = L.DomUtil.create("div", "mapml-popup-content"),
-              c = L.DomUtil.create("iframe");
-          c.style = "border: none";
-          c.srcdoc = mapmldoc.querySelector('map-feature map-properties').innerHTML;
-          c.setAttribute("sandbox","allow-same-origin allow-forms");
-          div.appendChild(c);
-          // passing a latlng to the popup is necessary for when there is no
-          // geometry / null geometry
-          layer._totalFeatureCount = mapmldoc.querySelectorAll("map-feature").length;
-          layer.bindPopup(div, popupOptions).openPopup(loc);
-          layer.on('popupclose', function() {
-              map.removeLayer(f);
-          });
-          f.showPaginationFeature({i: 0, popup: layer._popup});
-
-        }
-        function handleOtherResponse(text, layer, loc) {
-          let div = L.DomUtil.create("div", "mapml-popup-content"),
-              c = L.DomUtil.create("iframe");
-          c.style = "border: none";
-          c.srcdoc = text;
-          c.setAttribute("sandbox","allow-same-origin allow-forms");
-          div.appendChild(c);
-          layer.bindPopup(div, popupOptions).openPopup(loc);
-        }
-      }
-  });
-
-  /*
-  MIT License related to portions of M.ContextMenu 
-  Copyright (c) 2017 adam.ratcliffe@gmail.com
-  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), 
-  to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 
-  and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-  */
-  var ContextMenu = L.Handler.extend({
-    _touchstart: L.Browser.msPointer ? 'MSPointerDown' : L.Browser.pointer ? 'pointerdown' : 'touchstart',
-
-    initialize: function (map) {
-      L.Handler.prototype.initialize.call(this, map);
-
-      //setting the items in the context menu and their callback functions
-      this._items = [
-        {
-          text: M.options.locale.cmBack + " (<kbd>B</kbd>)",
-          callback:this._goBack,
-        },
-        {
-          text: M.options.locale.cmForward + " (<kbd>F</kbd>)",
-          callback:this._goForward,
-        },
-        {
-          text: M.options.locale.cmReload + " (<kbd>R</kbd>)",
-          callback:this._reload,
-        },
-        {
-          spacer:"-",
-        },
-        {
-          text: M.options.locale.cmToggleControls + " (<kbd>T</kbd>)",
-          callback:this._toggleControls,
-        },
-        {
-          text: M.options.locale.cmCopyCoords + " (<kbd>C</kbd>)<span></span>",
-          callback:this._copyCoords,
-          hideOnSelect:false,
-          popup:true,
-          submenu:[
-            {
-              text:"tile",
-              callback:this._copyTile,
-            },
-            {
-              text:"tilematrix",
-              callback:this._copyTileMatrix,
-            },
-            {
-              spacer:"-",
-            },
-            {
-              text:"map",
-              callback:this._copyMap,
-            },
-            {
-              spacer:"-",
-            },
-            {
-              text:"tcrs",
-              callback:this._copyTCRS,
-            },
-            {
-              text:"pcrs",
-              callback:this._copyPCRS,
-            },
-            {
-              text:"gcrs",
-              callback:this._copyGCRS,
-            },
-            {
-              spacer:"-",
-            },
-            {
-              text: M.options.locale.cmCopyAll,
-              callback:this._copyAllCoords,
-            }
-          ]
-        },
-        {
-          text: M.options.locale.cmToggleDebug + " (<kbd>D</kbd>)",
-          callback:this._toggleDebug,
-        },
-        {
-          text: M.options.locale.cmCopyMapML + " (<kbd>M</kbd>)",
-          callback:this._copyMapML,
-        },
-        {
-          text: M.options.locale.cmViewSource + " (<kbd>V</kbd>)",
-          callback:this._viewSource,
-        },
-      ];
-
-      this._layerItems = [
-        {
-          text: M.options.locale.lmZoomToLayer + " (<kbd>Z</kbd>)",
-          callback:this._zoomToLayer
-        },
-        {
-          text: M.options.locale.lmCopyExtent + " (<kbd>C</kbd>)",
-          callback:this._copyLayerExtent
-        },
-      ];
-      this._mapMenuVisible = false;
-      this._keyboardEvent = false;
-
-      this._container = L.DomUtil.create("div", "mapml-contextmenu", map._container);
-      this._container.setAttribute('hidden', '');
-      
-      for (let i = 0; i < 6; i++) {
-        this._items[i].el = this._createItem(this._container, this._items[i]);
-      }
-
-      this._coordMenu = L.DomUtil.create("div", "mapml-contextmenu mapml-submenu", this._container);
-      this._coordMenu.id = "mapml-copy-submenu";
-      this._coordMenu.setAttribute('hidden', '');
-
-      this._clickEvent = null;
-
-      for(let i =0;i<this._items[5].submenu.length;i++){
-        this._createItem(this._coordMenu,this._items[5].submenu[i],i);
-      }
-
-      this._items[6].el = this._createItem(this._container, this._items[6]);
-      this._items[7].el = this._createItem(this._container, this._items[7]);
-      this._items[8].el = this._createItem(this._container, this._items[8]);
-
-      this._layerMenu = L.DomUtil.create("div", "mapml-contextmenu mapml-layer-menu", map._container);
-      this._layerMenu.setAttribute('hidden', '');
-      for (let i = 0; i < this._layerItems.length; i++) {
-        this._createItem(this._layerMenu, this._layerItems[i]);
-      }
-
-      L.DomEvent
-        .on(this._container, 'click', L.DomEvent.stop)
-        .on(this._container, 'mousedown', L.DomEvent.stop)
-        .on(this._container, 'dblclick', L.DomEvent.stop)
-        .on(this._container, 'contextmenu', L.DomEvent.stop)
-        .on(this._layerMenu, 'click', L.DomEvent.stop)
-        .on(this._layerMenu, 'mousedown', L.DomEvent.stop)
-        .on(this._layerMenu, 'dblclick', L.DomEvent.stop)
-        .on(this._layerMenu, 'contextmenu', L.DomEvent.stop);
-    },
-
-    addHooks: function () {
-      var container = this._map.getContainer();
-
-      L.DomEvent
-        .on(container, 'mouseleave', this._hide, this)
-        .on(document, 'keydown', this._onKeyDown, this);
-
-      if (L.Browser.touch) {
-        L.DomEvent.on(document, this._touchstart, this._hide, this);
-      }
-
-      this._map.on({
-        contextmenu: this._show,
-        mousedown: this._hide,
-        zoomstart: this._hide
-      }, this);
-    },
-
-    removeHooks: function () {
-      var container = this._map.getContainer();
-
-      L.DomEvent
-        .off(container, 'mouseleave', this._hide, this)
-        .off(document, 'keydown', this._onKeyDown, this);
-
-      if (L.Browser.touch) {
-        L.DomEvent.off(document, this._touchstart, this._hide, this);
-      }
-
-      this._map.off({
-        contextmenu: this._show,
-        mousedown: this._hide,
-        zoomstart: this._hide
-      }, this);
-    },
-
-    _copyLayerExtent: function (e) {
-      let context = e instanceof KeyboardEvent ? this._map.contextMenu : this.contextMenu,
-          layerElem = context._layerClicked.layer._layerEl,
-          tL = layerElem.extent.topLeft.pcrs,
-          bR = layerElem.extent.bottomRight.pcrs;
-
-      let data = `<map-meta name="extent" content="top-left-easting=${tL.horizontal}, top-left-northing=${tL.vertical}, bottom-right-easting=${bR.horizontal}, bottom-right-northing=${bR.vertical}"></map-meta>`;
-      context._copyData(data);
-    },
-
-    _zoomToLayer: function (e) {
-      let context = e instanceof KeyboardEvent ? this._map.contextMenu : this.contextMenu;
-      context._layerClicked.layer._layerEl.focus();
-    },
-
-    _goForward: function(e){
-      let mapEl = e instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl;
-      mapEl.forward();
-    },
-
-    _goBack: function(e){
-      let mapEl = e instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl;
-      mapEl.back();
-    },
-
-    _reload: function(e){
-      let mapEl = e instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl;
-      mapEl.reload();
-    },
-
-    _toggleControls: function(e){
-      let mapEl = e instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl;
-      mapEl._toggleControls();
-    },
-
-    _copyMapML: function(e){
-      let context = e instanceof KeyboardEvent ? this._map.contextMenu : this.contextMenu,
-        mapEl = e instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl;
-      context._copyData(mapEl.outerHTML.replace(/<div class="mapml-web-map">.*?<\/div>|<style>\[is="web-map"].*?<\/style>|<style>mapml-viewer.*?<\/style>/gm, ""));
-    },
-
-    _viewSource: function(e){
-      let mapEl = e instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl;
-      mapEl.viewSource();
-    },
-
-    _toggleDebug: function(e){
-      let mapEl = e instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl;
-      mapEl.toggleDebug();
-    },
-
-    _copyCoords: function(e){
-      let directory = this.contextMenu?this.contextMenu:this;
-      directory._showCoordMenu(e);
-    },
-
-    _copyData: function(data){
-      const el = document.createElement('textarea');
-      el.value = data;
-      document.body.appendChild(el);
-      el.select();
-      document.execCommand('copy');
-      document.body.removeChild(el);
-    },
-
-    _copyGCRS: function(e){
-      let mapEl = this.options.mapEl,
-          click = this.contextMenu._clickEvent;
-      this.contextMenu._copyData(`z:${mapEl.zoom}, lon :${click.latlng.lng.toFixed(6)}, lat:${click.latlng.lat.toFixed(6)}`);
-    },
-
-    _copyTCRS: function(e){
-      let mapEl = this.options.mapEl,
-          click = this.contextMenu._clickEvent,
-          point = mapEl._map.project(click.latlng);
-      this.contextMenu._copyData(`z:${mapEl.zoom}, x:${point.x}, y:${point.y}`);
-    },
-
-    _copyTileMatrix: function(e){
-      let mapEl = this.options.mapEl,
-          click = this.contextMenu._clickEvent,
-          point = mapEl._map.project(click.latlng),
-          tileSize = mapEl._map.options.crs.options.crs.tile.bounds.max.x;
-      this.contextMenu._copyData(`z:${mapEl.zoom}, column:${Math.trunc(point.x/tileSize)}, row:${Math.trunc(point.y/tileSize)}`);
-    },
-
-    _copyPCRS: function(e){
-      let mapEl = this.options.mapEl,
-          click = this.contextMenu._clickEvent,
-          point = mapEl._map.project(click.latlng),
-          scale = mapEl._map.options.crs.scale(+mapEl.zoom),
-          pcrs = mapEl._map.options.crs.transformation.untransform(point,scale);
-      this.contextMenu._copyData(`z:${mapEl.zoom}, easting:${pcrs.x.toFixed(2)}, northing:${pcrs.y.toFixed(2)}`);
-    },
-
-    _copyTile: function(e){
-      let mapEl = this.options.mapEl,
-          click = this.contextMenu._clickEvent,
-          point = mapEl._map.options.crs.project(click.latlng),
-          tileSize = mapEl._map.options.crs.options.crs.tile.bounds.max.x,
-          pointX = point.x % tileSize, pointY = point.y % tileSize;
-      if(pointX < 0) pointX+= tileSize;
-      if(pointY < 0) pointY+= tileSize;
-
-      this.contextMenu._copyData(`z:${mapEl.zoom}, i:${Math.trunc(pointX)}, j:${Math.trunc(pointY)}`);
-    },
-
-    _copyMap: function(e){
-      let mapEl = this.options.mapEl,
-          click = this.contextMenu._clickEvent;
-      this.contextMenu._copyData(`z:${mapEl.zoom}, i:${Math.trunc(click.containerPoint.x)}, j:${Math.trunc(click.containerPoint.y)}`);
-    },
-
-    _copyAllCoords: function(e){
-      let mapEl = this.options.mapEl,
-      click = this.contextMenu._clickEvent,
-      point = mapEl._map.project(click.latlng),
-      tileSize = mapEl._map.options.crs.options.crs.tile.bounds.max.x,
-      pointX = point.x % tileSize, pointY = point.y % tileSize,
-      scale = mapEl._map.options.crs.scale(+mapEl.zoom),
-      pcrs = mapEl._map.options.crs.transformation.untransform(point,scale);
-      let allData = `z:${mapEl.zoom}\n`;
-      allData += `tile: i:${Math.trunc(pointX)}, j:${Math.trunc(pointY)}\n`;
-      allData += `tilematrix: column:${Math.trunc(point.x/tileSize)}, row:${Math.trunc(point.y/tileSize)}\n`;
-      allData += `map: i:${Math.trunc(click.containerPoint.x)}, j:${Math.trunc(click.containerPoint.y)}\n`;
-      allData += `tcrs: x:${Math.trunc(point.x)}, y:${Math.trunc(point.y)}\n`;
-      allData += `pcrs: easting:${pcrs.x.toFixed(2)}, northing:${pcrs.y.toFixed(2)}\n`;
-      allData += `gcrs: lon :${click.latlng.lng.toFixed(6)}, lat:${click.latlng.lat.toFixed(6)}`;
-      this.contextMenu._copyData(allData);
-    },
-
-    _createItem: function (container, options, index) {
-      if (options.spacer) {
-        return this._createSeparator(container, index);
-      }
-
-      var itemCls = 'mapml-contextmenu-item',
-          el = this._insertElementAt('button', itemCls, container, index),
-          callback = this._createEventHandler(el, options.callback, options.context, options.hideOnSelect),
-          html = '';
-
-      el.innerHTML = html + options.text;
-      el.setAttribute("type", "button");
-      el.classList.add("mapml-button");
-      if(options.popup){
-        el.setAttribute("aria-haspopup", "true");
-        el.setAttribute("aria-expanded", "false");
-        el.setAttribute("aria-controls", "mapml-copy-submenu");
-      }
-
-      L.DomEvent
-        .on(el, 'mouseover', this._onItemMouseOver, this)
-        .on(el, 'mouseout', this._onItemMouseOut, this)
-        .on(el, 'mousedown', L.DomEvent.stopPropagation)
-        .on(el, 'click', callback);
-
-      if (L.Browser.touch) {
-        L.DomEvent.on(el, this._touchstart, L.DomEvent.stopPropagation);
-      }
-
-      // Devices without a mouse fire "mouseover" on tap, but never “mouseout"
-      if (!L.Browser.pointer) {
-        L.DomEvent.on(el, 'click', this._onItemMouseOut, this);
-      }
-
-      return {
-        id: L.Util.stamp(el),
-        el: el,
-        callback: callback
-      };
-    },
-
-    _createSeparator: function (container, index) {
-      let el = this._insertElementAt('div', 'mapml-contextmenu-separator', container, index);
-
-      return {
-        id: L.Util.stamp(el),
-        el: el
-      };
-    },
-
-    _createEventHandler: function (el, func, context, hideOnSelect) {
-      let parent = this;
-
-      hideOnSelect = (hideOnSelect !== undefined) ? hideOnSelect : true;
-
-      return function (e) {
-        let map = parent._map,
-          containerPoint = parent._showLocation.containerPoint,
-          layerPoint = map.containerPointToLayerPoint(containerPoint),
-          latlng = map.layerPointToLatLng(layerPoint),
-          relatedTarget = parent._showLocation.relatedTarget,
-          data = {
-            containerPoint: containerPoint,
-            layerPoint: layerPoint,
-            latlng: latlng,
-            relatedTarget: relatedTarget
-          };
-
-        if (hideOnSelect) {
-          parent._hide();
-        }
-
-        if (func) {
-          func.call(context || map, data);
-        }
-
-        parent._map.fire('contextmenu.select', {
-          contextmenu: parent,
-          el: el
-        });
-      };
-    },
-
-    _insertElementAt: function (tagName, className, container, index) {
-        let refEl,
-            el = document.createElement(tagName);
-
-        el.className = className;
-
-        if (index !== undefined) {
-            refEl = container.children[index];
-        }
-
-        if (refEl) {
-            container.insertBefore(el, refEl);
-        } else {
-            container.appendChild(el);
-        }
-
-        return el;
-    },
-
-    _show: function (e) {
-      if(this._mapMenuVisible) this._hide();
-      this._clickEvent = e;
-      let elem = e.originalEvent.target;
-      if(elem.closest("fieldset")){
-        elem = elem.closest("fieldset").querySelector("span");
-        if(!elem.layer.validProjection) return;
-        this._layerClicked = elem;
-        this._showAtPoint(e.containerPoint, e, this._layerMenu);
-      } else if(elem.classList.contains("leaflet-container") || elem.classList.contains("mapml-debug-extent") ||
-        elem.tagName === "path") {
-        this._layerClicked = undefined;
-        this._showAtPoint(e.containerPoint, e, this._container);
-      }
-      if(e.originalEvent.button === 0 || e.originalEvent.button === -1){
-        this._keyboardEvent = true;
-        if(this._layerClicked){
-          let activeEl = document.activeElement;
-          this._elementInFocus = activeEl.shadowRoot.activeElement;
-          this._layerMenuTabs = 1;
-          this._layerMenu.firstChild.focus();
-        } else {
-          this._container.firstChild.focus();
-        }
-
-      }
-    },
-
-    _showAtPoint: function (pt, data, container) {
-        if (this._items.length) {
-            let event = L.extend(data || {}, {contextmenu: this});
-
-            this._showLocation = {
-                containerPoint: pt
-            };
-
-            if (data && data.relatedTarget){
-                this._showLocation.relatedTarget = data.relatedTarget;
-            }
-
-            this._setPosition(pt,container);
-
-            if (!this._mapMenuVisible) {
-              container.removeAttribute('hidden');
-                this._mapMenuVisible = true;
-            }
-
-            this._map.fire('contextmenu.show', event);
-        }
-    },
-
-    _hide: function () {
-        if (this._mapMenuVisible) {
-            this._mapMenuVisible = false;
-            this._container.setAttribute('hidden', '');
-            this._coordMenu.setAttribute('hidden', '');
-            this._layerMenu.setAttribute('hidden', '');
-            this._map.fire('contextmenu.hide', {contextmenu: this});
-            setTimeout(() => this._map._container.focus(), 0);
-        }
-    },
-
-    _setPosition: function (pt, container) {
-        let mapSize = this._map.getSize(),
-            containerSize = this._getElementSize(container),
-            anchor;
-
-        if (this._map.options.contextmenuAnchor) {
-            anchor = L.point(this._map.options.contextmenuAnchor);
-            pt = pt.add(anchor);
-        }
-
-        container._leaflet_pos = pt;
-
-        if (pt.x + containerSize.x > mapSize.x) {
-            container.style.left = 'auto';
-            container.style.right = Math.min(Math.max(mapSize.x - pt.x, 0), mapSize.x - containerSize.x - 1) + 'px';
-        } else {
-            container.style.left = Math.max(pt.x, 0) + 'px';
-            container.style.right = 'auto';
-        }
-
-        if (pt.y + containerSize.y > mapSize.y) {
-            container.style.top = 'auto';
-            container.style.bottom = Math.min(Math.max(mapSize.y - pt.y, 0), mapSize.y - containerSize.y - 1) + 'px';
-        } else {
-            container.style.top = Math.max(pt.y, 0) + 'px';
-            container.style.bottom = 'auto';
-        }
-    },
-
-    _getElementSize: function (el) {
-        let size = this._size;
-
-        if (!size || this._sizeChanged) {
-            size = {};
-
-            el.style.left = '-999999px';
-            el.style.right = 'auto';
-
-            size.x = el.offsetWidth;
-            size.y = el.offsetHeight;
-
-            el.style.left = 'auto';
-
-            this._sizeChanged = false;
-        }
-
-        return size;
-    },
-
-     // once tab is clicked on the layer menu, change the focus back to the layer control
-     _focusOnLayerControl: function(){
-      this._mapMenuVisible = false;
-      delete this._layerMenuTabs;
-      this._layerMenu.setAttribute('hidden', '');
-      if(this._elementInFocus){
-        this._elementInFocus.focus();
-      } else {
-        this._layerClicked.parentElement.firstChild.focus();
-      }
-      delete this._elementInFocus;
-    },
-
-    _onKeyDown: function (e) {
-      if(!this._mapMenuVisible) return;
-
-      let key = e.keyCode;
-      let path = e.path || e.composedPath();
-
-      if(key === 13)
-        e.preventDefault();
-      // keep track of where the focus is on the layer menu and when the layer menu is tabbed out of, focus on layer control
-      if(this._layerMenuTabs && (key === 9 || key === 27)){
-        if(e.shiftKey){
-          this._layerMenuTabs -= 1;
-        } else {
-          this._layerMenuTabs += 1;
-        }
-        if(this._layerMenuTabs === 0 || this._layerMenuTabs === 3 || key === 27){
-          L.DomEvent.stop(e);
-          this._focusOnLayerControl();
-        } 
-      } else if(key !== 16 && key!== 9 && !(!this._layerClicked && key === 67) && path[0].innerText !== (M.options.locale.cmCopyCoords + " (C)")){
-        this._hide();
-      }
-      switch(key){
-        case 13:  //ENTER KEY
-        case 32:  //SPACE KEY
-          if(this._map._container.parentNode.activeElement.parentNode.classList.contains("mapml-contextmenu"))
-            this._map._container.parentNode.activeElement.click();
-          break;
-        case 66: //B KEY
-          this._goBack(e);
-          break;
-        case 67: //C KEY
-          if(this._layerClicked){
-            this._copyLayerExtent(e);
-          } else {
-            this._copyCoords({
-              latlng:this._map.getCenter()
-            });
-          }
-          break;
-        case 68: //D KEY
-          this._toggleDebug(e);
-          break;
-        case 77: //M KEY
-          this._copyMapML(e);
-          break;
-        case 70: //F KEY
-          this._goForward(e);
-          break;
-        case 82: //R KEY
-          this._reload(e);
-          break;
-        case 84: //T KEY
-          this._toggleControls(e);
-          break;
-        case 86: //V KEY
-          this._viewSource(e);
-          break;
-        case 90: //Z KEY
-          if(this._layerClicked)
-            this._zoomToLayer(e);
-          break;
-      }
-    },
-
-    _showCoordMenu: function(e){
-      let mapSize = this._map.getSize(),
-          click = this._clickEvent,
-          menu = this._coordMenu,
-          copyEl = this._items[5].el.el;
-
-      copyEl.setAttribute("aria-expanded","true");
-      menu.removeAttribute('hidden');
-
-      if (click.containerPoint.x + 160 + 80 > mapSize.x) {
-        menu.style.left = 'auto';
-        menu.style.right = 160 + 'px';
-      } else {
-        menu.style.left = 160 + 'px';
-        menu.style.right = 'auto';
-      }
-
-      if (click.containerPoint.y + 160 > mapSize.y) {
-        menu.style.top = 'auto';
-        menu.style.bottom = 20 + 'px';
-      } else {
-        menu.style.top = 100 + 'px';
-        menu.style.bottom = 'auto';
-      }
-      if(this._keyboardEvent)menu.firstChild.focus();
-    },
-
-    _hideCoordMenu: function(e){
-      if(e.srcElement.parentElement.classList.contains("mapml-submenu") ||
-          e.srcElement.innerText === (M.options.locale.cmCopyCoords + " (C)"))return;
-      let menu = this._coordMenu, copyEl = this._items[5].el.el;
-      copyEl.setAttribute("aria-expanded","false");
-      menu.setAttribute('hidden', '');
-    },
-
-    _onItemMouseOver: function (e) {
-      L.DomUtil.addClass(e.target || e.srcElement, 'over');
-      if(e.srcElement.innerText === (M.options.locale.cmCopyCoords + " (C)")) this._showCoordMenu(e);
-    },
-
-    _onItemMouseOut: function (e) {
-      L.DomUtil.removeClass(e.target || e.srcElement, 'over');
-      this._hideCoordMenu(e);
-    }
-  });
-
-  var Util = {
-    convertAndFormatPCRS : function(pcrsBounds, map){
-      if(!pcrsBounds || !map) return {};
-
-      let tcrsTopLeft = [], tcrsBottomRight = [],
-          tileMatrixTopLeft = [], tileMatrixBottomRight = [],
-          tileSize = map.options.crs.options.crs.tile.bounds.max.y;
-
-      for(let i = 0;i<map.options.crs.options.resolutions.length;i++){
-        let scale = map.options.crs.scale(i),
-            minConverted = map.options.crs.transformation.transform(pcrsBounds.min,scale),
-            maxConverted = map.options.crs.transformation.transform(pcrsBounds.max,scale);
-            
-        tcrsTopLeft.push({
-          horizontal: minConverted.x,
-          vertical:maxConverted.y,
-        });
-        tcrsBottomRight.push({
-          horizontal: maxConverted.x,
-          vertical: minConverted.y,
-        });
-
-        //converts the tcrs values from earlier to tilematrix
-        tileMatrixTopLeft.push({
-          horizontal: tcrsTopLeft[i].horizontal / tileSize,
-          vertical:tcrsTopLeft[i].vertical / tileSize,
-        });
-        tileMatrixBottomRight.push({
-          horizontal: tcrsBottomRight[i].horizontal / tileSize,
-          vertical: tcrsBottomRight[i].vertical / tileSize,
-        });
-      }
-      
-      //converts the gcrs, I believe it can take any number values from -inf to +inf
-      let unprojectedMin = map.options.crs.unproject(pcrsBounds.min),
-          unprojectedMax = map.options.crs.unproject(pcrsBounds.max);
-
-      let gcrs = {
-        topLeft:{
-          horizontal: unprojectedMin.lng,
-          vertical:unprojectedMax.lat,
-        },
-        bottomRight:{
-          horizontal: unprojectedMax.lng,
-          vertical: unprojectedMin.lat,
-        },
-      };
-
-      //formats known pcrs bounds to correct format
-      let pcrs = {
-        topLeft:{
-          horizontal:pcrsBounds.min.x,
-          vertical:pcrsBounds.max.y,
-        },
-        bottomRight:{
-          horizontal:pcrsBounds.max.x,
-          vertical:pcrsBounds.min.y,
-        },
-      };
-
-      //formats all extent data
-      return {
-        topLeft:{
-          tcrs:tcrsTopLeft,
-          tilematrix:tileMatrixTopLeft,
-          gcrs:gcrs.topLeft,
-          pcrs:pcrs.topLeft,
-        },
-        bottomRight:{
-          tcrs:tcrsBottomRight,
-          tilematrix:tileMatrixBottomRight,
-          gcrs:gcrs.bottomRight,
-          pcrs:pcrs.bottomRight,
-        },
-        projection:map.options.projection
-      };
-    },
-    extractInputBounds: function(template){
-      if(!template) return undefined;
-
-      //sets variables with their respective fallback values incase content is missing from the template
-        let inputs = template.values, projection = template.projection || FALLBACK_PROJECTION, value = 0, boundsUnit = FALLBACK_CS;
-        let bounds = this[projection].options.crs.tilematrix.bounds(0), nMinZoom = 0, nMaxZoom = this[projection].options.resolutions.length - 1;
-        let locInputs = false, numberOfAxes = 0;
-      if(!template.zoomBounds){
-        template.zoomBounds ={};
-        template.zoomBounds.min=0;
-        template.zoomBounds.max=nMaxZoom;
-      }
-      for(let i=0;i<inputs.length;i++){
-        switch(inputs[i].getAttribute("type")){
-          case "zoom":
-            nMinZoom = +inputs[i].getAttribute("min");
-            nMaxZoom = +(inputs[i].hasAttribute("max") ? inputs[i].getAttribute("max") : nMaxZoom);
-            value = +inputs[i].getAttribute("value");
-          break;
-          case "location":
-            if(!inputs[i].getAttribute("max") || !inputs[i].getAttribute("min")) continue;
-            let max = +inputs[i].getAttribute("max"),min = +inputs[i].getAttribute("min");
-            switch(inputs[i].getAttribute("axis").toLowerCase()){
-              case "x":
-              case "longitude":
-              case "column":
-              case "easting":
-                boundsUnit = M.axisToCS(inputs[i].getAttribute("axis").toLowerCase());
-                bounds.min.x = min;
-                bounds.max.x = max;
-                numberOfAxes++;
-              break;
-              case "y":
-              case "latitude":
-              case "row":
-              case "northing":
-                boundsUnit = M.axisToCS(inputs[i].getAttribute("axis").toLowerCase());
-                bounds.min.y = min;
-                bounds.max.y = max;
-                numberOfAxes++;
-              break;
-            }
-          break;
-        }
-      }
-      if (numberOfAxes >= 2) {
-        locInputs = true;
-      }
-      let zoomBoundsFormatted = {
-        minZoom:+template.zoomBounds.min,
-        maxZoom:+template.zoomBounds.max,
-        minNativeZoom:nMinZoom,
-        maxNativeZoom:nMaxZoom
-      };
-      if(!locInputs && template.extentPCRSFallback && template.extentPCRSFallback.bounds) {
-        bounds = template.extentPCRSFallback.bounds;
-      } else if (locInputs) {
-        bounds = this.boundsToPCRSBounds(bounds,value,projection,boundsUnit);
-      } else {
-        bounds = this[projection].options.crs.pcrs.bounds;
-      }
-      return {
-        zoomBounds:zoomBoundsFormatted,
-        bounds:bounds
-      };
-    },
-
-    axisToCS : function(axis){
-      try{
-        switch(axis.toLowerCase()){
-          case "row":
-          case "column":
-            return "TILEMATRIX";
-          case "i":
-          case "j":
-            return ["MAP","TILE"];
-          case "x":
-          case "y":
-            return "TCRS";
-          case "latitude":
-          case "longitude":
-            return "GCRS";
-          case "northing":
-          case "easting":
-            return "PCRS";
-          default:
-            return FALLBACK_CS;
-        }
-      } catch (e) {return undefined;}
-    },
-
-    //takes a given cs and retuns the axes, first horizontal then vertical
-    csToAxes: function(cs){
-      try{
-        switch(cs.toLowerCase()){
-          case "tilematrix":
-            return ["column", "row"];
-          case "map":
-          case "tile":
-            return ["i", "j"];
-          case "tcrs":
-            return ["x", "y"];
-          case "gcrs":
-            return ["longitude", "latitude"];
-          case "pcrs":
-            return ["easting", "northing"];
-        }
-      } catch (e) {return undefined;}
-    },
-
-    axisToXY: function(axis){
-      try{
-        switch(axis.toLowerCase()){
-          case "i":
-          case "column":
-          case "longitude":
-          case "x":
-          case "easting":
-            return "x";
-          case "row":
-          case "j":
-          case "latitude":
-          case "y":
-          case "northing":
-            return "y";
-
-          default:
-            return undefined;
-        }
-      } catch (e) {return undefined;}
-    },
-
-    convertPCRSBounds: function(pcrsBounds, zoom, projection, cs){
-      if(!pcrsBounds || (!zoom && zoom !== 0) || !Number.isFinite(+zoom) || !projection || !cs) return undefined;
-      projection = (typeof projection === "string") ? M[projection] : projection;
-      switch (cs.toUpperCase()) {
-        case "PCRS":
-          return pcrsBounds;
-        case "TCRS":
-        case "TILEMATRIX":
-          let minPixel = projection.transformation.transform(pcrsBounds.min, projection.scale(+zoom)),
-              maxPixel = projection.transformation.transform(pcrsBounds.max, projection.scale(+zoom));
-          if (cs.toUpperCase() === "TCRS") return L.bounds(minPixel, maxPixel);
-          let tileSize = projection.options.crs.tile.bounds.max.x;
-          return L.bounds(L.point(minPixel.x / tileSize, minPixel.y / tileSize), L.point(maxPixel.x / tileSize,maxPixel.y / tileSize)); 
-        case "GCRS":
-          let minGCRS = projection.unproject(pcrsBounds.min),
-              maxGCRS = projection.unproject(pcrsBounds.max);
-          return L.bounds(L.point(minGCRS.lng, minGCRS.lat), L.point(maxGCRS.lng, maxGCRS.lat)); 
-        default:
-          return undefined;
-      }
-    },
-
-    pointToPCRSPoint: function(point, zoom, projection, cs){
-      if(!point || (!zoom && zoom !== 0) || !Number.isFinite(+zoom) || !cs || !projection) return undefined;
-      projection = (typeof projection === "string") ? M[projection] : projection;
-      let tileSize = projection.options.crs.tile.bounds.max.x;
-      switch(cs.toUpperCase()){
-        case "TILEMATRIX":
-          return M.pixelToPCRSPoint(L.point(point.x*tileSize,point.y*tileSize),zoom,projection);
-        case "PCRS":
-          return point;
-        case "TCRS" :
-          return M.pixelToPCRSPoint(point,zoom,projection);
-        case "GCRS":
-          return projection.project(L.latLng(point.y,point.x));
-        default:
-          return undefined;
-      }
-    },
-
-    pixelToPCRSPoint: function(point, zoom, projection){
-      if(!point || (!zoom && zoom !== 0) || !Number.isFinite(+zoom) || !projection) return undefined;
-      projection = (typeof projection === "string") ? M[projection] : projection;
-      return projection.transformation.untransform(point,projection.scale(zoom));
-    },
-
-    boundsToPCRSBounds: function(bounds, zoom, projection, cs){
-      if(!bounds || !bounds.max || !bounds.min || (!zoom && zoom !== 0) || !Number.isFinite(+zoom) || !projection || !cs) return undefined;
-      projection = (typeof projection === "string") ? M[projection] : projection;
-      return L.bounds(M.pointToPCRSPoint(bounds.min, zoom, projection, cs), M.pointToPCRSPoint(bounds.max, zoom, projection, cs));
-    },
-
-    //L.bounds have fixed point positions, where min is always topleft, max is always bottom right, and the values are always sorted by leaflet
-    //important to consider when working with pcrs where the origin is not topleft but rather bottomleft, could lead to confusion
-    pixelToPCRSBounds : function(bounds, zoom, projection){
-      if(!bounds || !bounds.max || !bounds.min || (!zoom && zoom !== 0) || !Number.isFinite(+zoom) || !projection) return undefined;
-      projection = (typeof projection === "string") ? M[projection] : projection;
-      return L.bounds(M.pixelToPCRSPoint(bounds.min, zoom, projection), M.pixelToPCRSPoint(bounds.max, zoom, projection));
-    },
-    //meta content is the content attribute of meta
-    // input "max=5,min=4" => [[max,5][min,5]]
-    metaContentToObject: function(input){
-      if(!input || input instanceof Object)return {};
-      let content = input.split(/\s+/).join("");
-      let contentArray = {};
-      let stringSplit = content.split(',');
-
-      for(let i=0;i<stringSplit.length;i++){
-        let prop = stringSplit[i].split("=");
-        if(prop.length === 2) contentArray[prop[0]]=prop[1];
-      }
-      if(contentArray !== "" && stringSplit[0].split("=").length ===1)contentArray.content = stringSplit[0];
-      return contentArray;
-    },
-    coordsToArray: function(containerPoints) {
-      // returns an array of arrays of coordinate pairs coordsToArray("1,2,3,4") -> [[1,2],[3,4]]
-      for (var i=1, pairs = [], coords = containerPoints.split(",");i<coords.length;i+=2) {
-        pairs.push([parseInt(coords[i-1]),parseInt(coords[i])]);
-      }
-      return pairs;
-    },
-    parseStylesheetAsHTML: function(mapml, base, container) {
-        if (!(container instanceof Element) || !mapml || !mapml.querySelector('map-link[rel=stylesheet],map-style')) return;
-
-        if(base instanceof Element) {
-          base = base.getAttribute('href')?base.getAttribute('href'):document.URL;
-        } else if (!base || base==="" || base instanceof Object) {
-          return;
-        }
-
-        var ss = [];
-        var stylesheets = mapml.querySelectorAll('map-link[rel=stylesheet],map-style');
-        for (var i=0;i<stylesheets.length;i++) {
-          if (stylesheets[i].nodeName.toUpperCase() === "MAP-LINK" ) {
-            var href = stylesheets[i].hasAttribute('href') ? new URL(stylesheets[i].getAttribute('href'),base).href: null;
-            if (href) {
-              if (!container.querySelector("link[href='"+href+"']")) {
-                var linkElm = document.createElement("link");
-                linkElm.setAttribute("href", href);
-                linkElm.setAttribute("rel", "stylesheet");
-                ss.push(linkElm);
-              }
-            }  
-          } else { // <map-style>
-              var styleElm = document.createElement('style');
-              styleElm.textContent = stylesheets[i].textContent;
-              ss.push(styleElm);
-          }
-        }
-        // insert <link> or <style> elements after the begining  of the container
-        // element, in document order as copied from original mapml document
-        // note the code below assumes hrefs have been resolved and elements
-        // re-parsed from xml and serialized as html elements ready for insertion
-        for (var s=ss.length-1;s >= 0;s--) {
-          container.insertAdjacentElement('afterbegin',ss[s]);
-        }
-    },
-
-    splitCoordinate: function(element, index, array) {
-      var a = [];
-      element.split(/\s+/gim).forEach(M.parseNumber,a);
-      this.push(a);
-    },
-
-    parseNumber : function(element, index, array){
-      this.push(parseFloat(element));
-    },
-
-    handleLink: function (link, leafletLayer) {
-      let zoomTo, justPan = false, layer, map = leafletLayer._map, opacity;
-      if(link.type === "text/html" && link.target !== "_blank"){  // all other target values other than blank behave as _top
-        link.target = "_top";
-      } else if (link.type !== "text/html" && link.url.includes("#")){
-        let hash = link.url.split("#"), loc = hash[1].split(",");
-        zoomTo = {z: loc[0] || 0, lng: loc[1] || 0, lat: loc[2] || 0};
-        justPan = !hash[0]; // if the first half of the array is an empty string then the link is just for panning
-        if(["/", ".","#"].includes(link.url[0])) link.target = "_self";
-      }
-      if(!justPan) {
-        let newLayer = false;
-        layer = document.createElement('layer-');
-        layer.setAttribute('src', link.url);
-        layer.setAttribute('checked', '');
-        switch (link.target) {
-          case "_blank":
-            if (link.type === "text/html") {
-              window.open(link.url);
-            } else {
-              map.options.mapEl.appendChild(layer);
-              newLayer = true;
-            }
-            break;
-          case "_parent":
-            for (let l of map.options.mapEl.querySelectorAll("layer-"))
-              if (l._layer !== leafletLayer) map.options.mapEl.removeChild(l);
-            map.options.mapEl.appendChild(layer);
-            map.options.mapEl.removeChild(leafletLayer._layerEl);
-            newLayer = true;
-            break;
-          case "_top":
-            window.location.href = link.url;
-            break;
-          default:
-            opacity = leafletLayer._layerEl.opacity;
-            leafletLayer._layerEl.insertAdjacentElement('beforebegin', layer);
-            map.options.mapEl.removeChild(leafletLayer._layerEl);
-            newLayer = true;
-        }
-        if(!link.inPlace && newLayer) L.DomEvent.on(layer,'extentload', function focusOnLoad(e) {
-          if(newLayer && ["_parent", "_self"].includes(link.target) && layer.parentElement.querySelectorAll("layer-").length === 1)
-            layer.parentElement.projection = layer._layer.getProjection();
-          if(layer.extent){
-            if(zoomTo) layer.parentElement.zoomTo(+zoomTo.lat, +zoomTo.lng, +zoomTo.z);
-            else layer.focus();
-            L.DomEvent.off(layer, 'extentload', focusOnLoad);
-          }
-
-          if(opacity) layer.opacity = opacity;
-          map.getContainer().focus();
-        });
-      } else if (zoomTo && !link.inPlace && justPan){
-        leafletLayer._map.options.mapEl.zoomTo(+zoomTo.lat, +zoomTo.lng, +zoomTo.z);
-        if(opacity) layer.opacity = opacity;
-      }
-    },
-
-    gcrsToTileMatrix: function (mapEl) {
-      let point = mapEl._map.project(mapEl._map.getCenter());
-      let tileSize = mapEl._map.options.crs.options.crs.tile.bounds.max.y;
-      let column = Math.trunc(point.x / tileSize);
-      let row = Math.trunc(point.y / tileSize);
-      return [column, row];
-    }
-  };
-
-  var ReloadButton = L.Control.extend({
-    options: {
-      position: 'topleft',
-    },
-
-    onAdd: function (map) {
-      let container = L.DomUtil.create("div", "mapml-reload-button leaflet-bar");
-
-      let link = L.DomUtil.create("button", "mapml-reload-button", container);
-      link.innerHTML = "<span aria-hidden='true'>&#x021BA</span>";
-      link.title = M.options.locale.cmReload;
-      link.setAttribute("type", "button");
-      link.classList.add("mapml-button");
-      link.setAttribute('aria-label', "Reload");
-
-      L.DomEvent.disableClickPropagation(link);
-      L.DomEvent.on(link, 'click', L.DomEvent.stop);
-      L.DomEvent.on(link, 'click', this._goReload, this);
-
-      this._reloadButton = link;
-
-      this._updateDisabled();
-      map.on('moveend', this._updateDisabled, this);
-
-      return container;
-    },
-
-    onRemove: function (map) {
-      map.off('moveend', this._updateDisabled, this);
-    },
-
-    disable: function () {
-      this._disabled = true;
-      this._updateDisabled();
-      return this;
-    },
-
-    enable: function () {
-      this._disabled = false;
-      this._updateDisabled();
-      return this;
-    },
-
-    _goReload: function (e) {
-      if (!this._disabled && this._map.options.mapEl._history.length > 1) {
-        this._map.options.mapEl.reload();
-      }
-    },
-
-    _updateDisabled: function () {
-      setTimeout(() => {
-        L.DomUtil.removeClass(this._reloadButton, "leaflet-disabled");
-        this._reloadButton.setAttribute("aria-disabled", "false");
-
-        if (this._map && (this._disabled || this._map.options.mapEl._history.length <= 1)) {
-          L.DomUtil.addClass(this._reloadButton, "leaflet-disabled");
-          this._reloadButton.setAttribute("aria-disabled", "true");
-        }
-      }, 0);
-    }
-  });
-
-  var reloadButton = function (options) {
-    return new ReloadButton(options);
-  };
-
-  var FullscreenButton = L.Control.extend({
-          options: {
-              position: 'topleft',
-              title: {
-                  'false': 'View fullscreen',
-                  'true': 'Exit fullscreen'
-              }
-          },
-
-          onAdd: function (map) {
-              var container = L.DomUtil.create('div', 'leaflet-control-fullscreen leaflet-bar leaflet-control');
-
-              this.link = L.DomUtil.create('a', 'leaflet-control-fullscreen-button leaflet-bar-part', container);
-              this.link.href = '#';
-              this.link.setAttribute('role', 'button');
-
-              this._map = map;
-              this._map.on('fullscreenchange', this._toggleTitle, this);
-              this._toggleTitle();
-
-              L.DomEvent.on(this.link, 'click', this._click, this);
-
-              return container;
-          },
-
-          onRemove: function (map) {
-              map.off('fullscreenchange', this._toggleTitle, this);
-          },
-
-          _click: function (e) {
-              L.DomEvent.stopPropagation(e);
-              L.DomEvent.preventDefault(e);
-              this._map.toggleFullscreen(this.options);
-          },
-
-          _toggleTitle: function() {
-              this.link.title = this.options.title[this._map.isFullscreen()];
-          }
-      });
-
-      L.Map.include({
-          isFullscreen: function () {
-              return this._isFullscreen || false;
-          },
-
-          toggleFullscreen: function (options) {
-              // the <map> element can't contain a shadow root, so we used a child <div>
-              // <mapml-viewer> can contain a shadow root, so return it directly
-              var mapEl = this.getContainer().getRootNode().host,
-                  container = mapEl.nodeName === "DIV" ? mapEl.parentElement : mapEl;
-              if (this.isFullscreen()) {
-                  if (options && options.pseudoFullscreen) {
-                      this._disablePseudoFullscreen(container);
-                  } else if (document.exitFullscreen) {
-                      document.exitFullscreen();
-                  } else if (document.mozCancelFullScreen) {
-                      document.mozCancelFullScreen();
-                  } else if (document.webkitCancelFullScreen) {
-                      document.webkitCancelFullScreen();
-                  } else if (document.msExitFullscreen) {
-                      document.msExitFullscreen();
-                  } else {
-                      this._disablePseudoFullscreen(container);
-                  }
-              } else {
-                  if (options && options.pseudoFullscreen) {
-                      this._enablePseudoFullscreen(container);
-                  } else if (container.requestFullscreen) {
-                      container.requestFullscreen();
-                  } else if (container.mozRequestFullScreen) {
-                      container.mozRequestFullScreen();
-                  } else if (container.webkitRequestFullscreen) {
-                      container.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
-                  } else if (container.msRequestFullscreen) {
-                      container.msRequestFullscreen();
-                  } else {
-                      this._enablePseudoFullscreen(container);
-                  }
-              }
-
-          },
-
-          _enablePseudoFullscreen: function (container) {
-              L.DomUtil.addClass(container, 'leaflet-pseudo-fullscreen');
-              this._setFullscreen(true);
-              this.fire('fullscreenchange');
-          },
-
-          _disablePseudoFullscreen: function (container) {
-              L.DomUtil.removeClass(container, 'leaflet-pseudo-fullscreen');
-              this._setFullscreen(false);
-              this.fire('fullscreenchange');
-          },
-
-          _setFullscreen: function(fullscreen) {
-              this._isFullscreen = fullscreen;
-              var container = this.getContainer().getRootNode().host;
-              if (fullscreen) {
-                  L.DomUtil.addClass(container, 'mapml-fullscreen-on');
-              } else {
-                  L.DomUtil.removeClass(container, 'mapml-fullscreen-on');
-              }
-              this.invalidateSize();
-          },
-
-          _onFullscreenChange: function (e) {
-              var fullscreenElement =
-                  document.fullscreenElement ||
-                  document.mozFullScreenElement ||
-                  document.webkitFullscreenElement ||
-                  document.msFullscreenElement,
-                  mapEl = this.getContainer().getRootNode().host,
-                  container = mapEl.nodeName === "DIV" ? mapEl.parentElement : mapEl;
-              
-
-              if (fullscreenElement === container && !this._isFullscreen) {
-                  this._setFullscreen(true);
-                  this.fire('fullscreenchange');
-              } else if (fullscreenElement !== container && this._isFullscreen) {
-                  this._setFullscreen(false);
-                  this.fire('fullscreenchange');
-              }
-          }
-      });
-
-      L.Map.mergeOptions({
-          fullscreenControl: false
-      });
-
-      L.Map.addInitHook(function () {
-          if (this.options.fullscreenControl) {
-              this.fullscreenControl = new FullscreenButton(this.options.fullscreenControl);
-              this.addControl(this.fullscreenControl);
-          }
-
-          var fullscreenchange;
-
-          if ('onfullscreenchange' in document) {
-              fullscreenchange = 'fullscreenchange';
-          } else if ('onmozfullscreenchange' in document) {
-              fullscreenchange = 'mozfullscreenchange';
-          } else if ('onwebkitfullscreenchange' in document) {
-              fullscreenchange = 'webkitfullscreenchange';
-          } else if ('onmsfullscreenchange' in document) {
-              fullscreenchange = 'MSFullscreenChange';
-          }
-
-          if (fullscreenchange) {
-              var onFullscreenChange = L.bind(this._onFullscreenChange, this);
-
-              this.whenReady(function () {
-                  L.DomEvent.on(document, fullscreenchange, onFullscreenChange);
-              });
-
-              this.on('unload', function () {
-                  L.DomEvent.off(document, fullscreenchange, onFullscreenChange);
-              });
-          }
-      });
-
-      var fullscreenButton = function (options) {
-          return new FullscreenButton(options);
-      };
-
-  var Crosshair = L.Layer.extend({
-    onAdd: function (map) {
-
-      // SVG crosshair design from https://github.com/xguaita/Leaflet.MapCenterCoord/blob/master/src/icons/MapCenterCoordIcon1.svg?short_path=81a5c76
-      // Optimized with SVGOMG: https://jakearchibald.github.io/svgomg/
-      let svgInnerHTML = `<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 100 100"><g stroke="#fff" stroke-linecap="round" stroke-linejoin="round"><circle cx="50.028" cy="50.219" r="3.923" stroke-width="2" color="currentColor" overflow="visible"/><path stroke-width="3" d="M4.973 54.424h31.768a4.204 4.204 0 1 0 0-8.409H4.973A4.203 4.203 0 0 0 .77 50.22a4.203 4.203 0 0 0 4.204 4.205z" color="currentColor" overflow="visible"/><path stroke-width="3" d="M54.232 5.165a4.204 4.204 0 1 0-8.408 0v31.767a4.204 4.204 0 1 0 8.408 0V5.165z"/><path stroke-width="3" d="M99.288 50.22a4.204 4.204 0 0 0-4.204-4.205H63.317a4.204 4.204 0 1 0 0 8.409h31.767a4.205 4.205 0 0 0 4.204-4.205zM45.823 95.274a4.204 4.204 0 1 0 8.409 0V63.506a4.204 4.204 0 1 0-8.409 0v31.768z" color="currentColor" overflow="visible"/></g></svg>`;
-
-      this._container = L.DomUtil.create("div", "mapml-crosshair", map._container);
-      this._container.innerHTML = svgInnerHTML;
-      map.isFocused = false;
-      this._isQueryable = false;
-
-      map.on("layerchange layeradd layerremove overlayremove", this._toggleEvents, this);
-      map.on("popupopen", this._isMapFocused, this);
-      L.DomEvent.on(map._container, "keydown keyup mousedown", this._isMapFocused, this);
-
-      this._addOrRemoveCrosshair();
-    },
-
-    onRemove: function (map) {
-      map.off("layerchange layeradd layerremove overlayremove", this._toggleEvents);
-      map.off("popupopen", this._isMapFocused);
-      L.DomEvent.off(map._container, "keydown keyup mousedown", this._isMapFocused);
-    },
-
-    _toggleEvents: function () {
-      if (this._hasQueryableLayer()) {
-        this._map.on("viewreset move moveend", this._addOrRemoveCrosshair, this);
-      } else {
-        this._map.off("viewreset move moveend", this._addOrRemoveCrosshair, this);
-      }
-      this._addOrRemoveCrosshair();
-    },
-
-    _addOrRemoveCrosshair: function (e) {
-      if (this._hasQueryableLayer()) {
-        this._container.removeAttribute("hidden");
-      } else {
-        this._container.setAttribute("hidden", "");
-      }
-    },
-
-    _addOrRemoveMapOutline: function (e) {
-      let mapContainer = this._map._container;
-      if (this._map.isFocused && !this._outline) {
-        this._outline = L.DomUtil.create("div", "mapml-outline", mapContainer);
-      } else if (!this._map.isFocused && this._outline) {
-        L.DomUtil.remove(this._outline);
-        delete this._outline;
-      }
-    },
-
-    _hasQueryableLayer: function () {
-      let layers = this._map.options.mapEl.layers;
-      if (this._map.isFocused) {
-        for (let layer of layers) {
-          if (layer.checked && layer._layer.queryable) {
-            return true;
-          }
-        }
-      }
-      return false;
-    },
-
-    _isMapFocused: function (e) {
-      //set this._map.isFocused = true if arrow buttons are used
-      if(!this._map._container.parentNode.activeElement){
-        this._map.isFocused = false;
-        return;
-      }
-      let isLeafletContainer = this._map._container.parentNode.activeElement.classList.contains("leaflet-container");
-      if (isLeafletContainer && ["keydown"].includes(e.type) && (e.shiftKey && e.keyCode === 9)) {
-        this._map.isFocused = false;
-      } else this._map.isFocused = isLeafletContainer && ["keyup", "keydown"].includes(e.type);
-
-      this._addOrRemoveMapOutline();
-      this._addOrRemoveCrosshair();
-    },
-
-  });
-
-
-  var crosshair = function (options) {
-    return new Crosshair(options);
-  };
-
-  /**
-   * M.Feature is a extension of L.Path that understands mapml feature markup
-   * It converts the markup to the following structure (abstract enough to encompass all feature types) for example:
-   *  this._outlinePath = HTMLElement;
-   *  this._parts = [
-   *    {
-   *      path: HTMLElement,
-   *      rings:[
-   *        {points:[{x:1,y:1}, ...]},
-   *        ...
-   *      ],
-   *      subrings:[
-   *        {points:[{x:2, y:2}, ...], cls:"Span Class Name", path: HTMLElement,},
-   *        ...
-   *      ],
-   *      cls:"className",
-   *    },
-   *    ...
-   *  ];
-   */
-  var Feature = L.Path.extend({
-
-    /**
-     * Initializes the M.Feature
-     * @param {HTMLElement} markup - The markup representation of the feature
-     * @param {Object} options - The options of the feature
-     */
-    initialize: function (markup, options) {
-      this.type = markup.tagName.toUpperCase();
-
-      if(this.type === "MAP-POINT" || this.type === "MAP-MULTIPOINT") options.fillOpacity = 1;
-
-      if(options.wrappers.length > 0)
-        options = Object.assign(this._convertWrappers(options.wrappers), options);
-      L.setOptions(this, options);
-
-      this.group = this.options.group;
-      this.options.interactive = this.options.link || (this.options.properties && this.options.onEachFeature);
-
-      this._parts = [];
-      this._markup = markup;
-      this.options.zoom = markup.getAttribute('zoom') || this.options.nativeZoom;
-
-      this._convertMarkup();
-
-      if(markup.querySelector('map-span') || markup.querySelector('map-a')){
-        this._generateOutlinePoints();
-      }
-
-      this.isClosed = this._isClosed();
-    },
-
-    /**
-     * Attaches link handler to the sub parts' paths
-     * @param {SVGElement} elem - The element to add listeners to, either path or g elements
-     * @param {Object} link - The link object that contains the url, type and target data
-     * @param leafletLayer
-     */
-    attachLinkHandler: function (elem, link, leafletLayer) {
-      let dragStart, container = document.createElement('div'), p = document.createElement('p'), hovered = false;
-      container.classList.add('mapml-link-preview');
-      container.appendChild(p);
-      elem.classList.add('map-a');
-      if (link.visited) elem.classList.add("map-a-visited");
-      L.DomEvent.on(elem, 'mousedown', e => dragStart = {x:e.clientX, y:e.clientY}, this);
-      L.DomEvent.on(elem, "mouseup", (e) => {
-        if (e.button !== 0) return; // don't trigger when button isn't left click
-        let onTop = true, nextLayer = this.options._leafletLayer._layerEl.nextElementSibling;
-        while(nextLayer && onTop){
-          if(nextLayer.tagName && nextLayer.tagName.toUpperCase() === "LAYER-")
-            onTop = !(nextLayer.checked && nextLayer._layer.queryable);
-          nextLayer = nextLayer.nextElementSibling;
-        }
-        if(onTop && dragStart) {
-          L.DomEvent.stop(e);
-          let dist = Math.sqrt(Math.pow(dragStart.x - e.clientX, 2) + Math.pow(dragStart.y - e.clientY, 2));
-          if (dist <= 5){
-            link.visited = true;
-            elem.setAttribute("stroke", "#6c00a2");
-            elem.classList.add("map-a-visited");
-            M.handleLink(link, leafletLayer);
-          }
-        }
-      }, this);
-      L.DomEvent.on(elem, "keypress", (e) => {
-        L.DomEvent.stop(e);
-        if(e.keyCode === 13 || e.keyCode === 32) {
-          link.visited = true;
-          elem.setAttribute("stroke", "#6c00a2");
-          elem.classList.add("map-a-visited");
-          M.handleLink(link, leafletLayer);
-        }
-      }, this);
-      L.DomEvent.on(elem, 'mouseenter keyup', (e) => {
-        if(e.target !== e.currentTarget) return;
-        hovered = true;
-        let resolver = document.createElement('a'), mapWidth = this._map.getContainer().clientWidth;
-        resolver.href = link.url;
-        p.innerHTML = resolver.href;
-
-        this._map.getContainer().appendChild(container);
-
-        while(p.clientWidth > mapWidth/2){
-          p.innerHTML = p.innerHTML.substring(0, p.innerHTML.length - 5) + "...";
-        }
-        setTimeout(()=>{
-          if(hovered) p.innerHTML = resolver.href;
-        }, 1000);
-      }, this);
-      L.DomEvent.on(elem, 'mouseout keydown mousedown', (e) => {
-        if(e.target !== e.currentTarget || !container.parentElement) return;
-        hovered = false;
-        this._map.getContainer().removeChild(container);
-      }, this);
-      L.DomEvent.on(leafletLayer._map.getContainer(),'mouseout mouseenter click', (e) => { //adds a lot of event handlers
-        if(!container.parentElement) return;
-        hovered = false;
-        this._map.getContainer().removeChild(container);
-      }, this);
-    },
-
-    /**
-     * Updates internal structure of the feature to the new map state, the structure can be found in this._parts
-     * @param {L.Map} addedMap - The map that the feature is part of, can be left blank in the case of static features
-     * @param {L.Point} tileOrigin - The tile origin for the feature, if blank then it takes the maps pixel origin in the function
-     * @param {int} zoomingTo - The zoom the map is animating to, if left blank then it takes the map zoom, its provided because in templated tiles zoom is delayed
-     * @private
-     */
-    _project: function (addedMap, tileOrigin = undefined, zoomingTo = undefined) {
-      let map = addedMap || this._map, origin = tileOrigin || map.getPixelOrigin(), zoom = zoomingTo === undefined ? map.getZoom() : zoomingTo;
-      for (let p of this._parts) {
-        p.pixelRings = this._convertRing(p.rings, map, origin, zoom);
-        for (let subP of p.subrings) {
-          subP.pixelSubrings = this._convertRing([subP], map, origin, zoom);
-        }
-      }
-      if (!this._outline) return;
-      this.pixelOutline = [];
-      for (let o of this._outline) {
-        this.pixelOutline = this.pixelOutline.concat(this._convertRing(o, map, origin, zoom));
-      }
-    },
-
-    /**
-     * Converts the PCRS points to pixel points that can be used to create the SVG
-     * @param {L.Point[][]} r - Is the rings of a feature, either the mainParts, subParts or outline
-     * @param {L.Map} map - The map that the feature is part of
-     * @param {L.Point} origin - The origin used to calculate the pixel points
-     * @param {int} zoom - The current zoom level of the map
-     * @returns {L.Point[][]}
-     * @private
-     */
-    _convertRing: function (r, map, origin, zoom) {
-      // TODO: Implement Ramer-Douglas-Peucer Algo for simplifying points
-      let scale = map.options.crs.scale(zoom), parts = [];
-      for (let sub of r) {
-        let interm = [];
-        for (let p of sub.points) {
-          let conv = map.options.crs.transformation.transform(p, scale);
-          interm.push(L.point(conv.x, conv.y)._subtract(origin).round());
-        }
-        parts.push(interm);
-      }
-      return parts;
-    },
-
-    /**
-     * Updates the features
-     * @private
-     */
-    _update: function () {
-      if (!this._map) return;
-      this._renderer._updateFeature(this);
-    },
-
-    /**
-     * Converts the map-spans, a and divs around a geometry subtype into options for the feature
-     * @param {HTMLElement[]} elems - The current zoom level of the map
-     * @private
-     */
-    _convertWrappers: function (elems) {
-      if(!elems || elems.length === 0) return;
-      let classList = '', output = {};
-      for(let elem of elems){
-        if(elem.tagName.toUpperCase() !== "MAP-A" && elem.className){
-          classList +=`${elem.className} `;
-        } else if(!output.link && elem.getAttribute("href")) {
-          let link = {};
-          link.url = elem.getAttribute("href");
-          if(elem.hasAttribute("target")) link.target = elem.getAttribute("target");
-          if(elem.hasAttribute("type")) link.type = elem.getAttribute("type");
-          if(elem.hasAttribute("inplace")) link.inPlace = true;
-          output.link = link;
-        }
-      }
-      output.className = `${classList} ${this.options.className}`.trim();
-      return output;
-    },
-
-    /**
-     * Converts this._markup to the internal structure of features
-     * @private
-     */
-    _convertMarkup: function () {
-      if (!this._markup) return;
-
-      let attr = this._markup.attributes;
-      this.featureAttributes = {};
-      if(this.options.link && this._markup.parentElement.tagName.toUpperCase() === "MAP-A" && this._markup.parentElement.parentElement.tagName.toUpperCase() !== "MAP-GEOMETRY")
-        this.featureAttributes.tabindex = "0";
-      for(let i = 0; i < attr.length; i++){
-        this.featureAttributes[attr[i].name] = attr[i].value;
-      }
-
-      let first = true;
-      for (let c of this._markup.querySelectorAll('map-coordinates')) {              //loops through the coordinates of the child
-        let ring = [], subRings = [];
-        this._coordinateToArrays(c, ring, subRings, this.options.className);              //creates an array of pcrs points for the main ring and the subparts
-        if (!first && this.type === "MAP-POLYGON") {
-          this._parts[0].rings.push(ring[0]);
-          if (subRings.length > 0)
-            this._parts[0].subrings = this._parts[0].subrings.concat(subRings);
-        } else if (this.type === "MAP-MULTIPOINT") {
-          for (let point of ring[0].points.concat(subRings)) {
-            this._parts.push({ rings: [{ points: [point] }], subrings: [], cls:`${point.cls || ""} ${this.options.className || ""}`.trim() });
-          }
-        } else {
-          this._parts.push({ rings: ring, subrings: subRings, cls: `${this.featureAttributes.class || ""} ${this.options.className || ""}`.trim() });
-        }
-        first = false;
-      }
-    },
-
-    /**
-     * Generates the feature outline, subtracting the map-spans to generate those separately
-     * @private
-     */
-    _generateOutlinePoints: function () {
-      if (this.type === "MAP-MULTIPOINT" || this.type === "MAP-POINT" || this.type === "MAP-LINESTRING" || this.type === "MAP-MULTILINESTRING") return;
-
-      this._outline = [];
-      for (let coords of this._markup.querySelectorAll('map-coordinates')) {
-        let nodes = coords.childNodes, cur = 0, tempDiv = document.createElement('div'), nodeLength = nodes.length;
-        for(let i = 0; i < nodes.length; i++){
-          if(nodes[i].textContent.trim().length === 0){
-            nodes[i].remove();
-          }
-        }
-        for (let n of nodes) {
-          let line = [];
-          if (!n.tagName) {  //no tagName means it's text content
-            let c = '', ind = (((cur - 1)%nodes.length) + nodes.length) % nodes.length; // this equation turns Javascript's % to how it behaves in C for example
-            if (nodes[ind].tagName) {
-              let prev = nodes[ind].textContent.trim().split(/\s+/);
-              c += `${prev[prev.length - 2]} ${prev[prev.length - 1]} `;
-            }
-            c += n.textContent;
-            ind = (((cur + 1)%nodes.length) + nodes.length) % nodes.length; // this is equivalent to C/C++'s (cur + 1) % nodes.length
-            if (nodes[ind].tagName) {
-              let next = nodes[ind].textContent.trim().split(/\s+/);
-              c += `${next[0]} ${next[1]} `;
-            }
-            tempDiv.innerHTML = c;
-            this._coordinateToArrays(tempDiv, line, [], true, this.featureAttributes.class || this.options.className);
-            this._outline.push(line);
-          }
-          cur++;
-        }
-      }
-    },
-
-    /**
-     * Converts map-coordinates element to an object representing the parts and subParts
-     * @param {HTMLElement} coords - A single map-coordinates element
-     * @param {Object[]} main - An empty array representing the main parts
-     * @param {Object[]} subParts - An empty array representing the sub parts
-     * @param {boolean} isFirst - A true | false representing if the current HTML element is the parent map-coordinates element or not
-     * @param {string} cls - The class of the coordinate/span
-     * @param parents
-     * @private
-     */
-    _coordinateToArrays: function (coords, main, subParts, isFirst = true, cls = undefined, parents = []) {
-      for (let span of coords.children) {
-        this._coordinateToArrays(span, main, subParts, false, span.getAttribute("class"), parents.concat([span]));
-      }
-      let noSpan = coords.textContent.replace(/(<([^>]+)>)/ig, ''),
-          pairs = noSpan.match(/(\S+\s+\S+)/gim), local = [];
-      for (let p of pairs) {
-        let numPair = [];
-        p.split(/\s+/gim).forEach(M.parseNumber, numPair);
-        let point = M.pointToPCRSPoint(L.point(numPair), this.options.zoom, this.options.projection, this.options.nativeCS);
-        local.push(point);
-        this._bounds = this._bounds ? this._bounds.extend(point) : L.bounds(point, point);
-      }
-      if (isFirst) {
-        main.push({ points: local });
-      } else {
-        let attrMap = {}, attr = coords.attributes, wrapperAttr = this._convertWrappers(parents);
-        if(wrapperAttr.link) attrMap.tabindex = "0";
-        for(let i = 0; i < attr.length; i++){
-          if(attr[i].name === "class") continue;
-          attrMap[attr[i].name] = attr[i].value;
-        }
-        subParts.unshift({
-          points: local,
-          cls: `${cls || ""} ${wrapperAttr.className || ""}`.trim(),
-          attr: attrMap,
-          link: wrapperAttr.link,
-          linkTarget: wrapperAttr.linkTarget,
-          linkType: wrapperAttr.linkType});
-      }
-    },
-
-    /**
-     * Returns if the feature is closed or open, useful when styling
-     * @returns {boolean}
-     * @private
-     */
-    _isClosed: function () {
-      switch (this.type) {
-        case 'MAP-POLYGON':
-        case 'MAP-MULTIPOLYGON':
-        case 'MAP-POINT':
-        case 'MAP-MULTIPOINT':
-          return true;
-        case 'MAP-LINESTRING':
-        case 'MAP-MULTILINESTRING':
-          return false;
-        default:
-          return false;
-      }
-    },
-
-    /**
-     * Returns the center of the entire feature
-     * @returns {L.Point}
-     */
-    getCenter: function () {
-      if (!this._bounds) return null;
-      return this._map.options.crs.unproject(this._bounds.getCenter());
-    },
-  });
-
-  /**
-   *
-   * @param {HTMLElement} markup - The markup of the feature
-   * @param {Object} options - Options of the feature
-   * @returns {M.Feature}
-   */
-  var feature = function (markup, options) {
-    return new Feature(markup, options);
-  };
-
-  /**
-   * Returns a new Feature Renderer
-   * @param {Object} options - Options for the renderer
-   * @returns {*}
-   */
-  var FeatureRenderer = L.SVG.extend({
-    
-
-    /**
-     * Override method of same name from L.SVG, use the this._container property
-     * to set up the role="none presentation" on featureGroupu container,
-     * per this recommendation: 
-     * https://github.com/Maps4HTML/Web-Map-Custom-Element/pull/471#issuecomment-845192246
-     * @private overrides ancestor method so that we have a _container to work with
-     */
-    _initContainer: function () {
-      // call the method we're overriding, per https://leafletjs.com/examples/extending/extending-1-classes.html#methods-of-the-parent-class
-      // note you have to pass 'this' as the first arg
-      L.SVG.prototype._initContainer.call(this);
-      // knowing that the previous method call creates the this._container, we
-      // access it and set the role="none presetation" which suppresses the 
-      // announcement of "Graphic" on each feature focus.
-      this._container.setAttribute('role', 'none presentation');
-    },
-    
-    /**
-     * Creates all the appropriate path elements for a M.Feature
-     * @param {M.Feature} layer - The M.Feature that needs paths generated
-     * @param {boolean} stampLayer - Whether or not a layer should be stamped and stored in the renderer layers
-     * @private
-     */
-    _initPath: function (layer, stampLayer = true) {
-
-      if(layer._outline) {
-        let outlinePath = L.SVG.create('path');
-        if (layer.options.className) L.DomUtil.addClass(outlinePath, layer.featureAttributes.class || layer.options.className);
-        L.DomUtil.addClass(outlinePath, 'mapml-feature-outline');
-        outlinePath.style.fill = "none";
-        layer.outlinePath = outlinePath;
-      }
-
-      //creates the main parts and sub parts paths
-      for (let p of layer._parts) {
-        if (p.rings){
-          this._createPath(p, layer.options.className, layer.featureAttributes['aria-label'], layer.options.interactive, layer.featureAttributes);
-          if(layer.outlinePath) p.path.style.stroke = "none";
-        }
-        if (p.subrings) {
-          for (let r of p.subrings) {
-            this._createPath(r, layer.options.className, r.attr['aria-label'], (r.link !== undefined), r.attr);
-            if(r.attr && r.attr.tabindex){
-              p.path.setAttribute('tabindex', r.attr.tabindex || '0');
-            }
-          }
-        }
-        this._updateStyle(layer);
-      }
-      if(stampLayer){
-        let stamp = L.stamp(layer);
-        this._layers[stamp] = layer;
-      }
-    },
-
-    /**
-     * Creates paths for either mainParts, subParts or outline of a feature
-     * @param {Object} ring - The ring the current path is being generated for
-     * @param {string} title - The accessible aria-label of a path
-     * @param {string} cls - The class of the path
-     * @param {boolean} interactive - The boolean representing whether a feature is interactive or not
-     * @param {Object} attr - Attributes map
-     * @private
-     */
-    _createPath: function (ring, cls, title, interactive = false, attr = undefined) {
-      let p = L.SVG.create('path');
-      ring.path = p;
-      if(!attr) {
-        if (title) p.setAttribute('aria-label', title);
-      } else {
-        for(let [name, value] of Object.entries(attr)){
-          if(name === "id") continue;
-          p.setAttribute(name, value);
-        }
-      }
-      if (ring.cls || cls) {
-        L.DomUtil.addClass(p, ring.cls || cls);
-      }
-      if (interactive) {
-        L.DomUtil.addClass(p, 'leaflet-interactive');
-      }
-    },
-
-    /**
-     * Adds all the paths needed for a feature
-     * @param {M.Feature} layer - The feature that needs it's paths added
-     * @param {HTMLElement} container - The location the paths need to be added to
-     * @param {boolean} interactive - Whether a feature is interactive or not
-     * @private
-     */
-    _addPath: function (layer, container = undefined, interactive = true) {
-      if (!this._rootGroup && !container) { this._initContainer(); }
-      let c = container || this._rootGroup, outlineAdded = false;
-      if(interactive) {
-        layer.addInteractiveTarget(layer.group);
-      }
-      for (let p of layer._parts) {
-        if (p.path)
-          layer.group.appendChild(p.path);
-        if (interactive){
-          if(layer.options.link) layer.attachLinkHandler(p.path, layer.options.link, layer.options._leafletLayer);
-          layer.addInteractiveTarget(p.path);
-        }
-
-        if(!outlineAdded && layer.pixelOutline) {
-          layer.group.appendChild(layer.outlinePath);
-          outlineAdded = true;
-        }
-
-        for (let subP of p.subrings) {
-          if (subP.path) {
-            if (subP.link){
-              layer.attachLinkHandler(subP.path, subP.link, layer.options._leafletLayer);
-              layer.addInteractiveTarget(subP.path);
-            }
-            layer.group.appendChild(subP.path);
-          }
-        }
-      }
-      c.appendChild(layer.group);
-    },
-
-    /**
-     * Removes all the paths related to a feature
-     * @param {M.Feature} layer - The feature who's paths need to be removed
-     * @private
-     */
-    _removePath: function (layer) {
-      for (let p of layer._parts) {
-        if (p.path) {
-          layer.removeInteractiveTarget(p.path);
-          L.DomUtil.remove(p.path);
-        }
-        for (let subP of p.subrings) {
-          if (subP.path)
-            L.DomUtil.remove(subP.path);
-        }
-      }
-      if(layer.outlinePath) L.DomUtil.remove(layer.outlinePath);
-      layer.removeInteractiveTarget(layer.group);
-      L.DomUtil.remove(layer.group);
-      delete this._layers[L.stamp(layer)];
-    },
-
-    /**
-     * Updates the d attribute of all paths of a feature
-     * @param {M.Feature} layer - The Feature that needs updating
-     * @private
-     */
-    _updateFeature: function (layer) {
-      if (layer.pixelOutline) this._setPath(layer.outlinePath, this.geometryToPath(layer.pixelOutline, false));
-      for (let p of layer._parts) {
-        this._setPath(p.path, this.geometryToPath(p.pixelRings, layer.isClosed));
-        for (let subP of p.subrings) {
-          this._setPath(subP.path, this.geometryToPath(subP.pixelSubrings, false));
-        }
-      }
-    },
-
-    /**
-     * Generates the marker d attribute for a given point
-     * @param {L.Point} p - The point of the marker
-     * @returns {string}
-     * @private
-     */
-    _pointToMarker: function (p) {
-      return `M${p.x} ${p.y} L${p.x - 12.5} ${p.y - 30} C${p.x - 12.5} ${p.y - 50}, ${p.x + 12.5} ${p.y - 50}, ${p.x + 12.5} ${p.y - 30} L${p.x} ${p.y}z`;
-    },
-
-    /**
-     * Updates the styles of all paths of a feature
-     * @param {M.Feature} layer - The feature that needs styles updated
-     * @private
-     */
-    _updateStyle: function (layer) {
-      this._updatePathStyle(layer.outlinePath, layer, false, true);
-      for (let p of layer._parts) {
-        if (p.path) {
-          this._updatePathStyle(p.path, layer, true);
-        }
-        for (let subP of p.subrings) {
-          if (subP.path)
-            this._updatePathStyle(subP.path, layer);
-        }
-      }
-    },
-
-    /**
-     * Updates the style of a single path
-     * @param {HTMLElement} path - The path that needs updating
-     * @param {M.Feature} layer - The feature layer
-     * @param {boolean} isMain - Whether it's the main parts or not
-     * @param {boolean} isOutline - Whether a path is an outline or not
-     * @private
-     */
-    _updatePathStyle: function (path, layer, isMain = false, isOutline = false) {
-      if (!path || !layer) { return; }
-      let options = layer.options, isClosed = layer.isClosed;
-      if ((options.stroke && (!isClosed || isOutline)) || (isMain && !layer.outlinePath)) {
-        path.setAttribute('stroke', options.color);
-        path.setAttribute('stroke-opacity', options.opacity);
-        path.setAttribute('stroke-width', options.weight);
-        path.setAttribute('stroke-linecap', options.lineCap);
-        path.setAttribute('stroke-linejoin', options.lineJoin);
-
-        if (options.dashArray) {
-          path.setAttribute('stroke-dasharray', options.dashArray);
-        } else {
-          path.removeAttribute('stroke-dasharray');
-        }
-
-        if (options.dashOffset) {
-          path.setAttribute('stroke-dashoffset', options.dashOffset);
-        } else {
-          path.removeAttribute('stroke-dashoffset');
-        }
-
-        if (options.link){
-          path.setAttribute("stroke", options.link.visited?"#6c00a2":"#0000EE");
-          path.setAttribute("stroke-opacity", "1");
-          path.setAttribute("stroke-width", "1px");
-          path.setAttribute("stroke-dasharray", "none");
-        }
-      } else {
-        path.setAttribute('stroke', 'none');
-      }
-
-      if(isClosed && !isOutline) {
-        if (!options.fill) {
-          path.setAttribute('fill', options.fillColor || options.color);
-          path.setAttribute('fill-opacity', options.fillOpacity);
-          path.setAttribute('fill-rule', options.fillRule || 'evenodd');
-        } else {
-          path.setAttribute('fill', options.color);
-        }
-      } else {
-        path.setAttribute('fill', 'none');
-      }
-    },
-
-    /**
-     * Sets the d attribute of a path
-     * @param {HTMLElement} path - The path that is being updated
-     * @param {string} def - The new d attribute of the path
-     * @private
-     */
-    _setPath: function (path, def) {
-      path.setAttribute('d', def);
-    },
-
-    /**
-     * Generates the d string of a feature part
-     * @param {L.Point[]} rings - The points making up a given part of a feature
-     * @param {boolean} closed - Whether a feature is closed or not
-     * @returns {string}
-     */
-    geometryToPath: function (rings, closed) {
-      let str = '', i, j, len, len2, points, p;
-
-      for (i = 0, len = rings.length; i < len; i++) {
-        points = rings[i];
-        if (points.length === 1) {
-          return this._pointToMarker(points[0]);
-        }
-        for (j = 0, len2 = points.length; j < len2; j++) {
-          p = points[j];
-          str += (j ? 'L' : 'M') + p.x + ' ' + p.y;
-        }
-        str += closed ? 'z' : '';
-      }
-      return str || 'M0 0';
-    },
-  });
-
-  /**
-   * Returns new M.FeatureRenderer
-   * @param {Object} options - Options for the renderer
-   * @returns {M.FeatureRenderer}
-   */
-  var featureRenderer = function (options) {
-    return new FeatureRenderer(options);
-  };
-
-  var FeatureGroup = L.FeatureGroup.extend({
-
-    /**
-     * Initialize the feature group
-     * @param {M.Feature[]} layers
-     * @param {Object} options
-     */
-    initialize: function (layers, options) {
-      if(options.wrappers && options.wrappers.length > 0)
-        options = Object.assign(M.Feature.prototype._convertWrappers(options.wrappers), options);
-
-      L.LayerGroup.prototype.initialize.call(this, layers, options);
-
-      if((this.options.onEachFeature && this.options.properties) || this.options.link) {
-        this.options.group.setAttribute('tabindex', '0');
-        L.DomUtil.addClass(this.options.group, "leaflet-interactive");
-        L.DomEvent.on(this.options.group, "keyup keydown mousedown", this._handleFocus, this);
-        let firstLayer = layers[Object.keys(layers)[0]];
-        if(layers.length === 1 && firstLayer.options.link) this.options.link = firstLayer.options.link;
-        if(this.options.link){
-          M.Feature.prototype.attachLinkHandler.call(this, this.options.group, this.options.link, this.options._leafletLayer);
-          this.options.group.setAttribute('role', 'link');
-        } else {
-          this.options.group.setAttribute("aria-expanded", "false");
-          this.options.group.setAttribute('role', 'button');
-          this.options.onEachFeature(this.options.properties, this);
-          this.off("click", this._openPopup);
-        }
-      }
-
-      this.options.group.setAttribute('aria-label', this.options.accessibleTitle);
-      if(this.options.featureID) this.options.group.setAttribute("data-fid", this.options.featureID);
-    },
-
-    /**
-     * Handler for focus events
-     * @param {L.DOMEvent} e - Event that occurred
-     * @private
-     */
-    _handleFocus: function(e) {
-      if(e.target.tagName.toUpperCase() !== "G") return;
-      if((e.keyCode === 9 || e.keyCode === 16 || e.keyCode === 13) && e.type === "keyup") {
-        this.openTooltip();
-      } else if (e.keyCode === 13 || e.keyCode === 32){
-        this.closeTooltip();
-        if(!this.options.link && this.options.onEachFeature){
-          L.DomEvent.stop(e);
-          this.openPopup();
-        }
-      } else {
-        this.closeTooltip();
-      }
-    },
-
-    /**
-     * Add a M.Feature to the M.FeatureGroup
-     * @param layer
-     */
-    addLayer: function (layer) {
-      if(!layer.options.link && layer.options.interactive) {
-        this.options.onEachFeature(this.options.properties, layer);
-      }
-      L.FeatureGroup.prototype.addLayer.call(this, layer);
-    },
-
-    /**
-     * Focuses the previous function in the sequence on previous button press
-     * @param e
-     * @private
-     */
-    _previousFeature: function(e){
-      let group = this._source.group.previousSibling;
-      if(!group){
-        let currentIndex = this._source.group.closest("div.mapml-layer").style.zIndex;
-        let overlays = this._map.getPane("overlayPane").children;
-        for(let i = overlays.length - 1; i >= 0; i--){
-          let layer = overlays[i];
-          if(layer.style.zIndex >= currentIndex) continue;
-          group = layer.querySelector("g.leaflet-interactive");
-          if(group){
-            group = group.parentNode.lastChild;
-            break;
-          }
-        }
-        if (!group) group = this._source.group;
-      }
-      group.focus();
-      this._map.closePopup();
-    },
-
-    /**
-     * Focuses next feature in sequence
-     * @param e
-     * @private
-     */
-    _nextFeature: function(e){
-      let group = this._source.group.nextSibling;
-      if(!group){
-        let currentIndex = this._source.group.closest("div.mapml-layer").style.zIndex;
-
-        for(let layer of this._map.getPane("overlayPane").children){
-          if(layer.style.zIndex <= currentIndex) continue;
-          group = layer.querySelectorAll("g.leaflet-interactive");
-          if(group.length > 0)break;
-        }
-        group = group && group.length > 0 ? group[0] : this._source.group;
-      }
-      group.focus();
-      this._map.closePopup();
-    },
-  });
-
-  /**
-   * Returns new M.FeatureGroup
-   * @param {M.Feature[]} layers - Layers belonging to feature group
-   * @param {Object} options - Options for the feature group
-   * @returns {M.FeatureGroup}
-   */
-  var featureGroup = function (layers, options) {
-    return new FeatureGroup(layers, options);
-  };
-
-  var AnnounceMovement = L.Handler.extend({
-      addHooks: function () {
-          this._map.on({
-              layeradd: this.totalBounds,
-              layerremove: this.totalBounds,
-          });
-
-          this._map.options.mapEl.addEventListener('moveend', this.announceBounds);
-          this._map.dragging._draggable.addEventListener('dragstart', this.dragged);
-          this._map.options.mapEl.addEventListener('mapfocused', this.focusAnnouncement);
-      },
-      removeHooks: function () {
-          this._map.off({
-              layeradd: this.totalBounds,
-              layerremove: this.totalBounds,
-          });
-
-          this._map.options.mapEl.removeEventListener('moveend', this.announceBounds);
-          this._map.dragging._draggable.removeEventListener('dragstart', this.dragged);
-          this._map.options.mapEl.removeEventListener('mapfocused', this.focusAnnouncement);
-      },
-
-       focusAnnouncement: function () {
-           let mapEl = this;
-           setTimeout(function (){
-               let el = mapEl.querySelector(".mapml-web-map") ? mapEl.querySelector(".mapml-web-map").shadowRoot.querySelector(".leaflet-container") :
-                   mapEl.shadowRoot.querySelector(".leaflet-container");
-
-               let mapZoom = mapEl._map.getZoom();
-               let location = M.gcrsToTileMatrix(mapEl);
-               let standard = M.options.locale.amZoom + " " + mapZoom + " " + M.options.locale.amColumn + " " + location[0] + " " + M.options.locale.amRow + " " + location[1];
-
-               if(mapZoom === mapEl._map._layersMaxZoom){
-                   standard = M.options.locale.amMaxZoom + " " + standard;
-               }
-               else if(mapZoom === mapEl._map._layersMinZoom){
-                   standard = M.options.locale.amMinZoom + " " + standard;
-               }
-
-               el.setAttribute("aria-roledescription", "region " + standard);
-               setTimeout(function () {
-                   el.removeAttribute("aria-roledescription");
-               }, 2000);
-           }, 0);
-       },
-
-      announceBounds: function () {
-          if(this._traversalCall > 0){
-              return;
-          }
-          let mapZoom = this._map.getZoom();
-          let mapBounds = M.pixelToPCRSBounds(this._map.getPixelBounds(),mapZoom,this._map.options.projection);
-
-          let visible = true;
-          if(this._map.totalLayerBounds){
-              visible = mapZoom <= this._map._layersMaxZoom && mapZoom >= this._map._layersMinZoom &&
-                  this._map.totalLayerBounds.overlaps(mapBounds);
-          }
-
-          let output = this.querySelector(".mapml-web-map") ? this.querySelector(".mapml-web-map").shadowRoot.querySelector(".mapml-screen-reader-output") :
-              this.shadowRoot.querySelector(".mapml-screen-reader-output");
-
-          //GCRS to TileMatrix
-          let location = M.gcrsToTileMatrix(this);
-          let standard = M.options.locale.amZoom + " " + mapZoom + " " + M.options.locale.amColumn + " " + location[0] + " " + M.options.locale.amRow + " " + location[1];
-
-          if(!visible){
-              let outOfBoundsPos = this._history[this._historyIndex];
-              let inBoundsPos = this._history[this._historyIndex - 1];
-              this.back();
-              this._history.pop();
-
-              if(outOfBoundsPos.zoom !== inBoundsPos.zoom){
-                  output.innerText = M.options.locale.amZoomedOut;
-              }
-              else if(this._map.dragging._draggable.wasDragged){
-                  output.innerText = M.options.locale.amDraggedOut;
-              }
-              else if(outOfBoundsPos.x > inBoundsPos.x){
-                  output.innerText = M.options.locale.amEastBound;
-              }
-              else if(outOfBoundsPos.x < inBoundsPos.x){
-                  output.innerText = M.options.locale.amWestBound;
-              }
-              else if(outOfBoundsPos.y < inBoundsPos.y){
-                  output.innerText = M.options.locale.amNorthBound;
-              }
-              else if(outOfBoundsPos.y > inBoundsPos.y){
-                  output.innerText = M.options.locale.amSouthBound;
-              }
-
-          }
-          else {
-              let prevZoom = this._history[this._historyIndex - 1] ? this._history[this._historyIndex - 1].zoom : this._history[this._historyIndex].zoom;
-              if(mapZoom === this._map._layersMaxZoom && mapZoom !== prevZoom){
-                  output.innerText = M.options.locale.amMaxZoom + " " + standard;
-              }
-              else if(mapZoom === this._map._layersMinZoom && mapZoom !== prevZoom){
-                  output.innerText = M.options.locale.amMinZoom + " " + standard;
-              }
-              else {
-                  output.innerText = standard;
-              }
-          }
-          this._map.dragging._draggable.wasDragged = false;
-      },
-
-      totalBounds: function () {
-          let layers = Object.keys(this._layers);
-          let bounds = L.bounds();
-
-          layers.forEach(i => {
-              if(this._layers[i].layerBounds){
-                  if(!bounds){
-                      let point = this._layers[i].layerBounds.getCenter();
-                      bounds = L.bounds(point, point);
-                  }
-                  bounds.extend(this._layers[i].layerBounds.min);
-                  bounds.extend(this._layers[i].layerBounds.max);
-              }
-          });
-
-          this.totalLayerBounds = bounds;
-      },
-
-      dragged: function () {
-          this.wasDragged = true;
-      }
-
-  });
-
-  var Options = {
-    announceMovement: false,
-    locale: {
-      cmBack: "Back",
-      cmForward: "Forward",
-      cmReload: "Reload",
-      cmToggleControls: "Toggle Controls",
-      cmCopyCoords: "Copy Coordinates",
-      cmToggleDebug: "Toggle Debug Mode",
-      cmCopyMapML: "Copy MapML",
-      cmViewSource: "View Map Source",
-      cmCopyAll: "All",
-      lmZoomToLayer: "Zoom To Layer",
-      lmCopyExtent: "Copy Extent",
-      lcOpacity: "Opacity",
-      btnZoomIn: "Zoom in",
-      btnZoomOut: "Zoom out",
-      btnFullScreen: "View fullscreen",
-      amZoom: "zoom level",
-      amColumn: "column",
-      amRow: "row",
-      amMaxZoom: "At maximum zoom level, zoom in disabled",
-      amMinZoom: "At minimum zoom level, zoom out disabled",
-      amZoomedOut: "Zoomed out of bounds, returning to",
-      amDraggedOut: "Dragged out of bounds, returning to",
-      amEastBound: "Reached east bound, panning east disabled",
-      amWestBound: "Reached west bound, panning west disabled",
-      amNorthBound: "Reached north bound, panning north disabled",
-      amSouthBound: "Reached south bound, panning south disabled"
-    }
-  };
-
-  L.Map.Keyboard.include({
-      _onKeyDown: function (e) {
-
-          if (e.altKey || e.metaKey) { return; }
-
-          let zoomIn = {
-              187: 187,
-              107: 107,
-              61: 61,
-              171: 171
-          };
-
-          let zoomOut = {
-              189: 189,
-              109: 109,
-              54: 54,
-              173: 173
-          };
-
-          var key = e.keyCode,
-              map = this._map,
-              offset;
-
-          if (key in this._panKeys) {
-              if (!map._panAnim || !map._panAnim._inProgress) {
-                  offset = this._panKeys[key];
-                  if (e.shiftKey) {
-                      offset = L.point(offset).multiplyBy(3);
-                  }
-                  if (e.ctrlKey) {
-                      offset = L.point(offset).divideBy(5);
-                  }
-
-                  map.panBy(offset);
-
-                  if (map.options.maxBounds) {
-                      map.panInsideBounds(map.options.maxBounds);
-                  }
-              }
-          } else if (key in this._zoomKeys) {
-              if((key in zoomIn && map._layersMaxZoom !== map.getZoom()) || (key in zoomOut && map._layersMinZoom !== map.getZoom()))
-                  map.setZoom(map.getZoom() + (e.shiftKey ? 3 : 1) * this._zoomKeys[key]);
-
-          } else if (key === 27 && map._popup && map._popup.options.closeOnEscapeKey) {
-              map.closePopup();
-
-          } else {
-              return;
-          }
-
-          L.DomEvent.stop(e);
-      }
-  });
-
-  var FeatureIndex = L.Layer.extend({
-      onAdd: function (map) {
-          let svgInnerHTML = `<svg
-                            xmlns:dc="http://purl.org/dc/elements/1.1/"
-                            xmlns:cc="http://creativecommons.org/ns#"
-                            xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-                            xmlns:svg="http://www.w3.org/2000/svg" 
-                            xmlns="http://www.w3.org/2000/svg" version="1.1"
-                            x="0px" y="0px" viewBox="0 0 99.999998 99.999998" xml:space="preserve">
-                                <g>
-                                    <rect  width="100" height="100"
-                                    style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#000000;fill-opacity:0;fill-rule:nonzero;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
-                                    />
-                                </g>
-                            </svg>`;
-
-          this._container = L.DomUtil.create("div", "mapml-feature-index-box", map._container);
-          this._container.innerHTML = svgInnerHTML;
-
-          this._output = L.DomUtil.create("output", "mapml-feature-index", map._container);
-          this._body = L.DomUtil.create("span", "mapml-feature-index-content", this._output);
-          this._moreContent = L.DomUtil.create("span", "mapml-feature-index-more-content", this._output);
-          this._moreContent.style.display = "none";
-
-          map.on("layerchange layeradd layerremove overlayremove", this._toggleEvents, this);
-          map.on('moveend focus', this._checkOverlap, this);
-          map.on("keydown", this._toggleMoreContent, this);
-          this._addOrRemoveFeatureIndex();
-      },
-
-      _checkOverlap: function () {
-          let bounds = this._map.getPixelBounds();
-          let center = bounds.getCenter();
-          let wRatio = Math.abs(bounds.min.x - bounds.max.x) / (this._map.options.mapEl.width);
-          let hRatio = Math.abs(bounds.min.y - bounds.max.y) / (this._map.options.mapEl.height);
-
-          let w = wRatio * 36;
-          let h = hRatio * 36;
-          let minPoint = L.point(center.x - w, center.y + h);
-          let maxPoint = L.point(center.x + w, center.y - h);
-          let b = L.bounds(minPoint, maxPoint);
-          let featureIndexBounds = M.pixelToPCRSBounds(b,this._map.getZoom(),this._map.options.projection);
-
-          let layers = this._map._layers;
-          let index = 1;
-          let keys = Object.keys(layers);
-          let body = this._body;
-
-          body.innerHTML = "";
-
-          let moreContent = this._moreContent;
-          moreContent.innerHTML = "";
-
-          keys.forEach(i => {
-              if(layers[i].featureAttributes && featureIndexBounds.overlaps(layers[i]._bounds)){
-                  let label = layers[i].group.getAttribute("aria-label");
-
-                  if(index%9 === 0){
-                      let span = document.createElement("span");
-                      span.setAttribute("id", index/9);
-                      moreContent.appendChild(span);
-                      if(index === 9){
-                          body.appendChild(this._updateOutput("More results", 9));
-                          index += 1;
-                      }
-                  }
-
-                  if(index > 9){
-                      let value = Math.floor((index - 1)/9);
-                      let span = moreContent.querySelector(`[id=${CSS.escape(value)}]`);
-                      span.appendChild(this._updateOutput(label, index));
-                  } else {
-                      body.appendChild(this._updateOutput(label, index));
-                  }
-                  index += 1;
-
-              }
-          });
-      },
-      _updateOutput: function (label, index) {
-          let span = document.createElement("span");
-          span.innerHTML = `<kbd>${index}</kbd>` + " " + label;
-          return span;
-      },
-      _toggleMoreContent: function (e){
-          let display = this._moreContent.style.display;
-          if(e.originalEvent.keyCode === 57){
-              if(display === "none"){
-                  this._moreContent.style.display = "inline-block";
-              } else {
-                  this._moreContent.style.display = "none";
-              }
-          }
-      },
-
-      _toggleEvents: function (){
-          this._map.on("viewreset move moveend focus blur", this._addOrRemoveFeatureIndex, this);
-
-      },
-
-      _addOrRemoveFeatureIndex: function (e) {
-          let obj = this;
-          setTimeout(function() {
-              if (e && e.type === "focus") {
-                  obj._container.querySelector('rect').style.display = "inline";
-                  obj._output.style.display = "block";
-              } else if (e && e.type === "blur") {
-                  obj._container.querySelector('rect').style.display = "none";
-                  obj._output.style.display = "none";
-              } else if (obj._map.isFocused) {
-                  obj._container.querySelector('rect').style.display = "inline";
-                  obj._output.style.display = "block";
-              } else {
-                  obj._container.querySelector('rect').style.display = "none";
-                  obj._output.style.display = "none";
-              }
-          }, 0);
-
-      },
-
-  });
-
-  var featureIndex = function (options) {
-      return new FeatureIndex(options);
-  };
-
-  /* 
-   * Copyright 2015-2016 Canada Centre for Mapping and Earth Observation, 
-   * Earth Sciences Sector, Natural Resources Canada.
-   * 
-   * License
-   * 
-   * By obtaining and/or copying this work, you (the licensee) agree that you have 
-   * read, understood, and will comply with the following terms and conditions.
-   * 
-   * Permission to copy, modify, and distribute this work, with or without 
-   * modification, for any purpose and without fee or royalty is hereby granted, 
-   * provided that you include the following on ALL copies of the work or portions 
-   * thereof, including modifications:
-   * 
-   * The full text of this NOTICE in a location viewable to users of the 
-   * redistributed or derivative work.
-   * 
-   * Any pre-existing intellectual property disclaimers, notices, or terms and 
-   * conditions. If none exist, the W3C Software and Document Short Notice should 
-   * be included.
-   * 
-   * Notice of any changes or modifications, through a copyright statement on the 
-   * new code or document such as "This software or document includes material 
-   * copied from or derived from [title and URI of the W3C document]. 
-   * Copyright © [YEAR] W3C® (MIT, ERCIM, Keio, Beihang)."
-   * 
-   * Disclaimers
-   * 
-   * THIS WORK IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS 
-   * OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF 
-   * MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE 
-   * SOFTWARE OR DOCUMENT WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, 
-   * TRADEMARKS OR OTHER RIGHTS.
-   * COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR 
-   * CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENT.
-   * 
-   * The name and trademarks of copyright holders may NOT be used in advertising or 
-   * publicity pertaining to the work without specific, written prior permission. 
-   * Title to copyright in this work will at all times remain with copyright holders.
-   */
-
-  /* global L, Node */
-  (function (window, document, undefined$1) {
-    
-  var M = {};
-  window.M = M;
-
-  (function () {
-    M.detectImagePath = function (container) {
-      // this relies on the CSS style leaflet-default-icon-path containing a 
-      // relative url() that leads to a valid icon file.  Since that depends on
-      // how all of this stuff is deployed (i.e. custom element or as leaflet-plugin)
-      // also, because we're using 'shady DOM' api, the container must be 
-      // a shady dom container, because the custom element tags it with added
-      // style-scope ... and related classes.
-     var el = L.DomUtil.create('div',  'leaflet-default-icon-path', container);
-     var path = L.DomUtil.getStyle(el, 'background-image') ||
-                L.DomUtil.getStyle(el, 'backgroundImage');	// IE8
-
-     container.removeChild(el);
-
-     if (path === null || path.indexOf('url') !== 0) {
-      path = '';
-     } else {
-      path = path.replace(/^url\(["']?/, '').replace(/marker-icon\.png["']?\)$/, '');
-     }
-
-     return path;
-    };
-    M.mime = "text/mapml";
-
-    let mapOptions = window.document.head.querySelector("map-options");
-    M.options = Options;
-    if (mapOptions) M.options = Object.assign(M.options, JSON.parse(mapOptions.innerHTML));
-
-    // see https://leafletjs.com/reference-1.5.0.html#crs-l-crs-base
-    // "new classes can't inherit from (L.CRS), and methods can't be added 
-    // to (L.CRS.anything) with the include function
-    // so we'll use the options property as a way to integrate needed 
-    // properties and methods...
-    M.WGS84 = new L.Proj.CRS('EPSG:4326','+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs ', {
-      origin: [-180,+90],
-      bounds: L.bounds([[-180,-90],[180,90]]),
-      resolutions: [
-        0.703125,
-        0.3515625,
-        0.17578125,
-        0.087890625,
-        0.0439453125,
-        0.02197265625,
-        0.010986328125,
-        0.0054931640625,
-        0.00274658203125,
-        0.001373291015625,
-        0.0006866455078125,
-        0.0003433227539062,
-        0.0001716613769531,
-        0.0000858306884766,
-        0.0000429153442383,
-        0.0000214576721191,
-        0.0000107288360596,
-        0.0000053644180298,
-        0.0000026822090149,
-        0.0000013411045074,
-        0.0000006705522537,
-        0.0000003352761269
-      ],
-      crs: {
-        tcrs: {
-          horizontal: {
-            name: "x",
-            min: 0, 
-            max: zoom => (M.WGS84.options.bounds.getSize().x / M.WGS84.options.resolutions[zoom]).toFixed()
-          },
-          vertical: {
-            name: "y",
-            min:0, 
-            max: zoom => (M.WGS84.options.bounds.getSize().y / M.WGS84.options.resolutions[zoom]).toFixed()
-          },
-          bounds: zoom => L.bounds([M.WGS84.options.crs.tcrs.horizontal.min,
-                            M.WGS84.options.crs.tcrs.vertical.min],
-                           [M.WGS84.options.crs.tcrs.horizontal.max(zoom),
-                            M.WGS84.options.crs.tcrs.vertical.max(zoom)])
-        },
-        pcrs: {
-          horizontal: {
-            name: "longitude",
-            get min() {return M.WGS84.options.crs.gcrs.horizontal.min;},
-            get max() {return M.WGS84.options.crs.gcrs.horizontal.max;}
-          }, 
-          vertical: {
-            name: "latitude", 
-            get min() {return M.WGS84.options.crs.gcrs.vertical.min;},
-            get max() {return M.WGS84.options.crs.gcrs.vertical.max;}
-          },
-          get bounds() {return M.WGS84.options.bounds;}
-        }, 
-        gcrs: {
-          horizontal: {
-            name: "longitude",
-            // set min/max axis values from EPSG registry area of use, retrieved 2019-07-25
-            min: -180.0,
-            max: 180.0
-          }, 
-          vertical: {
-            name: "latitude",
-            // set min/max axis values from EPSG registry area of use, retrieved 2019-07-25
-            min: -90.0,
-            max: 90.0
-          },
-          get bounds() {return L.latLngBounds(
-                [M.WGS84.options.crs.gcrs.vertical.min,M.WGS84.options.crs.gcrs.horizontal.min],
-                [M.WGS84.options.crs.gcrs.vertical.max,M.WGS84.options.crs.gcrs.horizontal.max]);}
-        },
-        map: {
-          horizontal: {
-            name: "i",
-            min: 0,
-            max: map => map.getSize().x
-          },
-          vertical: {
-            name: "j",
-            min: 0,
-            max: map => map.getSize().y
-          },
-          bounds: map => L.bounds(L.point([0,0]),map.getSize())
-        },
-        tile: {
-          horizontal: {
-            name: "i",
-            min: 0,
-            max: 256
-          },
-          vertical: {
-            name: "j",
-            min: 0,
-            max: 256
-          },
-          get bounds() {return L.bounds(
-                    [M.WGS84.options.crs.tile.horizontal.min,M.WGS84.options.crs.tile.vertical.min],
-                    [M.WGS84.options.crs.tile.horizontal.max,M.WGS84.options.crs.tile.vertical.max]);}
-        },
-        tilematrix: {
-          horizontal: {
-            name: "column",
-            min: 0,
-            max: zoom => (M.WGS84.options.crs.tcrs.horizontal.max(zoom) / M.WGS84.options.crs.tile.bounds.getSize().x).toFixed()
-          },
-          vertical: {
-            name: "row",
-            min: 0,
-            max: zoom => (M.WGS84.options.crs.tcrs.vertical.max(zoom) / M.WGS84.options.crs.tile.bounds.getSize().y).toFixed()
-          },
-          bounds: zoom => L.bounds(
-                   [M.WGS84.options.crs.tilematrix.horizontal.min,
-                    M.WGS84.options.crs.tilematrix.vertical.min],
-                   [M.WGS84.options.crs.tilematrix.horizontal.max(zoom),
-                    M.WGS84.options.crs.tilematrix.vertical.max(zoom)])
-        }
-      }
-    });
-    M.CBMTILE = new L.Proj.CRS('EPSG:3978',
-    '+proj=lcc +lat_1=49 +lat_2=77 +lat_0=49 +lon_0=-95 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs', {
-      origin: [-34655800, 39310000],
-      bounds: L.bounds([[-34655800,-39000000],[10000000,39310000]]),
-      resolutions: [
-        38364.660062653464, 
-        22489.62831258996, 
-        13229.193125052918, 
-        7937.5158750317505, 
-        4630.2175937685215, 
-        2645.8386250105837,
-        1587.5031750063501,
-        926.0435187537042, 
-        529.1677250021168, 
-        317.50063500127004, 
-        185.20870375074085, 
-        111.12522225044451, 
-        66.1459656252646, 
-        38.36466006265346, 
-        22.48962831258996,
-        13.229193125052918,
-        7.9375158750317505, 
-        4.6302175937685215,
-        2.6458386250105836,
-        1.5875031750063502,
-        0.92604351875370428,
-        0.52916772500211673,
-        0.31750063500127002,
-        0.18520870375074083,
-        0.11112522225044451,
-        0.066145965625264591
-      ],
-      crs: {
-        tcrs: {
-          horizontal: {
-            name: "x",
-            min: 0, 
-            max: zoom => (M.CBMTILE.options.bounds.getSize().x / M.CBMTILE.options.resolutions[zoom]).toFixed()
-          },
-          vertical: {
-            name: "y",
-            min:0, 
-            max: zoom => (M.CBMTILE.options.bounds.getSize().y / M.CBMTILE.options.resolutions[zoom]).toFixed()
-          },
-          bounds: zoom => L.bounds([M.CBMTILE.options.crs.tcrs.horizontal.min,
-                            M.CBMTILE.options.crs.tcrs.vertical.min],
-                           [M.CBMTILE.options.crs.tcrs.horizontal.max(zoom),
-                            M.CBMTILE.options.crs.tcrs.vertical.max(zoom)])
-        },
-        pcrs: {
-          horizontal: {
-            name: "easting",
-            get min() {return M.CBMTILE.options.bounds.min.x;},
-            get max() {return M.CBMTILE.options.bounds.max.x;}
-          }, 
-          vertical: {
-            name: "northing", 
-            get min() {return M.CBMTILE.options.bounds.min.y;},
-            get max() {return M.CBMTILE.options.bounds.max.y;}
-          },
-          get bounds() {return M.CBMTILE.options.bounds;}
-        }, 
-        gcrs: {
-          horizontal: {
-            name: "longitude",
-            // set min/max axis values from EPSG registry area of use, retrieved 2019-07-25
-            min: -141.01,
-            max: -47.74
-          }, 
-          vertical: {
-            name: "latitude",
-            // set min/max axis values from EPSG registry area of use, retrieved 2019-07-25
-            min: 40.04,
-            max: 86.46
-          },
-          get bounds() {return L.latLngBounds(
-                [M.CBMTILE.options.crs.gcrs.vertical.min,M.CBMTILE.options.crs.gcrs.horizontal.min],
-                [M.CBMTILE.options.crs.gcrs.vertical.max,M.CBMTILE.options.crs.gcrs.horizontal.max]);}
-        },
-        map: {
-          horizontal: {
-            name: "i",
-            min: 0,
-            max: map => map.getSize().x
-          },
-          vertical: {
-            name: "j",
-            min: 0,
-            max: map => map.getSize().y
-          },
-          bounds: map => L.bounds(L.point([0,0]),map.getSize())
-        },
-        tile: {
-          horizontal: {
-            name: "i",
-            min: 0,
-            max: 256
-          },
-          vertical: {
-            name: "j",
-            min: 0,
-            max: 256
-          },
-          get bounds() {return L.bounds(
-                    [M.CBMTILE.options.crs.tile.horizontal.min,M.CBMTILE.options.crs.tile.vertical.min],
-                    [M.CBMTILE.options.crs.tile.horizontal.max,M.CBMTILE.options.crs.tile.vertical.max]);}
-        },
-        tilematrix: {
-          horizontal: {
-            name: "column",
-            min: 0,
-            max: zoom => (M.CBMTILE.options.crs.tcrs.horizontal.max(zoom) / M.CBMTILE.options.crs.tile.bounds.getSize().x).toFixed()
-          },
-          vertical: {
-            name: "row",
-            min: 0,
-            max: zoom => (M.CBMTILE.options.crs.tcrs.vertical.max(zoom) / M.CBMTILE.options.crs.tile.bounds.getSize().y).toFixed()
-          },
-          bounds: zoom => L.bounds([0,0],
-                   [M.CBMTILE.options.crs.tilematrix.horizontal.max(zoom),
-                    M.CBMTILE.options.crs.tilematrix.vertical.max(zoom)])
-        }
-      }
-    });
-    M.APSTILE = new L.Proj.CRS('EPSG:5936',
-    '+proj=stere +lat_0=90 +lat_ts=50 +lon_0=-150 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m +no_defs', {
-      origin: [-2.8567784109255E7, 3.2567784109255E7],
-      bounds: L.bounds([[-28567784.109254867,-28567784.109254755],[32567784.109255023,32567784.10925506]]),
-      resolutions: [
-        238810.813354,
-        119405.406677,
-        59702.7033384999,
-        29851.3516692501,
-        14925.675834625,
-        7462.83791731252,
-        3731.41895865639,
-        1865.70947932806,
-        932.854739664032,
-        466.427369832148,
-        233.213684916074,
-        116.606842458037,
-        58.3034212288862,
-        29.1517106145754,
-        14.5758553072877,
-        7.28792765351156,
-        3.64396382688807,
-        1.82198191331174,
-        0.910990956788164,
-        0.45549547826179
-      ],
-      crs: {
-        tcrs: {
-          horizontal: {
-            name: "x",
-            min: 0, 
-            max: zoom => (M.APSTILE.options.bounds.getSize().x / M.APSTILE.options.resolutions[zoom]).toFixed()
-          },
-          vertical: {
-            name: "y",
-            min:0, 
-            max: zoom => (M.APSTILE.options.bounds.getSize().y / M.APSTILE.options.resolutions[zoom]).toFixed()
-          },
-          bounds: zoom => L.bounds([M.APSTILE.options.crs.tcrs.horizontal.min,
-                            M.APSTILE.options.crs.tcrs.vertical.min],
-                           [M.APSTILE.options.crs.tcrs.horizontal.max(zoom),
-                            M.APSTILE.options.crs.tcrs.vertical.max(zoom)])
-        },
-        pcrs: {
-          horizontal: {
-            name: "easting",
-            get min() {return M.APSTILE.options.bounds.min.x;},
-            get max() {return M.APSTILE.options.bounds.max.x;}
-          }, 
-          vertical: {
-            name: "northing", 
-            get min() {return M.APSTILE.options.bounds.min.y;},
-            get max() {return M.APSTILE.options.bounds.max.y;}
-          },
-          get bounds() {return M.APSTILE.options.bounds;}
-        }, 
-        gcrs: {
-          horizontal: {
-            name: "longitude",
-            // set min/max axis values from EPSG registry area of use, retrieved 2019-07-25
-            min: -180.0,
-            max: 180.0
-          }, 
-          vertical: {
-            name: "latitude",
-            // set min/max axis values from EPSG registry area of use, retrieved 2019-07-25
-            min: 60.0,
-            max: 90.0
-          },
-          get bounds() {return L.latLngBounds(
-                    [M.APSTILE.options.crs.gcrs.vertical.min,M.APSTILE.options.crs.gcrs.horizontal.min],
-                    [M.APSTILE.options.crs.gcrs.vertical.max,M.APSTILE.options.crs.gcrs.horizontal.max]);}
-        },
-        map: {
-          horizontal: {
-            name: "i",
-            min: 0,
-            max: map => map.getSize().x
-          },
-          vertical: {
-            name: "j",
-            min: 0,
-            max: map => map.getSize().y
-          },
-          bounds: map => L.bounds(L.point([0,0]),map.getSize())
-        },
-        tile: {
-          horizontal: {
-            name: "i",
-            min: 0,
-            max: 256
-          },
-          vertical: {
-            name: "j",
-            min: 0,
-            max: 256
-          },
-          get bounds() {return L.bounds(
-                    [M.APSTILE.options.crs.tile.horizontal.min,M.APSTILE.options.crs.tile.vertical.min],
-                    [M.APSTILE.options.crs.tile.horizontal.max,M.APSTILE.options.crs.tile.vertical.max]);}
-        },
-        tilematrix: {
-          horizontal: {
-            name: "column",
-            min: 0,
-            max: zoom => (M.APSTILE.options.crs.tcrs.horizontal.max(zoom) / M.APSTILE.options.crs.tile.bounds.getSize().x).toFixed()
-          },
-          vertical: {
-            name: "row",
-            min: 0,
-            max: zoom => (M.APSTILE.options.crs.tcrs.vertical.max(zoom) / M.APSTILE.options.crs.tile.bounds.getSize().y).toFixed()
-          },
-          bounds: zoom => L.bounds([0,0],
-                   [M.APSTILE.options.crs.tilematrix.horizontal.max(zoom),
-                    M.APSTILE.options.crs.tilematrix.vertical.max(zoom)])
-        }
-      }
-    });
-    M.OSMTILE = L.CRS.EPSG3857;
-    L.setOptions(M.OSMTILE, {
-      origin: [-20037508.342787, 20037508.342787],
-      bounds: L.bounds([[-20037508.342787, -20037508.342787],[20037508.342787, 20037508.342787]]),
-      resolutions: [
-        156543.0339,
-        78271.51695,
-        39135.758475,
-        19567.8792375,
-        9783.93961875,
-        4891.969809375,
-        2445.9849046875,
-        1222.9924523438,
-        611.49622617188,
-        305.74811308594,
-        152.87405654297,
-        76.437028271484,
-        38.218514135742,
-        19.109257067871,
-        9.5546285339355,
-        4.7773142669678,
-        2.3886571334839,
-        1.1943285667419,
-        0.59716428337097,
-        0.29858214168549,
-        0.14929107084274,
-        0.074645535421371,
-        0.03732276771068573,
-        0.018661383855342865,
-        0.009330691927671432495
-      ],
-      crs: {
-        tcrs: {
-          horizontal: {
-            name: "x",
-            min: 0, 
-            max: zoom => (M.OSMTILE.options.bounds.getSize().x / M.OSMTILE.options.resolutions[zoom]).toFixed()
-          },
-          vertical: {
-            name: "y",
-            min:0, 
-            max: zoom => (M.OSMTILE.options.bounds.getSize().y / M.OSMTILE.options.resolutions[zoom]).toFixed()
-          },
-          bounds: zoom => L.bounds([M.OSMTILE.options.crs.tcrs.horizontal.min,
-                            M.OSMTILE.options.crs.tcrs.vertical.min],
-                           [M.OSMTILE.options.crs.tcrs.horizontal.max(zoom),
-                            M.OSMTILE.options.crs.tcrs.vertical.max(zoom)])
-        },
-        pcrs: {
-          horizontal: {
-            name: "easting",
-            get min() {return M.OSMTILE.options.bounds.min.x;},
-            get max() {return M.OSMTILE.options.bounds.max.x;}
-          }, 
-          vertical: {
-            name: "northing", 
-            get min() {return M.OSMTILE.options.bounds.min.y;},
-            get max() {return M.OSMTILE.options.bounds.max.y;}
-          },
-          get bounds() {return M.OSMTILE.options.bounds;}
-        }, 
-        gcrs: {
-          horizontal: {
-            name: "longitude",
-            get min() {return M.OSMTILE.unproject(M.OSMTILE.options.bounds.min).lng;},
-            get max() {return M.OSMTILE.unproject(M.OSMTILE.options.bounds.max).lng;}
-          }, 
-          vertical: {
-            name: "latitude",
-            get min() {return M.OSMTILE.unproject(M.OSMTILE.options.bounds.min).lat;},
-            get max() {return M.OSMTILE.unproject(M.OSMTILE.options.bounds.max).lat;}
-          },
-          get bounds() {return L.latLngBounds(
-                [M.OSMTILE.options.crs.gcrs.vertical.min,M.OSMTILE.options.crs.gcrs.horizontal.min],
-                [M.OSMTILE.options.crs.gcrs.vertical.max,M.OSMTILE.options.crs.gcrs.horizontal.max]);}
-        },
-        map: {
-          horizontal: {
-            name: "i",
-            min: 0,
-            max: map => map.getSize().x
-          },
-          vertical: {
-            name: "j",
-            min: 0,
-            max: map => map.getSize().y
-          },
-          bounds: map => L.bounds(L.point([0,0]),map.getSize())
-        },
-        tile: {
-          horizontal: {
-            name: "i",
-            min: 0,
-            max: 256
-          },
-          vertical: {
-            name: "j",
-            min: 0,
-            max: 256
-          },
-          get bounds() {return L.bounds(
-                    [M.OSMTILE.options.crs.tile.horizontal.min,M.OSMTILE.options.crs.tile.vertical.min],
-                    [M.OSMTILE.options.crs.tile.horizontal.max,M.OSMTILE.options.crs.tile.vertical.max]);}
-        },
-        tilematrix: {
-          horizontal: {
-            name: "column",
-            min: 0,
-            max: zoom => (M.OSMTILE.options.crs.tcrs.horizontal.max(zoom) / M.OSMTILE.options.crs.tile.bounds.getSize().x).toFixed()
-          },
-          vertical: {
-            name: "row",
-            min: 0,
-            max: zoom => (M.OSMTILE.options.crs.tcrs.vertical.max(zoom) / M.OSMTILE.options.crs.tile.bounds.getSize().y).toFixed()
-          },
-          bounds: zoom => L.bounds([0,0],
-                   [M.OSMTILE.options.crs.tilematrix.horizontal.max(zoom),
-                    M.OSMTILE.options.crs.tilematrix.vertical.max(zoom)])
-        }
-      }
-    });
-  }());
-
-  M.handleLink = Util.handleLink;
-  M.convertPCRSBounds = Util.convertPCRSBounds;
-  M.axisToXY = Util.axisToXY;
-  M.csToAxes = Util.csToAxes;
-  M.convertAndFormatPCRS = Util.convertAndFormatPCRS;
-  M.axisToCS = Util.axisToCS;
-  M.parseNumber = Util.parseNumber;
-  M.extractInputBounds = Util.extractInputBounds;
-  M.splitCoordinate = Util.splitCoordinate;
-  M.boundsToPCRSBounds = Util.boundsToPCRSBounds;
-  M.pixelToPCRSBounds = Util.pixelToPCRSBounds;
-  M.metaContentToObject = Util.metaContentToObject;
-  M.coordsToArray = Util.coordsToArray;
-  M.parseStylesheetAsHTML = Util.parseStylesheetAsHTML;
-  M.pointToPCRSPoint = Util.pointToPCRSPoint;
-  M.pixelToPCRSPoint = Util.pixelToPCRSPoint;
-  M.gcrsToTileMatrix = Util.gcrsToTileMatrix;
-
-  M.QueryHandler = QueryHandler;
-  M.ContextMenu = ContextMenu;
-  M.AnnounceMovement = AnnounceMovement;
-
-  // see https://leafletjs.com/examples/extending/extending-3-controls.html#handlers
-  L.Map.addInitHook('addHandler', 'query', M.QueryHandler);
-  L.Map.addInitHook('addHandler', 'contextMenu', M.ContextMenu);
-  L.Map.addInitHook('addHandler', 'announceMovement', M.AnnounceMovement);
-
-  M.MapMLLayer = MapMLLayer;
-  M.mapMLLayer = mapMLLayer;
-
-  M.ImageOverlay = ImageOverlay;
-  M.imageOverlay = imageOverlay;
-
-  M.TemplatedImageLayer = TemplatedImageLayer;
-  M.templatedImageLayer = templatedImageLayer;
-
-  M.TemplatedFeaturesLayer = TemplatedFeaturesLayer;
-  M.templatedFeaturesLayer = templatedFeaturesLayer;
-
-  M.TemplatedLayer = TemplatedLayer;
-  M.templatedLayer = templatedLayer;
-
-  M.TemplatedTileLayer = TemplatedTileLayer;
-  M.templatedTileLayer = templatedTileLayer;
-
-  M.MapMLFeatures = MapMLFeatures;
-  M.mapMlFeatures = mapMlFeatures;
-
-  M.MapMLLayerControl = MapMLLayerControl;
-  M.mapMlLayerControl = mapMlLayerControl;
-
-  M.ReloadButton = ReloadButton;
-  M.reloadButton = reloadButton;
-
-  M.FullscreenButton = FullscreenButton;
-  M.fullscreenButton = fullscreenButton;
-
-  M.MapMLStaticTileLayer = MapMLStaticTileLayer;
-  M.mapMLStaticTileLayer = mapMLStaticTileLayer;
-
-  M.DebugOverlay = DebugOverlay;
-  M.debugOverlay = debugOverlay;
-
-  M.Crosshair = Crosshair;
-  M.crosshair = crosshair;
-
-  M.FeatureIndex = FeatureIndex;
-  M.featureIndex = featureIndex;
-
-  M.Feature = Feature;
-  M.feature = feature;
-
-  M.FeatureRenderer = FeatureRenderer;
-  M.featureRenderer = featureRenderer;
-
-  M.FeatureGroup = FeatureGroup;
-  M.featureGroup = featureGroup;
-
-  }(window));
-
-}());
diff --git a/screenreader/feature-index/dist/mapml.min.js b/screenreader/feature-index/dist/mapml.min.js
deleted file mode 100644
index dabcd68..0000000
--- a/screenreader/feature-index/dist/mapml.min.js
+++ /dev/null
@@ -1,3 +0,0 @@
-/*! @maps4html/web-map-custom-element 16-12-2021 */
-
-!function(){"use strict";var t=L.GridLayer.extend({initialize:function(t){this.zoomBounds=this._getZoomBounds(t.tileContainer,t.maxZoomBound),L.extend(t,this.zoomBounds),L.setOptions(this,t),this._groups=this._groupTiles(this.options.tileContainer.getElementsByTagName("map-tile"))},onAdd:function(){this._bounds=this._getLayerBounds(this._groups,this._map.options.projection),this.layerBounds=this._bounds[Object.keys(this._bounds)[0]];for(let t of Object.keys(this._bounds))this.layerBounds.extend(this._bounds[t].min),this.layerBounds.extend(this._bounds[t].max);L.GridLayer.prototype.onAdd.call(this,this._map),this._handleMoveEnd()},getEvents:function(){let t=L.GridLayer.prototype.getEvents.call(this,this._map);return this._parentOnMoveEnd=t.moveend,t.moveend=this._handleMoveEnd,t.move=(()=>{}),t},_handleMoveEnd:function(t){let e=this._map.getZoom(),i=e;i=(i=i>this.options.maxNativeZoom?this.options.maxNativeZoom:i)<this.options.minNativeZoom?this.options.minNativeZoom:i,this.isVisible=e<=this.zoomBounds.maxZoom&&e>=this.zoomBounds.minZoom&&this._bounds[i]&&this._bounds[i].overlaps(M.pixelToPCRSBounds(this._map.getPixelBounds(),this._map.getZoom(),this._map.options.projection)),this.isVisible&&this._parentOnMoveEnd()},_isValidTile(t){return this._groups[this._tileCoordsToKey(t)]},createTile:function(t){let e=this._groups[this._tileCoordsToKey(t)]||[],i=document.createElement("map-tile"),o=this.getTileSize();i.setAttribute("col",t.x),i.setAttribute("row",t.y),i.setAttribute("zoom",t.z);for(let t=0;t<e.length;t++){let n=document.createElement("img");n.width=o.x,n.height=o.y,n.alt="",n.setAttribute("role","presentation"),n.src=e[t].src,i.appendChild(n)}return i},_getLayerBounds:function(t,e){let i={},o=M[e].options.crs.tile.bounds.max.x;for(let e in t){let t=e.split(":"),n={};n.x=+t[0]*o,n.y=+t[1]*o,n.z=+t[2],t[2]in i?(i[t[2]].extend(L.point(n.x,n.y)),i[t[2]].extend(L.point(n.x+o,n.y+o))):i[t[2]]=L.bounds(L.point(n.x,n.y),L.point(n.x+o,n.y+o))}for(let t in i){let o=+t;i[t]=M.pixelToPCRSBounds(i[t],o,e)}return i},_getZoomBounds:function(t,e){if(!t)return null;let i=M.metaContentToObject(t.getElementsByTagName("map-tiles")[0].getAttribute("zoom")),o={},n=t.getElementsByTagName("map-tile");o.nativeZoom=+i.value||0,o.maxNativeZoom=0,o.minNativeZoom=e;for(let t=0;t<n.length;t++){let e=+n[t].getAttribute("zoom");n[t].getAttribute("zoom")||(e=o.nativeZoom),o.minNativeZoom=Math.min(o.minNativeZoom,e),o.maxNativeZoom=Math.max(o.maxNativeZoom,e)}return o.minZoom=o.minNativeZoom-2<=0?0:o.minNativeZoom-2,o.maxZoom=e,i.min&&(o.minZoom=+i.min<o.minNativeZoom-2?o.minNativeZoom-2:+i.min),i.max&&(o.maxZoom=+i.max),o},_groupTiles:function(t){let e={};for(let i=0;i<t.length;i++){let o={};o.row=+t[i].getAttribute("row"),o.col=+t[i].getAttribute("col"),o.zoom=+t[i].getAttribute("zoom")||this.options.nativeZoom,o.src=t[i].getAttribute("src");let n=o.col+":"+o.row+":"+o.zoom;n in e?e[n].push(o):e[n]=[o]}return e}}),e=function(e){return new t(e)},i=L.Control.Layers.extend({options:{autoZIndex:!1,sortLayers:!0,sortFunction:function(t,e){return t.options.zIndex<e.options.zIndex?-1:t.options.zIndex>e.options.zIndex?1:0}},initialize:function(t,e){for(var i in L.setOptions(this,e),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,t)this._addLayer(t[i],i,!0)},onAdd:function(){return this._initLayout(),this._map.on("validate",this._validateInput,this),L.DomEvent.on(this.options.mapEl,"layerchange",this._validateInput,this),L.DomEvent.on(this._container,"keydown",this._focusFirstLayer,this._container),this._update(),this._layers.length<1&&!this._map._showControls?this._container.setAttribute("hidden",""):this._map._showControls=!0,this._container},onRemove:function(t){t.off("validate",this._validateInput,this),L.DomEvent.off(this._container,"keydown",this._focusFirstLayer,this._container);for(var e=0;e<this._layers.length;e++)this._layers[e].layer.off("add remove",this._onLayerChange,this),this._layers[e].layer.off("extentload",this._validateInput,this)},addOrUpdateOverlay:function(t,e){for(var i=!1,o=0;o<this._layers.length;o++)if(this._layers[o].layer===t){i=!0,this._layers[o].name=e;break}return i||this.addOverlay(t,e),this._layers.length>0&&(this._container.removeAttribute("hidden"),this._map._showControls=!0),this._map?this._update():this},removeLayer:function(t){L.Control.Layers.prototype.removeLayer.call(this,t),0===this._layers.length&&this._container.setAttribute("hidden","")},_validateInput:function(t){for(let t=0;t<this._layers.length;t++){if(!this._layers[t].input.labels[0])continue;let e=this._layers[t].input.labels[0].getElementsByTagName("span"),i=this._layers[t].input.labels[0].getElementsByTagName("input");i[0].checked=this._layers[t].layer._layerEl.checked,this._layers[t].layer._layerEl.disabled&&this._layers[t].layer._layerEl.checked?(i[0].closest("fieldset").disabled=!0,e[0].style.fontStyle="italic"):(i[0].closest("fieldset").disabled=!1,e[0].style.fontStyle="normal")}},_focusFirstLayer:function(t){if("Enter"===t.key&&"leaflet-control-layers leaflet-control leaflet-control-layers-expanded"!=this.className){var e=this.children[1].children[2].children[0].children[0].children[0].children[0];e&&setTimeout(()=>e.focus(),0)}},_withinZoomBounds:function(t,e){return e.min<=t&&t<=e.max},_addItem:function(t){var e=t.layer.getLayerUserControlsHTML();return t.input=e.querySelector("input"),this._layerControlInputs.push(t.input),t.input.layerId=L.stamp(t.layer),L.DomEvent.on(t.input,"click",this._onInputClick,this),t.layer.on("extentload",this._validateInput,this),this._overlaysList.appendChild(e),e},collapse:function(t){return"SELECT"===t.target.tagName||t.relatedTarget&&t.relatedTarget.parentElement&&("mapml-contextmenu mapml-layer-menu"===t.relatedTarget.className||"mapml-contextmenu mapml-layer-menu"===t.relatedTarget.parentElement.className)||this._map&&"block"===this._map.contextMenu._layerMenu.style.display?this:(L.DomUtil.removeClass(this._container,"leaflet-control-layers-expanded"),this)}}),o=function(t,e){return new i(t,e)};const n="OSMTILE",a="mapmltemplatedtileplaceholder";var s=L.FeatureGroup.extend({initialize:function(t,e){if(L.setOptions(this,e),this.options.static&&(this._container=L.DomUtil.create("div","leaflet-layer",this.options.pane),L.DomUtil.addClass(this._container,"leaflet-pane mapml-vector-container"),L.setOptions(this.options.renderer,{pane:this._container})),this._layers={},this.options.query){this._mapmlFeatures=t,this.isVisible=!0;let e=this._getNativeVariables(t);this.options.nativeZoom=e.zoom,this.options.nativeCS=e.cs}if(t&&!this.options.query){let e=this._getNativeVariables(t);!t.querySelector("map-extent")&&t.querySelector("map-feature")&&this.options.static&&(this._features={},this._staticFeature=!0,this.isVisible=!0,this.zoomBounds=this._getZoomBounds(t,e.zoom),this.layerBounds=this._getLayerBounds(t),L.extend(this.options,this.zoomBounds)),this.addData(t,e.cs,e.zoom),this._staticFeature&&(this._resetFeatures(this._clampZoom(this.options._leafletLayer._map.getZoom())),this.options._leafletLayer._map._addZoomLimit(this))}},onAdd:function(t){L.FeatureGroup.prototype.onAdd.call(this,t),this._mapmlFeatures&&t.on("featurepagination",this.showPaginationFeature,this)},onRemove:function(t){this._mapmlFeatures&&(t.off("featurepagination",this.showPaginationFeature,this),delete this._mapmlFeatures,L.DomUtil.remove(this._container)),L.FeatureGroup.prototype.onRemove.call(this,t)},getEvents:function(){return this._staticFeature?{moveend:this._handleMoveEnd,zoomend:this._handleZoomEnd}:{moveend:this._removeCSS}},showPaginationFeature:function(t){if(this.options.query&&this._mapmlFeatures.querySelectorAll("map-feature")[t.i]){let e=this._mapmlFeatures.querySelectorAll("map-feature")[t.i];this.clearLayers(),this.addData(e,this.options.nativeCS,this.options.nativeZoom),t.popup._navigationBar.querySelector("p").innerText=t.i+1+"/"+this.options._leafletLayer._totalFeatureCount,t.popup._content.querySelector("iframe").setAttribute("sandbox","allow-same-origin allow-forms"),t.popup._content.querySelector("iframe").srcdoc=e.querySelector("map-properties").innerHTML}},_getNativeVariables:function(t){return{zoom:t.querySelector("map-meta[name=zoom]")&&+M.metaContentToObject(t.querySelector("map-meta[name=zoom]").getAttribute("content")).value||0,cs:t.querySelector("map-meta[name=cs]")&&M.metaContentToObject(t.querySelector("map-meta[name=cs]").getAttribute("content")).content||"GCRS"}},_handleMoveEnd:function(){let t=this._map.getZoom(),e=t<=this.zoomBounds.maxZoom&&t>=this.zoomBounds.minZoom;this.isVisible=e&&this._layers&&this.layerBounds&&this.layerBounds.overlaps(M.pixelToPCRSBounds(this._map.getPixelBounds(),t,this._map.options.projection)),this._removeCSS()},_handleZoomEnd:function(t){let e=this._map.getZoom();if(e>this.zoomBounds.maxZoom||e<this.zoomBounds.minZoom)return void this.clearLayers();let i=this._clampZoom(e);this._resetFeatures(i)},_getLayerBounds:function(t){if(!t)return null;let e="TILEMATRIX",i=t.querySelector("map-meta[name=projection]")&&M.metaContentToObject(t.querySelector("map-meta[name=projection]").getAttribute("content")).content.toUpperCase()||n;try{let o=t.querySelector("map-meta[name=extent]")&&M.metaContentToObject(t.querySelector("map-meta[name=extent]").getAttribute("content")),n=o.zoom||0,a=Object.keys(o);for(let t=0;t<a.length;t++)if(!a[t].includes("zoom")){e=M.axisToCS(a[t].split("-")[2]);break}let s=M.csToAxes(e);return M.boundsToPCRSBounds(L.bounds(L.point(+o[`top-left-${s[0]}`],+o[`top-left-${s[1]}`]),L.point(+o[`bottom-right-${s[0]}`],+o[`bottom-right-${s[1]}`])),n,i,e)}catch(t){return M.boundsToPCRSBounds(M[i].options.crs.tilematrix.bounds(0),0,i,e)}},_resetFeatures:function(t){if(this.clearLayers(),this._features&&this._features[t])for(let e=0;e<this._features[t].length;e++)this.addLayer(this._features[t][e])},_clampZoom:function(t){return t>this.zoomBounds.maxZoom||t<this.zoomBounds.minZoom?t:void 0!==this.zoomBounds.minNativeZoom&&t<this.zoomBounds.minNativeZoom?this.zoomBounds.minNativeZoom:void 0!==this.zoomBounds.maxNativeZoom&&this.zoomBounds.maxNativeZoom<t?this.zoomBounds.maxNativeZoom:t},_setZoomTransform:function(t,e){var i=this._map.getZoomScale(this._map.getZoom(),e),o=t.multiplyBy(i).subtract(this._map._getNewPixelOrigin(t,this._map.getZoom())).round();any3d?L.setTransform(this._layers[e],o,i):L.setPosition(this._layers[e],o)},_getZoomBounds:function(t,e){if(!t)return null;let i,o,a=100,s=0,r=t.getElementsByTagName("map-feature");for(let t=0;t<r.length;t++){let i=+r[t].getAttribute("zoom");r[t].getAttribute("zoom")||(i=e),s=Math.max(s,i),a=Math.min(a,i)}try{o=M.metaContentToObject(t.querySelector("map-meta[name=projection]").getAttribute("content")).content,i=M.metaContentToObject(t.querySelector("map-meta[name=zoom]").getAttribute("content"))}catch(t){return{minZoom:0,maxZoom:M[o||n].options.resolutions.length-1,minNativeZoom:a,maxNativeZoom:s}}return{minZoom:+i.min,maxZoom:+i.max,minNativeZoom:a,maxNativeZoom:s}},addData:function(t,e,i){var o,n,a,s=t.nodeType===Node.DOCUMENT_NODE||"LAYER-"===t.nodeName?t.getElementsByTagName("map-feature"):null;if(t.nodeType===Node.DOCUMENT_NODE?t.querySelector("map-link[rel=stylesheet],map-style"):null){var r=t.querySelector("map-base")&&t.querySelector("map-base").hasAttribute("href")?new URL(t.querySelector("map-base").getAttribute("href")).href:t.URL;M.parseStylesheetAsHTML(t,r,this._container)}if(s){for(o=0,n=s.length;o<n;o++){(a=s[o]).getElementsByTagName("map-geometry").length&&a.getElementsByTagName("map-coordinates").length&&this.addData(a,e,i)}return this}var l=this.options;if(l.filter&&!l.filter(t))return;t.classList.length&&(l.className=t.classList.value);let m=t.getAttribute("zoom")||i,u=t.querySelector("map-featurecaption");u=u?u.innerHTML:"Feature",t.querySelector("map-properties")&&(l.properties=document.createElement("div"),l.properties.classList.add("mapml-popup-content"),l.properties.insertAdjacentHTML("afterbegin",t.querySelector("map-properties").innerHTML));let p=this.geometryToLayer(t,l,e,+m,u);if(p){if(!p.options.color&&t.hasAttribute("class")&&(p.options.className=t.getAttribute("class")),p.defaultOptions=p.options,this.resetStyle(p),l.onEachFeature&&p.bindTooltip(u,{interactive:!0,sticky:!0}),this._staticFeature){let e=t.getAttribute("zoom")||i;return void(e in this._features?this._features[e].push(p):this._features[e]=[p])}return this.addLayer(p)}},resetStyle:function(t){var e=this.options.style;e&&(L.Util.extend(t.options,t.defaultOptions),this._setLayerStyle(t,e))},setStyle:function(t){this.eachLayer(function(e){this._setLayerStyle(e,t)},this)},_setLayerStyle:function(t,e){"function"==typeof e&&(e=e(t.feature)),t.setStyle&&t.setStyle(e)},_removeCSS:function(){let t=this._container.querySelectorAll("link[rel=stylesheet],style");for(let e=0;e<t.length;e++)this._container.removeChild(t[e])},geometryToLayer:function(t,e,i,o,n){let a="MAP-FEATURE"===t.tagName.toUpperCase()?t.getElementsByTagName("map-geometry")[0]:t,s=a.getAttribute("cs")||i,r=[],l=L.SVG.create("g"),m=Object.assign({},e);for(let e of a.querySelectorAll("map-polygon, map-linestring, map-multilinestring, map-point, map-multipoint"))r.push(M.feature(e,Object.assign(m,{nativeCS:s,nativeZoom:o,projection:this.options.projection,featureID:t.id,group:l,wrappers:this._getGeometryParents(e.parentElement),featureLayer:this,_leafletLayer:this.options._leafletLayer})));let u={group:l,featureID:t.id,accessibleTitle:n,onEachFeature:e.onEachFeature,properties:e.properties,_leafletLayer:this.options._leafletLayer},p=a.querySelector("map-multipolygon")||a.querySelector("map-geometrycollection");return p&&(u.wrappers=this._getGeometryParents(p.parentElement)),M.featureGroup(r,u)},_getGeometryParents:function(t,e=[]){return t&&"MAP-GEOMETRY"!==t.tagName.toUpperCase()?"MAP-MULTIPOLYGON"===t.tagName.toUpperCase()||"MAP-GEOMETRYCOLLECTION"===t.tagName.toUpperCase()?this._getGeometryParents(t.parentElement,e):this._getGeometryParents(t.parentElement,e.concat([t])):e}}),r=function(t,e){return new s(t,e)},l=L.TileLayer.extend({initialize:function(t,e){let i=M.extractInputBounds(t);this.zoomBounds=i.zoomBounds,this.layerBounds=i.bounds,this.isVisible=!0,L.extend(e,this.zoomBounds),e.tms=t.tms,L.setOptions(this,e),this._setUpTileTemplateVars(t),t.tile.subdomains&&L.setOptions(this,L.extend(this.options,{subdomains:t.tile.subdomains})),this._template=t,this._initContainer(),L.TileLayer.prototype.initialize.call(this,t.template,L.extend(e,{pane:this._container}))},onAdd:function(){this._map._addZoomLimit(this),L.TileLayer.prototype.onAdd.call(this,this._map),this._handleMoveEnd()},getEvents:function(){let t=L.TileLayer.prototype.getEvents.call(this,this._map);return this._parentOnMoveEnd=t.moveend,t.moveend=this._handleMoveEnd,t},_initContainer:function(){this._container||(this._container=L.DomUtil.create("div","leaflet-layer",this.options.pane),L.DomUtil.addClass(this._container,"mapml-templated-tile-container"),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity())},_handleMoveEnd:function(t){let e=this._map.getZoom(),i=M.pixelToPCRSBounds(this._map.getPixelBounds(),e,this._map.options.projection);this.isVisible=e<=this.options.maxZoom&&e>=this.options.minZoom&&this.layerBounds.overlaps(i),this.isVisible&&this._parentOnMoveEnd()},createTile:function(t){let e=document.createElement("DIV"),i=this.getTileSize();if(L.DomUtil.addClass(e,"mapml-tile-group"),L.DomUtil.addClass(e,"leaflet-tile"),this._template.linkEl.dispatchEvent(new CustomEvent("tileloadstart",{detail:{x:t.x,y:t.y,zoom:t.z,appendTile:t=>{e.appendChild(t)}}})),this._template.type.startsWith("image/")){let o=L.TileLayer.prototype.createTile.call(this,t,function(){});o.width=i.x,o.height=i.y,e.appendChild(o)}else this._url.includes(a)||this._fetchTile(t,e);return e},_mapmlTileReady:function(t){L.DomUtil.addClass(t,"leaflet-tile-loaded")},getPane:function(){return this.options.pane},_fetchTile:function(t,e){fetch(this.getTileUrl(t),{redirect:"follow"}).then(function(t){return t.status>=200&&t.status<300?Promise.resolve(t):(console.log("Looks like there was a problem. Status Code: "+t.status),Promise.reject(t))}).then(function(t){return t.text()}).then(t=>{return(new DOMParser).parseFromString(t,"application/xml")}).then(i=>{this._createFeatures(i,t,e),this._mapmlTileReady(e)}).catch(t=>{console.log("Error Creating Tile")})},_createFeatures:function(t,e,i){if(t.querySelector("map-link[rel=stylesheet],map-style")){let e=t.querySelector("map-base")&&t.querySelector("map-base").hasAttribute("href")?new URL(t.querySelector("map-base").getAttribute("href")).href:t.URL;M.parseStylesheetAsHTML(t,e,i)}let o=L.SVG.create("svg"),n=L.SVG.create("g"),a=this._map.options.crs.options.crs.tile.bounds.max.x,s=e.x*a,r=e.y*a,l=M.mapMlFeatures(t,{projection:this._map.options.projection,static:!1,interactive:!1});for(let t in l._layers)for(let i in l._layers[t]._layers){let o=l._layers[t]._layers[i];M.FeatureRenderer.prototype._initPath(o,!1),o._project(this._map,L.point([s,r]),e.z),M.FeatureRenderer.prototype._addPath(o,n,!1),M.FeatureRenderer.prototype._updateFeature(o)}o.setAttribute("width",a.toString()),o.setAttribute("height",a.toString()),o.appendChild(n),i.appendChild(o)},getTileUrl:function(t){if(t.z>=this._template.tilematrix.bounds.length||!this._template.tilematrix.bounds[t.z].contains(t))return"";var e={};for(var i in e[this._template.tilematrix.col.name]=t.x,e[this._template.tilematrix.row.name]=t.y,e[this._template.zoom.name]=this._getZoomForUrl(),e[this._template.pcrs.easting.left]=this._tileMatrixToPCRSPosition(t,"top-left").x,e[this._template.pcrs.easting.right]=this._tileMatrixToPCRSPosition(t,"top-right").x,e[this._template.pcrs.northing.top]=this._tileMatrixToPCRSPosition(t,"top-left").y,e[this._template.pcrs.northing.bottom]=this._tileMatrixToPCRSPosition(t,"bottom-left").y,e[this._template.tile.server]=this._getSubdomain(t),this._template.tile)["row","col","zoom","left","right","top","bottom"].indexOf(i)<0&&(e[i]=this._template.tile[i]);if(this._map&&!this._map.options.crs.infinite){let i=this._globalTileRange.max.y-t.y;this.options.tms&&(e[this._template.tilematrix.row.name]=i)}return e.r=this.options.detectRetina&&L.Browser.retina&&this.options.maxZoom>0?"@2x":"",L.Util.template(this._url,e)},_tileMatrixToPCRSPosition:function(t,e){var i=this._map.options.crs,o=this.getTileSize(),n=t.scaleBy(o),a=n.add(o),s=n.add(Math.floor(o/2)),r=i.transformation.untransform(n,i.scale(t.z)),l=i.transformation.untransform(a,i.scale(t.z)),m=i.transformation.untransform(s,i.scale(t.z)),u=null;switch(e){case"top-left":u=r;break;case"bottom-left":u=new L.Point(r.x,l.y);break;case"center-left":u=new L.Point(r.x,m.y);break;case"top-right":u=new L.Point(l.x,r.y);break;case"bottom-right":u=l;break;case"center-right":u=new L.Point(l.x,m.y);break;case"top-center":u=new L.Point(m.x,r.y);break;case"bottom-center":u=new L.Point(m.x,l.y);break;case"center":u=m}return u},_setUpTileTemplateVars:function(t){t.tile={};for(var e,i,o,n,a,s=t.values,r=this.options.crs.options,l=0;l<t.values.length;l++){var m=s[l].getAttribute("type"),u=s[l].getAttribute("units"),p=s[l].getAttribute("axis"),c=s[l].getAttribute("name"),h=s[l].getAttribute("position"),d="hidden"===m&&s[l].hasAttribute("shard"),_="map-select"===s[l].tagName.toLowerCase(),y=s[l].getAttribute("value"),g=s[l].getAttribute("min"),f=s[l].getAttribute("max");if("location"===m&&"tilematrix"===u)switch(p){case"column":a={name:c,min:r.crs.tilematrix.horizontal.min,max:r.crs.tilematrix.horizontal.max(r.resolutions.length-1)},isNaN(Number.parseFloat(g))||(a.min=Number.parseFloat(g)),isNaN(Number.parseFloat(f))||(a.max=Number.parseFloat(f));break;case"row":n={name:c,min:r.crs.tilematrix.vertical.min,max:r.crs.tilematrix.vertical.max(r.resolutions.length-1)},isNaN(Number.parseFloat(g))||(n.min=Number.parseFloat(g)),isNaN(Number.parseFloat(f))||(n.max=Number.parseFloat(f));break;case"longitude":case"easting":i||(i={min:r.crs.pcrs.horizontal.min,max:r.crs.pcrs.horizontal.max}),isNaN(Number.parseFloat(g))||(i.min=Number.parseFloat(g)),isNaN(Number.parseFloat(f))||(i.max=Number.parseFloat(f)),h&&(h.match(/.*?-left/i)?i.left=c:h.match(/.*?-right/i)&&(i.right=c));break;case"latitude":case"northing":o||(o={min:r.crs.pcrs.vertical.min,max:r.crs.pcrs.vertical.max}),isNaN(Number.parseFloat(g))||(o.min=Number.parseFloat(g)),isNaN(Number.parseFloat(f))||(o.max=Number.parseFloat(f)),h&&(h.match(/top-.*?/i)?o.top=c:h.match(/bottom-.*?/i)&&(o.bottom=c))}else if(m&&"zoom"===m.toLowerCase())e={name:c,min:0,max:r.resolutions.length,value:r.resolutions.length},!isNaN(Number.parseInt(y,10))&&Number.parseInt(y,10)>=e.min&&Number.parseInt(y,10)<=e.max?e.value=Number.parseInt(y,10):e.value=e.max,!isNaN(Number.parseInt(g,10))&&Number.parseInt(g,10)>=e.min&&Number.parseInt(g,10)<=e.max&&(e.min=Number.parseInt(g,10)),!isNaN(Number.parseInt(f,10))&&Number.parseInt(f,10)>=e.min&&Number.parseInt(f,10)<=e.max&&(e.max=Number.parseInt(f,10)),t.zoom=e;else if(d)t.tile.server=c,t.tile.subdomains=s[l].servers.slice();else if(_){const e=s[l].htmlselect;t.tile[c]=function(){return e.value}}else{const e=s[l];t.tile[c]=function(){return e.getAttribute("value")}}}var b=this.options.crs.transformation,x=this.options.crs.options.crs.tile.bounds.max.x,v=L.bind(this.options.crs.scale,this.options.crs),A=function(t,e){return b.transform(t,v(e)).divideBy(x).floor()};i&&o?(t.pcrs={},t.pcrs.bounds=L.bounds([i.min,o.min],[i.max,o.max]),t.pcrs.easting=i,t.pcrs.northing=o):a&&n&&!isNaN(e.value)?(t.pcrs||(t.pcrs={},t.pcrs.easting="",t.pcrs.northing=""),t.pcrs.bounds=M.boundsToPCRSBounds(L.bounds(L.point([a.min,n.min]),L.point([a.max,n.max])),e.value,this.options.crs,M.axisToCS("column")),t.tilematrix={},t.tilematrix.col=a,t.tilematrix.row=n):console.log("Unable to determine bounds for tile template: "+t.template),t.tilematrix||(t.tilematrix={},t.tilematrix.col={},t.tilematrix.row={}),t.tilematrix.bounds=[];for(var E=t.pcrs.bounds,C=t.zoom?t.zoom.min:0,S=t.zoom?t.zoom.max:r.resolutions.length,T=0;T<=S;T++)t.tilematrix.bounds[T]=T>=C?L.bounds(A(E.min,T),A(E.max,T)):L.bounds(L.point([-1,-1]),L.point([-1,-1]))}}),m=function(t,e){return new l(t,e)},u=L.Layer.extend({initialize:function(t,e){this._templates=t,L.setOptions(this,e),this._container=L.DomUtil.create("div","leaflet-layer",e.pane),L.DomUtil.addClass(this._container,"mapml-templatedlayer-container");for(var i=0;i<t.length;i++)if("tile"===t[i].rel)this._templates[i].layer=M.templatedTileLayer(t[i],L.Util.extend(e,{errorTileUrl:"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",zIndex:i,pane:this._container}));else if("image"===t[i].rel)this._templates[i].layer=M.templatedImageLayer(t[i],L.Util.extend(e,{zIndex:i,pane:this._container}));else if("features"===t[i].rel)this._templates[i].layer=M.templatedFeaturesLayer(t[i],L.Util.extend(e,{zIndex:i,pane:this._container}));else if("query"===t[i].rel){this.hasSetBoundsHandler=!0,this._queries||(this._queries=[]);let e=M.extractInputBounds(t[i]);t[i].layerBounds=e.bounds,t[i].zoomBounds=e.zoomBounds,this._queries.push(L.extend(t[i],this._setupQueryVars(t[i])))}},getEvents:function(){return{zoomstart:this._onZoomStart}},redraw:function(){this.closePopup();for(var t=0;t<this._templates.length;t++)"tile"!==this._templates[t].rel&&"image"!==this._templates[t].rel&&"features"!==this._templates[t].rel||this._templates[t].layer.redraw()},_onZoomStart:function(){this.closePopup()},_setupQueryVars:function(t){for(var e={query:{}},i=t.values,o=0;o<t.values.length;o++){var n=i[o].getAttribute("type"),a=i[o].getAttribute("units"),s=i[o].getAttribute("axis"),r=i[o].getAttribute("name"),l=i[o].getAttribute("position"),m=i[o].getAttribute("rel"),u="map-select"===i[o].tagName.toLowerCase();if("width"===n)e.query.width=r;else if("height"===n)e.query.height=r;else if("location"===n)switch(s){case"x":case"y":case"column":case"row":e.query[s]=r;break;case"longitude":case"easting":l?l.match(/.*?-left/i)?"pixel"===m?e.query.pixelleft=r:"tile"===m?e.query.tileleft=r:e.query.mapleft=r:l.match(/.*?-right/i)&&("pixel"===m?e.query.pixelright=r:"tile"===m?e.query.tileright=r:e.query.mapright=r):e.query[s]=r;break;case"latitude":case"northing":l?l.match(/top-.*?/i)?"pixel"===m?e.query.pixeltop=r:"tile"===m?e.query.tiletop=r:e.query.maptop=r:l.match(/bottom-.*?/i)&&("pixel"===m?e.query.pixelbottom=r:"tile"===m?e.query.tilebottom=r:e.query.mapbottom=r):e.query[s]=r;break;case"i":"tile"===a?e.query.tilei=r:e.query.mapi=r;break;case"j":"tile"===a?e.query.tilej=r:e.query.mapj=r}else if("zoom"===n)e.query.zoom=r;else if(u){const t=i[o].htmlselect;e.query[r]=function(){return t.value}}else{const t=i[o];e.query[r]=function(){return t.getAttribute("value")}}}return e.query.title=t.title,e},reset:function(t){if(t&&this._map){var e=this._map&&this._map.hasLayer(this),i=this._templates;delete this._queries,this._map.off("click",null,this),this._templates=t;for(var o=0;o<t.length;o++)"tile"===t[o].rel?this._templates[o].layer=M.templatedTileLayer(t[o],L.Util.extend(this.options,{errorTileUrl:"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",zIndex:o,pane:this._container})):"image"===t[o].rel?this._templates[o].layer=M.templatedImageLayer(t[o],L.Util.extend(this.options,{zIndex:o,pane:this._container})):"features"===t[o].rel?this._templates[o].layer=M.templatedFeaturesLayer(t[o],L.Util.extend(this.options,{zIndex:o,pane:this._container})):"query"===t[o].rel&&(this._queries||(this._queries=[]),this._queries.push(L.extend(t[o],this._setupQueryVars(t[o])))),e&&this.onAdd(this._map);for(o=0;o<i.length;o++)this._map.hasLayer(i[o].layer)&&this._map.removeLayer(i[o].layer)}},onAdd:function(t){for(var e=0;e<this._templates.length;e++)"query"!==this._templates[e].rel&&t.addLayer(this._templates[e].layer)},onRemove:function(t){L.DomUtil.remove(this._container);for(var e=0;e<this._templates.length;e++)"query"!==this._templates[e].rel&&t.removeLayer(this._templates[e].layer)},_previousFeature:function(t){this._count+-1>=0&&(this._count--,this._map.fire("featurepagination",{i:this._count,popup:this}))},_nextFeature:function(t){this._count+1<this._source._totalFeatureCount&&(this._count++,this._map.fire("featurepagination",{i:this._count,popup:this}))}}),p=function(t,e){return new u(t,e)},c=L.Layer.extend({initialize:function(t,e){let i=M.extractInputBounds(t);this.zoomBounds=i.zoomBounds,this.layerBounds=i.bounds,this.isVisible=!0,this._template=t,this._container=L.DomUtil.create("div","leaflet-layer",e.pane),L.extend(e,this.zoomBounds),L.DomUtil.addClass(this._container,"mapml-features-container"),L.setOptions(this,L.extend(e,this._setUpFeaturesTemplateVars(t)))},getEvents:function(){return{moveend:this._onMoveEnd}},onAdd:function(){this._map._addZoomLimit(this);var t,e=new Headers({Accept:"text/mapml"}),i=new DOMParser,o=this.options.opacity||1,n=this._container,a=this._map;this._features||(this._features=M.mapMlFeatures(null,{renderer:M.featureRenderer(),pane:n,opacity:o,projection:a.options.projection,static:!0,onEachFeature:function(t,e){var i=document.createElement("div");i.classList.add("mapml-popup-content"),i.insertAdjacentHTML("afterbegin",t.innerHTML),e.bindPopup(i,{autoClose:!1,minWidth:108})}}));var s=this._features,r=function(o,n){return fetch(o,{redirect:"follow",headers:e}).then(function(t){return t.text()}).then(function(e){t=i.parseFromString(e,"application/xml");var a=new URL(t.querySelector("map-base")?t.querySelector("map-base").getAttribute("href"):o).href;o=(o=t.querySelector("map-link[rel=next]")?t.querySelector("map-link[rel=next]").getAttribute("href"):null)?new URL(o,a).href:null;let l=t.querySelector("map-meta[name=zoom]")&&+M.metaContentToObject(t.querySelector("map-meta[name=zoom]").getAttribute("content")).value||0,m=t.querySelector("map-meta[name=cs]")&&M.metaContentToObject(t.querySelector("map-meta[name=cs]").getAttribute("content")).content||"GCRS";if(s.addData(t,m,l),o&&--n)return r(o,n)})};r(this._getfeaturesUrl(),10).then(function(){a.addLayer(s),a.fire("moveend")}).catch(function(t){console.log(t)})},redraw:function(){this._onMoveEnd()},_onMoveEnd:function(){let t=this._map.getZoom(),e=M.pixelToPCRSBounds(this._map.getPixelBounds(),t,this._map.options.projection);if(this.isVisible=t<=this.zoomBounds.maxZoom&&t>=this.zoomBounds.minZoom&&this.layerBounds.overlaps(e),this._features.clearLayers(),this.isVisible){var i,o=new Headers({Accept:"text/mapml;q=0.9,application/geo+json;q=0.8"}),n=new DOMParser,a=this._features,s=this._map,r=this,l=function(t,e){return fetch(t,{redirect:"follow",headers:o}).then(function(t){return t.text()}).then(function(o){i=n.parseFromString(o,"application/xml");var s=new URL(i.querySelector("map-base")?i.querySelector("map-base").getAttribute("href"):t).href;t=(t=i.querySelector("map-link[rel=next]")?i.querySelector("map-link[rel=next]").getAttribute("href"):null)?new URL(t,s).href:null;let r=i.querySelector("map-meta[name=zoom]")&&+M.metaContentToObject(i.querySelector("map-meta[name=zoom]").getAttribute("content")).value||0,m=i.querySelector("map-meta[name=cs]")&&M.metaContentToObject(i.querySelector("map-meta[name=cs]").getAttribute("content")).content||"GCRS";if(a.addData(i,m,r),t&&--e)return l(t,e)})};l(this._getfeaturesUrl(),10).then(function(){s.addLayer(a),M.TemplatedFeaturesLayer.prototype._updateTabIndex(r)}).catch(function(t){console.log(t)})}},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},_updateTabIndex:function(t){let e=t||this;for(let t in e._features._layers){let i=e._features._layers[t];if(i._path&&("M0 0"!==i._path.getAttribute("d")?i._path.setAttribute("tabindex",0):i._path.removeAttribute("tabindex"),0===i._path.childElementCount)){let t=document.createElement("title");t.innerText="Feature",i._path.appendChild(t)}}},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},onRemove:function(){this._map.removeLayer(this._features)},_getfeaturesUrl:function(){var t={};for(var e in this.options.feature.zoom&&(t[this.options.feature.zoom]=this._map.getZoom()),this.options.feature.width&&(t[this.options.feature.width]=this._map.getSize().x),this.options.feature.height&&(t[this.options.feature.height]=this._map.getSize().y),this.options.feature.bottom&&(t[this.options.feature.bottom]=this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).y),this.options.feature.left&&(t[this.options.feature.left]=this._TCRSToPCRS(this._map.getPixelBounds().min,this._map.getZoom()).x),this.options.feature.top&&(t[this.options.feature.top]=this._TCRSToPCRS(this._map.getPixelBounds().min,this._map.getZoom()).y),this.options.feature.right&&(t[this.options.feature.right]=this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).x),this.options.feature)["width","height","left","right","top","bottom","zoom"].indexOf(e)<0&&(t[e]=this.options.feature[e]);return L.Util.template(this._template.template,t)},_TCRSToPCRS:function(t,e){var i=this._map.options.crs;return i.transformation.untransform(t,i.scale(e))},_setUpFeaturesTemplateVars:function(t){var e={feature:{}},i=t.values;e.feature.hidden=[];for(var o=0;o<i.length;o++){var n=i[o].getAttribute("type"),a=i[o].getAttribute("units"),s=i[o].getAttribute("axis"),r=i[o].getAttribute("name"),l=i[o].getAttribute("position"),m=(i[o].getAttribute("value"),"map-select"===i[o].tagName.toLowerCase());if("width"===n)e.feature.width=r;else if("height"===n)e.feature.height=r;else if("zoom"===n)e.feature.zoom=r;else if("location"!==n||"pcrs"!==a&&"gcrs"!==a)if(m){const t=i[o].htmlselect;e.feature[r]=function(){return t.value}}else{const t=i[o];e.feature[r]=function(){return t.getAttribute("value")}}else switch(s){case"x":case"longitude":case"easting":l&&(l.match(/.*?-left/i)?e.feature.left=r:l.match(/.*?-right/i)&&(e.feature.right=r));break;case"y":case"latitude":case"northing":l&&(l.match(/top-.*?/i)?e.feature.top=r:l.match(/bottom-.*?/i)&&(e.feature.bottom=r))}}return e}}),h=function(t,e){return new c(t,e)},d=L.Layer.extend({initialize:function(t,e){this._template=t,this._container=L.DomUtil.create("div","leaflet-layer",e.pane),L.DomUtil.addClass(this._container,"mapml-image-container");let i=M.extractInputBounds(t);this.zoomBounds=i.zoomBounds,this.layerBounds=i.bounds,this.isVisible=!0,L.extend(e,this.zoomBounds),L.setOptions(this,L.extend(e,this._setUpExtentTemplateVars(t)))},getEvents:function(){return{moveend:this._onMoveEnd}},onAdd:function(){this._map._addZoomLimit(this),this.setZIndex(this.options.zIndex),this._onMoveEnd()},redraw:function(){this._onMoveEnd()},_clearLayer:function(){let t=this._container.querySelectorAll("img");for(let e=0;e<t.length;e++)this._container.removeChild(t[e])},_onMoveEnd:function(){let t=this._map.getZoom(),e=M.pixelToPCRSBounds(this._map.getPixelBounds(),t,this._map.options.projection);if(this.isVisible=t<=this.zoomBounds.maxZoom&&t>=this.zoomBounds.minZoom&&this.layerBounds.overlaps(e),this.isVisible){var i=this._map,o=i.getPixelBounds().min.subtract(i.getPixelOrigin()),n=i.getSize(),a=this.getImageUrl(),s=this._imageOverlay;this._imageOverlay=M.imageOverlay(a,o,n,0,this._container),this._imageOverlay.addTo(i),s&&this._imageOverlay.on("load error",function(){i.removeLayer(s)})}else this._clearLayer()},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},onRemove:function(t){this._clearLayer(),t._removeZoomLimit(this),this._container=null},getImageUrl:function(){var t={};for(var e in t[this.options.extent.width]=this._map.getSize().x,t[this.options.extent.height]=this._map.getSize().y,t[this.options.extent.bottom]=this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).y,t[this.options.extent.left]=this._TCRSToPCRS(this._map.getPixelBounds().min,this._map.getZoom()).x,t[this.options.extent.top]=this._TCRSToPCRS(this._map.getPixelBounds().min,this._map.getZoom()).y,t[this.options.extent.right]=this._TCRSToPCRS(this._map.getPixelBounds().max,this._map.getZoom()).x,this.options.extent)["width","height","left","right","top","bottom"].indexOf(e)<0&&(t[e]=this.options.extent[e]);return L.Util.template(this._template.template,t)},_TCRSToPCRS:function(t,e){var i=this._map.options.crs;return i.transformation.untransform(t,i.scale(e))},_setUpExtentTemplateVars:function(t){for(var e={extent:{}},i=t.values,o=0;o<t.values.length;o++){var n=i[o].getAttribute("type"),a=i[o].getAttribute("units"),s=i[o].getAttribute("axis"),r=i[o].getAttribute("name"),l=i[o].getAttribute("position"),m="map-select"===i[o].tagName.toLowerCase();if("width"===n)e.extent.width=r;else if("height"===n)e.extent.height=r;else if("location"!==n||"pcrs"!==a&&"gcrs"!==a)if(m){const t=i[o].htmlselect;e.extent[r]=function(){return t.value}}else{const t=i[o];e.extent[r]=function(){return t.getAttribute("value")}}else switch(s){case"longitude":case"easting":l&&(l.match(/.*?-left/i)?e.extent.left=r:l.match(/.*?-right/i)&&(e.extent.right=r));break;case"latitude":case"northing":l&&(l.match(/top-.*?/i)?e.extent.top=r:l.match(/bottom-.*?/i)&&(e.extent.bottom=r))}}return e}}),_=function(t,e){return new d(t,e)},y=L.ImageOverlay.extend({initialize:function(t,e,i,o,n,a){this._container=n,this._url=t,this._location=e,this._size=L.point(i),this._angle=o,L.setOptions(this,a)},getEvents:function(){var t={viewreset:this._reset};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},onAdd:function(){this.on({load:this._onImageLoad}),this._image||this._initImage(),this.options.interactive&&(L.DomUtil.addClass(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this._container.appendChild(this._image),this._reset()},onRemove:function(){L.DomUtil.remove(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},_onImageLoad:function(){this._image&&(this._image.loaded=+new Date,this._updateOpacity())},_animateZoom:function(t){var e=this._map.getZoomScale(t.zoom),i=this._map.getPixelOrigin().add(this._location).multiplyBy(e).subtract(this._map._getNewPixelOrigin(t.center,t.zoom)).round();L.Browser.any3d?L.DomUtil.setTransform(this._image,i,e):L.DomUtil.setPosition(this._image,i)},_reset:function(){var t=this._image,e=this._location,i=this._size;L.DomUtil.setPosition(t,e),t.style.width=i.x+"px",t.style.height=i.y+"px"},_updateOpacity:function(){if(this._map){var t=+new Date,e=!1,i=this._image,o=Math.min(1,(t-i.loaded)/200);L.DomUtil.setOpacity(i,o),o<1&&(e=!0),e&&(L.Util.cancelAnimFrame(this._fadeFrame),this._fadeFrame=L.Util.requestAnimFrame(this._updateOpacity,this)),L.DomUtil.addClass(i,"leaflet-image-loaded")}}}),g=function(t,e,i,o,n,a){return new y(t,e,i,o,n,a)},f=L.Layer.extend({options:{maxNext:10,zIndex:0,maxZoom:25},initialize:function(t,e,i){var o;t&&(this._href=t),e&&(this._layerEl=e,o=!!e.querySelector("map-feature,map-tile,map-extent"),!t&&o&&(this._content=e)),L.setOptions(this,i),this._container=L.DomUtil.create("div","leaflet-layer"),L.DomUtil.addClass(this._container,"mapml-layer"),this._imageContainer=L.DomUtil.create("div","leaflet-layer",this._container),L.DomUtil.addClass(this._imageContainer,"mapml-image-container"),this._mapmlTileContainer=L.DomUtil.create("div","mapml-tile-container",this._container),!o&&e&&e.hasAttribute("label")&&(this._title=e.getAttribute("label")),this._initCount=0,this._initExtent(o?e:null),this.on("attached",this._validateExtent,this),this.validProjection=!0},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},_changeOpacity:function(t){t&&t.target&&t.target.value>=0&&t.target.value<=1&&this.changeOpacity(t.target.value)},changeOpacity:function(t){this._container.style.opacity=t,this.opacityEl&&(this.opacityEl.value=t)},onAdd:function(t){!this._extent||this._validProjection(t)?(this._map=t,this._content?(this._mapmlvectors||(this._mapmlvectors=M.mapMlFeatures(this._content,{renderer:M.featureRenderer(),pane:this._container,opacity:this.options.opacity,projection:t.options.projection,_leafletLayer:this,static:!0,onEachFeature:function(t,e){if(t){var i=document.createElement("div");i.classList.add("mapml-popup-content"),i.insertAdjacentHTML("afterbegin",t.innerHTML),e.bindPopup(i,{autoClose:!1,minWidth:165})}}})),t.addLayer(this._mapmlvectors)):this.once("extentload",function(){this._validProjection(t)?(this._mapmlvectors||(this._mapmlvectors=M.mapMlFeatures(this._content,{renderer:M.featureRenderer(),pane:this._container,opacity:this.options.opacity,projection:t.options.projection,_leafletLayer:this,static:!0,onEachFeature:function(t,e){if(t){var i=document.createElement("div");i.classList.add("mapml-popup-content"),i.insertAdjacentHTML("afterbegin",t.innerHTML),e.bindPopup(i,{autoClose:!1,minWidth:165})}}}).addTo(t)),this._setLayerElExtent()):this.validProjection=!1},this),this._imageLayer||(this._imageLayer=L.layerGroup()),t.addLayer(this._imageLayer),(!this._staticTileLayer||null===this._staticTileLayer._container)&&this._mapmlTileContainer.getElementsByTagName("map-tiles").length>0&&(this._staticTileLayer=M.mapMLStaticTileLayer({pane:this._container,_leafletLayer:this,className:"mapml-static-tile-layer",tileContainer:this._mapmlTileContainer,maxZoomBound:t.options.crs.options.resolutions.length-1,tileSize:t.options.crs.options.crs.tile.bounds.max.x}),t.addLayer(this._staticTileLayer)),this._extent?this._templateVars&&(this._templatedLayer=M.templatedLayer(this._templateVars,{pane:this._container,_leafletLayer:this,crs:this.crs}).addTo(t)):this.once("extentload",function(){this._validProjection(t)?this._templateVars&&(this._templatedLayer=M.templatedLayer(this._templateVars,{pane:this._container,_leafletLayer:this,crs:this.crs}).addTo(t),this._setLayerElExtent()):this.validProjection=!1},this),this._setLayerElExtent(),this.setZIndex(this.options.zIndex),this.getPane().appendChild(this._container),setTimeout(()=>{t.fire("checkdisabled")},0),t.on("popupopen",this._attachSkipButtons,this)):this.validProjection=!1},_validProjection:function(t){let e=!1;if(this._templateVars)for(let i of this._templateVars)i.projectionMatch||i.projection===t.options.projection||(e=!0);return!(e||this.getProjection()!==t.options.projection.toUpperCase())},_setLayerElExtent:function(){let t,e;["_staticTileLayer","_imageLayer","_mapmlvectors","_templatedLayer"].forEach(i=>{if(this[i])if("_templatedLayer"===i)for(let o=0;o<this[i]._templates.length;o++)"query"!==this[i]._templates[o].rel&&this[i]._templates[o].layer.layerBounds&&(t?(t.extend(this[i]._templates[o].layer.layerBounds.min),t.extend(this[i]._templates[o].layer.layerBounds.max)):(t=this[i]._templates[o].layer.layerBounds,e=this[i]._templates[o].layer.zoomBounds));else this[i].layerBounds&&(t?(t.extend(this[i].layerBounds.min),t.extend(this[i].layerBounds.max)):(t=this[i].layerBounds,e=this[i].zoomBounds))}),t&&(this._layerEl.extent=Object.assign(M.convertAndFormatPCRS(t,this._map),{zoom:e}))},addTo:function(t){return t.addLayer(this),this},getEvents:function(){return{zoomanim:this._onZoomAnim}},redraw:function(){this._templatedLayer&&this._templatedLayer.redraw()},_onZoomAnim:function(t){var e=t.zoom,i=this._extent?this._extent.querySelector("map-input[type=zoom]"):null,o=i&&i.hasAttribute("min")?parseInt(i.getAttribute("min")):this._map.getMinZoom(),n=i&&i.hasAttribute("max")?parseInt(i.getAttribute("max")):this._map.getMaxZoom();e<o&&this._extent.zoomout||e>n&&this._extent.zoomin;o<=e&&e<=n||(this._extent.zoomin&&e>n?(this._href=this._extent.zoomin,this._layerEl.src=this._extent.zoomin,this.href=this._extent.zoomin,this._layerEl.src=this._extent.zoomin):this._extent.zoomout&&e<o&&(this._href=this._extent.zoomout,this.href=this._extent.zoomout,this._layerEl.src=this._extent.zoomout)),this._templatedLayer},onRemove:function(t){L.DomUtil.remove(this._container),this._staticTileLayer&&t.removeLayer(this._staticTileLayer),this._mapmlvectors&&t.removeLayer(this._mapmlvectors),this._imageLayer&&t.removeLayer(this._imageLayer),this._templatedLayer&&t.removeLayer(this._templatedLayer),t.fire("checkdisabled"),t.off("popupopen",this._attachSkipButtons)},getZoomBounds:function(){var t=this._extent,e=t?t.querySelector("[type=zoom]"):void 0,i=e&&e.hasAttribute("min")?e.getAttribute("min"):this._map.getMinZoom(),o=e&&e.hasAttribute("max")?e.getAttribute("max"):this._map.getMaxZoom(),n={};return n.min=Math.min(i,o),n.max=Math.max(i,o),n},_transformDeprectatedInput:function(t){var e=t.getAttribute("type").toLowerCase();if("xmin"===e||"ymin"===e||"xmax"===e||"ymax"===e)switch(t.setAttribute("type","location"),t.setAttribute("units","tcrs"),e){case"xmin":t.setAttribute("axis","x"),t.setAttribute("position","top-left");break;case"ymin":t.setAttribute("axis","y"),t.setAttribute("position","top-left");break;case"xmax":t.setAttribute("axis","x"),t.setAttribute("position","bottom-right");break;case"ymax":t.setAttribute("axis","y"),t.setAttribute("position","bottom-right")}},getLayerExtentBounds:function(t){if(this._extent){var e,i,o,n,a,s,r,l,m=t.getZoom(),u=t.options.projection,p=u!==this._extent.getAttribute("units");if(s=this._extent.querySelector("[type=xmin]").getAttribute("min"),r=this._extent.querySelector("[type=xmax]").getAttribute("min"),i=Math.min(s,r),s=this._extent.querySelector("[type=xmin]").getAttribute("max"),r=this._extent.querySelector("[type=xmax]").getAttribute("max"),n=Math.max(s,r),s=this._extent.querySelector("[type=ymin]").getAttribute("min"),r=this._extent.querySelector("[type=ymax]").getAttribute("min"),o=Math.min(s,r),s=this._extent.querySelector("[type=ymin]").getAttribute("max"),r=this._extent.querySelector("[type=ymax]").getAttribute("max"),a=Math.max(s,r),p){var c=[(e=M[u]).latLngToPoint(L.latLng([o,i]),m),e.latLngToPoint(L.latLng([a,n]),m),e.latLngToPoint(L.latLng([o,i]),m),e.latLngToPoint(L.latLng([o,n]),m)];return L.bounds(c)}return(l=parseInt(this._extent.querySelector("[type=zoom]").getAttribute("value")))!==m?(e=M[u],L.bounds(e.latLngToPoint(e.pointToLatLng(L.point(i,o),l),m),e.latLngToPoint(e.pointToLatLng(L.point(n,a),l),m))):L.bounds(L.point(i,o),L.point(n,a))}},getAttribution:function(){return this.options.attribution},getLayerUserControlsHTML:function(){var t=L.DomUtil.create("fieldset","mapml-layer-item"),e=L.DomUtil.create("input"),i=L.DomUtil.create("span","mapml-layer-item-name"),o=L.DomUtil.create("span"),n=L.DomUtil.create("div","mapml-layer-item-properties",t),a=L.DomUtil.create("div","mapml-layer-item-settings",t),s=L.DomUtil.create("label","mapml-layer-item-toggle",n),r=L.DomUtil.create("div","mapml-layer-item-controls",n),l=L.DomUtil.create("details","mapml-layer-item-opacity mapml-control-layers",a),m=L.DomUtil.create("input"),u=L.DomUtil.create("summary"),p=L.SVG.create("svg"),c=L.SVG.create("path"),h=L.SVG.create("path"),d=this._layerEl.parentNode;this.opacityEl=m,p.setAttribute("viewBox","0 0 24 24"),p.setAttribute("height","22"),p.setAttribute("width","22"),c.setAttribute("d","M0 0h24v24H0z"),c.setAttribute("fill","none"),h.setAttribute("d","M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"),p.appendChild(c),p.appendChild(h),a.hidden=!0,o.setAttribute("aria-hidden",!0);let _=L.DomUtil.create("button","mapml-layer-item-remove-control",r);_.type="button",_.title="Remove Layer",_.innerHTML="<span aria-hidden='true'>&#10005;</span>",_.classList.add("mapml-button"),L.DomEvent.on(_,"click",L.DomEvent.stop),L.DomEvent.on(_,"click",t=>{let e,i,o=0;if(i="MAPML-VIEWER"===d.tagName?d.shadowRoot:d.querySelector(".mapml-web-map").shadowRoot,t.target.closest("fieldset").nextElementSibling&&!t.target.closest("fieldset").nextElementSibling.disbaled)for(e=t.target.closest("fieldset").previousElementSibling;e;)o+=2,e=e.previousElementSibling;else e="link";d.removeChild(t.target.closest("fieldset").querySelector("span").layer._layerEl),(e=e?i.querySelector(".leaflet-control-attribution").firstElementChild:e=i.querySelectorAll("input")[o]).focus()},this);let y=L.DomUtil.create("button","mapml-layer-item-settings-control",r);if(y.type="button",y.title="Layer Settings",y.setAttribute("aria-expanded",!1),y.classList.add("mapml-button"),L.DomEvent.on(y,"click",t=>{1==a.hidden?(y.setAttribute("aria-expanded",!0),a.hidden=!1):(y.setAttribute("aria-expanded",!1),a.hidden=!0)},this),e.defaultChecked=!!this._map,e.type="checkbox",i.layer=this,this._legendUrl){var g=document.createElement("a");g.text=" "+this._title,g.href=this._legendUrl,g.target="_blank",g.draggable=!1,i.appendChild(g)}else i.innerHTML=this._title;if(i.id="mapml-layer-item-name-{"+L.stamp(i)+"}",u.innerText="Opacity",u.id="mapml-layer-item-opacity-"+L.stamp(u),l.appendChild(u),l.appendChild(m),m.setAttribute("type","range"),m.setAttribute("min","0"),m.setAttribute("max","1.0"),m.setAttribute("value",this._container.style.opacity||"1.0"),m.setAttribute("step","0.1"),m.setAttribute("aria-labelledby",u.id),m.value=this._container.style.opacity||"1.0",t.setAttribute("aria-grabbed","false"),t.setAttribute("aria-labelledby",i.id),t.onmousedown=(e=>{if("input"===e.target.tagName.toLowerCase()||"select"===e.target.tagName.toLowerCase())return;e.preventDefault();let i=t,o=t.parentNode,n=!1,a=e.clientY;document.body.onmousemove=(t=>{t.preventDefault();let e=t.clientY-a;if(n=Math.abs(e)>5||n,o&&!n||o&&o.childElementCount<=1||o.getBoundingClientRect().top>i.getBoundingClientRect().bottom||o.getBoundingClientRect().bottom<i.getBoundingClientRect().top)return;o.classList.add("mapml-draggable"),i.style.transform="translateY("+e+"px)",i.style.pointerEvents="none";let s=t.clientX,r=t.clientY,l=("MAPML-VIEWER"===d.tagName?d.shadowRoot:d.querySelector(".mapml-web-map").shadowRoot).elementFromPoint(s,r),m=l&&l.closest("fieldset")?l.closest("fieldset"):i;m=Math.abs(e)<=m.offsetHeight?i:m,i.setAttribute("aria-grabbed","true"),i.setAttribute("aria-dropeffect","move"),m&&o===m.parentNode&&(m=m!==i.nextSibling?m:m.nextSibling,i!==m&&(a=t.clientY,i.style.transform=null),o.insertBefore(i,m))}),document.body.onmouseup=(()=>{i.setAttribute("aria-grabbed","false"),i.removeAttribute("aria-dropeffect"),i.style.pointerEvents=null,i.style.transform=null;let t=o.children,e=1;for(let i of t){let t=i.querySelector("span").layer._layerEl;t.setAttribute("data-moving",""),d.insertAdjacentElement("beforeend",t),t.removeAttribute("data-moving"),t._layer.setZIndex(e),e++}o.classList.remove("mapml-draggable"),document.body.onmousemove=document.body.onmouseup=null})}),L.DomEvent.on(m,"change",this._changeOpacity,this),s.appendChild(e),s.appendChild(i),y.appendChild(o),o.appendChild(p),this._styles&&a.appendChild(this._styles),this._userInputs){var f=document.createDocumentFragment(),b=this._templateVars;if(b)for(var x=0;x<b.length;x++)for(var v=b[x],A=0;A<v.values.length;A++){var M=v.values[A],E="#"+M.getAttribute("id");if("map-select"===M.tagName.toLowerCase()&&!f.querySelector(E)){var C=L.DomUtil.create("details","mapml-layer-item-time mapml-control-layers",f),S=L.DomUtil.create("summary"),T=L.DomUtil.create("label");T.innerText=M.getAttribute("name"),T.setAttribute("for",M.getAttribute("id")),S.appendChild(T),C.appendChild(S),C.appendChild(M.htmlselect)}}a.appendChild(f)}return t},_initExtent:function(t){if(this._href||t){var e,i,o=this;if(this._href){var s=new XMLHttpRequest;e=this._href,i=l,s.onreadystatechange=function(){this.readyState===this.DONE&&(400!==this.status&&404!==this.status&&500!==this.status&&406!==this.status||(o.error=!0,o.fire("extentload",o,!0),s.abort()))},s.onload=i,s.onerror=function(){o.error=!0,o.fire("extentload",o,!0)},s.open("GET",e),s.setRequestHeader("Accept",M.mime),s.overrideMimeType("text/xml"),s.send()}else t&&l.call(this,t)}function r(t){var e=document.createElement("select"),i=t.getAttributeNames();for(let o=0;o<i.length;o++)e.setAttribute(i[o],t.getAttribute(i[o]));var o=t.children;for(let t=0;t<o.length;t++){var n=document.createElement("option"),a=o[t].getAttributeNames();for(let e=0;e<a.length;e++)n.setAttribute(a[e],o[t].getAttribute(a[e]));n.innerHTML=o[t].innerHTML,e.appendChild(n)}return e}function l(t){var e=this.responseXML||t;if(e.querySelector&&e.querySelector("map-feature")&&(o._content=e),!this.responseXML&&this.responseText&&(e=(new DOMParser).parseFromString(this.responseText,"text/xml")),this.readyState===this.DONE&&e.querySelector&&!e.querySelector("parsererror")){var i,s=e.querySelector("map-extent")||e.querySelector("map-meta[name=projection]");"map-extent"===s.tagName.toLowerCase()&&s.hasAttribute("units")?i=s.getAttribute("units"):"map-meta"===s.tagName.toLowerCase()&&s.hasAttribute("content")&&(i=M.metaContentToObject(s.getAttribute("content")).content);var l=i&&i===o.options.mapprojection,m=e.querySelector("map-meta[name=extent]"),u=!l&&e.querySelector("map-head map-link[rel=alternate][projection="+o.options.mapprojection+"]"),p=new URL(e.querySelector("map-base")?e.querySelector("map-base").getAttribute("href"):e.baseURI||this.responseURL,this.responseURL).href;if(s){if(!l&&u&&u.hasAttribute("href"))return void o.fire("changeprojection",{href:new URL(u.getAttribute("href"),p).href},!1);if(!l&&o._map&&1===o._map.options.mapEl.querySelectorAll("layer-").length)return void(o._map.options.mapEl.projection=i);if(s.querySelector("map-link[rel=tile],map-link[rel=image],map-link[rel=features],map-link[rel=query]")&&s.hasAttribute("units")){o._templateVars=[];var c=s.querySelectorAll("map-link[rel=tile],map-link[rel=image],map-link[rel=features],map-link[rel=query]"),h=new RegExp("(?:{)(.*?)(?:})","g"),d=s.querySelector('map-input[type="zoom" i]'),_=!1,y={zoom:0};if(m){let t=M.metaContentToObject(m.getAttribute("content"));y.zoom=t.zoom||y.zoom;let e=Object.keys(t);for(let t=0;t<e.length;t++)if(!e[t].includes("zoom")){y.cs=M.axisToCS(e[t].split("-")[2]);break}let o=M.csToAxes(y.cs);y.bounds=M.boundsToPCRSBounds(L.bounds(L.point(+t[`top-left-${o[0]}`],+t[`top-left-${o[1]}`]),L.point(+t[`bottom-right-${o[0]}`],+t[`bottom-right-${o[1]}`])),y.zoom,i,y.cs)}else y.bounds=M[i].options.crs.pcrs.bounds,y.cs="PCRS";for(var g=0;g<c.length;g++){var f=c[g],b=f.getAttribute("tref");if(!b){b=a;let t=e.querySelectorAll("map-input");for(let e of t)b+=`{${e.getAttribute("name")}}`}for(var x,v=f.hasAttribute("title")?f.getAttribute("title"):"Query this layer",A=b.match(h),E=f.hasAttribute("rel")&&"tile"!==f.getAttribute("rel").toLowerCase()?f.getAttribute("rel").toLowerCase():"tile",C=f.hasAttribute("type")?f.getAttribute("type").toLowerCase():"image/*",S=[],T=f&&f.hasAttribute("tms"),z=e.querySelector("map-meta[name=zoom]")?M.metaContentToObject(e.querySelector("map-meta[name=zoom]").getAttribute("content")):void 0;null!==(x=h.exec(b));){var k=x[1],P=s.querySelector("map-input[name="+k+"],map-select[name="+k+"]");if(!P){console.log("input with name="+k+" not found for template variable of same name");break}if(P.hasAttribute("type")&&"location"===P.getAttribute("type")&&!P.hasAttribute("min")&&P.hasAttribute("axis")&&!["i","j"].includes(P.getAttribute("axis").toLowerCase())){d.setAttribute("value",y.zoom);let t=P.getAttribute("axis"),e=M.convertPCRSBounds(y.bounds,y.zoom,i,M.axisToCS(t));P.setAttribute("min",e.min[M.axisToXY(t)]),P.setAttribute("max",e.max[M.axisToXY(t)])}if(S.push(P),_=_||P.hasAttribute("type")&&"zoom"===P.getAttribute("type").toLowerCase(),P.hasAttribute("shard")){var w=P.getAttribute("list");P.servers=[];var I=s.querySelectorAll("map-datalist#"+w+" > map-option");0===I.length&&P.hasAttribute("value")&&(I=P.getAttribute("value").split(""));for(var B=0;B<I.length;B++)I[B].getAttribute?P.servers.push(I[B].getAttribute("value")):P.servers.push(I[B])}else if("map-select"===P.tagName.toLowerCase()){var D=document.createElement("div");D.insertAdjacentHTML("afterbegin",P.outerHTML),P.htmlselect=D.querySelector("map-select"),P.htmlselect=r(P.htmlselect),L.DomEvent.on(P.htmlselect,"change",o.redraw,o),o._userInputs||(o._userInputs=[]),o._userInputs.push(P.htmlselect)}}(b&&A.length===S.length||b===a)&&("query"===E&&(o.queryable=!0),!_&&d&&S.push(d),o._templateVars.push({template:decodeURI(new URL(b,p)),linkEl:f,title:v,rel:E,type:C,values:S,zoomBounds:z,extentPCRSFallback:{bounds:y.bounds},projectionMatch:l||u,projection:s.getAttribute("units")||n,tms:T}))}}}else s=o._synthesizeExtent(e),e.querySelector("map-feature,map-tile")&&(o._content=e);o._parseLicenseAndLegend(e,o),o._extent=s;var q=e.querySelector("map-link[rel=zoomin]"),F=e.querySelector("map-link[rel=zoomout]");if(delete o._extent.zoomin,delete o._extent.zoomout,q&&(o._extent.zoomin=new URL(q.getAttribute("href"),p).href),F&&(o._extent.zoomout=new URL(F.getAttribute("href"),p).href),o._templatedLayer&&o._templatedLayer.reset(o._templateVars),e.querySelector("map-tile")){var R=document.createElement("map-tiles"),N=e.querySelector("map-meta[name=zoom][content]")||e.querySelector("map-input[type=zoom][value]");R.setAttribute("zoom",N&&N.getAttribute("content")||N&&N.getAttribute("value")||"0");for(var O=e.getElementsByTagName("map-tile"),U=0;U<O.length;U++)R.appendChild(document.importNode(O[U],!0));o._mapmlTileContainer.appendChild(R)}M.parseStylesheetAsHTML(e,p,o._container);var j=e.querySelectorAll('map-link[rel=style],map-link[rel="self style"],map-link[rel="style self"]');if(j.length>1){var Z=document.createElement("details"),G=document.createElement("summary");G.innerText="Style",Z.appendChild(G);for(var H=function(t){o.fire("changestyle",{src:t.target.getAttribute("data-href")},!1)},$=0;$<j.length;$++){var V=document.createElement("div"),W=V.appendChild(document.createElement("input"));W.setAttribute("type","radio"),W.setAttribute("id","rad-"+L.stamp(W)),W.setAttribute("name","styles-"+o._title),W.setAttribute("value",j[$].getAttribute("title")),W.setAttribute("data-href",new URL(j[$].getAttribute("href"),p).href);var K=V.appendChild(document.createElement("label"));K.setAttribute("for","rad-"+L.stamp(W)),K.innerText=j[$].getAttribute("title"),"style self"!==j[$].getAttribute("rel")&&"self style"!==j[$].getAttribute("rel")||(W.checked=!0),Z.appendChild(V),L.DomUtil.addClass(Z,"mapml-layer-item-style mapml-control-layers"),L.DomEvent.on(W,"click",H,o)}o._styles=Z}e.querySelector("map-title")?o._title=e.querySelector("map-title").textContent.trim():e instanceof Element&&e.hasAttribute("label")&&(o._title=e.getAttribute("label").trim()),o._map&&(o._validateExtent(),o._map.hasLayer(o)&&o._map.attributionControl.addAttribution(o.getAttribution()))}else o.error=!0;o.fire("extentload",o,!1),o._layerEl.dispatchEvent(new CustomEvent("extentload",{detail:o}))}},_createExtent:function(){var t=document.createElement("map-extent"),e=document.createElement("map-input"),i=document.createElement("map-input"),o=document.createElement("map-input"),n=document.createElement("map-input"),a=document.createElement("map-input"),s=document.createElement("map-input");return a.setAttribute("type","zoom"),a.setAttribute("min","0"),a.setAttribute("max","0"),e.setAttribute("type","xmin"),e.setAttribute("min",""),e.setAttribute("max",""),i.setAttribute("type","ymin"),i.setAttribute("min",""),i.setAttribute("max",""),o.setAttribute("type","xmax"),o.setAttribute("min",""),o.setAttribute("max",""),n.setAttribute("type","ymax"),n.setAttribute("min",""),n.setAttribute("max",""),s.setAttribute("type","projection"),s.setAttribute("value","WGS84"),t.appendChild(e),t.appendChild(i),t.appendChild(o),t.appendChild(n),t.appendChild(a),t.appendChild(s),t},_validateExtent:function(){var t=this._extent;if(t&&t.querySelector&&this._map){if(t.querySelector('[type=xmin][min=""], [type=xmin][max=""], [type=xmax][min=""], [type=xmax][max=""], [type=ymin][min=""], [type=ymin][max=""]')){var e,i,o=t.querySelector("[type=xmin]"),n=t.querySelector("[type=ymin]"),a=t.querySelector("[type=xmax]"),s=t.querySelector("[type=ymax]"),r=t.querySelector("[type=projection][value]");r?(i=r.getAttribute("value"))&&"WGS84"===i?(e=this._map.getBounds(),o.setAttribute("min",e.getWest()),o.setAttribute("max",e.getEast()),n.setAttribute("min",e.getSouth()),n.setAttribute("max",e.getNorth()),a.setAttribute("min",e.getWest()),a.setAttribute("max",e.getEast()),s.setAttribute("min",e.getSouth()),s.setAttribute("max",e.getNorth())):i&&(e=this._map.getPixelBounds(),o.setAttribute("min",e.getBottomLeft().x),o.setAttribute("max",e.getTopRight().x),n.setAttribute("min",e.getTopRight().y),n.setAttribute("max",e.getBottomLeft().y),a.setAttribute("min",e.getBottomLeft().x),a.setAttribute("max",e.getTopRight().x),s.setAttribute("min",e.getTopRight().y),s.setAttribute("max",e.getBottomLeft().y)):this.error=!0}if(t.querySelector('[type=zoom][min=""], [type=zoom][max=""]')){var l=t.querySelector("[type=zoom]");l.setAttribute("min",this._map.getMinZoom()),l.setAttribute("max",this._map.getMaxZoom())}var m=t.hasAttribute("units")?t.getAttribute("units"):null;m&&M[m]?this.crs=M[m]:this.crs=M.OSMTILE}},_getMapMLExtent:function(t,e,i){var o=this._createExtent(),n=o.querySelector("map-input[type=zoom]"),a=o.querySelector("map-input[type=xmin]"),s=o.querySelector("map-input[type=ymin]"),r=o.querySelector("map-input[type=xmax]"),l=o.querySelector("map-input[type=ymax]"),m=o.querySelector("map-input[type=projection]"),u=void 0!==e[0]&&void 0!==e[1]?Math.min(e[0],e[1]):"",p=void 0!==e[0]&&void 0!==e[1]?Math.max(e[0],e[1]):"",c=t?t._southWest?t.getWest():t.getBottomLeft().x:"",h=t?t._southWest?t.getSouth():t.getTopRight().y:"",d=t?t._southWest?t.getEast():t.getTopRight().x:"",_=t?t._southWest?t.getNorth():t.getBottomLeft().y:"";return n.setAttribute("min","number"==typeof u&&isNaN(u)?"":u),n.setAttribute("max","number"==typeof p&&isNaN(p)?"":p),a.setAttribute("min",c),a.setAttribute("max",d),s.setAttribute("min",h),s.setAttribute("max",_),r.setAttribute("min",c),r.setAttribute("max",d),l.setAttribute("min",h),l.setAttribute("max",_),m.setAttribute("value",t&&t._southWest&&!i?"WGS84":i),o},_synthesizeExtent:function(t){var e,i,o,a,s,r,l,m,u,p,c,h,d=t.querySelectorAll("map-meta[name=zoom]")[0],_=t.querySelector("map-meta[name=extent]"),y=t.querySelector("map-meta[name=projection]"),g=y?y.getAttribute("content"):n;if(d)for(i=d.getAttribute("content").split(","),e=0;e<i.length;e++)c=(p=i[e].split("="))[0],h=p[1],"min"===c&&(a=parseInt(h)),"max"===c&&(s=parseInt(h));if(_)for(i=_.getAttribute("content").split(","),e=0;e<i.length;e++)c=(p=i[e].split("="))[0],h=p[1],"xmin"===c&&(r=parseFloat(h)),"xmax"===c&&(m=parseFloat(h)),"ymin"===c&&(l=parseFloat(h)),"ymax"===c&&(u=parseFloat(h));if(r&&l&&m&&u&&"WGS84"===g){var f=L.latLng(l,r),b=L.latLng(u,m);o=L.latLngBounds(f,b)}else r&&l&&m&&u&&(o=L.bounds([[r,l],[m,u]]));return this._getMapMLExtent(o,[a,s],g)},getProjection:function(){let t=this._extent;if(!t)return n;switch(t.tagName.toUpperCase()){case"MAP-EXTENT":if(t.hasAttribute("units"))return t.getAttribute("units").toUpperCase();break;case"MAP-INPUT":if(t.hasAttribute("value"))return t.getAttribute("value").toUpperCase();break;case"MAP-META":if(t.hasAttribute("content"))return M.metaContentToObject(t.getAttribute("content")).content.toUpperCase();break;default:return n}return n},_parseLicenseAndLegend:function(t,e){var i,o,n=t.querySelector("map-link[rel=license]");n&&(i=n.getAttribute("title"),o='<a href="'+n.getAttribute("href")+'" title="'+i+'">'+i+"</a>"),L.setOptions(e,{attribution:o});var a=t.querySelector("map-link[rel=legend]");a&&(e._legendUrl=a.getAttribute("href"))},_getUnprojectedMapLatLngBounds:function(t){var e=(t=t||this._map).getPixelOrigin(),i=t.getPixelBounds(),o=t.unproject(e),n=t.unproject(i.getBottomLeft()),a=t.unproject(i.getTopRight()),s=t.unproject(e.add(t.getSize()));return L.latLngBounds(n,a).extend(s).extend(o)},_projectionMatches:function(t){t=t||this._map;var e=this.getProjection();return!(!t.options.projection||"WGS84"!==e&&t.options.projection!==e)},getQueryTemplates:function(){if(this._templatedLayer&&this._templatedLayer._queries)return this._templatedLayer._queries},_attachSkipButtons:function(t){let e,i,o=t.popup,n=t.target,a=o._container.getElementsByClassName("mapml-popup-content")[0];o._container.setAttribute("role","dialog"),a.setAttribute("tabindex","-1"),a.setAttribute("role","document"),o._count=0,o._source._eventParents?(e=o._source._eventParents[Object.keys(o._source._eventParents)[0]],i=o._source.group):e=o._source._templatedLayer,o._container.querySelector('nav[class="mapml-focus-buttons"]')&&(L.DomUtil.remove(o._container.querySelector('nav[class="mapml-focus-buttons"]')),L.DomUtil.remove(o._container.querySelector("hr")));let s=L.DomUtil.create("nav","mapml-focus-buttons"),r=L.DomUtil.create("button","mapml-popup-button",s);r.type="button",r.title="Focus Map",r.innerHTML="<span aria-hidden='true'>|&#10094;</span>",L.DomEvent.disableClickPropagation(r),L.DomEvent.on(r,"click",L.DomEvent.stop),L.DomEvent.on(r,"click",t=>{n.closePopup(),n._container.focus()},o);let l=L.DomUtil.create("button","mapml-popup-button",s);l.type="button",l.title="Previous Feature",l.innerHTML="<span aria-hidden='true'>&#10094;</span>",L.DomEvent.disableClickPropagation(l),L.DomEvent.on(l,"click",L.DomEvent.stop),L.DomEvent.on(l,"click",e._previousFeature,o);let m=L.DomUtil.create("p","mapml-feature-count",s),u=this._totalFeatureCount?this._totalFeatureCount:1;m.innerText=o._count+1+"/"+u;let p=L.DomUtil.create("button","mapml-popup-button",s);p.type="button",p.title="Next Feature",p.innerHTML="<span aria-hidden='true'>&#10095;</span>",L.DomEvent.disableClickPropagation(p),L.DomEvent.on(p,"click",L.DomEvent.stop),L.DomEvent.on(p,"click",e._nextFeature,o);let c=L.DomUtil.create("button","mapml-popup-button",s);c.type="button",c.title="Focus Controls",c.innerHTML="<span aria-hidden='true'>&#10095;|</span>",L.DomEvent.disableClickPropagation(c),L.DomEvent.on(c,"click",L.DomEvent.stop),L.DomEvent.on(c,"click",t=>{n.closePopup(),n._controlContainer.querySelector("A").focus()},o);let h=L.DomUtil.create("hr");function d(t){let e=t.originalEvent.path||t.originalEvent.composedPath(),a=9===t.originalEvent.keyCode,s=t.originalEvent.shiftKey;e[0].classList.contains("leaflet-popup-close-button")&&a&&!s||27===t.originalEvent.keyCode?(L.DomEvent.stop(t),n.closePopup(o),i.focus()):("Focus Map"===e[0].title||e[0].classList.contains("mapml-popup-content"))&&a&&s&&setTimeout(()=>{L.DomEvent.stop(t),n.closePopup(o),i.focus()},0)}function _(t){let e=t.originalEvent.path||t.originalEvent.composedPath(),i=9===t.originalEvent.keyCode,a=t.originalEvent.shiftKey;13===t.originalEvent.keyCode&&e[0].classList.contains("leaflet-popup-close-button")||27===t.originalEvent.keyCode?(L.DomEvent.stopPropagation(t),n._container.focus(),n.closePopup(o),27!==t.originalEvent.keyCode&&(n._popupClosed=!0)):i&&e[0].classList.contains("leaflet-popup-close-button")?n.closePopup(o):("Focus Map"===e[0].title||e[0].classList.contains("mapml-popup-content"))&&i&&a&&setTimeout(()=>{L.DomEvent.stop(t),n.closePopup(o),n._container.focus()},0)}o._navigationBar=s,o._content.appendChild(h),o._content.appendChild(s),a.focus(),i?(i.setAttribute("aria-expanded","true"),n.on("keydown",d)):n.on("keydown",_),n.on("popupclose",function t(e){e.popup===o&&(n.off("keydown",d),n.off("keydown",_),n.off("popupclose",t),i&&i.setAttribute("aria-expanded","false"))})}}),b=function(t,e,i){return t||e?new f(t,e,i):null},x=L.Layer.extend({onAdd:function(t){let e=t.getSize();(e.x>400||e.y>300)&&(this._container=L.DomUtil.create("table","mapml-debug",t._container),this._panel=E({className:"mapml-debug-panel",pane:this._container}),t.addLayer(this._panel)),this._grid=S({className:"mapml-debug-grid",pane:t._panes.mapPane,zIndex:400,tileSize:t.options.crs.options.crs.tile.bounds.max.x}),t.addLayer(this._grid),this._vectors=z({className:"mapml-debug-vectors",pane:t._panes.mapPane,toolPane:this._container}),t.addLayer(this._vectors)},onRemove:function(t){t.removeLayer(this._grid),t.removeLayer(this._vectors),this._panel&&(t.removeLayer(this._panel),L.DomUtil.remove(this._container))}}),v=function(){return new x},A=L.Layer.extend({initialize:function(t){L.setOptions(this,t)},onAdd:function(t){this._title=L.DomUtil.create("caption","mapml-debug-banner",this.options.pane),this._title.innerHTML="Debug mode",t.debug={},t.debug._infoContainer=this._debugContainer=L.DomUtil.create("tbody","mapml-debug-panel",this.options.pane);let e=t.debug._infoContainer;t.debug._tileCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._tileMatrixCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._mapCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._tcrsCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._pcrsCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._gcrsCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),this._map.on("mousemove",this._updateCoords)},onRemove:function(){L.DomUtil.remove(this._title),this._debugContainer&&(L.DomUtil.remove(this._debugContainer),this._map.off("mousemove",this._updateCoords))},_updateCoords:function(t){if(this.contextMenu._visible)return;let e=this.options.mapEl,i=e._map.project(t.latlng),o=e._map.options.crs.scale(+e.zoom),n=e._map.options.crs.transformation.untransform(i,o),a=e._map.options.crs.options.crs.tile.bounds.max.x,s=i.x%a,r=i.y%a;s<0&&(s+=a),r<0&&(r+=a),this.debug._tileCoord.innerHTML=`\n      <th scope="row">tile: </th>\n      <td>i: ${Math.trunc(s)}, </td>\n      <td>j: ${Math.trunc(r)}</td>\n      `,this.debug._mapCoord.innerHTML=`\n      <th scope="row">map: </th>\n      <td>i: ${Math.trunc(t.containerPoint.x)}, </td>\n      <td>j: ${Math.trunc(t.containerPoint.y)}</td>\n      `,this.debug._gcrsCoord.innerHTML=`\n      <th scope="row">gcrs: </th>\n      <td>lon: ${t.latlng.lng.toFixed(6)}, </td>\n      <td>lat: ${t.latlng.lat.toFixed(6)}</td>\n      `,this.debug._tcrsCoord.innerHTML=`\n      <th scope="row">tcrs: </th>\n      <td>x: ${Math.trunc(i.x)}, </td>\n      <td>y: ${Math.trunc(i.y)}</td>\n      `,this.debug._tileMatrixCoord.innerHTML=`\n      <th scope="row">tilematrix: </th>\n      <td>column: ${Math.trunc(i.x/a)}, </td>\n      <td>row: ${Math.trunc(i.y/a)}</td>\n      `,this.debug._pcrsCoord.innerHTML=`\n      <th scope="row">pcrs: </th>\n      <td>easting: ${n.x.toFixed(2)}, </td>\n      <td>northing: ${n.y.toFixed(2)}</td>\n      `}}),E=function(t){return new A(t)},C=L.GridLayer.extend({initialize:function(t){L.setOptions(this,t),L.GridLayer.prototype.initialize.call(this,this._map)},createTile:function(t){let e=L.DomUtil.create("div","mapml-debug-tile");return e.setAttribute("col",t.x),e.setAttribute("row",t.y),e.setAttribute("zoom",t.z),e.innerHTML=[`col: ${t.x}`,`row: ${t.y}`,`zoom: ${t.z}`].join(", "),e.style.outline="1px dashed red",e}}),S=function(t){return new C(t)},T=L.LayerGroup.extend({initialize:function(t){L.setOptions(this,t),L.LayerGroup.prototype.initialize.call(this,this._map,t)},onAdd:function(t){t.on("overlayremove",this._mapLayerUpdate,this),t.on("overlayadd",this._mapLayerUpdate,this);let e=t.options.crs.transformation.transform(L.point(0,0),t.options.crs.scale(0));this._centerVector=L.circle(t.options.crs.pointToLatLng(e,0),{radius:250}),this._centerVector.bindTooltip("Projection Center"),this._addBounds(t)},onRemove:function(t){this.clearLayers()},_addBounds:function(t){let e=Object.keys(t._layers),i=t._layers,o=["#FF5733","#8DFF33","#3397FF","#E433FF","#F3FF33"],n=0;this.addLayer(this._centerVector);for(let t of e)if(i[t].layerBounds){let e=[i[t].layerBounds.min,L.point(i[t].layerBounds.max.x,i[t].layerBounds.min.y),i[t].layerBounds.max,L.point(i[t].layerBounds.min.x,i[t].layerBounds.max.y)],a=P(e,{color:o[n%o.length],weight:2,opacity:1,fillOpacity:.01,fill:!0});i[t].options._leafletLayer&&a.bindTooltip(i[t].options._leafletLayer._title,{sticky:!0}),this.addLayer(a),n++}if(t.totalLayerBounds){let e=[t.totalLayerBounds.min,L.point(t.totalLayerBounds.max.x,t.totalLayerBounds.min.y),t.totalLayerBounds.max,L.point(t.totalLayerBounds.min.x,t.totalLayerBounds.max.y)],i=P(e,{color:"#808080",weight:5,opacity:.5,fill:!1});this.addLayer(i)}},_mapLayerUpdate:function(t){this.clearLayers(),this._addBounds(t.target)}}),z=function(t){return new T(t)},k=L.Path.extend({options:{className:"mapml-debug-extent"},initialize:function(t,e){this._locations=t,L.setOptions(this,e)},_project:function(){this._rings=[];let t=this._map.options.crs.scale(this._map.getZoom()),e=this._map;for(let i=0;i<this._locations.length;i++){let o=e.options.crs.transformation.transform(this._locations[i],t);this._rings.push(L.point(o.x,o.y)._subtract(e.getPixelOrigin()))}this._parts=[this._rings]},_update:function(){this._map&&this._renderer._updatePoly(this,!0)}}),P=function(t,e){return new k(t,e)},w=L.Handler.extend({addHooks:function(){L.setOptions(this,{mapEl:this._map.options.mapEl}),L.DomEvent.on(this._map,"click",this._queryTopLayer,this),L.DomEvent.on(this._map,"keypress",this._queryTopLayerAtMapCenter,this)},removeHooks:function(){L.DomEvent.off(this._map,"click",this._queryTopLayer,this),L.DomEvent.on(this._map,"keypress",this._queryTopLayerAtMapCenter,this)},_getTopQueryableLayer:function(){for(var t=this.options.mapEl.layers,e=t.length-1;e>=0;e--){var i=t[e]._layer;if(t[e].checked&&i.queryable)return i}},_queryTopLayerAtMapCenter:function(t){setTimeout(()=>{!this._map.isFocused||this._map._popupClosed||" "!==t.originalEvent.key&&13!=+t.originalEvent.keyCode?delete this._map._popupClosed:this._map.fire("click",{latlng:this._map.getCenter(),layerPoint:this._map.latLngToLayerPoint(this._map.getCenter()),containerPoint:this._map.latLngToContainerPoint(this._map.getCenter())})},0)},_queryTopLayer:function(t){var e=this._getTopQueryableLayer();e&&this._query(t,e)},_query(t,e){var i={},o=e.getQueryTemplates()[0],n=t.target.getZoom(),a=this._map,s=e.crs,r=a.options.crs.options.crs.tile.bounds.max.x,l=e._container,m={autoClose:!1,autoPan:!0,maxHeight:.5*a.getSize().y-50},u=function(t){return s.transformation.untransform(t,s.scale(n))},p=function(t){return s.unproject(s.transformation.untransform(t,s.scale(n)),n)},c=s.latLngToPoint(t.latlng,n),h=c.divideBy(r).floor(),d=new L.Bounds(c.divideBy(r).floor().multiplyBy(r),c.divideBy(r).ceil().multiplyBy(r));for(var _ in i[o.query.tilei]=c.x.toFixed()-h.x*r,i[o.query.tilej]=c.y.toFixed()-h.y*r,i[o.query.mapi]=a.getSize().divideBy(2).x.toFixed(),i[o.query.mapj]=a.getSize().divideBy(2).y.toFixed(),i[o.query.pixelleft]=s.pointToLatLng(c,n).lng,i[o.query.pixeltop]=s.pointToLatLng(c,n).lat,i[o.query.pixelright]=s.pointToLatLng(c.add([1,1]),n).lng,i[o.query.pixelbottom]=s.pointToLatLng(c.add([1,1]),n).lat,i[o.query.column]=h.x,i[o.query.row]=h.y,i[o.query.x]=c.x.toFixed(),i[o.query.y]=c.y.toFixed(),i[o.query.easting]=u(c).x,i[o.query.northing]=u(c).y,i[o.query.longitude]=p(c).lng,i[o.query.latitude]=p(c).lat,i[o.query.zoom]=n,i[o.query.width]=a.getSize().x,i[o.query.height]=a.getSize().y,i[o.query.mapbottom]=u(c.add(a.getSize().divideBy(2))).y,i[o.query.mapleft]=u(c.subtract(a.getSize().divideBy(2))).x,i[o.query.maptop]=u(c.subtract(a.getSize().divideBy(2))).y,i[o.query.mapright]=u(c.add(a.getSize().divideBy(2))).x,i[o.query.tilebottom]=u(d.max).y,i[o.query.tileleft]=u(d.min).x,i[o.query.tiletop]=u(d.min).y,i[o.query.tileright]=u(d.max).x,o.query)["mapi","mapj","tilei","tilej","row","col","x","y","easting","northing","longitude","latitude","width","height","zoom","mapleft","mapright",",maptop","mapbottom","tileleft","tileright","tiletop","tilebottom","pixeltop","pixelbottom","pixelleft","pixelright"].indexOf(_)<0&&(i[_]=o.query[_]);let y,g=this._map.project(t.latlng),f=this._map.options.crs.scale(this._map.getZoom()),b=this._map.options.crs.transformation.untransform(g,f);o.layerBounds.contains(b)&&fetch(L.Util.template(o.template,i),{redirect:"follow"}).then(t=>{if(y=t.headers.get("Content-Type"),t.status>=200&&t.status<300)return t.text();throw new Error(t.status)}).then(i=>y.startsWith("text/mapml")?function(t,i){let o=(new DOMParser).parseFromString(t,"application/xml");for(let t of o.querySelectorAll("map-feature"))if(!t.querySelector("map-geometry")){let e=document.createElement("map-geometry"),o=document.createElement("map-point"),n=document.createElement("map-coordinates");e.setAttribute("cs","gcrs"),n.innerHTML=`${i.lng} ${i.lat}`,o.appendChild(n),e.appendChild(o),t.appendChild(e)}let n=M.mapMlFeatures(o,{renderer:M.featureRenderer(),pane:l,projection:a.options.projection,_leafletLayer:e,query:!0,static:!0});n.addTo(a);let s=L.DomUtil.create("div","mapml-popup-content"),r=L.DomUtil.create("iframe");r.style="border: none",r.srcdoc=o.querySelector("map-feature map-properties").innerHTML,r.setAttribute("sandbox","allow-same-origin allow-forms"),s.appendChild(r),e._totalFeatureCount=o.querySelectorAll("map-feature").length,e.bindPopup(s,m).openPopup(i),e.on("popupclose",function(){a.removeLayer(n)}),n.showPaginationFeature({i:0,popup:e._popup})}(i,t.latlng):function(t,e,i){let o=L.DomUtil.create("div","mapml-popup-content"),n=L.DomUtil.create("iframe");n.style="border: none",n.srcdoc=t,n.setAttribute("sandbox","allow-same-origin allow-forms"),o.appendChild(n),e.bindPopup(o,m).openPopup(i)}(i,e,t.latlng)).catch(t=>{console.log("Looks like there was a problem. Status: "+t.message)})}}),I=L.Handler.extend({_touchstart:L.Browser.msPointer?"MSPointerDown":L.Browser.pointer?"pointerdown":"touchstart",initialize:function(t){L.Handler.prototype.initialize.call(this,t),this._items=[{text:M.options.locale.cmBack+" (<kbd>B</kbd>)",callback:this._goBack},{text:M.options.locale.cmForward+" (<kbd>F</kbd>)",callback:this._goForward},{text:M.options.locale.cmReload+" (<kbd>R</kbd>)",callback:this._reload},{spacer:"-"},{text:M.options.locale.cmToggleControls+" (<kbd>T</kbd>)",callback:this._toggleControls},{text:M.options.locale.cmCopyCoords+" (<kbd>C</kbd>)<span></span>",callback:this._copyCoords,hideOnSelect:!1,popup:!0,submenu:[{text:"tile",callback:this._copyTile},{text:"tilematrix",callback:this._copyTileMatrix},{spacer:"-"},{text:"map",callback:this._copyMap},{spacer:"-"},{text:"tcrs",callback:this._copyTCRS},{text:"pcrs",callback:this._copyPCRS},{text:"gcrs",callback:this._copyGCRS},{spacer:"-"},{text:M.options.locale.cmCopyAll,callback:this._copyAllCoords}]},{text:M.options.locale.cmToggleDebug+" (<kbd>D</kbd>)",callback:this._toggleDebug},{text:M.options.locale.cmCopyMapML+" (<kbd>M</kbd>)",callback:this._copyMapML},{text:M.options.locale.cmViewSource+" (<kbd>V</kbd>)",callback:this._viewSource}],this._layerItems=[{text:M.options.locale.lmZoomToLayer+" (<kbd>Z</kbd>)",callback:this._zoomToLayer},{text:M.options.locale.lmCopyExtent+" (<kbd>C</kbd>)",callback:this._copyLayerExtent}],this._mapMenuVisible=!1,this._keyboardEvent=!1,this._container=L.DomUtil.create("div","mapml-contextmenu",t._container),this._container.setAttribute("hidden","");for(let t=0;t<6;t++)this._items[t].el=this._createItem(this._container,this._items[t]);this._coordMenu=L.DomUtil.create("div","mapml-contextmenu mapml-submenu",this._container),this._coordMenu.id="mapml-copy-submenu",this._coordMenu.setAttribute("hidden",""),this._clickEvent=null;for(let t=0;t<this._items[5].submenu.length;t++)this._createItem(this._coordMenu,this._items[5].submenu[t],t);this._items[6].el=this._createItem(this._container,this._items[6]),this._items[7].el=this._createItem(this._container,this._items[7]),this._items[8].el=this._createItem(this._container,this._items[8]),this._layerMenu=L.DomUtil.create("div","mapml-contextmenu mapml-layer-menu",t._container),this._layerMenu.setAttribute("hidden","");for(let t=0;t<this._layerItems.length;t++)this._createItem(this._layerMenu,this._layerItems[t]);L.DomEvent.on(this._container,"click",L.DomEvent.stop).on(this._container,"mousedown",L.DomEvent.stop).on(this._container,"dblclick",L.DomEvent.stop).on(this._container,"contextmenu",L.DomEvent.stop).on(this._layerMenu,"click",L.DomEvent.stop).on(this._layerMenu,"mousedown",L.DomEvent.stop).on(this._layerMenu,"dblclick",L.DomEvent.stop).on(this._layerMenu,"contextmenu",L.DomEvent.stop)},addHooks:function(){var t=this._map.getContainer();L.DomEvent.on(t,"mouseleave",this._hide,this).on(document,"keydown",this._onKeyDown,this),L.Browser.touch&&L.DomEvent.on(document,this._touchstart,this._hide,this),this._map.on({contextmenu:this._show,mousedown:this._hide,zoomstart:this._hide},this)},removeHooks:function(){var t=this._map.getContainer();L.DomEvent.off(t,"mouseleave",this._hide,this).off(document,"keydown",this._onKeyDown,this),L.Browser.touch&&L.DomEvent.off(document,this._touchstart,this._hide,this),this._map.off({contextmenu:this._show,mousedown:this._hide,zoomstart:this._hide},this)},_copyLayerExtent:function(t){let e=t instanceof KeyboardEvent?this._map.contextMenu:this.contextMenu,i=e._layerClicked.layer._layerEl,o=i.extent.topLeft.pcrs,n=i.extent.bottomRight.pcrs,a=`<map-meta name="extent" content="top-left-easting=${o.horizontal}, top-left-northing=${o.vertical}, bottom-right-easting=${n.horizontal}, bottom-right-northing=${n.vertical}"></map-meta>`;e._copyData(a)},_zoomToLayer:function(t){(t instanceof KeyboardEvent?this._map.contextMenu:this.contextMenu)._layerClicked.layer._layerEl.focus()},_goForward:function(t){(t instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl).forward()},_goBack:function(t){(t instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl).back()},_reload:function(t){(t instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl).reload()},_toggleControls:function(t){(t instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl)._toggleControls()},_copyMapML:function(t){let e=t instanceof KeyboardEvent?this._map.contextMenu:this.contextMenu,i=t instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl;e._copyData(i.outerHTML.replace(/<div class="mapml-web-map">.*?<\/div>|<style>\[is="web-map"].*?<\/style>|<style>mapml-viewer.*?<\/style>/gm,""))},_viewSource:function(t){(t instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl).viewSource()},_toggleDebug:function(t){(t instanceof KeyboardEvent?this._map.options.mapEl:this.options.mapEl).toggleDebug()},_copyCoords:function(t){(this.contextMenu?this.contextMenu:this)._showCoordMenu(t)},_copyData:function(t){const e=document.createElement("textarea");e.value=t,document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)},_copyGCRS:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent;this.contextMenu._copyData(`z:${e.zoom}, lon :${i.latlng.lng.toFixed(6)}, lat:${i.latlng.lat.toFixed(6)}`)},_copyTCRS:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent,o=e._map.project(i.latlng);this.contextMenu._copyData(`z:${e.zoom}, x:${o.x}, y:${o.y}`)},_copyTileMatrix:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent,o=e._map.project(i.latlng),n=e._map.options.crs.options.crs.tile.bounds.max.x;this.contextMenu._copyData(`z:${e.zoom}, column:${Math.trunc(o.x/n)}, row:${Math.trunc(o.y/n)}`)},_copyPCRS:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent,o=e._map.project(i.latlng),n=e._map.options.crs.scale(+e.zoom),a=e._map.options.crs.transformation.untransform(o,n);this.contextMenu._copyData(`z:${e.zoom}, easting:${a.x.toFixed(2)}, northing:${a.y.toFixed(2)}`)},_copyTile:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent,o=e._map.options.crs.project(i.latlng),n=e._map.options.crs.options.crs.tile.bounds.max.x,a=o.x%n,s=o.y%n;a<0&&(a+=n),s<0&&(s+=n),this.contextMenu._copyData(`z:${e.zoom}, i:${Math.trunc(a)}, j:${Math.trunc(s)}`)},_copyMap:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent;this.contextMenu._copyData(`z:${e.zoom}, i:${Math.trunc(i.containerPoint.x)}, j:${Math.trunc(i.containerPoint.y)}`)},_copyAllCoords:function(t){let e=this.options.mapEl,i=this.contextMenu._clickEvent,o=e._map.project(i.latlng),n=e._map.options.crs.options.crs.tile.bounds.max.x,a=o.x%n,s=o.y%n,r=e._map.options.crs.scale(+e.zoom),l=e._map.options.crs.transformation.untransform(o,r),m=`z:${e.zoom}\n`;m+=`tile: i:${Math.trunc(a)}, j:${Math.trunc(s)}\n`,m+=`tilematrix: column:${Math.trunc(o.x/n)}, row:${Math.trunc(o.y/n)}\n`,m+=`map: i:${Math.trunc(i.containerPoint.x)}, j:${Math.trunc(i.containerPoint.y)}\n`,m+=`tcrs: x:${Math.trunc(o.x)}, y:${Math.trunc(o.y)}\n`,m+=`pcrs: easting:${l.x.toFixed(2)}, northing:${l.y.toFixed(2)}\n`,m+=`gcrs: lon :${i.latlng.lng.toFixed(6)}, lat:${i.latlng.lat.toFixed(6)}`,this.contextMenu._copyData(m)},_createItem:function(t,e,i){if(e.spacer)return this._createSeparator(t,i);var o=this._insertElementAt("button","mapml-contextmenu-item",t,i),n=this._createEventHandler(o,e.callback,e.context,e.hideOnSelect);return o.innerHTML=""+e.text,o.setAttribute("type","button"),o.classList.add("mapml-button"),e.popup&&(o.setAttribute("aria-haspopup","true"),o.setAttribute("aria-expanded","false"),o.setAttribute("aria-controls","mapml-copy-submenu")),L.DomEvent.on(o,"mouseover",this._onItemMouseOver,this).on(o,"mouseout",this._onItemMouseOut,this).on(o,"mousedown",L.DomEvent.stopPropagation).on(o,"click",n),L.Browser.touch&&L.DomEvent.on(o,this._touchstart,L.DomEvent.stopPropagation),L.Browser.pointer||L.DomEvent.on(o,"click",this._onItemMouseOut,this),{id:L.Util.stamp(o),el:o,callback:n}},_createSeparator:function(t,e){let i=this._insertElementAt("div","mapml-contextmenu-separator",t,e);return{id:L.Util.stamp(i),el:i}},_createEventHandler:function(t,e,i,o){let n=this;return o=void 0===o||o,function(a){let s=n._map,r=n._showLocation.containerPoint,l=s.containerPointToLayerPoint(r),m={containerPoint:r,layerPoint:l,latlng:s.layerPointToLatLng(l),relatedTarget:n._showLocation.relatedTarget};o&&n._hide(),e&&e.call(i||s,m),n._map.fire("contextmenu.select",{contextmenu:n,el:t})}},_insertElementAt:function(t,e,i,o){let n,a=document.createElement(t);return a.className=e,void 0!==o&&(n=i.children[o]),n?i.insertBefore(a,n):i.appendChild(a),a},_show:function(t){this._mapMenuVisible&&this._hide(),this._clickEvent=t;let e=t.originalEvent.target;if(e.closest("fieldset")){if(!(e=e.closest("fieldset").querySelector("span")).layer.validProjection)return;this._layerClicked=e,this._showAtPoint(t.containerPoint,t,this._layerMenu)}else(e.classList.contains("leaflet-container")||e.classList.contains("mapml-debug-extent")||"path"===e.tagName)&&(this._layerClicked=void 0,this._showAtPoint(t.containerPoint,t,this._container));if(0===t.originalEvent.button||-1===t.originalEvent.button)if(this._keyboardEvent=!0,this._layerClicked){let t=document.activeElement;this._elementInFocus=t.shadowRoot.activeElement,this._layerMenuTabs=1,this._layerMenu.firstChild.focus()}else this._container.firstChild.focus()},_showAtPoint:function(t,e,i){if(this._items.length){let o=L.extend(e||{},{contextmenu:this});this._showLocation={containerPoint:t},e&&e.relatedTarget&&(this._showLocation.relatedTarget=e.relatedTarget),this._setPosition(t,i),this._mapMenuVisible||(i.removeAttribute("hidden"),this._mapMenuVisible=!0),this._map.fire("contextmenu.show",o)}},_hide:function(){this._mapMenuVisible&&(this._mapMenuVisible=!1,this._container.setAttribute("hidden",""),this._coordMenu.setAttribute("hidden",""),this._layerMenu.setAttribute("hidden",""),this._map.fire("contextmenu.hide",{contextmenu:this}),setTimeout(()=>this._map._container.focus(),0))},_setPosition:function(t,e){let i,o=this._map.getSize(),n=this._getElementSize(e);this._map.options.contextmenuAnchor&&(i=L.point(this._map.options.contextmenuAnchor),t=t.add(i)),e._leaflet_pos=t,t.x+n.x>o.x?(e.style.left="auto",e.style.right=Math.min(Math.max(o.x-t.x,0),o.x-n.x-1)+"px"):(e.style.left=Math.max(t.x,0)+"px",e.style.right="auto"),t.y+n.y>o.y?(e.style.top="auto",e.style.bottom=Math.min(Math.max(o.y-t.y,0),o.y-n.y-1)+"px"):(e.style.top=Math.max(t.y,0)+"px",e.style.bottom="auto")},_getElementSize:function(t){let e=this._size;return e&&!this._sizeChanged||(e={},t.style.left="-999999px",t.style.right="auto",e.x=t.offsetWidth,e.y=t.offsetHeight,t.style.left="auto",this._sizeChanged=!1),e},_focusOnLayerControl:function(){this._mapMenuVisible=!1,delete this._layerMenuTabs,this._layerMenu.setAttribute("hidden",""),this._elementInFocus?this._elementInFocus.focus():this._layerClicked.parentElement.firstChild.focus(),delete this._elementInFocus},_onKeyDown:function(t){if(!this._mapMenuVisible)return;let e=t.keyCode,i=t.path||t.composedPath();switch(13===e&&t.preventDefault(),!this._layerMenuTabs||9!==e&&27!==e?16===e||9===e||!this._layerClicked&&67===e||i[0].innerText===M.options.locale.cmCopyCoords+" (C)"||this._hide():(t.shiftKey?this._layerMenuTabs-=1:this._layerMenuTabs+=1,0!==this._layerMenuTabs&&3!==this._layerMenuTabs&&27!==e||(L.DomEvent.stop(t),this._focusOnLayerControl())),e){case 13:case 32:this._map._container.parentNode.activeElement.parentNode.classList.contains("mapml-contextmenu")&&this._map._container.parentNode.activeElement.click();break;case 66:this._goBack(t);break;case 67:this._layerClicked?this._copyLayerExtent(t):this._copyCoords({latlng:this._map.getCenter()});break;case 68:this._toggleDebug(t);break;case 77:this._copyMapML(t);break;case 70:this._goForward(t);break;case 82:this._reload(t);break;case 84:this._toggleControls(t);break;case 86:this._viewSource(t);break;case 90:this._layerClicked&&this._zoomToLayer(t)}},_showCoordMenu:function(t){let e=this._map.getSize(),i=this._clickEvent,o=this._coordMenu;this._items[5].el.el.setAttribute("aria-expanded","true"),o.removeAttribute("hidden"),i.containerPoint.x+160+80>e.x?(o.style.left="auto",o.style.right="160px"):(o.style.left="160px",o.style.right="auto"),i.containerPoint.y+160>e.y?(o.style.top="auto",o.style.bottom="20px"):(o.style.top="100px",o.style.bottom="auto"),this._keyboardEvent&&o.firstChild.focus()},_hideCoordMenu:function(t){if(t.srcElement.parentElement.classList.contains("mapml-submenu")||t.srcElement.innerText===M.options.locale.cmCopyCoords+" (C)")return;let e=this._coordMenu;this._items[5].el.el.setAttribute("aria-expanded","false"),e.setAttribute("hidden","")},_onItemMouseOver:function(t){L.DomUtil.addClass(t.target||t.srcElement,"over"),t.srcElement.innerText===M.options.locale.cmCopyCoords+" (C)"&&this._showCoordMenu(t)},_onItemMouseOut:function(t){L.DomUtil.removeClass(t.target||t.srcElement,"over"),this._hideCoordMenu(t)}}),B={convertAndFormatPCRS:function(t,e){if(!t||!e)return{};let i=[],o=[],n=[],a=[],s=e.options.crs.options.crs.tile.bounds.max.y;for(let r=0;r<e.options.crs.options.resolutions.length;r++){let l=e.options.crs.scale(r),m=e.options.crs.transformation.transform(t.min,l),u=e.options.crs.transformation.transform(t.max,l);i.push({horizontal:m.x,vertical:u.y}),o.push({horizontal:u.x,vertical:m.y}),n.push({horizontal:i[r].horizontal/s,vertical:i[r].vertical/s}),a.push({horizontal:o[r].horizontal/s,vertical:o[r].vertical/s})}let r=e.options.crs.unproject(t.min),l=e.options.crs.unproject(t.max),m={topLeft:{horizontal:r.lng,vertical:l.lat},bottomRight:{horizontal:l.lng,vertical:r.lat}},u={topLeft:{horizontal:t.min.x,vertical:t.max.y},bottomRight:{horizontal:t.max.x,vertical:t.min.y}};return{topLeft:{tcrs:i,tilematrix:n,gcrs:m.topLeft,pcrs:u.topLeft},bottomRight:{tcrs:o,tilematrix:a,gcrs:m.bottomRight,pcrs:u.bottomRight},projection:e.options.projection}},extractInputBounds:function(t){if(!t)return;let e=t.values,i=t.projection||n,o=0,a="TILEMATRIX",s=this[i].options.crs.tilematrix.bounds(0),r=0,l=this[i].options.resolutions.length-1,m=!1,u=0;t.zoomBounds||(t.zoomBounds={},t.zoomBounds.min=0,t.zoomBounds.max=l);for(let t=0;t<e.length;t++)switch(e[t].getAttribute("type")){case"zoom":r=+e[t].getAttribute("min"),l=+(e[t].hasAttribute("max")?e[t].getAttribute("max"):l),o=+e[t].getAttribute("value");break;case"location":if(!e[t].getAttribute("max")||!e[t].getAttribute("min"))continue;let i=+e[t].getAttribute("max"),n=+e[t].getAttribute("min");switch(e[t].getAttribute("axis").toLowerCase()){case"x":case"longitude":case"column":case"easting":a=M.axisToCS(e[t].getAttribute("axis").toLowerCase()),s.min.x=n,s.max.x=i,u++;break;case"y":case"latitude":case"row":case"northing":a=M.axisToCS(e[t].getAttribute("axis").toLowerCase()),s.min.y=n,s.max.y=i,u++}}return u>=2&&(m=!0),{zoomBounds:{minZoom:+t.zoomBounds.min,maxZoom:+t.zoomBounds.max,minNativeZoom:r,maxNativeZoom:l},bounds:s=!m&&t.extentPCRSFallback&&t.extentPCRSFallback.bounds?t.extentPCRSFallback.bounds:m?this.boundsToPCRSBounds(s,o,i,a):this[i].options.crs.pcrs.bounds}},axisToCS:function(t){try{switch(t.toLowerCase()){case"row":case"column":return"TILEMATRIX";case"i":case"j":return["MAP","TILE"];case"x":case"y":return"TCRS";case"latitude":case"longitude":return"GCRS";case"northing":case"easting":return"PCRS";default:return"TILEMATRIX"}}catch(t){return}},csToAxes:function(t){try{switch(t.toLowerCase()){case"tilematrix":return["column","row"];case"map":case"tile":return["i","j"];case"tcrs":return["x","y"];case"gcrs":return["longitude","latitude"];case"pcrs":return["easting","northing"]}}catch(t){return}},axisToXY:function(t){try{switch(t.toLowerCase()){case"i":case"column":case"longitude":case"x":case"easting":return"x";case"row":case"j":case"latitude":case"y":case"northing":return"y";default:return}}catch(t){return}},convertPCRSBounds:function(t,e,i,o){if(t&&(e||0===e)&&Number.isFinite(+e)&&i&&o)switch(i="string"==typeof i?M[i]:i,o.toUpperCase()){case"PCRS":return t;case"TCRS":case"TILEMATRIX":let n=i.transformation.transform(t.min,i.scale(+e)),a=i.transformation.transform(t.max,i.scale(+e));if("TCRS"===o.toUpperCase())return L.bounds(n,a);let s=i.options.crs.tile.bounds.max.x;return L.bounds(L.point(n.x/s,n.y/s),L.point(a.x/s,a.y/s));case"GCRS":let r=i.unproject(t.min),l=i.unproject(t.max);return L.bounds(L.point(r.lng,r.lat),L.point(l.lng,l.lat));default:return}},pointToPCRSPoint:function(t,e,i,o){if(!t||!e&&0!==e||!Number.isFinite(+e)||!o||!i)return;let n=(i="string"==typeof i?M[i]:i).options.crs.tile.bounds.max.x;switch(o.toUpperCase()){case"TILEMATRIX":return M.pixelToPCRSPoint(L.point(t.x*n,t.y*n),e,i);case"PCRS":return t;case"TCRS":return M.pixelToPCRSPoint(t,e,i);case"GCRS":return i.project(L.latLng(t.y,t.x));default:return}},pixelToPCRSPoint:function(t,e,i){if(t&&(e||0===e)&&Number.isFinite(+e)&&i)return(i="string"==typeof i?M[i]:i).transformation.untransform(t,i.scale(e))},boundsToPCRSBounds:function(t,e,i,o){if(t&&t.max&&t.min&&(e||0===e)&&Number.isFinite(+e)&&i&&o)return i="string"==typeof i?M[i]:i,L.bounds(M.pointToPCRSPoint(t.min,e,i,o),M.pointToPCRSPoint(t.max,e,i,o))},pixelToPCRSBounds:function(t,e,i){if(t&&t.max&&t.min&&(e||0===e)&&Number.isFinite(+e)&&i)return i="string"==typeof i?M[i]:i,L.bounds(M.pixelToPCRSPoint(t.min,e,i),M.pixelToPCRSPoint(t.max,e,i))},metaContentToObject:function(t){if(!t||t instanceof Object)return{};let e={},i=t.split(/\s+/).join("").split(",");for(let t=0;t<i.length;t++){let o=i[t].split("=");2===o.length&&(e[o[0]]=o[1])}return""!==e&&1===i[0].split("=").length&&(e.content=i[0]),e},coordsToArray:function(t){for(var e=1,i=[],o=t.split(",");e<o.length;e+=2)i.push([parseInt(o[e-1]),parseInt(o[e])]);return i},parseStylesheetAsHTML:function(t,e,i){if(i instanceof Element&&t&&t.querySelector("map-link[rel=stylesheet],map-style")){if(e instanceof Element)e=e.getAttribute("href")?e.getAttribute("href"):document.URL;else if(!e||""===e||e instanceof Object)return;for(var o=[],n=t.querySelectorAll("map-link[rel=stylesheet],map-style"),a=0;a<n.length;a++)if("MAP-LINK"===n[a].nodeName.toUpperCase()){var s=n[a].hasAttribute("href")?new URL(n[a].getAttribute("href"),e).href:null;if(s&&!i.querySelector("link[href='"+s+"']")){var r=document.createElement("link");r.setAttribute("href",s),r.setAttribute("rel","stylesheet"),o.push(r)}}else{var l=document.createElement("style");l.textContent=n[a].textContent,o.push(l)}for(var m=o.length-1;m>=0;m--)i.insertAdjacentElement("afterbegin",o[m])}},splitCoordinate:function(t,e,i){var o=[];t.split(/\s+/gim).forEach(M.parseNumber,o),this.push(o)},parseNumber:function(t,e,i){this.push(parseFloat(t))},handleLink:function(t,e){let i,o,n,a=!1,s=e._map;if("text/html"===t.type&&"_blank"!==t.target)t.target="_top";else if("text/html"!==t.type&&t.url.includes("#")){let e=t.url.split("#"),o=e[1].split(",");i={z:o[0]||0,lng:o[1]||0,lat:o[2]||0},a=!e[0],["/",".","#"].includes(t.url[0])&&(t.target="_self")}if(a)i&&!t.inPlace&&a&&(e._map.options.mapEl.zoomTo(+i.lat,+i.lng,+i.z),n&&(o.opacity=n));else{let a=!1;switch((o=document.createElement("layer-")).setAttribute("src",t.url),o.setAttribute("checked",""),t.target){case"_blank":"text/html"===t.type?window.open(t.url):(s.options.mapEl.appendChild(o),a=!0);break;case"_parent":for(let t of s.options.mapEl.querySelectorAll("layer-"))t._layer!==e&&s.options.mapEl.removeChild(t);s.options.mapEl.appendChild(o),s.options.mapEl.removeChild(e._layerEl),a=!0;break;case"_top":window.location.href=t.url;break;default:n=e._layerEl.opacity,e._layerEl.insertAdjacentElement("beforebegin",o),s.options.mapEl.removeChild(e._layerEl),a=!0}!t.inPlace&&a&&L.DomEvent.on(o,"extentload",function e(r){a&&["_parent","_self"].includes(t.target)&&1===o.parentElement.querySelectorAll("layer-").length&&(o.parentElement.projection=o._layer.getProjection()),o.extent&&(i?o.parentElement.zoomTo(+i.lat,+i.lng,+i.z):o.focus(),L.DomEvent.off(o,"extentload",e)),n&&(o.opacity=n),s.getContainer().focus()})}},gcrsToTileMatrix:function(t){let e=t._map.project(t._map.getCenter()),i=t._map.options.crs.options.crs.tile.bounds.max.y;return[Math.trunc(e.x/i),Math.trunc(e.y/i)]}},D=L.Control.extend({options:{position:"topleft"},onAdd:function(t){let e=L.DomUtil.create("div","mapml-reload-button leaflet-bar"),i=L.DomUtil.create("button","mapml-reload-button",e);return i.innerHTML="<span aria-hidden='true'>&#x021BA</span>",i.title=M.options.locale.cmReload,i.setAttribute("type","button"),i.classList.add("mapml-button"),i.setAttribute("aria-label","Reload"),L.DomEvent.disableClickPropagation(i),L.DomEvent.on(i,"click",L.DomEvent.stop),L.DomEvent.on(i,"click",this._goReload,this),this._reloadButton=i,this._updateDisabled(),t.on("moveend",this._updateDisabled,this),e},onRemove:function(t){t.off("moveend",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_goReload:function(t){!this._disabled&&this._map.options.mapEl._history.length>1&&this._map.options.mapEl.reload()},_updateDisabled:function(){setTimeout(()=>{L.DomUtil.removeClass(this._reloadButton,"leaflet-disabled"),this._reloadButton.setAttribute("aria-disabled","false"),this._map&&(this._disabled||this._map.options.mapEl._history.length<=1)&&(L.DomUtil.addClass(this._reloadButton,"leaflet-disabled"),this._reloadButton.setAttribute("aria-disabled","true"))},0)}}),q=function(t){return new D(t)},F=L.Control.extend({options:{position:"topleft",title:{false:"View fullscreen",true:"Exit fullscreen"}},onAdd:function(t){var e=L.DomUtil.create("div","leaflet-control-fullscreen leaflet-bar leaflet-control");return this.link=L.DomUtil.create("a","leaflet-control-fullscreen-button leaflet-bar-part",e),this.link.href="#",this.link.setAttribute("role","button"),this._map=t,this._map.on("fullscreenchange",this._toggleTitle,this),this._toggleTitle(),L.DomEvent.on(this.link,"click",this._click,this),e},onRemove:function(t){t.off("fullscreenchange",this._toggleTitle,this)},_click:function(t){L.DomEvent.stopPropagation(t),L.DomEvent.preventDefault(t),this._map.toggleFullscreen(this.options)},_toggleTitle:function(){this.link.title=this.options.title[this._map.isFullscreen()]}});L.Map.include({isFullscreen:function(){return this._isFullscreen||!1},toggleFullscreen:function(t){var e=this.getContainer().getRootNode().host,i="DIV"===e.nodeName?e.parentElement:e;this.isFullscreen()?t&&t.pseudoFullscreen?this._disablePseudoFullscreen(i):document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.msExitFullscreen?document.msExitFullscreen():this._disablePseudoFullscreen(i):t&&t.pseudoFullscreen?this._enablePseudoFullscreen(i):i.requestFullscreen?i.requestFullscreen():i.mozRequestFullScreen?i.mozRequestFullScreen():i.webkitRequestFullscreen?i.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):i.msRequestFullscreen?i.msRequestFullscreen():this._enablePseudoFullscreen(i)},_enablePseudoFullscreen:function(t){L.DomUtil.addClass(t,"leaflet-pseudo-fullscreen"),this._setFullscreen(!0),this.fire("fullscreenchange")},_disablePseudoFullscreen:function(t){L.DomUtil.removeClass(t,"leaflet-pseudo-fullscreen"),this._setFullscreen(!1),this.fire("fullscreenchange")},_setFullscreen:function(t){this._isFullscreen=t;var e=this.getContainer().getRootNode().host;t?L.DomUtil.addClass(e,"mapml-fullscreen-on"):L.DomUtil.removeClass(e,"mapml-fullscreen-on"),this.invalidateSize()},_onFullscreenChange:function(t){var e=document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement,i=this.getContainer().getRootNode().host,o="DIV"===i.nodeName?i.parentElement:i;e!==o||this._isFullscreen?e!==o&&this._isFullscreen&&(this._setFullscreen(!1),this.fire("fullscreenchange")):(this._setFullscreen(!0),this.fire("fullscreenchange"))}}),L.Map.mergeOptions({fullscreenControl:!1}),L.Map.addInitHook(function(){var t;if(this.options.fullscreenControl&&(this.fullscreenControl=new F(this.options.fullscreenControl),this.addControl(this.fullscreenControl)),"onfullscreenchange"in document?t="fullscreenchange":"onmozfullscreenchange"in document?t="mozfullscreenchange":"onwebkitfullscreenchange"in document?t="webkitfullscreenchange":"onmsfullscreenchange"in document&&(t="MSFullscreenChange"),t){var e=L.bind(this._onFullscreenChange,this);this.whenReady(function(){L.DomEvent.on(document,t,e)}),this.on("unload",function(){L.DomEvent.off(document,t,e)})}});var R=function(t){return new F(t)},N=L.Layer.extend({onAdd:function(t){this._container=L.DomUtil.create("div","mapml-crosshair",t._container),this._container.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 100 100"><g stroke="#fff" stroke-linecap="round" stroke-linejoin="round"><circle cx="50.028" cy="50.219" r="3.923" stroke-width="2" color="currentColor" overflow="visible"/><path stroke-width="3" d="M4.973 54.424h31.768a4.204 4.204 0 1 0 0-8.409H4.973A4.203 4.203 0 0 0 .77 50.22a4.203 4.203 0 0 0 4.204 4.205z" color="currentColor" overflow="visible"/><path stroke-width="3" d="M54.232 5.165a4.204 4.204 0 1 0-8.408 0v31.767a4.204 4.204 0 1 0 8.408 0V5.165z"/><path stroke-width="3" d="M99.288 50.22a4.204 4.204 0 0 0-4.204-4.205H63.317a4.204 4.204 0 1 0 0 8.409h31.767a4.205 4.205 0 0 0 4.204-4.205zM45.823 95.274a4.204 4.204 0 1 0 8.409 0V63.506a4.204 4.204 0 1 0-8.409 0v31.768z" color="currentColor" overflow="visible"/></g></svg>',t.isFocused=!1,this._isQueryable=!1,t.on("layerchange layeradd layerremove overlayremove",this._toggleEvents,this),t.on("popupopen",this._isMapFocused,this),L.DomEvent.on(t._container,"keydown keyup mousedown",this._isMapFocused,this),this._addOrRemoveCrosshair()},onRemove:function(t){t.off("layerchange layeradd layerremove overlayremove",this._toggleEvents),t.off("popupopen",this._isMapFocused),L.DomEvent.off(t._container,"keydown keyup mousedown",this._isMapFocused)},_toggleEvents:function(){this._hasQueryableLayer()?this._map.on("viewreset move moveend",this._addOrRemoveCrosshair,this):this._map.off("viewreset move moveend",this._addOrRemoveCrosshair,this),this._addOrRemoveCrosshair()},_addOrRemoveCrosshair:function(t){this._hasQueryableLayer()?this._container.removeAttribute("hidden"):this._container.setAttribute("hidden","")},_addOrRemoveMapOutline:function(t){let e=this._map._container;this._map.isFocused&&!this._outline?this._outline=L.DomUtil.create("div","mapml-outline",e):!this._map.isFocused&&this._outline&&(L.DomUtil.remove(this._outline),delete this._outline)},_hasQueryableLayer:function(){let t=this._map.options.mapEl.layers;if(this._map.isFocused)for(let e of t)if(e.checked&&e._layer.queryable)return!0;return!1},_isMapFocused:function(t){if(!this._map._container.parentNode.activeElement)return void(this._map.isFocused=!1);let e=this._map._container.parentNode.activeElement.classList.contains("leaflet-container");e&&["keydown"].includes(t.type)&&t.shiftKey&&9===t.keyCode?this._map.isFocused=!1:this._map.isFocused=e&&["keyup","keydown"].includes(t.type),this._addOrRemoveMapOutline(),this._addOrRemoveCrosshair()}}),O=function(t){return new N(t)},U=L.Path.extend({initialize:function(t,e){this.type=t.tagName.toUpperCase(),"MAP-POINT"!==this.type&&"MAP-MULTIPOINT"!==this.type||(e.fillOpacity=1),e.wrappers.length>0&&(e=Object.assign(this._convertWrappers(e.wrappers),e)),L.setOptions(this,e),this.group=this.options.group,this.options.interactive=this.options.link||this.options.properties&&this.options.onEachFeature,this._parts=[],this._markup=t,this.options.zoom=t.getAttribute("zoom")||this.options.nativeZoom,this._convertMarkup(),(t.querySelector("map-span")||t.querySelector("map-a"))&&this._generateOutlinePoints(),this.isClosed=this._isClosed()},attachLinkHandler:function(t,e,i){let o,n=document.createElement("div"),a=document.createElement("p"),s=!1;n.classList.add("mapml-link-preview"),n.appendChild(a),t.classList.add("map-a"),e.visited&&t.classList.add("map-a-visited"),L.DomEvent.on(t,"mousedown",t=>o={x:t.clientX,y:t.clientY},this),L.DomEvent.on(t,"mouseup",n=>{if(0!==n.button)return;let a=!0,s=this.options._leafletLayer._layerEl.nextElementSibling;for(;s&&a;)s.tagName&&"LAYER-"===s.tagName.toUpperCase()&&(a=!(s.checked&&s._layer.queryable)),s=s.nextElementSibling;if(a&&o){L.DomEvent.stop(n),Math.sqrt(Math.pow(o.x-n.clientX,2)+Math.pow(o.y-n.clientY,2))<=5&&(e.visited=!0,t.setAttribute("stroke","#6c00a2"),t.classList.add("map-a-visited"),M.handleLink(e,i))}},this),L.DomEvent.on(t,"keypress",o=>{L.DomEvent.stop(o),13!==o.keyCode&&32!==o.keyCode||(e.visited=!0,t.setAttribute("stroke","#6c00a2"),t.classList.add("map-a-visited"),M.handleLink(e,i))},this),L.DomEvent.on(t,"mouseenter keyup",t=>{if(t.target!==t.currentTarget)return;s=!0;let i=document.createElement("a"),o=this._map.getContainer().clientWidth;for(i.href=e.url,a.innerHTML=i.href,this._map.getContainer().appendChild(n);a.clientWidth>o/2;)a.innerHTML=a.innerHTML.substring(0,a.innerHTML.length-5)+"...";setTimeout(()=>{s&&(a.innerHTML=i.href)},1e3)},this),L.DomEvent.on(t,"mouseout keydown mousedown",t=>{t.target===t.currentTarget&&n.parentElement&&(s=!1,this._map.getContainer().removeChild(n))},this),L.DomEvent.on(i._map.getContainer(),"mouseout mouseenter click",t=>{n.parentElement&&(s=!1,this._map.getContainer().removeChild(n))},this)},_project:function(t,e,i){let o=t||this._map,n=e||o.getPixelOrigin(),a=void 0===i?o.getZoom():i;for(let t of this._parts){t.pixelRings=this._convertRing(t.rings,o,n,a);for(let e of t.subrings)e.pixelSubrings=this._convertRing([e],o,n,a)}if(this._outline){this.pixelOutline=[];for(let t of this._outline)this.pixelOutline=this.pixelOutline.concat(this._convertRing(t,o,n,a))}},_convertRing:function(t,e,i,o){let n=e.options.crs.scale(o),a=[];for(let o of t){let t=[];for(let a of o.points){let o=e.options.crs.transformation.transform(a,n);t.push(L.point(o.x,o.y)._subtract(i).round())}a.push(t)}return a},_update:function(){this._map&&this._renderer._updateFeature(this)},_convertWrappers:function(t){if(!t||0===t.length)return;let e="",i={};for(let o of t)if("MAP-A"!==o.tagName.toUpperCase()&&o.className)e+=`${o.className} `;else if(!i.link&&o.getAttribute("href")){let t={};t.url=o.getAttribute("href"),o.hasAttribute("target")&&(t.target=o.getAttribute("target")),o.hasAttribute("type")&&(t.type=o.getAttribute("type")),o.hasAttribute("inplace")&&(t.inPlace=!0),i.link=t}return i.className=`${e} ${this.options.className}`.trim(),i},_convertMarkup:function(){if(!this._markup)return;let t=this._markup.attributes;this.featureAttributes={},this.options.link&&"MAP-A"===this._markup.parentElement.tagName.toUpperCase()&&"MAP-GEOMETRY"!==this._markup.parentElement.parentElement.tagName.toUpperCase()&&(this.featureAttributes.tabindex="0");for(let e=0;e<t.length;e++)this.featureAttributes[t[e].name]=t[e].value;let e=!0;for(let t of this._markup.querySelectorAll("map-coordinates")){let i=[],o=[];if(this._coordinateToArrays(t,i,o,this.options.className),e||"MAP-POLYGON"!==this.type)if("MAP-MULTIPOINT"===this.type)for(let t of i[0].points.concat(o))this._parts.push({rings:[{points:[t]}],subrings:[],cls:`${t.cls||""} ${this.options.className||""}`.trim()});else this._parts.push({rings:i,subrings:o,cls:`${this.featureAttributes.class||""} ${this.options.className||""}`.trim()});else this._parts[0].rings.push(i[0]),o.length>0&&(this._parts[0].subrings=this._parts[0].subrings.concat(o));e=!1}},_generateOutlinePoints:function(){if("MAP-MULTIPOINT"!==this.type&&"MAP-POINT"!==this.type&&"MAP-LINESTRING"!==this.type&&"MAP-MULTILINESTRING"!==this.type){this._outline=[];for(let t of this._markup.querySelectorAll("map-coordinates")){let e=t.childNodes,i=0,o=document.createElement("div");e.length;for(let t=0;t<e.length;t++)0===e[t].textContent.trim().length&&e[t].remove();for(let t of e){let n=[];if(!t.tagName){let a="",s=((i-1)%e.length+e.length)%e.length;if(e[s].tagName){let t=e[s].textContent.trim().split(/\s+/);a+=`${t[t.length-2]} ${t[t.length-1]} `}if(a+=t.textContent,e[s=((i+1)%e.length+e.length)%e.length].tagName){let t=e[s].textContent.trim().split(/\s+/);a+=`${t[0]} ${t[1]} `}o.innerHTML=a,this._coordinateToArrays(o,n,[],!0,this.featureAttributes.class||this.options.className),this._outline.push(n)}i++}}}},_coordinateToArrays:function(t,e,i,o=!0,n,a=[]){for(let o of t.children)this._coordinateToArrays(o,e,i,!1,o.getAttribute("class"),a.concat([o]));let s=t.textContent.replace(/(<([^>]+)>)/gi,"").match(/(\S+\s+\S+)/gim),r=[];for(let t of s){let e=[];t.split(/\s+/gim).forEach(M.parseNumber,e);let i=M.pointToPCRSPoint(L.point(e),this.options.zoom,this.options.projection,this.options.nativeCS);r.push(i),this._bounds=this._bounds?this._bounds.extend(i):L.bounds(i,i)}if(o)e.push({points:r});else{let e={},o=t.attributes,s=this._convertWrappers(a);s.link&&(e.tabindex="0");for(let t=0;t<o.length;t++)"class"!==o[t].name&&(e[o[t].name]=o[t].value);i.unshift({points:r,cls:`${n||""} ${s.className||""}`.trim(),attr:e,link:s.link,linkTarget:s.linkTarget,linkType:s.linkType})}},_isClosed:function(){switch(this.type){case"MAP-POLYGON":case"MAP-MULTIPOLYGON":case"MAP-POINT":case"MAP-MULTIPOINT":return!0;case"MAP-LINESTRING":case"MAP-MULTILINESTRING":default:return!1}},getCenter:function(){return this._bounds?this._map.options.crs.unproject(this._bounds.getCenter()):null}}),j=function(t,e){return new U(t,e)},Z=L.SVG.extend({_initContainer:function(){L.SVG.prototype._initContainer.call(this),this._container.setAttribute("role","none presentation")},_initPath:function(t,e=!0){if(t._outline){let e=L.SVG.create("path");t.options.className&&L.DomUtil.addClass(e,t.featureAttributes.class||t.options.className),L.DomUtil.addClass(e,"mapml-feature-outline"),e.style.fill="none",t.outlinePath=e}for(let e of t._parts){if(e.rings&&(this._createPath(e,t.options.className,t.featureAttributes["aria-label"],t.options.interactive,t.featureAttributes),t.outlinePath&&(e.path.style.stroke="none")),e.subrings)for(let i of e.subrings)this._createPath(i,t.options.className,i.attr["aria-label"],void 0!==i.link,i.attr),i.attr&&i.attr.tabindex&&e.path.setAttribute("tabindex",i.attr.tabindex||"0");this._updateStyle(t)}if(e){let e=L.stamp(t);this._layers[e]=t}},_createPath:function(t,e,i,o=!1,n){let a=L.SVG.create("path");if(t.path=a,n)for(let[t,e]of Object.entries(n))"id"!==t&&a.setAttribute(t,e);else i&&a.setAttribute("aria-label",i);(t.cls||e)&&L.DomUtil.addClass(a,t.cls||e),o&&L.DomUtil.addClass(a,"leaflet-interactive")},_addPath:function(t,e,i=!0){this._rootGroup||e||this._initContainer();let o=e||this._rootGroup,n=!1;i&&t.addInteractiveTarget(t.group);for(let e of t._parts){e.path&&t.group.appendChild(e.path),i&&(t.options.link&&t.attachLinkHandler(e.path,t.options.link,t.options._leafletLayer),t.addInteractiveTarget(e.path)),!n&&t.pixelOutline&&(t.group.appendChild(t.outlinePath),n=!0);for(let i of e.subrings)i.path&&(i.link&&(t.attachLinkHandler(i.path,i.link,t.options._leafletLayer),t.addInteractiveTarget(i.path)),t.group.appendChild(i.path))}o.appendChild(t.group)},_removePath:function(t){for(let e of t._parts){e.path&&(t.removeInteractiveTarget(e.path),L.DomUtil.remove(e.path));for(let t of e.subrings)t.path&&L.DomUtil.remove(t.path)}t.outlinePath&&L.DomUtil.remove(t.outlinePath),t.removeInteractiveTarget(t.group),L.DomUtil.remove(t.group),delete this._layers[L.stamp(t)]},_updateFeature:function(t){t.pixelOutline&&this._setPath(t.outlinePath,this.geometryToPath(t.pixelOutline,!1));for(let e of t._parts){this._setPath(e.path,this.geometryToPath(e.pixelRings,t.isClosed));for(let t of e.subrings)this._setPath(t.path,this.geometryToPath(t.pixelSubrings,!1))}},_pointToMarker:function(t){return`M${t.x} ${t.y} L${t.x-12.5} ${t.y-30} C${t.x-12.5} ${t.y-50}, ${t.x+12.5} ${t.y-50}, ${t.x+12.5} ${t.y-30} L${t.x} ${t.y}z`},_updateStyle:function(t){this._updatePathStyle(t.outlinePath,t,!1,!0);for(let e of t._parts){e.path&&this._updatePathStyle(e.path,t,!0);for(let i of e.subrings)i.path&&this._updatePathStyle(i.path,t)}},_updatePathStyle:function(t,e,i=!1,o=!1){if(!t||!e)return;let n=e.options,a=e.isClosed;n.stroke&&(!a||o)||i&&!e.outlinePath?(t.setAttribute("stroke",n.color),t.setAttribute("stroke-opacity",n.opacity),t.setAttribute("stroke-width",n.weight),t.setAttribute("stroke-linecap",n.lineCap),t.setAttribute("stroke-linejoin",n.lineJoin),n.dashArray?t.setAttribute("stroke-dasharray",n.dashArray):t.removeAttribute("stroke-dasharray"),n.dashOffset?t.setAttribute("stroke-dashoffset",n.dashOffset):t.removeAttribute("stroke-dashoffset"),n.link&&(t.setAttribute("stroke",n.link.visited?"#6c00a2":"#0000EE"),t.setAttribute("stroke-opacity","1"),t.setAttribute("stroke-width","1px"),t.setAttribute("stroke-dasharray","none"))):t.setAttribute("stroke","none"),a&&!o?n.fill?t.setAttribute("fill",n.color):(t.setAttribute("fill",n.fillColor||n.color),t.setAttribute("fill-opacity",n.fillOpacity),t.setAttribute("fill-rule",n.fillRule||"evenodd")):t.setAttribute("fill","none")},_setPath:function(t,e){t.setAttribute("d",e)},geometryToPath:function(t,e){let i,o,n,a,s,r,l="";for(i=0,n=t.length;i<n;i++){if(1===(s=t[i]).length)return this._pointToMarker(s[0]);for(o=0,a=s.length;o<a;o++)r=s[o],l+=(o?"L":"M")+r.x+" "+r.y;l+=e?"z":""}return l||"M0 0"}}),G=function(t){return new Z(t)},H=L.FeatureGroup.extend({initialize:function(t,e){if(e.wrappers&&e.wrappers.length>0&&(e=Object.assign(M.Feature.prototype._convertWrappers(e.wrappers),e)),L.LayerGroup.prototype.initialize.call(this,t,e),this.options.onEachFeature&&this.options.properties||this.options.link){this.options.group.setAttribute("tabindex","0"),L.DomUtil.addClass(this.options.group,"leaflet-interactive"),L.DomEvent.on(this.options.group,"keyup keydown mousedown",this._handleFocus,this);let e=t[Object.keys(t)[0]];1===t.length&&e.options.link&&(this.options.link=e.options.link),this.options.link?(M.Feature.prototype.attachLinkHandler.call(this,this.options.group,this.options.link,this.options._leafletLayer),this.options.group.setAttribute("role","link")):(this.options.group.setAttribute("aria-expanded","false"),this.options.group.setAttribute("role","button"),this.options.onEachFeature(this.options.properties,this),this.off("click",this._openPopup))}this.options.group.setAttribute("aria-label",this.options.accessibleTitle),this.options.featureID&&this.options.group.setAttribute("data-fid",this.options.featureID)},_handleFocus:function(t){"G"===t.target.tagName.toUpperCase()&&(9!==t.keyCode&&16!==t.keyCode&&13!==t.keyCode||"keyup"!==t.type?13===t.keyCode||32===t.keyCode?(this.closeTooltip(),!this.options.link&&this.options.onEachFeature&&(L.DomEvent.stop(t),this.openPopup())):this.closeTooltip():this.openTooltip())},addLayer:function(t){!t.options.link&&t.options.interactive&&this.options.onEachFeature(this.options.properties,t),L.FeatureGroup.prototype.addLayer.call(this,t)},_previousFeature:function(t){let e=this._source.group.previousSibling;if(!e){let t=this._source.group.closest("div.mapml-layer").style.zIndex,i=this._map.getPane("overlayPane").children;for(let o=i.length-1;o>=0;o--){let n=i[o];if(!(n.style.zIndex>=t)&&(e=n.querySelector("g.leaflet-interactive"))){e=e.parentNode.lastChild;break}}e||(e=this._source.group)}e.focus(),this._map.closePopup()},_nextFeature:function(t){let e=this._source.group.nextSibling;if(!e){let t=this._source.group.closest("div.mapml-layer").style.zIndex;for(let i of this._map.getPane("overlayPane").children)if(!(i.style.zIndex<=t)&&(e=i.querySelectorAll("g.leaflet-interactive")).length>0)break;e=e&&e.length>0?e[0]:this._source.group}e.focus(),this._map.closePopup()}}),$=function(t,e){return new H(t,e)},V=L.Handler.extend({addHooks:function(){this._map.on({layeradd:this.totalBounds,layerremove:this.totalBounds}),this._map.options.mapEl.addEventListener("moveend",this.announceBounds),this._map.dragging._draggable.addEventListener("dragstart",this.dragged),this._map.options.mapEl.addEventListener("mapfocused",this.focusAnnouncement)},removeHooks:function(){this._map.off({layeradd:this.totalBounds,layerremove:this.totalBounds}),this._map.options.mapEl.removeEventListener("moveend",this.announceBounds),this._map.dragging._draggable.removeEventListener("dragstart",this.dragged),this._map.options.mapEl.removeEventListener("mapfocused",this.focusAnnouncement)},focusAnnouncement:function(){let t=this;setTimeout(function(){let e=t.querySelector(".mapml-web-map")?t.querySelector(".mapml-web-map").shadowRoot.querySelector(".leaflet-container"):t.shadowRoot.querySelector(".leaflet-container"),i=t._map.getZoom(),o=M.gcrsToTileMatrix(t),n=M.options.locale.amZoom+" "+i+" "+M.options.locale.amColumn+" "+o[0]+" "+M.options.locale.amRow+" "+o[1];i===t._map._layersMaxZoom?n=M.options.locale.amMaxZoom+" "+n:i===t._map._layersMinZoom&&(n=M.options.locale.amMinZoom+" "+n),e.setAttribute("aria-roledescription","region "+n),setTimeout(function(){e.removeAttribute("aria-roledescription")},2e3)},0)},announceBounds:function(){if(this._traversalCall>0)return;let t=this._map.getZoom(),e=M.pixelToPCRSBounds(this._map.getPixelBounds(),t,this._map.options.projection),i=!0;this._map.totalLayerBounds&&(i=t<=this._map._layersMaxZoom&&t>=this._map._layersMinZoom&&this._map.totalLayerBounds.overlaps(e));let o=this.querySelector(".mapml-web-map")?this.querySelector(".mapml-web-map").shadowRoot.querySelector(".mapml-screen-reader-output"):this.shadowRoot.querySelector(".mapml-screen-reader-output"),n=M.gcrsToTileMatrix(this),a=M.options.locale.amZoom+" "+t+" "+M.options.locale.amColumn+" "+n[0]+" "+M.options.locale.amRow+" "+n[1];if(i){let e=this._history[this._historyIndex-1]?this._history[this._historyIndex-1].zoom:this._history[this._historyIndex].zoom;t===this._map._layersMaxZoom&&t!==e?o.innerText=M.options.locale.amMaxZoom+" "+a:t===this._map._layersMinZoom&&t!==e?o.innerText=M.options.locale.amMinZoom+" "+a:o.innerText=a}else{let t=this._history[this._historyIndex],e=this._history[this._historyIndex-1];this.back(),this._history.pop(),t.zoom!==e.zoom?o.innerText=M.options.locale.amZoomedOut:this._map.dragging._draggable.wasDragged?o.innerText=M.options.locale.amDraggedOut:t.x>e.x?o.innerText=M.options.locale.amEastBound:t.x<e.x?o.innerText=M.options.locale.amWestBound:t.y<e.y?o.innerText=M.options.locale.amNorthBound:t.y>e.y&&(o.innerText=M.options.locale.amSouthBound)}this._map.dragging._draggable.wasDragged=!1},totalBounds:function(){let t=Object.keys(this._layers),e=L.bounds();t.forEach(t=>{if(this._layers[t].layerBounds){if(!e){let i=this._layers[t].layerBounds.getCenter();e=L.bounds(i,i)}e.extend(this._layers[t].layerBounds.min),e.extend(this._layers[t].layerBounds.max)}}),this.totalLayerBounds=e},dragged:function(){this.wasDragged=!0}}),W={announceMovement:!1,locale:{cmBack:"Back",cmForward:"Forward",cmReload:"Reload",cmToggleControls:"Toggle Controls",cmCopyCoords:"Copy Coordinates",cmToggleDebug:"Toggle Debug Mode",cmCopyMapML:"Copy MapML",cmViewSource:"View Map Source",cmCopyAll:"All",lmZoomToLayer:"Zoom To Layer",lmCopyExtent:"Copy Extent",lcOpacity:"Opacity",btnZoomIn:"Zoom in",btnZoomOut:"Zoom out",btnFullScreen:"View fullscreen",amZoom:"zoom level",amColumn:"column",amRow:"row",amMaxZoom:"At maximum zoom level, zoom in disabled",amMinZoom:"At minimum zoom level, zoom out disabled",amZoomedOut:"Zoomed out of bounds, returning to",amDraggedOut:"Dragged out of bounds, returning to",amEastBound:"Reached east bound, panning east disabled",amWestBound:"Reached west bound, panning west disabled",amNorthBound:"Reached north bound, panning north disabled",amSouthBound:"Reached south bound, panning south disabled"}};L.Map.Keyboard.include({_onKeyDown:function(t){if(t.altKey||t.metaKey)return;let e={187:187,107:107,61:61,171:171},i={189:189,109:109,54:54,173:173};var o,n=t.keyCode,a=this._map;if(n in this._panKeys)a._panAnim&&a._panAnim._inProgress||(o=this._panKeys[n],t.shiftKey&&(o=L.point(o).multiplyBy(3)),t.ctrlKey&&(o=L.point(o).divideBy(5)),a.panBy(o),a.options.maxBounds&&a.panInsideBounds(a.options.maxBounds));else if(n in this._zoomKeys)(n in e&&a._layersMaxZoom!==a.getZoom()||n in i&&a._layersMinZoom!==a.getZoom())&&a.setZoom(a.getZoom()+(t.shiftKey?3:1)*this._zoomKeys[n]);else{if(27!==n||!a._popup||!a._popup.options.closeOnEscapeKey)return;a.closePopup()}L.DomEvent.stop(t)}});var K=L.Layer.extend({onAdd:function(t){this._container=L.DomUtil.create("div","mapml-feature-index-box",t._container),this._container.innerHTML='<svg\n                            xmlns:dc="http://purl.org/dc/elements/1.1/"\n                            xmlns:cc="http://creativecommons.org/ns#"\n                            xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\n                            xmlns:svg="http://www.w3.org/2000/svg" \n                            xmlns="http://www.w3.org/2000/svg" version="1.1"\n                            x="0px" y="0px" viewBox="0 0 99.999998 99.999998" xml:space="preserve">\n                                <g>\n                                    <rect  width="100" height="100"\n                                    style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#000000;fill-opacity:0;fill-rule:nonzero;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"\n                                    />\n                                </g>\n                            </svg>',this._output=L.DomUtil.create("output","mapml-feature-index",t._container),this._body=L.DomUtil.create("span","mapml-feature-index-content",this._output),this._moreContent=L.DomUtil.create("span","mapml-feature-index-more-content",this._output),this._moreContent.style.display="none",t.on("layerchange layeradd layerremove overlayremove",this._toggleEvents,this),t.on("moveend focus",this._checkOverlap,this),t.on("keydown",this._toggleMoreContent,this),this._addOrRemoveFeatureIndex()},_checkOverlap:function(){let t=this._map.getPixelBounds(),e=t.getCenter(),i=36*(Math.abs(t.min.x-t.max.x)/this._map.options.mapEl.width),o=36*(Math.abs(t.min.y-t.max.y)/this._map.options.mapEl.height),n=L.point(e.x-i,e.y+o),a=L.point(e.x+i,e.y-o),s=L.bounds(n,a),r=M.pixelToPCRSBounds(s,this._map.getZoom(),this._map.options.projection),l=this._map._layers,m=1,u=Object.keys(l),p=this._body;p.innerHTML="";let c=this._moreContent;c.innerHTML="",u.forEach(t=>{if(l[t].featureAttributes&&r.overlaps(l[t]._bounds)){let e=l[t].group.getAttribute("aria-label");if(m%9==0){let t=document.createElement("span");t.setAttribute("id",m/9),c.appendChild(t),9===m&&(p.appendChild(this._updateOutput("More results",9)),m+=1)}if(m>9){let t=Math.floor((m-1)/9);c.querySelector(`[id=${CSS.escape(t)}]`).appendChild(this._updateOutput(e,m))}else p.appendChild(this._updateOutput(e,m));m+=1}})},_updateOutput:function(t,e){let i=document.createElement("span");return i.innerHTML=`<kbd>${e}</kbd>`+" "+t,i},_toggleMoreContent:function(t){let e=this._moreContent.style.display;57===t.originalEvent.keyCode&&(this._moreContent.style.display="none"===e?"inline-block":"none")},_toggleEvents:function(){this._map.on("viewreset move moveend focus blur",this._addOrRemoveFeatureIndex,this)},_addOrRemoveFeatureIndex:function(t){let e=this;setTimeout(function(){t&&"focus"===t.type?(e._container.querySelector("rect").style.display="inline",e._output.style.display="block"):t&&"blur"===t.type?(e._container.querySelector("rect").style.display="none",e._output.style.display="none"):e._map.isFocused?(e._container.querySelector("rect").style.display="inline",e._output.style.display="block"):(e._container.querySelector("rect").style.display="none",e._output.style.display="none")},0)}}),Y=function(t){return new K(t)};!function(n,a,A){var M={};n.M=M,function(){M.detectImagePath=function(t){var e=L.DomUtil.create("div","leaflet-default-icon-path",t),i=L.DomUtil.getStyle(e,"background-image")||L.DomUtil.getStyle(e,"backgroundImage");return t.removeChild(e),i=null===i||0!==i.indexOf("url")?"":i.replace(/^url\(["']?/,"").replace(/marker-icon\.png["']?\)$/,"")},M.mime="text/mapml";let t=n.document.head.querySelector("map-options");M.options=W,t&&(M.options=Object.assign(M.options,JSON.parse(t.innerHTML))),M.WGS84=new L.Proj.CRS("EPSG:4326","+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs ",{origin:[-180,90],bounds:L.bounds([[-180,-90],[180,90]]),resolutions:[.703125,.3515625,.17578125,.087890625,.0439453125,.02197265625,.010986328125,.0054931640625,.00274658203125,.001373291015625,.0006866455078125,.0003433227539062,.0001716613769531,858306884766e-16,429153442383e-16,214576721191e-16,107288360596e-16,53644180298e-16,26822090149e-16,13411045074e-16,6.705522537e-7,3.352761269e-7],crs:{tcrs:{horizontal:{name:"x",min:0,max:t=>(M.WGS84.options.bounds.getSize().x/M.WGS84.options.resolutions[t]).toFixed()},vertical:{name:"y",min:0,max:t=>(M.WGS84.options.bounds.getSize().y/M.WGS84.options.resolutions[t]).toFixed()},bounds:t=>L.bounds([M.WGS84.options.crs.tcrs.horizontal.min,M.WGS84.options.crs.tcrs.vertical.min],[M.WGS84.options.crs.tcrs.horizontal.max(t),M.WGS84.options.crs.tcrs.vertical.max(t)])},pcrs:{horizontal:{name:"longitude",get min(){return M.WGS84.options.crs.gcrs.horizontal.min},get max(){return M.WGS84.options.crs.gcrs.horizontal.max}},vertical:{name:"latitude",get min(){return M.WGS84.options.crs.gcrs.vertical.min},get max(){return M.WGS84.options.crs.gcrs.vertical.max}},get bounds(){return M.WGS84.options.bounds}},gcrs:{horizontal:{name:"longitude",min:-180,max:180},vertical:{name:"latitude",min:-90,max:90},get bounds(){return L.latLngBounds([M.WGS84.options.crs.gcrs.vertical.min,M.WGS84.options.crs.gcrs.horizontal.min],[M.WGS84.options.crs.gcrs.vertical.max,M.WGS84.options.crs.gcrs.horizontal.max])}},map:{horizontal:{name:"i",min:0,max:t=>t.getSize().x},vertical:{name:"j",min:0,max:t=>t.getSize().y},bounds:t=>L.bounds(L.point([0,0]),t.getSize())},tile:{horizontal:{name:"i",min:0,max:256},vertical:{name:"j",min:0,max:256},get bounds(){return L.bounds([M.WGS84.options.crs.tile.horizontal.min,M.WGS84.options.crs.tile.vertical.min],[M.WGS84.options.crs.tile.horizontal.max,M.WGS84.options.crs.tile.vertical.max])}},tilematrix:{horizontal:{name:"column",min:0,max:t=>(M.WGS84.options.crs.tcrs.horizontal.max(t)/M.WGS84.options.crs.tile.bounds.getSize().x).toFixed()},vertical:{name:"row",min:0,max:t=>(M.WGS84.options.crs.tcrs.vertical.max(t)/M.WGS84.options.crs.tile.bounds.getSize().y).toFixed()},bounds:t=>L.bounds([M.WGS84.options.crs.tilematrix.horizontal.min,M.WGS84.options.crs.tilematrix.vertical.min],[M.WGS84.options.crs.tilematrix.horizontal.max(t),M.WGS84.options.crs.tilematrix.vertical.max(t)])}}}),M.CBMTILE=new L.Proj.CRS("EPSG:3978","+proj=lcc +lat_1=49 +lat_2=77 +lat_0=49 +lon_0=-95 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs",{origin:[-34655800,3931e4],bounds:L.bounds([[-34655800,-39e6],[1e7,3931e4]]),resolutions:[38364.660062653464,22489.62831258996,13229.193125052918,7937.5158750317505,4630.2175937685215,2645.8386250105837,1587.5031750063501,926.0435187537042,529.1677250021168,317.50063500127004,185.20870375074085,111.12522225044451,66.1459656252646,38.36466006265346,22.48962831258996,13.229193125052918,7.9375158750317505,4.6302175937685215,2.6458386250105836,1.5875031750063502,.9260435187537043,.5291677250021167,.31750063500127,.18520870375074083,.11112522225044451,.06614596562526459],crs:{tcrs:{horizontal:{name:"x",min:0,max:t=>(M.CBMTILE.options.bounds.getSize().x/M.CBMTILE.options.resolutions[t]).toFixed()},vertical:{name:"y",min:0,max:t=>(M.CBMTILE.options.bounds.getSize().y/M.CBMTILE.options.resolutions[t]).toFixed()},bounds:t=>L.bounds([M.CBMTILE.options.crs.tcrs.horizontal.min,M.CBMTILE.options.crs.tcrs.vertical.min],[M.CBMTILE.options.crs.tcrs.horizontal.max(t),M.CBMTILE.options.crs.tcrs.vertical.max(t)])},pcrs:{horizontal:{name:"easting",get min(){return M.CBMTILE.options.bounds.min.x},get max(){return M.CBMTILE.options.bounds.max.x}},vertical:{name:"northing",get min(){return M.CBMTILE.options.bounds.min.y},get max(){return M.CBMTILE.options.bounds.max.y}},get bounds(){return M.CBMTILE.options.bounds}},gcrs:{horizontal:{name:"longitude",min:-141.01,max:-47.74},vertical:{name:"latitude",min:40.04,max:86.46},get bounds(){return L.latLngBounds([M.CBMTILE.options.crs.gcrs.vertical.min,M.CBMTILE.options.crs.gcrs.horizontal.min],[M.CBMTILE.options.crs.gcrs.vertical.max,M.CBMTILE.options.crs.gcrs.horizontal.max])}},map:{horizontal:{name:"i",min:0,max:t=>t.getSize().x},vertical:{name:"j",min:0,max:t=>t.getSize().y},bounds:t=>L.bounds(L.point([0,0]),t.getSize())},tile:{horizontal:{name:"i",min:0,max:256},vertical:{name:"j",min:0,max:256},get bounds(){return L.bounds([M.CBMTILE.options.crs.tile.horizontal.min,M.CBMTILE.options.crs.tile.vertical.min],[M.CBMTILE.options.crs.tile.horizontal.max,M.CBMTILE.options.crs.tile.vertical.max])}},tilematrix:{horizontal:{name:"column",min:0,max:t=>(M.CBMTILE.options.crs.tcrs.horizontal.max(t)/M.CBMTILE.options.crs.tile.bounds.getSize().x).toFixed()},vertical:{name:"row",min:0,max:t=>(M.CBMTILE.options.crs.tcrs.vertical.max(t)/M.CBMTILE.options.crs.tile.bounds.getSize().y).toFixed()},bounds:t=>L.bounds([0,0],[M.CBMTILE.options.crs.tilematrix.horizontal.max(t),M.CBMTILE.options.crs.tilematrix.vertical.max(t)])}}}),M.APSTILE=new L.Proj.CRS("EPSG:5936","+proj=stere +lat_0=90 +lat_ts=50 +lon_0=-150 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m +no_defs",{origin:[-28567784.109255,32567784.109255],bounds:L.bounds([[-28567784.109254867,-28567784.109254755],[32567784.109255023,32567784.10925506]]),resolutions:[238810.813354,119405.406677,59702.7033384999,29851.3516692501,14925.675834625,7462.83791731252,3731.41895865639,1865.70947932806,932.854739664032,466.427369832148,233.213684916074,116.606842458037,58.3034212288862,29.1517106145754,14.5758553072877,7.28792765351156,3.64396382688807,1.82198191331174,.910990956788164,.45549547826179],crs:{tcrs:{horizontal:{name:"x",min:0,max:t=>(M.APSTILE.options.bounds.getSize().x/M.APSTILE.options.resolutions[t]).toFixed()},vertical:{name:"y",min:0,max:t=>(M.APSTILE.options.bounds.getSize().y/M.APSTILE.options.resolutions[t]).toFixed()},bounds:t=>L.bounds([M.APSTILE.options.crs.tcrs.horizontal.min,M.APSTILE.options.crs.tcrs.vertical.min],[M.APSTILE.options.crs.tcrs.horizontal.max(t),M.APSTILE.options.crs.tcrs.vertical.max(t)])},pcrs:{horizontal:{name:"easting",get min(){return M.APSTILE.options.bounds.min.x},get max(){return M.APSTILE.options.bounds.max.x}},vertical:{name:"northing",get min(){return M.APSTILE.options.bounds.min.y},get max(){return M.APSTILE.options.bounds.max.y}},get bounds(){return M.APSTILE.options.bounds}},gcrs:{horizontal:{name:"longitude",min:-180,max:180},vertical:{name:"latitude",min:60,max:90},get bounds(){return L.latLngBounds([M.APSTILE.options.crs.gcrs.vertical.min,M.APSTILE.options.crs.gcrs.horizontal.min],[M.APSTILE.options.crs.gcrs.vertical.max,M.APSTILE.options.crs.gcrs.horizontal.max])}},map:{horizontal:{name:"i",min:0,max:t=>t.getSize().x},vertical:{name:"j",min:0,max:t=>t.getSize().y},bounds:t=>L.bounds(L.point([0,0]),t.getSize())},tile:{horizontal:{name:"i",min:0,max:256},vertical:{name:"j",min:0,max:256},get bounds(){return L.bounds([M.APSTILE.options.crs.tile.horizontal.min,M.APSTILE.options.crs.tile.vertical.min],[M.APSTILE.options.crs.tile.horizontal.max,M.APSTILE.options.crs.tile.vertical.max])}},tilematrix:{horizontal:{name:"column",min:0,max:t=>(M.APSTILE.options.crs.tcrs.horizontal.max(t)/M.APSTILE.options.crs.tile.bounds.getSize().x).toFixed()},vertical:{name:"row",min:0,max:t=>(M.APSTILE.options.crs.tcrs.vertical.max(t)/M.APSTILE.options.crs.tile.bounds.getSize().y).toFixed()},bounds:t=>L.bounds([0,0],[M.APSTILE.options.crs.tilematrix.horizontal.max(t),M.APSTILE.options.crs.tilematrix.vertical.max(t)])}}}),M.OSMTILE=L.CRS.EPSG3857,L.setOptions(M.OSMTILE,{origin:[-20037508.342787,20037508.342787],bounds:L.bounds([[-20037508.342787,-20037508.342787],[20037508.342787,20037508.342787]]),resolutions:[156543.0339,78271.51695,39135.758475,19567.8792375,9783.93961875,4891.969809375,2445.9849046875,1222.9924523438,611.49622617188,305.74811308594,152.87405654297,76.437028271484,38.218514135742,19.109257067871,9.5546285339355,4.7773142669678,2.3886571334839,1.1943285667419,.59716428337097,.29858214168549,.14929107084274,.074645535421371,.03732276771068573,.018661383855342866,.009330691927671433],crs:{tcrs:{horizontal:{name:"x",min:0,max:t=>(M.OSMTILE.options.bounds.getSize().x/M.OSMTILE.options.resolutions[t]).toFixed()},vertical:{name:"y",min:0,max:t=>(M.OSMTILE.options.bounds.getSize().y/M.OSMTILE.options.resolutions[t]).toFixed()},bounds:t=>L.bounds([M.OSMTILE.options.crs.tcrs.horizontal.min,M.OSMTILE.options.crs.tcrs.vertical.min],[M.OSMTILE.options.crs.tcrs.horizontal.max(t),M.OSMTILE.options.crs.tcrs.vertical.max(t)])},pcrs:{horizontal:{name:"easting",get min(){return M.OSMTILE.options.bounds.min.x},get max(){return M.OSMTILE.options.bounds.max.x}},vertical:{name:"northing",get min(){return M.OSMTILE.options.bounds.min.y},get max(){return M.OSMTILE.options.bounds.max.y}},get bounds(){return M.OSMTILE.options.bounds}},gcrs:{horizontal:{name:"longitude",get min(){return M.OSMTILE.unproject(M.OSMTILE.options.bounds.min).lng},get max(){return M.OSMTILE.unproject(M.OSMTILE.options.bounds.max).lng}},vertical:{name:"latitude",get min(){return M.OSMTILE.unproject(M.OSMTILE.options.bounds.min).lat},get max(){return M.OSMTILE.unproject(M.OSMTILE.options.bounds.max).lat}},get bounds(){return L.latLngBounds([M.OSMTILE.options.crs.gcrs.vertical.min,M.OSMTILE.options.crs.gcrs.horizontal.min],[M.OSMTILE.options.crs.gcrs.vertical.max,M.OSMTILE.options.crs.gcrs.horizontal.max])}},map:{horizontal:{name:"i",min:0,max:t=>t.getSize().x},vertical:{name:"j",min:0,max:t=>t.getSize().y},bounds:t=>L.bounds(L.point([0,0]),t.getSize())},tile:{horizontal:{name:"i",min:0,max:256},vertical:{name:"j",min:0,max:256},get bounds(){return L.bounds([M.OSMTILE.options.crs.tile.horizontal.min,M.OSMTILE.options.crs.tile.vertical.min],[M.OSMTILE.options.crs.tile.horizontal.max,M.OSMTILE.options.crs.tile.vertical.max])}},tilematrix:{horizontal:{name:"column",min:0,max:t=>(M.OSMTILE.options.crs.tcrs.horizontal.max(t)/M.OSMTILE.options.crs.tile.bounds.getSize().x).toFixed()},vertical:{name:"row",min:0,max:t=>(M.OSMTILE.options.crs.tcrs.vertical.max(t)/M.OSMTILE.options.crs.tile.bounds.getSize().y).toFixed()},bounds:t=>L.bounds([0,0],[M.OSMTILE.options.crs.tilematrix.horizontal.max(t),M.OSMTILE.options.crs.tilematrix.vertical.max(t)])}}})}(),M.handleLink=B.handleLink,M.convertPCRSBounds=B.convertPCRSBounds,M.axisToXY=B.axisToXY,M.csToAxes=B.csToAxes,M.convertAndFormatPCRS=B.convertAndFormatPCRS,M.axisToCS=B.axisToCS,M.parseNumber=B.parseNumber,M.extractInputBounds=B.extractInputBounds,M.splitCoordinate=B.splitCoordinate,M.boundsToPCRSBounds=B.boundsToPCRSBounds,M.pixelToPCRSBounds=B.pixelToPCRSBounds,M.metaContentToObject=B.metaContentToObject,M.coordsToArray=B.coordsToArray,M.parseStylesheetAsHTML=B.parseStylesheetAsHTML,M.pointToPCRSPoint=B.pointToPCRSPoint,M.pixelToPCRSPoint=B.pixelToPCRSPoint,M.gcrsToTileMatrix=B.gcrsToTileMatrix,M.QueryHandler=w,M.ContextMenu=I,M.AnnounceMovement=V,L.Map.addInitHook("addHandler","query",M.QueryHandler),L.Map.addInitHook("addHandler","contextMenu",M.ContextMenu),L.Map.addInitHook("addHandler","announceMovement",M.AnnounceMovement),M.MapMLLayer=f,M.mapMLLayer=b,M.ImageOverlay=y,M.imageOverlay=g,M.TemplatedImageLayer=d,M.templatedImageLayer=_,M.TemplatedFeaturesLayer=c,M.templatedFeaturesLayer=h,M.TemplatedLayer=u,M.templatedLayer=p,M.TemplatedTileLayer=l,M.templatedTileLayer=m,M.MapMLFeatures=s,M.mapMlFeatures=r,M.MapMLLayerControl=i,M.mapMlLayerControl=o,M.ReloadButton=D,M.reloadButton=q,M.FullscreenButton=F,M.fullscreenButton=R,M.MapMLStaticTileLayer=t,M.mapMLStaticTileLayer=e,M.DebugOverlay=x,M.debugOverlay=v,M.Crosshair=N,M.crosshair=O,M.FeatureIndex=K,M.featureIndex=Y,M.Feature=U,M.feature=j,M.FeatureRenderer=Z,M.featureRenderer=G,M.FeatureGroup=H,M.featureGroup=$}(window)}();
\ No newline at end of file
diff --git a/screenreader/feature-index/dist/proj4-src.js b/screenreader/feature-index/dist/proj4-src.js
deleted file mode 100644
index b29a12a..0000000
--- a/screenreader/feature-index/dist/proj4-src.js
+++ /dev/null
@@ -1,6602 +0,0 @@
-(function (global, factory) {
-    typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
-    typeof define === 'function' && define.amd ? define(factory) :
-    (global.proj4 = factory());
-}(window, (function () { 'use strict';
-
-    var globals = function(defs) {
-      defs('EPSG:4326', "+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees");
-      defs('EPSG:4269', "+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees");
-      defs('EPSG:3857', "+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs");
-
-      defs.WGS84 = defs['EPSG:4326'];
-      defs['EPSG:3785'] = defs['EPSG:3857']; // maintain backward compat, official code is 3857
-      defs.GOOGLE = defs['EPSG:3857'];
-      defs['EPSG:900913'] = defs['EPSG:3857'];
-      defs['EPSG:102113'] = defs['EPSG:3857'];
-    };
-
-    var PJD_3PARAM = 1;
-    var PJD_7PARAM = 2;
-    var PJD_WGS84 = 4; // WGS84 or equivalent
-    var PJD_NODATUM = 5; // WGS84 or equivalent
-    var SEC_TO_RAD = 4.84813681109535993589914102357e-6;
-    var HALF_PI = Math.PI/2;
-    // ellipoid pj_set_ell.c
-    var SIXTH = 0.1666666666666666667;
-    /* 1/6 */
-    var RA4 = 0.04722222222222222222;
-    /* 17/360 */
-    var RA6 = 0.02215608465608465608;
-    var EPSLN = 1.0e-10;
-    // you'd think you could use Number.EPSILON above but that makes
-    // Mollweide get into an infinate loop.
-
-    var D2R = 0.01745329251994329577;
-    var R2D = 57.29577951308232088;
-    var FORTPI = Math.PI/4;
-    var TWO_PI = Math.PI * 2;
-    // SPI is slightly greater than Math.PI, so values that exceed the -180..180
-    // degree range by a tiny amount don't get wrapped. This prevents points that
-    // have drifted from their original location along the 180th meridian (due to
-    // floating point error) from changing their sign.
-    var SPI = 3.14159265359;
-
-    var exports$1 = {};
-    exports$1.greenwich = 0.0; //"0dE",
-    exports$1.lisbon = -9.131906111111; //"9d07'54.862\"W",
-    exports$1.paris = 2.337229166667; //"2d20'14.025\"E",
-    exports$1.bogota = -74.080916666667; //"74d04'51.3\"W",
-    exports$1.madrid = -3.687938888889; //"3d41'16.58\"W",
-    exports$1.rome = 12.452333333333; //"12d27'8.4\"E",
-    exports$1.bern = 7.439583333333; //"7d26'22.5\"E",
-    exports$1.jakarta = 106.807719444444; //"106d48'27.79\"E",
-    exports$1.ferro = -17.666666666667; //"17d40'W",
-    exports$1.brussels = 4.367975; //"4d22'4.71\"E",
-    exports$1.stockholm = 18.058277777778; //"18d3'29.8\"E",
-    exports$1.athens = 23.7163375; //"23d42'58.815\"E",
-    exports$1.oslo = 10.722916666667; //"10d43'22.5\"E"
-
-    var units = {
-      ft: {to_meter: 0.3048},
-      'us-ft': {to_meter: 1200 / 3937}
-    };
-
-    var ignoredChar = /[\s_\-\/\(\)]/g;
-    function match(obj, key) {
-      if (obj[key]) {
-        return obj[key];
-      }
-      var keys = Object.keys(obj);
-      var lkey = key.toLowerCase().replace(ignoredChar, '');
-      var i = -1;
-      var testkey, processedKey;
-      while (++i < keys.length) {
-        testkey = keys[i];
-        processedKey = testkey.toLowerCase().replace(ignoredChar, '');
-        if (processedKey === lkey) {
-          return obj[testkey];
-        }
-      }
-    }
-
-    var parseProj = function(defData) {
-      var self = {};
-      var paramObj = defData.split('+').map(function(v) {
-        return v.trim();
-      }).filter(function(a) {
-        return a;
-      }).reduce(function(p, a) {
-        var split = a.split('=');
-        split.push(true);
-        p[split[0].toLowerCase()] = split[1];
-        return p;
-      }, {});
-      var paramName, paramVal, paramOutname;
-      var params = {
-        proj: 'projName',
-        datum: 'datumCode',
-        rf: function(v) {
-          self.rf = parseFloat(v);
-        },
-        lat_0: function(v) {
-          self.lat0 = v * D2R;
-        },
-        lat_1: function(v) {
-          self.lat1 = v * D2R;
-        },
-        lat_2: function(v) {
-          self.lat2 = v * D2R;
-        },
-        lat_ts: function(v) {
-          self.lat_ts = v * D2R;
-        },
-        lon_0: function(v) {
-          self.long0 = v * D2R;
-        },
-        lon_1: function(v) {
-          self.long1 = v * D2R;
-        },
-        lon_2: function(v) {
-          self.long2 = v * D2R;
-        },
-        alpha: function(v) {
-          self.alpha = parseFloat(v) * D2R;
-        },
-        lonc: function(v) {
-          self.longc = v * D2R;
-        },
-        x_0: function(v) {
-          self.x0 = parseFloat(v);
-        },
-        y_0: function(v) {
-          self.y0 = parseFloat(v);
-        },
-        k_0: function(v) {
-          self.k0 = parseFloat(v);
-        },
-        k: function(v) {
-          self.k0 = parseFloat(v);
-        },
-        a: function(v) {
-          self.a = parseFloat(v);
-        },
-        b: function(v) {
-          self.b = parseFloat(v);
-        },
-        r_a: function() {
-          self.R_A = true;
-        },
-        zone: function(v) {
-          self.zone = parseInt(v, 10);
-        },
-        south: function() {
-          self.utmSouth = true;
-        },
-        towgs84: function(v) {
-          self.datum_params = v.split(",").map(function(a) {
-            return parseFloat(a);
-          });
-        },
-        to_meter: function(v) {
-          self.to_meter = parseFloat(v);
-        },
-        units: function(v) {
-          self.units = v;
-          var unit = match(units, v);
-          if (unit) {
-            self.to_meter = unit.to_meter;
-          }
-        },
-        from_greenwich: function(v) {
-          self.from_greenwich = v * D2R;
-        },
-        pm: function(v) {
-          var pm = match(exports$1, v);
-          self.from_greenwich = (pm ? pm : parseFloat(v)) * D2R;
-        },
-        nadgrids: function(v) {
-          if (v === '@null') {
-            self.datumCode = 'none';
-          }
-          else {
-            self.nadgrids = v;
-          }
-        },
-        axis: function(v) {
-          var legalAxis = "ewnsud";
-          if (v.length === 3 && legalAxis.indexOf(v.substr(0, 1)) !== -1 && legalAxis.indexOf(v.substr(1, 1)) !== -1 && legalAxis.indexOf(v.substr(2, 1)) !== -1) {
-            self.axis = v;
-          }
-        }
-      };
-      for (paramName in paramObj) {
-        paramVal = paramObj[paramName];
-        if (paramName in params) {
-          paramOutname = params[paramName];
-          if (typeof paramOutname === 'function') {
-            paramOutname(paramVal);
-          }
-          else {
-            self[paramOutname] = paramVal;
-          }
-        }
-        else {
-          self[paramName] = paramVal;
-        }
-      }
-      if(typeof self.datumCode === 'string' && self.datumCode !== "WGS84"){
-        self.datumCode = self.datumCode.toLowerCase();
-      }
-      return self;
-    };
-
-    var NEUTRAL = 1;
-    var KEYWORD = 2;
-    var NUMBER = 3;
-    var QUOTED = 4;
-    var AFTERQUOTE = 5;
-    var ENDED = -1;
-    var whitespace = /\s/;
-    var latin = /[A-Za-z]/;
-    var keyword = /[A-Za-z84]/;
-    var endThings = /[,\]]/;
-    var digets = /[\d\.E\-\+]/;
-    // const ignoredChar = /[\s_\-\/\(\)]/g;
-    function Parser(text) {
-      if (typeof text !== 'string') {
-        throw new Error('not a string');
-      }
-      this.text = text.trim();
-      this.level = 0;
-      this.place = 0;
-      this.root = null;
-      this.stack = [];
-      this.currentObject = null;
-      this.state = NEUTRAL;
-    }
-    Parser.prototype.readCharicter = function() {
-      var char = this.text[this.place++];
-      if (this.state !== QUOTED) {
-        while (whitespace.test(char)) {
-          if (this.place >= this.text.length) {
-            return;
-          }
-          char = this.text[this.place++];
-        }
-      }
-      switch (this.state) {
-        case NEUTRAL:
-          return this.neutral(char);
-        case KEYWORD:
-          return this.keyword(char)
-        case QUOTED:
-          return this.quoted(char);
-        case AFTERQUOTE:
-          return this.afterquote(char);
-        case NUMBER:
-          return this.number(char);
-        case ENDED:
-          return;
-      }
-    };
-    Parser.prototype.afterquote = function(char) {
-      if (char === '"') {
-        this.word += '"';
-        this.state = QUOTED;
-        return;
-      }
-      if (endThings.test(char)) {
-        this.word = this.word.trim();
-        this.afterItem(char);
-        return;
-      }
-      throw new Error('havn\'t handled "' +char + '" in afterquote yet, index ' + this.place);
-    };
-    Parser.prototype.afterItem = function(char) {
-      if (char === ',') {
-        if (this.word !== null) {
-          this.currentObject.push(this.word);
-        }
-        this.word = null;
-        this.state = NEUTRAL;
-        return;
-      }
-      if (char === ']') {
-        this.level--;
-        if (this.word !== null) {
-          this.currentObject.push(this.word);
-          this.word = null;
-        }
-        this.state = NEUTRAL;
-        this.currentObject = this.stack.pop();
-        if (!this.currentObject) {
-          this.state = ENDED;
-        }
-
-        return;
-      }
-    };
-    Parser.prototype.number = function(char) {
-      if (digets.test(char)) {
-        this.word += char;
-        return;
-      }
-      if (endThings.test(char)) {
-        this.word = parseFloat(this.word);
-        this.afterItem(char);
-        return;
-      }
-      throw new Error('havn\'t handled "' +char + '" in number yet, index ' + this.place);
-    };
-    Parser.prototype.quoted = function(char) {
-      if (char === '"') {
-        this.state = AFTERQUOTE;
-        return;
-      }
-      this.word += char;
-      return;
-    };
-    Parser.prototype.keyword = function(char) {
-      if (keyword.test(char)) {
-        this.word += char;
-        return;
-      }
-      if (char === '[') {
-        var newObjects = [];
-        newObjects.push(this.word);
-        this.level++;
-        if (this.root === null) {
-          this.root = newObjects;
-        } else {
-          this.currentObject.push(newObjects);
-        }
-        this.stack.push(this.currentObject);
-        this.currentObject = newObjects;
-        this.state = NEUTRAL;
-        return;
-      }
-      if (endThings.test(char)) {
-        this.afterItem(char);
-        return;
-      }
-      throw new Error('havn\'t handled "' +char + '" in keyword yet, index ' + this.place);
-    };
-    Parser.prototype.neutral = function(char) {
-      if (latin.test(char)) {
-        this.word = char;
-        this.state = KEYWORD;
-        return;
-      }
-      if (char === '"') {
-        this.word = '';
-        this.state = QUOTED;
-        return;
-      }
-      if (digets.test(char)) {
-        this.word = char;
-        this.state = NUMBER;
-        return;
-      }
-      if (endThings.test(char)) {
-        this.afterItem(char);
-        return;
-      }
-      throw new Error('havn\'t handled "' +char + '" in neutral yet, index ' + this.place);
-    };
-    Parser.prototype.output = function() {
-      while (this.place < this.text.length) {
-        this.readCharicter();
-      }
-      if (this.state === ENDED) {
-        return this.root;
-      }
-      throw new Error('unable to parse string "' +this.text + '". State is ' + this.state);
-    };
-
-    function parseString(txt) {
-      var parser = new Parser(txt);
-      return parser.output();
-    }
-
-    function mapit(obj, key, value) {
-      if (Array.isArray(key)) {
-        value.unshift(key);
-        key = null;
-      }
-      var thing = key ? {} : obj;
-
-      var out = value.reduce(function(newObj, item) {
-        sExpr(item, newObj);
-        return newObj
-      }, thing);
-      if (key) {
-        obj[key] = out;
-      }
-    }
-
-    function sExpr(v, obj) {
-      if (!Array.isArray(v)) {
-        obj[v] = true;
-        return;
-      }
-      var key = v.shift();
-      if (key === 'PARAMETER') {
-        key = v.shift();
-      }
-      if (v.length === 1) {
-        if (Array.isArray(v[0])) {
-          obj[key] = {};
-          sExpr(v[0], obj[key]);
-          return;
-        }
-        obj[key] = v[0];
-        return;
-      }
-      if (!v.length) {
-        obj[key] = true;
-        return;
-      }
-      if (key === 'TOWGS84') {
-        obj[key] = v;
-        return;
-      }
-      if (key === 'AXIS') {
-        if (!(key in obj)) {
-          obj[key] = [];
-        }
-        obj[key].push(v);
-        return;
-      }
-      if (!Array.isArray(key)) {
-        obj[key] = {};
-      }
-
-      var i;
-      switch (key) {
-        case 'UNIT':
-        case 'PRIMEM':
-        case 'VERT_DATUM':
-          obj[key] = {
-            name: v[0].toLowerCase(),
-            convert: v[1]
-          };
-          if (v.length === 3) {
-            sExpr(v[2], obj[key]);
-          }
-          return;
-        case 'SPHEROID':
-        case 'ELLIPSOID':
-          obj[key] = {
-            name: v[0],
-            a: v[1],
-            rf: v[2]
-          };
-          if (v.length === 4) {
-            sExpr(v[3], obj[key]);
-          }
-          return;
-        case 'PROJECTEDCRS':
-        case 'PROJCRS':
-        case 'GEOGCS':
-        case 'GEOCCS':
-        case 'PROJCS':
-        case 'LOCAL_CS':
-        case 'GEODCRS':
-        case 'GEODETICCRS':
-        case 'GEODETICDATUM':
-        case 'EDATUM':
-        case 'ENGINEERINGDATUM':
-        case 'VERT_CS':
-        case 'VERTCRS':
-        case 'VERTICALCRS':
-        case 'COMPD_CS':
-        case 'COMPOUNDCRS':
-        case 'ENGINEERINGCRS':
-        case 'ENGCRS':
-        case 'FITTED_CS':
-        case 'LOCAL_DATUM':
-        case 'DATUM':
-          v[0] = ['name', v[0]];
-          mapit(obj, key, v);
-          return;
-        default:
-          i = -1;
-          while (++i < v.length) {
-            if (!Array.isArray(v[i])) {
-              return sExpr(v, obj[key]);
-            }
-          }
-          return mapit(obj, key, v);
-      }
-    }
-
-    var D2R$1 = 0.01745329251994329577;
-    function rename(obj, params) {
-      var outName = params[0];
-      var inName = params[1];
-      if (!(outName in obj) && (inName in obj)) {
-        obj[outName] = obj[inName];
-        if (params.length === 3) {
-          obj[outName] = params[2](obj[outName]);
-        }
-      }
-    }
-
-    function d2r(input) {
-      return input * D2R$1;
-    }
-
-    function cleanWKT(wkt) {
-      if (wkt.type === 'GEOGCS') {
-        wkt.projName = 'longlat';
-      } else if (wkt.type === 'LOCAL_CS') {
-        wkt.projName = 'identity';
-        wkt.local = true;
-      } else {
-        if (typeof wkt.PROJECTION === 'object') {
-          wkt.projName = Object.keys(wkt.PROJECTION)[0];
-        } else {
-          wkt.projName = wkt.PROJECTION;
-        }
-      }
-      if (wkt.AXIS) {
-        var axisOrder = '';
-        for (var i = 0, ii = wkt.AXIS.length; i < ii; ++i) {
-          var axis = wkt.AXIS[i];
-          var descriptor = axis[0].toLowerCase();
-          if (descriptor.indexOf('north') !== -1) {
-            axisOrder += 'n';
-          } else if (descriptor.indexOf('south') !== -1) {
-            axisOrder += 's';
-          } else if (descriptor.indexOf('east') !== -1) {
-            axisOrder += 'e';
-          } else if (descriptor.indexOf('west') !== -1) {
-            axisOrder += 'w';
-          }
-        }
-        if (axisOrder.length === 2) {
-          axisOrder += 'u';
-        }
-        if (axisOrder.length === 3) {
-          wkt.axis = axisOrder;
-        }
-      }
-      if (wkt.UNIT) {
-        wkt.units = wkt.UNIT.name.toLowerCase();
-        if (wkt.units === 'metre') {
-          wkt.units = 'meter';
-        }
-        if (wkt.UNIT.convert) {
-          if (wkt.type === 'GEOGCS') {
-            if (wkt.DATUM && wkt.DATUM.SPHEROID) {
-              wkt.to_meter = wkt.UNIT.convert*wkt.DATUM.SPHEROID.a;
-            }
-          } else {
-            wkt.to_meter = wkt.UNIT.convert;
-          }
-        }
-      }
-      var geogcs = wkt.GEOGCS;
-      if (wkt.type === 'GEOGCS') {
-        geogcs = wkt;
-      }
-      if (geogcs) {
-        //if(wkt.GEOGCS.PRIMEM&&wkt.GEOGCS.PRIMEM.convert){
-        //  wkt.from_greenwich=wkt.GEOGCS.PRIMEM.convert*D2R;
-        //}
-        if (geogcs.DATUM) {
-          wkt.datumCode = geogcs.DATUM.name.toLowerCase();
-        } else {
-          wkt.datumCode = geogcs.name.toLowerCase();
-        }
-        if (wkt.datumCode.slice(0, 2) === 'd_') {
-          wkt.datumCode = wkt.datumCode.slice(2);
-        }
-        if (wkt.datumCode === 'new_zealand_geodetic_datum_1949' || wkt.datumCode === 'new_zealand_1949') {
-          wkt.datumCode = 'nzgd49';
-        }
-        if (wkt.datumCode === 'wgs_1984' || wkt.datumCode === 'world_geodetic_system_1984') {
-          if (wkt.PROJECTION === 'Mercator_Auxiliary_Sphere') {
-            wkt.sphere = true;
-          }
-          wkt.datumCode = 'wgs84';
-        }
-        if (wkt.datumCode.slice(-6) === '_ferro') {
-          wkt.datumCode = wkt.datumCode.slice(0, - 6);
-        }
-        if (wkt.datumCode.slice(-8) === '_jakarta') {
-          wkt.datumCode = wkt.datumCode.slice(0, - 8);
-        }
-        if (~wkt.datumCode.indexOf('belge')) {
-          wkt.datumCode = 'rnb72';
-        }
-        if (geogcs.DATUM && geogcs.DATUM.SPHEROID) {
-          wkt.ellps = geogcs.DATUM.SPHEROID.name.replace('_19', '').replace(/[Cc]larke\_18/, 'clrk');
-          if (wkt.ellps.toLowerCase().slice(0, 13) === 'international') {
-            wkt.ellps = 'intl';
-          }
-
-          wkt.a = geogcs.DATUM.SPHEROID.a;
-          wkt.rf = parseFloat(geogcs.DATUM.SPHEROID.rf, 10);
-        }
-
-        if (geogcs.DATUM && geogcs.DATUM.TOWGS84) {
-          wkt.datum_params = geogcs.DATUM.TOWGS84;
-        }
-        if (~wkt.datumCode.indexOf('osgb_1936')) {
-          wkt.datumCode = 'osgb36';
-        }
-        if (~wkt.datumCode.indexOf('osni_1952')) {
-          wkt.datumCode = 'osni52';
-        }
-        if (~wkt.datumCode.indexOf('tm65')
-          || ~wkt.datumCode.indexOf('geodetic_datum_of_1965')) {
-          wkt.datumCode = 'ire65';
-        }
-        if (wkt.datumCode === 'ch1903+') {
-          wkt.datumCode = 'ch1903';
-        }
-        if (~wkt.datumCode.indexOf('israel')) {
-          wkt.datumCode = 'isr93';
-        }
-      }
-      if (wkt.b && !isFinite(wkt.b)) {
-        wkt.b = wkt.a;
-      }
-
-      function toMeter(input) {
-        var ratio = wkt.to_meter || 1;
-        return input * ratio;
-      }
-      var renamer = function(a) {
-        return rename(wkt, a);
-      };
-      var list = [
-        ['standard_parallel_1', 'Standard_Parallel_1'],
-        ['standard_parallel_2', 'Standard_Parallel_2'],
-        ['false_easting', 'False_Easting'],
-        ['false_northing', 'False_Northing'],
-        ['central_meridian', 'Central_Meridian'],
-        ['latitude_of_origin', 'Latitude_Of_Origin'],
-        ['latitude_of_origin', 'Central_Parallel'],
-        ['scale_factor', 'Scale_Factor'],
-        ['k0', 'scale_factor'],
-        ['latitude_of_center', 'Latitude_Of_Center'],
-        ['latitude_of_center', 'Latitude_of_center'],
-        ['lat0', 'latitude_of_center', d2r],
-        ['longitude_of_center', 'Longitude_Of_Center'],
-        ['longitude_of_center', 'Longitude_of_center'],
-        ['longc', 'longitude_of_center', d2r],
-        ['x0', 'false_easting', toMeter],
-        ['y0', 'false_northing', toMeter],
-        ['long0', 'central_meridian', d2r],
-        ['lat0', 'latitude_of_origin', d2r],
-        ['lat0', 'standard_parallel_1', d2r],
-        ['lat1', 'standard_parallel_1', d2r],
-        ['lat2', 'standard_parallel_2', d2r],
-        ['azimuth', 'Azimuth'],
-        ['alpha', 'azimuth', d2r],
-        ['srsCode', 'name']
-      ];
-      list.forEach(renamer);
-      if (!wkt.long0 && wkt.longc && (wkt.projName === 'Albers_Conic_Equal_Area' || wkt.projName === 'Lambert_Azimuthal_Equal_Area')) {
-        wkt.long0 = wkt.longc;
-      }
-      if (!wkt.lat_ts && wkt.lat1 && (wkt.projName === 'Stereographic_South_Pole' || wkt.projName === 'Polar Stereographic (variant B)')) {
-        wkt.lat0 = d2r(wkt.lat1 > 0 ? 90 : -90);
-        wkt.lat_ts = wkt.lat1;
-      }
-    }
-    var wkt = function(wkt) {
-      var lisp = parseString(wkt);
-      var type = lisp.shift();
-      var name = lisp.shift();
-      lisp.unshift(['name', name]);
-      lisp.unshift(['type', type]);
-      var obj = {};
-      sExpr(lisp, obj);
-      cleanWKT(obj);
-      return obj;
-    };
-
-    function defs(name) {
-      /*global console*/
-      var that = this;
-      if (arguments.length === 2) {
-        var def = arguments[1];
-        if (typeof def === 'string') {
-          if (def.charAt(0) === '+') {
-            defs[name] = parseProj(arguments[1]);
-          }
-          else {
-            defs[name] = wkt(arguments[1]);
-          }
-        } else {
-          defs[name] = def;
-        }
-      }
-      else if (arguments.length === 1) {
-        if (Array.isArray(name)) {
-          return name.map(function(v) {
-            if (Array.isArray(v)) {
-              defs.apply(that, v);
-            }
-            else {
-              defs(v);
-            }
-          });
-        }
-        else if (typeof name === 'string') {
-          if (name in defs) {
-            return defs[name];
-          }
-        }
-        else if ('EPSG' in name) {
-          defs['EPSG:' + name.EPSG] = name;
-        }
-        else if ('ESRI' in name) {
-          defs['ESRI:' + name.ESRI] = name;
-        }
-        else if ('IAU2000' in name) {
-          defs['IAU2000:' + name.IAU2000] = name;
-        }
-        else {
-          console.log(name);
-        }
-        return;
-      }
-
-
-    }
-    globals(defs);
-
-    function testObj(code){
-      return typeof code === 'string';
-    }
-    function testDef(code){
-      return code in defs;
-    }
-     var codeWords = ['PROJECTEDCRS', 'PROJCRS', 'GEOGCS','GEOCCS','PROJCS','LOCAL_CS', 'GEODCRS', 'GEODETICCRS', 'GEODETICDATUM', 'ENGCRS', 'ENGINEERINGCRS'];
-    function testWKT(code){
-      return codeWords.some(function (word) {
-        return code.indexOf(word) > -1;
-      });
-    }
-    var codes = ['3857', '900913', '3785', '102113'];
-    function checkMercator(item) {
-      var auth = match(item, 'authority');
-      if (!auth) {
-        return;
-      }
-      var code = match(auth, 'epsg');
-      return code && codes.indexOf(code) > -1;
-    }
-    function checkProjStr(item) {
-      var ext = match(item, 'extension');
-      if (!ext) {
-        return;
-      }
-      return match(ext, 'proj4');
-    }
-    function testProj(code){
-      return code[0] === '+';
-    }
-    function parse(code){
-      if (testObj(code)) {
-        //check to see if this is a WKT string
-        if (testDef(code)) {
-          return defs[code];
-        }
-        if (testWKT(code)) {
-          var out = wkt(code);
-          // test of spetial case, due to this being a very common and often malformed
-          if (checkMercator(out)) {
-            return defs['EPSG:3857'];
-          }
-          var maybeProjStr = checkProjStr(out);
-          if (maybeProjStr) {
-            return parseProj(maybeProjStr);
-          }
-          return out;
-        }
-        if (testProj(code)) {
-          return parseProj(code);
-        }
-      }else{
-        return code;
-      }
-    }
-
-    var extend = function(destination, source) {
-      destination = destination || {};
-      var value, property;
-      if (!source) {
-        return destination;
-      }
-      for (property in source) {
-        value = source[property];
-        if (value !== undefined) {
-          destination[property] = value;
-        }
-      }
-      return destination;
-    };
-
-    var msfnz = function(eccent, sinphi, cosphi) {
-      var con = eccent * sinphi;
-      return cosphi / (Math.sqrt(1 - con * con));
-    };
-
-    var sign = function(x) {
-      return x<0 ? -1 : 1;
-    };
-
-    var adjust_lon = function(x) {
-      return (Math.abs(x) <= SPI) ? x : (x - (sign(x) * TWO_PI));
-    };
-
-    var tsfnz = function(eccent, phi, sinphi) {
-      var con = eccent * sinphi;
-      var com = 0.5 * eccent;
-      con = Math.pow(((1 - con) / (1 + con)), com);
-      return (Math.tan(0.5 * (HALF_PI - phi)) / con);
-    };
-
-    var phi2z = function(eccent, ts) {
-      var eccnth = 0.5 * eccent;
-      var con, dphi;
-      var phi = HALF_PI - 2 * Math.atan(ts);
-      for (var i = 0; i <= 15; i++) {
-        con = eccent * Math.sin(phi);
-        dphi = HALF_PI - 2 * Math.atan(ts * (Math.pow(((1 - con) / (1 + con)), eccnth))) - phi;
-        phi += dphi;
-        if (Math.abs(dphi) <= 0.0000000001) {
-          return phi;
-        }
-      }
-      //console.log("phi2z has NoConvergence");
-      return -9999;
-    };
-
-    function init() {
-      var con = this.b / this.a;
-      this.es = 1 - con * con;
-      if(!('x0' in this)){
-        this.x0 = 0;
-      }
-      if(!('y0' in this)){
-        this.y0 = 0;
-      }
-      this.e = Math.sqrt(this.es);
-      if (this.lat_ts) {
-        if (this.sphere) {
-          this.k0 = Math.cos(this.lat_ts);
-        }
-        else {
-          this.k0 = msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts));
-        }
-      }
-      else {
-        if (!this.k0) {
-          if (this.k) {
-            this.k0 = this.k;
-          }
-          else {
-            this.k0 = 1;
-          }
-        }
-      }
-    }
-
-    /* Mercator forward equations--mapping lat,long to x,y
-      --------------------------------------------------*/
-
-    function forward(p) {
-      var lon = p.x;
-      var lat = p.y;
-      // convert to radians
-      if (lat * R2D > 90 && lat * R2D < -90 && lon * R2D > 180 && lon * R2D < -180) {
-        return null;
-      }
-
-      var x, y;
-      if (Math.abs(Math.abs(lat) - HALF_PI) <= EPSLN) {
-        return null;
-      }
-      else {
-        if (this.sphere) {
-          x = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0);
-          y = this.y0 + this.a * this.k0 * Math.log(Math.tan(FORTPI + 0.5 * lat));
-        }
-        else {
-          var sinphi = Math.sin(lat);
-          var ts = tsfnz(this.e, lat, sinphi);
-          x = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0);
-          y = this.y0 - this.a * this.k0 * Math.log(ts);
-        }
-        p.x = x;
-        p.y = y;
-        return p;
-      }
-    }
-
-    /* Mercator inverse equations--mapping x,y to lat/long
-      --------------------------------------------------*/
-    function inverse(p) {
-
-      var x = p.x - this.x0;
-      var y = p.y - this.y0;
-      var lon, lat;
-
-      if (this.sphere) {
-        lat = HALF_PI - 2 * Math.atan(Math.exp(-y / (this.a * this.k0)));
-      }
-      else {
-        var ts = Math.exp(-y / (this.a * this.k0));
-        lat = phi2z(this.e, ts);
-        if (lat === -9999) {
-          return null;
-        }
-      }
-      lon = adjust_lon(this.long0 + x / (this.a * this.k0));
-
-      p.x = lon;
-      p.y = lat;
-      return p;
-    }
-
-    var names$1 = ["Mercator", "Popular Visualisation Pseudo Mercator", "Mercator_1SP", "Mercator_Auxiliary_Sphere", "merc"];
-    var merc = {
-      init: init,
-      forward: forward,
-      inverse: inverse,
-      names: names$1
-    };
-
-    function init$1() {
-      //no-op for longlat
-    }
-
-    function identity(pt) {
-      return pt;
-    }
-    var names$2 = ["longlat", "identity"];
-    var longlat = {
-      init: init$1,
-      forward: identity,
-      inverse: identity,
-      names: names$2
-    };
-
-    var projs = [merc, longlat];
-    var names = {};
-    var projStore = [];
-
-    function add(proj, i) {
-      var len = projStore.length;
-      if (!proj.names) {
-        console.log(i);
-        return true;
-      }
-      projStore[len] = proj;
-      proj.names.forEach(function(n) {
-        names[n.toLowerCase()] = len;
-      });
-      return this;
-    }
-
-    function get(name) {
-      if (!name) {
-        return false;
-      }
-      var n = name.toLowerCase();
-      if (typeof names[n] !== 'undefined' && projStore[names[n]]) {
-        return projStore[names[n]];
-      }
-    }
-
-    function start() {
-      projs.forEach(add);
-    }
-    var projections = {
-      start: start,
-      add: add,
-      get: get
-    };
-
-    var exports$2 = {};
-    exports$2.MERIT = {
-      a: 6378137.0,
-      rf: 298.257,
-      ellipseName: "MERIT 1983"
-    };
-
-    exports$2.SGS85 = {
-      a: 6378136.0,
-      rf: 298.257,
-      ellipseName: "Soviet Geodetic System 85"
-    };
-
-    exports$2.GRS80 = {
-      a: 6378137.0,
-      rf: 298.257222101,
-      ellipseName: "GRS 1980(IUGG, 1980)"
-    };
-
-    exports$2.IAU76 = {
-      a: 6378140.0,
-      rf: 298.257,
-      ellipseName: "IAU 1976"
-    };
-
-    exports$2.airy = {
-      a: 6377563.396,
-      b: 6356256.910,
-      ellipseName: "Airy 1830"
-    };
-
-    exports$2.APL4 = {
-      a: 6378137,
-      rf: 298.25,
-      ellipseName: "Appl. Physics. 1965"
-    };
-
-    exports$2.NWL9D = {
-      a: 6378145.0,
-      rf: 298.25,
-      ellipseName: "Naval Weapons Lab., 1965"
-    };
-
-    exports$2.mod_airy = {
-      a: 6377340.189,
-      b: 6356034.446,
-      ellipseName: "Modified Airy"
-    };
-
-    exports$2.andrae = {
-      a: 6377104.43,
-      rf: 300.0,
-      ellipseName: "Andrae 1876 (Den., Iclnd.)"
-    };
-
-    exports$2.aust_SA = {
-      a: 6378160.0,
-      rf: 298.25,
-      ellipseName: "Australian Natl & S. Amer. 1969"
-    };
-
-    exports$2.GRS67 = {
-      a: 6378160.0,
-      rf: 298.2471674270,
-      ellipseName: "GRS 67(IUGG 1967)"
-    };
-
-    exports$2.bessel = {
-      a: 6377397.155,
-      rf: 299.1528128,
-      ellipseName: "Bessel 1841"
-    };
-
-    exports$2.bess_nam = {
-      a: 6377483.865,
-      rf: 299.1528128,
-      ellipseName: "Bessel 1841 (Namibia)"
-    };
-
-    exports$2.clrk66 = {
-      a: 6378206.4,
-      b: 6356583.8,
-      ellipseName: "Clarke 1866"
-    };
-
-    exports$2.clrk80 = {
-      a: 6378249.145,
-      rf: 293.4663,
-      ellipseName: "Clarke 1880 mod."
-    };
-
-    exports$2.clrk58 = {
-      a: 6378293.645208759,
-      rf: 294.2606763692654,
-      ellipseName: "Clarke 1858"
-    };
-
-    exports$2.CPM = {
-      a: 6375738.7,
-      rf: 334.29,
-      ellipseName: "Comm. des Poids et Mesures 1799"
-    };
-
-    exports$2.delmbr = {
-      a: 6376428.0,
-      rf: 311.5,
-      ellipseName: "Delambre 1810 (Belgium)"
-    };
-
-    exports$2.engelis = {
-      a: 6378136.05,
-      rf: 298.2566,
-      ellipseName: "Engelis 1985"
-    };
-
-    exports$2.evrst30 = {
-      a: 6377276.345,
-      rf: 300.8017,
-      ellipseName: "Everest 1830"
-    };
-
-    exports$2.evrst48 = {
-      a: 6377304.063,
-      rf: 300.8017,
-      ellipseName: "Everest 1948"
-    };
-
-    exports$2.evrst56 = {
-      a: 6377301.243,
-      rf: 300.8017,
-      ellipseName: "Everest 1956"
-    };
-
-    exports$2.evrst69 = {
-      a: 6377295.664,
-      rf: 300.8017,
-      ellipseName: "Everest 1969"
-    };
-
-    exports$2.evrstSS = {
-      a: 6377298.556,
-      rf: 300.8017,
-      ellipseName: "Everest (Sabah & Sarawak)"
-    };
-
-    exports$2.fschr60 = {
-      a: 6378166.0,
-      rf: 298.3,
-      ellipseName: "Fischer (Mercury Datum) 1960"
-    };
-
-    exports$2.fschr60m = {
-      a: 6378155.0,
-      rf: 298.3,
-      ellipseName: "Fischer 1960"
-    };
-
-    exports$2.fschr68 = {
-      a: 6378150.0,
-      rf: 298.3,
-      ellipseName: "Fischer 1968"
-    };
-
-    exports$2.helmert = {
-      a: 6378200.0,
-      rf: 298.3,
-      ellipseName: "Helmert 1906"
-    };
-
-    exports$2.hough = {
-      a: 6378270.0,
-      rf: 297.0,
-      ellipseName: "Hough"
-    };
-
-    exports$2.intl = {
-      a: 6378388.0,
-      rf: 297.0,
-      ellipseName: "International 1909 (Hayford)"
-    };
-
-    exports$2.kaula = {
-      a: 6378163.0,
-      rf: 298.24,
-      ellipseName: "Kaula 1961"
-    };
-
-    exports$2.lerch = {
-      a: 6378139.0,
-      rf: 298.257,
-      ellipseName: "Lerch 1979"
-    };
-
-    exports$2.mprts = {
-      a: 6397300.0,
-      rf: 191.0,
-      ellipseName: "Maupertius 1738"
-    };
-
-    exports$2.new_intl = {
-      a: 6378157.5,
-      b: 6356772.2,
-      ellipseName: "New International 1967"
-    };
-
-    exports$2.plessis = {
-      a: 6376523.0,
-      rf: 6355863.0,
-      ellipseName: "Plessis 1817 (France)"
-    };
-
-    exports$2.krass = {
-      a: 6378245.0,
-      rf: 298.3,
-      ellipseName: "Krassovsky, 1942"
-    };
-
-    exports$2.SEasia = {
-      a: 6378155.0,
-      b: 6356773.3205,
-      ellipseName: "Southeast Asia"
-    };
-
-    exports$2.walbeck = {
-      a: 6376896.0,
-      b: 6355834.8467,
-      ellipseName: "Walbeck"
-    };
-
-    exports$2.WGS60 = {
-      a: 6378165.0,
-      rf: 298.3,
-      ellipseName: "WGS 60"
-    };
-
-    exports$2.WGS66 = {
-      a: 6378145.0,
-      rf: 298.25,
-      ellipseName: "WGS 66"
-    };
-
-    exports$2.WGS7 = {
-      a: 6378135.0,
-      rf: 298.26,
-      ellipseName: "WGS 72"
-    };
-
-    var WGS84 = exports$2.WGS84 = {
-      a: 6378137.0,
-      rf: 298.257223563,
-      ellipseName: "WGS 84"
-    };
-
-    exports$2.sphere = {
-      a: 6370997.0,
-      b: 6370997.0,
-      ellipseName: "Normal Sphere (r=6370997)"
-    };
-
-    function eccentricity(a, b, rf, R_A) {
-      var a2 = a * a; // used in geocentric
-      var b2 = b * b; // used in geocentric
-      var es = (a2 - b2) / a2; // e ^ 2
-      var e = 0;
-      if (R_A) {
-        a *= 1 - es * (SIXTH + es * (RA4 + es * RA6));
-        a2 = a * a;
-        es = 0;
-      } else {
-        e = Math.sqrt(es); // eccentricity
-      }
-      var ep2 = (a2 - b2) / b2; // used in geocentric
-      return {
-        es: es,
-        e: e,
-        ep2: ep2
-      };
-    }
-    function sphere(a, b, rf, ellps, sphere) {
-      if (!a) { // do we have an ellipsoid?
-        var ellipse = match(exports$2, ellps);
-        if (!ellipse) {
-          ellipse = WGS84;
-        }
-        a = ellipse.a;
-        b = ellipse.b;
-        rf = ellipse.rf;
-      }
-
-      if (rf && !b) {
-        b = (1.0 - 1.0 / rf) * a;
-      }
-      if (rf === 0 || Math.abs(a - b) < EPSLN) {
-        sphere = true;
-        b = a;
-      }
-      return {
-        a: a,
-        b: b,
-        rf: rf,
-        sphere: sphere
-      };
-    }
-
-    var exports$3 = {};
-    exports$3.wgs84 = {
-      towgs84: "0,0,0",
-      ellipse: "WGS84",
-      datumName: "WGS84"
-    };
-
-    exports$3.ch1903 = {
-      towgs84: "674.374,15.056,405.346",
-      ellipse: "bessel",
-      datumName: "swiss"
-    };
-
-    exports$3.ggrs87 = {
-      towgs84: "-199.87,74.79,246.62",
-      ellipse: "GRS80",
-      datumName: "Greek_Geodetic_Reference_System_1987"
-    };
-
-    exports$3.nad83 = {
-      towgs84: "0,0,0",
-      ellipse: "GRS80",
-      datumName: "North_American_Datum_1983"
-    };
-
-    exports$3.nad27 = {
-      nadgrids: "@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",
-      ellipse: "clrk66",
-      datumName: "North_American_Datum_1927"
-    };
-
-    exports$3.potsdam = {
-      towgs84: "606.0,23.0,413.0",
-      ellipse: "bessel",
-      datumName: "Potsdam Rauenberg 1950 DHDN"
-    };
-
-    exports$3.carthage = {
-      towgs84: "-263.0,6.0,431.0",
-      ellipse: "clark80",
-      datumName: "Carthage 1934 Tunisia"
-    };
-
-    exports$3.hermannskogel = {
-      towgs84: "653.0,-212.0,449.0",
-      ellipse: "bessel",
-      datumName: "Hermannskogel"
-    };
-
-    exports$3.osni52 = {
-      towgs84: "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",
-      ellipse: "airy",
-      datumName: "Irish National"
-    };
-
-    exports$3.ire65 = {
-      towgs84: "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",
-      ellipse: "mod_airy",
-      datumName: "Ireland 1965"
-    };
-
-    exports$3.rassadiran = {
-      towgs84: "-133.63,-157.5,-158.62",
-      ellipse: "intl",
-      datumName: "Rassadiran"
-    };
-
-    exports$3.nzgd49 = {
-      towgs84: "59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",
-      ellipse: "intl",
-      datumName: "New Zealand Geodetic Datum 1949"
-    };
-
-    exports$3.osgb36 = {
-      towgs84: "446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",
-      ellipse: "airy",
-      datumName: "Airy 1830"
-    };
-
-    exports$3.s_jtsk = {
-      towgs84: "589,76,480",
-      ellipse: 'bessel',
-      datumName: 'S-JTSK (Ferro)'
-    };
-
-    exports$3.beduaram = {
-      towgs84: '-106,-87,188',
-      ellipse: 'clrk80',
-      datumName: 'Beduaram'
-    };
-
-    exports$3.gunung_segara = {
-      towgs84: '-403,684,41',
-      ellipse: 'bessel',
-      datumName: 'Gunung Segara Jakarta'
-    };
-
-    exports$3.rnb72 = {
-      towgs84: "106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",
-      ellipse: "intl",
-      datumName: "Reseau National Belge 1972"
-    };
-
-    function datum(datumCode, datum_params, a, b, es, ep2) {
-      var out = {};
-
-      if (datumCode === undefined || datumCode === 'none') {
-        out.datum_type = PJD_NODATUM;
-      } else {
-        out.datum_type = PJD_WGS84;
-      }
-
-      if (datum_params) {
-        out.datum_params = datum_params.map(parseFloat);
-        if (out.datum_params[0] !== 0 || out.datum_params[1] !== 0 || out.datum_params[2] !== 0) {
-          out.datum_type = PJD_3PARAM;
-        }
-        if (out.datum_params.length > 3) {
-          if (out.datum_params[3] !== 0 || out.datum_params[4] !== 0 || out.datum_params[5] !== 0 || out.datum_params[6] !== 0) {
-            out.datum_type = PJD_7PARAM;
-            out.datum_params[3] *= SEC_TO_RAD;
-            out.datum_params[4] *= SEC_TO_RAD;
-            out.datum_params[5] *= SEC_TO_RAD;
-            out.datum_params[6] = (out.datum_params[6] / 1000000.0) + 1.0;
-          }
-        }
-      }
-
-      out.a = a; //datum object also uses these values
-      out.b = b;
-      out.es = es;
-      out.ep2 = ep2;
-      return out;
-    }
-
-    function Projection(srsCode,callback) {
-      if (!(this instanceof Projection)) {
-        return new Projection(srsCode);
-      }
-      callback = callback || function(error){
-        if(error){
-          throw error;
-        }
-      };
-      var json = parse(srsCode);
-      if(typeof json !== 'object'){
-        callback(srsCode);
-        return;
-      }
-      var ourProj = Projection.projections.get(json.projName);
-      if(!ourProj){
-        callback(srsCode);
-        return;
-      }
-      if (json.datumCode && json.datumCode !== 'none') {
-        var datumDef = match(exports$3, json.datumCode);
-        if (datumDef) {
-          json.datum_params = datumDef.towgs84 ? datumDef.towgs84.split(',') : null;
-          json.ellps = datumDef.ellipse;
-          json.datumName = datumDef.datumName ? datumDef.datumName : json.datumCode;
-        }
-      }
-      json.k0 = json.k0 || 1.0;
-      json.axis = json.axis || 'enu';
-      json.ellps = json.ellps || 'wgs84';
-      var sphere_ = sphere(json.a, json.b, json.rf, json.ellps, json.sphere);
-      var ecc = eccentricity(sphere_.a, sphere_.b, sphere_.rf, json.R_A);
-      var datumObj = json.datum || datum(json.datumCode, json.datum_params, sphere_.a, sphere_.b, ecc.es, ecc.ep2);
-
-      extend(this, json); // transfer everything over from the projection because we don't know what we'll need
-      extend(this, ourProj); // transfer all the methods from the projection
-
-      // copy the 4 things over we calulated in deriveConstants.sphere
-      this.a = sphere_.a;
-      this.b = sphere_.b;
-      this.rf = sphere_.rf;
-      this.sphere = sphere_.sphere;
-
-      // copy the 3 things we calculated in deriveConstants.eccentricity
-      this.es = ecc.es;
-      this.e = ecc.e;
-      this.ep2 = ecc.ep2;
-
-      // add in the datum object
-      this.datum = datumObj;
-
-      // init the projection
-      this.init();
-
-      // legecy callback from back in the day when it went to spatialreference.org
-      callback(null, this);
-
-    }
-    Projection.projections = projections;
-    Projection.projections.start();
-
-    'use strict';
-    function compareDatums(source, dest) {
-      if (source.datum_type !== dest.datum_type) {
-        return false; // false, datums are not equal
-      } else if (source.a !== dest.a || Math.abs(source.es - dest.es) > 0.000000000050) {
-        // the tolerance for es is to ensure that GRS80 and WGS84
-        // are considered identical
-        return false;
-      } else if (source.datum_type === PJD_3PARAM) {
-        return (source.datum_params[0] === dest.datum_params[0] && source.datum_params[1] === dest.datum_params[1] && source.datum_params[2] === dest.datum_params[2]);
-      } else if (source.datum_type === PJD_7PARAM) {
-        return (source.datum_params[0] === dest.datum_params[0] && source.datum_params[1] === dest.datum_params[1] && source.datum_params[2] === dest.datum_params[2] && source.datum_params[3] === dest.datum_params[3] && source.datum_params[4] === dest.datum_params[4] && source.datum_params[5] === dest.datum_params[5] && source.datum_params[6] === dest.datum_params[6]);
-      } else {
-        return true; // datums are equal
-      }
-    } // cs_compare_datums()
-
-    /*
-     * The function Convert_Geodetic_To_Geocentric converts geodetic coordinates
-     * (latitude, longitude, and height) to geocentric coordinates (X, Y, Z),
-     * according to the current ellipsoid parameters.
-     *
-     *    Latitude  : Geodetic latitude in radians                     (input)
-     *    Longitude : Geodetic longitude in radians                    (input)
-     *    Height    : Geodetic height, in meters                       (input)
-     *    X         : Calculated Geocentric X coordinate, in meters    (output)
-     *    Y         : Calculated Geocentric Y coordinate, in meters    (output)
-     *    Z         : Calculated Geocentric Z coordinate, in meters    (output)
-     *
-     */
-    function geodeticToGeocentric(p, es, a) {
-      var Longitude = p.x;
-      var Latitude = p.y;
-      var Height = p.z ? p.z : 0; //Z value not always supplied
-
-      var Rn; /*  Earth radius at location  */
-      var Sin_Lat; /*  Math.sin(Latitude)  */
-      var Sin2_Lat; /*  Square of Math.sin(Latitude)  */
-      var Cos_Lat; /*  Math.cos(Latitude)  */
-
-      /*
-       ** Don't blow up if Latitude is just a little out of the value
-       ** range as it may just be a rounding issue.  Also removed longitude
-       ** test, it should be wrapped by Math.cos() and Math.sin().  NFW for PROJ.4, Sep/2001.
-       */
-      if (Latitude < -HALF_PI && Latitude > -1.001 * HALF_PI) {
-        Latitude = -HALF_PI;
-      } else if (Latitude > HALF_PI && Latitude < 1.001 * HALF_PI) {
-        Latitude = HALF_PI;
-      } else if (Latitude < -HALF_PI) {
-        /* Latitude out of range */
-        //..reportError('geocent:lat out of range:' + Latitude);
-        return { x: -Infinity, y: -Infinity, z: p.z };
-      } else if (Latitude > HALF_PI) {
-        /* Latitude out of range */
-        return { x: Infinity, y: Infinity, z: p.z };
-      }
-
-      if (Longitude > Math.PI) {
-        Longitude -= (2 * Math.PI);
-      }
-      Sin_Lat = Math.sin(Latitude);
-      Cos_Lat = Math.cos(Latitude);
-      Sin2_Lat = Sin_Lat * Sin_Lat;
-      Rn = a / (Math.sqrt(1.0e0 - es * Sin2_Lat));
-      return {
-        x: (Rn + Height) * Cos_Lat * Math.cos(Longitude),
-        y: (Rn + Height) * Cos_Lat * Math.sin(Longitude),
-        z: ((Rn * (1 - es)) + Height) * Sin_Lat
-      };
-    } // cs_geodetic_to_geocentric()
-
-    function geocentricToGeodetic(p, es, a, b) {
-      /* local defintions and variables */
-      /* end-criterium of loop, accuracy of sin(Latitude) */
-      var genau = 1e-12;
-      var genau2 = (genau * genau);
-      var maxiter = 30;
-
-      var P; /* distance between semi-minor axis and location */
-      var RR; /* distance between center and location */
-      var CT; /* sin of geocentric latitude */
-      var ST; /* cos of geocentric latitude */
-      var RX;
-      var RK;
-      var RN; /* Earth radius at location */
-      var CPHI0; /* cos of start or old geodetic latitude in iterations */
-      var SPHI0; /* sin of start or old geodetic latitude in iterations */
-      var CPHI; /* cos of searched geodetic latitude */
-      var SPHI; /* sin of searched geodetic latitude */
-      var SDPHI; /* end-criterium: addition-theorem of sin(Latitude(iter)-Latitude(iter-1)) */
-      var iter; /* # of continous iteration, max. 30 is always enough (s.a.) */
-
-      var X = p.x;
-      var Y = p.y;
-      var Z = p.z ? p.z : 0.0; //Z value not always supplied
-      var Longitude;
-      var Latitude;
-      var Height;
-
-      P = Math.sqrt(X * X + Y * Y);
-      RR = Math.sqrt(X * X + Y * Y + Z * Z);
-
-      /*      special cases for latitude and longitude */
-      if (P / a < genau) {
-
-        /*  special case, if P=0. (X=0., Y=0.) */
-        Longitude = 0.0;
-
-        /*  if (X,Y,Z)=(0.,0.,0.) then Height becomes semi-minor axis
-         *  of ellipsoid (=center of mass), Latitude becomes PI/2 */
-        if (RR / a < genau) {
-          Latitude = HALF_PI;
-          Height = -b;
-          return {
-            x: p.x,
-            y: p.y,
-            z: p.z
-          };
-        }
-      } else {
-        /*  ellipsoidal (geodetic) longitude
-         *  interval: -PI < Longitude <= +PI */
-        Longitude = Math.atan2(Y, X);
-      }
-
-      /* --------------------------------------------------------------
-       * Following iterative algorithm was developped by
-       * "Institut for Erdmessung", University of Hannover, July 1988.
-       * Internet: www.ife.uni-hannover.de
-       * Iterative computation of CPHI,SPHI and Height.
-       * Iteration of CPHI and SPHI to 10**-12 radian resp.
-       * 2*10**-7 arcsec.
-       * --------------------------------------------------------------
-       */
-      CT = Z / RR;
-      ST = P / RR;
-      RX = 1.0 / Math.sqrt(1.0 - es * (2.0 - es) * ST * ST);
-      CPHI0 = ST * (1.0 - es) * RX;
-      SPHI0 = CT * RX;
-      iter = 0;
-
-      /* loop to find sin(Latitude) resp. Latitude
-       * until |sin(Latitude(iter)-Latitude(iter-1))| < genau */
-      do {
-        iter++;
-        RN = a / Math.sqrt(1.0 - es * SPHI0 * SPHI0);
-
-        /*  ellipsoidal (geodetic) height */
-        Height = P * CPHI0 + Z * SPHI0 - RN * (1.0 - es * SPHI0 * SPHI0);
-
-        RK = es * RN / (RN + Height);
-        RX = 1.0 / Math.sqrt(1.0 - RK * (2.0 - RK) * ST * ST);
-        CPHI = ST * (1.0 - RK) * RX;
-        SPHI = CT * RX;
-        SDPHI = SPHI * CPHI0 - CPHI * SPHI0;
-        CPHI0 = CPHI;
-        SPHI0 = SPHI;
-      }
-      while (SDPHI * SDPHI > genau2 && iter < maxiter);
-
-      /*      ellipsoidal (geodetic) latitude */
-      Latitude = Math.atan(SPHI / Math.abs(CPHI));
-      return {
-        x: Longitude,
-        y: Latitude,
-        z: Height
-      };
-    } // cs_geocentric_to_geodetic()
-
-    /****************************************************************/
-    // pj_geocentic_to_wgs84( p )
-    //  p = point to transform in geocentric coordinates (x,y,z)
-
-
-    /** point object, nothing fancy, just allows values to be
-        passed back and forth by reference rather than by value.
-        Other point classes may be used as long as they have
-        x and y properties, which will get modified in the transform method.
-    */
-    function geocentricToWgs84(p, datum_type, datum_params) {
-
-      if (datum_type === PJD_3PARAM) {
-        // if( x[io] === HUGE_VAL )
-        //    continue;
-        return {
-          x: p.x + datum_params[0],
-          y: p.y + datum_params[1],
-          z: p.z + datum_params[2],
-        };
-      } else if (datum_type === PJD_7PARAM) {
-        var Dx_BF = datum_params[0];
-        var Dy_BF = datum_params[1];
-        var Dz_BF = datum_params[2];
-        var Rx_BF = datum_params[3];
-        var Ry_BF = datum_params[4];
-        var Rz_BF = datum_params[5];
-        var M_BF = datum_params[6];
-        // if( x[io] === HUGE_VAL )
-        //    continue;
-        return {
-          x: M_BF * (p.x - Rz_BF * p.y + Ry_BF * p.z) + Dx_BF,
-          y: M_BF * (Rz_BF * p.x + p.y - Rx_BF * p.z) + Dy_BF,
-          z: M_BF * (-Ry_BF * p.x + Rx_BF * p.y + p.z) + Dz_BF
-        };
-      }
-    } // cs_geocentric_to_wgs84
-
-    /****************************************************************/
-    // pj_geocentic_from_wgs84()
-    //  coordinate system definition,
-    //  point to transform in geocentric coordinates (x,y,z)
-    function geocentricFromWgs84(p, datum_type, datum_params) {
-
-      if (datum_type === PJD_3PARAM) {
-        //if( x[io] === HUGE_VAL )
-        //    continue;
-        return {
-          x: p.x - datum_params[0],
-          y: p.y - datum_params[1],
-          z: p.z - datum_params[2],
-        };
-
-      } else if (datum_type === PJD_7PARAM) {
-        var Dx_BF = datum_params[0];
-        var Dy_BF = datum_params[1];
-        var Dz_BF = datum_params[2];
-        var Rx_BF = datum_params[3];
-        var Ry_BF = datum_params[4];
-        var Rz_BF = datum_params[5];
-        var M_BF = datum_params[6];
-        var x_tmp = (p.x - Dx_BF) / M_BF;
-        var y_tmp = (p.y - Dy_BF) / M_BF;
-        var z_tmp = (p.z - Dz_BF) / M_BF;
-        //if( x[io] === HUGE_VAL )
-        //    continue;
-
-        return {
-          x: x_tmp + Rz_BF * y_tmp - Ry_BF * z_tmp,
-          y: -Rz_BF * x_tmp + y_tmp + Rx_BF * z_tmp,
-          z: Ry_BF * x_tmp - Rx_BF * y_tmp + z_tmp
-        };
-      } //cs_geocentric_from_wgs84()
-    }
-
-    function checkParams(type) {
-      return (type === PJD_3PARAM || type === PJD_7PARAM);
-    }
-
-    var datum_transform = function(source, dest, point) {
-      // Short cut if the datums are identical.
-      if (compareDatums(source, dest)) {
-        return point; // in this case, zero is sucess,
-        // whereas cs_compare_datums returns 1 to indicate TRUE
-        // confusing, should fix this
-      }
-
-      // Explicitly skip datum transform by setting 'datum=none' as parameter for either source or dest
-      if (source.datum_type === PJD_NODATUM || dest.datum_type === PJD_NODATUM) {
-        return point;
-      }
-
-      // If this datum requires grid shifts, then apply it to geodetic coordinates.
-
-      // Do we need to go through geocentric coordinates?
-      if (source.es === dest.es && source.a === dest.a && !checkParams(source.datum_type) &&  !checkParams(dest.datum_type)) {
-        return point;
-      }
-
-      // Convert to geocentric coordinates.
-      point = geodeticToGeocentric(point, source.es, source.a);
-      // Convert between datums
-      if (checkParams(source.datum_type)) {
-        point = geocentricToWgs84(point, source.datum_type, source.datum_params);
-      }
-      if (checkParams(dest.datum_type)) {
-        point = geocentricFromWgs84(point, dest.datum_type, dest.datum_params);
-      }
-      return geocentricToGeodetic(point, dest.es, dest.a, dest.b);
-
-    };
-
-    var adjust_axis = function(crs, denorm, point) {
-      var xin = point.x,
-        yin = point.y,
-        zin = point.z || 0.0;
-      var v, t, i;
-      var out = {};
-      for (i = 0; i < 3; i++) {
-        if (denorm && i === 2 && point.z === undefined) {
-          continue;
-        }
-        if (i === 0) {
-          v = xin;
-          if ("ew".indexOf(crs.axis[i]) !== -1) {
-            t = 'x';
-          } else {
-            t = 'y';
-          }
-
-        }
-        else if (i === 1) {
-          v = yin;
-          if ("ns".indexOf(crs.axis[i]) !== -1) {
-            t = 'y';
-          } else {
-            t = 'x';
-          }
-        }
-        else {
-          v = zin;
-          t = 'z';
-        }
-        switch (crs.axis[i]) {
-        case 'e':
-        case 'w':
-        case 'n':
-        case 's':
-          out[t] = v;
-          break;
-        case 'u':
-          if (point[t] !== undefined) {
-            out.z = v;
-          }
-          break;
-        case 'd':
-          if (point[t] !== undefined) {
-            out.z = -v;
-          }
-          break;
-        default:
-          //console.log("ERROR: unknow axis ("+crs.axis[i]+") - check definition of "+crs.projName);
-          return null;
-        }
-      }
-      return out;
-    };
-
-    var toPoint = function (array){
-      var out = {
-        x: array[0],
-        y: array[1]
-      };
-      if (array.length>2) {
-        out.z = array[2];
-      }
-      if (array.length>3) {
-        out.m = array[3];
-      }
-      return out;
-    };
-
-    var checkSanity = function (point) {
-      checkCoord(point.x);
-      checkCoord(point.y);
-    };
-    function checkCoord(num) {
-      if (typeof Number.isFinite === 'function') {
-        if (Number.isFinite(num)) {
-          return;
-        }
-        throw new TypeError('coordinates must be finite numbers');
-      }
-      if (typeof num !== 'number' || num !== num || !isFinite(num)) {
-        throw new TypeError('coordinates must be finite numbers');
-      }
-    }
-
-    function checkNotWGS(source, dest) {
-      return ((source.datum.datum_type === PJD_3PARAM || source.datum.datum_type === PJD_7PARAM) && dest.datumCode !== 'WGS84') || ((dest.datum.datum_type === PJD_3PARAM || dest.datum.datum_type === PJD_7PARAM) && source.datumCode !== 'WGS84');
-    }
-
-    function transform(source, dest, point) {
-      var wgs84;
-      if (Array.isArray(point)) {
-        point = toPoint(point);
-      }
-      checkSanity(point);
-      // Workaround for datum shifts towgs84, if either source or destination projection is not wgs84
-      if (source.datum && dest.datum && checkNotWGS(source, dest)) {
-        wgs84 = new Projection('WGS84');
-        point = transform(source, wgs84, point);
-        source = wgs84;
-      }
-      // DGR, 2010/11/12
-      if (source.axis !== 'enu') {
-        point = adjust_axis(source, false, point);
-      }
-      // Transform source points to long/lat, if they aren't already.
-      if (source.projName === 'longlat') {
-        point = {
-          x: point.x * D2R,
-          y: point.y * D2R,
-          z: point.z || 0
-        };
-      } else {
-        if (source.to_meter) {
-          point = {
-            x: point.x * source.to_meter,
-            y: point.y * source.to_meter,
-            z: point.z || 0
-          };
-        }
-        point = source.inverse(point); // Convert Cartesian to longlat
-        if (!point) {
-          return;
-        }
-      }
-      // Adjust for the prime meridian if necessary
-      if (source.from_greenwich) {
-        point.x += source.from_greenwich;
-      }
-
-      // Convert datums if needed, and if possible.
-      point = datum_transform(source.datum, dest.datum, point);
-
-      // Adjust for the prime meridian if necessary
-      if (dest.from_greenwich) {
-        point = {
-          x: point.x - dest.from_greenwich,
-          y: point.y,
-          z: point.z || 0
-        };
-      }
-
-      if (dest.projName === 'longlat') {
-        // convert radians to decimal degrees
-        point = {
-          x: point.x * R2D,
-          y: point.y * R2D,
-          z: point.z || 0
-        };
-      } else { // else project
-        point = dest.forward(point);
-        if (dest.to_meter) {
-          point = {
-            x: point.x / dest.to_meter,
-            y: point.y / dest.to_meter,
-            z: point.z || 0
-          };
-        }
-      }
-
-      // DGR, 2010/11/12
-      if (dest.axis !== 'enu') {
-        return adjust_axis(dest, true, point);
-      }
-
-      return point;
-    }
-
-    var wgs84 = Projection('WGS84');
-
-    function transformer(from, to, coords) {
-      var transformedArray, out, keys;
-      if (Array.isArray(coords)) {
-        transformedArray = transform(from, to, coords) || {x: NaN, y: NaN};
-        if (coords.length > 2) {
-          if ((typeof from.name !== 'undefined' && from.name === 'geocent') || (typeof to.name !== 'undefined' && to.name === 'geocent')) {
-            if (typeof transformedArray.z === 'number') {
-              return [transformedArray.x, transformedArray.y, transformedArray.z].concat(coords.splice(3));
-            } else {
-              return [transformedArray.x, transformedArray.y, coords[2]].concat(coords.splice(3));
-            }
-          } else {
-            return [transformedArray.x, transformedArray.y].concat(coords.splice(2));
-          }
-        } else {
-          return [transformedArray.x, transformedArray.y];
-        }
-      } else {
-        out = transform(from, to, coords);
-        keys = Object.keys(coords);
-        if (keys.length === 2) {
-          return out;
-        }
-        keys.forEach(function (key) {
-          if ((typeof from.name !== 'undefined' && from.name === 'geocent') || (typeof to.name !== 'undefined' && to.name === 'geocent')) {
-            if (key === 'x' || key === 'y' || key === 'z') {
-              return;
-            }
-          } else {
-            if (key === 'x' || key === 'y') {
-              return;
-            }
-          }
-          out[key] = coords[key];
-        });
-        return out;
-      }
-    }
-
-    function checkProj(item) {
-      if (item instanceof Projection) {
-        return item;
-      }
-      if (item.oProj) {
-        return item.oProj;
-      }
-      return Projection(item);
-    }
-
-    function proj4$1(fromProj, toProj, coord) {
-      fromProj = checkProj(fromProj);
-      var single = false;
-      var obj;
-      if (typeof toProj === 'undefined') {
-        toProj = fromProj;
-        fromProj = wgs84;
-        single = true;
-      } else if (typeof toProj.x !== 'undefined' || Array.isArray(toProj)) {
-        coord = toProj;
-        toProj = fromProj;
-        fromProj = wgs84;
-        single = true;
-      }
-      toProj = checkProj(toProj);
-      if (coord) {
-        return transformer(fromProj, toProj, coord);
-      } else {
-        obj = {
-          forward: function (coords) {
-            return transformer(fromProj, toProj, coords);
-          },
-          inverse: function (coords) {
-            return transformer(toProj, fromProj, coords);
-          }
-        };
-        if (single) {
-          obj.oProj = toProj;
-        }
-        return obj;
-      }
-    }
-
-    /**
-     * UTM zones are grouped, and assigned to one of a group of 6
-     * sets.
-     *
-     * {int} @private
-     */
-    var NUM_100K_SETS = 6;
-
-    /**
-     * The column letters (for easting) of the lower left value, per
-     * set.
-     *
-     * {string} @private
-     */
-    var SET_ORIGIN_COLUMN_LETTERS = 'AJSAJS';
-
-    /**
-     * The row letters (for northing) of the lower left value, per
-     * set.
-     *
-     * {string} @private
-     */
-    var SET_ORIGIN_ROW_LETTERS = 'AFAFAF';
-
-    var A = 65; // A
-    var I = 73; // I
-    var O = 79; // O
-    var V = 86; // V
-    var Z = 90; // Z
-    var mgrs = {
-      forward: forward$1,
-      inverse: inverse$1,
-      toPoint: toPoint$1
-    };
-    /**
-     * Conversion of lat/lon to MGRS.
-     *
-     * @param {object} ll Object literal with lat and lon properties on a
-     *     WGS84 ellipsoid.
-     * @param {int} accuracy Accuracy in digits (5 for 1 m, 4 for 10 m, 3 for
-     *      100 m, 2 for 1000 m or 1 for 10000 m). Optional, default is 5.
-     * @return {string} the MGRS string for the given location and accuracy.
-     */
-    function forward$1(ll, accuracy) {
-      accuracy = accuracy || 5; // default accuracy 1m
-      return encode(LLtoUTM({
-        lat: ll[1],
-        lon: ll[0]
-      }), accuracy);
-    }
-
-    /**
-     * Conversion of MGRS to lat/lon.
-     *
-     * @param {string} mgrs MGRS string.
-     * @return {array} An array with left (longitude), bottom (latitude), right
-     *     (longitude) and top (latitude) values in WGS84, representing the
-     *     bounding box for the provided MGRS reference.
-     */
-    function inverse$1(mgrs) {
-      var bbox = UTMtoLL(decode(mgrs.toUpperCase()));
-      if (bbox.lat && bbox.lon) {
-        return [bbox.lon, bbox.lat, bbox.lon, bbox.lat];
-      }
-      return [bbox.left, bbox.bottom, bbox.right, bbox.top];
-    }
-
-    function toPoint$1(mgrs) {
-      var bbox = UTMtoLL(decode(mgrs.toUpperCase()));
-      if (bbox.lat && bbox.lon) {
-        return [bbox.lon, bbox.lat];
-      }
-      return [(bbox.left + bbox.right) / 2, (bbox.top + bbox.bottom) / 2];
-    }
-    /**
-     * Conversion from degrees to radians.
-     *
-     * @private
-     * @param {number} deg the angle in degrees.
-     * @return {number} the angle in radians.
-     */
-    function degToRad(deg) {
-      return (deg * (Math.PI / 180.0));
-    }
-
-    /**
-     * Conversion from radians to degrees.
-     *
-     * @private
-     * @param {number} rad the angle in radians.
-     * @return {number} the angle in degrees.
-     */
-    function radToDeg(rad) {
-      return (180.0 * (rad / Math.PI));
-    }
-
-    /**
-     * Converts a set of Longitude and Latitude co-ordinates to UTM
-     * using the WGS84 ellipsoid.
-     *
-     * @private
-     * @param {object} ll Object literal with lat and lon properties
-     *     representing the WGS84 coordinate to be converted.
-     * @return {object} Object literal containing the UTM value with easting,
-     *     northing, zoneNumber and zoneLetter properties, and an optional
-     *     accuracy property in digits. Returns null if the conversion failed.
-     */
-    function LLtoUTM(ll) {
-      var Lat = ll.lat;
-      var Long = ll.lon;
-      var a = 6378137.0; //ellip.radius;
-      var eccSquared = 0.00669438; //ellip.eccsq;
-      var k0 = 0.9996;
-      var LongOrigin;
-      var eccPrimeSquared;
-      var N, T, C, A, M;
-      var LatRad = degToRad(Lat);
-      var LongRad = degToRad(Long);
-      var LongOriginRad;
-      var ZoneNumber;
-      // (int)
-      ZoneNumber = Math.floor((Long + 180) / 6) + 1;
-
-      //Make sure the longitude 180.00 is in Zone 60
-      if (Long === 180) {
-        ZoneNumber = 60;
-      }
-
-      // Special zone for Norway
-      if (Lat >= 56.0 && Lat < 64.0 && Long >= 3.0 && Long < 12.0) {
-        ZoneNumber = 32;
-      }
-
-      // Special zones for Svalbard
-      if (Lat >= 72.0 && Lat < 84.0) {
-        if (Long >= 0.0 && Long < 9.0) {
-          ZoneNumber = 31;
-        }
-        else if (Long >= 9.0 && Long < 21.0) {
-          ZoneNumber = 33;
-        }
-        else if (Long >= 21.0 && Long < 33.0) {
-          ZoneNumber = 35;
-        }
-        else if (Long >= 33.0 && Long < 42.0) {
-          ZoneNumber = 37;
-        }
-      }
-
-      LongOrigin = (ZoneNumber - 1) * 6 - 180 + 3; //+3 puts origin
-      // in middle of
-      // zone
-      LongOriginRad = degToRad(LongOrigin);
-
-      eccPrimeSquared = (eccSquared) / (1 - eccSquared);
-
-      N = a / Math.sqrt(1 - eccSquared * Math.sin(LatRad) * Math.sin(LatRad));
-      T = Math.tan(LatRad) * Math.tan(LatRad);
-      C = eccPrimeSquared * Math.cos(LatRad) * Math.cos(LatRad);
-      A = Math.cos(LatRad) * (LongRad - LongOriginRad);
-
-      M = a * ((1 - eccSquared / 4 - 3 * eccSquared * eccSquared / 64 - 5 * eccSquared * eccSquared * eccSquared / 256) * LatRad - (3 * eccSquared / 8 + 3 * eccSquared * eccSquared / 32 + 45 * eccSquared * eccSquared * eccSquared / 1024) * Math.sin(2 * LatRad) + (15 * eccSquared * eccSquared / 256 + 45 * eccSquared * eccSquared * eccSquared / 1024) * Math.sin(4 * LatRad) - (35 * eccSquared * eccSquared * eccSquared / 3072) * Math.sin(6 * LatRad));
-
-      var UTMEasting = (k0 * N * (A + (1 - T + C) * A * A * A / 6.0 + (5 - 18 * T + T * T + 72 * C - 58 * eccPrimeSquared) * A * A * A * A * A / 120.0) + 500000.0);
-
-      var UTMNorthing = (k0 * (M + N * Math.tan(LatRad) * (A * A / 2 + (5 - T + 9 * C + 4 * C * C) * A * A * A * A / 24.0 + (61 - 58 * T + T * T + 600 * C - 330 * eccPrimeSquared) * A * A * A * A * A * A / 720.0)));
-      if (Lat < 0.0) {
-        UTMNorthing += 10000000.0; //10000000 meter offset for
-        // southern hemisphere
-      }
-
-      return {
-        northing: Math.round(UTMNorthing),
-        easting: Math.round(UTMEasting),
-        zoneNumber: ZoneNumber,
-        zoneLetter: getLetterDesignator(Lat)
-      };
-    }
-
-    /**
-     * Converts UTM coords to lat/long, using the WGS84 ellipsoid. This is a convenience
-     * class where the Zone can be specified as a single string eg."60N" which
-     * is then broken down into the ZoneNumber and ZoneLetter.
-     *
-     * @private
-     * @param {object} utm An object literal with northing, easting, zoneNumber
-     *     and zoneLetter properties. If an optional accuracy property is
-     *     provided (in meters), a bounding box will be returned instead of
-     *     latitude and longitude.
-     * @return {object} An object literal containing either lat and lon values
-     *     (if no accuracy was provided), or top, right, bottom and left values
-     *     for the bounding box calculated according to the provided accuracy.
-     *     Returns null if the conversion failed.
-     */
-    function UTMtoLL(utm) {
-
-      var UTMNorthing = utm.northing;
-      var UTMEasting = utm.easting;
-      var zoneLetter = utm.zoneLetter;
-      var zoneNumber = utm.zoneNumber;
-      // check the ZoneNummber is valid
-      if (zoneNumber < 0 || zoneNumber > 60) {
-        return null;
-      }
-
-      var k0 = 0.9996;
-      var a = 6378137.0; //ellip.radius;
-      var eccSquared = 0.00669438; //ellip.eccsq;
-      var eccPrimeSquared;
-      var e1 = (1 - Math.sqrt(1 - eccSquared)) / (1 + Math.sqrt(1 - eccSquared));
-      var N1, T1, C1, R1, D, M;
-      var LongOrigin;
-      var mu, phi1Rad;
-
-      // remove 500,000 meter offset for longitude
-      var x = UTMEasting - 500000.0;
-      var y = UTMNorthing;
-
-      // We must know somehow if we are in the Northern or Southern
-      // hemisphere, this is the only time we use the letter So even
-      // if the Zone letter isn't exactly correct it should indicate
-      // the hemisphere correctly
-      if (zoneLetter < 'N') {
-        y -= 10000000.0; // remove 10,000,000 meter offset used
-        // for southern hemisphere
-      }
-
-      // There are 60 zones with zone 1 being at West -180 to -174
-      LongOrigin = (zoneNumber - 1) * 6 - 180 + 3; // +3 puts origin
-      // in middle of
-      // zone
-
-      eccPrimeSquared = (eccSquared) / (1 - eccSquared);
-
-      M = y / k0;
-      mu = M / (a * (1 - eccSquared / 4 - 3 * eccSquared * eccSquared / 64 - 5 * eccSquared * eccSquared * eccSquared / 256));
-
-      phi1Rad = mu + (3 * e1 / 2 - 27 * e1 * e1 * e1 / 32) * Math.sin(2 * mu) + (21 * e1 * e1 / 16 - 55 * e1 * e1 * e1 * e1 / 32) * Math.sin(4 * mu) + (151 * e1 * e1 * e1 / 96) * Math.sin(6 * mu);
-      // double phi1 = ProjMath.radToDeg(phi1Rad);
-
-      N1 = a / Math.sqrt(1 - eccSquared * Math.sin(phi1Rad) * Math.sin(phi1Rad));
-      T1 = Math.tan(phi1Rad) * Math.tan(phi1Rad);
-      C1 = eccPrimeSquared * Math.cos(phi1Rad) * Math.cos(phi1Rad);
-      R1 = a * (1 - eccSquared) / Math.pow(1 - eccSquared * Math.sin(phi1Rad) * Math.sin(phi1Rad), 1.5);
-      D = x / (N1 * k0);
-
-      var lat = phi1Rad - (N1 * Math.tan(phi1Rad) / R1) * (D * D / 2 - (5 + 3 * T1 + 10 * C1 - 4 * C1 * C1 - 9 * eccPrimeSquared) * D * D * D * D / 24 + (61 + 90 * T1 + 298 * C1 + 45 * T1 * T1 - 252 * eccPrimeSquared - 3 * C1 * C1) * D * D * D * D * D * D / 720);
-      lat = radToDeg(lat);
-
-      var lon = (D - (1 + 2 * T1 + C1) * D * D * D / 6 + (5 - 2 * C1 + 28 * T1 - 3 * C1 * C1 + 8 * eccPrimeSquared + 24 * T1 * T1) * D * D * D * D * D / 120) / Math.cos(phi1Rad);
-      lon = LongOrigin + radToDeg(lon);
-
-      var result;
-      if (utm.accuracy) {
-        var topRight = UTMtoLL({
-          northing: utm.northing + utm.accuracy,
-          easting: utm.easting + utm.accuracy,
-          zoneLetter: utm.zoneLetter,
-          zoneNumber: utm.zoneNumber
-        });
-        result = {
-          top: topRight.lat,
-          right: topRight.lon,
-          bottom: lat,
-          left: lon
-        };
-      }
-      else {
-        result = {
-          lat: lat,
-          lon: lon
-        };
-      }
-      return result;
-    }
-
-    /**
-     * Calculates the MGRS letter designator for the given latitude.
-     *
-     * @private
-     * @param {number} lat The latitude in WGS84 to get the letter designator
-     *     for.
-     * @return {char} The letter designator.
-     */
-    function getLetterDesignator(lat) {
-      //This is here as an error flag to show that the Latitude is
-      //outside MGRS limits
-      var LetterDesignator = 'Z';
-
-      if ((84 >= lat) && (lat >= 72)) {
-        LetterDesignator = 'X';
-      }
-      else if ((72 > lat) && (lat >= 64)) {
-        LetterDesignator = 'W';
-      }
-      else if ((64 > lat) && (lat >= 56)) {
-        LetterDesignator = 'V';
-      }
-      else if ((56 > lat) && (lat >= 48)) {
-        LetterDesignator = 'U';
-      }
-      else if ((48 > lat) && (lat >= 40)) {
-        LetterDesignator = 'T';
-      }
-      else if ((40 > lat) && (lat >= 32)) {
-        LetterDesignator = 'S';
-      }
-      else if ((32 > lat) && (lat >= 24)) {
-        LetterDesignator = 'R';
-      }
-      else if ((24 > lat) && (lat >= 16)) {
-        LetterDesignator = 'Q';
-      }
-      else if ((16 > lat) && (lat >= 8)) {
-        LetterDesignator = 'P';
-      }
-      else if ((8 > lat) && (lat >= 0)) {
-        LetterDesignator = 'N';
-      }
-      else if ((0 > lat) && (lat >= -8)) {
-        LetterDesignator = 'M';
-      }
-      else if ((-8 > lat) && (lat >= -16)) {
-        LetterDesignator = 'L';
-      }
-      else if ((-16 > lat) && (lat >= -24)) {
-        LetterDesignator = 'K';
-      }
-      else if ((-24 > lat) && (lat >= -32)) {
-        LetterDesignator = 'J';
-      }
-      else if ((-32 > lat) && (lat >= -40)) {
-        LetterDesignator = 'H';
-      }
-      else if ((-40 > lat) && (lat >= -48)) {
-        LetterDesignator = 'G';
-      }
-      else if ((-48 > lat) && (lat >= -56)) {
-        LetterDesignator = 'F';
-      }
-      else if ((-56 > lat) && (lat >= -64)) {
-        LetterDesignator = 'E';
-      }
-      else if ((-64 > lat) && (lat >= -72)) {
-        LetterDesignator = 'D';
-      }
-      else if ((-72 > lat) && (lat >= -80)) {
-        LetterDesignator = 'C';
-      }
-      return LetterDesignator;
-    }
-
-    /**
-     * Encodes a UTM location as MGRS string.
-     *
-     * @private
-     * @param {object} utm An object literal with easting, northing,
-     *     zoneLetter, zoneNumber
-     * @param {number} accuracy Accuracy in digits (1-5).
-     * @return {string} MGRS string for the given UTM location.
-     */
-    function encode(utm, accuracy) {
-      // prepend with leading zeroes
-      var seasting = "00000" + utm.easting,
-        snorthing = "00000" + utm.northing;
-
-      return utm.zoneNumber + utm.zoneLetter + get100kID(utm.easting, utm.northing, utm.zoneNumber) + seasting.substr(seasting.length - 5, accuracy) + snorthing.substr(snorthing.length - 5, accuracy);
-    }
-
-    /**
-     * Get the two letter 100k designator for a given UTM easting,
-     * northing and zone number value.
-     *
-     * @private
-     * @param {number} easting
-     * @param {number} northing
-     * @param {number} zoneNumber
-     * @return the two letter 100k designator for the given UTM location.
-     */
-    function get100kID(easting, northing, zoneNumber) {
-      var setParm = get100kSetForZone(zoneNumber);
-      var setColumn = Math.floor(easting / 100000);
-      var setRow = Math.floor(northing / 100000) % 20;
-      return getLetter100kID(setColumn, setRow, setParm);
-    }
-
-    /**
-     * Given a UTM zone number, figure out the MGRS 100K set it is in.
-     *
-     * @private
-     * @param {number} i An UTM zone number.
-     * @return {number} the 100k set the UTM zone is in.
-     */
-    function get100kSetForZone(i) {
-      var setParm = i % NUM_100K_SETS;
-      if (setParm === 0) {
-        setParm = NUM_100K_SETS;
-      }
-
-      return setParm;
-    }
-
-    /**
-     * Get the two-letter MGRS 100k designator given information
-     * translated from the UTM northing, easting and zone number.
-     *
-     * @private
-     * @param {number} column the column index as it relates to the MGRS
-     *        100k set spreadsheet, created from the UTM easting.
-     *        Values are 1-8.
-     * @param {number} row the row index as it relates to the MGRS 100k set
-     *        spreadsheet, created from the UTM northing value. Values
-     *        are from 0-19.
-     * @param {number} parm the set block, as it relates to the MGRS 100k set
-     *        spreadsheet, created from the UTM zone. Values are from
-     *        1-60.
-     * @return two letter MGRS 100k code.
-     */
-    function getLetter100kID(column, row, parm) {
-      // colOrigin and rowOrigin are the letters at the origin of the set
-      var index = parm - 1;
-      var colOrigin = SET_ORIGIN_COLUMN_LETTERS.charCodeAt(index);
-      var rowOrigin = SET_ORIGIN_ROW_LETTERS.charCodeAt(index);
-
-      // colInt and rowInt are the letters to build to return
-      var colInt = colOrigin + column - 1;
-      var rowInt = rowOrigin + row;
-      var rollover = false;
-
-      if (colInt > Z) {
-        colInt = colInt - Z + A - 1;
-        rollover = true;
-      }
-
-      if (colInt === I || (colOrigin < I && colInt > I) || ((colInt > I || colOrigin < I) && rollover)) {
-        colInt++;
-      }
-
-      if (colInt === O || (colOrigin < O && colInt > O) || ((colInt > O || colOrigin < O) && rollover)) {
-        colInt++;
-
-        if (colInt === I) {
-          colInt++;
-        }
-      }
-
-      if (colInt > Z) {
-        colInt = colInt - Z + A - 1;
-      }
-
-      if (rowInt > V) {
-        rowInt = rowInt - V + A - 1;
-        rollover = true;
-      }
-      else {
-        rollover = false;
-      }
-
-      if (((rowInt === I) || ((rowOrigin < I) && (rowInt > I))) || (((rowInt > I) || (rowOrigin < I)) && rollover)) {
-        rowInt++;
-      }
-
-      if (((rowInt === O) || ((rowOrigin < O) && (rowInt > O))) || (((rowInt > O) || (rowOrigin < O)) && rollover)) {
-        rowInt++;
-
-        if (rowInt === I) {
-          rowInt++;
-        }
-      }
-
-      if (rowInt > V) {
-        rowInt = rowInt - V + A - 1;
-      }
-
-      var twoLetter = String.fromCharCode(colInt) + String.fromCharCode(rowInt);
-      return twoLetter;
-    }
-
-    /**
-     * Decode the UTM parameters from a MGRS string.
-     *
-     * @private
-     * @param {string} mgrsString an UPPERCASE coordinate string is expected.
-     * @return {object} An object literal with easting, northing, zoneLetter,
-     *     zoneNumber and accuracy (in meters) properties.
-     */
-    function decode(mgrsString) {
-
-      if (mgrsString && mgrsString.length === 0) {
-        throw ("MGRSPoint coverting from nothing");
-      }
-
-      var length = mgrsString.length;
-
-      var hunK = null;
-      var sb = "";
-      var testChar;
-      var i = 0;
-
-      // get Zone number
-      while (!(/[A-Z]/).test(testChar = mgrsString.charAt(i))) {
-        if (i >= 2) {
-          throw ("MGRSPoint bad conversion from: " + mgrsString);
-        }
-        sb += testChar;
-        i++;
-      }
-
-      var zoneNumber = parseInt(sb, 10);
-
-      if (i === 0 || i + 3 > length) {
-        // A good MGRS string has to be 4-5 digits long,
-        // ##AAA/#AAA at least.
-        throw ("MGRSPoint bad conversion from: " + mgrsString);
-      }
-
-      var zoneLetter = mgrsString.charAt(i++);
-
-      // Should we check the zone letter here? Why not.
-      if (zoneLetter <= 'A' || zoneLetter === 'B' || zoneLetter === 'Y' || zoneLetter >= 'Z' || zoneLetter === 'I' || zoneLetter === 'O') {
-        throw ("MGRSPoint zone letter " + zoneLetter + " not handled: " + mgrsString);
-      }
-
-      hunK = mgrsString.substring(i, i += 2);
-
-      var set = get100kSetForZone(zoneNumber);
-
-      var east100k = getEastingFromChar(hunK.charAt(0), set);
-      var north100k = getNorthingFromChar(hunK.charAt(1), set);
-
-      // We have a bug where the northing may be 2000000 too low.
-      // How
-      // do we know when to roll over?
-
-      while (north100k < getMinNorthing(zoneLetter)) {
-        north100k += 2000000;
-      }
-
-      // calculate the char index for easting/northing separator
-      var remainder = length - i;
-
-      if (remainder % 2 !== 0) {
-        throw ("MGRSPoint has to have an even number \nof digits after the zone letter and two 100km letters - front \nhalf for easting meters, second half for \nnorthing meters" + mgrsString);
-      }
-
-      var sep = remainder / 2;
-
-      var sepEasting = 0.0;
-      var sepNorthing = 0.0;
-      var accuracyBonus, sepEastingString, sepNorthingString, easting, northing;
-      if (sep > 0) {
-        accuracyBonus = 100000.0 / Math.pow(10, sep);
-        sepEastingString = mgrsString.substring(i, i + sep);
-        sepEasting = parseFloat(sepEastingString) * accuracyBonus;
-        sepNorthingString = mgrsString.substring(i + sep);
-        sepNorthing = parseFloat(sepNorthingString) * accuracyBonus;
-      }
-
-      easting = sepEasting + east100k;
-      northing = sepNorthing + north100k;
-
-      return {
-        easting: easting,
-        northing: northing,
-        zoneLetter: zoneLetter,
-        zoneNumber: zoneNumber,
-        accuracy: accuracyBonus
-      };
-    }
-
-    /**
-     * Given the first letter from a two-letter MGRS 100k zone, and given the
-     * MGRS table set for the zone number, figure out the easting value that
-     * should be added to the other, secondary easting value.
-     *
-     * @private
-     * @param {char} e The first letter from a two-letter MGRS 100´k zone.
-     * @param {number} set The MGRS table set for the zone number.
-     * @return {number} The easting value for the given letter and set.
-     */
-    function getEastingFromChar(e, set) {
-      // colOrigin is the letter at the origin of the set for the
-      // column
-      var curCol = SET_ORIGIN_COLUMN_LETTERS.charCodeAt(set - 1);
-      var eastingValue = 100000.0;
-      var rewindMarker = false;
-
-      while (curCol !== e.charCodeAt(0)) {
-        curCol++;
-        if (curCol === I) {
-          curCol++;
-        }
-        if (curCol === O) {
-          curCol++;
-        }
-        if (curCol > Z) {
-          if (rewindMarker) {
-            throw ("Bad character: " + e);
-          }
-          curCol = A;
-          rewindMarker = true;
-        }
-        eastingValue += 100000.0;
-      }
-
-      return eastingValue;
-    }
-
-    /**
-     * Given the second letter from a two-letter MGRS 100k zone, and given the
-     * MGRS table set for the zone number, figure out the northing value that
-     * should be added to the other, secondary northing value. You have to
-     * remember that Northings are determined from the equator, and the vertical
-     * cycle of letters mean a 2000000 additional northing meters. This happens
-     * approx. every 18 degrees of latitude. This method does *NOT* count any
-     * additional northings. You have to figure out how many 2000000 meters need
-     * to be added for the zone letter of the MGRS coordinate.
-     *
-     * @private
-     * @param {char} n Second letter of the MGRS 100k zone
-     * @param {number} set The MGRS table set number, which is dependent on the
-     *     UTM zone number.
-     * @return {number} The northing value for the given letter and set.
-     */
-    function getNorthingFromChar(n, set) {
-
-      if (n > 'V') {
-        throw ("MGRSPoint given invalid Northing " + n);
-      }
-
-      // rowOrigin is the letter at the origin of the set for the
-      // column
-      var curRow = SET_ORIGIN_ROW_LETTERS.charCodeAt(set - 1);
-      var northingValue = 0.0;
-      var rewindMarker = false;
-
-      while (curRow !== n.charCodeAt(0)) {
-        curRow++;
-        if (curRow === I) {
-          curRow++;
-        }
-        if (curRow === O) {
-          curRow++;
-        }
-        // fixing a bug making whole application hang in this loop
-        // when 'n' is a wrong character
-        if (curRow > V) {
-          if (rewindMarker) { // making sure that this loop ends
-            throw ("Bad character: " + n);
-          }
-          curRow = A;
-          rewindMarker = true;
-        }
-        northingValue += 100000.0;
-      }
-
-      return northingValue;
-    }
-
-    /**
-     * The function getMinNorthing returns the minimum northing value of a MGRS
-     * zone.
-     *
-     * Ported from Geotrans' c Lattitude_Band_Value structure table.
-     *
-     * @private
-     * @param {char} zoneLetter The MGRS zone to get the min northing for.
-     * @return {number}
-     */
-    function getMinNorthing(zoneLetter) {
-      var northing;
-      switch (zoneLetter) {
-      case 'C':
-        northing = 1100000.0;
-        break;
-      case 'D':
-        northing = 2000000.0;
-        break;
-      case 'E':
-        northing = 2800000.0;
-        break;
-      case 'F':
-        northing = 3700000.0;
-        break;
-      case 'G':
-        northing = 4600000.0;
-        break;
-      case 'H':
-        northing = 5500000.0;
-        break;
-      case 'J':
-        northing = 6400000.0;
-        break;
-      case 'K':
-        northing = 7300000.0;
-        break;
-      case 'L':
-        northing = 8200000.0;
-        break;
-      case 'M':
-        northing = 9100000.0;
-        break;
-      case 'N':
-        northing = 0.0;
-        break;
-      case 'P':
-        northing = 800000.0;
-        break;
-      case 'Q':
-        northing = 1700000.0;
-        break;
-      case 'R':
-        northing = 2600000.0;
-        break;
-      case 'S':
-        northing = 3500000.0;
-        break;
-      case 'T':
-        northing = 4400000.0;
-        break;
-      case 'U':
-        northing = 5300000.0;
-        break;
-      case 'V':
-        northing = 6200000.0;
-        break;
-      case 'W':
-        northing = 7000000.0;
-        break;
-      case 'X':
-        northing = 7900000.0;
-        break;
-      default:
-        northing = -1.0;
-      }
-      if (northing >= 0.0) {
-        return northing;
-      }
-      else {
-        throw ("Invalid zone letter: " + zoneLetter);
-      }
-
-    }
-
-    function Point(x, y, z) {
-      if (!(this instanceof Point)) {
-        return new Point(x, y, z);
-      }
-      if (Array.isArray(x)) {
-        this.x = x[0];
-        this.y = x[1];
-        this.z = x[2] || 0.0;
-      } else if(typeof x === 'object') {
-        this.x = x.x;
-        this.y = x.y;
-        this.z = x.z || 0.0;
-      } else if (typeof x === 'string' && typeof y === 'undefined') {
-        var coords = x.split(',');
-        this.x = parseFloat(coords[0], 10);
-        this.y = parseFloat(coords[1], 10);
-        this.z = parseFloat(coords[2], 10) || 0.0;
-      } else {
-        this.x = x;
-        this.y = y;
-        this.z = z || 0.0;
-      }
-      console.warn('proj4.Point will be removed in version 3, use proj4.toPoint');
-    }
-
-    Point.fromMGRS = function(mgrsStr) {
-      return new Point(toPoint$1(mgrsStr));
-    };
-    Point.prototype.toMGRS = function(accuracy) {
-      return forward$1([this.x, this.y], accuracy);
-    };
-
-    var C00 = 1;
-    var C02 = 0.25;
-    var C04 = 0.046875;
-    var C06 = 0.01953125;
-    var C08 = 0.01068115234375;
-    var C22 = 0.75;
-    var C44 = 0.46875;
-    var C46 = 0.01302083333333333333;
-    var C48 = 0.00712076822916666666;
-    var C66 = 0.36458333333333333333;
-    var C68 = 0.00569661458333333333;
-    var C88 = 0.3076171875;
-
-    var pj_enfn = function(es) {
-      var en = [];
-      en[0] = C00 - es * (C02 + es * (C04 + es * (C06 + es * C08)));
-      en[1] = es * (C22 - es * (C04 + es * (C06 + es * C08)));
-      var t = es * es;
-      en[2] = t * (C44 - es * (C46 + es * C48));
-      t *= es;
-      en[3] = t * (C66 - es * C68);
-      en[4] = t * es * C88;
-      return en;
-    };
-
-    var pj_mlfn = function(phi, sphi, cphi, en) {
-      cphi *= sphi;
-      sphi *= sphi;
-      return (en[0] * phi - cphi * (en[1] + sphi * (en[2] + sphi * (en[3] + sphi * en[4]))));
-    };
-
-    var MAX_ITER = 20;
-
-    var pj_inv_mlfn = function(arg, es, en) {
-      var k = 1 / (1 - es);
-      var phi = arg;
-      for (var i = MAX_ITER; i; --i) { /* rarely goes over 2 iterations */
-        var s = Math.sin(phi);
-        var t = 1 - es * s * s;
-        //t = this.pj_mlfn(phi, s, Math.cos(phi), en) - arg;
-        //phi -= t * (t * Math.sqrt(t)) * k;
-        t = (pj_mlfn(phi, s, Math.cos(phi), en) - arg) * (t * Math.sqrt(t)) * k;
-        phi -= t;
-        if (Math.abs(t) < EPSLN) {
-          return phi;
-        }
-      }
-      //..reportError("cass:pj_inv_mlfn: Convergence error");
-      return phi;
-    };
-
-    // Heavily based on this tmerc projection implementation
-    // https://github.com/mbloch/mapshaper-proj/blob/master/src/projections/tmerc.js
-
-    function init$2() {
-      this.x0 = this.x0 !== undefined ? this.x0 : 0;
-      this.y0 = this.y0 !== undefined ? this.y0 : 0;
-      this.long0 = this.long0 !== undefined ? this.long0 : 0;
-      this.lat0 = this.lat0 !== undefined ? this.lat0 : 0;
-
-      if (this.es) {
-        this.en = pj_enfn(this.es);
-        this.ml0 = pj_mlfn(this.lat0, Math.sin(this.lat0), Math.cos(this.lat0), this.en);
-      }
-    }
-
-    /**
-        Transverse Mercator Forward  - long/lat to x/y
-        long/lat in radians
-      */
-    function forward$2(p) {
-      var lon = p.x;
-      var lat = p.y;
-
-      var delta_lon = adjust_lon(lon - this.long0);
-      var con;
-      var x, y;
-      var sin_phi = Math.sin(lat);
-      var cos_phi = Math.cos(lat);
-
-      if (!this.es) {
-        var b = cos_phi * Math.sin(delta_lon);
-
-        if ((Math.abs(Math.abs(b) - 1)) < EPSLN) {
-          return (93);
-        }
-        else {
-          x = 0.5 * this.a * this.k0 * Math.log((1 + b) / (1 - b)) + this.x0;
-          y = cos_phi * Math.cos(delta_lon) / Math.sqrt(1 - Math.pow(b, 2));
-          b = Math.abs(y);
-
-          if (b >= 1) {
-            if ((b - 1) > EPSLN) {
-              return (93);
-            }
-            else {
-              y = 0;
-            }
-          }
-          else {
-            y = Math.acos(y);
-          }
-
-          if (lat < 0) {
-            y = -y;
-          }
-
-          y = this.a * this.k0 * (y - this.lat0) + this.y0;
-        }
-      }
-      else {
-        var al = cos_phi * delta_lon;
-        var als = Math.pow(al, 2);
-        var c = this.ep2 * Math.pow(cos_phi, 2);
-        var cs = Math.pow(c, 2);
-        var tq = Math.abs(cos_phi) > EPSLN ? Math.tan(lat) : 0;
-        var t = Math.pow(tq, 2);
-        var ts = Math.pow(t, 2);
-        con = 1 - this.es * Math.pow(sin_phi, 2);
-        al = al / Math.sqrt(con);
-        var ml = pj_mlfn(lat, sin_phi, cos_phi, this.en);
-
-        x = this.a * (this.k0 * al * (1 +
-          als / 6 * (1 - t + c +
-          als / 20 * (5 - 18 * t + ts + 14 * c - 58 * t * c +
-          als / 42 * (61 + 179 * ts - ts * t - 479 * t))))) +
-          this.x0;
-
-        y = this.a * (this.k0 * (ml - this.ml0 +
-          sin_phi * delta_lon * al / 2 * (1 +
-          als / 12 * (5 - t + 9 * c + 4 * cs +
-          als / 30 * (61 + ts - 58 * t + 270 * c - 330 * t * c +
-          als / 56 * (1385 + 543 * ts - ts * t - 3111 * t)))))) +
-          this.y0;
-      }
-
-      p.x = x;
-      p.y = y;
-
-      return p;
-    }
-
-    /**
-        Transverse Mercator Inverse  -  x/y to long/lat
-      */
-    function inverse$2(p) {
-      var con, phi;
-      var lat, lon;
-      var x = (p.x - this.x0) * (1 / this.a);
-      var y = (p.y - this.y0) * (1 / this.a);
-
-      if (!this.es) {
-        var f = Math.exp(x / this.k0);
-        var g = 0.5 * (f - 1 / f);
-        var temp = this.lat0 + y / this.k0;
-        var h = Math.cos(temp);
-        con = Math.sqrt((1 - Math.pow(h, 2)) / (1 + Math.pow(g, 2)));
-        lat = Math.asin(con);
-
-        if (y < 0) {
-          lat = -lat;
-        }
-
-        if ((g === 0) && (h === 0)) {
-          lon = 0;
-        }
-        else {
-          lon = adjust_lon(Math.atan2(g, h) + this.long0);
-        }
-      }
-      else { // ellipsoidal form
-        con = this.ml0 + y / this.k0;
-        phi = pj_inv_mlfn(con, this.es, this.en);
-
-        if (Math.abs(phi) < HALF_PI) {
-          var sin_phi = Math.sin(phi);
-          var cos_phi = Math.cos(phi);
-          var tan_phi = Math.abs(cos_phi) > EPSLN ? Math.tan(phi) : 0;
-          var c = this.ep2 * Math.pow(cos_phi, 2);
-          var cs = Math.pow(c, 2);
-          var t = Math.pow(tan_phi, 2);
-          var ts = Math.pow(t, 2);
-          con = 1 - this.es * Math.pow(sin_phi, 2);
-          var d = x * Math.sqrt(con) / this.k0;
-          var ds = Math.pow(d, 2);
-          con = con * tan_phi;
-
-          lat = phi - (con * ds / (1 - this.es)) * 0.5 * (1 -
-            ds / 12 * (5 + 3 * t - 9 * c * t + c - 4 * cs -
-            ds / 30 * (61 + 90 * t - 252 * c * t + 45 * ts + 46 * c -
-            ds / 56 * (1385 + 3633 * t + 4095 * ts + 1574 * ts * t))));
-
-          lon = adjust_lon(this.long0 + (d * (1 -
-            ds / 6 * (1 + 2 * t + c -
-            ds / 20 * (5 + 28 * t + 24 * ts + 8 * c * t + 6 * c -
-            ds / 42 * (61 + 662 * t + 1320 * ts + 720 * ts * t)))) / cos_phi));
-        }
-        else {
-          lat = HALF_PI * sign(y);
-          lon = 0;
-        }
-      }
-
-      p.x = lon;
-      p.y = lat;
-
-      return p;
-    }
-
-    var names$3 = ["Transverse_Mercator", "Transverse Mercator", "tmerc"];
-    var tmerc = {
-      init: init$2,
-      forward: forward$2,
-      inverse: inverse$2,
-      names: names$3
-    };
-
-    var sinh = function(x) {
-      var r = Math.exp(x);
-      r = (r - 1 / r) / 2;
-      return r;
-    };
-
-    var hypot = function(x, y) {
-      x = Math.abs(x);
-      y = Math.abs(y);
-      var a = Math.max(x, y);
-      var b = Math.min(x, y) / (a ? a : 1);
-
-      return a * Math.sqrt(1 + Math.pow(b, 2));
-    };
-
-    var log1py = function(x) {
-      var y = 1 + x;
-      var z = y - 1;
-
-      return z === 0 ? x : x * Math.log(y) / z;
-    };
-
-    var asinhy = function(x) {
-      var y = Math.abs(x);
-      y = log1py(y * (1 + y / (hypot(1, y) + 1)));
-
-      return x < 0 ? -y : y;
-    };
-
-    var gatg = function(pp, B) {
-      var cos_2B = 2 * Math.cos(2 * B);
-      var i = pp.length - 1;
-      var h1 = pp[i];
-      var h2 = 0;
-      var h;
-
-      while (--i >= 0) {
-        h = -h2 + cos_2B * h1 + pp[i];
-        h2 = h1;
-        h1 = h;
-      }
-
-      return (B + h * Math.sin(2 * B));
-    };
-
-    var clens = function(pp, arg_r) {
-      var r = 2 * Math.cos(arg_r);
-      var i = pp.length - 1;
-      var hr1 = pp[i];
-      var hr2 = 0;
-      var hr;
-
-      while (--i >= 0) {
-        hr = -hr2 + r * hr1 + pp[i];
-        hr2 = hr1;
-        hr1 = hr;
-      }
-
-      return Math.sin(arg_r) * hr;
-    };
-
-    var cosh = function(x) {
-      var r = Math.exp(x);
-      r = (r + 1 / r) / 2;
-      return r;
-    };
-
-    var clens_cmplx = function(pp, arg_r, arg_i) {
-      var sin_arg_r = Math.sin(arg_r);
-      var cos_arg_r = Math.cos(arg_r);
-      var sinh_arg_i = sinh(arg_i);
-      var cosh_arg_i = cosh(arg_i);
-      var r = 2 * cos_arg_r * cosh_arg_i;
-      var i = -2 * sin_arg_r * sinh_arg_i;
-      var j = pp.length - 1;
-      var hr = pp[j];
-      var hi1 = 0;
-      var hr1 = 0;
-      var hi = 0;
-      var hr2;
-      var hi2;
-
-      while (--j >= 0) {
-        hr2 = hr1;
-        hi2 = hi1;
-        hr1 = hr;
-        hi1 = hi;
-        hr = -hr2 + r * hr1 - i * hi1 + pp[j];
-        hi = -hi2 + i * hr1 + r * hi1;
-      }
-
-      r = sin_arg_r * cosh_arg_i;
-      i = cos_arg_r * sinh_arg_i;
-
-      return [r * hr - i * hi, r * hi + i * hr];
-    };
-
-    // Heavily based on this etmerc projection implementation
-    // https://github.com/mbloch/mapshaper-proj/blob/master/src/projections/etmerc.js
-
-    function init$3() {
-      if (this.es === undefined || this.es <= 0) {
-        throw new Error('incorrect elliptical usage');
-      }
-
-      this.x0 = this.x0 !== undefined ? this.x0 : 0;
-      this.y0 = this.y0 !== undefined ? this.y0 : 0;
-      this.long0 = this.long0 !== undefined ? this.long0 : 0;
-      this.lat0 = this.lat0 !== undefined ? this.lat0 : 0;
-
-      this.cgb = [];
-      this.cbg = [];
-      this.utg = [];
-      this.gtu = [];
-
-      var f = this.es / (1 + Math.sqrt(1 - this.es));
-      var n = f / (2 - f);
-      var np = n;
-
-      this.cgb[0] = n * (2 + n * (-2 / 3 + n * (-2 + n * (116 / 45 + n * (26 / 45 + n * (-2854 / 675 ))))));
-      this.cbg[0] = n * (-2 + n * ( 2 / 3 + n * ( 4 / 3 + n * (-82 / 45 + n * (32 / 45 + n * (4642 / 4725))))));
-
-      np = np * n;
-      this.cgb[1] = np * (7 / 3 + n * (-8 / 5 + n * (-227 / 45 + n * (2704 / 315 + n * (2323 / 945)))));
-      this.cbg[1] = np * (5 / 3 + n * (-16 / 15 + n * ( -13 / 9 + n * (904 / 315 + n * (-1522 / 945)))));
-
-      np = np * n;
-      this.cgb[2] = np * (56 / 15 + n * (-136 / 35 + n * (-1262 / 105 + n * (73814 / 2835))));
-      this.cbg[2] = np * (-26 / 15 + n * (34 / 21 + n * (8 / 5 + n * (-12686 / 2835))));
-
-      np = np * n;
-      this.cgb[3] = np * (4279 / 630 + n * (-332 / 35 + n * (-399572 / 14175)));
-      this.cbg[3] = np * (1237 / 630 + n * (-12 / 5 + n * ( -24832 / 14175)));
-
-      np = np * n;
-      this.cgb[4] = np * (4174 / 315 + n * (-144838 / 6237));
-      this.cbg[4] = np * (-734 / 315 + n * (109598 / 31185));
-
-      np = np * n;
-      this.cgb[5] = np * (601676 / 22275);
-      this.cbg[5] = np * (444337 / 155925);
-
-      np = Math.pow(n, 2);
-      this.Qn = this.k0 / (1 + n) * (1 + np * (1 / 4 + np * (1 / 64 + np / 256)));
-
-      this.utg[0] = n * (-0.5 + n * ( 2 / 3 + n * (-37 / 96 + n * ( 1 / 360 + n * (81 / 512 + n * (-96199 / 604800))))));
-      this.gtu[0] = n * (0.5 + n * (-2 / 3 + n * (5 / 16 + n * (41 / 180 + n * (-127 / 288 + n * (7891 / 37800))))));
-
-      this.utg[1] = np * (-1 / 48 + n * (-1 / 15 + n * (437 / 1440 + n * (-46 / 105 + n * (1118711 / 3870720)))));
-      this.gtu[1] = np * (13 / 48 + n * (-3 / 5 + n * (557 / 1440 + n * (281 / 630 + n * (-1983433 / 1935360)))));
-
-      np = np * n;
-      this.utg[2] = np * (-17 / 480 + n * (37 / 840 + n * (209 / 4480 + n * (-5569 / 90720 ))));
-      this.gtu[2] = np * (61 / 240 + n * (-103 / 140 + n * (15061 / 26880 + n * (167603 / 181440))));
-
-      np = np * n;
-      this.utg[3] = np * (-4397 / 161280 + n * (11 / 504 + n * (830251 / 7257600)));
-      this.gtu[3] = np * (49561 / 161280 + n * (-179 / 168 + n * (6601661 / 7257600)));
-
-      np = np * n;
-      this.utg[4] = np * (-4583 / 161280 + n * (108847 / 3991680));
-      this.gtu[4] = np * (34729 / 80640 + n * (-3418889 / 1995840));
-
-      np = np * n;
-      this.utg[5] = np * (-20648693 / 638668800);
-      this.gtu[5] = np * (212378941 / 319334400);
-
-      var Z = gatg(this.cbg, this.lat0);
-      this.Zb = -this.Qn * (Z + clens(this.gtu, 2 * Z));
-    }
-
-    function forward$3(p) {
-      var Ce = adjust_lon(p.x - this.long0);
-      var Cn = p.y;
-
-      Cn = gatg(this.cbg, Cn);
-      var sin_Cn = Math.sin(Cn);
-      var cos_Cn = Math.cos(Cn);
-      var sin_Ce = Math.sin(Ce);
-      var cos_Ce = Math.cos(Ce);
-
-      Cn = Math.atan2(sin_Cn, cos_Ce * cos_Cn);
-      Ce = Math.atan2(sin_Ce * cos_Cn, hypot(sin_Cn, cos_Cn * cos_Ce));
-      Ce = asinhy(Math.tan(Ce));
-
-      var tmp = clens_cmplx(this.gtu, 2 * Cn, 2 * Ce);
-
-      Cn = Cn + tmp[0];
-      Ce = Ce + tmp[1];
-
-      var x;
-      var y;
-
-      if (Math.abs(Ce) <= 2.623395162778) {
-        x = this.a * (this.Qn * Ce) + this.x0;
-        y = this.a * (this.Qn * Cn + this.Zb) + this.y0;
-      }
-      else {
-        x = Infinity;
-        y = Infinity;
-      }
-
-      p.x = x;
-      p.y = y;
-
-      return p;
-    }
-
-    function inverse$3(p) {
-      var Ce = (p.x - this.x0) * (1 / this.a);
-      var Cn = (p.y - this.y0) * (1 / this.a);
-
-      Cn = (Cn - this.Zb) / this.Qn;
-      Ce = Ce / this.Qn;
-
-      var lon;
-      var lat;
-
-      if (Math.abs(Ce) <= 2.623395162778) {
-        var tmp = clens_cmplx(this.utg, 2 * Cn, 2 * Ce);
-
-        Cn = Cn + tmp[0];
-        Ce = Ce + tmp[1];
-        Ce = Math.atan(sinh(Ce));
-
-        var sin_Cn = Math.sin(Cn);
-        var cos_Cn = Math.cos(Cn);
-        var sin_Ce = Math.sin(Ce);
-        var cos_Ce = Math.cos(Ce);
-
-        Cn = Math.atan2(sin_Cn * cos_Ce, hypot(sin_Ce, cos_Ce * cos_Cn));
-        Ce = Math.atan2(sin_Ce, cos_Ce * cos_Cn);
-
-        lon = adjust_lon(Ce + this.long0);
-        lat = gatg(this.cgb, Cn);
-      }
-      else {
-        lon = Infinity;
-        lat = Infinity;
-      }
-
-      p.x = lon;
-      p.y = lat;
-
-      return p;
-    }
-
-    var names$4 = ["Extended_Transverse_Mercator", "Extended Transverse Mercator", "etmerc"];
-    var etmerc = {
-      init: init$3,
-      forward: forward$3,
-      inverse: inverse$3,
-      names: names$4
-    };
-
-    var adjust_zone = function(zone, lon) {
-      if (zone === undefined) {
-        zone = Math.floor((adjust_lon(lon) + Math.PI) * 30 / Math.PI) + 1;
-
-        if (zone < 0) {
-          return 0;
-        } else if (zone > 60) {
-          return 60;
-        }
-      }
-      return zone;
-    };
-
-    var dependsOn = 'etmerc';
-    function init$4() {
-      var zone = adjust_zone(this.zone, this.long0);
-      if (zone === undefined) {
-        throw new Error('unknown utm zone');
-      }
-      this.lat0 = 0;
-      this.long0 =  ((6 * Math.abs(zone)) - 183) * D2R;
-      this.x0 = 500000;
-      this.y0 = this.utmSouth ? 10000000 : 0;
-      this.k0 = 0.9996;
-
-      etmerc.init.apply(this);
-      this.forward = etmerc.forward;
-      this.inverse = etmerc.inverse;
-    }
-
-    var names$5 = ["Universal Transverse Mercator System", "utm"];
-    var utm = {
-      init: init$4,
-      names: names$5,
-      dependsOn: dependsOn
-    };
-
-    var srat = function(esinp, exp) {
-      return (Math.pow((1 - esinp) / (1 + esinp), exp));
-    };
-
-    var MAX_ITER$1 = 20;
-    function init$6() {
-      var sphi = Math.sin(this.lat0);
-      var cphi = Math.cos(this.lat0);
-      cphi *= cphi;
-      this.rc = Math.sqrt(1 - this.es) / (1 - this.es * sphi * sphi);
-      this.C = Math.sqrt(1 + this.es * cphi * cphi / (1 - this.es));
-      this.phic0 = Math.asin(sphi / this.C);
-      this.ratexp = 0.5 * this.C * this.e;
-      this.K = Math.tan(0.5 * this.phic0 + FORTPI) / (Math.pow(Math.tan(0.5 * this.lat0 + FORTPI), this.C) * srat(this.e * sphi, this.ratexp));
-    }
-
-    function forward$5(p) {
-      var lon = p.x;
-      var lat = p.y;
-
-      p.y = 2 * Math.atan(this.K * Math.pow(Math.tan(0.5 * lat + FORTPI), this.C) * srat(this.e * Math.sin(lat), this.ratexp)) - HALF_PI;
-      p.x = this.C * lon;
-      return p;
-    }
-
-    function inverse$5(p) {
-      var DEL_TOL = 1e-14;
-      var lon = p.x / this.C;
-      var lat = p.y;
-      var num = Math.pow(Math.tan(0.5 * lat + FORTPI) / this.K, 1 / this.C);
-      for (var i = MAX_ITER$1; i > 0; --i) {
-        lat = 2 * Math.atan(num * srat(this.e * Math.sin(p.y), - 0.5 * this.e)) - HALF_PI;
-        if (Math.abs(lat - p.y) < DEL_TOL) {
-          break;
-        }
-        p.y = lat;
-      }
-      /* convergence failed */
-      if (!i) {
-        return null;
-      }
-      p.x = lon;
-      p.y = lat;
-      return p;
-    }
-
-    var names$7 = ["gauss"];
-    var gauss = {
-      init: init$6,
-      forward: forward$5,
-      inverse: inverse$5,
-      names: names$7
-    };
-
-    function init$5() {
-      gauss.init.apply(this);
-      if (!this.rc) {
-        return;
-      }
-      this.sinc0 = Math.sin(this.phic0);
-      this.cosc0 = Math.cos(this.phic0);
-      this.R2 = 2 * this.rc;
-      if (!this.title) {
-        this.title = "Oblique Stereographic Alternative";
-      }
-    }
-
-    function forward$4(p) {
-      var sinc, cosc, cosl, k;
-      p.x = adjust_lon(p.x - this.long0);
-      gauss.forward.apply(this, [p]);
-      sinc = Math.sin(p.y);
-      cosc = Math.cos(p.y);
-      cosl = Math.cos(p.x);
-      k = this.k0 * this.R2 / (1 + this.sinc0 * sinc + this.cosc0 * cosc * cosl);
-      p.x = k * cosc * Math.sin(p.x);
-      p.y = k * (this.cosc0 * sinc - this.sinc0 * cosc * cosl);
-      p.x = this.a * p.x + this.x0;
-      p.y = this.a * p.y + this.y0;
-      return p;
-    }
-
-    function inverse$4(p) {
-      var sinc, cosc, lon, lat, rho;
-      p.x = (p.x - this.x0) / this.a;
-      p.y = (p.y - this.y0) / this.a;
-
-      p.x /= this.k0;
-      p.y /= this.k0;
-      if ((rho = Math.sqrt(p.x * p.x + p.y * p.y))) {
-        var c = 2 * Math.atan2(rho, this.R2);
-        sinc = Math.sin(c);
-        cosc = Math.cos(c);
-        lat = Math.asin(cosc * this.sinc0 + p.y * sinc * this.cosc0 / rho);
-        lon = Math.atan2(p.x * sinc, rho * this.cosc0 * cosc - p.y * this.sinc0 * sinc);
-      }
-      else {
-        lat = this.phic0;
-        lon = 0;
-      }
-
-      p.x = lon;
-      p.y = lat;
-      gauss.inverse.apply(this, [p]);
-      p.x = adjust_lon(p.x + this.long0);
-      return p;
-    }
-
-    var names$6 = ["Stereographic_North_Pole", "Oblique_Stereographic", "Polar_Stereographic", "sterea","Oblique Stereographic Alternative","Double_Stereographic"];
-    var sterea = {
-      init: init$5,
-      forward: forward$4,
-      inverse: inverse$4,
-      names: names$6
-    };
-
-    function ssfn_(phit, sinphi, eccen) {
-      sinphi *= eccen;
-      return (Math.tan(0.5 * (HALF_PI + phit)) * Math.pow((1 - sinphi) / (1 + sinphi), 0.5 * eccen));
-    }
-
-    function init$7() {
-      this.coslat0 = Math.cos(this.lat0);
-      this.sinlat0 = Math.sin(this.lat0);
-      if (this.sphere) {
-        if (this.k0 === 1 && !isNaN(this.lat_ts) && Math.abs(this.coslat0) <= EPSLN) {
-          this.k0 = 0.5 * (1 + sign(this.lat0) * Math.sin(this.lat_ts));
-        }
-      }
-      else {
-        if (Math.abs(this.coslat0) <= EPSLN) {
-          if (this.lat0 > 0) {
-            //North pole
-            //trace('stere:north pole');
-            this.con = 1;
-          }
-          else {
-            //South pole
-            //trace('stere:south pole');
-            this.con = -1;
-          }
-        }
-        this.cons = Math.sqrt(Math.pow(1 + this.e, 1 + this.e) * Math.pow(1 - this.e, 1 - this.e));
-        if (this.k0 === 1 && !isNaN(this.lat_ts) && Math.abs(this.coslat0) <= EPSLN) {
-          this.k0 = 0.5 * this.cons * msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts)) / tsfnz(this.e, this.con * this.lat_ts, this.con * Math.sin(this.lat_ts));
-        }
-        this.ms1 = msfnz(this.e, this.sinlat0, this.coslat0);
-        this.X0 = 2 * Math.atan(this.ssfn_(this.lat0, this.sinlat0, this.e)) - HALF_PI;
-        this.cosX0 = Math.cos(this.X0);
-        this.sinX0 = Math.sin(this.X0);
-      }
-    }
-
-    // Stereographic forward equations--mapping lat,long to x,y
-    function forward$6(p) {
-      var lon = p.x;
-      var lat = p.y;
-      var sinlat = Math.sin(lat);
-      var coslat = Math.cos(lat);
-      var A, X, sinX, cosX, ts, rh;
-      var dlon = adjust_lon(lon - this.long0);
-
-      if (Math.abs(Math.abs(lon - this.long0) - Math.PI) <= EPSLN && Math.abs(lat + this.lat0) <= EPSLN) {
-        //case of the origine point
-        //trace('stere:this is the origin point');
-        p.x = NaN;
-        p.y = NaN;
-        return p;
-      }
-      if (this.sphere) {
-        //trace('stere:sphere case');
-        A = 2 * this.k0 / (1 + this.sinlat0 * sinlat + this.coslat0 * coslat * Math.cos(dlon));
-        p.x = this.a * A * coslat * Math.sin(dlon) + this.x0;
-        p.y = this.a * A * (this.coslat0 * sinlat - this.sinlat0 * coslat * Math.cos(dlon)) + this.y0;
-        return p;
-      }
-      else {
-        X = 2 * Math.atan(this.ssfn_(lat, sinlat, this.e)) - HALF_PI;
-        cosX = Math.cos(X);
-        sinX = Math.sin(X);
-        if (Math.abs(this.coslat0) <= EPSLN) {
-          ts = tsfnz(this.e, lat * this.con, this.con * sinlat);
-          rh = 2 * this.a * this.k0 * ts / this.cons;
-          p.x = this.x0 + rh * Math.sin(lon - this.long0);
-          p.y = this.y0 - this.con * rh * Math.cos(lon - this.long0);
-          //trace(p.toString());
-          return p;
-        }
-        else if (Math.abs(this.sinlat0) < EPSLN) {
-          //Eq
-          //trace('stere:equateur');
-          A = 2 * this.a * this.k0 / (1 + cosX * Math.cos(dlon));
-          p.y = A * sinX;
-        }
-        else {
-          //other case
-          //trace('stere:normal case');
-          A = 2 * this.a * this.k0 * this.ms1 / (this.cosX0 * (1 + this.sinX0 * sinX + this.cosX0 * cosX * Math.cos(dlon)));
-          p.y = A * (this.cosX0 * sinX - this.sinX0 * cosX * Math.cos(dlon)) + this.y0;
-        }
-        p.x = A * cosX * Math.sin(dlon) + this.x0;
-      }
-      //trace(p.toString());
-      return p;
-    }
-
-    //* Stereographic inverse equations--mapping x,y to lat/long
-    function inverse$6(p) {
-      p.x -= this.x0;
-      p.y -= this.y0;
-      var lon, lat, ts, ce, Chi;
-      var rh = Math.sqrt(p.x * p.x + p.y * p.y);
-      if (this.sphere) {
-        var c = 2 * Math.atan(rh / (2 * this.a * this.k0));
-        lon = this.long0;
-        lat = this.lat0;
-        if (rh <= EPSLN) {
-          p.x = lon;
-          p.y = lat;
-          return p;
-        }
-        lat = Math.asin(Math.cos(c) * this.sinlat0 + p.y * Math.sin(c) * this.coslat0 / rh);
-        if (Math.abs(this.coslat0) < EPSLN) {
-          if (this.lat0 > 0) {
-            lon = adjust_lon(this.long0 + Math.atan2(p.x, - 1 * p.y));
-          }
-          else {
-            lon = adjust_lon(this.long0 + Math.atan2(p.x, p.y));
-          }
-        }
-        else {
-          lon = adjust_lon(this.long0 + Math.atan2(p.x * Math.sin(c), rh * this.coslat0 * Math.cos(c) - p.y * this.sinlat0 * Math.sin(c)));
-        }
-        p.x = lon;
-        p.y = lat;
-        return p;
-      }
-      else {
-        if (Math.abs(this.coslat0) <= EPSLN) {
-          if (rh <= EPSLN) {
-            lat = this.lat0;
-            lon = this.long0;
-            p.x = lon;
-            p.y = lat;
-            //trace(p.toString());
-            return p;
-          }
-          p.x *= this.con;
-          p.y *= this.con;
-          ts = rh * this.cons / (2 * this.a * this.k0);
-          lat = this.con * phi2z(this.e, ts);
-          lon = this.con * adjust_lon(this.con * this.long0 + Math.atan2(p.x, - 1 * p.y));
-        }
-        else {
-          ce = 2 * Math.atan(rh * this.cosX0 / (2 * this.a * this.k0 * this.ms1));
-          lon = this.long0;
-          if (rh <= EPSLN) {
-            Chi = this.X0;
-          }
-          else {
-            Chi = Math.asin(Math.cos(ce) * this.sinX0 + p.y * Math.sin(ce) * this.cosX0 / rh);
-            lon = adjust_lon(this.long0 + Math.atan2(p.x * Math.sin(ce), rh * this.cosX0 * Math.cos(ce) - p.y * this.sinX0 * Math.sin(ce)));
-          }
-          lat = -1 * phi2z(this.e, Math.tan(0.5 * (HALF_PI + Chi)));
-        }
-      }
-      p.x = lon;
-      p.y = lat;
-
-      //trace(p.toString());
-      return p;
-
-    }
-
-    var names$8 = ["stere", "Stereographic_South_Pole", "Polar Stereographic (variant B)"];
-    var stere = {
-      init: init$7,
-      forward: forward$6,
-      inverse: inverse$6,
-      names: names$8,
-      ssfn_: ssfn_
-    };
-
-    /*
-      references:
-        Formules et constantes pour le Calcul pour la
-        projection cylindrique conforme à axe oblique et pour la transformation entre
-        des systèmes de référence.
-        http://www.swisstopo.admin.ch/internet/swisstopo/fr/home/topics/survey/sys/refsys/switzerland.parsysrelated1.31216.downloadList.77004.DownloadFile.tmp/swissprojectionfr.pdf
-      */
-
-    function init$8() {
-      var phy0 = this.lat0;
-      this.lambda0 = this.long0;
-      var sinPhy0 = Math.sin(phy0);
-      var semiMajorAxis = this.a;
-      var invF = this.rf;
-      var flattening = 1 / invF;
-      var e2 = 2 * flattening - Math.pow(flattening, 2);
-      var e = this.e = Math.sqrt(e2);
-      this.R = this.k0 * semiMajorAxis * Math.sqrt(1 - e2) / (1 - e2 * Math.pow(sinPhy0, 2));
-      this.alpha = Math.sqrt(1 + e2 / (1 - e2) * Math.pow(Math.cos(phy0), 4));
-      this.b0 = Math.asin(sinPhy0 / this.alpha);
-      var k1 = Math.log(Math.tan(Math.PI / 4 + this.b0 / 2));
-      var k2 = Math.log(Math.tan(Math.PI / 4 + phy0 / 2));
-      var k3 = Math.log((1 + e * sinPhy0) / (1 - e * sinPhy0));
-      this.K = k1 - this.alpha * k2 + this.alpha * e / 2 * k3;
-    }
-
-    function forward$7(p) {
-      var Sa1 = Math.log(Math.tan(Math.PI / 4 - p.y / 2));
-      var Sa2 = this.e / 2 * Math.log((1 + this.e * Math.sin(p.y)) / (1 - this.e * Math.sin(p.y)));
-      var S = -this.alpha * (Sa1 + Sa2) + this.K;
-
-      // spheric latitude
-      var b = 2 * (Math.atan(Math.exp(S)) - Math.PI / 4);
-
-      // spheric longitude
-      var I = this.alpha * (p.x - this.lambda0);
-
-      // psoeudo equatorial rotation
-      var rotI = Math.atan(Math.sin(I) / (Math.sin(this.b0) * Math.tan(b) + Math.cos(this.b0) * Math.cos(I)));
-
-      var rotB = Math.asin(Math.cos(this.b0) * Math.sin(b) - Math.sin(this.b0) * Math.cos(b) * Math.cos(I));
-
-      p.y = this.R / 2 * Math.log((1 + Math.sin(rotB)) / (1 - Math.sin(rotB))) + this.y0;
-      p.x = this.R * rotI + this.x0;
-      return p;
-    }
-
-    function inverse$7(p) {
-      var Y = p.x - this.x0;
-      var X = p.y - this.y0;
-
-      var rotI = Y / this.R;
-      var rotB = 2 * (Math.atan(Math.exp(X / this.R)) - Math.PI / 4);
-
-      var b = Math.asin(Math.cos(this.b0) * Math.sin(rotB) + Math.sin(this.b0) * Math.cos(rotB) * Math.cos(rotI));
-      var I = Math.atan(Math.sin(rotI) / (Math.cos(this.b0) * Math.cos(rotI) - Math.sin(this.b0) * Math.tan(rotB)));
-
-      var lambda = this.lambda0 + I / this.alpha;
-
-      var S = 0;
-      var phy = b;
-      var prevPhy = -1000;
-      var iteration = 0;
-      while (Math.abs(phy - prevPhy) > 0.0000001) {
-        if (++iteration > 20) {
-          //...reportError("omercFwdInfinity");
-          return;
-        }
-        //S = Math.log(Math.tan(Math.PI / 4 + phy / 2));
-        S = 1 / this.alpha * (Math.log(Math.tan(Math.PI / 4 + b / 2)) - this.K) + this.e * Math.log(Math.tan(Math.PI / 4 + Math.asin(this.e * Math.sin(phy)) / 2));
-        prevPhy = phy;
-        phy = 2 * Math.atan(Math.exp(S)) - Math.PI / 2;
-      }
-
-      p.x = lambda;
-      p.y = phy;
-      return p;
-    }
-
-    var names$9 = ["somerc"];
-    var somerc = {
-      init: init$8,
-      forward: forward$7,
-      inverse: inverse$7,
-      names: names$9
-    };
-
-    /* Initialize the Oblique Mercator  projection
-        ------------------------------------------*/
-    function init$9() {
-      this.no_off = this.no_off || false;
-      this.no_rot = this.no_rot || false;
-
-      if (isNaN(this.k0)) {
-        this.k0 = 1;
-      }
-      var sinlat = Math.sin(this.lat0);
-      var coslat = Math.cos(this.lat0);
-      var con = this.e * sinlat;
-
-      this.bl = Math.sqrt(1 + this.es / (1 - this.es) * Math.pow(coslat, 4));
-      this.al = this.a * this.bl * this.k0 * Math.sqrt(1 - this.es) / (1 - con * con);
-      var t0 = tsfnz(this.e, this.lat0, sinlat);
-      var dl = this.bl / coslat * Math.sqrt((1 - this.es) / (1 - con * con));
-      if (dl * dl < 1) {
-        dl = 1;
-      }
-      var fl;
-      var gl;
-      if (!isNaN(this.longc)) {
-        //Central point and azimuth method
-
-        if (this.lat0 >= 0) {
-          fl = dl + Math.sqrt(dl * dl - 1);
-        }
-        else {
-          fl = dl - Math.sqrt(dl * dl - 1);
-        }
-        this.el = fl * Math.pow(t0, this.bl);
-        gl = 0.5 * (fl - 1 / fl);
-        this.gamma0 = Math.asin(Math.sin(this.alpha) / dl);
-        this.long0 = this.longc - Math.asin(gl * Math.tan(this.gamma0)) / this.bl;
-
-      }
-      else {
-        //2 points method
-        var t1 = tsfnz(this.e, this.lat1, Math.sin(this.lat1));
-        var t2 = tsfnz(this.e, this.lat2, Math.sin(this.lat2));
-        if (this.lat0 >= 0) {
-          this.el = (dl + Math.sqrt(dl * dl - 1)) * Math.pow(t0, this.bl);
-        }
-        else {
-          this.el = (dl - Math.sqrt(dl * dl - 1)) * Math.pow(t0, this.bl);
-        }
-        var hl = Math.pow(t1, this.bl);
-        var ll = Math.pow(t2, this.bl);
-        fl = this.el / hl;
-        gl = 0.5 * (fl - 1 / fl);
-        var jl = (this.el * this.el - ll * hl) / (this.el * this.el + ll * hl);
-        var pl = (ll - hl) / (ll + hl);
-        var dlon12 = adjust_lon(this.long1 - this.long2);
-        this.long0 = 0.5 * (this.long1 + this.long2) - Math.atan(jl * Math.tan(0.5 * this.bl * (dlon12)) / pl) / this.bl;
-        this.long0 = adjust_lon(this.long0);
-        var dlon10 = adjust_lon(this.long1 - this.long0);
-        this.gamma0 = Math.atan(Math.sin(this.bl * (dlon10)) / gl);
-        this.alpha = Math.asin(dl * Math.sin(this.gamma0));
-      }
-
-      if (this.no_off) {
-        this.uc = 0;
-      }
-      else {
-        if (this.lat0 >= 0) {
-          this.uc = this.al / this.bl * Math.atan2(Math.sqrt(dl * dl - 1), Math.cos(this.alpha));
-        }
-        else {
-          this.uc = -1 * this.al / this.bl * Math.atan2(Math.sqrt(dl * dl - 1), Math.cos(this.alpha));
-        }
-      }
-
-    }
-
-    /* Oblique Mercator forward equations--mapping lat,long to x,y
-        ----------------------------------------------------------*/
-    function forward$8(p) {
-      var lon = p.x;
-      var lat = p.y;
-      var dlon = adjust_lon(lon - this.long0);
-      var us, vs;
-      var con;
-      if (Math.abs(Math.abs(lat) - HALF_PI) <= EPSLN) {
-        if (lat > 0) {
-          con = -1;
-        }
-        else {
-          con = 1;
-        }
-        vs = this.al / this.bl * Math.log(Math.tan(FORTPI + con * this.gamma0 * 0.5));
-        us = -1 * con * HALF_PI * this.al / this.bl;
-      }
-      else {
-        var t = tsfnz(this.e, lat, Math.sin(lat));
-        var ql = this.el / Math.pow(t, this.bl);
-        var sl = 0.5 * (ql - 1 / ql);
-        var tl = 0.5 * (ql + 1 / ql);
-        var vl = Math.sin(this.bl * (dlon));
-        var ul = (sl * Math.sin(this.gamma0) - vl * Math.cos(this.gamma0)) / tl;
-        if (Math.abs(Math.abs(ul) - 1) <= EPSLN) {
-          vs = Number.POSITIVE_INFINITY;
-        }
-        else {
-          vs = 0.5 * this.al * Math.log((1 - ul) / (1 + ul)) / this.bl;
-        }
-        if (Math.abs(Math.cos(this.bl * (dlon))) <= EPSLN) {
-          us = this.al * this.bl * (dlon);
-        }
-        else {
-          us = this.al * Math.atan2(sl * Math.cos(this.gamma0) + vl * Math.sin(this.gamma0), Math.cos(this.bl * dlon)) / this.bl;
-        }
-      }
-
-      if (this.no_rot) {
-        p.x = this.x0 + us;
-        p.y = this.y0 + vs;
-      }
-      else {
-
-        us -= this.uc;
-        p.x = this.x0 + vs * Math.cos(this.alpha) + us * Math.sin(this.alpha);
-        p.y = this.y0 + us * Math.cos(this.alpha) - vs * Math.sin(this.alpha);
-      }
-      return p;
-    }
-
-    function inverse$8(p) {
-      var us, vs;
-      if (this.no_rot) {
-        vs = p.y - this.y0;
-        us = p.x - this.x0;
-      }
-      else {
-        vs = (p.x - this.x0) * Math.cos(this.alpha) - (p.y - this.y0) * Math.sin(this.alpha);
-        us = (p.y - this.y0) * Math.cos(this.alpha) + (p.x - this.x0) * Math.sin(this.alpha);
-        us += this.uc;
-      }
-      var qp = Math.exp(-1 * this.bl * vs / this.al);
-      var sp = 0.5 * (qp - 1 / qp);
-      var tp = 0.5 * (qp + 1 / qp);
-      var vp = Math.sin(this.bl * us / this.al);
-      var up = (vp * Math.cos(this.gamma0) + sp * Math.sin(this.gamma0)) / tp;
-      var ts = Math.pow(this.el / Math.sqrt((1 + up) / (1 - up)), 1 / this.bl);
-      if (Math.abs(up - 1) < EPSLN) {
-        p.x = this.long0;
-        p.y = HALF_PI;
-      }
-      else if (Math.abs(up + 1) < EPSLN) {
-        p.x = this.long0;
-        p.y = -1 * HALF_PI;
-      }
-      else {
-        p.y = phi2z(this.e, ts);
-        p.x = adjust_lon(this.long0 - Math.atan2(sp * Math.cos(this.gamma0) - vp * Math.sin(this.gamma0), Math.cos(this.bl * us / this.al)) / this.bl);
-      }
-      return p;
-    }
-
-    var names$10 = ["Hotine_Oblique_Mercator", "Hotine Oblique Mercator", "Hotine_Oblique_Mercator_Azimuth_Natural_Origin", "Hotine_Oblique_Mercator_Azimuth_Center", "omerc"];
-    var omerc = {
-      init: init$9,
-      forward: forward$8,
-      inverse: inverse$8,
-      names: names$10
-    };
-
-    function init$10() {
-
-      // array of:  r_maj,r_min,lat1,lat2,c_lon,c_lat,false_east,false_north
-      //double c_lat;                   /* center latitude                      */
-      //double c_lon;                   /* center longitude                     */
-      //double lat1;                    /* first standard parallel              */
-      //double lat2;                    /* second standard parallel             */
-      //double r_maj;                   /* major axis                           */
-      //double r_min;                   /* minor axis                           */
-      //double false_east;              /* x offset in meters                   */
-      //double false_north;             /* y offset in meters                   */
-
-      if (!this.lat2) {
-        this.lat2 = this.lat1;
-      } //if lat2 is not defined
-      if (!this.k0) {
-        this.k0 = 1;
-      }
-      this.x0 = this.x0 || 0;
-      this.y0 = this.y0 || 0;
-      // Standard Parallels cannot be equal and on opposite sides of the equator
-      if (Math.abs(this.lat1 + this.lat2) < EPSLN) {
-        return;
-      }
-
-      var temp = this.b / this.a;
-      this.e = Math.sqrt(1 - temp * temp);
-
-      var sin1 = Math.sin(this.lat1);
-      var cos1 = Math.cos(this.lat1);
-      var ms1 = msfnz(this.e, sin1, cos1);
-      var ts1 = tsfnz(this.e, this.lat1, sin1);
-
-      var sin2 = Math.sin(this.lat2);
-      var cos2 = Math.cos(this.lat2);
-      var ms2 = msfnz(this.e, sin2, cos2);
-      var ts2 = tsfnz(this.e, this.lat2, sin2);
-
-      var ts0 = tsfnz(this.e, this.lat0, Math.sin(this.lat0));
-
-      if (Math.abs(this.lat1 - this.lat2) > EPSLN) {
-        this.ns = Math.log(ms1 / ms2) / Math.log(ts1 / ts2);
-      }
-      else {
-        this.ns = sin1;
-      }
-      if (isNaN(this.ns)) {
-        this.ns = sin1;
-      }
-      this.f0 = ms1 / (this.ns * Math.pow(ts1, this.ns));
-      this.rh = this.a * this.f0 * Math.pow(ts0, this.ns);
-      if (!this.title) {
-        this.title = "Lambert Conformal Conic";
-      }
-    }
-
-    // Lambert Conformal conic forward equations--mapping lat,long to x,y
-    // -----------------------------------------------------------------
-    function forward$9(p) {
-
-      var lon = p.x;
-      var lat = p.y;
-
-      // singular cases :
-      if (Math.abs(2 * Math.abs(lat) - Math.PI) <= EPSLN) {
-        lat = sign(lat) * (HALF_PI - 2 * EPSLN);
-      }
-
-      var con = Math.abs(Math.abs(lat) - HALF_PI);
-      var ts, rh1;
-      if (con > EPSLN) {
-        ts = tsfnz(this.e, lat, Math.sin(lat));
-        rh1 = this.a * this.f0 * Math.pow(ts, this.ns);
-      }
-      else {
-        con = lat * this.ns;
-        if (con <= 0) {
-          return null;
-        }
-        rh1 = 0;
-      }
-      var theta = this.ns * adjust_lon(lon - this.long0);
-      p.x = this.k0 * (rh1 * Math.sin(theta)) + this.x0;
-      p.y = this.k0 * (this.rh - rh1 * Math.cos(theta)) + this.y0;
-
-      return p;
-    }
-
-    // Lambert Conformal Conic inverse equations--mapping x,y to lat/long
-    // -----------------------------------------------------------------
-    function inverse$9(p) {
-
-      var rh1, con, ts;
-      var lat, lon;
-      var x = (p.x - this.x0) / this.k0;
-      var y = (this.rh - (p.y - this.y0) / this.k0);
-      if (this.ns > 0) {
-        rh1 = Math.sqrt(x * x + y * y);
-        con = 1;
-      }
-      else {
-        rh1 = -Math.sqrt(x * x + y * y);
-        con = -1;
-      }
-      var theta = 0;
-      if (rh1 !== 0) {
-        theta = Math.atan2((con * x), (con * y));
-      }
-      if ((rh1 !== 0) || (this.ns > 0)) {
-        con = 1 / this.ns;
-        ts = Math.pow((rh1 / (this.a * this.f0)), con);
-        lat = phi2z(this.e, ts);
-        if (lat === -9999) {
-          return null;
-        }
-      }
-      else {
-        lat = -HALF_PI;
-      }
-      lon = adjust_lon(theta / this.ns + this.long0);
-
-      p.x = lon;
-      p.y = lat;
-      return p;
-    }
-
-    var names$11 = ["Lambert Tangential Conformal Conic Projection", "Lambert_Conformal_Conic", "Lambert_Conformal_Conic_2SP", "lcc"];
-    var lcc = {
-      init: init$10,
-      forward: forward$9,
-      inverse: inverse$9,
-      names: names$11
-    };
-
-    function init$11() {
-      this.a = 6377397.155;
-      this.es = 0.006674372230614;
-      this.e = Math.sqrt(this.es);
-      if (!this.lat0) {
-        this.lat0 = 0.863937979737193;
-      }
-      if (!this.long0) {
-        this.long0 = 0.7417649320975901 - 0.308341501185665;
-      }
-      /* if scale not set default to 0.9999 */
-      if (!this.k0) {
-        this.k0 = 0.9999;
-      }
-      this.s45 = 0.785398163397448; /* 45 */
-      this.s90 = 2 * this.s45;
-      this.fi0 = this.lat0;
-      this.e2 = this.es;
-      this.e = Math.sqrt(this.e2);
-      this.alfa = Math.sqrt(1 + (this.e2 * Math.pow(Math.cos(this.fi0), 4)) / (1 - this.e2));
-      this.uq = 1.04216856380474;
-      this.u0 = Math.asin(Math.sin(this.fi0) / this.alfa);
-      this.g = Math.pow((1 + this.e * Math.sin(this.fi0)) / (1 - this.e * Math.sin(this.fi0)), this.alfa * this.e / 2);
-      this.k = Math.tan(this.u0 / 2 + this.s45) / Math.pow(Math.tan(this.fi0 / 2 + this.s45), this.alfa) * this.g;
-      this.k1 = this.k0;
-      this.n0 = this.a * Math.sqrt(1 - this.e2) / (1 - this.e2 * Math.pow(Math.sin(this.fi0), 2));
-      this.s0 = 1.37008346281555;
-      this.n = Math.sin(this.s0);
-      this.ro0 = this.k1 * this.n0 / Math.tan(this.s0);
-      this.ad = this.s90 - this.uq;
-    }
-
-    /* ellipsoid */
-    /* calculate xy from lat/lon */
-    /* Constants, identical to inverse transform function */
-    function forward$10(p) {
-      var gfi, u, deltav, s, d, eps, ro;
-      var lon = p.x;
-      var lat = p.y;
-      var delta_lon = adjust_lon(lon - this.long0);
-      /* Transformation */
-      gfi = Math.pow(((1 + this.e * Math.sin(lat)) / (1 - this.e * Math.sin(lat))), (this.alfa * this.e / 2));
-      u = 2 * (Math.atan(this.k * Math.pow(Math.tan(lat / 2 + this.s45), this.alfa) / gfi) - this.s45);
-      deltav = -delta_lon * this.alfa;
-      s = Math.asin(Math.cos(this.ad) * Math.sin(u) + Math.sin(this.ad) * Math.cos(u) * Math.cos(deltav));
-      d = Math.asin(Math.cos(u) * Math.sin(deltav) / Math.cos(s));
-      eps = this.n * d;
-      ro = this.ro0 * Math.pow(Math.tan(this.s0 / 2 + this.s45), this.n) / Math.pow(Math.tan(s / 2 + this.s45), this.n);
-      p.y = ro * Math.cos(eps) / 1;
-      p.x = ro * Math.sin(eps) / 1;
-
-      if (!this.czech) {
-        p.y *= -1;
-        p.x *= -1;
-      }
-      return (p);
-    }
-
-    /* calculate lat/lon from xy */
-    function inverse$10(p) {
-      var u, deltav, s, d, eps, ro, fi1;
-      var ok;
-
-      /* Transformation */
-      /* revert y, x*/
-      var tmp = p.x;
-      p.x = p.y;
-      p.y = tmp;
-      if (!this.czech) {
-        p.y *= -1;
-        p.x *= -1;
-      }
-      ro = Math.sqrt(p.x * p.x + p.y * p.y);
-      eps = Math.atan2(p.y, p.x);
-      d = eps / Math.sin(this.s0);
-      s = 2 * (Math.atan(Math.pow(this.ro0 / ro, 1 / this.n) * Math.tan(this.s0 / 2 + this.s45)) - this.s45);
-      u = Math.asin(Math.cos(this.ad) * Math.sin(s) - Math.sin(this.ad) * Math.cos(s) * Math.cos(d));
-      deltav = Math.asin(Math.cos(s) * Math.sin(d) / Math.cos(u));
-      p.x = this.long0 - deltav / this.alfa;
-      fi1 = u;
-      ok = 0;
-      var iter = 0;
-      do {
-        p.y = 2 * (Math.atan(Math.pow(this.k, - 1 / this.alfa) * Math.pow(Math.tan(u / 2 + this.s45), 1 / this.alfa) * Math.pow((1 + this.e * Math.sin(fi1)) / (1 - this.e * Math.sin(fi1)), this.e / 2)) - this.s45);
-        if (Math.abs(fi1 - p.y) < 0.0000000001) {
-          ok = 1;
-        }
-        fi1 = p.y;
-        iter += 1;
-      } while (ok === 0 && iter < 15);
-      if (iter >= 15) {
-        return null;
-      }
-
-      return (p);
-    }
-
-    var names$12 = ["Krovak", "krovak"];
-    var krovak = {
-      init: init$11,
-      forward: forward$10,
-      inverse: inverse$10,
-      names: names$12
-    };
-
-    var mlfn = function(e0, e1, e2, e3, phi) {
-      return (e0 * phi - e1 * Math.sin(2 * phi) + e2 * Math.sin(4 * phi) - e3 * Math.sin(6 * phi));
-    };
-
-    var e0fn = function(x) {
-      return (1 - 0.25 * x * (1 + x / 16 * (3 + 1.25 * x)));
-    };
-
-    var e1fn = function(x) {
-      return (0.375 * x * (1 + 0.25 * x * (1 + 0.46875 * x)));
-    };
-
-    var e2fn = function(x) {
-      return (0.05859375 * x * x * (1 + 0.75 * x));
-    };
-
-    var e3fn = function(x) {
-      return (x * x * x * (35 / 3072));
-    };
-
-    var gN = function(a, e, sinphi) {
-      var temp = e * sinphi;
-      return a / Math.sqrt(1 - temp * temp);
-    };
-
-    var adjust_lat = function(x) {
-      return (Math.abs(x) < HALF_PI) ? x : (x - (sign(x) * Math.PI));
-    };
-
-    var imlfn = function(ml, e0, e1, e2, e3) {
-      var phi;
-      var dphi;
-
-      phi = ml / e0;
-      for (var i = 0; i < 15; i++) {
-        dphi = (ml - (e0 * phi - e1 * Math.sin(2 * phi) + e2 * Math.sin(4 * phi) - e3 * Math.sin(6 * phi))) / (e0 - 2 * e1 * Math.cos(2 * phi) + 4 * e2 * Math.cos(4 * phi) - 6 * e3 * Math.cos(6 * phi));
-        phi += dphi;
-        if (Math.abs(dphi) <= 0.0000000001) {
-          return phi;
-        }
-      }
-
-      //..reportError("IMLFN-CONV:Latitude failed to converge after 15 iterations");
-      return NaN;
-    };
-
-    function init$12() {
-      if (!this.sphere) {
-        this.e0 = e0fn(this.es);
-        this.e1 = e1fn(this.es);
-        this.e2 = e2fn(this.es);
-        this.e3 = e3fn(this.es);
-        this.ml0 = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, this.lat0);
-      }
-    }
-
-    /* Cassini forward equations--mapping lat,long to x,y
-      -----------------------------------------------------------------------*/
-    function forward$11(p) {
-
-      /* Forward equations
-          -----------------*/
-      var x, y;
-      var lam = p.x;
-      var phi = p.y;
-      lam = adjust_lon(lam - this.long0);
-
-      if (this.sphere) {
-        x = this.a * Math.asin(Math.cos(phi) * Math.sin(lam));
-        y = this.a * (Math.atan2(Math.tan(phi), Math.cos(lam)) - this.lat0);
-      }
-      else {
-        //ellipsoid
-        var sinphi = Math.sin(phi);
-        var cosphi = Math.cos(phi);
-        var nl = gN(this.a, this.e, sinphi);
-        var tl = Math.tan(phi) * Math.tan(phi);
-        var al = lam * Math.cos(phi);
-        var asq = al * al;
-        var cl = this.es * cosphi * cosphi / (1 - this.es);
-        var ml = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, phi);
-
-        x = nl * al * (1 - asq * tl * (1 / 6 - (8 - tl + 8 * cl) * asq / 120));
-        y = ml - this.ml0 + nl * sinphi / cosphi * asq * (0.5 + (5 - tl + 6 * cl) * asq / 24);
-
-
-      }
-
-      p.x = x + this.x0;
-      p.y = y + this.y0;
-      return p;
-    }
-
-    /* Inverse equations
-      -----------------*/
-    function inverse$11(p) {
-      p.x -= this.x0;
-      p.y -= this.y0;
-      var x = p.x / this.a;
-      var y = p.y / this.a;
-      var phi, lam;
-
-      if (this.sphere) {
-        var dd = y + this.lat0;
-        phi = Math.asin(Math.sin(dd) * Math.cos(x));
-        lam = Math.atan2(Math.tan(x), Math.cos(dd));
-      }
-      else {
-        /* ellipsoid */
-        var ml1 = this.ml0 / this.a + y;
-        var phi1 = imlfn(ml1, this.e0, this.e1, this.e2, this.e3);
-        if (Math.abs(Math.abs(phi1) - HALF_PI) <= EPSLN) {
-          p.x = this.long0;
-          p.y = HALF_PI;
-          if (y < 0) {
-            p.y *= -1;
-          }
-          return p;
-        }
-        var nl1 = gN(this.a, this.e, Math.sin(phi1));
-
-        var rl1 = nl1 * nl1 * nl1 / this.a / this.a * (1 - this.es);
-        var tl1 = Math.pow(Math.tan(phi1), 2);
-        var dl = x * this.a / nl1;
-        var dsq = dl * dl;
-        phi = phi1 - nl1 * Math.tan(phi1) / rl1 * dl * dl * (0.5 - (1 + 3 * tl1) * dl * dl / 24);
-        lam = dl * (1 - dsq * (tl1 / 3 + (1 + 3 * tl1) * tl1 * dsq / 15)) / Math.cos(phi1);
-
-      }
-
-      p.x = adjust_lon(lam + this.long0);
-      p.y = adjust_lat(phi);
-      return p;
-
-    }
-
-    var names$13 = ["Cassini", "Cassini_Soldner", "cass"];
-    var cass = {
-      init: init$12,
-      forward: forward$11,
-      inverse: inverse$11,
-      names: names$13
-    };
-
-    var qsfnz = function(eccent, sinphi) {
-      var con;
-      if (eccent > 1.0e-7) {
-        con = eccent * sinphi;
-        return ((1 - eccent * eccent) * (sinphi / (1 - con * con) - (0.5 / eccent) * Math.log((1 - con) / (1 + con))));
-      }
-      else {
-        return (2 * sinphi);
-      }
-    };
-
-    /*
-      reference
-        "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder,
-        The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355.
-      */
-
-    var S_POLE = 1;
-
-    var N_POLE = 2;
-    var EQUIT = 3;
-    var OBLIQ = 4;
-
-    /* Initialize the Lambert Azimuthal Equal Area projection
-      ------------------------------------------------------*/
-    function init$13() {
-      var t = Math.abs(this.lat0);
-      if (Math.abs(t - HALF_PI) < EPSLN) {
-        this.mode = this.lat0 < 0 ? this.S_POLE : this.N_POLE;
-      }
-      else if (Math.abs(t) < EPSLN) {
-        this.mode = this.EQUIT;
-      }
-      else {
-        this.mode = this.OBLIQ;
-      }
-      if (this.es > 0) {
-        var sinphi;
-
-        this.qp = qsfnz(this.e, 1);
-        this.mmf = 0.5 / (1 - this.es);
-        this.apa = authset(this.es);
-        switch (this.mode) {
-        case this.N_POLE:
-          this.dd = 1;
-          break;
-        case this.S_POLE:
-          this.dd = 1;
-          break;
-        case this.EQUIT:
-          this.rq = Math.sqrt(0.5 * this.qp);
-          this.dd = 1 / this.rq;
-          this.xmf = 1;
-          this.ymf = 0.5 * this.qp;
-          break;
-        case this.OBLIQ:
-          this.rq = Math.sqrt(0.5 * this.qp);
-          sinphi = Math.sin(this.lat0);
-          this.sinb1 = qsfnz(this.e, sinphi) / this.qp;
-          this.cosb1 = Math.sqrt(1 - this.sinb1 * this.sinb1);
-          this.dd = Math.cos(this.lat0) / (Math.sqrt(1 - this.es * sinphi * sinphi) * this.rq * this.cosb1);
-          this.ymf = (this.xmf = this.rq) / this.dd;
-          this.xmf *= this.dd;
-          break;
-        }
-      }
-      else {
-        if (this.mode === this.OBLIQ) {
-          this.sinph0 = Math.sin(this.lat0);
-          this.cosph0 = Math.cos(this.lat0);
-        }
-      }
-    }
-
-    /* Lambert Azimuthal Equal Area forward equations--mapping lat,long to x,y
-      -----------------------------------------------------------------------*/
-    function forward$12(p) {
-
-      /* Forward equations
-          -----------------*/
-      var x, y, coslam, sinlam, sinphi, q, sinb, cosb, b, cosphi;
-      var lam = p.x;
-      var phi = p.y;
-
-      lam = adjust_lon(lam - this.long0);
-      if (this.sphere) {
-        sinphi = Math.sin(phi);
-        cosphi = Math.cos(phi);
-        coslam = Math.cos(lam);
-        if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
-          y = (this.mode === this.EQUIT) ? 1 + cosphi * coslam : 1 + this.sinph0 * sinphi + this.cosph0 * cosphi * coslam;
-          if (y <= EPSLN) {
-            return null;
-          }
-          y = Math.sqrt(2 / y);
-          x = y * cosphi * Math.sin(lam);
-          y *= (this.mode === this.EQUIT) ? sinphi : this.cosph0 * sinphi - this.sinph0 * cosphi * coslam;
-        }
-        else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {
-          if (this.mode === this.N_POLE) {
-            coslam = -coslam;
-          }
-          if (Math.abs(phi + this.lat0) < EPSLN) {
-            return null;
-          }
-          y = FORTPI - phi * 0.5;
-          y = 2 * ((this.mode === this.S_POLE) ? Math.cos(y) : Math.sin(y));
-          x = y * Math.sin(lam);
-          y *= coslam;
-        }
-      }
-      else {
-        sinb = 0;
-        cosb = 0;
-        b = 0;
-        coslam = Math.cos(lam);
-        sinlam = Math.sin(lam);
-        sinphi = Math.sin(phi);
-        q = qsfnz(this.e, sinphi);
-        if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
-          sinb = q / this.qp;
-          cosb = Math.sqrt(1 - sinb * sinb);
-        }
-        switch (this.mode) {
-        case this.OBLIQ:
-          b = 1 + this.sinb1 * sinb + this.cosb1 * cosb * coslam;
-          break;
-        case this.EQUIT:
-          b = 1 + cosb * coslam;
-          break;
-        case this.N_POLE:
-          b = HALF_PI + phi;
-          q = this.qp - q;
-          break;
-        case this.S_POLE:
-          b = phi - HALF_PI;
-          q = this.qp + q;
-          break;
-        }
-        if (Math.abs(b) < EPSLN) {
-          return null;
-        }
-        switch (this.mode) {
-        case this.OBLIQ:
-        case this.EQUIT:
-          b = Math.sqrt(2 / b);
-          if (this.mode === this.OBLIQ) {
-            y = this.ymf * b * (this.cosb1 * sinb - this.sinb1 * cosb * coslam);
-          }
-          else {
-            y = (b = Math.sqrt(2 / (1 + cosb * coslam))) * sinb * this.ymf;
-          }
-          x = this.xmf * b * cosb * sinlam;
-          break;
-        case this.N_POLE:
-        case this.S_POLE:
-          if (q >= 0) {
-            x = (b = Math.sqrt(q)) * sinlam;
-            y = coslam * ((this.mode === this.S_POLE) ? b : -b);
-          }
-          else {
-            x = y = 0;
-          }
-          break;
-        }
-      }
-
-      p.x = this.a * x + this.x0;
-      p.y = this.a * y + this.y0;
-      return p;
-    }
-
-    /* Inverse equations
-      -----------------*/
-    function inverse$12(p) {
-      p.x -= this.x0;
-      p.y -= this.y0;
-      var x = p.x / this.a;
-      var y = p.y / this.a;
-      var lam, phi, cCe, sCe, q, rho, ab;
-      if (this.sphere) {
-        var cosz = 0,
-          rh, sinz = 0;
-
-        rh = Math.sqrt(x * x + y * y);
-        phi = rh * 0.5;
-        if (phi > 1) {
-          return null;
-        }
-        phi = 2 * Math.asin(phi);
-        if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
-          sinz = Math.sin(phi);
-          cosz = Math.cos(phi);
-        }
-        switch (this.mode) {
-        case this.EQUIT:
-          phi = (Math.abs(rh) <= EPSLN) ? 0 : Math.asin(y * sinz / rh);
-          x *= sinz;
-          y = cosz * rh;
-          break;
-        case this.OBLIQ:
-          phi = (Math.abs(rh) <= EPSLN) ? this.lat0 : Math.asin(cosz * this.sinph0 + y * sinz * this.cosph0 / rh);
-          x *= sinz * this.cosph0;
-          y = (cosz - Math.sin(phi) * this.sinph0) * rh;
-          break;
-        case this.N_POLE:
-          y = -y;
-          phi = HALF_PI - phi;
-          break;
-        case this.S_POLE:
-          phi -= HALF_PI;
-          break;
-        }
-        lam = (y === 0 && (this.mode === this.EQUIT || this.mode === this.OBLIQ)) ? 0 : Math.atan2(x, y);
-      }
-      else {
-        ab = 0;
-        if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
-          x /= this.dd;
-          y *= this.dd;
-          rho = Math.sqrt(x * x + y * y);
-          if (rho < EPSLN) {
-            p.x = this.long0;
-            p.y = this.lat0;
-            return p;
-          }
-          sCe = 2 * Math.asin(0.5 * rho / this.rq);
-          cCe = Math.cos(sCe);
-          x *= (sCe = Math.sin(sCe));
-          if (this.mode === this.OBLIQ) {
-            ab = cCe * this.sinb1 + y * sCe * this.cosb1 / rho;
-            q = this.qp * ab;
-            y = rho * this.cosb1 * cCe - y * this.sinb1 * sCe;
-          }
-          else {
-            ab = y * sCe / rho;
-            q = this.qp * ab;
-            y = rho * cCe;
-          }
-        }
-        else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {
-          if (this.mode === this.N_POLE) {
-            y = -y;
-          }
-          q = (x * x + y * y);
-          if (!q) {
-            p.x = this.long0;
-            p.y = this.lat0;
-            return p;
-          }
-          ab = 1 - q / this.qp;
-          if (this.mode === this.S_POLE) {
-            ab = -ab;
-          }
-        }
-        lam = Math.atan2(x, y);
-        phi = authlat(Math.asin(ab), this.apa);
-      }
-
-      p.x = adjust_lon(this.long0 + lam);
-      p.y = phi;
-      return p;
-    }
-
-    /* determine latitude from authalic latitude */
-    var P00 = 0.33333333333333333333;
-
-    var P01 = 0.17222222222222222222;
-    var P02 = 0.10257936507936507936;
-    var P10 = 0.06388888888888888888;
-    var P11 = 0.06640211640211640211;
-    var P20 = 0.01641501294219154443;
-
-    function authset(es) {
-      var t;
-      var APA = [];
-      APA[0] = es * P00;
-      t = es * es;
-      APA[0] += t * P01;
-      APA[1] = t * P10;
-      t *= es;
-      APA[0] += t * P02;
-      APA[1] += t * P11;
-      APA[2] = t * P20;
-      return APA;
-    }
-
-    function authlat(beta, APA) {
-      var t = beta + beta;
-      return (beta + APA[0] * Math.sin(t) + APA[1] * Math.sin(t + t) + APA[2] * Math.sin(t + t + t));
-    }
-
-    var names$14 = ["Lambert Azimuthal Equal Area", "Lambert_Azimuthal_Equal_Area", "laea"];
-    var laea = {
-      init: init$13,
-      forward: forward$12,
-      inverse: inverse$12,
-      names: names$14,
-      S_POLE: S_POLE,
-      N_POLE: N_POLE,
-      EQUIT: EQUIT,
-      OBLIQ: OBLIQ
-    };
-
-    var asinz = function(x) {
-      if (Math.abs(x) > 1) {
-        x = (x > 1) ? 1 : -1;
-      }
-      return Math.asin(x);
-    };
-
-    function init$14() {
-
-      if (Math.abs(this.lat1 + this.lat2) < EPSLN) {
-        return;
-      }
-      this.temp = this.b / this.a;
-      this.es = 1 - Math.pow(this.temp, 2);
-      this.e3 = Math.sqrt(this.es);
-
-      this.sin_po = Math.sin(this.lat1);
-      this.cos_po = Math.cos(this.lat1);
-      this.t1 = this.sin_po;
-      this.con = this.sin_po;
-      this.ms1 = msfnz(this.e3, this.sin_po, this.cos_po);
-      this.qs1 = qsfnz(this.e3, this.sin_po, this.cos_po);
-
-      this.sin_po = Math.sin(this.lat2);
-      this.cos_po = Math.cos(this.lat2);
-      this.t2 = this.sin_po;
-      this.ms2 = msfnz(this.e3, this.sin_po, this.cos_po);
-      this.qs2 = qsfnz(this.e3, this.sin_po, this.cos_po);
-
-      this.sin_po = Math.sin(this.lat0);
-      this.cos_po = Math.cos(this.lat0);
-      this.t3 = this.sin_po;
-      this.qs0 = qsfnz(this.e3, this.sin_po, this.cos_po);
-
-      if (Math.abs(this.lat1 - this.lat2) > EPSLN) {
-        this.ns0 = (this.ms1 * this.ms1 - this.ms2 * this.ms2) / (this.qs2 - this.qs1);
-      }
-      else {
-        this.ns0 = this.con;
-      }
-      this.c = this.ms1 * this.ms1 + this.ns0 * this.qs1;
-      this.rh = this.a * Math.sqrt(this.c - this.ns0 * this.qs0) / this.ns0;
-    }
-
-    /* Albers Conical Equal Area forward equations--mapping lat,long to x,y
-      -------------------------------------------------------------------*/
-    function forward$13(p) {
-
-      var lon = p.x;
-      var lat = p.y;
-
-      this.sin_phi = Math.sin(lat);
-      this.cos_phi = Math.cos(lat);
-
-      var qs = qsfnz(this.e3, this.sin_phi, this.cos_phi);
-      var rh1 = this.a * Math.sqrt(this.c - this.ns0 * qs) / this.ns0;
-      var theta = this.ns0 * adjust_lon(lon - this.long0);
-      var x = rh1 * Math.sin(theta) + this.x0;
-      var y = this.rh - rh1 * Math.cos(theta) + this.y0;
-
-      p.x = x;
-      p.y = y;
-      return p;
-    }
-
-    function inverse$13(p) {
-      var rh1, qs, con, theta, lon, lat;
-
-      p.x -= this.x0;
-      p.y = this.rh - p.y + this.y0;
-      if (this.ns0 >= 0) {
-        rh1 = Math.sqrt(p.x * p.x + p.y * p.y);
-        con = 1;
-      }
-      else {
-        rh1 = -Math.sqrt(p.x * p.x + p.y * p.y);
-        con = -1;
-      }
-      theta = 0;
-      if (rh1 !== 0) {
-        theta = Math.atan2(con * p.x, con * p.y);
-      }
-      con = rh1 * this.ns0 / this.a;
-      if (this.sphere) {
-        lat = Math.asin((this.c - con * con) / (2 * this.ns0));
-      }
-      else {
-        qs = (this.c - con * con) / this.ns0;
-        lat = this.phi1z(this.e3, qs);
-      }
-
-      lon = adjust_lon(theta / this.ns0 + this.long0);
-      p.x = lon;
-      p.y = lat;
-      return p;
-    }
-
-    /* Function to compute phi1, the latitude for the inverse of the
-       Albers Conical Equal-Area projection.
-    -------------------------------------------*/
-    function phi1z(eccent, qs) {
-      var sinphi, cosphi, con, com, dphi;
-      var phi = asinz(0.5 * qs);
-      if (eccent < EPSLN) {
-        return phi;
-      }
-
-      var eccnts = eccent * eccent;
-      for (var i = 1; i <= 25; i++) {
-        sinphi = Math.sin(phi);
-        cosphi = Math.cos(phi);
-        con = eccent * sinphi;
-        com = 1 - con * con;
-        dphi = 0.5 * com * com / cosphi * (qs / (1 - eccnts) - sinphi / com + 0.5 / eccent * Math.log((1 - con) / (1 + con)));
-        phi = phi + dphi;
-        if (Math.abs(dphi) <= 1e-7) {
-          return phi;
-        }
-      }
-      return null;
-    }
-
-    var names$15 = ["Albers_Conic_Equal_Area", "Albers", "aea"];
-    var aea = {
-      init: init$14,
-      forward: forward$13,
-      inverse: inverse$13,
-      names: names$15,
-      phi1z: phi1z
-    };
-
-    /*
-      reference:
-        Wolfram Mathworld "Gnomonic Projection"
-        http://mathworld.wolfram.com/GnomonicProjection.html
-        Accessed: 12th November 2009
-      */
-    function init$15() {
-
-      /* Place parameters in static storage for common use
-          -------------------------------------------------*/
-      this.sin_p14 = Math.sin(this.lat0);
-      this.cos_p14 = Math.cos(this.lat0);
-      // Approximation for projecting points to the horizon (infinity)
-      this.infinity_dist = 1000 * this.a;
-      this.rc = 1;
-    }
-
-    /* Gnomonic forward equations--mapping lat,long to x,y
-        ---------------------------------------------------*/
-    function forward$14(p) {
-      var sinphi, cosphi; /* sin and cos value        */
-      var dlon; /* delta longitude value      */
-      var coslon; /* cos of longitude        */
-      var ksp; /* scale factor          */
-      var g;
-      var x, y;
-      var lon = p.x;
-      var lat = p.y;
-      /* Forward equations
-          -----------------*/
-      dlon = adjust_lon(lon - this.long0);
-
-      sinphi = Math.sin(lat);
-      cosphi = Math.cos(lat);
-
-      coslon = Math.cos(dlon);
-      g = this.sin_p14 * sinphi + this.cos_p14 * cosphi * coslon;
-      ksp = 1;
-      if ((g > 0) || (Math.abs(g) <= EPSLN)) {
-        x = this.x0 + this.a * ksp * cosphi * Math.sin(dlon) / g;
-        y = this.y0 + this.a * ksp * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon) / g;
-      }
-      else {
-
-        // Point is in the opposing hemisphere and is unprojectable
-        // We still need to return a reasonable point, so we project
-        // to infinity, on a bearing
-        // equivalent to the northern hemisphere equivalent
-        // This is a reasonable approximation for short shapes and lines that
-        // straddle the horizon.
-
-        x = this.x0 + this.infinity_dist * cosphi * Math.sin(dlon);
-        y = this.y0 + this.infinity_dist * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon);
-
-      }
-      p.x = x;
-      p.y = y;
-      return p;
-    }
-
-    function inverse$14(p) {
-      var rh; /* Rho */
-      var sinc, cosc;
-      var c;
-      var lon, lat;
-
-      /* Inverse equations
-          -----------------*/
-      p.x = (p.x - this.x0) / this.a;
-      p.y = (p.y - this.y0) / this.a;
-
-      p.x /= this.k0;
-      p.y /= this.k0;
-
-      if ((rh = Math.sqrt(p.x * p.x + p.y * p.y))) {
-        c = Math.atan2(rh, this.rc);
-        sinc = Math.sin(c);
-        cosc = Math.cos(c);
-
-        lat = asinz(cosc * this.sin_p14 + (p.y * sinc * this.cos_p14) / rh);
-        lon = Math.atan2(p.x * sinc, rh * this.cos_p14 * cosc - p.y * this.sin_p14 * sinc);
-        lon = adjust_lon(this.long0 + lon);
-      }
-      else {
-        lat = this.phic0;
-        lon = 0;
-      }
-
-      p.x = lon;
-      p.y = lat;
-      return p;
-    }
-
-    var names$16 = ["gnom"];
-    var gnom = {
-      init: init$15,
-      forward: forward$14,
-      inverse: inverse$14,
-      names: names$16
-    };
-
-    var iqsfnz = function(eccent, q) {
-      var temp = 1 - (1 - eccent * eccent) / (2 * eccent) * Math.log((1 - eccent) / (1 + eccent));
-      if (Math.abs(Math.abs(q) - temp) < 1.0E-6) {
-        if (q < 0) {
-          return (-1 * HALF_PI);
-        }
-        else {
-          return HALF_PI;
-        }
-      }
-      //var phi = 0.5* q/(1-eccent*eccent);
-      var phi = Math.asin(0.5 * q);
-      var dphi;
-      var sin_phi;
-      var cos_phi;
-      var con;
-      for (var i = 0; i < 30; i++) {
-        sin_phi = Math.sin(phi);
-        cos_phi = Math.cos(phi);
-        con = eccent * sin_phi;
-        dphi = Math.pow(1 - con * con, 2) / (2 * cos_phi) * (q / (1 - eccent * eccent) - sin_phi / (1 - con * con) + 0.5 / eccent * Math.log((1 - con) / (1 + con)));
-        phi += dphi;
-        if (Math.abs(dphi) <= 0.0000000001) {
-          return phi;
-        }
-      }
-
-      //console.log("IQSFN-CONV:Latitude failed to converge after 30 iterations");
-      return NaN;
-    };
-
-    /*
-      reference:
-        "Cartographic Projection Procedures for the UNIX Environment-
-        A User's Manual" by Gerald I. Evenden,
-        USGS Open File Report 90-284and Release 4 Interim Reports (2003)
-    */
-    function init$16() {
-      //no-op
-      if (!this.sphere) {
-        this.k0 = msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts));
-      }
-    }
-
-    /* Cylindrical Equal Area forward equations--mapping lat,long to x,y
-        ------------------------------------------------------------*/
-    function forward$15(p) {
-      var lon = p.x;
-      var lat = p.y;
-      var x, y;
-      /* Forward equations
-          -----------------*/
-      var dlon = adjust_lon(lon - this.long0);
-      if (this.sphere) {
-        x = this.x0 + this.a * dlon * Math.cos(this.lat_ts);
-        y = this.y0 + this.a * Math.sin(lat) / Math.cos(this.lat_ts);
-      }
-      else {
-        var qs = qsfnz(this.e, Math.sin(lat));
-        x = this.x0 + this.a * this.k0 * dlon;
-        y = this.y0 + this.a * qs * 0.5 / this.k0;
-      }
-
-      p.x = x;
-      p.y = y;
-      return p;
-    }
-
-    /* Cylindrical Equal Area inverse equations--mapping x,y to lat/long
-        ------------------------------------------------------------*/
-    function inverse$15(p) {
-      p.x -= this.x0;
-      p.y -= this.y0;
-      var lon, lat;
-
-      if (this.sphere) {
-        lon = adjust_lon(this.long0 + (p.x / this.a) / Math.cos(this.lat_ts));
-        lat = Math.asin((p.y / this.a) * Math.cos(this.lat_ts));
-      }
-      else {
-        lat = iqsfnz(this.e, 2 * p.y * this.k0 / this.a);
-        lon = adjust_lon(this.long0 + p.x / (this.a * this.k0));
-      }
-
-      p.x = lon;
-      p.y = lat;
-      return p;
-    }
-
-    var names$17 = ["cea"];
-    var cea = {
-      init: init$16,
-      forward: forward$15,
-      inverse: inverse$15,
-      names: names$17
-    };
-
-    function init$17() {
-
-      this.x0 = this.x0 || 0;
-      this.y0 = this.y0 || 0;
-      this.lat0 = this.lat0 || 0;
-      this.long0 = this.long0 || 0;
-      this.lat_ts = this.lat_ts || 0;
-      this.title = this.title || "Equidistant Cylindrical (Plate Carre)";
-
-      this.rc = Math.cos(this.lat_ts);
-    }
-
-    // forward equations--mapping lat,long to x,y
-    // -----------------------------------------------------------------
-    function forward$16(p) {
-
-      var lon = p.x;
-      var lat = p.y;
-
-      var dlon = adjust_lon(lon - this.long0);
-      var dlat = adjust_lat(lat - this.lat0);
-      p.x = this.x0 + (this.a * dlon * this.rc);
-      p.y = this.y0 + (this.a * dlat);
-      return p;
-    }
-
-    // inverse equations--mapping x,y to lat/long
-    // -----------------------------------------------------------------
-    function inverse$16(p) {
-
-      var x = p.x;
-      var y = p.y;
-
-      p.x = adjust_lon(this.long0 + ((x - this.x0) / (this.a * this.rc)));
-      p.y = adjust_lat(this.lat0 + ((y - this.y0) / (this.a)));
-      return p;
-    }
-
-    var names$18 = ["Equirectangular", "Equidistant_Cylindrical", "eqc"];
-    var eqc = {
-      init: init$17,
-      forward: forward$16,
-      inverse: inverse$16,
-      names: names$18
-    };
-
-    var MAX_ITER$2 = 20;
-
-    function init$18() {
-      /* Place parameters in static storage for common use
-          -------------------------------------------------*/
-      this.temp = this.b / this.a;
-      this.es = 1 - Math.pow(this.temp, 2); // devait etre dans tmerc.js mais n y est pas donc je commente sinon retour de valeurs nulles
-      this.e = Math.sqrt(this.es);
-      this.e0 = e0fn(this.es);
-      this.e1 = e1fn(this.es);
-      this.e2 = e2fn(this.es);
-      this.e3 = e3fn(this.es);
-      this.ml0 = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, this.lat0); //si que des zeros le calcul ne se fait pas
-    }
-
-    /* Polyconic forward equations--mapping lat,long to x,y
-        ---------------------------------------------------*/
-    function forward$17(p) {
-      var lon = p.x;
-      var lat = p.y;
-      var x, y, el;
-      var dlon = adjust_lon(lon - this.long0);
-      el = dlon * Math.sin(lat);
-      if (this.sphere) {
-        if (Math.abs(lat) <= EPSLN) {
-          x = this.a * dlon;
-          y = -1 * this.a * this.lat0;
-        }
-        else {
-          x = this.a * Math.sin(el) / Math.tan(lat);
-          y = this.a * (adjust_lat(lat - this.lat0) + (1 - Math.cos(el)) / Math.tan(lat));
-        }
-      }
-      else {
-        if (Math.abs(lat) <= EPSLN) {
-          x = this.a * dlon;
-          y = -1 * this.ml0;
-        }
-        else {
-          var nl = gN(this.a, this.e, Math.sin(lat)) / Math.tan(lat);
-          x = nl * Math.sin(el);
-          y = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, lat) - this.ml0 + nl * (1 - Math.cos(el));
-        }
-
-      }
-      p.x = x + this.x0;
-      p.y = y + this.y0;
-      return p;
-    }
-
-    /* Inverse equations
-      -----------------*/
-    function inverse$17(p) {
-      var lon, lat, x, y, i;
-      var al, bl;
-      var phi, dphi;
-      x = p.x - this.x0;
-      y = p.y - this.y0;
-
-      if (this.sphere) {
-        if (Math.abs(y + this.a * this.lat0) <= EPSLN) {
-          lon = adjust_lon(x / this.a + this.long0);
-          lat = 0;
-        }
-        else {
-          al = this.lat0 + y / this.a;
-          bl = x * x / this.a / this.a + al * al;
-          phi = al;
-          var tanphi;
-          for (i = MAX_ITER$2; i; --i) {
-            tanphi = Math.tan(phi);
-            dphi = -1 * (al * (phi * tanphi + 1) - phi - 0.5 * (phi * phi + bl) * tanphi) / ((phi - al) / tanphi - 1);
-            phi += dphi;
-            if (Math.abs(dphi) <= EPSLN) {
-              lat = phi;
-              break;
-            }
-          }
-          lon = adjust_lon(this.long0 + (Math.asin(x * Math.tan(phi) / this.a)) / Math.sin(lat));
-        }
-      }
-      else {
-        if (Math.abs(y + this.ml0) <= EPSLN) {
-          lat = 0;
-          lon = adjust_lon(this.long0 + x / this.a);
-        }
-        else {
-
-          al = (this.ml0 + y) / this.a;
-          bl = x * x / this.a / this.a + al * al;
-          phi = al;
-          var cl, mln, mlnp, ma;
-          var con;
-          for (i = MAX_ITER$2; i; --i) {
-            con = this.e * Math.sin(phi);
-            cl = Math.sqrt(1 - con * con) * Math.tan(phi);
-            mln = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, phi);
-            mlnp = this.e0 - 2 * this.e1 * Math.cos(2 * phi) + 4 * this.e2 * Math.cos(4 * phi) - 6 * this.e3 * Math.cos(6 * phi);
-            ma = mln / this.a;
-            dphi = (al * (cl * ma + 1) - ma - 0.5 * cl * (ma * ma + bl)) / (this.es * Math.sin(2 * phi) * (ma * ma + bl - 2 * al * ma) / (4 * cl) + (al - ma) * (cl * mlnp - 2 / Math.sin(2 * phi)) - mlnp);
-            phi -= dphi;
-            if (Math.abs(dphi) <= EPSLN) {
-              lat = phi;
-              break;
-            }
-          }
-
-          //lat=phi4z(this.e,this.e0,this.e1,this.e2,this.e3,al,bl,0,0);
-          cl = Math.sqrt(1 - this.es * Math.pow(Math.sin(lat), 2)) * Math.tan(lat);
-          lon = adjust_lon(this.long0 + Math.asin(x * cl / this.a) / Math.sin(lat));
-        }
-      }
-
-      p.x = lon;
-      p.y = lat;
-      return p;
-    }
-
-    var names$19 = ["Polyconic", "poly"];
-    var poly = {
-      init: init$18,
-      forward: forward$17,
-      inverse: inverse$17,
-      names: names$19
-    };
-
-    /*
-      reference
-        Department of Land and Survey Technical Circular 1973/32
-          http://www.linz.govt.nz/docs/miscellaneous/nz-map-definition.pdf
-        OSG Technical Report 4.1
-          http://www.linz.govt.nz/docs/miscellaneous/nzmg.pdf
-      */
-
-    /**
-     * iterations: Number of iterations to refine inverse transform.
-     *     0 -> km accuracy
-     *     1 -> m accuracy -- suitable for most mapping applications
-     *     2 -> mm accuracy
-     */
-
-
-    function init$19() {
-      this.A = [];
-      this.A[1] = 0.6399175073;
-      this.A[2] = -0.1358797613;
-      this.A[3] = 0.063294409;
-      this.A[4] = -0.02526853;
-      this.A[5] = 0.0117879;
-      this.A[6] = -0.0055161;
-      this.A[7] = 0.0026906;
-      this.A[8] = -0.001333;
-      this.A[9] = 0.00067;
-      this.A[10] = -0.00034;
-
-      this.B_re = [];
-      this.B_im = [];
-      this.B_re[1] = 0.7557853228;
-      this.B_im[1] = 0;
-      this.B_re[2] = 0.249204646;
-      this.B_im[2] = 0.003371507;
-      this.B_re[3] = -0.001541739;
-      this.B_im[3] = 0.041058560;
-      this.B_re[4] = -0.10162907;
-      this.B_im[4] = 0.01727609;
-      this.B_re[5] = -0.26623489;
-      this.B_im[5] = -0.36249218;
-      this.B_re[6] = -0.6870983;
-      this.B_im[6] = -1.1651967;
-
-      this.C_re = [];
-      this.C_im = [];
-      this.C_re[1] = 1.3231270439;
-      this.C_im[1] = 0;
-      this.C_re[2] = -0.577245789;
-      this.C_im[2] = -0.007809598;
-      this.C_re[3] = 0.508307513;
-      this.C_im[3] = -0.112208952;
-      this.C_re[4] = -0.15094762;
-      this.C_im[4] = 0.18200602;
-      this.C_re[5] = 1.01418179;
-      this.C_im[5] = 1.64497696;
-      this.C_re[6] = 1.9660549;
-      this.C_im[6] = 2.5127645;
-
-      this.D = [];
-      this.D[1] = 1.5627014243;
-      this.D[2] = 0.5185406398;
-      this.D[3] = -0.03333098;
-      this.D[4] = -0.1052906;
-      this.D[5] = -0.0368594;
-      this.D[6] = 0.007317;
-      this.D[7] = 0.01220;
-      this.D[8] = 0.00394;
-      this.D[9] = -0.0013;
-    }
-
-    /**
-        New Zealand Map Grid Forward  - long/lat to x/y
-        long/lat in radians
-      */
-    function forward$18(p) {
-      var n;
-      var lon = p.x;
-      var lat = p.y;
-
-      var delta_lat = lat - this.lat0;
-      var delta_lon = lon - this.long0;
-
-      // 1. Calculate d_phi and d_psi    ...                          // and d_lambda
-      // For this algorithm, delta_latitude is in seconds of arc x 10-5, so we need to scale to those units. Longitude is radians.
-      var d_phi = delta_lat / SEC_TO_RAD * 1E-5;
-      var d_lambda = delta_lon;
-      var d_phi_n = 1; // d_phi^0
-
-      var d_psi = 0;
-      for (n = 1; n <= 10; n++) {
-        d_phi_n = d_phi_n * d_phi;
-        d_psi = d_psi + this.A[n] * d_phi_n;
-      }
-
-      // 2. Calculate theta
-      var th_re = d_psi;
-      var th_im = d_lambda;
-
-      // 3. Calculate z
-      var th_n_re = 1;
-      var th_n_im = 0; // theta^0
-      var th_n_re1;
-      var th_n_im1;
-
-      var z_re = 0;
-      var z_im = 0;
-      for (n = 1; n <= 6; n++) {
-        th_n_re1 = th_n_re * th_re - th_n_im * th_im;
-        th_n_im1 = th_n_im * th_re + th_n_re * th_im;
-        th_n_re = th_n_re1;
-        th_n_im = th_n_im1;
-        z_re = z_re + this.B_re[n] * th_n_re - this.B_im[n] * th_n_im;
-        z_im = z_im + this.B_im[n] * th_n_re + this.B_re[n] * th_n_im;
-      }
-
-      // 4. Calculate easting and northing
-      p.x = (z_im * this.a) + this.x0;
-      p.y = (z_re * this.a) + this.y0;
-
-      return p;
-    }
-
-    /**
-        New Zealand Map Grid Inverse  -  x/y to long/lat
-      */
-    function inverse$18(p) {
-      var n;
-      var x = p.x;
-      var y = p.y;
-
-      var delta_x = x - this.x0;
-      var delta_y = y - this.y0;
-
-      // 1. Calculate z
-      var z_re = delta_y / this.a;
-      var z_im = delta_x / this.a;
-
-      // 2a. Calculate theta - first approximation gives km accuracy
-      var z_n_re = 1;
-      var z_n_im = 0; // z^0
-      var z_n_re1;
-      var z_n_im1;
-
-      var th_re = 0;
-      var th_im = 0;
-      for (n = 1; n <= 6; n++) {
-        z_n_re1 = z_n_re * z_re - z_n_im * z_im;
-        z_n_im1 = z_n_im * z_re + z_n_re * z_im;
-        z_n_re = z_n_re1;
-        z_n_im = z_n_im1;
-        th_re = th_re + this.C_re[n] * z_n_re - this.C_im[n] * z_n_im;
-        th_im = th_im + this.C_im[n] * z_n_re + this.C_re[n] * z_n_im;
-      }
-
-      // 2b. Iterate to refine the accuracy of the calculation
-      //        0 iterations gives km accuracy
-      //        1 iteration gives m accuracy -- good enough for most mapping applications
-      //        2 iterations bives mm accuracy
-      for (var i = 0; i < this.iterations; i++) {
-        var th_n_re = th_re;
-        var th_n_im = th_im;
-        var th_n_re1;
-        var th_n_im1;
-
-        var num_re = z_re;
-        var num_im = z_im;
-        for (n = 2; n <= 6; n++) {
-          th_n_re1 = th_n_re * th_re - th_n_im * th_im;
-          th_n_im1 = th_n_im * th_re + th_n_re * th_im;
-          th_n_re = th_n_re1;
-          th_n_im = th_n_im1;
-          num_re = num_re + (n - 1) * (this.B_re[n] * th_n_re - this.B_im[n] * th_n_im);
-          num_im = num_im + (n - 1) * (this.B_im[n] * th_n_re + this.B_re[n] * th_n_im);
-        }
-
-        th_n_re = 1;
-        th_n_im = 0;
-        var den_re = this.B_re[1];
-        var den_im = this.B_im[1];
-        for (n = 2; n <= 6; n++) {
-          th_n_re1 = th_n_re * th_re - th_n_im * th_im;
-          th_n_im1 = th_n_im * th_re + th_n_re * th_im;
-          th_n_re = th_n_re1;
-          th_n_im = th_n_im1;
-          den_re = den_re + n * (this.B_re[n] * th_n_re - this.B_im[n] * th_n_im);
-          den_im = den_im + n * (this.B_im[n] * th_n_re + this.B_re[n] * th_n_im);
-        }
-
-        // Complex division
-        var den2 = den_re * den_re + den_im * den_im;
-        th_re = (num_re * den_re + num_im * den_im) / den2;
-        th_im = (num_im * den_re - num_re * den_im) / den2;
-      }
-
-      // 3. Calculate d_phi              ...                                    // and d_lambda
-      var d_psi = th_re;
-      var d_lambda = th_im;
-      var d_psi_n = 1; // d_psi^0
-
-      var d_phi = 0;
-      for (n = 1; n <= 9; n++) {
-        d_psi_n = d_psi_n * d_psi;
-        d_phi = d_phi + this.D[n] * d_psi_n;
-      }
-
-      // 4. Calculate latitude and longitude
-      // d_phi is calcuated in second of arc * 10^-5, so we need to scale back to radians. d_lambda is in radians.
-      var lat = this.lat0 + (d_phi * SEC_TO_RAD * 1E5);
-      var lon = this.long0 + d_lambda;
-
-      p.x = lon;
-      p.y = lat;
-
-      return p;
-    }
-
-    var names$20 = ["New_Zealand_Map_Grid", "nzmg"];
-    var nzmg = {
-      init: init$19,
-      forward: forward$18,
-      inverse: inverse$18,
-      names: names$20
-    };
-
-    /*
-      reference
-        "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder,
-        The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355.
-      */
-
-
-    /* Initialize the Miller Cylindrical projection
-      -------------------------------------------*/
-    function init$20() {
-      //no-op
-    }
-
-    /* Miller Cylindrical forward equations--mapping lat,long to x,y
-        ------------------------------------------------------------*/
-    function forward$19(p) {
-      var lon = p.x;
-      var lat = p.y;
-      /* Forward equations
-          -----------------*/
-      var dlon = adjust_lon(lon - this.long0);
-      var x = this.x0 + this.a * dlon;
-      var y = this.y0 + this.a * Math.log(Math.tan((Math.PI / 4) + (lat / 2.5))) * 1.25;
-
-      p.x = x;
-      p.y = y;
-      return p;
-    }
-
-    /* Miller Cylindrical inverse equations--mapping x,y to lat/long
-        ------------------------------------------------------------*/
-    function inverse$19(p) {
-      p.x -= this.x0;
-      p.y -= this.y0;
-
-      var lon = adjust_lon(this.long0 + p.x / this.a);
-      var lat = 2.5 * (Math.atan(Math.exp(0.8 * p.y / this.a)) - Math.PI / 4);
-
-      p.x = lon;
-      p.y = lat;
-      return p;
-    }
-
-    var names$21 = ["Miller_Cylindrical", "mill"];
-    var mill = {
-      init: init$20,
-      forward: forward$19,
-      inverse: inverse$19,
-      names: names$21
-    };
-
-    var MAX_ITER$3 = 20;
-    function init$21() {
-      /* Place parameters in static storage for common use
-        -------------------------------------------------*/
-
-
-      if (!this.sphere) {
-        this.en = pj_enfn(this.es);
-      }
-      else {
-        this.n = 1;
-        this.m = 0;
-        this.es = 0;
-        this.C_y = Math.sqrt((this.m + 1) / this.n);
-        this.C_x = this.C_y / (this.m + 1);
-      }
-
-    }
-
-    /* Sinusoidal forward equations--mapping lat,long to x,y
-      -----------------------------------------------------*/
-    function forward$20(p) {
-      var x, y;
-      var lon = p.x;
-      var lat = p.y;
-      /* Forward equations
-        -----------------*/
-      lon = adjust_lon(lon - this.long0);
-
-      if (this.sphere) {
-        if (!this.m) {
-          lat = this.n !== 1 ? Math.asin(this.n * Math.sin(lat)) : lat;
-        }
-        else {
-          var k = this.n * Math.sin(lat);
-          for (var i = MAX_ITER$3; i; --i) {
-            var V = (this.m * lat + Math.sin(lat) - k) / (this.m + Math.cos(lat));
-            lat -= V;
-            if (Math.abs(V) < EPSLN) {
-              break;
-            }
-          }
-        }
-        x = this.a * this.C_x * lon * (this.m + Math.cos(lat));
-        y = this.a * this.C_y * lat;
-
-      }
-      else {
-
-        var s = Math.sin(lat);
-        var c = Math.cos(lat);
-        y = this.a * pj_mlfn(lat, s, c, this.en);
-        x = this.a * lon * c / Math.sqrt(1 - this.es * s * s);
-      }
-
-      p.x = x;
-      p.y = y;
-      return p;
-    }
-
-    function inverse$20(p) {
-      var lat, temp, lon, s;
-
-      p.x -= this.x0;
-      lon = p.x / this.a;
-      p.y -= this.y0;
-      lat = p.y / this.a;
-
-      if (this.sphere) {
-        lat /= this.C_y;
-        lon = lon / (this.C_x * (this.m + Math.cos(lat)));
-        if (this.m) {
-          lat = asinz((this.m * lat + Math.sin(lat)) / this.n);
-        }
-        else if (this.n !== 1) {
-          lat = asinz(Math.sin(lat) / this.n);
-        }
-        lon = adjust_lon(lon + this.long0);
-        lat = adjust_lat(lat);
-      }
-      else {
-        lat = pj_inv_mlfn(p.y / this.a, this.es, this.en);
-        s = Math.abs(lat);
-        if (s < HALF_PI) {
-          s = Math.sin(lat);
-          temp = this.long0 + p.x * Math.sqrt(1 - this.es * s * s) / (this.a * Math.cos(lat));
-          //temp = this.long0 + p.x / (this.a * Math.cos(lat));
-          lon = adjust_lon(temp);
-        }
-        else if ((s - EPSLN) < HALF_PI) {
-          lon = this.long0;
-        }
-      }
-      p.x = lon;
-      p.y = lat;
-      return p;
-    }
-
-    var names$22 = ["Sinusoidal", "sinu"];
-    var sinu = {
-      init: init$21,
-      forward: forward$20,
-      inverse: inverse$20,
-      names: names$22
-    };
-
-    function init$22() {}
-    /* Mollweide forward equations--mapping lat,long to x,y
-        ----------------------------------------------------*/
-    function forward$21(p) {
-
-      /* Forward equations
-          -----------------*/
-      var lon = p.x;
-      var lat = p.y;
-
-      var delta_lon = adjust_lon(lon - this.long0);
-      var theta = lat;
-      var con = Math.PI * Math.sin(lat);
-
-      /* Iterate using the Newton-Raphson method to find theta
-          -----------------------------------------------------*/
-      while (true) {
-        var delta_theta = -(theta + Math.sin(theta) - con) / (1 + Math.cos(theta));
-        theta += delta_theta;
-        if (Math.abs(delta_theta) < EPSLN) {
-          break;
-        }
-      }
-      theta /= 2;
-
-      /* If the latitude is 90 deg, force the x coordinate to be "0 + false easting"
-           this is done here because of precision problems with "cos(theta)"
-           --------------------------------------------------------------------------*/
-      if (Math.PI / 2 - Math.abs(lat) < EPSLN) {
-        delta_lon = 0;
-      }
-      var x = 0.900316316158 * this.a * delta_lon * Math.cos(theta) + this.x0;
-      var y = 1.4142135623731 * this.a * Math.sin(theta) + this.y0;
-
-      p.x = x;
-      p.y = y;
-      return p;
-    }
-
-    function inverse$21(p) {
-      var theta;
-      var arg;
-
-      /* Inverse equations
-          -----------------*/
-      p.x -= this.x0;
-      p.y -= this.y0;
-      arg = p.y / (1.4142135623731 * this.a);
-
-      /* Because of division by zero problems, 'arg' can not be 1.  Therefore
-           a number very close to one is used instead.
-           -------------------------------------------------------------------*/
-      if (Math.abs(arg) > 0.999999999999) {
-        arg = 0.999999999999;
-      }
-      theta = Math.asin(arg);
-      var lon = adjust_lon(this.long0 + (p.x / (0.900316316158 * this.a * Math.cos(theta))));
-      if (lon < (-Math.PI)) {
-        lon = -Math.PI;
-      }
-      if (lon > Math.PI) {
-        lon = Math.PI;
-      }
-      arg = (2 * theta + Math.sin(2 * theta)) / Math.PI;
-      if (Math.abs(arg) > 1) {
-        arg = 1;
-      }
-      var lat = Math.asin(arg);
-
-      p.x = lon;
-      p.y = lat;
-      return p;
-    }
-
-    var names$23 = ["Mollweide", "moll"];
-    var moll = {
-      init: init$22,
-      forward: forward$21,
-      inverse: inverse$21,
-      names: names$23
-    };
-
-    function init$23() {
-
-      /* Place parameters in static storage for common use
-          -------------------------------------------------*/
-      // Standard Parallels cannot be equal and on opposite sides of the equator
-      if (Math.abs(this.lat1 + this.lat2) < EPSLN) {
-        return;
-      }
-      this.lat2 = this.lat2 || this.lat1;
-      this.temp = this.b / this.a;
-      this.es = 1 - Math.pow(this.temp, 2);
-      this.e = Math.sqrt(this.es);
-      this.e0 = e0fn(this.es);
-      this.e1 = e1fn(this.es);
-      this.e2 = e2fn(this.es);
-      this.e3 = e3fn(this.es);
-
-      this.sinphi = Math.sin(this.lat1);
-      this.cosphi = Math.cos(this.lat1);
-
-      this.ms1 = msfnz(this.e, this.sinphi, this.cosphi);
-      this.ml1 = mlfn(this.e0, this.e1, this.e2, this.e3, this.lat1);
-
-      if (Math.abs(this.lat1 - this.lat2) < EPSLN) {
-        this.ns = this.sinphi;
-      }
-      else {
-        this.sinphi = Math.sin(this.lat2);
-        this.cosphi = Math.cos(this.lat2);
-        this.ms2 = msfnz(this.e, this.sinphi, this.cosphi);
-        this.ml2 = mlfn(this.e0, this.e1, this.e2, this.e3, this.lat2);
-        this.ns = (this.ms1 - this.ms2) / (this.ml2 - this.ml1);
-      }
-      this.g = this.ml1 + this.ms1 / this.ns;
-      this.ml0 = mlfn(this.e0, this.e1, this.e2, this.e3, this.lat0);
-      this.rh = this.a * (this.g - this.ml0);
-    }
-
-    /* Equidistant Conic forward equations--mapping lat,long to x,y
-      -----------------------------------------------------------*/
-    function forward$22(p) {
-      var lon = p.x;
-      var lat = p.y;
-      var rh1;
-
-      /* Forward equations
-          -----------------*/
-      if (this.sphere) {
-        rh1 = this.a * (this.g - lat);
-      }
-      else {
-        var ml = mlfn(this.e0, this.e1, this.e2, this.e3, lat);
-        rh1 = this.a * (this.g - ml);
-      }
-      var theta = this.ns * adjust_lon(lon - this.long0);
-      var x = this.x0 + rh1 * Math.sin(theta);
-      var y = this.y0 + this.rh - rh1 * Math.cos(theta);
-      p.x = x;
-      p.y = y;
-      return p;
-    }
-
-    /* Inverse equations
-      -----------------*/
-    function inverse$22(p) {
-      p.x -= this.x0;
-      p.y = this.rh - p.y + this.y0;
-      var con, rh1, lat, lon;
-      if (this.ns >= 0) {
-        rh1 = Math.sqrt(p.x * p.x + p.y * p.y);
-        con = 1;
-      }
-      else {
-        rh1 = -Math.sqrt(p.x * p.x + p.y * p.y);
-        con = -1;
-      }
-      var theta = 0;
-      if (rh1 !== 0) {
-        theta = Math.atan2(con * p.x, con * p.y);
-      }
-
-      if (this.sphere) {
-        lon = adjust_lon(this.long0 + theta / this.ns);
-        lat = adjust_lat(this.g - rh1 / this.a);
-        p.x = lon;
-        p.y = lat;
-        return p;
-      }
-      else {
-        var ml = this.g - rh1 / this.a;
-        lat = imlfn(ml, this.e0, this.e1, this.e2, this.e3);
-        lon = adjust_lon(this.long0 + theta / this.ns);
-        p.x = lon;
-        p.y = lat;
-        return p;
-      }
-
-    }
-
-    var names$24 = ["Equidistant_Conic", "eqdc"];
-    var eqdc = {
-      init: init$23,
-      forward: forward$22,
-      inverse: inverse$22,
-      names: names$24
-    };
-
-    /* Initialize the Van Der Grinten projection
-      ----------------------------------------*/
-    function init$24() {
-      //this.R = 6370997; //Radius of earth
-      this.R = this.a;
-    }
-
-    function forward$23(p) {
-
-      var lon = p.x;
-      var lat = p.y;
-
-      /* Forward equations
-        -----------------*/
-      var dlon = adjust_lon(lon - this.long0);
-      var x, y;
-
-      if (Math.abs(lat) <= EPSLN) {
-        x = this.x0 + this.R * dlon;
-        y = this.y0;
-      }
-      var theta = asinz(2 * Math.abs(lat / Math.PI));
-      if ((Math.abs(dlon) <= EPSLN) || (Math.abs(Math.abs(lat) - HALF_PI) <= EPSLN)) {
-        x = this.x0;
-        if (lat >= 0) {
-          y = this.y0 + Math.PI * this.R * Math.tan(0.5 * theta);
-        }
-        else {
-          y = this.y0 + Math.PI * this.R * -Math.tan(0.5 * theta);
-        }
-        //  return(OK);
-      }
-      var al = 0.5 * Math.abs((Math.PI / dlon) - (dlon / Math.PI));
-      var asq = al * al;
-      var sinth = Math.sin(theta);
-      var costh = Math.cos(theta);
-
-      var g = costh / (sinth + costh - 1);
-      var gsq = g * g;
-      var m = g * (2 / sinth - 1);
-      var msq = m * m;
-      var con = Math.PI * this.R * (al * (g - msq) + Math.sqrt(asq * (g - msq) * (g - msq) - (msq + asq) * (gsq - msq))) / (msq + asq);
-      if (dlon < 0) {
-        con = -con;
-      }
-      x = this.x0 + con;
-      //con = Math.abs(con / (Math.PI * this.R));
-      var q = asq + g;
-      con = Math.PI * this.R * (m * q - al * Math.sqrt((msq + asq) * (asq + 1) - q * q)) / (msq + asq);
-      if (lat >= 0) {
-        //y = this.y0 + Math.PI * this.R * Math.sqrt(1 - con * con - 2 * al * con);
-        y = this.y0 + con;
-      }
-      else {
-        //y = this.y0 - Math.PI * this.R * Math.sqrt(1 - con * con - 2 * al * con);
-        y = this.y0 - con;
-      }
-      p.x = x;
-      p.y = y;
-      return p;
-    }
-
-    /* Van Der Grinten inverse equations--mapping x,y to lat/long
-      ---------------------------------------------------------*/
-    function inverse$23(p) {
-      var lon, lat;
-      var xx, yy, xys, c1, c2, c3;
-      var a1;
-      var m1;
-      var con;
-      var th1;
-      var d;
-
-      /* inverse equations
-        -----------------*/
-      p.x -= this.x0;
-      p.y -= this.y0;
-      con = Math.PI * this.R;
-      xx = p.x / con;
-      yy = p.y / con;
-      xys = xx * xx + yy * yy;
-      c1 = -Math.abs(yy) * (1 + xys);
-      c2 = c1 - 2 * yy * yy + xx * xx;
-      c3 = -2 * c1 + 1 + 2 * yy * yy + xys * xys;
-      d = yy * yy / c3 + (2 * c2 * c2 * c2 / c3 / c3 / c3 - 9 * c1 * c2 / c3 / c3) / 27;
-      a1 = (c1 - c2 * c2 / 3 / c3) / c3;
-      m1 = 2 * Math.sqrt(-a1 / 3);
-      con = ((3 * d) / a1) / m1;
-      if (Math.abs(con) > 1) {
-        if (con >= 0) {
-          con = 1;
-        }
-        else {
-          con = -1;
-        }
-      }
-      th1 = Math.acos(con) / 3;
-      if (p.y >= 0) {
-        lat = (-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;
-      }
-      else {
-        lat = -(-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;
-      }
-
-      if (Math.abs(xx) < EPSLN) {
-        lon = this.long0;
-      }
-      else {
-        lon = adjust_lon(this.long0 + Math.PI * (xys - 1 + Math.sqrt(1 + 2 * (xx * xx - yy * yy) + xys * xys)) / 2 / xx);
-      }
-
-      p.x = lon;
-      p.y = lat;
-      return p;
-    }
-
-    var names$25 = ["Van_der_Grinten_I", "VanDerGrinten", "vandg"];
-    var vandg = {
-      init: init$24,
-      forward: forward$23,
-      inverse: inverse$23,
-      names: names$25
-    };
-
-    function init$25() {
-      this.sin_p12 = Math.sin(this.lat0);
-      this.cos_p12 = Math.cos(this.lat0);
-    }
-
-    function forward$24(p) {
-      var lon = p.x;
-      var lat = p.y;
-      var sinphi = Math.sin(p.y);
-      var cosphi = Math.cos(p.y);
-      var dlon = adjust_lon(lon - this.long0);
-      var e0, e1, e2, e3, Mlp, Ml, tanphi, Nl1, Nl, psi, Az, G, H, GH, Hs, c, kp, cos_c, s, s2, s3, s4, s5;
-      if (this.sphere) {
-        if (Math.abs(this.sin_p12 - 1) <= EPSLN) {
-          //North Pole case
-          p.x = this.x0 + this.a * (HALF_PI - lat) * Math.sin(dlon);
-          p.y = this.y0 - this.a * (HALF_PI - lat) * Math.cos(dlon);
-          return p;
-        }
-        else if (Math.abs(this.sin_p12 + 1) <= EPSLN) {
-          //South Pole case
-          p.x = this.x0 + this.a * (HALF_PI + lat) * Math.sin(dlon);
-          p.y = this.y0 + this.a * (HALF_PI + lat) * Math.cos(dlon);
-          return p;
-        }
-        else {
-          //default case
-          cos_c = this.sin_p12 * sinphi + this.cos_p12 * cosphi * Math.cos(dlon);
-          c = Math.acos(cos_c);
-          kp = c ? c / Math.sin(c) : 1;
-          p.x = this.x0 + this.a * kp * cosphi * Math.sin(dlon);
-          p.y = this.y0 + this.a * kp * (this.cos_p12 * sinphi - this.sin_p12 * cosphi * Math.cos(dlon));
-          return p;
-        }
-      }
-      else {
-        e0 = e0fn(this.es);
-        e1 = e1fn(this.es);
-        e2 = e2fn(this.es);
-        e3 = e3fn(this.es);
-        if (Math.abs(this.sin_p12 - 1) <= EPSLN) {
-          //North Pole case
-          Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);
-          Ml = this.a * mlfn(e0, e1, e2, e3, lat);
-          p.x = this.x0 + (Mlp - Ml) * Math.sin(dlon);
-          p.y = this.y0 - (Mlp - Ml) * Math.cos(dlon);
-          return p;
-        }
-        else if (Math.abs(this.sin_p12 + 1) <= EPSLN) {
-          //South Pole case
-          Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);
-          Ml = this.a * mlfn(e0, e1, e2, e3, lat);
-          p.x = this.x0 + (Mlp + Ml) * Math.sin(dlon);
-          p.y = this.y0 + (Mlp + Ml) * Math.cos(dlon);
-          return p;
-        }
-        else {
-          //Default case
-          tanphi = sinphi / cosphi;
-          Nl1 = gN(this.a, this.e, this.sin_p12);
-          Nl = gN(this.a, this.e, sinphi);
-          psi = Math.atan((1 - this.es) * tanphi + this.es * Nl1 * this.sin_p12 / (Nl * cosphi));
-          Az = Math.atan2(Math.sin(dlon), this.cos_p12 * Math.tan(psi) - this.sin_p12 * Math.cos(dlon));
-          if (Az === 0) {
-            s = Math.asin(this.cos_p12 * Math.sin(psi) - this.sin_p12 * Math.cos(psi));
-          }
-          else if (Math.abs(Math.abs(Az) - Math.PI) <= EPSLN) {
-            s = -Math.asin(this.cos_p12 * Math.sin(psi) - this.sin_p12 * Math.cos(psi));
-          }
-          else {
-            s = Math.asin(Math.sin(dlon) * Math.cos(psi) / Math.sin(Az));
-          }
-          G = this.e * this.sin_p12 / Math.sqrt(1 - this.es);
-          H = this.e * this.cos_p12 * Math.cos(Az) / Math.sqrt(1 - this.es);
-          GH = G * H;
-          Hs = H * H;
-          s2 = s * s;
-          s3 = s2 * s;
-          s4 = s3 * s;
-          s5 = s4 * s;
-          c = Nl1 * s * (1 - s2 * Hs * (1 - Hs) / 6 + s3 / 8 * GH * (1 - 2 * Hs) + s4 / 120 * (Hs * (4 - 7 * Hs) - 3 * G * G * (1 - 7 * Hs)) - s5 / 48 * GH);
-          p.x = this.x0 + c * Math.sin(Az);
-          p.y = this.y0 + c * Math.cos(Az);
-          return p;
-        }
-      }
-
-
-    }
-
-    function inverse$24(p) {
-      p.x -= this.x0;
-      p.y -= this.y0;
-      var rh, z, sinz, cosz, lon, lat, con, e0, e1, e2, e3, Mlp, M, N1, psi, Az, cosAz, tmp, A, B, D, Ee, F, sinpsi;
-      if (this.sphere) {
-        rh = Math.sqrt(p.x * p.x + p.y * p.y);
-        if (rh > (2 * HALF_PI * this.a)) {
-          return;
-        }
-        z = rh / this.a;
-
-        sinz = Math.sin(z);
-        cosz = Math.cos(z);
-
-        lon = this.long0;
-        if (Math.abs(rh) <= EPSLN) {
-          lat = this.lat0;
-        }
-        else {
-          lat = asinz(cosz * this.sin_p12 + (p.y * sinz * this.cos_p12) / rh);
-          con = Math.abs(this.lat0) - HALF_PI;
-          if (Math.abs(con) <= EPSLN) {
-            if (this.lat0 >= 0) {
-              lon = adjust_lon(this.long0 + Math.atan2(p.x, - p.y));
-            }
-            else {
-              lon = adjust_lon(this.long0 - Math.atan2(-p.x, p.y));
-            }
-          }
-          else {
-            /*con = cosz - this.sin_p12 * Math.sin(lat);
-            if ((Math.abs(con) < EPSLN) && (Math.abs(p.x) < EPSLN)) {
-              //no-op, just keep the lon value as is
-            } else {
-              var temp = Math.atan2((p.x * sinz * this.cos_p12), (con * rh));
-              lon = adjust_lon(this.long0 + Math.atan2((p.x * sinz * this.cos_p12), (con * rh)));
-            }*/
-            lon = adjust_lon(this.long0 + Math.atan2(p.x * sinz, rh * this.cos_p12 * cosz - p.y * this.sin_p12 * sinz));
-          }
-        }
-
-        p.x = lon;
-        p.y = lat;
-        return p;
-      }
-      else {
-        e0 = e0fn(this.es);
-        e1 = e1fn(this.es);
-        e2 = e2fn(this.es);
-        e3 = e3fn(this.es);
-        if (Math.abs(this.sin_p12 - 1) <= EPSLN) {
-          //North pole case
-          Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);
-          rh = Math.sqrt(p.x * p.x + p.y * p.y);
-          M = Mlp - rh;
-          lat = imlfn(M / this.a, e0, e1, e2, e3);
-          lon = adjust_lon(this.long0 + Math.atan2(p.x, - 1 * p.y));
-          p.x = lon;
-          p.y = lat;
-          return p;
-        }
-        else if (Math.abs(this.sin_p12 + 1) <= EPSLN) {
-          //South pole case
-          Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);
-          rh = Math.sqrt(p.x * p.x + p.y * p.y);
-          M = rh - Mlp;
-
-          lat = imlfn(M / this.a, e0, e1, e2, e3);
-          lon = adjust_lon(this.long0 + Math.atan2(p.x, p.y));
-          p.x = lon;
-          p.y = lat;
-          return p;
-        }
-        else {
-          //default case
-          rh = Math.sqrt(p.x * p.x + p.y * p.y);
-          Az = Math.atan2(p.x, p.y);
-          N1 = gN(this.a, this.e, this.sin_p12);
-          cosAz = Math.cos(Az);
-          tmp = this.e * this.cos_p12 * cosAz;
-          A = -tmp * tmp / (1 - this.es);
-          B = 3 * this.es * (1 - A) * this.sin_p12 * this.cos_p12 * cosAz / (1 - this.es);
-          D = rh / N1;
-          Ee = D - A * (1 + A) * Math.pow(D, 3) / 6 - B * (1 + 3 * A) * Math.pow(D, 4) / 24;
-          F = 1 - A * Ee * Ee / 2 - D * Ee * Ee * Ee / 6;
-          psi = Math.asin(this.sin_p12 * Math.cos(Ee) + this.cos_p12 * Math.sin(Ee) * cosAz);
-          lon = adjust_lon(this.long0 + Math.asin(Math.sin(Az) * Math.sin(Ee) / Math.cos(psi)));
-          sinpsi = Math.sin(psi);
-          lat = Math.atan2((sinpsi - this.es * F * this.sin_p12) * Math.tan(psi), sinpsi * (1 - this.es));
-          p.x = lon;
-          p.y = lat;
-          return p;
-        }
-      }
-
-    }
-
-    var names$26 = ["Azimuthal_Equidistant", "aeqd"];
-    var aeqd = {
-      init: init$25,
-      forward: forward$24,
-      inverse: inverse$24,
-      names: names$26
-    };
-
-    function init$26() {
-      //double temp;      /* temporary variable    */
-
-      /* Place parameters in static storage for common use
-          -------------------------------------------------*/
-      this.sin_p14 = Math.sin(this.lat0);
-      this.cos_p14 = Math.cos(this.lat0);
-    }
-
-    /* Orthographic forward equations--mapping lat,long to x,y
-        ---------------------------------------------------*/
-    function forward$25(p) {
-      var sinphi, cosphi; /* sin and cos value        */
-      var dlon; /* delta longitude value      */
-      var coslon; /* cos of longitude        */
-      var ksp; /* scale factor          */
-      var g, x, y;
-      var lon = p.x;
-      var lat = p.y;
-      /* Forward equations
-          -----------------*/
-      dlon = adjust_lon(lon - this.long0);
-
-      sinphi = Math.sin(lat);
-      cosphi = Math.cos(lat);
-
-      coslon = Math.cos(dlon);
-      g = this.sin_p14 * sinphi + this.cos_p14 * cosphi * coslon;
-      ksp = 1;
-      if ((g > 0) || (Math.abs(g) <= EPSLN)) {
-        x = this.a * ksp * cosphi * Math.sin(dlon);
-        y = this.y0 + this.a * ksp * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon);
-      }
-      p.x = x;
-      p.y = y;
-      return p;
-    }
-
-    function inverse$25(p) {
-      var rh; /* height above ellipsoid      */
-      var z; /* angle          */
-      var sinz, cosz; /* sin of z and cos of z      */
-      var con;
-      var lon, lat;
-      /* Inverse equations
-          -----------------*/
-      p.x -= this.x0;
-      p.y -= this.y0;
-      rh = Math.sqrt(p.x * p.x + p.y * p.y);
-      z = asinz(rh / this.a);
-
-      sinz = Math.sin(z);
-      cosz = Math.cos(z);
-
-      lon = this.long0;
-      if (Math.abs(rh) <= EPSLN) {
-        lat = this.lat0;
-        p.x = lon;
-        p.y = lat;
-        return p;
-      }
-      lat = asinz(cosz * this.sin_p14 + (p.y * sinz * this.cos_p14) / rh);
-      con = Math.abs(this.lat0) - HALF_PI;
-      if (Math.abs(con) <= EPSLN) {
-        if (this.lat0 >= 0) {
-          lon = adjust_lon(this.long0 + Math.atan2(p.x, - p.y));
-        }
-        else {
-          lon = adjust_lon(this.long0 - Math.atan2(-p.x, p.y));
-        }
-        p.x = lon;
-        p.y = lat;
-        return p;
-      }
-      lon = adjust_lon(this.long0 + Math.atan2((p.x * sinz), rh * this.cos_p14 * cosz - p.y * this.sin_p14 * sinz));
-      p.x = lon;
-      p.y = lat;
-      return p;
-    }
-
-    var names$27 = ["ortho"];
-    var ortho = {
-      init: init$26,
-      forward: forward$25,
-      inverse: inverse$25,
-      names: names$27
-    };
-
-    // QSC projection rewritten from the original PROJ4
-    // https://github.com/OSGeo/proj.4/blob/master/src/PJ_qsc.c
-
-    /* constants */
-    var FACE_ENUM = {
-        FRONT: 1,
-        RIGHT: 2,
-        BACK: 3,
-        LEFT: 4,
-        TOP: 5,
-        BOTTOM: 6
-    };
-
-    var AREA_ENUM = {
-        AREA_0: 1,
-        AREA_1: 2,
-        AREA_2: 3,
-        AREA_3: 4
-    };
-
-    function init$27() {
-
-      this.x0 = this.x0 || 0;
-      this.y0 = this.y0 || 0;
-      this.lat0 = this.lat0 || 0;
-      this.long0 = this.long0 || 0;
-      this.lat_ts = this.lat_ts || 0;
-      this.title = this.title || "Quadrilateralized Spherical Cube";
-
-      /* Determine the cube face from the center of projection. */
-      if (this.lat0 >= HALF_PI - FORTPI / 2.0) {
-        this.face = FACE_ENUM.TOP;
-      } else if (this.lat0 <= -(HALF_PI - FORTPI / 2.0)) {
-        this.face = FACE_ENUM.BOTTOM;
-      } else if (Math.abs(this.long0) <= FORTPI) {
-        this.face = FACE_ENUM.FRONT;
-      } else if (Math.abs(this.long0) <= HALF_PI + FORTPI) {
-        this.face = this.long0 > 0.0 ? FACE_ENUM.RIGHT : FACE_ENUM.LEFT;
-      } else {
-        this.face = FACE_ENUM.BACK;
-      }
-
-      /* Fill in useful values for the ellipsoid <-> sphere shift
-       * described in [LK12]. */
-      if (this.es !== 0) {
-        this.one_minus_f = 1 - (this.a - this.b) / this.a;
-        this.one_minus_f_squared = this.one_minus_f * this.one_minus_f;
-      }
-    }
-
-    // QSC forward equations--mapping lat,long to x,y
-    // -----------------------------------------------------------------
-    function forward$26(p) {
-      var xy = {x: 0, y: 0};
-      var lat, lon;
-      var theta, phi;
-      var t, mu;
-      /* nu; */
-      var area = {value: 0};
-
-      // move lon according to projection's lon
-      p.x -= this.long0;
-
-      /* Convert the geodetic latitude to a geocentric latitude.
-       * This corresponds to the shift from the ellipsoid to the sphere
-       * described in [LK12]. */
-      if (this.es !== 0) {//if (P->es != 0) {
-        lat = Math.atan(this.one_minus_f_squared * Math.tan(p.y));
-      } else {
-        lat = p.y;
-      }
-
-      /* Convert the input lat, lon into theta, phi as used by QSC.
-       * This depends on the cube face and the area on it.
-       * For the top and bottom face, we can compute theta and phi
-       * directly from phi, lam. For the other faces, we must use
-       * unit sphere cartesian coordinates as an intermediate step. */
-      lon = p.x; //lon = lp.lam;
-      if (this.face === FACE_ENUM.TOP) {
-        phi = HALF_PI - lat;
-        if (lon >= FORTPI && lon <= HALF_PI + FORTPI) {
-          area.value = AREA_ENUM.AREA_0;
-          theta = lon - HALF_PI;
-        } else if (lon > HALF_PI + FORTPI || lon <= -(HALF_PI + FORTPI)) {
-          area.value = AREA_ENUM.AREA_1;
-          theta = (lon > 0.0 ? lon - SPI : lon + SPI);
-        } else if (lon > -(HALF_PI + FORTPI) && lon <= -FORTPI) {
-          area.value = AREA_ENUM.AREA_2;
-          theta = lon + HALF_PI;
-        } else {
-          area.value = AREA_ENUM.AREA_3;
-          theta = lon;
-        }
-      } else if (this.face === FACE_ENUM.BOTTOM) {
-        phi = HALF_PI + lat;
-        if (lon >= FORTPI && lon <= HALF_PI + FORTPI) {
-          area.value = AREA_ENUM.AREA_0;
-          theta = -lon + HALF_PI;
-        } else if (lon < FORTPI && lon >= -FORTPI) {
-          area.value = AREA_ENUM.AREA_1;
-          theta = -lon;
-        } else if (lon < -FORTPI && lon >= -(HALF_PI + FORTPI)) {
-          area.value = AREA_ENUM.AREA_2;
-          theta = -lon - HALF_PI;
-        } else {
-          area.value = AREA_ENUM.AREA_3;
-          theta = (lon > 0.0 ? -lon + SPI : -lon - SPI);
-        }
-      } else {
-        var q, r, s;
-        var sinlat, coslat;
-        var sinlon, coslon;
-
-        if (this.face === FACE_ENUM.RIGHT) {
-          lon = qsc_shift_lon_origin(lon, +HALF_PI);
-        } else if (this.face === FACE_ENUM.BACK) {
-          lon = qsc_shift_lon_origin(lon, +SPI);
-        } else if (this.face === FACE_ENUM.LEFT) {
-          lon = qsc_shift_lon_origin(lon, -HALF_PI);
-        }
-        sinlat = Math.sin(lat);
-        coslat = Math.cos(lat);
-        sinlon = Math.sin(lon);
-        coslon = Math.cos(lon);
-        q = coslat * coslon;
-        r = coslat * sinlon;
-        s = sinlat;
-
-        if (this.face === FACE_ENUM.FRONT) {
-          phi = Math.acos(q);
-          theta = qsc_fwd_equat_face_theta(phi, s, r, area);
-        } else if (this.face === FACE_ENUM.RIGHT) {
-          phi = Math.acos(r);
-          theta = qsc_fwd_equat_face_theta(phi, s, -q, area);
-        } else if (this.face === FACE_ENUM.BACK) {
-          phi = Math.acos(-q);
-          theta = qsc_fwd_equat_face_theta(phi, s, -r, area);
-        } else if (this.face === FACE_ENUM.LEFT) {
-          phi = Math.acos(-r);
-          theta = qsc_fwd_equat_face_theta(phi, s, q, area);
-        } else {
-          /* Impossible */
-          phi = theta = 0;
-          area.value = AREA_ENUM.AREA_0;
-        }
-      }
-
-      /* Compute mu and nu for the area of definition.
-       * For mu, see Eq. (3-21) in [OL76], but note the typos:
-       * compare with Eq. (3-14). For nu, see Eq. (3-38). */
-      mu = Math.atan((12 / SPI) * (theta + Math.acos(Math.sin(theta) * Math.cos(FORTPI)) - HALF_PI));
-      t = Math.sqrt((1 - Math.cos(phi)) / (Math.cos(mu) * Math.cos(mu)) / (1 - Math.cos(Math.atan(1 / Math.cos(theta)))));
-
-      /* Apply the result to the real area. */
-      if (area.value === AREA_ENUM.AREA_1) {
-        mu += HALF_PI;
-      } else if (area.value === AREA_ENUM.AREA_2) {
-        mu += SPI;
-      } else if (area.value === AREA_ENUM.AREA_3) {
-        mu += 1.5 * SPI;
-      }
-
-      /* Now compute x, y from mu and nu */
-      xy.x = t * Math.cos(mu);
-      xy.y = t * Math.sin(mu);
-      xy.x = xy.x * this.a + this.x0;
-      xy.y = xy.y * this.a + this.y0;
-
-      p.x = xy.x;
-      p.y = xy.y;
-      return p;
-    }
-
-    // QSC inverse equations--mapping x,y to lat/long
-    // -----------------------------------------------------------------
-    function inverse$26(p) {
-      var lp = {lam: 0, phi: 0};
-      var mu, nu, cosmu, tannu;
-      var tantheta, theta, cosphi, phi;
-      var t;
-      var area = {value: 0};
-
-      /* de-offset */
-      p.x = (p.x - this.x0) / this.a;
-      p.y = (p.y - this.y0) / this.a;
-
-      /* Convert the input x, y to the mu and nu angles as used by QSC.
-       * This depends on the area of the cube face. */
-      nu = Math.atan(Math.sqrt(p.x * p.x + p.y * p.y));
-      mu = Math.atan2(p.y, p.x);
-      if (p.x >= 0.0 && p.x >= Math.abs(p.y)) {
-        area.value = AREA_ENUM.AREA_0;
-      } else if (p.y >= 0.0 && p.y >= Math.abs(p.x)) {
-        area.value = AREA_ENUM.AREA_1;
-        mu -= HALF_PI;
-      } else if (p.x < 0.0 && -p.x >= Math.abs(p.y)) {
-        area.value = AREA_ENUM.AREA_2;
-        mu = (mu < 0.0 ? mu + SPI : mu - SPI);
-      } else {
-        area.value = AREA_ENUM.AREA_3;
-        mu += HALF_PI;
-      }
-
-      /* Compute phi and theta for the area of definition.
-       * The inverse projection is not described in the original paper, but some
-       * good hints can be found here (as of 2011-12-14):
-       * http://fits.gsfc.nasa.gov/fitsbits/saf.93/saf.9302
-       * (search for "Message-Id: <9302181759.AA25477 at fits.cv.nrao.edu>") */
-      t = (SPI / 12) * Math.tan(mu);
-      tantheta = Math.sin(t) / (Math.cos(t) - (1 / Math.sqrt(2)));
-      theta = Math.atan(tantheta);
-      cosmu = Math.cos(mu);
-      tannu = Math.tan(nu);
-      cosphi = 1 - cosmu * cosmu * tannu * tannu * (1 - Math.cos(Math.atan(1 / Math.cos(theta))));
-      if (cosphi < -1) {
-        cosphi = -1;
-      } else if (cosphi > +1) {
-        cosphi = +1;
-      }
-
-      /* Apply the result to the real area on the cube face.
-       * For the top and bottom face, we can compute phi and lam directly.
-       * For the other faces, we must use unit sphere cartesian coordinates
-       * as an intermediate step. */
-      if (this.face === FACE_ENUM.TOP) {
-        phi = Math.acos(cosphi);
-        lp.phi = HALF_PI - phi;
-        if (area.value === AREA_ENUM.AREA_0) {
-          lp.lam = theta + HALF_PI;
-        } else if (area.value === AREA_ENUM.AREA_1) {
-          lp.lam = (theta < 0.0 ? theta + SPI : theta - SPI);
-        } else if (area.value === AREA_ENUM.AREA_2) {
-          lp.lam = theta - HALF_PI;
-        } else /* area.value == AREA_ENUM.AREA_3 */ {
-          lp.lam = theta;
-        }
-      } else if (this.face === FACE_ENUM.BOTTOM) {
-        phi = Math.acos(cosphi);
-        lp.phi = phi - HALF_PI;
-        if (area.value === AREA_ENUM.AREA_0) {
-          lp.lam = -theta + HALF_PI;
-        } else if (area.value === AREA_ENUM.AREA_1) {
-          lp.lam = -theta;
-        } else if (area.value === AREA_ENUM.AREA_2) {
-          lp.lam = -theta - HALF_PI;
-        } else /* area.value == AREA_ENUM.AREA_3 */ {
-          lp.lam = (theta < 0.0 ? -theta - SPI : -theta + SPI);
-        }
-      } else {
-        /* Compute phi and lam via cartesian unit sphere coordinates. */
-        var q, r, s;
-        q = cosphi;
-        t = q * q;
-        if (t >= 1) {
-          s = 0;
-        } else {
-          s = Math.sqrt(1 - t) * Math.sin(theta);
-        }
-        t += s * s;
-        if (t >= 1) {
-          r = 0;
-        } else {
-          r = Math.sqrt(1 - t);
-        }
-        /* Rotate q,r,s into the correct area. */
-        if (area.value === AREA_ENUM.AREA_1) {
-          t = r;
-          r = -s;
-          s = t;
-        } else if (area.value === AREA_ENUM.AREA_2) {
-          r = -r;
-          s = -s;
-        } else if (area.value === AREA_ENUM.AREA_3) {
-          t = r;
-          r = s;
-          s = -t;
-        }
-        /* Rotate q,r,s into the correct cube face. */
-        if (this.face === FACE_ENUM.RIGHT) {
-          t = q;
-          q = -r;
-          r = t;
-        } else if (this.face === FACE_ENUM.BACK) {
-          q = -q;
-          r = -r;
-        } else if (this.face === FACE_ENUM.LEFT) {
-          t = q;
-          q = r;
-          r = -t;
-        }
-        /* Now compute phi and lam from the unit sphere coordinates. */
-        lp.phi = Math.acos(-s) - HALF_PI;
-        lp.lam = Math.atan2(r, q);
-        if (this.face === FACE_ENUM.RIGHT) {
-          lp.lam = qsc_shift_lon_origin(lp.lam, -HALF_PI);
-        } else if (this.face === FACE_ENUM.BACK) {
-          lp.lam = qsc_shift_lon_origin(lp.lam, -SPI);
-        } else if (this.face === FACE_ENUM.LEFT) {
-          lp.lam = qsc_shift_lon_origin(lp.lam, +HALF_PI);
-        }
-      }
-
-      /* Apply the shift from the sphere to the ellipsoid as described
-       * in [LK12]. */
-      if (this.es !== 0) {
-        var invert_sign;
-        var tanphi, xa;
-        invert_sign = (lp.phi < 0 ? 1 : 0);
-        tanphi = Math.tan(lp.phi);
-        xa = this.b / Math.sqrt(tanphi * tanphi + this.one_minus_f_squared);
-        lp.phi = Math.atan(Math.sqrt(this.a * this.a - xa * xa) / (this.one_minus_f * xa));
-        if (invert_sign) {
-          lp.phi = -lp.phi;
-        }
-      }
-
-      lp.lam += this.long0;
-      p.x = lp.lam;
-      p.y = lp.phi;
-      return p;
-    }
-
-    /* Helper function for forward projection: compute the theta angle
-     * and determine the area number. */
-    function qsc_fwd_equat_face_theta(phi, y, x, area) {
-      var theta;
-      if (phi < EPSLN) {
-        area.value = AREA_ENUM.AREA_0;
-        theta = 0.0;
-      } else {
-        theta = Math.atan2(y, x);
-        if (Math.abs(theta) <= FORTPI) {
-          area.value = AREA_ENUM.AREA_0;
-        } else if (theta > FORTPI && theta <= HALF_PI + FORTPI) {
-          area.value = AREA_ENUM.AREA_1;
-          theta -= HALF_PI;
-        } else if (theta > HALF_PI + FORTPI || theta <= -(HALF_PI + FORTPI)) {
-          area.value = AREA_ENUM.AREA_2;
-          theta = (theta >= 0.0 ? theta - SPI : theta + SPI);
-        } else {
-          area.value = AREA_ENUM.AREA_3;
-          theta += HALF_PI;
-        }
-      }
-      return theta;
-    }
-
-    /* Helper function: shift the longitude. */
-    function qsc_shift_lon_origin(lon, offset) {
-      var slon = lon + offset;
-      if (slon < -SPI) {
-        slon += TWO_PI;
-      } else if (slon > +SPI) {
-        slon -= TWO_PI;
-      }
-      return slon;
-    }
-
-    var names$28 = ["Quadrilateralized Spherical Cube", "Quadrilateralized_Spherical_Cube", "qsc"];
-    var qsc = {
-      init: init$27,
-      forward: forward$26,
-      inverse: inverse$26,
-      names: names$28
-    };
-
-    // Robinson projection
-    // Based on https://github.com/OSGeo/proj.4/blob/master/src/PJ_robin.c
-    // Polynomial coeficients from http://article.gmane.org/gmane.comp.gis.proj-4.devel/6039
-
-    var COEFS_X = [
-        [1.0000, 2.2199e-17, -7.15515e-05, 3.1103e-06],
-        [0.9986, -0.000482243, -2.4897e-05, -1.3309e-06],
-        [0.9954, -0.00083103, -4.48605e-05, -9.86701e-07],
-        [0.9900, -0.00135364, -5.9661e-05, 3.6777e-06],
-        [0.9822, -0.00167442, -4.49547e-06, -5.72411e-06],
-        [0.9730, -0.00214868, -9.03571e-05, 1.8736e-08],
-        [0.9600, -0.00305085, -9.00761e-05, 1.64917e-06],
-        [0.9427, -0.00382792, -6.53386e-05, -2.6154e-06],
-        [0.9216, -0.00467746, -0.00010457, 4.81243e-06],
-        [0.8962, -0.00536223, -3.23831e-05, -5.43432e-06],
-        [0.8679, -0.00609363, -0.000113898, 3.32484e-06],
-        [0.8350, -0.00698325, -6.40253e-05, 9.34959e-07],
-        [0.7986, -0.00755338, -5.00009e-05, 9.35324e-07],
-        [0.7597, -0.00798324, -3.5971e-05, -2.27626e-06],
-        [0.7186, -0.00851367, -7.01149e-05, -8.6303e-06],
-        [0.6732, -0.00986209, -0.000199569, 1.91974e-05],
-        [0.6213, -0.010418, 8.83923e-05, 6.24051e-06],
-        [0.5722, -0.00906601, 0.000182, 6.24051e-06],
-        [0.5322, -0.00677797, 0.000275608, 6.24051e-06]
-    ];
-
-    var COEFS_Y = [
-        [-5.20417e-18, 0.0124, 1.21431e-18, -8.45284e-11],
-        [0.0620, 0.0124, -1.26793e-09, 4.22642e-10],
-        [0.1240, 0.0124, 5.07171e-09, -1.60604e-09],
-        [0.1860, 0.0123999, -1.90189e-08, 6.00152e-09],
-        [0.2480, 0.0124002, 7.10039e-08, -2.24e-08],
-        [0.3100, 0.0123992, -2.64997e-07, 8.35986e-08],
-        [0.3720, 0.0124029, 9.88983e-07, -3.11994e-07],
-        [0.4340, 0.0123893, -3.69093e-06, -4.35621e-07],
-        [0.4958, 0.0123198, -1.02252e-05, -3.45523e-07],
-        [0.5571, 0.0121916, -1.54081e-05, -5.82288e-07],
-        [0.6176, 0.0119938, -2.41424e-05, -5.25327e-07],
-        [0.6769, 0.011713, -3.20223e-05, -5.16405e-07],
-        [0.7346, 0.0113541, -3.97684e-05, -6.09052e-07],
-        [0.7903, 0.0109107, -4.89042e-05, -1.04739e-06],
-        [0.8435, 0.0103431, -6.4615e-05, -1.40374e-09],
-        [0.8936, 0.00969686, -6.4636e-05, -8.547e-06],
-        [0.9394, 0.00840947, -0.000192841, -4.2106e-06],
-        [0.9761, 0.00616527, -0.000256, -4.2106e-06],
-        [1.0000, 0.00328947, -0.000319159, -4.2106e-06]
-    ];
-
-    var FXC = 0.8487;
-    var FYC = 1.3523;
-    var C1 = R2D/5; // rad to 5-degree interval
-    var RC1 = 1/C1;
-    var NODES = 18;
-
-    var poly3_val = function(coefs, x) {
-        return coefs[0] + x * (coefs[1] + x * (coefs[2] + x * coefs[3]));
-    };
-
-    var poly3_der = function(coefs, x) {
-        return coefs[1] + x * (2 * coefs[2] + x * 3 * coefs[3]);
-    };
-
-    function newton_rapshon(f_df, start, max_err, iters) {
-        var x = start;
-        for (; iters; --iters) {
-            var upd = f_df(x);
-            x -= upd;
-            if (Math.abs(upd) < max_err) {
-                break;
-            }
-        }
-        return x;
-    }
-
-    function init$28() {
-        this.x0 = this.x0 || 0;
-        this.y0 = this.y0 || 0;
-        this.long0 = this.long0 || 0;
-        this.es = 0;
-        this.title = this.title || "Robinson";
-    }
-
-    function forward$27(ll) {
-        var lon = adjust_lon(ll.x - this.long0);
-
-        var dphi = Math.abs(ll.y);
-        var i = Math.floor(dphi * C1);
-        if (i < 0) {
-            i = 0;
-        } else if (i >= NODES) {
-            i = NODES - 1;
-        }
-        dphi = R2D * (dphi - RC1 * i);
-        var xy = {
-            x: poly3_val(COEFS_X[i], dphi) * lon,
-            y: poly3_val(COEFS_Y[i], dphi)
-        };
-        if (ll.y < 0) {
-            xy.y = -xy.y;
-        }
-
-        xy.x = xy.x * this.a * FXC + this.x0;
-        xy.y = xy.y * this.a * FYC + this.y0;
-        return xy;
-    }
-
-    function inverse$27(xy) {
-        var ll = {
-            x: (xy.x - this.x0) / (this.a * FXC),
-            y: Math.abs(xy.y - this.y0) / (this.a * FYC)
-        };
-
-        if (ll.y >= 1) { // pathologic case
-            ll.x /= COEFS_X[NODES][0];
-            ll.y = xy.y < 0 ? -HALF_PI : HALF_PI;
-        } else {
-            // find table interval
-            var i = Math.floor(ll.y * NODES);
-            if (i < 0) {
-                i = 0;
-            } else if (i >= NODES) {
-                i = NODES - 1;
-            }
-            for (;;) {
-                if (COEFS_Y[i][0] > ll.y) {
-                    --i;
-                } else if (COEFS_Y[i+1][0] <= ll.y) {
-                    ++i;
-                } else {
-                    break;
-                }
-            }
-            // linear interpolation in 5 degree interval
-            var coefs = COEFS_Y[i];
-            var t = 5 * (ll.y - coefs[0]) / (COEFS_Y[i+1][0] - coefs[0]);
-            // find t so that poly3_val(coefs, t) = ll.y
-            t = newton_rapshon(function(x) {
-                return (poly3_val(coefs, x) - ll.y) / poly3_der(coefs, x);
-            }, t, EPSLN, 100);
-
-            ll.x /= poly3_val(COEFS_X[i], t);
-            ll.y = (5 * i + t) * D2R;
-            if (xy.y < 0) {
-                ll.y = -ll.y;
-            }
-        }
-
-        ll.x = adjust_lon(ll.x + this.long0);
-        return ll;
-    }
-
-    var names$29 = ["Robinson", "robin"];
-    var robin = {
-      init: init$28,
-      forward: forward$27,
-      inverse: inverse$27,
-      names: names$29
-    };
-
-    function init$29() {
-        this.name = 'geocent';
-
-    }
-
-    function forward$28(p) {
-        var point = geodeticToGeocentric(p, this.es, this.a);
-        return point;
-    }
-
-    function inverse$28(p) {
-        var point = geocentricToGeodetic(p, this.es, this.a, this.b);
-        return point;
-    }
-
-    var names$30 = ["Geocentric", 'geocentric', "geocent", "Geocent"];
-    var geocent = {
-        init: init$29,
-        forward: forward$28,
-        inverse: inverse$28,
-        names: names$30
-    };
-
-    var includedProjections = function(proj4){
-      proj4.Proj.projections.add(tmerc);
-      proj4.Proj.projections.add(etmerc);
-      proj4.Proj.projections.add(utm);
-      proj4.Proj.projections.add(sterea);
-      proj4.Proj.projections.add(stere);
-      proj4.Proj.projections.add(somerc);
-      proj4.Proj.projections.add(omerc);
-      proj4.Proj.projections.add(lcc);
-      proj4.Proj.projections.add(krovak);
-      proj4.Proj.projections.add(cass);
-      proj4.Proj.projections.add(laea);
-      proj4.Proj.projections.add(aea);
-      proj4.Proj.projections.add(gnom);
-      proj4.Proj.projections.add(cea);
-      proj4.Proj.projections.add(eqc);
-      proj4.Proj.projections.add(poly);
-      proj4.Proj.projections.add(nzmg);
-      proj4.Proj.projections.add(mill);
-      proj4.Proj.projections.add(sinu);
-      proj4.Proj.projections.add(moll);
-      proj4.Proj.projections.add(eqdc);
-      proj4.Proj.projections.add(vandg);
-      proj4.Proj.projections.add(aeqd);
-      proj4.Proj.projections.add(ortho);
-      proj4.Proj.projections.add(qsc);
-      proj4.Proj.projections.add(robin);
-      proj4.Proj.projections.add(geocent);
-    };
-
-    proj4$1.defaultDatum = 'WGS84'; //default datum
-    proj4$1.Proj = Projection;
-    proj4$1.WGS84 = new proj4$1.Proj('WGS84');
-    proj4$1.Point = Point;
-    proj4$1.toPoint = toPoint;
-    proj4$1.defs = defs;
-    proj4$1.transform = transform;
-    proj4$1.mgrs = mgrs;
-    proj4$1.version = '2.6.2';
-    includedProjections(proj4$1);
-
-    return proj4$1;
-
-})));
diff --git a/screenreader/feature-index/dist/proj4leaflet.js b/screenreader/feature-index/dist/proj4leaflet.js
deleted file mode 100644
index c5a00f6..0000000
--- a/screenreader/feature-index/dist/proj4leaflet.js
+++ /dev/null
@@ -1,272 +0,0 @@
-(function (factory) {
-	var L, proj4;
-	if (typeof define === 'function' && define.amd) {
-		// AMD
-		define(['leaflet', 'proj4'], factory);
-	} else if (typeof module === 'object' && typeof module.exports === "object") {
-		// Node/CommonJS
-		L = require('leaflet');
-		proj4 = require('proj4');
-		module.exports = factory(L, proj4);
-	} else {
-		// Browser globals
-		if (typeof window.L === 'undefined' || typeof window.proj4 === 'undefined')
-			throw 'Leaflet and proj4 must be loaded first';
-		factory(window.L, window.proj4);
-	}
-}(function (L, proj4) {
-	if (proj4.__esModule && proj4.default) {
-		// If proj4 was bundled as an ES6 module, unwrap it to get
-		// to the actual main proj4 object.
-		// See discussion in https://github.com/kartena/Proj4Leaflet/pull/147
-		proj4 = proj4.default;
-	}
- 
-	L.Proj = {};
-
-	L.Proj._isProj4Obj = function(a) {
-		return (typeof a.inverse !== 'undefined' &&
-			typeof a.forward !== 'undefined');
-	};
-
-	L.Proj.Projection = L.Class.extend({
-		initialize: function(code, def, bounds) {
-			var isP4 = L.Proj._isProj4Obj(code);
-			this._proj = isP4 ? code : this._projFromCodeDef(code, def);
-			this.bounds = isP4 ? def : bounds;
-		},
-
-		project: function (latlng) {
-			var point = this._proj.forward([latlng.lng, latlng.lat]);
-			return new L.Point(point[0], point[1]);
-		},
-
-		unproject: function (point, unbounded) {
-			var point2 = this._proj.inverse([point.x, point.y]);
-			return new L.LatLng(point2[1] || 0, point2[0] || 0, unbounded);
-		},
-
-		_projFromCodeDef: function(code, def) {
-			if (def) {
-				proj4.defs(code, def);
-			} else if (proj4.defs[code] === undefined) {
-				var urn = code.split(':');
-				if (urn.length > 3) {
-					code = urn[urn.length - 3] + ':' + urn[urn.length - 1];
-				}
-				if (proj4.defs[code] === undefined) {
-					throw 'No projection definition for code ' + code;
-				}
-			}
-
-			return proj4(code);
-		}
-	});
-
-	L.Proj.CRS = L.Class.extend({
-		includes: L.CRS,
-
-		options: {
-			transformation: new L.Transformation(1, 0, -1, 0)
-		},
-
-		initialize: function(a, b, c) {
-			var code,
-			    proj,
-			    def,
-			    options;
-
-			if (L.Proj._isProj4Obj(a)) {
-				proj = a;
-				code = proj.srsCode;
-				options = b || {};
-
-				this.projection = new L.Proj.Projection(proj, options.bounds);
-			} else {
-				code = a;
-				def = b;
-				options = c || {};
-				this.projection = new L.Proj.Projection(code, def, options.bounds);
-			}
-
-			L.Util.setOptions(this, options);
-			this.code = code;
-			this.transformation = this.options.transformation;
-
-			if (this.options.origin) {
-				this.transformation =
-					new L.Transformation(1, -this.options.origin[0],
-						-1, this.options.origin[1]);
-			}
-
-			if (this.options.scales) {
-				this._scales = this.options.scales;
-			} else if (this.options.resolutions) {
-				this._scales = [];
-				for (var i = this.options.resolutions.length - 1; i >= 0; i--) {
-					if (this.options.resolutions[i]) {
-						this._scales[i] = 1 / this.options.resolutions[i];
-					}
-				}
-			}
-
-			this.infinite = !this.options.bounds;
-
-		},
-
-		scale: function(zoom) {
-			var iZoom = Math.floor(zoom),
-				baseScale,
-				nextScale,
-				scaleDiff,
-				zDiff;
-			if (zoom === iZoom) {
-				return this._scales[zoom];
-			} else {
-				// Non-integer zoom, interpolate
-				baseScale = this._scales[iZoom];
-				nextScale = this._scales[iZoom + 1];
-				scaleDiff = nextScale - baseScale;
-				zDiff = (zoom - iZoom);
-				return baseScale + scaleDiff * zDiff;
-			}
-		},
-
-		zoom: function(scale) {
-			// Find closest number in this._scales, down
-			var downScale = this._closestElement(this._scales, scale),
-				downZoom = this._scales.indexOf(downScale),
-				nextScale,
-				nextZoom,
-				scaleDiff;
-			// Check if scale is downScale => return array index
-			if (scale === downScale) {
-				return downZoom;
-			}
-			if (downScale === undefined) {
-				return -Infinity;
-			}
-			// Interpolate
-			nextZoom = downZoom + 1;
-			nextScale = this._scales[nextZoom];
-			if (nextScale === undefined) {
-				return Infinity;
-			}
-			scaleDiff = nextScale - downScale;
-			return (scale - downScale) / scaleDiff + downZoom;
-		},
-
-		distance: L.CRS.Earth.distance,
-
-		R: L.CRS.Earth.R,
-
-		/* Get the closest lowest element in an array */
-		_closestElement: function(array, element) {
-			var low;
-			for (var i = array.length; i--;) {
-				if (array[i] <= element && (low === undefined || low < array[i])) {
-					low = array[i];
-				}
-			}
-			return low;
-		}
-	});
-
-	L.Proj.GeoJSON = L.GeoJSON.extend({
-		initialize: function(geojson, options) {
-			this._callLevel = 0;
-			L.GeoJSON.prototype.initialize.call(this, geojson, options);
-		},
-
-		addData: function(geojson) {
-			var crs;
-
-			if (geojson) {
-				if (geojson.crs && geojson.crs.type === 'name') {
-					crs = new L.Proj.CRS(geojson.crs.properties.name);
-				} else if (geojson.crs && geojson.crs.type) {
-					crs = new L.Proj.CRS(geojson.crs.type + ':' + geojson.crs.properties.code);
-				}
-
-				if (crs !== undefined) {
-					this.options.coordsToLatLng = function(coords) {
-						var point = L.point(coords[0], coords[1]);
-						return crs.projection.unproject(point);
-					};
-				}
-			}
-
-			// Base class' addData might call us recursively, but
-			// CRS shouldn't be cleared in that case, since CRS applies
-			// to the whole GeoJSON, inluding sub-features.
-			this._callLevel++;
-			try {
-				L.GeoJSON.prototype.addData.call(this, geojson);
-			} finally {
-				this._callLevel--;
-				if (this._callLevel === 0) {
-					delete this.options.coordsToLatLng;
-				}
-			}
-		}
-	});
-
-	L.Proj.geoJson = function(geojson, options) {
-		return new L.Proj.GeoJSON(geojson, options);
-	};
-
-	L.Proj.ImageOverlay = L.ImageOverlay.extend({
-		initialize: function (url, bounds, options) {
-			L.ImageOverlay.prototype.initialize.call(this, url, null, options);
-			this._projectedBounds = bounds;
-		},
-
-		// Danger ahead: Overriding internal methods in Leaflet.
-		// Decided to do this rather than making a copy of L.ImageOverlay
-		// and doing very tiny modifications to it.
-		// Future will tell if this was wise or not.
-		_animateZoom: function (event) {
-			var scale = this._map.getZoomScale(event.zoom);
-			var northWest = L.point(this._projectedBounds.min.x, this._projectedBounds.max.y);
-			var offset = this._projectedToNewLayerPoint(northWest, event.zoom, event.center);
-
-			L.DomUtil.setTransform(this._image, offset, scale);
-		},
-
-		_reset: function () {
-			var zoom = this._map.getZoom();
-			var pixelOrigin = this._map.getPixelOrigin();
-			var bounds = L.bounds(
-				this._transform(this._projectedBounds.min, zoom)._subtract(pixelOrigin),
-				this._transform(this._projectedBounds.max, zoom)._subtract(pixelOrigin)
-			);
-			var size = bounds.getSize();
-
-			L.DomUtil.setPosition(this._image, bounds.min);
-			this._image.style.width = size.x + 'px';
-			this._image.style.height = size.y + 'px';
-		},
-
-		_projectedToNewLayerPoint: function (point, zoom, center) {
-			var viewHalf = this._map.getSize()._divideBy(2);
-			var newTopLeft = this._map.project(center, zoom)._subtract(viewHalf)._round();
-			var topLeft = newTopLeft.add(this._map._getMapPanePos());
-
-			return this._transform(point, zoom)._subtract(topLeft);
-		},
-
-		_transform: function (point, zoom) {
-			var crs = this._map.options.crs;
-			var transformation = crs.transformation;
-			var scale = crs.scale(zoom);
-
-			return transformation.transform(point, scale);
-		}
-	});
-
-	L.Proj.imageOverlay = function (url, bounds, options) {
-		return new L.Proj.ImageOverlay(url, bounds, options);
-	};
-
-	return L.Proj;
-}));
diff --git a/screenreader/feature-index/dist/web-map.js b/screenreader/feature-index/dist/web-map.js
deleted file mode 100644
index ec305b1..0000000
--- a/screenreader/feature-index/dist/web-map.js
+++ /dev/null
@@ -1,815 +0,0 @@
-import './leaflet-src.js';  // a lightly modified version of Leaflet for use as browser module
-import './proj4-src.js';        // modified version of proj4; could be stripped down for mapml
-import './proj4leaflet.js'; // not modified, seems to adapt proj4 for leaflet use.
-import './mapml.js';       // refactored URI usage, replaced with URL standard
-import { MapLayer } from './layer.js';
-import { MapArea } from './map-area.js';
-
-export class WebMap extends HTMLMapElement {
-  static get observedAttributes() {
-    return ['lat', 'lon', 'zoom', 'projection', 'width', 'height', 'controls'];
-  }
-  // see comments below regarding attributeChangedCallback vs. getter/setter
-  // usage.  Effectively, the user of the element must use the property, not
-  // the getAttribute/setAttribute/removeAttribute DOM API, because the latter
-  // calls don't result in the getter/setter being called (so you have to use
-  // the getter/setter directly)
-  get controls() {
-    return this.hasAttribute('controls');
-  }
-  set controls(value) {
-    const hasControls = Boolean(value);
-    if (hasControls)
-      this.setAttribute('controls', '');
-    else
-      this.removeAttribute('controls');
-    this._toggleControls(hasControls);
-  }
-  get controlslist() {
-    return this.hasAttribute('controlslist') ? this.getAttribute("controlslist") : "";
-  }
-  set controlslist(val) {
-    let options = ["nofullscreen", "nozoom", "nolayer", "noreload"],
-        lowerVal = val.toLowerCase();
-    if (this.controlslist.includes(lowerVal) || !options.includes(lowerVal))return;
-    this.setAttribute("controlslist", this.controlslist+` ${lowerVal}`);
-  }
-  get lat() {
-    return this.hasAttribute("lat") ? this.getAttribute("lat") : "0";
-  }
-  set lat(val) {
-    if (val) {
-      this.setAttribute("lat", val);
-    }
-  }
-  get lon() {
-    return this.hasAttribute("lon") ? this.getAttribute("lon") : "0";
-  }
-  set lon(val) {
-    if (val) {
-      this.setAttribute("lon", val);
-    }
-  }
-  get projection() {
-    return this.hasAttribute("projection") ? this.getAttribute("projection") : "OSMTILE";
-  }
-  set projection(val) {
-    if(val && M[val]){
-      this.setAttribute('projection', val);
-      if (this._map && this._map.options.projection !== val){
-        this._map.options.crs = M[val];
-        this._map.options.projection = val;
-        for(let layer of this.querySelectorAll("layer-")){
-          layer.removeAttribute("disabled");
-          let reAttach = this.removeChild(layer);
-          this.appendChild(reAttach);
-        }
-        if(this._debug) for(let i = 0; i<2;i++) this.toggleDebug();
-      } else this.dispatchEvent(new CustomEvent('createmap'));
-    } else throw new Error("Undefined Projection");
-  }
-  get zoom() {
-    return this.hasAttribute("zoom") ? this.getAttribute("zoom") : 0;
-  }
-  set zoom(val) {
-    var parsedVal = parseInt(val,10);
-    if (!isNaN(parsedVal) && (parsedVal >= 0 && parsedVal <= 25)) {
-      this.setAttribute('zoom', parsedVal);
-    }
-  }
-  get layers() {
-    return this.getElementsByTagName('layer-');
-  }
-  get areas() {
-    return this.getElementsByTagName('area');
-  }
-
-  get extent(){
-    let map = this._map,
-      pcrsBounds = M.pixelToPCRSBounds(
-        map.getPixelBounds(),
-        map.getZoom(),
-        map.options.projection);
-    let formattedExtent = M.convertAndFormatPCRS(pcrsBounds, map);
-    if(map.getMaxZoom() !== Infinity){
-      formattedExtent.zoom = {
-        minZoom:map.getMinZoom(),
-        maxZoom:map.getMaxZoom()
-      };
-    }
-    return (formattedExtent);
-  }
-
-  constructor() {
-    // Always call super first in constructor
-    super();
-
-    this._source = this.outerHTML;
-    let tmpl = document.createElement('template');
-    tmpl.innerHTML = `<link rel="stylesheet" href="${new URL("mapml.css", import.meta.url).href}">`; // jshint ignore:line
-
-    const rootDiv = document.createElement('div');
-    rootDiv.classList.add('mapml-web-map');
-
-    let shadowRoot = rootDiv.attachShadow({mode: 'open'});
-    this._container = document.createElement('div');
-
-    let output = "<output role='status' aria-live='polite' aria-atomic='true' class='mapml-screen-reader-output'></output>";
-    this._container.insertAdjacentHTML("beforeend", output);
-
-    // Set default styles for the map element.
-    let mapDefaultCSS = document.createElement('style');
-    mapDefaultCSS.innerHTML =
-    `[is="web-map"] {` +
-    `all: initial;` + // Reset properties inheritable from html/body, as some inherited styles may cause unexpected issues with the map element's components (https://github.com/Maps4HTML/Web-Map-Custom-Element/issues/140).
-    `contain: layout size;` + // Contain layout and size calculations within the map element.
-    `display: inline-block;` + // This together with dimension properties is required so that Leaflet isn't working with a height=0 box by default.
-    `height: 150px;` + // Provide a "default object size" (https://github.com/Maps4HTML/HTML-Map-Element/issues/31).
-    `width: 300px;` +
-    `border-width: 2px;` + // Set a default border for contrast, similar to UA default for iframes.
-    `border-style: inset;` +
-    `box-sizing: inherit;` + // https://github.com/Maps4HTML/Web-Map-Custom-Element/issues/350#issuecomment-888361985
-    `}` +
-    `[is="web-map"][frameborder="0"] {` +
-  	`border-width: 0;` +
-  	`}` +
-    `[is="web-map"][hidden] {` +
-    `display: none!important;` +
-    `}` +
-    `[is="web-map"] .mapml-web-map {` +
-    `display: contents;` + // This div doesn't have to participate in layout by generating its own box.
-    `}`;
-    
-    let shadowRootCSS = document.createElement('style');
-    shadowRootCSS.innerHTML =
-    `:host .leaflet-control-container {` +
-    `visibility: hidden!important;` + // Visibility hack to improve percieved performance (mitigate FOUC) – visibility is unset in mapml.css! (https://github.com/Maps4HTML/Web-Map-Custom-Element/issues/154).
-    `}`;
-    
-    // Hide all (light DOM) children of the map element except for the
-    // `<area>` and `<div class="mapml-web-map">` (shadow root host) elements.
-    let hideElementsCSS = document.createElement('style');
-    hideElementsCSS.innerHTML =
-    `[is="web-map"] > :not(area):not(.mapml-web-map) {` +
-    `display: none!important;` +
-    `}`;
-    
-    shadowRoot.appendChild(shadowRootCSS);
-    shadowRoot.appendChild(tmpl.content.cloneNode(true));
-    shadowRoot.appendChild(this._container);
-    this.appendChild(rootDiv);
-    this.appendChild(hideElementsCSS);
-    document.head.insertAdjacentElement('afterbegin', mapDefaultCSS);
-    this._toggleState = false;
-    this.controlsListObserver = new MutationObserver((m) => {
-      m.forEach((change)=>{
-        if(change.type==="attributes" && change.attributeName === "controlslist")
-          this.setControls(false,false,false);
-      });
-    });
-    this.controlsListObserver.observe(this, {attributes:true});
-  }
-  connectedCallback() {
-    if (this.isConnected) {
-
-      // the dimension attributes win, if they're there. A map does not
-      // have an intrinsic size, unlike an image or video, and so must
-      // have a defined width and height.
-      var s = window.getComputedStyle(this),
-        wpx = s.width, hpx=s.height,
-        w = parseInt(wpx.replace('px','')),
-        h = parseInt(hpx.replace('px',''));
-
-      if (wpx === "" || hpx === "") {
-         return;
-      }
-
-      if (!this.width || this.width !== w) {
-        this._container.style.width = wpx;
-        this.width = w;
-      } else {
-        this._container.style.width = this.width+"px";
-      }
-
-      if (!this.height || this.height !== h) {
-        this._container.style.height = hpx;
-        this.height = h;
-      } else {
-        this._container.style.height = this.height+"px";
-      }
-
-      // create an array to track the history of the map and the current index
-      if(!this._history){
-        this._history = [];
-        this._historyIndex = -1;
-        this._traversalCall = false;
-      }
-
-      this.addEventListener('createmap', ()=>{
-        if (!this._map) {
-          this._map = L.map(this._container, {
-            center: new L.LatLng(this.lat, this.lon),
-            projection: this.projection,
-            query: true,
-            contextMenu: true,
-            announceMovement: M.options.announceMovement,
-            mapEl: this,
-            crs: M[this.projection],
-            zoom: this.zoom,
-            zoomControl: false,
-            // because the M.MapMLLayer invokes _tileLayer._onMoveEnd when
-            // the mapml response is received the screen tends to flash.  I'm sure
-            // there is a better configuration than that, but at this moment
-            // I'm not sure how to approach that issue.
-            // See https://github.com/Maps4HTML/MapML-Leaflet-Client/issues/24
-            fadeAnimation: true
-          });
-          this._addToHistory();
-          // the attribution control is not optional
-          this._attributionControl =  this._map.attributionControl.setPrefix('<a href="https://www.w3.org/community/maps4html/" title="W3C Maps for HTML Community Group">Maps4HTML</a> | <a href="https://leafletjs.com" title="A JS library for interactive maps">Leaflet</a>');
-          this._attributionControl.getContainer().setAttribute("role","group");
-          this._attributionControl.getContainer().setAttribute("aria-label","Map data attribution");
-
-          this.setControls(false,false,true);
-          this._crosshair = M.crosshair().addTo(this._map);
-          this._featureIndex = M.featureIndex().addTo(this._map);
-
-          if (this.hasAttribute('name')) {
-            var name = this.getAttribute('name');
-            if (name) {
-              this.poster = document.querySelector('img[usemap='+'"#'+name+'"]');
-              // firefox has an issue where the attribution control's use of
-              // _container.innerHTML does not work properly if the engine is throwing
-              // exceptions because there are no area element children of the image map
-              // for firefox only, a workaround is to actually remove the image...
-              if (this.poster) {
-                if (L.Browser.gecko) {
-                    this.poster.removeAttribute('usemap');
-                }
-                //this.appendChild(this.poster);
-              }
-            }
-          }
-
-          // undisplay the img in the image map, because it's not needed now.
-          // gives a slight FOUC, unless:
-          // 1) the img is pre-styled (https://github.com/Maps4HTML/Web-Map-Custom-Element/blob/80a4a4e372d2ef61bb7cad6a111e17e396b8e908/index-map-area.html#L35)
-          // 2) placed after the map element
-          if (this.poster) {
-            this.poster.setAttribute('hidden', '');
-          }
-          
-          // https://github.com/Maps4HTML/Web-Map-Custom-Element/issues/274
-          this.setAttribute('role', 'application');
-          // Make the Leaflet container element programmatically identifiable
-          // (https://github.com/Leaflet/Leaflet/issues/7193).
-          this._container.setAttribute('role', 'region');
-          this._container.setAttribute('aria-label', 'Interactive map');
-          
-          this._setUpEvents();
-          // this.fire('load', {target: this});
-        }
-      }, {once:true});
-
-      let custom = !(["CBMTILE","APSTILE","OSMTILE","WGS84"].includes(this.projection));
-      // if the page doesn't use nav.js or isn't custom then dispatch createmap event	
-      if(!custom){	
-        this.dispatchEvent(new CustomEvent('createmap'));
-      }
-    }
-  }
-  disconnectedCallback() {
-    //this._removeEvents();
-    delete this._map;
-  }
-  adoptedCallback() {
-//    console.log('Custom map element moved to new page.');
-  }
-
-  setControls(isToggle, toggleShow, setup){
-    if (this.controls && this._map) {
-      let controls = ["_zoomControl", "_reloadButton", "_fullScreenControl", "_layerControl"],
-          options = ["nozoom", "noreload", "nofullscreen", 'nolayer'],
-          mapSize = this._map.getSize().y,
-          totalSize = 0;
-
-      //removes the left hand controls, if not done they will be re-added in the incorrect order
-      //better to just reset them
-      for(let i = 0 ; i<3;i++){
-        if(this[controls[i]]){
-          this._map.removeControl(this[controls[i]]);
-          delete this[controls[i]];
-        }
-      }
-
-      if (!this.controlslist.toLowerCase().includes("nolayer") && !this._layerControl && this.layers.length > 0){
-        this._layerControl = M.mapMlLayerControl(null,{"collapsed": true, mapEl: this}).addTo(this._map);
-        //if this is the initial setup the layers dont need to be readded, causes issues if they are
-        if(!setup){
-          for (var i=0;i<this.layers.length;i++) {
-            if (!this.layers[i].hidden) {
-              this._layerControl.addOverlay(this.layers[i]._layer, this.layers[i].label);
-              this._map.on('moveend', this.layers[i]._validateDisabled,  this.layers[i]);
-              this.layers[i]._layerControl = this._layerControl;
-            }
-          }
-          this._map.fire("validate");
-        }
-      }
-      if (!this.controlslist.toLowerCase().includes("nozoom") && !this._zoomControl && (totalSize + 93) <= mapSize){
-        totalSize += 93;
-        this._zoomControl = L.control.zoom().addTo(this._map);
-      }
-      if (!this.controlslist.toLowerCase().includes("noreload") && !this._reloadButton && (totalSize + 49) <= mapSize){
-        totalSize += 49;
-        this._reloadButton = M.reloadButton().addTo(this._map);
-      }
-      if (!this.controlslist.toLowerCase().includes("nofullscreen") && !this._fullScreenControl && (totalSize + 49) <= mapSize){
-        totalSize += 49;
-        this._fullScreenControl = M.fullscreenButton().addTo(this._map);
-      }
-      //removes any control layers that are not needed, either by the toggling or by the controlslist attribute
-      for(let i in options){
-        if(this[controls[i]] && (this.controlslist.toLowerCase().includes(options[i]) || (isToggle && !toggleShow ))){
-          this._map.removeControl(this[controls[i]]);
-          delete this[controls[i]];
-        }
-      }
-    }
-  }
-  attributeChangedCallback(name, oldValue, newValue) {
-//    console.log('Attribute: ' + name + ' changed from: '+ oldValue + ' to: '+newValue);
-    // "Best practice": handle side-effects in this callback
-    // https://developers.google.com/web/fundamentals/web-components/best-practices
-    // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
-    // note that the example is misleading, since the user can't use
-    // setAttribute or removeAttribute to set the property, they need to use
-    // the property directly in their API usage, which kinda sucks
-    /*
-  const hasValue = newValue !== null;
-  switch (name) {
-    case 'checked':
-      // Note the attributeChangedCallback is only handling the *side effects*
-      // of setting the attribute.
-      this.setAttribute('aria-checked', hasValue);
-      break;
-    ...
-  }     */
-  }
-  _dropHandler(event) {
-    event.preventDefault();
-    // create a new <layer-> child of this <map> element
-      let l = new MapLayer();
-      l.src = event.dataTransfer.getData("text");
-      l.label = 'Layer';
-      l.checked = 'true';
-      this.appendChild(l);
-      l.addEventListener("error", function () {
-        if (l.parentElement) {
-          // should invoke lifecyle callbacks automatically by removing it from DOM
-          l.parentElement.removeChild(l);
-        }
-        // garbage collect it
-        l = null;
-      });
-  }
-  _dragoverHandler(event) {
-    function contains(list, value) {
-      for( var i = 0; i < list.length; ++i ) {
-        if(list[i] === value) return true;
-      }
-      return false;
-    }
-    // check if the thing being dragged is a URL
-    var isLink = contains( event.dataTransfer.types, "text/uri-list");
-    if (isLink) {
-      event.preventDefault();
-      event.dataTransfer.dropEffect = "copy";
-    }
-  }
-  _removeEvents() {
-    if (this._map) {
-      this._map.off('preclick click dblclick mousemove mouseover mouseout mousedown mouseup contextmenu', false, this);
-      this._map.off('load movestart move moveend zoomstart zoom zoomend', false, this);
-      this.removeEventListener("drop", this._dropHandler, false);
-      this.removeEventListener("dragover", this._dragoverHandler, false);
-    }
-  }
-  _setUpEvents() {
-    this.addEventListener("drop", this._dropHandler, false);
-    this.addEventListener("dragover", this._dragoverHandler, false);
-    this.addEventListener("change",
-    function(e) {
-      if(e.target.tagName === "LAYER-"){
-        this.dispatchEvent(new CustomEvent("layerchange", {details:{target: this, originalEvent: e}}));
-      }
-    }, false);
-
-    this.parentElement.addEventListener('keyup', function (e) {
-      if(e.keyCode === 9 && document.activeElement.nodeName === "MAPML-VIEWER"){
-        document.activeElement.dispatchEvent(new CustomEvent('mapfocused', {detail:
-              {target: this}}));
-      }
-    });
-    this.parentElement.addEventListener('mousedown', function (e) {
-      if(document.activeElement.nodeName === "MAPML-VIEWER"){
-        document.activeElement.dispatchEvent(new CustomEvent('mapfocused', {detail:
-              {target: this}}));
-      }
-    });
-    this._map.on('load',
-      function () {
-        this.dispatchEvent(new CustomEvent('load', {detail: {target: this}}));
-      }, this);
-    this._map.on('preclick',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('preclick', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      }, this);
-    this._map.on('click',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('click', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      }, this);
-    this._map.on('dblclick',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('dblclick', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      }, this);
-    this._map.on('mousemove',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('mousemove', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      }, this);
-    this._map.on('mouseover',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('mouseover', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      }, this);
-    this._map.on('mouseout',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('mouseout', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      }, this);
-    this._map.on('mousedown',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('mousedown', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      },this);
-    this._map.on('mouseup',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('mouseup', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      }, this);
-    this._map.on('contextmenu',
-      function (e) {
-        this.dispatchEvent(new CustomEvent('contextmenu', {detail:
-          {lat: e.latlng.lat,     lon: e.latlng.lng,
-             x: e.containerPoint.x, y: e.containerPoint.y}
-         }));
-      }, this);
-    this._map.on('movestart',
-      function () {
-        this._updateMapCenter();
-        this.dispatchEvent(new CustomEvent('movestart', {detail:
-          {target: this}}));
-      }, this);
-    this._map.on('move',
-      function () {
-        this._updateMapCenter();
-        this.dispatchEvent(new CustomEvent('move', {detail:
-          {target: this}}));
-      }, this);
-    this._map.on('moveend',
-      function () {
-        this._updateMapCenter();
-        this._addToHistory();
-        this.dispatchEvent(new CustomEvent('moveend', {detail:
-          {target: this}}));
-      }, this);
-    this._map.on('zoomstart',
-      function () {
-        this._updateMapCenter();
-        this.dispatchEvent(new CustomEvent('zoomstart', {detail:
-          {target: this}}));
-      }, this);
-    this._map.on('zoom',
-      function () {
-        this._updateMapCenter();
-        this.dispatchEvent(new CustomEvent('zoom', {detail:
-          {target: this}}));
-      }, this);
-    this._map.on('zoomend',
-      function () {
-        this._updateMapCenter();
-        this.dispatchEvent(new CustomEvent('zoomend', {detail:
-          {target: this}}));
-      }, this);
-  }
-  _toggleControls() {
-    if (this._map) {
-        this.setControls(true, this._toggleState, false);
-        this._toggleState = !this._toggleState;
-    }
-  }
-
-  toggleDebug(){
-    if(this._debug){
-      this._debug.remove();
-      this._debug = undefined;
-    } else {
-      this._debug = M.debugOverlay().addTo(this._map);
-    }
-  }
-  
-  _widthChanged(width) {
-    this.style.width = width+"px";
-    this._container.style.width = width+"px";
-    if (this._map) {
-        this._map.invalidateSize(false);
-    }
-  }
-  _heightChanged(height) {
-    this.style.height = height+"px";
-    this._container.style.height = height+"px";
-    if (this._map) {
-        this._map.invalidateSize(false);
-    }
-  }
-  zoomTo(lat, lon, zoom) {
-    zoom = Number.isInteger(+zoom) ? +zoom : this.zoom;
-    let location = new L.LatLng(+lat, +lon);
-    this._map.setView(location, zoom);
-    this.zoom = zoom;
-    this.lat = location.lat;
-    this.lon = location.lng;
-  }
-  _updateMapCenter() {
-    // remember to tell Leaflet event handler that 'this' in here refers to
-    //  something other than the map in this case the custom polymer element
-    this.lat = this._map.getCenter().lat;
-    this.lon = this._map.getCenter().lng;
-    this.zoom = this._map.getZoom();
-  }
-
-  /**
-   * Adds to the maps history on moveends
-   * @private
-   */
-  _addToHistory(){
-    if(this._traversalCall > 0) { // this._traversalCall tracks how many consecutive moveends to ignore from history
-      this._traversalCall--;      // this is useful for ignoring moveends corresponding to back, forward and reload
-      return;
-    }
-
-    let mapLocation = this._map.getPixelBounds().getCenter();
-    let location = {
-      zoom: this._map.getZoom(),
-      x:mapLocation.x,
-      y:mapLocation.y,
-    };
-    this._historyIndex++;
-    this._history.splice(this._historyIndex, 0, location);
-  }
-
-  /**
-   * Allow user to move back in history
-   */
-  back(){
-    let history = this._history;
-    let curr = history[this._historyIndex];
-
-    if(this._historyIndex > 0){
-      this._historyIndex--;
-      let prev = history[this._historyIndex];
-
-      if(prev.zoom !== curr.zoom){
-        this._traversalCall = 2;  // allows the next 2 moveends to be ignored from history
-
-        let currScale = this._map.options.crs.scale(curr.zoom); // gets the scale of the current zoom level
-        let prevScale = this._map.options.crs.scale(prev.zoom); // gets the scale of the previous zoom level
-
-        let scale = currScale / prevScale; // used to convert the previous pixel location to be in terms of the current zoom level
-
-        this._map.panBy([((prev.x * scale) - curr.x), ((prev.y * scale) - curr.y)], {animate: false});
-        this._map.setZoom(prev.zoom);
-      } else {
-        this._traversalCall = 1;
-        this._map.panBy([(prev.x - curr.x), (prev.y - curr.y)]);
-      }
-    }
-  }
-
-  /**
-   * Allows user to move forward in history
-   */
-  forward(){
-    let history = this._history;
-    let curr = history[this._historyIndex];
-    if(this._historyIndex < history.length - 1){
-      this._historyIndex++;
-      let next = history[this._historyIndex];
-
-      if(next.zoom !== curr.zoom){
-        this._traversalCall = 2; // allows the next 2 moveends to be ignored from history
-
-        let currScale = this._map.options.crs.scale(curr.zoom); // gets the scale of the current zoom level
-        let nextScale = this._map.options.crs.scale(next.zoom); // gets the scale of the next zoom level
-
-        let scale = currScale / nextScale; // used to convert the next pixel location to be in terms of the current zoom level
-
-        this._map.panBy([((next.x * scale) - curr.x), ((next.y * scale) - curr.y)], {animate: false});
-        this._map.setZoom(next.zoom);
-      } else {
-        this._traversalCall = 1;
-        this._map.panBy([(next.x - curr.x), (next.y - curr.y)]);
-      }
-    }
-  }
-
-  /**
-   * Allows the user to reload/reset the map's location to it's initial location
-   */
-  reload(){
-    let initialLocation = this._history.shift();
-    let mapLocation = this._map.getPixelBounds().getCenter();
-    let curr = {
-      zoom: this._map.getZoom(),
-      x:mapLocation.x,
-      y:mapLocation.y,
-    };
-
-    this._history = [initialLocation];
-    this._historyIndex = 0;
-
-    if(initialLocation.zoom !== curr.zoom) {
-      this._traversalCall = 2; // ignores the next 2 moveend events
-
-      let currScale = this._map.options.crs.scale(curr.zoom); // gets the scale of the current zoom level
-      let initScale = this._map.options.crs.scale(initialLocation.zoom); // gets the scale of the initial location's zoom
-
-      let scale = currScale / initScale;
-
-      this._map.panBy([((initialLocation.x * scale) - curr.x), ((initialLocation.y * scale) - curr.y)], {animate: false});
-      this._map.setZoom(initialLocation.zoom);
-    } else { // if it's on the same zoom level as the initial location, no need to calculate scales
-      this._traversalCall = 1;
-      this._map.panBy([(initialLocation.x- curr.x), (initialLocation.y - curr.y)]);
-    }
-  }
-
-  viewSource(){
-    let blob = new Blob([this._source],{type:"text/plain"}),
-        url = URL.createObjectURL(blob);
-    window.open(url);
-    URL.revokeObjectURL(url);
-  }
-
-  defineCustomProjection(jsonTemplate) {
-    let t = JSON.parse(jsonTemplate);
-    if (t === undefined || !t.proj4string || !t.projection || !t.resolutions || !t.origin || !t.bounds) throw new Error('Incomplete TCRS Definition');
-    if (t.projection.indexOf(":") >= 0) throw new Error('":" is not permitted in projection name');
-    if (M[t.projection.toUpperCase()]) return t.projection.toUpperCase();
-    let tileSize = [256, 512, 1024, 2048, 4096].includes(t.tilesize)?t.tilesize:256;
-
-    M[t.projection] = new L.Proj.CRS(t.projection, t.proj4string, {
-      origin: t.origin,
-      resolutions: t.resolutions,
-      bounds: L.bounds(t.bounds),
-      crs: {
-        tcrs: {
-          horizontal: {
-            name: "x",
-            min: 0, 
-            max: zoom => (M[t.projection].options.bounds.getSize().x / M[t.projection].options.resolutions[zoom]).toFixed()
-          },
-          vertical: {
-            name: "y",
-            min:0, 
-            max: zoom => (M[t.projection].options.bounds.getSize().y / M[t.projection].options.resolutions[zoom]).toFixed()
-          },
-          bounds: zoom => L.bounds([M[t.projection].options.crs.tcrs.horizontal.min,
-            M[t.projection].options.crs.tcrs.vertical.min],
-            [M[t.projection].options.crs.tcrs.horizontal.max(zoom),
-            M[t.projection].options.crs.tcrs.vertical.max(zoom)])
-        },
-        pcrs: {
-          horizontal: {
-            name: "easting",
-            get min() {return M[t.projection].options.bounds.min.x;},
-            get max() {return M[t.projection].options.bounds.max.x;}
-          }, 
-          vertical: {
-            name: "northing", 
-            get min() {return M[t.projection].options.bounds.min.y;},
-            get max() {return M[t.projection].options.bounds.max.y;}
-          },
-          get bounds() {return M[t.projection].options.bounds;}
-        }, 
-        gcrs: {
-          horizontal: {
-            name: "longitude",
-            // set min/max axis values from EPSG registry area of use, retrieved 2019-07-25
-            get min() {return M[t.projection].unproject(M.OSMTILE.options.bounds.min).lng;},
-            get max() {return M[t.projection].unproject(M.OSMTILE.options.bounds.max).lng;}
-          }, 
-          vertical: {
-            name: "latitude",
-            // set min/max axis values from EPSG registry area of use, retrieved 2019-07-25
-            get min() {return M[t.projection].unproject(M.OSMTILE.options.bounds.min).lat;},
-            get max() {return M[t.projection].unproject(M.OSMTILE.options.bounds.max).lat;}
-          },
-          get bounds() {return L.latLngBounds(
-                [M[t.projection].options.crs.gcrs.vertical.min,M[t.projection].options.crs.gcrs.horizontal.min],
-                [M[t.projection].options.crs.gcrs.vertical.max,M[t.projection].options.crs.gcrs.horizontal.max]);}
-        },
-        map: {
-          horizontal: {
-            name: "i",
-            min: 0,
-            max: map => map.getSize().x
-          },
-          vertical: {
-            name: "j",
-            min: 0,
-            max: map => map.getSize().y
-          },
-          bounds: map => L.bounds(L.point([0,0]),map.getSize())
-        },
-        tile: {
-          horizontal: {
-            name: "i",
-            min: 0,
-            max: tileSize,
-          },
-          vertical: {
-            name: "j",
-            min: 0,
-            max: tileSize,
-          },
-          get bounds() {return L.bounds(
-                    [M[t.projection].options.crs.tile.horizontal.min,M[t.projection].options.crs.tile.vertical.min],
-                    [M[t.projection].options.crs.tile.horizontal.max,M[t.projection].options.crs.tile.vertical.max]);}
-        },
-        tilematrix: {
-          horizontal: {
-            name: "column",
-            min: 0,
-            max: zoom => (M[t.projection].options.crs.tcrs.horizontal.max(zoom) / M[t.projection].options.crs.tile.bounds.getSize().x).toFixed()
-          },
-          vertical: {
-            name: "row",
-            min: 0,
-            max: zoom => (M[t.projection].options.crs.tcrs.vertical.max(zoom) / M[t.projection].options.crs.tile.bounds.getSize().y).toFixed()
-          },
-          bounds: zoom => L.bounds(
-                   [M[t.projection].options.crs.tilematrix.horizontal.min,
-                   M[t.projection].options.crs.tilematrix.vertical.min],
-                   [M[t.projection].options.crs.tilematrix.horizontal.max(zoom),
-                   M[t.projection].options.crs.tilematrix.vertical.max(zoom)])
-        }
-      },
-    });      //creates crs using L.Proj
-    M[t.projection.toUpperCase()] = M[t.projection]; //adds the projection uppercase to global M
-    return t.projection;
-  }
-
-  _ready() {
-    if (this.hasAttribute('name')) {
-      var name = this.getAttribute('name');
-      if (name) {
-        this.poster = document.querySelector('img[usemap='+'"#'+name+'"]');
-        // firefox has an issue where the attribution control's use of
-        // _container.innerHTML does not work properly if the engine is throwing
-        // exceptions because there are no area element children of the image map
-        // for firefox only, a workaround is to actually remove the image...
-        if (this.poster) {
-          if (L.Browser.gecko) {
-            this.poster.removeAttribute('usemap');
-          }
-          this._container.appendChild(this.poster);
-        }
-      }
-    }
-  }
-}
-// need to provide options { extends: ... }  for custom built-in elements
-window.customElements.define('web-map', WebMap,  { extends: 'map' });
-window.customElements.define('layer-', MapLayer);
-window.customElements.define('map-area', MapArea, {extends: 'area'});
diff --git a/screenreader/feature-index/index.html b/screenreader/feature-index/index.html
deleted file mode 100644
index 28e9724..0000000
--- a/screenreader/feature-index/index.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<!doctype html>
-<html lang="en">
-  <head>
-    <meta charset="utf-8">
-    <meta name="viewport" content="width=device-width,initial-scale=1">
-    <title>Ottawa Restaurants</title>
-    <script type="module" src="./dist/mapml-viewer.js"></script>
-    <link rel="stylesheet" href="../../global.css">
-  </head>
-  <body>
-    <mapml-viewer projection="OSMTILE" zoom="15" lat="45.409071" lon="-75.703411" controls>
-      <layer- label="OpenStreetMap" src="../../refactoring-temporary/osm.mapml" checked hidden></layer->
-      <layer- label="Ottawa Restaurants" src="restaurants.mapml" checked></layer->
-    </mapml-viewer>
-  </body>
-</html>
diff --git a/screenreader/feature-index/restaurants.mapml b/screenreader/feature-index/restaurants.mapml
deleted file mode 100644
index d5b4ff2..0000000
--- a/screenreader/feature-index/restaurants.mapml
+++ /dev/null
@@ -1,387 +0,0 @@
-<mapml- xmlns="http://www.w3.org/1999/xhtml">
-    <map-head>
-        <map-title>Restaurants</map-title>
-        <map-meta charset="utf-8" ></map-meta>
-        <map-meta content="text/mapml" http-equiv="Content-Type" ></map-meta>
-        <map-link rel="license" href="http://opendatacommons.org/licenses/odbl/1-0/" title="© OpenStreetMap and contributors" />
-        <map-meta name="projection" content="OSMTILE"></map-meta>
-        <map-meta name="zoom" content="min=0,max=22,value=3" ></map-meta>
-        <map-meta name="cs" content="gcrs" ></map-meta>
-<!--   cbmtile extent     <map-meta name="extent" content="top-left-easting=1509080.1964270622,top-left-northing=-169400.558801122,bottom-right-easting=1512094.3357886747,bottom-right-northing=-172702.5654051304" ></map-meta>-->
-        <map-meta name="extent" content="top-left-easting=-8433134.90,top-left-northing=5689045.64,bottom-right-easting=-8421315.83,bottom-right-northing=5683319.12" ></map-meta>
-    </map-head>
-    <map-body>
-        <map-feature id="restaurant_map-point.77" class="restaurant_map-point">
-          <map-featurecaption>Hung Sum Restaurant</map-featurecaption>
-            <map-geometry>
-                <map-point>
-                        <map-coordinates>-75.71543400037297 45.40819502909854</map-coordinates>
-                </map-point>
-            </map-geometry>
-            <map-properties>
-                <table>
-                    <thead>
-                        <tr>
-                            <th role="columnheader" scope="col">Property name</th>
-                            <th role="columnheader" scope="col">Property value</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <tr>
-                            <th scope="row">amenity</th>
-                            <td itemprop="amenity">restaurant</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">name</th>
-                            <td itemprop="name">Hung Sum Restaurant</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_stree</th>
-                            <td itemprop="addr_stree">Somerset Street West</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_house</th>
-                            <td itemprop="addr_house">939</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">cuisine</th>
-                            <td itemprop="cuisine">chinese</td>
-                        </tr>
-                    </tbody>
-                </table>
-            </map-properties>
-        </map-feature>
-        <map-feature id="restaurant_map-point.2" class="restaurant_map-point">
-          <map-featurecaption>Big Daddy's</map-featurecaption>
-            <map-geometry>
-                <map-point>
-                  <map-coordinates>-75.6902755031953 45.41868067160079</map-coordinates>
-                </map-point>
-            </map-geometry>
-            <map-properties>
-                <table>
-                    <thead>
-                        <tr>
-                            <th role="columnheader" scope="col">Property name</th>
-                            <th role="columnheader" scope="col">Property value</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <tr>
-                            <th scope="row">amenity</th>
-                            <td itemprop="amenity">restaurant</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">name</th>
-                            <td itemprop="name">Big Daddy's</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_stree</th>
-                            <td itemprop="addr_stree">Cooper Street</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_house</th>
-                            <td itemprop="addr_house">180</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">cuisine</th>
-                            <td itemprop="cuisine">seafood</td>
-                        </tr>
-                    </tbody>
-                </table>
-            </map-properties>
-        </map-feature>
-        <map-feature id="restaurant_map-point.9" class="restaurant_map-point">
-          <map-featurecaption>Hareg Cafe &amp; Variety</map-featurecaption>
-            <map-geometry>
-              <map-point>
-                <map-coordinates>-75.69108408413759 45.407905135087496</map-coordinates>
-              </map-point>
-            </map-geometry>
-            <map-properties>
-                <table>
-                    <thead>
-                        <tr>
-                            <th role="columnheader" scope="col">Property name</th>
-                            <th role="columnheader" scope="col">Property value</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <tr>
-                            <th scope="row">amenity</th>
-                            <td itemprop="amenity">restaurant</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">name</th>
-                            <td itemprop="name">Hareg Cafe &amp; Variety</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_stree</th>
-                            <td itemprop="addr_stree">Bank Street</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_house</th>
-                            <td itemprop="addr_house">587</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">cuisine</th>
-                            <td itemprop="cuisine">african</td>
-                        </tr>
-                    </tbody>
-                </table>
-            </map-properties>
-        </map-feature>
-        <map-feature id="restaurant_map-point.13" class="restaurant_map-point">
-          <map-featurecaption>Phucket Royal</map-featurecaption>
-            <map-geometry>
-              <map-point>
-                <map-coordinates>-75.70786179432208 45.410746385011166</map-coordinates>
-              </map-point>
-            </map-geometry>
-            <map-properties>
-                <table>
-                    <thead>
-                        <tr>
-                            <th role="columnheader" scope="col">Property name</th>
-                            <th role="columnheader" scope="col">Property value</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <tr>
-                            <th scope="row">amenity</th>
-                            <td itemprop="amenity">restaurant</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">name</th>
-                            <td itemprop="name">Phucket Royal</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_stree</th>
-                            <td itemprop="addr_stree">Somerset Street West</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_house</th>
-                            <td itemprop="addr_house">713</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">cuisine</th>
-                            <td itemprop="cuisine">thai</td>
-                        </tr>
-                    </tbody>
-                </table>
-            </map-properties>
-        </map-feature>
-        <map-feature id="restaurant_map-point.18" class="restaurant_map-point">
-          <map-featurecaption>Sushi 88</map-featurecaption>
-            <map-geometry>
-              <map-point>
-                <map-coordinates>-75.70642921479893 45.41108327733854</map-coordinates>
-              </map-point>
-            </map-geometry>
-            <map-properties>
-                <table>
-                    <thead>
-                        <tr>
-                            <th role="columnheader" scope="col">Property name</th>
-                            <th role="columnheader" scope="col">Property value</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <tr>
-                            <th scope="row">amenity</th>
-                            <td itemprop="amenity">restaurant</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">name</th>
-                            <td itemprop="name">Sushi 88</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_stree</th>
-                            <td itemprop="addr_stree">Somerset Street West</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_house</th>
-                            <td itemprop="addr_house">690 B</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">cuisine</th>
-                            <td itemprop="cuisine">sushi</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">website</th>
-                            <td itemprop="website" />
-                        </tr>
-                        <tr>
-                            <th scope="row">phone</th>
-                            <td itemprop="phone">+1-613-233-3288</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">wheelchair</th>
-                            <td itemprop="wheelchair">no</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_postc</th>
-                            <td itemprop="addr_postc">K1R 6P4</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">outdoor_se</th>
-                            <td itemprop="outdoor_se">no</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">takeaway</th>
-                            <td itemprop="takeaway">yes</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">delivery</th>
-                            <td itemprop="delivery">no</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">internet_a</th>
-                            <td itemprop="internet_a">no</td>
-                        </tr>
-                    </tbody>
-                </table>
-            </map-properties>
-        </map-feature>
-        <map-feature id="restaurant_polygon.2" class="restaurant_polygon">
-          <map-featurecaption>Banditos</map-featurecaption>
-            <map-geometry>
-              <map-point>
-                  <map-coordinates>-75.689609 45.405803</map-coordinates>
-              </map-point>
-            </map-geometry>
-            <map-properties>
-                <table>
-                    <thead>
-                        <tr>
-                            <th role="columnheader" scope="col">Property name</th>
-                            <th role="columnheader" scope="col">Property value</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <tr>
-                            <th scope="row">addr_house</th>
-                            <td itemprop="addr_house">683</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_stree</th>
-                            <td itemprop="addr_stree">Bank Street</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">amenity</th>
-                            <td itemprop="amenity">restaurant</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">building</th>
-                            <td itemprop="building">commercial</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">name</th>
-                            <td itemprop="name">Banditos</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">cuisine</th>
-                            <td itemprop="cuisine">mexican</td>
-                        </tr>
-                    </tbody>
-                </table>
-            </map-properties>
-        </map-feature>
-        <map-feature id="restaurant_polygon.7" class="restaurant_polygon">
-          <map-featurecaption>India Palace</map-featurecaption>
-            <map-geometry>
-              <map-point>
-                  <map-coordinates>-75.7019048 45.4191548</map-coordinates>
-              </map-point>
-            </map-geometry>
-            <map-properties>
-                <table>
-                    <thead>
-                        <tr>
-                            <th role="columnheader" scope="col">Property name</th>
-                            <th role="columnheader" scope="col">Property value</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <tr>
-                            <th scope="row">addr_house</th>
-                            <td itemprop="addr_house">292</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_stree</th>
-                            <td itemprop="addr_stree">Albert Street</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">amenity</th>
-                            <td itemprop="amenity">restaurant</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">building</th>
-                            <td itemprop="building">yes</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">name</th>
-                            <td itemprop="name">India Palace</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">cuisine</th>
-                            <td itemprop="cuisine">indian</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">website</th>
-                            <td itemprop="website">http://www.indiapalace.ca</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">phone</th>
-                            <td itemprop="phone">+1-613-234-5433</td>
-                        </tr>
-                    </tbody>
-                </table>
-            </map-properties>
-        </map-feature>
-        <map-feature id="restaurant_polygon.20" class="restaurant_polygon">
-          <map-featurecaption>The Prescott</map-featurecaption>
-            <map-geometry>
-              <map-point>
-                  <map-coordinates>-75.7093517 45.4005727</map-coordinates>
-              </map-point>
-            </map-geometry>
-            <map-properties>
-                <table>
-                    <thead>
-                        <tr>
-                            <th role="columnheader" scope="col">Property name</th>
-                            <th role="columnheader" scope="col">Property value</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <tr>
-                            <th scope="row">addr_house</th>
-                            <td itemprop="addr_house">379</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_stree</th>
-                            <td itemprop="addr_stree">Preston Street</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">amenity</th>
-                            <td itemprop="amenity">restaurant</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">building</th>
-                            <td itemprop="building">retail</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">name</th>
-                            <td itemprop="name">The Prescott</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">website</th>
-                            <td itemprop="website"><a href="http://www.theprescott.com/">The Prescott</a></td>
-                        </tr>
-                    </tbody>
-                </table>
-            </map-properties>
-        </map-feature>
-    </map-body>
-</mapml->
diff --git a/screenreader/restaurants/index.html b/screenreader/restaurants/index.html
index b6c9c17..4806c09 100644
--- a/screenreader/restaurants/index.html
+++ b/screenreader/restaurants/index.html
@@ -12,7 +12,22 @@
       <layer- label="CBMT" src="/experiments/refactoring-temporary/cbmtile-cbmt.mapml" checked hidden></layer->-->
     <mapml-viewer projection="OSMTILE" zoom="15" lat="45.409071" lon="-75.703411" controls>
       <layer- label="OpenStreetMap" src="../../refactoring-temporary/osm.mapml" checked hidden></layer->
-      <layer- label="Ottawa Restaurants" src="restaurants.mapml" checked></layer->
+      <layer- id="restaurant" label="Restaurants" checked>
+        <map-meta name="cs" content="gcrs" ></map-meta>
+        <map-meta name="extent" content="top-left-easting=-8433179, top-left-northing=5689316, bottom-right-easting=-8420968, bottom-right-northing=5683139"></map-meta>
+        <map-extent units="OSMTILE">
+           <map-select id="restaurants" name="cusine">
+              <map-option value="restaurants" selected>All cuisines</map-option>
+              <map-option value="african">African</map-option>
+              <map-option value="asian">Asian</map-option>
+              <map-option value="cajun">Cajun</map-option>
+              <map-option value="indian">Indian</map-option>
+              <map-option value="italian">Italian</map-option>
+              <map-option value="mexican">Mexican</map-option>
+            </map-select>
+            <map-link tref="../../shared/restaurants/{cusine}.mapml" rel="features"/>
+          </map-extent>
+      </layer->
     </mapml-viewer>
   </body>
 </html>
diff --git a/screenreader/restaurants/restaurants.mapml b/screenreader/restaurants/restaurants.mapml
deleted file mode 100644
index d5b4ff2..0000000
--- a/screenreader/restaurants/restaurants.mapml
+++ /dev/null
@@ -1,387 +0,0 @@
-<mapml- xmlns="http://www.w3.org/1999/xhtml">
-    <map-head>
-        <map-title>Restaurants</map-title>
-        <map-meta charset="utf-8" ></map-meta>
-        <map-meta content="text/mapml" http-equiv="Content-Type" ></map-meta>
-        <map-link rel="license" href="http://opendatacommons.org/licenses/odbl/1-0/" title="© OpenStreetMap and contributors" />
-        <map-meta name="projection" content="OSMTILE"></map-meta>
-        <map-meta name="zoom" content="min=0,max=22,value=3" ></map-meta>
-        <map-meta name="cs" content="gcrs" ></map-meta>
-<!--   cbmtile extent     <map-meta name="extent" content="top-left-easting=1509080.1964270622,top-left-northing=-169400.558801122,bottom-right-easting=1512094.3357886747,bottom-right-northing=-172702.5654051304" ></map-meta>-->
-        <map-meta name="extent" content="top-left-easting=-8433134.90,top-left-northing=5689045.64,bottom-right-easting=-8421315.83,bottom-right-northing=5683319.12" ></map-meta>
-    </map-head>
-    <map-body>
-        <map-feature id="restaurant_map-point.77" class="restaurant_map-point">
-          <map-featurecaption>Hung Sum Restaurant</map-featurecaption>
-            <map-geometry>
-                <map-point>
-                        <map-coordinates>-75.71543400037297 45.40819502909854</map-coordinates>
-                </map-point>
-            </map-geometry>
-            <map-properties>
-                <table>
-                    <thead>
-                        <tr>
-                            <th role="columnheader" scope="col">Property name</th>
-                            <th role="columnheader" scope="col">Property value</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <tr>
-                            <th scope="row">amenity</th>
-                            <td itemprop="amenity">restaurant</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">name</th>
-                            <td itemprop="name">Hung Sum Restaurant</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_stree</th>
-                            <td itemprop="addr_stree">Somerset Street West</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_house</th>
-                            <td itemprop="addr_house">939</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">cuisine</th>
-                            <td itemprop="cuisine">chinese</td>
-                        </tr>
-                    </tbody>
-                </table>
-            </map-properties>
-        </map-feature>
-        <map-feature id="restaurant_map-point.2" class="restaurant_map-point">
-          <map-featurecaption>Big Daddy's</map-featurecaption>
-            <map-geometry>
-                <map-point>
-                  <map-coordinates>-75.6902755031953 45.41868067160079</map-coordinates>
-                </map-point>
-            </map-geometry>
-            <map-properties>
-                <table>
-                    <thead>
-                        <tr>
-                            <th role="columnheader" scope="col">Property name</th>
-                            <th role="columnheader" scope="col">Property value</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <tr>
-                            <th scope="row">amenity</th>
-                            <td itemprop="amenity">restaurant</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">name</th>
-                            <td itemprop="name">Big Daddy's</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_stree</th>
-                            <td itemprop="addr_stree">Cooper Street</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_house</th>
-                            <td itemprop="addr_house">180</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">cuisine</th>
-                            <td itemprop="cuisine">seafood</td>
-                        </tr>
-                    </tbody>
-                </table>
-            </map-properties>
-        </map-feature>
-        <map-feature id="restaurant_map-point.9" class="restaurant_map-point">
-          <map-featurecaption>Hareg Cafe &amp; Variety</map-featurecaption>
-            <map-geometry>
-              <map-point>
-                <map-coordinates>-75.69108408413759 45.407905135087496</map-coordinates>
-              </map-point>
-            </map-geometry>
-            <map-properties>
-                <table>
-                    <thead>
-                        <tr>
-                            <th role="columnheader" scope="col">Property name</th>
-                            <th role="columnheader" scope="col">Property value</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <tr>
-                            <th scope="row">amenity</th>
-                            <td itemprop="amenity">restaurant</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">name</th>
-                            <td itemprop="name">Hareg Cafe &amp; Variety</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_stree</th>
-                            <td itemprop="addr_stree">Bank Street</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_house</th>
-                            <td itemprop="addr_house">587</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">cuisine</th>
-                            <td itemprop="cuisine">african</td>
-                        </tr>
-                    </tbody>
-                </table>
-            </map-properties>
-        </map-feature>
-        <map-feature id="restaurant_map-point.13" class="restaurant_map-point">
-          <map-featurecaption>Phucket Royal</map-featurecaption>
-            <map-geometry>
-              <map-point>
-                <map-coordinates>-75.70786179432208 45.410746385011166</map-coordinates>
-              </map-point>
-            </map-geometry>
-            <map-properties>
-                <table>
-                    <thead>
-                        <tr>
-                            <th role="columnheader" scope="col">Property name</th>
-                            <th role="columnheader" scope="col">Property value</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <tr>
-                            <th scope="row">amenity</th>
-                            <td itemprop="amenity">restaurant</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">name</th>
-                            <td itemprop="name">Phucket Royal</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_stree</th>
-                            <td itemprop="addr_stree">Somerset Street West</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_house</th>
-                            <td itemprop="addr_house">713</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">cuisine</th>
-                            <td itemprop="cuisine">thai</td>
-                        </tr>
-                    </tbody>
-                </table>
-            </map-properties>
-        </map-feature>
-        <map-feature id="restaurant_map-point.18" class="restaurant_map-point">
-          <map-featurecaption>Sushi 88</map-featurecaption>
-            <map-geometry>
-              <map-point>
-                <map-coordinates>-75.70642921479893 45.41108327733854</map-coordinates>
-              </map-point>
-            </map-geometry>
-            <map-properties>
-                <table>
-                    <thead>
-                        <tr>
-                            <th role="columnheader" scope="col">Property name</th>
-                            <th role="columnheader" scope="col">Property value</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <tr>
-                            <th scope="row">amenity</th>
-                            <td itemprop="amenity">restaurant</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">name</th>
-                            <td itemprop="name">Sushi 88</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_stree</th>
-                            <td itemprop="addr_stree">Somerset Street West</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_house</th>
-                            <td itemprop="addr_house">690 B</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">cuisine</th>
-                            <td itemprop="cuisine">sushi</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">website</th>
-                            <td itemprop="website" />
-                        </tr>
-                        <tr>
-                            <th scope="row">phone</th>
-                            <td itemprop="phone">+1-613-233-3288</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">wheelchair</th>
-                            <td itemprop="wheelchair">no</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_postc</th>
-                            <td itemprop="addr_postc">K1R 6P4</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">outdoor_se</th>
-                            <td itemprop="outdoor_se">no</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">takeaway</th>
-                            <td itemprop="takeaway">yes</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">delivery</th>
-                            <td itemprop="delivery">no</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">internet_a</th>
-                            <td itemprop="internet_a">no</td>
-                        </tr>
-                    </tbody>
-                </table>
-            </map-properties>
-        </map-feature>
-        <map-feature id="restaurant_polygon.2" class="restaurant_polygon">
-          <map-featurecaption>Banditos</map-featurecaption>
-            <map-geometry>
-              <map-point>
-                  <map-coordinates>-75.689609 45.405803</map-coordinates>
-              </map-point>
-            </map-geometry>
-            <map-properties>
-                <table>
-                    <thead>
-                        <tr>
-                            <th role="columnheader" scope="col">Property name</th>
-                            <th role="columnheader" scope="col">Property value</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <tr>
-                            <th scope="row">addr_house</th>
-                            <td itemprop="addr_house">683</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_stree</th>
-                            <td itemprop="addr_stree">Bank Street</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">amenity</th>
-                            <td itemprop="amenity">restaurant</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">building</th>
-                            <td itemprop="building">commercial</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">name</th>
-                            <td itemprop="name">Banditos</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">cuisine</th>
-                            <td itemprop="cuisine">mexican</td>
-                        </tr>
-                    </tbody>
-                </table>
-            </map-properties>
-        </map-feature>
-        <map-feature id="restaurant_polygon.7" class="restaurant_polygon">
-          <map-featurecaption>India Palace</map-featurecaption>
-            <map-geometry>
-              <map-point>
-                  <map-coordinates>-75.7019048 45.4191548</map-coordinates>
-              </map-point>
-            </map-geometry>
-            <map-properties>
-                <table>
-                    <thead>
-                        <tr>
-                            <th role="columnheader" scope="col">Property name</th>
-                            <th role="columnheader" scope="col">Property value</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <tr>
-                            <th scope="row">addr_house</th>
-                            <td itemprop="addr_house">292</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_stree</th>
-                            <td itemprop="addr_stree">Albert Street</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">amenity</th>
-                            <td itemprop="amenity">restaurant</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">building</th>
-                            <td itemprop="building">yes</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">name</th>
-                            <td itemprop="name">India Palace</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">cuisine</th>
-                            <td itemprop="cuisine">indian</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">website</th>
-                            <td itemprop="website">http://www.indiapalace.ca</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">phone</th>
-                            <td itemprop="phone">+1-613-234-5433</td>
-                        </tr>
-                    </tbody>
-                </table>
-            </map-properties>
-        </map-feature>
-        <map-feature id="restaurant_polygon.20" class="restaurant_polygon">
-          <map-featurecaption>The Prescott</map-featurecaption>
-            <map-geometry>
-              <map-point>
-                  <map-coordinates>-75.7093517 45.4005727</map-coordinates>
-              </map-point>
-            </map-geometry>
-            <map-properties>
-                <table>
-                    <thead>
-                        <tr>
-                            <th role="columnheader" scope="col">Property name</th>
-                            <th role="columnheader" scope="col">Property value</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <tr>
-                            <th scope="row">addr_house</th>
-                            <td itemprop="addr_house">379</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">addr_stree</th>
-                            <td itemprop="addr_stree">Preston Street</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">amenity</th>
-                            <td itemprop="amenity">restaurant</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">building</th>
-                            <td itemprop="building">retail</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">name</th>
-                            <td itemprop="name">The Prescott</td>
-                        </tr>
-                        <tr>
-                            <th scope="row">website</th>
-                            <td itemprop="website"><a href="http://www.theprescott.com/">The Prescott</a></td>
-                        </tr>
-                    </tbody>
-                </table>
-            </map-properties>
-        </map-feature>
-    </map-body>
-</mapml->
diff --git a/screenreader/closest-restaurants/restaurants/african.mapml b/shared/restaurants/african.mapml
similarity index 100%
rename from screenreader/closest-restaurants/restaurants/african.mapml
rename to shared/restaurants/african.mapml
diff --git a/screenreader/closest-restaurants/restaurants/asian.mapml b/shared/restaurants/asian.mapml
similarity index 100%
rename from screenreader/closest-restaurants/restaurants/asian.mapml
rename to shared/restaurants/asian.mapml
diff --git a/screenreader/closest-restaurants/restaurants/cajun.mapml b/shared/restaurants/cajun.mapml
similarity index 100%
rename from screenreader/closest-restaurants/restaurants/cajun.mapml
rename to shared/restaurants/cajun.mapml
diff --git a/screenreader/closest-restaurants/restaurants/indian.mapml b/shared/restaurants/indian.mapml
similarity index 100%
rename from screenreader/closest-restaurants/restaurants/indian.mapml
rename to shared/restaurants/indian.mapml
diff --git a/screenreader/closest-restaurants/restaurants/italian.mapml b/shared/restaurants/italian.mapml
similarity index 100%
rename from screenreader/closest-restaurants/restaurants/italian.mapml
rename to shared/restaurants/italian.mapml
diff --git a/screenreader/closest-restaurants/restaurants/mexican.mapml b/shared/restaurants/mexican.mapml
similarity index 100%
rename from screenreader/closest-restaurants/restaurants/mexican.mapml
rename to shared/restaurants/mexican.mapml
diff --git a/screenreader/closest-restaurants/restaurants/restaurants.mapml b/shared/restaurants/restaurants.mapml
similarity index 100%
rename from screenreader/closest-restaurants/restaurants/restaurants.mapml
rename to shared/restaurants/restaurants.mapml
