RT# 76968 - Created new interactive map to select census tract
authorChristopher Burger <burgerc@freeside.biz>
Sun, 10 Sep 2017 23:07:30 +0000 (19:07 -0400)
committerChristopher Burger <burgerc@freeside.biz>
Sun, 10 Sep 2017 23:07:30 +0000 (19:07 -0400)
13 files changed:
httemplate/misc/confirm-censustract.html
httemplate/misc/elements/leaflet/images/layers-2x.png [new file with mode: 0644]
httemplate/misc/elements/leaflet/images/layers.png [new file with mode: 0644]
httemplate/misc/elements/leaflet/images/marker-icon-2x.png [new file with mode: 0644]
httemplate/misc/elements/leaflet/images/marker-icon.png [new file with mode: 0644]
httemplate/misc/elements/leaflet/images/marker-shadow.png [new file with mode: 0644]
httemplate/misc/elements/leaflet/leaflet-src.js [new file with mode: 0644]
httemplate/misc/elements/leaflet/leaflet-src.js.map [new file with mode: 0644]
httemplate/misc/elements/leaflet/leaflet.css [new file with mode: 0644]
httemplate/misc/elements/leaflet/leaflet.js [new file with mode: 0644]
httemplate/misc/elements/leaflet/leaflet.js.map [new file with mode: 0644]
httemplate/misc/openmap.html [new file with mode: 0644]
httemplate/misc/xmlhttp-censustract.html [new file with mode: 0644]

index 10ae918..0afb754 100644 (file)
@@ -19,10 +19,11 @@ Confirm census tract
 % my $querystring = "census_year=$year&latitude=".$cache->get('latitude').'&longitude='.$cache->get('longitude');
 <A HREF="http://maps.ffiec.gov/FFIECMapper/TGMapSrv.aspx?<% $querystring %>"
    TARGET="_blank">Map service module location</A><BR>
-% $querystring = "census_year=$year&zip_code=".$cache->get('zip');
-<A HREF="http://maps.ffiec.gov/FFIECMapper/TGMapSrv.aspx?<% $querystring %>"
+% $querystring = "census_year=$year&pre=$pre&zip_code=" . $cache->get('zip');
+<A HREF="<%$p%>misc/openmap.html?<% $querystring %>"
    TARGET="_blank">Map zip code center</A><BR>
 <BR>
+<input type="hidden" id="new_tract" name="new_tract" value="<%$new_tract%>">
 <TABLE>
   <TR>
     <TH style="width:50%">Entered census tract</TH>
@@ -31,9 +32,9 @@ Confirm census tract
   <TR>
     <TD><% $old_tract %></TD>
 % if ( $error ) {
-    <TD><FONT COLOR="#ff0000"><% $error %></FONT></TD>
+    <TD><div id='newcensustract'><FONT COLOR="#ff0000"><% $error %></FONT></div></TD>
 % } else {
-    <TD><% $new_tract %></TD>
+    <TD><div id='newcensustract'><% $new_tract %></div></TD>
 % }
   </TR>
   <TR>
@@ -43,30 +44,43 @@ Confirm census tract
       <IMG SRC="<%$p%>images/error.png" ALT=""> Use entered census tract
       </BUTTON>
     </TD>
-%   if ( !$error ) {
     <TD ALIGN="center">
-      <BUTTON TYPE="button"
-              onclick="set_censustract('<% $new_tract %>', '<% $year %>', '<% $pre %>')">
+     <div id="setnewtractdiv"
+% if ( $error ) { ## do not display this block if error finding track.
+      style="display:none"
+% }
+     >
+      <BUTTON TYPE="button" id="setnewtract"
+              onclick="set_censustract(getElementById('new_tract').value, '<% $year %>', '<% $pre %>')">
       <IMG SRC="<%$p%>images/tick.png" ALT=""> Use calculated census tract
       </BUTTON>
-    </TD>
-  </TR>
-  <TR>
-    <TD COLSPAN=2 ALIGN="center">
+     </div>
+     <div id='cancelsubmissiontop'
+% if ( !$error ) { ## do not display this block if there is no error finding a track.
+      style="display:none"
+% }
+     >
       <BUTTON TYPE="button" onclick="submit_abort()">
-      <IMG SRC="<%$p%>images/cross.png" ALT=""> Cancel submission
+        <IMG SRC="<%$p%>images/cross.png" ALT=""> Cancel submission
       </BUTTON>
+     </div>
     </TD>
   </TR>
-%   } else { # don't show a button to use the calculated value
-    <TD COLSPAN=1 ALIGN="center">
+  <TR>
+    <TD COLSPAN=2 ALIGN="center">
+     <div id='cancelsubmissionbottom'
+% if ( $error ) { ## do not display this block if error finding track.
+      style="display:none"
+% }
+     >
       <BUTTON TYPE="button" onclick="submit_abort()">
-      <IMG SRC="<%$p%>images/cross.png" ALT=""> Cancel submission
+        <IMG SRC="<%$p%>images/cross.png" ALT=""> Cancel submission
       </BUTTON>
+     </div>
     </TD>
   </TR>
-%   }
 </TABLE></CENTER>
+
 <%init>
 
 local $SIG{__DIE__}; #disable Mason error trap
diff --git a/httemplate/misc/elements/leaflet/images/layers-2x.png b/httemplate/misc/elements/leaflet/images/layers-2x.png
new file mode 100644 (file)
index 0000000..200c333
Binary files /dev/null and b/httemplate/misc/elements/leaflet/images/layers-2x.png differ
diff --git a/httemplate/misc/elements/leaflet/images/layers.png b/httemplate/misc/elements/leaflet/images/layers.png
new file mode 100644 (file)
index 0000000..1a72e57
Binary files /dev/null and b/httemplate/misc/elements/leaflet/images/layers.png differ
diff --git a/httemplate/misc/elements/leaflet/images/marker-icon-2x.png b/httemplate/misc/elements/leaflet/images/marker-icon-2x.png
new file mode 100644 (file)
index 0000000..e4abba3
Binary files /dev/null and b/httemplate/misc/elements/leaflet/images/marker-icon-2x.png differ
diff --git a/httemplate/misc/elements/leaflet/images/marker-icon.png b/httemplate/misc/elements/leaflet/images/marker-icon.png
new file mode 100644 (file)
index 0000000..950edf2
Binary files /dev/null and b/httemplate/misc/elements/leaflet/images/marker-icon.png differ
diff --git a/httemplate/misc/elements/leaflet/images/marker-shadow.png b/httemplate/misc/elements/leaflet/images/marker-shadow.png
new file mode 100644 (file)
index 0000000..9fd2979
Binary files /dev/null and b/httemplate/misc/elements/leaflet/images/marker-shadow.png differ
diff --git a/httemplate/misc/elements/leaflet/leaflet-src.js b/httemplate/misc/elements/leaflet/leaflet-src.js
new file mode 100644 (file)
index 0000000..d70b16a
--- /dev/null
@@ -0,0 +1,13609 @@
+/* @preserve
+ * Leaflet 1.2.0+Detached: 1ac320ba232cb85b73ac81f3d82780c9d07f0d4e.1ac320b, a JS library for interactive maps. http://leafletjs.com
+ * (c) 2010-2017 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 = {})));
+}(this, (function (exports) { 'use strict';
+
+var version = "1.2.0+HEAD.1ac320b";
+
+/*\r
+ * @namespace Util\r
+ *\r
+ * Various utility functions, used by Leaflet internally.\r
+ */\r
+\r
+var freeze = Object.freeze;\r
+Object.freeze = function (obj) { return obj; };\r
+\r
+// @function extend(dest: Object, src?: Object): Object\r
+// Merges the properties of the `src` object (or multiple objects) into `dest` object and returns the latter. Has an `L.extend` shortcut.\r
+function extend(dest) {\r
+       var i, j, len, src;\r
+\r
+       for (j = 1, len = arguments.length; j < len; j++) {\r
+               src = arguments[j];\r
+               for (i in src) {\r
+                       dest[i] = src[i];\r
+               }\r
+       }\r
+       return dest;\r
+}\r
+\r
+// @function create(proto: Object, properties?: Object): Object\r
+// Compatibility polyfill for [Object.create](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/create)\r
+var create = Object.create || (function () {\r
+       function F() {}\r
+       return function (proto) {\r
+               F.prototype = proto;\r
+               return new F();\r
+       };\r
+})();\r
+\r
+// @function bind(fn: Function, …): Function\r
+// 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).\r
+// Has a `L.bind()` shortcut.\r
+function bind(fn, obj) {\r
+       var slice = Array.prototype.slice;\r
+\r
+       if (fn.bind) {\r
+               return fn.bind.apply(fn, slice.call(arguments, 1));\r
+       }\r
+\r
+       var args = slice.call(arguments, 2);\r
+\r
+       return function () {\r
+               return fn.apply(obj, args.length ? args.concat(slice.call(arguments)) : arguments);\r
+       };\r
+}\r
+\r
+// @property lastId: Number\r
+// Last unique ID used by [`stamp()`](#util-stamp)\r
+var lastId = 0;\r
+\r
+// @function stamp(obj: Object): Number\r
+// Returns the unique ID of an object, assiging it one if it doesn't have it.\r
+function stamp(obj) {\r
+       /*eslint-disable */\r
+       obj._leaflet_id = obj._leaflet_id || ++lastId;\r
+       return obj._leaflet_id;\r
+       /*eslint-enable */\r
+}\r
+\r
+// @function throttle(fn: Function, time: Number, context: Object): Function\r
+// Returns a function which executes function `fn` with the given scope `context`\r
+// (so that the `this` keyword refers to `context` inside `fn`'s code). The function\r
+// `fn` will be called no more than one time per given amount of `time`. The arguments\r
+// received by the bound function will be any arguments passed when binding the\r
+// function, followed by any arguments passed when invoking the bound function.\r
+// Has an `L.throttle` shortcut.\r
+function throttle(fn, time, context) {\r
+       var lock, args, wrapperFn, later;\r
+\r
+       later = function () {\r
+               // reset lock and call if queued\r
+               lock = false;\r
+               if (args) {\r
+                       wrapperFn.apply(context, args);\r
+                       args = false;\r
+               }\r
+       };\r
+\r
+       wrapperFn = function () {\r
+               if (lock) {\r
+                       // called too soon, queue to call later\r
+                       args = arguments;\r
+\r
+               } else {\r
+                       // call and lock until later\r
+                       fn.apply(context, arguments);\r
+                       setTimeout(later, time);\r
+                       lock = true;\r
+               }\r
+       };\r
+\r
+       return wrapperFn;\r
+}\r
+\r
+// @function wrapNum(num: Number, range: Number[], includeMax?: Boolean): Number\r
+// Returns the number `num` modulo `range` in such a way so it lies within\r
+// `range[0]` and `range[1]`. The returned value will be always smaller than\r
+// `range[1]` unless `includeMax` is set to `true`.\r
+function wrapNum(x, range, includeMax) {\r
+       var max = range[1],\r
+           min = range[0],\r
+           d = max - min;\r
+       return x === max && includeMax ? x : ((x - min) % d + d) % d + min;\r
+}\r
+\r
+// @function falseFn(): Function\r
+// Returns a function which always returns `false`.\r
+function falseFn() { return false; }\r
+\r
+// @function formatNum(num: Number, digits?: Number): Number\r
+// Returns the number `num` rounded to `digits` decimals, or to 5 decimals by default.\r
+function formatNum(num, digits) {\r
+       var pow = Math.pow(10, digits || 5);\r
+       return Math.round(num * pow) / pow;\r
+}\r
+\r
+// @function trim(str: String): String\r
+// Compatibility polyfill for [String.prototype.trim](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim)\r
+function trim(str) {\r
+       return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, '');\r
+}\r
+\r
+// @function splitWords(str: String): String[]\r
+// Trims and splits the string on whitespace and returns the array of parts.\r
+function splitWords(str) {\r
+       return trim(str).split(/\s+/);\r
+}\r
+\r
+// @function setOptions(obj: Object, options: Object): Object\r
+// Merges the given properties to the `options` of the `obj` object, returning the resulting options. See `Class options`. Has an `L.setOptions` shortcut.\r
+function setOptions(obj, options) {\r
+       if (!obj.hasOwnProperty('options')) {\r
+               obj.options = obj.options ? create(obj.options) : {};\r
+       }\r
+       for (var i in options) {\r
+               obj.options[i] = options[i];\r
+       }\r
+       return obj.options;\r
+}\r
+\r
+// @function getParamString(obj: Object, existingUrl?: String, uppercase?: Boolean): String\r
+// Converts an object into a parameter URL string, e.g. `{a: "foo", b: "bar"}`\r
+// translates to `'?a=foo&b=bar'`. If `existingUrl` is set, the parameters will\r
+// be appended at the end. If `uppercase` is `true`, the parameter names will\r
+// be uppercased (e.g. `'?A=foo&B=bar'`)\r
+function getParamString(obj, existingUrl, uppercase) {\r
+       var params = [];\r
+       for (var i in obj) {\r
+               params.push(encodeURIComponent(uppercase ? i.toUpperCase() : i) + '=' + encodeURIComponent(obj[i]));\r
+       }\r
+       return ((!existingUrl || existingUrl.indexOf('?') === -1) ? '?' : '&') + params.join('&');\r
+}\r
+\r
+var templateRe = /\{ *([\w_\-]+) *\}/g;\r
+\r
+// @function template(str: String, data: Object): String\r
+// Simple templating facility, accepts a template string of the form `'Hello {a}, {b}'`\r
+// and a data object like `{a: 'foo', b: 'bar'}`, returns evaluated string\r
+// `('Hello foo, bar')`. You can also specify functions instead of strings for\r
+// data values — they will be evaluated passing `data` as an argument.\r
+function template(str, data) {\r
+       return str.replace(templateRe, function (str, key) {\r
+               var value = data[key];\r
+\r
+               if (value === undefined) {\r
+                       throw new Error('No value provided for variable ' + str);\r
+\r
+               } else if (typeof value === 'function') {\r
+                       value = value(data);\r
+               }\r
+               return value;\r
+       });\r
+}\r
+\r
+// @function isArray(obj): Boolean\r
+// Compatibility polyfill for [Array.isArray](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray)\r
+var isArray = Array.isArray || function (obj) {\r
+       return (Object.prototype.toString.call(obj) === '[object Array]');\r
+};\r
+\r
+// @function indexOf(array: Array, el: Object): Number\r
+// Compatibility polyfill for [Array.prototype.indexOf](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf)\r
+function indexOf(array, el) {\r
+       for (var i = 0; i < array.length; i++) {\r
+               if (array[i] === el) { return i; }\r
+       }\r
+       return -1;\r
+}\r
+\r
+// @property emptyImageUrl: String\r
+// Data URI string containing a base64-encoded empty GIF image.\r
+// Used as a hack to free memory from unused images on WebKit-powered\r
+// mobile devices (by setting image `src` to this string).\r
+var emptyImageUrl = 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=';\r
+\r
+// inspired by http://paulirish.com/2011/requestanimationframe-for-smart-animating/\r
+\r
+function getPrefixed(name) {\r
+       return window['webkit' + name] || window['moz' + name] || window['ms' + name];\r
+}\r
+\r
+var lastTime = 0;\r
+\r
+// fallback for IE 7-8\r
+function timeoutDefer(fn) {\r
+       var time = +new Date(),\r
+           timeToCall = Math.max(0, 16 - (time - lastTime));\r
+\r
+       lastTime = time + timeToCall;\r
+       return window.setTimeout(fn, timeToCall);\r
+}\r
+\r
+var requestFn = window.requestAnimationFrame || getPrefixed('RequestAnimationFrame') || timeoutDefer;\r
+var cancelFn = window.cancelAnimationFrame || getPrefixed('CancelAnimationFrame') ||\r
+               getPrefixed('CancelRequestAnimationFrame') || function (id) { window.clearTimeout(id); };\r
+\r
+// @function requestAnimFrame(fn: Function, context?: Object, immediate?: Boolean): Number\r
+// Schedules `fn` to be executed when the browser repaints. `fn` is bound to\r
+// `context` if given. When `immediate` is set, `fn` is called immediately if\r
+// the browser doesn't have native support for\r
+// [`window.requestAnimationFrame`](https://developer.mozilla.org/docs/Web/API/window/requestAnimationFrame),\r
+// otherwise it's delayed. Returns a request ID that can be used to cancel the request.\r
+function requestAnimFrame(fn, context, immediate) {\r
+       if (immediate && requestFn === timeoutDefer) {\r
+               fn.call(context);\r
+       } else {\r
+               return requestFn.call(window, bind(fn, context));\r
+       }\r
+}\r
+\r
+// @function cancelAnimFrame(id: Number): undefined\r
+// Cancels a previous `requestAnimFrame`. See also [window.cancelAnimationFrame](https://developer.mozilla.org/docs/Web/API/window/cancelAnimationFrame).\r
+function cancelAnimFrame(id) {\r
+       if (id) {\r
+               cancelFn.call(window, id);\r
+       }\r
+}\r
+
+
+var Util = (Object.freeze || Object)({
+       freeze: freeze,
+       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\r
+// @aka L.Class\r
+\r
+// @section\r
+// @uninheritable\r
+\r
+// Thanks to John Resig and Dean Edwards for inspiration!\r
+\r
+function Class() {}\r
+\r
+Class.extend = function (props) {\r
+\r
+       // @function extend(props: Object): Function\r
+       // [Extends the current class](#class-inheritance) given the properties to be included.\r
+       // Returns a Javascript function that is a class constructor (to be called with `new`).\r
+       var NewClass = function () {\r
+\r
+               // call the constructor\r
+               if (this.initialize) {\r
+                       this.initialize.apply(this, arguments);\r
+               }\r
+\r
+               // call all constructor hooks\r
+               this.callInitHooks();\r
+       };\r
+\r
+       var parentProto = NewClass.__super__ = this.prototype;\r
+\r
+       var proto = create(parentProto);\r
+       proto.constructor = NewClass;\r
+\r
+       NewClass.prototype = proto;\r
+\r
+       // inherit parent's statics\r
+       for (var i in this) {\r
+               if (this.hasOwnProperty(i) && i !== 'prototype' && i !== '__super__') {\r
+                       NewClass[i] = this[i];\r
+               }\r
+       }\r
+\r
+       // mix static properties into the class\r
+       if (props.statics) {\r
+               extend(NewClass, props.statics);\r
+               delete props.statics;\r
+       }\r
+\r
+       // mix includes into the prototype\r
+       if (props.includes) {\r
+               checkDeprecatedMixinEvents(props.includes);\r
+               extend.apply(null, [proto].concat(props.includes));\r
+               delete props.includes;\r
+       }\r
+\r
+       // merge options\r
+       if (proto.options) {\r
+               props.options = extend(create(proto.options), props.options);\r
+       }\r
+\r
+       // mix given properties into the prototype\r
+       extend(proto, props);\r
+\r
+       proto._initHooks = [];\r
+\r
+       // add method for calling all hooks\r
+       proto.callInitHooks = function () {\r
+\r
+               if (this._initHooksCalled) { return; }\r
+\r
+               if (parentProto.callInitHooks) {\r
+                       parentProto.callInitHooks.call(this);\r
+               }\r
+\r
+               this._initHooksCalled = true;\r
+\r
+               for (var i = 0, len = proto._initHooks.length; i < len; i++) {\r
+                       proto._initHooks[i].call(this);\r
+               }\r
+       };\r
+\r
+       return NewClass;\r
+};\r
+\r
+\r
+// @function include(properties: Object): this\r
+// [Includes a mixin](#class-includes) into the current class.\r
+Class.include = function (props) {\r
+       extend(this.prototype, props);\r
+       return this;\r
+};\r
+\r
+// @function mergeOptions(options: Object): this\r
+// [Merges `options`](#class-options) into the defaults of the class.\r
+Class.mergeOptions = function (options) {\r
+       extend(this.prototype.options, options);\r
+       return this;\r
+};\r
+\r
+// @function addInitHook(fn: Function): this\r
+// Adds a [constructor hook](#class-constructor-hooks) to the class.\r
+Class.addInitHook = function (fn) { // (Function) || (String, args...)\r
+       var args = Array.prototype.slice.call(arguments, 1);\r
+\r
+       var init = typeof fn === 'function' ? fn : function () {\r
+               this[fn].apply(this, args);\r
+       };\r
+\r
+       this.prototype._initHooks = this.prototype._initHooks || [];\r
+       this.prototype._initHooks.push(init);\r
+       return this;\r
+};\r
+\r
+function checkDeprecatedMixinEvents(includes) {\r
+       if (!L || !L.Mixin) { return; }\r
+\r
+       includes = isArray(includes) ? includes : [includes];\r
+\r
+       for (var i = 0; i < includes.length; i++) {\r
+               if (includes[i] === L.Mixin.Events) {\r
+                       console.warn('Deprecated include of L.Mixin.Events: ' +\r
+                               'this property will be removed in future releases, ' +\r
+                               'please inherit from L.Evented instead.', new Error().stack);\r
+               }\r
+       }\r
+}
+
+/*\r
+ * @class Evented\r
+ * @aka L.Evented\r
+ * @inherits Class\r
+ *\r
+ * 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).\r
+ *\r
+ * @example\r
+ *\r
+ * ```js\r
+ * map.on('click', function(e) {\r
+ *     alert(e.latlng);\r
+ * } );\r
+ * ```\r
+ *\r
+ * Leaflet deals with event listeners by reference, so if you want to add a listener and then remove it, define it as a function:\r
+ *\r
+ * ```js\r
+ * function onClick(e) { ... }\r
+ *\r
+ * map.on('click', onClick);\r
+ * map.off('click', onClick);\r
+ * ```\r
+ */\r
+\r
+var Events = {\r
+       /* @method on(type: String, fn: Function, context?: Object): this\r
+        * 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'`).\r
+        *\r
+        * @alternative\r
+        * @method on(eventMap: Object): this\r
+        * Adds a set of type/listener pairs, e.g. `{click: onClick, mousemove: onMouseMove}`\r
+        */\r
+       on: function (types, fn, context) {\r
+\r
+               // types can be a map of types/handlers\r
+               if (typeof types === 'object') {\r
+                       for (var type in types) {\r
+                               // we don't process space-separated events here for performance;\r
+                               // it's a hot path since Layer uses the on(obj) syntax\r
+                               this._on(type, types[type], fn);\r
+                       }\r
+\r
+               } else {\r
+                       // types can be a string of space-separated words\r
+                       types = splitWords(types);\r
+\r
+                       for (var i = 0, len = types.length; i < len; i++) {\r
+                               this._on(types[i], fn, context);\r
+                       }\r
+               }\r
+\r
+               return this;\r
+       },\r
+\r
+       /* @method off(type: String, fn?: Function, context?: Object): this\r
+        * 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.\r
+        *\r
+        * @alternative\r
+        * @method off(eventMap: Object): this\r
+        * Removes a set of type/listener pairs.\r
+        *\r
+        * @alternative\r
+        * @method off: this\r
+        * Removes all listeners to all events on the object.\r
+        */\r
+       off: function (types, fn, context) {\r
+\r
+               if (!types) {\r
+                       // clear all listeners if called without arguments\r
+                       delete this._events;\r
+\r
+               } else if (typeof types === 'object') {\r
+                       for (var type in types) {\r
+                               this._off(type, types[type], fn);\r
+                       }\r
+\r
+               } else {\r
+                       types = splitWords(types);\r
+\r
+                       for (var i = 0, len = types.length; i < len; i++) {\r
+                               this._off(types[i], fn, context);\r
+                       }\r
+               }\r
+\r
+               return this;\r
+       },\r
+\r
+       // attach listener (without syntactic sugar now)\r
+       _on: function (type, fn, context) {\r
+               this._events = this._events || {};\r
+\r
+               /* get/init listeners for type */\r
+               var typeListeners = this._events[type];\r
+               if (!typeListeners) {\r
+                       typeListeners = [];\r
+                       this._events[type] = typeListeners;\r
+               }\r
+\r
+               if (context === this) {\r
+                       // Less memory footprint.\r
+                       context = undefined;\r
+               }\r
+               var newListener = {fn: fn, ctx: context},\r
+                   listeners = typeListeners;\r
+\r
+               // check if fn already there\r
+               for (var i = 0, len = listeners.length; i < len; i++) {\r
+                       if (listeners[i].fn === fn && listeners[i].ctx === context) {\r
+                               return;\r
+                       }\r
+               }\r
+\r
+               listeners.push(newListener);\r
+       },\r
+\r
+       _off: function (type, fn, context) {\r
+               var listeners,\r
+                   i,\r
+                   len;\r
+\r
+               if (!this._events) { return; }\r
+\r
+               listeners = this._events[type];\r
+\r
+               if (!listeners) {\r
+                       return;\r
+               }\r
+\r
+               if (!fn) {\r
+                       // Set all removed listeners to noop so they are not called if remove happens in fire\r
+                       for (i = 0, len = listeners.length; i < len; i++) {\r
+                               listeners[i].fn = falseFn;\r
+                       }\r
+                       // clear all listeners for a type if function isn't specified\r
+                       delete this._events[type];\r
+                       return;\r
+               }\r
+\r
+               if (context === this) {\r
+                       context = undefined;\r
+               }\r
+\r
+               if (listeners) {\r
+\r
+                       // find fn and remove it\r
+                       for (i = 0, len = listeners.length; i < len; i++) {\r
+                               var l = listeners[i];\r
+                               if (l.ctx !== context) { continue; }\r
+                               if (l.fn === fn) {\r
+\r
+                                       // set the removed listener to noop so that's not called if remove happens in fire\r
+                                       l.fn = falseFn;\r
+\r
+                                       if (this._firingCount) {\r
+                                               /* copy array in case events are being fired */\r
+                                               this._events[type] = listeners = listeners.slice();\r
+                                       }\r
+                                       listeners.splice(i, 1);\r
+\r
+                                       return;\r
+                               }\r
+                       }\r
+               }\r
+       },\r
+\r
+       // @method fire(type: String, data?: Object, propagate?: Boolean): this\r
+       // Fires an event of the specified type. You can optionally provide an data\r
+       // object — the first argument of the listener function will contain its\r
+       // properties. The event can optionally be propagated to event parents.\r
+       fire: function (type, data, propagate) {\r
+               if (!this.listens(type, propagate)) { return this; }\r
+\r
+               var event = extend({}, data, {type: type, target: this});\r
+\r
+               if (this._events) {\r
+                       var listeners = this._events[type];\r
+\r
+                       if (listeners) {\r
+                               this._firingCount = (this._firingCount + 1) || 1;\r
+                               for (var i = 0, len = listeners.length; i < len; i++) {\r
+                                       var l = listeners[i];\r
+                                       l.fn.call(l.ctx || this, event);\r
+                               }\r
+\r
+                               this._firingCount--;\r
+                       }\r
+               }\r
+\r
+               if (propagate) {\r
+                       // propagate the event to parents (set with addEventParent)\r
+                       this._propagateEvent(event);\r
+               }\r
+\r
+               return this;\r
+       },\r
+\r
+       // @method listens(type: String): Boolean\r
+       // Returns `true` if a particular event type has any listeners attached to it.\r
+       listens: function (type, propagate) {\r
+               var listeners = this._events && this._events[type];\r
+               if (listeners && listeners.length) { return true; }\r
+\r
+               if (propagate) {\r
+                       // also check parents for listeners if event propagates\r
+                       for (var id in this._eventParents) {\r
+                               if (this._eventParents[id].listens(type, propagate)) { return true; }\r
+                       }\r
+               }\r
+               return false;\r
+       },\r
+\r
+       // @method once(…): this\r
+       // Behaves as [`on(…)`](#evented-on), except the listener will only get fired once and then removed.\r
+       once: function (types, fn, context) {\r
+\r
+               if (typeof types === 'object') {\r
+                       for (var type in types) {\r
+                               this.once(type, types[type], fn);\r
+                       }\r
+                       return this;\r
+               }\r
+\r
+               var handler = bind(function () {\r
+                       this\r
+                           .off(types, fn, context)\r
+                           .off(types, handler, context);\r
+               }, this);\r
+\r
+               // add a listener that's executed once and removed after that\r
+               return this\r
+                   .on(types, fn, context)\r
+                   .on(types, handler, context);\r
+       },\r
+\r
+       // @method addEventParent(obj: Evented): this\r
+       // Adds an event parent - an `Evented` that will receive propagated events\r
+       addEventParent: function (obj) {\r
+               this._eventParents = this._eventParents || {};\r
+               this._eventParents[stamp(obj)] = obj;\r
+               return this;\r
+       },\r
+\r
+       // @method removeEventParent(obj: Evented): this\r
+       // Removes an event parent, so it will stop receiving propagated events\r
+       removeEventParent: function (obj) {\r
+               if (this._eventParents) {\r
+                       delete this._eventParents[stamp(obj)];\r
+               }\r
+               return this;\r
+       },\r
+\r
+       _propagateEvent: function (e) {\r
+               for (var id in this._eventParents) {\r
+                       this._eventParents[id].fire(e.type, extend({layer: e.target}, e), true);\r
+               }\r
+       }\r
+};\r
+\r
+// aliases; we should ditch those eventually\r
+\r
+// @method addEventListener(…): this\r
+// Alias to [`on(…)`](#evented-on)\r
+Events.addEventListener = Events.on;\r
+\r
+// @method removeEventListener(…): this\r
+// Alias to [`off(…)`](#evented-off)\r
+\r
+// @method clearAllEventListeners(…): this\r
+// Alias to [`off()`](#evented-off)\r
+Events.removeEventListener = Events.clearAllEventListeners = Events.off;\r
+\r
+// @method addOneTimeEventListener(…): this\r
+// Alias to [`once(…)`](#evented-once)\r
+Events.addOneTimeEventListener = Events.once;\r
+\r
+// @method fireEvent(…): this\r
+// Alias to [`fire(…)`](#evented-fire)\r
+Events.fireEvent = Events.fire;\r
+\r
+// @method hasEventListeners(…): Boolean\r
+// Alias to [`listens(…)`](#evented-listens)\r
+Events.hasEventListeners = Events.listens;\r
+\r
+var Evented = Class.extend(Events);
+
+/*\r
+ * @class Point\r
+ * @aka L.Point\r
+ *\r
+ * Represents a point with `x` and `y` coordinates in pixels.\r
+ *\r
+ * @example\r
+ *\r
+ * ```js\r
+ * var point = L.point(200, 300);\r
+ * ```\r
+ *\r
+ * 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:\r
+ *\r
+ * ```js\r
+ * map.panBy([200, 300]);\r
+ * map.panBy(L.point(200, 300));\r
+ * ```\r
+ */\r
+\r
+function Point(x, y, round) {\r
+       // @property x: Number; The `x` coordinate of the point\r
+       this.x = (round ? Math.round(x) : x);\r
+       // @property y: Number; The `y` coordinate of the point\r
+       this.y = (round ? Math.round(y) : y);\r
+}\r
+\r
+Point.prototype = {\r
+\r
+       // @method clone(): Point\r
+       // Returns a copy of the current point.\r
+       clone: function () {\r
+               return new Point(this.x, this.y);\r
+       },\r
+\r
+       // @method add(otherPoint: Point): Point\r
+       // Returns the result of addition of the current and the given points.\r
+       add: function (point) {\r
+               // non-destructive, returns a new point\r
+               return this.clone()._add(toPoint(point));\r
+       },\r
+\r
+       _add: function (point) {\r
+               // destructive, used directly for performance in situations where it's safe to modify existing point\r
+               this.x += point.x;\r
+               this.y += point.y;\r
+               return this;\r
+       },\r
+\r
+       // @method subtract(otherPoint: Point): Point\r
+       // Returns the result of subtraction of the given point from the current.\r
+       subtract: function (point) {\r
+               return this.clone()._subtract(toPoint(point));\r
+       },\r
+\r
+       _subtract: function (point) {\r
+               this.x -= point.x;\r
+               this.y -= point.y;\r
+               return this;\r
+       },\r
+\r
+       // @method divideBy(num: Number): Point\r
+       // Returns the result of division of the current point by the given number.\r
+       divideBy: function (num) {\r
+               return this.clone()._divideBy(num);\r
+       },\r
+\r
+       _divideBy: function (num) {\r
+               this.x /= num;\r
+               this.y /= num;\r
+               return this;\r
+       },\r
+\r
+       // @method multiplyBy(num: Number): Point\r
+       // Returns the result of multiplication of the current point by the given number.\r
+       multiplyBy: function (num) {\r
+               return this.clone()._multiplyBy(num);\r
+       },\r
+\r
+       _multiplyBy: function (num) {\r
+               this.x *= num;\r
+               this.y *= num;\r
+               return this;\r
+       },\r
+\r
+       // @method scaleBy(scale: Point): Point\r
+       // Multiply each coordinate of the current point by each coordinate of\r
+       // `scale`. In linear algebra terms, multiply the point by the\r
+       // [scaling matrix](https://en.wikipedia.org/wiki/Scaling_%28geometry%29#Matrix_representation)\r
+       // defined by `scale`.\r
+       scaleBy: function (point) {\r
+               return new Point(this.x * point.x, this.y * point.y);\r
+       },\r
+\r
+       // @method unscaleBy(scale: Point): Point\r
+       // Inverse of `scaleBy`. Divide each coordinate of the current point by\r
+       // each coordinate of `scale`.\r
+       unscaleBy: function (point) {\r
+               return new Point(this.x / point.x, this.y / point.y);\r
+       },\r
+\r
+       // @method round(): Point\r
+       // Returns a copy of the current point with rounded coordinates.\r
+       round: function () {\r
+               return this.clone()._round();\r
+       },\r
+\r
+       _round: function () {\r
+               this.x = Math.round(this.x);\r
+               this.y = Math.round(this.y);\r
+               return this;\r
+       },\r
+\r
+       // @method floor(): Point\r
+       // Returns a copy of the current point with floored coordinates (rounded down).\r
+       floor: function () {\r
+               return this.clone()._floor();\r
+       },\r
+\r
+       _floor: function () {\r
+               this.x = Math.floor(this.x);\r
+               this.y = Math.floor(this.y);\r
+               return this;\r
+       },\r
+\r
+       // @method ceil(): Point\r
+       // Returns a copy of the current point with ceiled coordinates (rounded up).\r
+       ceil: function () {\r
+               return this.clone()._ceil();\r
+       },\r
+\r
+       _ceil: function () {\r
+               this.x = Math.ceil(this.x);\r
+               this.y = Math.ceil(this.y);\r
+               return this;\r
+       },\r
+\r
+       // @method distanceTo(otherPoint: Point): Number\r
+       // Returns the cartesian distance between the current and the given points.\r
+       distanceTo: function (point) {\r
+               point = toPoint(point);\r
+\r
+               var x = point.x - this.x,\r
+                   y = point.y - this.y;\r
+\r
+               return Math.sqrt(x * x + y * y);\r
+       },\r
+\r
+       // @method equals(otherPoint: Point): Boolean\r
+       // Returns `true` if the given point has the same coordinates.\r
+       equals: function (point) {\r
+               point = toPoint(point);\r
+\r
+               return point.x === this.x &&\r
+                      point.y === this.y;\r
+       },\r
+\r
+       // @method contains(otherPoint: Point): Boolean\r
+       // Returns `true` if both coordinates of the given point are less than the corresponding current point coordinates (in absolute values).\r
+       contains: function (point) {\r
+               point = toPoint(point);\r
+\r
+               return Math.abs(point.x) <= Math.abs(this.x) &&\r
+                      Math.abs(point.y) <= Math.abs(this.y);\r
+       },\r
+\r
+       // @method toString(): String\r
+       // Returns a string representation of the point for debugging purposes.\r
+       toString: function () {\r
+               return 'Point(' +\r
+                       formatNum(this.x) + ', ' +\r
+                       formatNum(this.y) + ')';\r
+       }\r
+};\r
+\r
+// @factory L.point(x: Number, y: Number, round?: Boolean)\r
+// Creates a Point object with the given `x` and `y` coordinates. If optional `round` is set to true, rounds the `x` and `y` values.\r
+\r
+// @alternative\r
+// @factory L.point(coords: Number[])\r
+// Expects an array of the form `[x, y]` instead.\r
+\r
+// @alternative\r
+// @factory L.point(coords: Object)\r
+// Expects a plain object of the form `{x: Number, y: Number}` instead.\r
+function toPoint(x, y, round) {\r
+       if (x instanceof Point) {\r
+               return x;\r
+       }\r
+       if (isArray(x)) {\r
+               return new Point(x[0], x[1]);\r
+       }\r
+       if (x === undefined || x === null) {\r
+               return x;\r
+       }\r
+       if (typeof x === 'object' && 'x' in x && 'y' in x) {\r
+               return new Point(x.x, x.y);\r
+       }\r
+       return new Point(x, y, round);\r
+}
+
+/*\r
+ * @class Bounds\r
+ * @aka L.Bounds\r
+ *\r
+ * Represents a rectangular area in pixel coordinates.\r
+ *\r
+ * @example\r
+ *\r
+ * ```js\r
+ * var p1 = L.point(10, 10),\r
+ * p2 = L.point(40, 60),\r
+ * bounds = L.bounds(p1, p2);\r
+ * ```\r
+ *\r
+ * 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:\r
+ *\r
+ * ```js\r
+ * otherBounds.intersects([[10, 10], [40, 60]]);\r
+ * ```\r
+ */\r
+\r
+function Bounds(a, b) {\r
+       if (!a) { return; }\r
+\r
+       var points = b ? [a, b] : a;\r
+\r
+       for (var i = 0, len = points.length; i < len; i++) {\r
+               this.extend(points[i]);\r
+       }\r
+}\r
+\r
+Bounds.prototype = {\r
+       // @method extend(point: Point): this\r
+       // Extends the bounds to contain the given point.\r
+       extend: function (point) { // (Point)\r
+               point = toPoint(point);\r
+\r
+               // @property min: Point\r
+               // The top left corner of the rectangle.\r
+               // @property max: Point\r
+               // The bottom right corner of the rectangle.\r
+               if (!this.min && !this.max) {\r
+                       this.min = point.clone();\r
+                       this.max = point.clone();\r
+               } else {\r
+                       this.min.x = Math.min(point.x, this.min.x);\r
+                       this.max.x = Math.max(point.x, this.max.x);\r
+                       this.min.y = Math.min(point.y, this.min.y);\r
+                       this.max.y = Math.max(point.y, this.max.y);\r
+               }\r
+               return this;\r
+       },\r
+\r
+       // @method getCenter(round?: Boolean): Point\r
+       // Returns the center point of the bounds.\r
+       getCenter: function (round) {\r
+               return new Point(\r
+                       (this.min.x + this.max.x) / 2,\r
+                       (this.min.y + this.max.y) / 2, round);\r
+       },\r
+\r
+       // @method getBottomLeft(): Point\r
+       // Returns the bottom-left point of the bounds.\r
+       getBottomLeft: function () {\r
+               return new Point(this.min.x, this.max.y);\r
+       },\r
+\r
+       // @method getTopRight(): Point\r
+       // Returns the top-right point of the bounds.\r
+       getTopRight: function () { // -> Point\r
+               return new Point(this.max.x, this.min.y);\r
+       },\r
+\r
+       // @method getTopLeft(): Point\r
+       // Returns the top-left point of the bounds (i.e. [`this.min`](#bounds-min)).\r
+       getTopLeft: function () {\r
+               return this.min; // left, top\r
+       },\r
+\r
+       // @method getBottomRight(): Point\r
+       // Returns the bottom-right point of the bounds (i.e. [`this.max`](#bounds-max)).\r
+       getBottomRight: function () {\r
+               return this.max; // right, bottom\r
+       },\r
+\r
+       // @method getSize(): Point\r
+       // Returns the size of the given bounds\r
+       getSize: function () {\r
+               return this.max.subtract(this.min);\r
+       },\r
+\r
+       // @method contains(otherBounds: Bounds): Boolean\r
+       // Returns `true` if the rectangle contains the given one.\r
+       // @alternative\r
+       // @method contains(point: Point): Boolean\r
+       // Returns `true` if the rectangle contains the given point.\r
+       contains: function (obj) {\r
+               var min, max;\r
+\r
+               if (typeof obj[0] === 'number' || obj instanceof Point) {\r
+                       obj = toPoint(obj);\r
+               } else {\r
+                       obj = toBounds(obj);\r
+               }\r
+\r
+               if (obj instanceof Bounds) {\r
+                       min = obj.min;\r
+                       max = obj.max;\r
+               } else {\r
+                       min = max = obj;\r
+               }\r
+\r
+               return (min.x >= this.min.x) &&\r
+                      (max.x <= this.max.x) &&\r
+                      (min.y >= this.min.y) &&\r
+                      (max.y <= this.max.y);\r
+       },\r
+\r
+       // @method intersects(otherBounds: Bounds): Boolean\r
+       // Returns `true` if the rectangle intersects the given bounds. Two bounds\r
+       // intersect if they have at least one point in common.\r
+       intersects: function (bounds) { // (Bounds) -> Boolean\r
+               bounds = toBounds(bounds);\r
+\r
+               var min = this.min,\r
+                   max = this.max,\r
+                   min2 = bounds.min,\r
+                   max2 = bounds.max,\r
+                   xIntersects = (max2.x >= min.x) && (min2.x <= max.x),\r
+                   yIntersects = (max2.y >= min.y) && (min2.y <= max.y);\r
+\r
+               return xIntersects && yIntersects;\r
+       },\r
+\r
+       // @method overlaps(otherBounds: Bounds): Boolean\r
+       // Returns `true` if the rectangle overlaps the given bounds. Two bounds\r
+       // overlap if their intersection is an area.\r
+       overlaps: function (bounds) { // (Bounds) -> Boolean\r
+               bounds = toBounds(bounds);\r
+\r
+               var min = this.min,\r
+                   max = this.max,\r
+                   min2 = bounds.min,\r
+                   max2 = bounds.max,\r
+                   xOverlaps = (max2.x > min.x) && (min2.x < max.x),\r
+                   yOverlaps = (max2.y > min.y) && (min2.y < max.y);\r
+\r
+               return xOverlaps && yOverlaps;\r
+       },\r
+\r
+       isValid: function () {\r
+               return !!(this.min && this.max);\r
+       }\r
+};\r
+\r
+\r
+// @factory L.bounds(corner1: Point, corner2: Point)\r
+// Creates a Bounds object from two corners coordinate pairs.\r
+// @alternative\r
+// @factory L.bounds(points: Point[])\r
+// Creates a Bounds object from the given array of points.\r
+function toBounds(a, b) {\r
+       if (!a || a instanceof Bounds) {\r
+               return a;\r
+       }\r
+       return new Bounds(a, b);\r
+}
+
+/*\r
+ * @class LatLngBounds\r
+ * @aka L.LatLngBounds\r
+ *\r
+ * Represents a rectangular geographical area on a map.\r
+ *\r
+ * @example\r
+ *\r
+ * ```js\r
+ * var corner1 = L.latLng(40.712, -74.227),\r
+ * corner2 = L.latLng(40.774, -74.125),\r
+ * bounds = L.latLngBounds(corner1, corner2);\r
+ * ```\r
+ *\r
+ * 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:\r
+ *\r
+ * ```js\r
+ * map.fitBounds([\r
+ *     [40.712, -74.227],\r
+ *     [40.774, -74.125]\r
+ * ]);\r
+ * ```\r
+ *\r
+ * 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.\r
+ */\r
+\r
+function LatLngBounds(corner1, corner2) { // (LatLng, LatLng) or (LatLng[])\r
+       if (!corner1) { return; }\r
+\r
+       var latlngs = corner2 ? [corner1, corner2] : corner1;\r
+\r
+       for (var i = 0, len = latlngs.length; i < len; i++) {\r
+               this.extend(latlngs[i]);\r
+       }\r
+}\r
+\r
+LatLngBounds.prototype = {\r
+\r
+       // @method extend(latlng: LatLng): this\r
+       // Extend the bounds to contain the given point\r
+\r
+       // @alternative\r
+       // @method extend(otherBounds: LatLngBounds): this\r
+       // Extend the bounds to contain the given bounds\r
+       extend: function (obj) {\r
+               var sw = this._southWest,\r
+                   ne = this._northEast,\r
+                   sw2, ne2;\r
+\r
+               if (obj instanceof LatLng) {\r
+                       sw2 = obj;\r
+                       ne2 = obj;\r
+\r
+               } else if (obj instanceof LatLngBounds) {\r
+                       sw2 = obj._southWest;\r
+                       ne2 = obj._northEast;\r
+\r
+                       if (!sw2 || !ne2) { return this; }\r
+\r
+               } else {\r
+                       return obj ? this.extend(toLatLng(obj) || toLatLngBounds(obj)) : this;\r
+               }\r
+\r
+               if (!sw && !ne) {\r
+                       this._southWest = new LatLng(sw2.lat, sw2.lng);\r
+                       this._northEast = new LatLng(ne2.lat, ne2.lng);\r
+               } else {\r
+                       sw.lat = Math.min(sw2.lat, sw.lat);\r
+                       sw.lng = Math.min(sw2.lng, sw.lng);\r
+                       ne.lat = Math.max(ne2.lat, ne.lat);\r
+                       ne.lng = Math.max(ne2.lng, ne.lng);\r
+               }\r
+\r
+               return this;\r
+       },\r
+\r
+       // @method pad(bufferRatio: Number): LatLngBounds\r
+       // Returns bigger bounds created by extending the current bounds by a given percentage in each direction.\r
+       pad: function (bufferRatio) {\r
+               var sw = this._southWest,\r
+                   ne = this._northEast,\r
+                   heightBuffer = Math.abs(sw.lat - ne.lat) * bufferRatio,\r
+                   widthBuffer = Math.abs(sw.lng - ne.lng) * bufferRatio;\r
+\r
+               return new LatLngBounds(\r
+                       new LatLng(sw.lat - heightBuffer, sw.lng - widthBuffer),\r
+                       new LatLng(ne.lat + heightBuffer, ne.lng + widthBuffer));\r
+       },\r
+\r
+       // @method getCenter(): LatLng\r
+       // Returns the center point of the bounds.\r
+       getCenter: function () {\r
+               return new LatLng(\r
+                       (this._southWest.lat + this._northEast.lat) / 2,\r
+                       (this._southWest.lng + this._northEast.lng) / 2);\r
+       },\r
+\r
+       // @method getSouthWest(): LatLng\r
+       // Returns the south-west point of the bounds.\r
+       getSouthWest: function () {\r
+               return this._southWest;\r
+       },\r
+\r
+       // @method getNorthEast(): LatLng\r
+       // Returns the north-east point of the bounds.\r
+       getNorthEast: function () {\r
+               return this._northEast;\r
+       },\r
+\r
+       // @method getNorthWest(): LatLng\r
+       // Returns the north-west point of the bounds.\r
+       getNorthWest: function () {\r
+               return new LatLng(this.getNorth(), this.getWest());\r
+       },\r
+\r
+       // @method getSouthEast(): LatLng\r
+       // Returns the south-east point of the bounds.\r
+       getSouthEast: function () {\r
+               return new LatLng(this.getSouth(), this.getEast());\r
+       },\r
+\r
+       // @method getWest(): Number\r
+       // Returns the west longitude of the bounds\r
+       getWest: function () {\r
+               return this._southWest.lng;\r
+       },\r
+\r
+       // @method getSouth(): Number\r
+       // Returns the south latitude of the bounds\r
+       getSouth: function () {\r
+               return this._southWest.lat;\r
+       },\r
+\r
+       // @method getEast(): Number\r
+       // Returns the east longitude of the bounds\r
+       getEast: function () {\r
+               return this._northEast.lng;\r
+       },\r
+\r
+       // @method getNorth(): Number\r
+       // Returns the north latitude of the bounds\r
+       getNorth: function () {\r
+               return this._northEast.lat;\r
+       },\r
+\r
+       // @method contains(otherBounds: LatLngBounds): Boolean\r
+       // Returns `true` if the rectangle contains the given one.\r
+\r
+       // @alternative\r
+       // @method contains (latlng: LatLng): Boolean\r
+       // Returns `true` if the rectangle contains the given point.\r
+       contains: function (obj) { // (LatLngBounds) or (LatLng) -> Boolean\r
+               if (typeof obj[0] === 'number' || obj instanceof LatLng || 'lat' in obj) {\r
+                       obj = toLatLng(obj);\r
+               } else {\r
+                       obj = toLatLngBounds(obj);\r
+               }\r
+\r
+               var sw = this._southWest,\r
+                   ne = this._northEast,\r
+                   sw2, ne2;\r
+\r
+               if (obj instanceof LatLngBounds) {\r
+                       sw2 = obj.getSouthWest();\r
+                       ne2 = obj.getNorthEast();\r
+               } else {\r
+                       sw2 = ne2 = obj;\r
+               }\r
+\r
+               return (sw2.lat >= sw.lat) && (ne2.lat <= ne.lat) &&\r
+                      (sw2.lng >= sw.lng) && (ne2.lng <= ne.lng);\r
+       },\r
+\r
+       // @method intersects(otherBounds: LatLngBounds): Boolean\r
+       // Returns `true` if the rectangle intersects the given bounds. Two bounds intersect if they have at least one point in common.\r
+       intersects: function (bounds) {\r
+               bounds = toLatLngBounds(bounds);\r
+\r
+               var sw = this._southWest,\r
+                   ne = this._northEast,\r
+                   sw2 = bounds.getSouthWest(),\r
+                   ne2 = bounds.getNorthEast(),\r
+\r
+                   latIntersects = (ne2.lat >= sw.lat) && (sw2.lat <= ne.lat),\r
+                   lngIntersects = (ne2.lng >= sw.lng) && (sw2.lng <= ne.lng);\r
+\r
+               return latIntersects && lngIntersects;\r
+       },\r
+\r
+       // @method overlaps(otherBounds: Bounds): Boolean\r
+       // Returns `true` if the rectangle overlaps the given bounds. Two bounds overlap if their intersection is an area.\r
+       overlaps: function (bounds) {\r
+               bounds = toLatLngBounds(bounds);\r
+\r
+               var sw = this._southWest,\r
+                   ne = this._northEast,\r
+                   sw2 = bounds.getSouthWest(),\r
+                   ne2 = bounds.getNorthEast(),\r
+\r
+                   latOverlaps = (ne2.lat > sw.lat) && (sw2.lat < ne.lat),\r
+                   lngOverlaps = (ne2.lng > sw.lng) && (sw2.lng < ne.lng);\r
+\r
+               return latOverlaps && lngOverlaps;\r
+       },\r
+\r
+       // @method toBBoxString(): String\r
+       // 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.\r
+       toBBoxString: function () {\r
+               return [this.getWest(), this.getSouth(), this.getEast(), this.getNorth()].join(',');\r
+       },\r
+\r
+       // @method equals(otherBounds: LatLngBounds, maxMargin?: Number): Boolean\r
+       // Returns `true` if the rectangle is equivalent (within a small margin of error) to the given bounds. The margin of error can be overriden by setting `maxMargin` to a small number.\r
+       equals: function (bounds, maxMargin) {\r
+               if (!bounds) { return false; }\r
+\r
+               bounds = toLatLngBounds(bounds);\r
+\r
+               return this._southWest.equals(bounds.getSouthWest(), maxMargin) &&\r
+                      this._northEast.equals(bounds.getNorthEast(), maxMargin);\r
+       },\r
+\r
+       // @method isValid(): Boolean\r
+       // Returns `true` if the bounds are properly initialized.\r
+       isValid: function () {\r
+               return !!(this._southWest && this._northEast);\r
+       }\r
+};\r
+\r
+// TODO International date line?\r
+\r
+// @factory L.latLngBounds(corner1: LatLng, corner2: LatLng)\r
+// Creates a `LatLngBounds` object by defining two diagonally opposite corners of the rectangle.\r
+\r
+// @alternative\r
+// @factory L.latLngBounds(latlngs: LatLng[])\r
+// 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).\r
+function toLatLngBounds(a, b) {\r
+       if (a instanceof LatLngBounds) {\r
+               return a;\r
+       }\r
+       return new LatLngBounds(a, b);\r
+}
+
+/* @class LatLng\r
+ * @aka L.LatLng\r
+ *\r
+ * Represents a geographical point with a certain latitude and longitude.\r
+ *\r
+ * @example\r
+ *\r
+ * ```\r
+ * var latlng = L.latLng(50.5, 30.5);\r
+ * ```\r
+ *\r
+ * 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:\r
+ *\r
+ * ```\r
+ * map.panTo([50, 30]);\r
+ * map.panTo({lon: 30, lat: 50});\r
+ * map.panTo({lat: 50, lng: 30});\r
+ * map.panTo(L.latLng(50, 30));\r
+ * ```\r
+ */\r
+\r
+function LatLng(lat, lng, alt) {\r
+       if (isNaN(lat) || isNaN(lng)) {\r
+               throw new Error('Invalid LatLng object: (' + lat + ', ' + lng + ')');\r
+       }\r
+\r
+       // @property lat: Number\r
+       // Latitude in degrees\r
+       this.lat = +lat;\r
+\r
+       // @property lng: Number\r
+       // Longitude in degrees\r
+       this.lng = +lng;\r
+\r
+       // @property alt: Number\r
+       // Altitude in meters (optional)\r
+       if (alt !== undefined) {\r
+               this.alt = +alt;\r
+       }\r
+}\r
+\r
+LatLng.prototype = {\r
+       // @method equals(otherLatLng: LatLng, maxMargin?: Number): Boolean\r
+       // Returns `true` if the given `LatLng` point is at the same position (within a small margin of error). The margin of error can be overriden by setting `maxMargin` to a small number.\r
+       equals: function (obj, maxMargin) {\r
+               if (!obj) { return false; }\r
+\r
+               obj = toLatLng(obj);\r
+\r
+               var margin = Math.max(\r
+                       Math.abs(this.lat - obj.lat),\r
+                       Math.abs(this.lng - obj.lng));\r
+\r
+               return margin <= (maxMargin === undefined ? 1.0E-9 : maxMargin);\r
+       },\r
+\r
+       // @method toString(): String\r
+       // Returns a string representation of the point (for debugging purposes).\r
+       toString: function (precision) {\r
+               return 'LatLng(' +\r
+                       formatNum(this.lat, precision) + ', ' +\r
+                       formatNum(this.lng, precision) + ')';\r
+       },\r
+\r
+       // @method distanceTo(otherLatLng: LatLng): Number\r
+       // Returns the distance (in meters) to the given `LatLng` calculated using the [Haversine formula](http://en.wikipedia.org/wiki/Haversine_formula).\r
+       distanceTo: function (other) {\r
+               return Earth.distance(this, toLatLng(other));\r
+       },\r
+\r
+       // @method wrap(): LatLng\r
+       // Returns a new `LatLng` object with the longitude wrapped so it's always between -180 and +180 degrees.\r
+       wrap: function () {\r
+               return Earth.wrapLatLng(this);\r
+       },\r
+\r
+       // @method toBounds(sizeInMeters: Number): LatLngBounds\r
+       // Returns a new `LatLngBounds` object in which each boundary is `sizeInMeters/2` meters apart from the `LatLng`.\r
+       toBounds: function (sizeInMeters) {\r
+               var latAccuracy = 180 * sizeInMeters / 40075017,\r
+                   lngAccuracy = latAccuracy / Math.cos((Math.PI / 180) * this.lat);\r
+\r
+               return toLatLngBounds(\r
+                       [this.lat - latAccuracy, this.lng - lngAccuracy],\r
+                       [this.lat + latAccuracy, this.lng + lngAccuracy]);\r
+       },\r
+\r
+       clone: function () {\r
+               return new LatLng(this.lat, this.lng, this.alt);\r
+       }\r
+};\r
+\r
+\r
+\r
+// @factory L.latLng(latitude: Number, longitude: Number, altitude?: Number): LatLng\r
+// Creates an object representing a geographical point with the given latitude and longitude (and optionally altitude).\r
+\r
+// @alternative\r
+// @factory L.latLng(coords: Array): LatLng\r
+// Expects an array of the form `[Number, Number]` or `[Number, Number, Number]` instead.\r
+\r
+// @alternative\r
+// @factory L.latLng(coords: Object): LatLng\r
+// Expects an plain object of the form `{lat: Number, lng: Number}` or `{lat: Number, lng: Number, alt: Number}` instead.\r
+\r
+function toLatLng(a, b, c) {\r
+       if (a instanceof LatLng) {\r
+               return a;\r
+       }\r
+       if (isArray(a) && typeof a[0] !== 'object') {\r
+               if (a.length === 3) {\r
+                       return new LatLng(a[0], a[1], a[2]);\r
+               }\r
+               if (a.length === 2) {\r
+                       return new LatLng(a[0], a[1]);\r
+               }\r
+               return null;\r
+       }\r
+       if (a === undefined || a === null) {\r
+               return a;\r
+       }\r
+       if (typeof a === 'object' && 'lat' in a) {\r
+               return new LatLng(a.lat, 'lng' in a ? a.lng : a.lon, a.alt);\r
+       }\r
+       if (b === undefined) {\r
+               return null;\r
+       }\r
+       return new LatLng(a, b, c);\r
+}
+
+/*\r
+ * @namespace CRS\r
+ * @crs L.CRS.Base\r
+ * Object that defines coordinate reference systems for projecting\r
+ * geographical points into pixel (screen) coordinates and back (and to\r
+ * coordinates in other units for [WMS](https://en.wikipedia.org/wiki/Web_Map_Service) services). See\r
+ * [spatial reference system](http://en.wikipedia.org/wiki/Coordinate_reference_system).\r
+ *\r
+ * Leaflet defines the most usual CRSs by default. If you want to use a\r
+ * CRS not defined by default, take a look at the\r
+ * [Proj4Leaflet](https://github.com/kartena/Proj4Leaflet) plugin.\r
+ */\r
+\r
+var CRS = {\r
+       // @method latLngToPoint(latlng: LatLng, zoom: Number): Point\r
+       // Projects geographical coordinates into pixel coordinates for a given zoom.\r
+       latLngToPoint: function (latlng, zoom) {\r
+               var projectedPoint = this.projection.project(latlng),\r
+                   scale = this.scale(zoom);\r
+\r
+               return this.transformation._transform(projectedPoint, scale);\r
+       },\r
+\r
+       // @method pointToLatLng(point: Point, zoom: Number): LatLng\r
+       // The inverse of `latLngToPoint`. Projects pixel coordinates on a given\r
+       // zoom into geographical coordinates.\r
+       pointToLatLng: function (point, zoom) {\r
+               var scale = this.scale(zoom),\r
+                   untransformedPoint = this.transformation.untransform(point, scale);\r
+\r
+               return this.projection.unproject(untransformedPoint);\r
+       },\r
+\r
+       // @method project(latlng: LatLng): Point\r
+       // Projects geographical coordinates into coordinates in units accepted for\r
+       // this CRS (e.g. meters for EPSG:3857, for passing it to WMS services).\r
+       project: function (latlng) {\r
+               return this.projection.project(latlng);\r
+       },\r
+\r
+       // @method unproject(point: Point): LatLng\r
+       // Given a projected coordinate returns the corresponding LatLng.\r
+       // The inverse of `project`.\r
+       unproject: function (point) {\r
+               return this.projection.unproject(point);\r
+       },\r
+\r
+       // @method scale(zoom: Number): Number\r
+       // Returns the scale used when transforming projected coordinates into\r
+       // pixel coordinates for a particular zoom. For example, it returns\r
+       // `256 * 2^zoom` for Mercator-based CRS.\r
+       scale: function (zoom) {\r
+               return 256 * Math.pow(2, zoom);\r
+       },\r
+\r
+       // @method zoom(scale: Number): Number\r
+       // Inverse of `scale()`, returns the zoom level corresponding to a scale\r
+       // factor of `scale`.\r
+       zoom: function (scale) {\r
+               return Math.log(scale / 256) / Math.LN2;\r
+       },\r
+\r
+       // @method getProjectedBounds(zoom: Number): Bounds\r
+       // Returns the projection's bounds scaled and transformed for the provided `zoom`.\r
+       getProjectedBounds: function (zoom) {\r
+               if (this.infinite) { return null; }\r
+\r
+               var b = this.projection.bounds,\r
+                   s = this.scale(zoom),\r
+                   min = this.transformation.transform(b.min, s),\r
+                   max = this.transformation.transform(b.max, s);\r
+\r
+               return new Bounds(min, max);\r
+       },\r
+\r
+       // @method distance(latlng1: LatLng, latlng2: LatLng): Number\r
+       // Returns the distance between two geographical coordinates.\r
+\r
+       // @property code: String\r
+       // Standard code name of the CRS passed into WMS services (e.g. `'EPSG:3857'`)\r
+       //\r
+       // @property wrapLng: Number[]\r
+       // An array of two numbers defining whether the longitude (horizontal) coordinate\r
+       // axis wraps around a given range and how. Defaults to `[-180, 180]` in most\r
+       // geographical CRSs. If `undefined`, the longitude axis does not wrap around.\r
+       //\r
+       // @property wrapLat: Number[]\r
+       // Like `wrapLng`, but for the latitude (vertical) axis.\r
+\r
+       // wrapLng: [min, max],\r
+       // wrapLat: [min, max],\r
+\r
+       // @property infinite: Boolean\r
+       // If true, the coordinate space will be unbounded (infinite in both axes)\r
+       infinite: false,\r
+\r
+       // @method wrapLatLng(latlng: LatLng): LatLng\r
+       // Returns a `LatLng` where lat and lng has been wrapped according to the\r
+       // CRS's `wrapLat` and `wrapLng` properties, if they are outside the CRS's bounds.\r
+       wrapLatLng: function (latlng) {\r
+               var lng = this.wrapLng ? wrapNum(latlng.lng, this.wrapLng, true) : latlng.lng,\r
+                   lat = this.wrapLat ? wrapNum(latlng.lat, this.wrapLat, true) : latlng.lat,\r
+                   alt = latlng.alt;\r
+\r
+               return new LatLng(lat, lng, alt);\r
+       },\r
+\r
+       // @method wrapLatLngBounds(bounds: LatLngBounds): LatLngBounds\r
+       // Returns a `LatLngBounds` with the same size as the given one, ensuring\r
+       // that its center is within the CRS's bounds.\r
+       // Only accepts actual `L.LatLngBounds` instances, not arrays.\r
+       wrapLatLngBounds: function (bounds) {\r
+               var center = bounds.getCenter(),\r
+                   newCenter = this.wrapLatLng(center),\r
+                   latShift = center.lat - newCenter.lat,\r
+                   lngShift = center.lng - newCenter.lng;\r
+\r
+               if (latShift === 0 && lngShift === 0) {\r
+                       return bounds;\r
+               }\r
+\r
+               var sw = bounds.getSouthWest(),\r
+                   ne = bounds.getNorthEast(),\r
+                   newSw = new LatLng(sw.lat - latShift, sw.lng - lngShift),\r
+                   newNe = new LatLng(ne.lat - latShift, ne.lng - lngShift);\r
+\r
+               return new LatLngBounds(newSw, newNe);\r
+       }\r
+};
+
+/*
+ * @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,
+                   a = Math.sin(lat1) * Math.sin(lat2) +
+                       Math.cos(lat1) * Math.cos(lat2) * Math.cos((latlng2.lng - latlng1.lng) * rad);
+
+               return this.R * Math.acos(Math.min(a, 1));
+       }
+});
+
+/*\r
+ * @namespace Projection\r
+ * @projection L.Projection.SphericalMercator\r
+ *\r
+ * Spherical Mercator projection — the most common projection for online maps,\r
+ * used by almost all free and commercial tile providers. Assumes that Earth is\r
+ * a sphere. Used by the `EPSG:3857` CRS.\r
+ */\r
+\r
+var SphericalMercator = {\r
+\r
+       R: 6378137,\r
+       MAX_LATITUDE: 85.0511287798,\r
+\r
+       project: function (latlng) {\r
+               var d = Math.PI / 180,\r
+                   max = this.MAX_LATITUDE,\r
+                   lat = Math.max(Math.min(max, latlng.lat), -max),\r
+                   sin = Math.sin(lat * d);\r
+\r
+               return new Point(\r
+                               this.R * latlng.lng * d,\r
+                               this.R * Math.log((1 + sin) / (1 - sin)) / 2);\r
+       },\r
+\r
+       unproject: function (point) {\r
+               var d = 180 / Math.PI;\r
+\r
+               return new LatLng(\r
+                       (2 * Math.atan(Math.exp(point.y / this.R)) - (Math.PI / 2)) * d,\r
+                       point.x * d / this.R);\r
+       },\r
+\r
+       bounds: (function () {\r
+               var d = 6378137 * Math.PI;\r
+               return new Bounds([-d, -d], [d, d]);\r
+       })()\r
+};
+
+/*\r
+ * @class Transformation\r
+ * @aka L.Transformation\r
+ *\r
+ * Represents an affine transformation: a set of coefficients `a`, `b`, `c`, `d`\r
+ * for transforming a point of a form `(x, y)` into `(a*x + b, c*y + d)` and doing\r
+ * the reverse. Used by Leaflet in its projections code.\r
+ *\r
+ * @example\r
+ *\r
+ * ```js\r
+ * var transformation = L.transformation(2, 5, -1, 10),\r
+ *     p = L.point(1, 2),\r
+ *     p2 = transformation.transform(p), //  L.point(7, 8)\r
+ *     p3 = transformation.untransform(p2); //  L.point(1, 2)\r
+ * ```\r
+ */\r
+\r
+\r
+// factory new L.Transformation(a: Number, b: Number, c: Number, d: Number)\r
+// Creates a `Transformation` object with the given coefficients.\r
+function Transformation(a, b, c, d) {\r
+       if (isArray(a)) {\r
+               // use array properties\r
+               this._a = a[0];\r
+               this._b = a[1];\r
+               this._c = a[2];\r
+               this._d = a[3];\r
+               return;\r
+       }\r
+       this._a = a;\r
+       this._b = b;\r
+       this._c = c;\r
+       this._d = d;\r
+}\r
+\r
+Transformation.prototype = {\r
+       // @method transform(point: Point, scale?: Number): Point\r
+       // Returns a transformed point, optionally multiplied by the given scale.\r
+       // Only accepts actual `L.Point` instances, not arrays.\r
+       transform: function (point, scale) { // (Point, Number) -> Point\r
+               return this._transform(point.clone(), scale);\r
+       },\r
+\r
+       // destructive transform (faster)\r
+       _transform: function (point, scale) {\r
+               scale = scale || 1;\r
+               point.x = scale * (this._a * point.x + this._b);\r
+               point.y = scale * (this._c * point.y + this._d);\r
+               return point;\r
+       },\r
+\r
+       // @method untransform(point: Point, scale?: Number): Point\r
+       // Returns the reverse transformation of the given point, optionally divided\r
+       // by the given scale. Only accepts actual `L.Point` instances, not arrays.\r
+       untransform: function (point, scale) {\r
+               scale = scale || 1;\r
+               return new Point(\r
+                       (point.x / scale - this._b) / this._a,\r
+                       (point.y / scale - this._d) / this._c);\r
+       }\r
+};\r
+\r
+// factory L.transformation(a: Number, b: Number, c: Number, d: Number)\r
+\r
+// @factory L.transformation(a: Number, b: Number, c: Number, d: Number)\r
+// Instantiates a Transformation object with the given coefficients.\r
+\r
+// @alternative\r
+// @factory L.transformation(coefficients: Array): Transformation\r
+// Expects an coeficients array of the form\r
+// `[a: Number, b: Number, c: Number, d: Number]`.\r
+\r
+function toTransformation(a, b, c, d) {\r
+       return new Transformation(a, b, c, d);\r
+}
+
+/*\r
+ * @namespace CRS\r
+ * @crs L.CRS.EPSG3857\r
+ *\r
+ * The most common CRS for online maps, used by almost all free and commercial\r
+ * tile providers. Uses Spherical Mercator projection. Set in by default in\r
+ * Map's `crs` option.\r
+ */\r
+\r
+var EPSG3857 = extend({}, Earth, {\r
+       code: 'EPSG:3857',\r
+       projection: SphericalMercator,\r
+\r
+       transformation: (function () {\r
+               var scale = 0.5 / (Math.PI * SphericalMercator.R);\r
+               return toTransformation(scale, 0.5, -scale, 0.5);\r
+       }())\r
+});\r
+\r
+var EPSG900913 = extend({}, EPSG3857, {\r
+       code: 'EPSG:900913'\r
+});
+
+// @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';
+}
+
+/*\r
+ * @namespace Browser\r
+ * @aka L.Browser\r
+ *\r
+ * A namespace with static properties for browser/feature detection used by Leaflet internally.\r
+ *\r
+ * @example\r
+ *\r
+ * ```js\r
+ * if (L.Browser.ielt9) {\r
+ *   alert('Upgrade your browser, dude!');\r
+ * }\r
+ * ```\r
+ */\r
+\r
+var style$1 = document.documentElement.style;\r
+\r
+// @property ie: Boolean; `true` for all Internet Explorer versions (not Edge).\r
+var ie = 'ActiveXObject' in window;\r
+\r
+// @property ielt9: Boolean; `true` for Internet Explorer versions less than 9.\r
+var ielt9 = ie && !document.addEventListener;\r
+\r
+// @property edge: Boolean; `true` for the Edge web browser.\r
+var edge = 'msLaunchUri' in navigator && !('documentMode' in document);\r
+\r
+// @property webkit: Boolean;\r
+// `true` for webkit-based browsers like Chrome and Safari (including mobile versions).\r
+var webkit = userAgentContains('webkit');\r
+\r
+// @property android: Boolean\r
+// `true` for any browser running on an Android platform.\r
+var android = userAgentContains('android');\r
+\r
+// @property android23: Boolean; `true` for browsers running on Android 2 or Android 3.\r
+var android23 = userAgentContains('android 2') || userAgentContains('android 3');\r
+\r
+// @property opera: Boolean; `true` for the Opera browser\r
+var opera = !!window.opera;\r
+\r
+// @property chrome: Boolean; `true` for the Chrome browser.\r
+var chrome = userAgentContains('chrome');\r
+\r
+// @property gecko: Boolean; `true` for gecko-based browsers like Firefox.\r
+var gecko = userAgentContains('gecko') && !webkit && !opera && !ie;\r
+\r
+// @property safari: Boolean; `true` for the Safari browser.\r
+var safari = !chrome && userAgentContains('safari');\r
+\r
+var phantom = userAgentContains('phantom');\r
+\r
+// @property opera12: Boolean\r
+// `true` for the Opera browser supporting CSS transforms (version 12 or later).\r
+var opera12 = 'OTransition' in style$1;\r
+\r
+// @property win: Boolean; `true` when the browser is running in a Windows platform\r
+var win = navigator.platform.indexOf('Win') === 0;\r
+\r
+// @property ie3d: Boolean; `true` for all Internet Explorer versions supporting CSS transforms.\r
+var ie3d = ie && ('transition' in style$1);\r
+\r
+// @property webkit3d: Boolean; `true` for webkit-based browsers supporting CSS transforms.\r
+var webkit3d = ('WebKitCSSMatrix' in window) && ('m11' in new window.WebKitCSSMatrix()) && !android23;\r
+\r
+// @property gecko3d: Boolean; `true` for gecko-based browsers supporting CSS transforms.\r
+var gecko3d = 'MozPerspective' in style$1;\r
+\r
+// @property any3d: Boolean\r
+// `true` for all browsers supporting CSS transforms.\r
+var any3d = !window.L_DISABLE_3D && (ie3d || webkit3d || gecko3d) && !opera12 && !phantom;\r
+\r
+// @property mobile: Boolean; `true` for all browsers running in a mobile device.\r
+var mobile = typeof orientation !== 'undefined' || userAgentContains('mobile');\r
+\r
+// @property mobileWebkit: Boolean; `true` for all webkit-based browsers in a mobile device.\r
+var mobileWebkit = mobile && webkit;\r
+\r
+// @property mobileWebkit3d: Boolean\r
+// `true` for all webkit-based browsers in a mobile device supporting CSS transforms.\r
+var mobileWebkit3d = mobile && webkit3d;\r
+\r
+// @property msPointer: Boolean\r
+// `true` for browsers implementing the Microsoft touch events model (notably IE10).\r
+var msPointer = !window.PointerEvent && window.MSPointerEvent;\r
+\r
+// @property pointer: Boolean\r
+// `true` for all browsers supporting [pointer events](https://msdn.microsoft.com/en-us/library/dn433244%28v=vs.85%29.aspx).\r
+var pointer = !!(window.PointerEvent || msPointer);\r
+\r
+// @property touch: Boolean\r
+// `true` for all browsers supporting [touch events](https://developer.mozilla.org/docs/Web/API/Touch_events).\r
+// This does not necessarily mean that the browser is running in a computer with\r
+// a touchscreen, it only means that the browser is capable of understanding\r
+// touch events.\r
+var touch = !window.L_NO_TOUCH && (pointer || 'ontouchstart' in window ||\r
+               (window.DocumentTouch && document instanceof window.DocumentTouch));\r
+\r
+// @property mobileOpera: Boolean; `true` for the Opera browser in a mobile device.\r
+var mobileOpera = mobile && opera;\r
+\r
+// @property mobileGecko: Boolean\r
+// `true` for gecko-based browsers running in a mobile device.\r
+var mobileGecko = mobile && gecko;\r
+\r
+// @property retina: Boolean\r
+// `true` for browsers on a high-resolution "retina" screen.\r
+var retina = (window.devicePixelRatio || (window.screen.deviceXDPI / window.screen.logicalXDPI)) > 1;\r
+\r
+\r
+// @property canvas: Boolean\r
+// `true` when the browser supports [`<canvas>`](https://developer.mozilla.org/docs/Web/API/Canvas_API).\r
+var canvas = (function () {\r
+       return !!document.createElement('canvas').getContext;\r
+}());\r
+\r
+// @property svg: Boolean\r
+// `true` when the browser supports [SVG](https://developer.mozilla.org/docs/Web/SVG).\r
+var svg = !!(document.createElementNS && svgCreate('svg').createSVGRect);\r
+\r
+// @property vml: Boolean\r
+// `true` if the browser supports [VML](https://en.wikipedia.org/wiki/Vector_Markup_Language).\r
+var vml = !svg && (function () {\r
+       try {\r
+               var div = document.createElement('div');\r
+               div.innerHTML = '<v:shape adj="1"/>';\r
+\r
+               var shape = div.firstChild;\r
+               shape.style.behavior = 'url(#default#VML)';\r
+\r
+               return shape && (typeof shape.adj === 'object');\r
+\r
+       } catch (e) {\r
+               return false;\r
+       }\r
+}());\r
+\r
+\r
+function userAgentContains(str) {\r
+       return navigator.userAgent.toLowerCase().indexOf(str) >= 0;\r
+}\r
+
+
+var Browser = (Object.freeze || Object)({
+       ie: ie,
+       ielt9: ielt9,
+       edge: edge,
+       webkit: webkit,
+       android: android,
+       android23: android23,
+       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,
+       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 TAG_WHITE_LIST = ['INPUT', 'SELECT', 'OPTION'];
+var _pointers = {};
+var _pointerDocListener = false;
+
+// DomEvent.DoubleTap needs to know about this
+var _pointersCount = 0;
+
+// 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) {
+               if (e.pointerType !== 'mouse' && e.pointerType !== e.MSPOINTER_TYPE_MOUSE && e.pointerType !== e.MSPOINTER_TYPE_MOUSE) {
+                       // In IE11, some touch events needs to fire for form controls, or
+                       // the controls will stop working. We keep a whitelist of tag names that
+                       // need these events. For other target tags, we prevent default on the event.
+                       if (TAG_WHITE_LIST.indexOf(e.target.tagName) < 0) {
+                               preventDefault(e);
+                       } else {
+                               return;
+                       }
+               }
+
+               _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 documentElement as any drags that end by moving the touch off the screen get fired there
+               document.documentElement.addEventListener(POINTER_DOWN, _globalPointerDown, true);
+               document.documentElement.addEventListener(POINTER_MOVE, _globalPointerMove, true);
+               document.documentElement.addEventListener(POINTER_UP, _globalPointerUp, true);
+               document.documentElement.addEventListener(POINTER_CANCEL, _globalPointerUp, true);
+
+               _pointerDocListener = true;
+       }
+}
+
+function _globalPointerDown(e) {
+       _pointers[e.pointerId] = e;
+       _pointersCount++;
+}
+
+function _globalPointerMove(e) {
+       if (_pointers[e.pointerId]) {
+               _pointers[e.pointerId] = e;
+       }
+}
+
+function _globalPointerUp(e) {
+       delete _pointers[e.pointerId];
+       _pointersCount--;
+}
+
+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 || e.pointerType === '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);
+}
+
+/*\r
+ * Extends the event handling code with double tap support for mobile browsers.\r
+ */\r
+\r
+var _touchstart = msPointer ? 'MSPointerDown' : pointer ? 'pointerdown' : 'touchstart';
+var _touchend = msPointer ? 'MSPointerUp' : pointer ? 'pointerup' : 'touchend';
+var _pre = '_leaflet_';\r
+\r
+// inspired by Zepto touch code by Thomas Fuchs\r
+function addDoubleTapListener(obj, handler, id) {\r
+       var last, touch$$1,\r
+           doubleTap = false,\r
+           delay = 250;\r
+\r
+       function onTouchStart(e) {\r
+               var count;\r
+\r
+               if (pointer) {\r
+                       if ((!edge) || e.pointerType === 'mouse') { return; }\r
+                       count = _pointersCount;\r
+               } else {\r
+                       count = e.touches.length;\r
+               }\r
+\r
+               if (count > 1) { return; }\r
+\r
+               var now = Date.now(),\r
+                   delta = now - (last || now);\r
+\r
+               touch$$1 = e.touches ? e.touches[0] : e;\r
+               doubleTap = (delta > 0 && delta <= delay);\r
+               last = now;\r
+       }\r
+\r
+       function onTouchEnd(e) {\r
+               if (doubleTap && !touch$$1.cancelBubble) {\r
+                       if (pointer) {\r
+                               if ((!edge) || e.pointerType === 'mouse') { return; }\r
+                               // work around .type being readonly with MSPointer* events\r
+                               var newTouch = {},\r
+                                   prop, i;\r
+\r
+                               for (i in touch$$1) {\r
+                                       prop = touch$$1[i];\r
+                                       newTouch[i] = prop && prop.bind ? prop.bind(touch$$1) : prop;\r
+                               }\r
+                               touch$$1 = newTouch;\r
+                       }\r
+                       touch$$1.type = 'dblclick';\r
+                       handler(touch$$1);\r
+                       last = null;\r
+               }\r
+       }\r
+\r
+       obj[_pre + _touchstart + id] = onTouchStart;\r
+       obj[_pre + _touchend + id] = onTouchEnd;\r
+       obj[_pre + 'dblclick' + id] = handler;\r
+\r
+       obj.addEventListener(_touchstart, onTouchStart, false);\r
+       obj.addEventListener(_touchend, onTouchEnd, false);\r
+\r
+       // On some platforms (notably, chrome<55 on win10 + touchscreen + mouse),\r
+       // the browser doesn't fire touchend/pointerup events but does fire\r
+       // native dblclicks. See #4127.\r
+       // Edge 14 also fires native dblclicks, but only for pointerType mouse, see #5180.\r
+       obj.addEventListener('dblclick', handler, false);\r
+\r
+       return this;\r
+}\r
+\r
+function removeDoubleTapListener(obj, id) {\r
+       var touchstart = obj[_pre + _touchstart + id],\r
+           touchend = obj[_pre + _touchend + id],\r
+           dblclick = obj[_pre + 'dblclick' + id];\r
+\r
+       obj.removeEventListener(_touchstart, touchstart, false);\r
+       obj.removeEventListener(_touchend, touchend, false);\r
+       if (!edge) {\r
+               obj.removeEventListener('dblclick', dblclick, false);\r
+       }\r
+\r
+       return this;\r
+}
+
+/*\r
+ * @namespace DomEvent\r
+ * Utility functions to work with the [DOM events](https://developer.mozilla.org/docs/Web/API/Event), used by Leaflet internally.\r
+ */\r
+\r
+// Inspired by John Resig, Dean Edwards and YUI addEvent implementations.\r
+\r
+// @function on(el: HTMLElement, types: String, fn: Function, context?: Object): this\r
+// Adds a listener function (`fn`) to a particular DOM event type of the\r
+// element `el`. You can optionally specify the context of the listener\r
+// (object the `this` keyword will point to). You can also pass several\r
+// space-separated types (e.g. `'click dblclick'`).\r
+\r
+// @alternative\r
+// @function on(el: HTMLElement, eventMap: Object, context?: Object): this\r
+// Adds a set of type/listener pairs, e.g. `{click: onClick, mousemove: onMouseMove}`\r
+function on(obj, types, fn, context) {\r
+\r
+       if (typeof types === 'object') {\r
+               for (var type in types) {\r
+                       addOne(obj, type, types[type], fn);\r
+               }\r
+       } else {\r
+               types = splitWords(types);\r
+\r
+               for (var i = 0, len = types.length; i < len; i++) {\r
+                       addOne(obj, types[i], fn, context);\r
+               }\r
+       }\r
+\r
+       return this;\r
+}\r
+\r
+var eventsKey = '_leaflet_events';\r
+\r
+// @function off(el: HTMLElement, types: String, fn: Function, context?: Object): this\r
+// Removes a previously added listener function. If no function is specified,\r
+// it will remove all the listeners of that particular DOM event from the element.\r
+// Note that if you passed a custom context to on, you must pass the same\r
+// context to `off` in order to remove the listener.\r
+\r
+// @alternative\r
+// @function off(el: HTMLElement, eventMap: Object, context?: Object): this\r
+// Removes a set of type/listener pairs, e.g. `{click: onClick, mousemove: onMouseMove}`\r
+\r
+// @alternative\r
+// @function off(el: HTMLElement): this\r
+// Removes all known event listeners\r
+function off(obj, types, fn, context) {\r
+\r
+       if (typeof types === 'object') {\r
+               for (var type in types) {\r
+                       removeOne(obj, type, types[type], fn);\r
+               }\r
+       } else if (types) {\r
+               types = splitWords(types);\r
+\r
+               for (var i = 0, len = types.length; i < len; i++) {\r
+                       removeOne(obj, types[i], fn, context);\r
+               }\r
+       } else {\r
+               for (var j in obj[eventsKey]) {\r
+                       removeOne(obj, j, obj[eventsKey][j]);\r
+               }\r
+               delete obj[eventsKey];\r
+       }\r
+\r
+       return this;\r
+}\r
+\r
+function addOne(obj, type, fn, context) {\r
+       var id = type + stamp(fn) + (context ? '_' + stamp(context) : '');\r
+\r
+       if (obj[eventsKey] && obj[eventsKey][id]) { return this; }\r
+\r
+       var handler = function (e) {\r
+               return fn.call(context || obj, e || window.event);\r
+       };\r
+\r
+       var originalHandler = handler;\r
+\r
+       if (pointer && type.indexOf('touch') === 0) {\r
+               // Needs DomEvent.Pointer.js\r
+               addPointerListener(obj, type, handler, id);\r
+\r
+       } else if (touch && (type === 'dblclick') && addDoubleTapListener &&\r
+                  !(pointer && chrome)) {\r
+               // Chrome >55 does not need the synthetic dblclicks from addDoubleTapListener\r
+               // See #5180\r
+               addDoubleTapListener(obj, handler, id);\r
+\r
+       } else if ('addEventListener' in obj) {\r
+\r
+               if (type === 'mousewheel') {\r
+                       obj.addEventListener('onwheel' in obj ? 'wheel' : 'mousewheel', handler, false);\r
+\r
+               } else if ((type === 'mouseenter') || (type === 'mouseleave')) {\r
+                       handler = function (e) {\r
+                               e = e || window.event;\r
+                               if (isExternalTarget(obj, e)) {\r
+                                       originalHandler(e);\r
+                               }\r
+                       };\r
+                       obj.addEventListener(type === 'mouseenter' ? 'mouseover' : 'mouseout', handler, false);\r
+\r
+               } else {\r
+                       if (type === 'click' && android) {\r
+                               handler = function (e) {\r
+                                       filterClick(e, originalHandler);\r
+                               };\r
+                       }\r
+                       obj.addEventListener(type, handler, false);\r
+               }\r
+\r
+       } else if ('attachEvent' in obj) {\r
+               obj.attachEvent('on' + type, handler);\r
+       }\r
+\r
+       obj[eventsKey] = obj[eventsKey] || {};\r
+       obj[eventsKey][id] = handler;\r
+}\r
+\r
+function removeOne(obj, type, fn, context) {\r
+\r
+       var id = type + stamp(fn) + (context ? '_' + stamp(context) : ''),\r
+           handler = obj[eventsKey] && obj[eventsKey][id];\r
+\r
+       if (!handler) { return this; }\r
+\r
+       if (pointer && type.indexOf('touch') === 0) {\r
+               removePointerListener(obj, type, id);\r
+\r
+       } else if (touch && (type === 'dblclick') && removeDoubleTapListener) {\r
+               removeDoubleTapListener(obj, id);\r
+\r
+       } else if ('removeEventListener' in obj) {\r
+\r
+               if (type === 'mousewheel') {\r
+                       obj.removeEventListener('onwheel' in obj ? 'wheel' : 'mousewheel', handler, false);\r
+\r
+               } else {\r
+                       obj.removeEventListener(\r
+                               type === 'mouseenter' ? 'mouseover' :\r
+                               type === 'mouseleave' ? 'mouseout' : type, handler, false);\r
+               }\r
+\r
+       } else if ('detachEvent' in obj) {\r
+               obj.detachEvent('on' + type, handler);\r
+       }\r
+\r
+       obj[eventsKey][id] = null;\r
+}\r
+\r
+// @function stopPropagation(ev: DOMEvent): this\r
+// Stop the given event from propagation to parent elements. Used inside the listener functions:\r
+// ```js\r
+// L.DomEvent.on(div, 'click', function (ev) {\r
+//     L.DomEvent.stopPropagation(ev);\r
+// });\r
+// ```\r
+function stopPropagation(e) {\r
+\r
+       if (e.stopPropagation) {\r
+               e.stopPropagation();\r
+       } else if (e.originalEvent) {  // In case of Leaflet event.\r
+               e.originalEvent._stopped = true;\r
+       } else {\r
+               e.cancelBubble = true;\r
+       }\r
+       skipped(e);\r
+\r
+       return this;\r
+}\r
+\r
+// @function disableScrollPropagation(el: HTMLElement): this\r
+// Adds `stopPropagation` to the element's `'mousewheel'` events (plus browser variants).\r
+function disableScrollPropagation(el) {\r
+       addOne(el, 'mousewheel', stopPropagation);\r
+       return this;\r
+}\r
+\r
+// @function disableClickPropagation(el: HTMLElement): this\r
+// Adds `stopPropagation` to the element's `'click'`, `'doubleclick'`,\r
+// `'mousedown'` and `'touchstart'` events (plus browser variants).\r
+function disableClickPropagation(el) {\r
+       on(el, 'mousedown touchstart dblclick', stopPropagation);\r
+       addOne(el, 'click', fakeStop);\r
+       return this;\r
+}\r
+\r
+// @function preventDefault(ev: DOMEvent): this\r
+// Prevents the default action of the DOM Event `ev` from happening (such as\r
+// following a link in the href of the a element, or doing a POST request\r
+// with page reload when a `<form>` is submitted).\r
+// Use it inside listener functions.\r
+function preventDefault(e) {\r
+       if (e.preventDefault) {\r
+               e.preventDefault();\r
+       } else {\r
+               e.returnValue = false;\r
+       }\r
+       return this;\r
+}\r
+\r
+// @function stop(ev): this\r
+// Does `stopPropagation` and `preventDefault` at the same time.\r
+function stop(e) {\r
+       preventDefault(e);\r
+       stopPropagation(e);\r
+       return this;\r
+}\r
+\r
+// @function getMousePosition(ev: DOMEvent, container?: HTMLElement): Point\r
+// Gets normalized mouse position from a DOM event relative to the\r
+// `container` or to the whole page if not specified.\r
+function getMousePosition(e, container) {\r
+       if (!container) {\r
+               return new Point(e.clientX, e.clientY);\r
+       }\r
+\r
+       var rect = container.getBoundingClientRect();\r
+\r
+       return new Point(\r
+               e.clientX - rect.left - container.clientLeft,\r
+               e.clientY - rect.top - container.clientTop);\r
+}\r
+\r
+// Chrome on Win scrolls double the pixels as in other platforms (see #4538),\r
+// and Firefox scrolls device pixels, not CSS pixels\r
+var wheelPxFactor =\r
+       (win && chrome) ? 2 * window.devicePixelRatio :\r
+       gecko ? window.devicePixelRatio : 1;\r
+\r
+// @function getWheelDelta(ev: DOMEvent): Number\r
+// Gets normalized wheel delta from a mousewheel DOM event, in vertical\r
+// pixels scrolled (negative if scrolling down).\r
+// Events from pointing devices without precise scrolling are mapped to\r
+// a best guess of 60 pixels.\r
+function getWheelDelta(e) {\r
+       return (edge) ? e.wheelDeltaY / 2 : // Don't trust window-geometry-based delta\r
+              (e.deltaY && e.deltaMode === 0) ? -e.deltaY / wheelPxFactor : // Pixels\r
+              (e.deltaY && e.deltaMode === 1) ? -e.deltaY * 20 : // Lines\r
+              (e.deltaY && e.deltaMode === 2) ? -e.deltaY * 60 : // Pages\r
+              (e.deltaX || e.deltaZ) ? 0 :     // Skip horizontal/depth wheel events\r
+              e.wheelDelta ? (e.wheelDeltaY || e.wheelDelta) / 2 : // Legacy IE pixels\r
+              (e.detail && Math.abs(e.detail) < 32765) ? -e.detail * 20 : // Legacy Moz lines\r
+              e.detail ? e.detail / -32765 * 60 : // Legacy Moz pages\r
+              0;\r
+}\r
+\r
+var skipEvents = {};\r
+\r
+function fakeStop(e) {\r
+       // fakes stopPropagation by setting a special event flag, checked/reset with skipped(e)\r
+       skipEvents[e.type] = true;\r
+}\r
+\r
+function skipped(e) {\r
+       var events = skipEvents[e.type];\r
+       // reset when checking, as it's only used in map container and propagates outside of the map\r
+       skipEvents[e.type] = false;\r
+       return events;\r
+}\r
+\r
+// check if element really left/entered the event target (for mouseenter/mouseleave)\r
+function isExternalTarget(el, e) {\r
+\r
+       var related = e.relatedTarget;\r
+\r
+       if (!related) { return true; }\r
+\r
+       try {\r
+               while (related && (related !== el)) {\r
+                       related = related.parentNode;\r
+               }\r
+       } catch (err) {\r
+               return false;\r
+       }\r
+       return (related !== el);\r
+}\r
+\r
+var lastClick;\r
+\r
+// this is a horrible workaround for a bug in Android where a single touch triggers two click events\r
+function filterClick(e, handler) {\r
+       var timeStamp = (e.timeStamp || (e.originalEvent && e.originalEvent.timeStamp)),\r
+           elapsed = lastClick && (timeStamp - lastClick);\r
+\r
+       // are they closer together than 500ms yet more than 100ms?\r
+       // Android typically triggers them ~300ms apart while multiple listeners\r
+       // on the same event should be triggered far faster;\r
+       // or check if click is simulated on the element, and if it is, reject any non-simulated events\r
+\r
+       if ((elapsed && elapsed > 100 && elapsed < 500) || (e.target._simulatedClick && !e._simulated)) {\r
+               stop(e);\r
+               return;\r
+       }\r
+       lastClick = timeStamp;\r
+\r
+       handler(e);\r
+}\r
+\r
+\r
+
+
+var DomEvent = (Object.freeze || Object)({
+       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
+});
+
+/*\r
+ * @namespace DomUtil\r
+ *\r
+ * Utility functions to work with the [DOM](https://developer.mozilla.org/docs/Web/API/Document_Object_Model)\r
+ * tree, used by Leaflet internally.\r
+ *\r
+ * Most functions expecting or returning a `HTMLElement` also work for\r
+ * SVG elements. The only difference is that classes refer to CSS classes\r
+ * in HTML and SVG classes in SVG.\r
+ */\r
+\r
+\r
+// @property TRANSFORM: String\r
+// Vendor-prefixed transform style name (e.g. `'webkitTransform'` for WebKit).\r
+var TRANSFORM = testProp(\r
+       ['transform', 'WebkitTransform', 'OTransform', 'MozTransform', 'msTransform']);\r
+\r
+// webkitTransition comes first because some browser versions that drop vendor prefix don't do\r
+// the same for the transitionend event, in particular the Android 4.1 stock browser\r
+\r
+// @property TRANSITION: String\r
+// Vendor-prefixed transition style name.\r
+var TRANSITION = testProp(\r
+       ['webkitTransition', 'transition', 'OTransition', 'MozTransition', 'msTransition']);\r
+\r
+// @property TRANSITION_END: String\r
+// Vendor-prefixed transitionend event name.\r
+var TRANSITION_END =\r
+       TRANSITION === 'webkitTransition' || TRANSITION === 'OTransition' ? TRANSITION + 'End' : 'transitionend';\r
+\r
+\r
+// @function get(id: String|HTMLElement): HTMLElement\r
+// Returns an element given its DOM id, or returns the element itself\r
+// if it was passed directly.\r
+function get(id) {\r
+       return typeof id === 'string' ? document.getElementById(id) : id;\r
+}\r
+\r
+// @function getStyle(el: HTMLElement, styleAttrib: String): String\r
+// Returns the value for a certain style attribute on an element,\r
+// including computed values or values set through CSS.\r
+function getStyle(el, style) {\r
+       var value = el.style[style] || (el.currentStyle && el.currentStyle[style]);\r
+\r
+       if ((!value || value === 'auto') && document.defaultView) {\r
+               var css = document.defaultView.getComputedStyle(el, null);\r
+               value = css ? css[style] : null;\r
+       }\r
+       return value === 'auto' ? null : value;\r
+}\r
+\r
+// @function create(tagName: String, className?: String, container?: HTMLElement): HTMLElement\r
+// Creates an HTML element with `tagName`, sets its class to `className`, and optionally appends it to `container` element.\r
+function create$1(tagName, className, container) {\r
+       var el = document.createElement(tagName);\r
+       el.className = className || '';\r
+\r
+       if (container) {\r
+               container.appendChild(el);\r
+       }\r
+       return el;\r
+}\r
+\r
+// @function remove(el: HTMLElement)\r
+// Removes `el` from its parent element\r
+function remove(el) {\r
+       var parent = el.parentNode;\r
+       if (parent) {\r
+               parent.removeChild(el);\r
+       }\r
+}\r
+\r
+// @function empty(el: HTMLElement)\r
+// Removes all of `el`'s children elements from `el`\r
+function empty(el) {\r
+       while (el.firstChild) {\r
+               el.removeChild(el.firstChild);\r
+       }\r
+}\r
+\r
+// @function toFront(el: HTMLElement)\r
+// Makes `el` the last child of its parent, so it renders in front of the other children.\r
+function toFront(el) {\r
+       var parent = el.parentNode;\r
+       if (parent.lastChild !== el) {\r
+               parent.appendChild(el);\r
+       }\r
+}\r
+\r
+// @function toBack(el: HTMLElement)\r
+// Makes `el` the first child of its parent, so it renders behind the other children.\r
+function toBack(el) {\r
+       var parent = el.parentNode;\r
+       if (parent.firstChild !== el) {\r
+               parent.insertBefore(el, parent.firstChild);\r
+       }\r
+}\r
+\r
+// @function hasClass(el: HTMLElement, name: String): Boolean\r
+// Returns `true` if the element's class attribute contains `name`.\r
+function hasClass(el, name) {\r
+       if (el.classList !== undefined) {\r
+               return el.classList.contains(name);\r
+       }\r
+       var className = getClass(el);\r
+       return className.length > 0 && new RegExp('(^|\\s)' + name + '(\\s|$)').test(className);\r
+}\r
+\r
+// @function addClass(el: HTMLElement, name: String)\r
+// Adds `name` to the element's class attribute.\r
+function addClass(el, name) {\r
+       if (el.classList !== undefined) {\r
+               var classes = splitWords(name);\r
+               for (var i = 0, len = classes.length; i < len; i++) {\r
+                       el.classList.add(classes[i]);\r
+               }\r
+       } else if (!hasClass(el, name)) {\r
+               var className = getClass(el);\r
+               setClass(el, (className ? className + ' ' : '') + name);\r
+       }\r
+}\r
+\r
+// @function removeClass(el: HTMLElement, name: String)\r
+// Removes `name` from the element's class attribute.\r
+function removeClass(el, name) {\r
+       if (el.classList !== undefined) {\r
+               el.classList.remove(name);\r
+       } else {\r
+               setClass(el, trim((' ' + getClass(el) + ' ').replace(' ' + name + ' ', ' ')));\r
+       }\r
+}\r
+\r
+// @function setClass(el: HTMLElement, name: String)\r
+// Sets the element's class.\r
+function setClass(el, name) {\r
+       if (el.className.baseVal === undefined) {\r
+               el.className = name;\r
+       } else {\r
+               // in case of SVG element\r
+               el.className.baseVal = name;\r
+       }\r
+}\r
+\r
+// @function getClass(el: HTMLElement): String\r
+// Returns the element's class.\r
+function getClass(el) {\r
+       return el.className.baseVal === undefined ? el.className : el.className.baseVal;\r
+}\r
+\r
+// @function setOpacity(el: HTMLElement, opacity: Number)\r
+// Set the opacity of an element (including old IE support).\r
+// `opacity` must be a number from `0` to `1`.\r
+function setOpacity(el, value) {\r
+       if ('opacity' in el.style) {\r
+               el.style.opacity = value;\r
+       } else if ('filter' in el.style) {\r
+               _setOpacityIE(el, value);\r
+       }\r
+}\r
+\r
+function _setOpacityIE(el, value) {\r
+       var filter = false,\r
+           filterName = 'DXImageTransform.Microsoft.Alpha';\r
+\r
+       // filters collection throws an error if we try to retrieve a filter that doesn't exist\r
+       try {\r
+               filter = el.filters.item(filterName);\r
+       } catch (e) {\r
+               // don't set opacity to 1 if we haven't already set an opacity,\r
+               // it isn't needed and breaks transparent pngs.\r
+               if (value === 1) { return; }\r
+       }\r
+\r
+       value = Math.round(value * 100);\r
+\r
+       if (filter) {\r
+               filter.Enabled = (value !== 100);\r
+               filter.Opacity = value;\r
+       } else {\r
+               el.style.filter += ' progid:' + filterName + '(opacity=' + value + ')';\r
+       }\r
+}\r
+\r
+// @function testProp(props: String[]): String|false\r
+// Goes through the array of style names and returns the first name\r
+// that is a valid style name for an element. If no such name is found,\r
+// it returns false. Useful for vendor-prefixed styles like `transform`.\r
+function testProp(props) {\r
+       var style = document.documentElement.style;\r
+\r
+       for (var i = 0; i < props.length; i++) {\r
+               if (props[i] in style) {\r
+                       return props[i];\r
+               }\r
+       }\r
+       return false;\r
+}\r
+\r
+// @function setTransform(el: HTMLElement, offset: Point, scale?: Number)\r
+// Resets the 3D CSS transform of `el` so it is translated by `offset` pixels\r
+// and optionally scaled by `scale`. Does not have an effect if the\r
+// browser doesn't support 3D CSS transforms.\r
+function setTransform(el, offset, scale) {\r
+       var pos = offset || new Point(0, 0);\r
+\r
+       el.style[TRANSFORM] =\r
+               (ie3d ?\r
+                       'translate(' + pos.x + 'px,' + pos.y + 'px)' :\r
+                       'translate3d(' + pos.x + 'px,' + pos.y + 'px,0)') +\r
+               (scale ? ' scale(' + scale + ')' : '');\r
+}\r
+\r
+// @function setPosition(el: HTMLElement, position: Point)\r
+// Sets the position of `el` to coordinates specified by `position`,\r
+// using CSS translate or top/left positioning depending on the browser\r
+// (used by Leaflet internally to position its layers).\r
+function setPosition(el, point) {\r
+\r
+       /*eslint-disable */\r
+       el._leaflet_pos = point;\r
+       /*eslint-enable */\r
+\r
+       if (any3d) {\r
+               setTransform(el, point);\r
+       } else {\r
+               el.style.left = point.x + 'px';\r
+               el.style.top = point.y + 'px';\r
+       }\r
+}\r
+\r
+// @function getPosition(el: HTMLElement): Point\r
+// Returns the coordinates of an element previously positioned with setPosition.\r
+function getPosition(el) {\r
+       // this method is only used for elements previously positioned using setPosition,\r
+       // so it's safe to cache the position for performance\r
+\r
+       return el._leaflet_pos || new Point(0, 0);\r
+}\r
+\r
+// @function disableTextSelection()\r
+// Prevents the user from generating `selectstart` DOM events, usually generated\r
+// when the user drags the mouse through a page with text. Used internally\r
+// by Leaflet to override the behaviour of any click-and-drag interaction on\r
+// the map. Affects drag interactions on the whole document.\r
+\r
+// @function enableTextSelection()\r
+// Cancels the effects of a previous [`L.DomUtil.disableTextSelection`](#domutil-disabletextselection).\r
+var disableTextSelection;\r
+var enableTextSelection;\r
+var _userSelect;\r
+if ('onselectstart' in document) {\r
+       disableTextSelection = function () {\r
+               on(window, 'selectstart', preventDefault);\r
+       };\r
+       enableTextSelection = function () {\r
+               off(window, 'selectstart', preventDefault);\r
+       };\r
+} else {\r
+       var userSelectProperty = testProp(\r
+               ['userSelect', 'WebkitUserSelect', 'OUserSelect', 'MozUserSelect', 'msUserSelect']);\r
+\r
+       disableTextSelection = function () {\r
+               if (userSelectProperty) {\r
+                       var style = document.documentElement.style;\r
+                       _userSelect = style[userSelectProperty];\r
+                       style[userSelectProperty] = 'none';\r
+               }\r
+       };\r
+       enableTextSelection = function () {\r
+               if (userSelectProperty) {\r
+                       document.documentElement.style[userSelectProperty] = _userSelect;\r
+                       _userSelect = undefined;\r
+               }\r
+       };\r
+}\r
+\r
+// @function disableImageDrag()\r
+// As [`L.DomUtil.disableTextSelection`](#domutil-disabletextselection), but\r
+// for `dragstart` DOM events, usually generated when the user drags an image.\r
+function disableImageDrag() {\r
+       on(window, 'dragstart', preventDefault);\r
+}\r
+\r
+// @function enableImageDrag()\r
+// Cancels the effects of a previous [`L.DomUtil.disableImageDrag`](#domutil-disabletextselection).\r
+function enableImageDrag() {\r
+       off(window, 'dragstart', preventDefault);\r
+}\r
+\r
+var _outlineElement;
+var _outlineStyle;\r
+// @function preventOutline(el: HTMLElement)\r
+// Makes the [outline](https://developer.mozilla.org/docs/Web/CSS/outline)\r
+// of the element `el` invisible. Used internally by Leaflet to prevent\r
+// focusable elements from displaying an outline when the user performs a\r
+// drag interaction on them.\r
+function preventOutline(element) {\r
+       while (element.tabIndex === -1) {\r
+               element = element.parentNode;\r
+       }\r
+       if (!element.style) { return; }\r
+       restoreOutline();\r
+       _outlineElement = element;\r
+       _outlineStyle = element.style.outline;\r
+       element.style.outline = 'none';\r
+       on(window, 'keydown', restoreOutline);\r
+}\r
+\r
+// @function restoreOutline()\r
+// Cancels the effects of a previous [`L.DomUtil.preventOutline`]().\r
+function restoreOutline() {\r
+       if (!_outlineElement) { return; }\r
+       _outlineElement.style.outline = _outlineStyle;\r
+       _outlineElement = undefined;\r
+       _outlineStyle = undefined;\r
+       off(window, 'keydown', restoreOutline);\r
+}\r
+
+
+var DomUtil = (Object.freeze || Object)({
+       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
+});
+
+/*
+ * @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);
+       }
+});
+
+/*\r
+ * @class Map\r
+ * @aka L.Map\r
+ * @inherits Evented\r
+ *\r
+ * The central class of the API — it is used to create a map on a page and manipulate it.\r
+ *\r
+ * @example\r
+ *\r
+ * ```js\r
+ * // initialize the map on the "map" div with a given center and zoom\r
+ * var map = L.map('map', {\r
+ *     center: [51.505, -0.09],\r
+ *     zoom: 13\r
+ * });\r
+ * ```\r
+ *\r
+ */\r
+\r
+var Map = Evented.extend({\r
+\r
+       options: {\r
+               // @section Map State Options\r
+               // @option crs: CRS = L.CRS.EPSG3857\r
+               // The [Coordinate Reference System](#crs) to use. Don't change this if you're not\r
+               // sure what it means.\r
+               crs: EPSG3857,\r
+\r
+               // @option center: LatLng = undefined\r
+               // Initial geographic center of the map\r
+               center: undefined,\r
+\r
+               // @option zoom: Number = undefined\r
+               // Initial map zoom level\r
+               zoom: undefined,\r
+\r
+               // @option minZoom: Number = *\r
+               // Minimum zoom level of the map.\r
+               // If not specified and at least one `GridLayer` or `TileLayer` is in the map,\r
+               // the lowest of their `minZoom` options will be used instead.\r
+               minZoom: undefined,\r
+\r
+               // @option maxZoom: Number = *\r
+               // Maximum zoom level of the map.\r
+               // If not specified and at least one `GridLayer` or `TileLayer` is in the map,\r
+               // the highest of their `maxZoom` options will be used instead.\r
+               maxZoom: undefined,\r
+\r
+               // @option layers: Layer[] = []\r
+               // Array of layers that will be added to the map initially\r
+               layers: [],\r
+\r
+               // @option maxBounds: LatLngBounds = null\r
+               // When this option is set, the map restricts the view to the given\r
+               // geographical bounds, bouncing the user back if the user tries to pan\r
+               // outside the view. To set the restriction dynamically, use\r
+               // [`setMaxBounds`](#map-setmaxbounds) method.\r
+               maxBounds: undefined,\r
+\r
+               // @option renderer: Renderer = *\r
+               // The default method for drawing vector layers on the map. `L.SVG`\r
+               // or `L.Canvas` by default depending on browser support.\r
+               renderer: undefined,\r
+\r
+\r
+               // @section Animation Options\r
+               // @option zoomAnimation: Boolean = true\r
+               // Whether the map zoom animation is enabled. By default it's enabled\r
+               // in all browsers that support CSS3 Transitions except Android.\r
+               zoomAnimation: true,\r
+\r
+               // @option zoomAnimationThreshold: Number = 4\r
+               // Won't animate zoom if the zoom difference exceeds this value.\r
+               zoomAnimationThreshold: 4,\r
+\r
+               // @option fadeAnimation: Boolean = true\r
+               // Whether the tile fade animation is enabled. By default it's enabled\r
+               // in all browsers that support CSS3 Transitions except Android.\r
+               fadeAnimation: true,\r
+\r
+               // @option markerZoomAnimation: Boolean = true\r
+               // Whether markers animate their zoom with the zoom animation, if disabled\r
+               // they will disappear for the length of the animation. By default it's\r
+               // enabled in all browsers that support CSS3 Transitions except Android.\r
+               markerZoomAnimation: true,\r
+\r
+               // @option transform3DLimit: Number = 2^23\r
+               // Defines the maximum size of a CSS translation transform. The default\r
+               // value should not be changed unless a web browser positions layers in\r
+               // the wrong place after doing a large `panBy`.\r
+               transform3DLimit: 8388608, // Precision limit of a 32-bit float\r
+\r
+               // @section Interaction Options\r
+               // @option zoomSnap: Number = 1\r
+               // Forces the map's zoom level to always be a multiple of this, particularly\r
+               // right after a [`fitBounds()`](#map-fitbounds) or a pinch-zoom.\r
+               // By default, the zoom level snaps to the nearest integer; lower values\r
+               // (e.g. `0.5` or `0.1`) allow for greater granularity. A value of `0`\r
+               // means the zoom level will not be snapped after `fitBounds` or a pinch-zoom.\r
+               zoomSnap: 1,\r
+\r
+               // @option zoomDelta: Number = 1\r
+               // Controls how much the map's zoom level will change after a\r
+               // [`zoomIn()`](#map-zoomin), [`zoomOut()`](#map-zoomout), pressing `+`\r
+               // or `-` on the keyboard, or using the [zoom controls](#control-zoom).\r
+               // Values smaller than `1` (e.g. `0.5`) allow for greater granularity.\r
+               zoomDelta: 1,\r
+\r
+               // @option trackResize: Boolean = true\r
+               // Whether the map automatically handles browser window resize to update itself.\r
+               trackResize: true\r
+       },\r
+\r
+       initialize: function (id, options) { // (HTMLElement or String, Object)\r
+               options = setOptions(this, options);\r
+\r
+               this._initContainer(id);\r
+               this._initLayout();\r
+\r
+               // hack for https://github.com/Leaflet/Leaflet/issues/1980\r
+               this._onResize = bind(this._onResize, this);\r
+\r
+               this._initEvents();\r
+\r
+               if (options.maxBounds) {\r
+                       this.setMaxBounds(options.maxBounds);\r
+               }\r
+\r
+               if (options.zoom !== undefined) {\r
+                       this._zoom = this._limitZoom(options.zoom);\r
+               }\r
+\r
+               if (options.center && options.zoom !== undefined) {\r
+                       this.setView(toLatLng(options.center), options.zoom, {reset: true});\r
+               }\r
+\r
+               this._handlers = [];\r
+               this._layers = {};\r
+               this._zoomBoundLayers = {};\r
+               this._sizeChanged = true;\r
+\r
+               this.callInitHooks();\r
+\r
+               // don't animate on browsers without hardware-accelerated transitions or old Android/Opera\r
+               this._zoomAnimated = TRANSITION && any3d && !mobileOpera &&\r
+                               this.options.zoomAnimation;\r
+\r
+               // zoom transitions run with the same duration for all layers, so if one of transitionend events\r
+               // happens after starting zoom animation (propagating to the map pane), we know that it ended globally\r
+               if (this._zoomAnimated) {\r
+                       this._createAnimProxy();\r
+                       on(this._proxy, TRANSITION_END, this._catchTransitionEnd, this);\r
+               }\r
+\r
+               this._addLayers(this.options.layers);\r
+       },\r
+\r
+\r
+       // @section Methods for modifying map state\r
+\r
+       // @method setView(center: LatLng, zoom: Number, options?: Zoom/pan options): this\r
+       // Sets the view of the map (geographical center and zoom) with the given\r
+       // animation options.\r
+       setView: function (center, zoom, options) {\r
+\r
+               zoom = zoom === undefined ? this._zoom : this._limitZoom(zoom);\r
+               center = this._limitCenter(toLatLng(center), zoom, this.options.maxBounds);\r
+               options = options || {};\r
+\r
+               this._stop();\r
+\r
+               if (this._loaded && !options.reset && options !== true) {\r
+\r
+                       if (options.animate !== undefined) {\r
+                               options.zoom = extend({animate: options.animate}, options.zoom);\r
+                               options.pan = extend({animate: options.animate, duration: options.duration}, options.pan);\r
+                       }\r
+\r
+                       // try animating pan or zoom\r
+                       var moved = (this._zoom !== zoom) ?\r
+                               this._tryAnimatedZoom && this._tryAnimatedZoom(center, zoom, options.zoom) :\r
+                               this._tryAnimatedPan(center, options.pan);\r
+\r
+                       if (moved) {\r
+                               // prevent resize handler call, the view will refresh after animation anyway\r
+                               clearTimeout(this._sizeTimer);\r
+                               return this;\r
+                       }\r
+               }\r
+\r
+               // animation didn't start, just reset the map view\r
+               this._resetView(center, zoom);\r
+\r
+               return this;\r
+       },\r
+\r
+       // @method setZoom(zoom: Number, options?: Zoom/pan options): this\r
+       // Sets the zoom of the map.\r
+       setZoom: function (zoom, options) {\r
+               if (!this._loaded) {\r
+                       this._zoom = zoom;\r
+                       return this;\r
+               }\r
+               return this.setView(this.getCenter(), zoom, {zoom: options});\r
+       },\r
+\r
+       // @method zoomIn(delta?: Number, options?: Zoom options): this\r
+       // Increases the zoom of the map by `delta` ([`zoomDelta`](#map-zoomdelta) by default).\r
+       zoomIn: function (delta, options) {\r
+               delta = delta || (any3d ? this.options.zoomDelta : 1);\r
+               return this.setZoom(this._zoom + delta, options);\r
+       },\r
+\r
+       // @method zoomOut(delta?: Number, options?: Zoom options): this\r
+       // Decreases the zoom of the map by `delta` ([`zoomDelta`](#map-zoomdelta) by default).\r
+       zoomOut: function (delta, options) {\r
+               delta = delta || (any3d ? this.options.zoomDelta : 1);\r
+               return this.setZoom(this._zoom - delta, options);\r
+       },\r
+\r
+       // @method setZoomAround(latlng: LatLng, zoom: Number, options: Zoom options): this\r
+       // Zooms the map while keeping a specified geographical point on the map\r
+       // stationary (e.g. used internally for scroll zoom and double-click zoom).\r
+       // @alternative\r
+       // @method setZoomAround(offset: Point, zoom: Number, options: Zoom options): this\r
+       // Zooms the map while keeping a specified pixel on the map (relative to the top-left corner) stationary.\r
+       setZoomAround: function (latlng, zoom, options) {\r
+               var scale = this.getZoomScale(zoom),\r
+                   viewHalf = this.getSize().divideBy(2),\r
+                   containerPoint = latlng instanceof Point ? latlng : this.latLngToContainerPoint(latlng),\r
+\r
+                   centerOffset = containerPoint.subtract(viewHalf).multiplyBy(1 - 1 / scale),\r
+                   newCenter = this.containerPointToLatLng(viewHalf.add(centerOffset));\r
+\r
+               return this.setView(newCenter, zoom, {zoom: options});\r
+       },\r
+\r
+       _getBoundsCenterZoom: function (bounds, options) {\r
+\r
+               options = options || {};\r
+               bounds = bounds.getBounds ? bounds.getBounds() : toLatLngBounds(bounds);\r
+\r
+               var paddingTL = toPoint(options.paddingTopLeft || options.padding || [0, 0]),\r
+                   paddingBR = toPoint(options.paddingBottomRight || options.padding || [0, 0]),\r
+\r
+                   zoom = this.getBoundsZoom(bounds, false, paddingTL.add(paddingBR));\r
+\r
+               zoom = (typeof options.maxZoom === 'number') ? Math.min(options.maxZoom, zoom) : zoom;\r
+\r
+               if (zoom === Infinity) {\r
+                       return {\r
+                               center: bounds.getCenter(),\r
+                               zoom: zoom\r
+                       };\r
+               }\r
+\r
+               var paddingOffset = paddingBR.subtract(paddingTL).divideBy(2),\r
+\r
+                   swPoint = this.project(bounds.getSouthWest(), zoom),\r
+                   nePoint = this.project(bounds.getNorthEast(), zoom),\r
+                   center = this.unproject(swPoint.add(nePoint).divideBy(2).add(paddingOffset), zoom);\r
+\r
+               return {\r
+                       center: center,\r
+                       zoom: zoom\r
+               };\r
+       },\r
+\r
+       // @method fitBounds(bounds: LatLngBounds, options?: fitBounds options): this\r
+       // Sets a map view that contains the given geographical bounds with the\r
+       // maximum zoom level possible.\r
+       fitBounds: function (bounds, options) {\r
+\r
+               bounds = toLatLngBounds(bounds);\r
+\r
+               if (!bounds.isValid()) {\r
+                       throw new Error('Bounds are not valid.');\r
+               }\r
+\r
+               var target = this._getBoundsCenterZoom(bounds, options);\r
+               return this.setView(target.center, target.zoom, options);\r
+       },\r
+\r
+       // @method fitWorld(options?: fitBounds options): this\r
+       // Sets a map view that mostly contains the whole world with the maximum\r
+       // zoom level possible.\r
+       fitWorld: function (options) {\r
+               return this.fitBounds([[-90, -180], [90, 180]], options);\r
+       },\r
+\r
+       // @method panTo(latlng: LatLng, options?: Pan options): this\r
+       // Pans the map to a given center.\r
+       panTo: function (center, options) { // (LatLng)\r
+               return this.setView(center, this._zoom, {pan: options});\r
+       },\r
+\r
+       // @method panBy(offset: Point, options?: Pan options): this\r
+       // Pans the map by a given number of pixels (animated).\r
+       panBy: function (offset, options) {\r
+               offset = toPoint(offset).round();\r
+               options = options || {};\r
+\r
+               if (!offset.x && !offset.y) {\r
+                       return this.fire('moveend');\r
+               }\r
+               // If we pan too far, Chrome gets issues with tiles\r
+               // and makes them disappear or appear in the wrong place (slightly offset) #2602\r
+               if (options.animate !== true && !this.getSize().contains(offset)) {\r
+                       this._resetView(this.unproject(this.project(this.getCenter()).add(offset)), this.getZoom());\r
+                       return this;\r
+               }\r
+\r
+               if (!this._panAnim) {\r
+                       this._panAnim = new PosAnimation();\r
+\r
+                       this._panAnim.on({\r
+                               'step': this._onPanTransitionStep,\r
+                               'end': this._onPanTransitionEnd\r
+                       }, this);\r
+               }\r
+\r
+               // don't fire movestart if animating inertia\r
+               if (!options.noMoveStart) {\r
+                       this.fire('movestart');\r
+               }\r
+\r
+               // animate pan unless animate: false specified\r
+               if (options.animate !== false) {\r
+                       addClass(this._mapPane, 'leaflet-pan-anim');\r
+\r
+                       var newPos = this._getMapPanePos().subtract(offset).round();\r
+                       this._panAnim.run(this._mapPane, newPos, options.duration || 0.25, options.easeLinearity);\r
+               } else {\r
+                       this._rawPanBy(offset);\r
+                       this.fire('move').fire('moveend');\r
+               }\r
+\r
+               return this;\r
+       },\r
+\r
+       // @method flyTo(latlng: LatLng, zoom?: Number, options?: Zoom/pan options): this\r
+       // Sets the view of the map (geographical center and zoom) performing a smooth\r
+       // pan-zoom animation.\r
+       flyTo: function (targetCenter, targetZoom, options) {\r
+\r
+               options = options || {};\r
+               if (options.animate === false || !any3d) {\r
+                       return this.setView(targetCenter, targetZoom, options);\r
+               }\r
+\r
+               this._stop();\r
+\r
+               var from = this.project(this.getCenter()),\r
+                   to = this.project(targetCenter),\r
+                   size = this.getSize(),\r
+                   startZoom = this._zoom;\r
+\r
+               targetCenter = toLatLng(targetCenter);\r
+               targetZoom = targetZoom === undefined ? startZoom : targetZoom;\r
+\r
+               var w0 = Math.max(size.x, size.y),\r
+                   w1 = w0 * this.getZoomScale(startZoom, targetZoom),\r
+                   u1 = (to.distanceTo(from)) || 1,\r
+                   rho = 1.42,\r
+                   rho2 = rho * rho;\r
+\r
+               function r(i) {\r
+                       var s1 = i ? -1 : 1,\r
+                           s2 = i ? w1 : w0,\r
+                           t1 = w1 * w1 - w0 * w0 + s1 * rho2 * rho2 * u1 * u1,\r
+                           b1 = 2 * s2 * rho2 * u1,\r
+                           b = t1 / b1,\r
+                           sq = Math.sqrt(b * b + 1) - b;\r
+\r
+                           // workaround for floating point precision bug when sq = 0, log = -Infinite,\r
+                           // thus triggering an infinite loop in flyTo\r
+                           var log = sq < 0.000000001 ? -18 : Math.log(sq);\r
+\r
+                       return log;\r
+               }\r
+\r
+               function sinh(n) { return (Math.exp(n) - Math.exp(-n)) / 2; }\r
+               function cosh(n) { return (Math.exp(n) + Math.exp(-n)) / 2; }\r
+               function tanh(n) { return sinh(n) / cosh(n); }\r
+\r
+               var r0 = r(0);\r
+\r
+               function w(s) { return w0 * (cosh(r0) / cosh(r0 + rho * s)); }\r
+               function u(s) { return w0 * (cosh(r0) * tanh(r0 + rho * s) - sinh(r0)) / rho2; }\r
+\r
+               function easeOut(t) { return 1 - Math.pow(1 - t, 1.5); }\r
+\r
+               var start = Date.now(),\r
+                   S = (r(1) - r0) / rho,\r
+                   duration = options.duration ? 1000 * options.duration : 1000 * S * 0.8;\r
+\r
+               function frame() {\r
+                       var t = (Date.now() - start) / duration,\r
+                           s = easeOut(t) * S;\r
+\r
+                       if (t <= 1) {\r
+                               this._flyToFrame = requestAnimFrame(frame, this);\r
+\r
+                               this._move(\r
+                                       this.unproject(from.add(to.subtract(from).multiplyBy(u(s) / u1)), startZoom),\r
+                                       this.getScaleZoom(w0 / w(s), startZoom),\r
+                                       {flyTo: true});\r
+\r
+                       } else {\r
+                               this\r
+                                       ._move(targetCenter, targetZoom)\r
+                                       ._moveEnd(true);\r
+                       }\r
+               }\r
+\r
+               this._moveStart(true);\r
+\r
+               frame.call(this);\r
+               return this;\r
+       },\r
+\r
+       // @method flyToBounds(bounds: LatLngBounds, options?: fitBounds options): this\r
+       // Sets the view of the map with a smooth animation like [`flyTo`](#map-flyto),\r
+       // but takes a bounds parameter like [`fitBounds`](#map-fitbounds).\r
+       flyToBounds: function (bounds, options) {\r
+               var target = this._getBoundsCenterZoom(bounds, options);\r
+               return this.flyTo(target.center, target.zoom, options);\r
+       },\r
+\r
+       // @method setMaxBounds(bounds: Bounds): this\r
+       // Restricts the map view to the given bounds (see the [maxBounds](#map-maxbounds) option).\r
+       setMaxBounds: function (bounds) {\r
+               bounds = toLatLngBounds(bounds);\r
+\r
+               if (!bounds.isValid()) {\r
+                       this.options.maxBounds = null;\r
+                       return this.off('moveend', this._panInsideMaxBounds);\r
+               } else if (this.options.maxBounds) {\r
+                       this.off('moveend', this._panInsideMaxBounds);\r
+               }\r
+\r
+               this.options.maxBounds = bounds;\r
+\r
+               if (this._loaded) {\r
+                       this._panInsideMaxBounds();\r
+               }\r
+\r
+               return this.on('moveend', this._panInsideMaxBounds);\r
+       },\r
+\r
+       // @method setMinZoom(zoom: Number): this\r
+       // Sets the lower limit for the available zoom levels (see the [minZoom](#map-minzoom) option).\r
+       setMinZoom: function (zoom) {\r
+               this.options.minZoom = zoom;\r
+\r
+               if (this._loaded && this.getZoom() < this.options.minZoom) {\r
+                       return this.setZoom(zoom);\r
+               }\r
+\r
+               return this;\r
+       },\r
+\r
+       // @method setMaxZoom(zoom: Number): this\r
+       // Sets the upper limit for the available zoom levels (see the [maxZoom](#map-maxzoom) option).\r
+       setMaxZoom: function (zoom) {\r
+               this.options.maxZoom = zoom;\r
+\r
+               if (this._loaded && (this.getZoom() > this.options.maxZoom)) {\r
+                       return this.setZoom(zoom);\r
+               }\r
+\r
+               return this;\r
+       },\r
+\r
+       // @method panInsideBounds(bounds: LatLngBounds, options?: Pan options): this\r
+       // 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.\r
+       panInsideBounds: function (bounds, options) {\r
+               this._enforcingBounds = true;\r
+               var center = this.getCenter(),\r
+                   newCenter = this._limitCenter(center, this._zoom, toLatLngBounds(bounds));\r
+\r
+               if (!center.equals(newCenter)) {\r
+                       this.panTo(newCenter, options);\r
+               }\r
+\r
+               this._enforcingBounds = false;\r
+               return this;\r
+       },\r
+\r
+       // @method invalidateSize(options: Zoom/Pan options): this\r
+       // Checks if the map container size changed and updates the map if so —\r
+       // call it after you've changed the map size dynamically, also animating\r
+       // pan by default. If `options.pan` is `false`, panning will not occur.\r
+       // If `options.debounceMoveend` is `true`, it will delay `moveend` event so\r
+       // that it doesn't happen often even if the method is called many\r
+       // times in a row.\r
+\r
+       // @alternative\r
+       // @method invalidateSize(animate: Boolean): this\r
+       // Checks if the map container size changed and updates the map if so —\r
+       // call it after you've changed the map size dynamically, also animating\r
+       // pan by default.\r
+       invalidateSize: function (options) {\r
+               if (!this._loaded) { return this; }\r
+\r
+               options = extend({\r
+                       animate: false,\r
+                       pan: true\r
+               }, options === true ? {animate: true} : options);\r
+\r
+               var oldSize = this.getSize();\r
+               this._sizeChanged = true;\r
+               this._lastCenter = null;\r
+\r
+               var newSize = this.getSize(),\r
+                   oldCenter = oldSize.divideBy(2).round(),\r
+                   newCenter = newSize.divideBy(2).round(),\r
+                   offset = oldCenter.subtract(newCenter);\r
+\r
+               if (!offset.x && !offset.y) { return this; }\r
+\r
+               if (options.animate && options.pan) {\r
+                       this.panBy(offset);\r
+\r
+               } else {\r
+                       if (options.pan) {\r
+                               this._rawPanBy(offset);\r
+                       }\r
+\r
+                       this.fire('move');\r
+\r
+                       if (options.debounceMoveend) {\r
+                               clearTimeout(this._sizeTimer);\r
+                               this._sizeTimer = setTimeout(bind(this.fire, this, 'moveend'), 200);\r
+                       } else {\r
+                               this.fire('moveend');\r
+                       }\r
+               }\r
+\r
+               // @section Map state change events\r
+               // @event resize: ResizeEvent\r
+               // Fired when the map is resized.\r
+               return this.fire('resize', {\r
+                       oldSize: oldSize,\r
+                       newSize: newSize\r
+               });\r
+       },\r
+\r
+       // @section Methods for modifying map state\r
+       // @method stop(): this\r
+       // Stops the currently running `panTo` or `flyTo` animation, if any.\r
+       stop: function () {\r
+               this.setZoom(this._limitZoom(this._zoom));\r
+               if (!this.options.zoomSnap) {\r
+                       this.fire('viewreset');\r
+               }\r
+               return this._stop();\r
+       },\r
+\r
+       // @section Geolocation methods\r
+       // @method locate(options?: Locate options): this\r
+       // Tries to locate the user using the Geolocation API, firing a [`locationfound`](#map-locationfound)\r
+       // event with location data on success or a [`locationerror`](#map-locationerror) event on failure,\r
+       // and optionally sets the map view to the user's location with respect to\r
+       // detection accuracy (or to the world view if geolocation failed).\r
+       // Note that, if your page doesn't use HTTPS, this method will fail in\r
+       // modern browsers ([Chrome 50 and newer](https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-powerful-features-on-insecure-origins))\r
+       // See `Locate options` for more details.\r
+       locate: function (options) {\r
+\r
+               options = this._locateOptions = extend({\r
+                       timeout: 10000,\r
+                       watch: false\r
+                       // setView: false\r
+                       // maxZoom: <Number>\r
+                       // maximumAge: 0\r
+                       // enableHighAccuracy: false\r
+               }, options);\r
+\r
+               if (!('geolocation' in navigator)) {\r
+                       this._handleGeolocationError({\r
+                               code: 0,\r
+                               message: 'Geolocation not supported.'\r
+                       });\r
+                       return this;\r
+               }\r
+\r
+               var onResponse = bind(this._handleGeolocationResponse, this),\r
+                   onError = bind(this._handleGeolocationError, this);\r
+\r
+               if (options.watch) {\r
+                       this._locationWatchId =\r
+                               navigator.geolocation.watchPosition(onResponse, onError, options);\r
+               } else {\r
+                       navigator.geolocation.getCurrentPosition(onResponse, onError, options);\r
+               }\r
+               return this;\r
+       },\r
+\r
+       // @method stopLocate(): this\r
+       // Stops watching location previously initiated by `map.locate({watch: true})`\r
+       // and aborts resetting the map view if map.locate was called with\r
+       // `{setView: true}`.\r
+       stopLocate: function () {\r
+               if (navigator.geolocation && navigator.geolocation.clearWatch) {\r
+                       navigator.geolocation.clearWatch(this._locationWatchId);\r
+               }\r
+               if (this._locateOptions) {\r
+                       this._locateOptions.setView = false;\r
+               }\r
+               return this;\r
+       },\r
+\r
+       _handleGeolocationError: function (error) {\r
+               var c = error.code,\r
+                   message = error.message ||\r
+                           (c === 1 ? 'permission denied' :\r
+                           (c === 2 ? 'position unavailable' : 'timeout'));\r
+\r
+               if (this._locateOptions.setView && !this._loaded) {\r
+                       this.fitWorld();\r
+               }\r
+\r
+               // @section Location events\r
+               // @event locationerror: ErrorEvent\r
+               // Fired when geolocation (using the [`locate`](#map-locate) method) failed.\r
+               this.fire('locationerror', {\r
+                       code: c,\r
+                       message: 'Geolocation error: ' + message + '.'\r
+               });\r
+       },\r
+\r
+       _handleGeolocationResponse: function (pos) {\r
+               var lat = pos.coords.latitude,\r
+                   lng = pos.coords.longitude,\r
+                   latlng = new LatLng(lat, lng),\r
+                   bounds = latlng.toBounds(pos.coords.accuracy),\r
+                   options = this._locateOptions;\r
+\r
+               if (options.setView) {\r
+                       var zoom = this.getBoundsZoom(bounds);\r
+                       this.setView(latlng, options.maxZoom ? Math.min(zoom, options.maxZoom) : zoom);\r
+               }\r
+\r
+               var data = {\r
+                       latlng: latlng,\r
+                       bounds: bounds,\r
+                       timestamp: pos.timestamp\r
+               };\r
+\r
+               for (var i in pos.coords) {\r
+                       if (typeof pos.coords[i] === 'number') {\r
+                               data[i] = pos.coords[i];\r
+                       }\r
+               }\r
+\r
+               // @event locationfound: LocationEvent\r
+               // Fired when geolocation (using the [`locate`](#map-locate) method)\r
+               // went successfully.\r
+               this.fire('locationfound', data);\r
+       },\r
+\r
+       // TODO handler.addTo\r
+       // TODO Appropiate docs section?\r
+       // @section Other Methods\r
+       // @method addHandler(name: String, HandlerClass: Function): this\r
+       // Adds a new `Handler` to the map, given its name and constructor function.\r
+       addHandler: function (name, HandlerClass) {\r
+               if (!HandlerClass) { return this; }\r
+\r
+               var handler = this[name] = new HandlerClass(this);\r
+\r
+               this._handlers.push(handler);\r
+\r
+               if (this.options[name]) {\r
+                       handler.enable();\r
+               }\r
+\r
+               return this;\r
+       },\r
+\r
+       // @method remove(): this\r
+       // Destroys the map and clears all related event listeners.\r
+       remove: function () {\r
+\r
+               this._initEvents(true);\r
+\r
+               if (this._containerId !== this._container._leaflet_id) {\r
+                       throw new Error('Map container is being reused by another instance');\r
+               }\r
+\r
+               try {\r
+                       // throws error in IE6-8\r
+                       delete this._container._leaflet_id;\r
+                       delete this._containerId;\r
+               } catch (e) {\r
+                       /*eslint-disable */\r
+                       this._container._leaflet_id = undefined;\r
+                       /*eslint-enable */\r
+                       this._containerId = undefined;\r
+               }\r
+\r
+               remove(this._mapPane);\r
+\r
+               if (this._clearControlPos) {\r
+                       this._clearControlPos();\r
+               }\r
+\r
+               this._clearHandlers();\r
+\r
+               if (this._loaded) {\r
+                       // @section Map state change events\r
+                       // @event unload: Event\r
+                       // Fired when the map is destroyed with [remove](#map-remove) method.\r
+                       this.fire('unload');\r
+               }\r
+\r
+               var i;\r
+               for (i in this._layers) {\r
+                       this._layers[i].remove();\r
+               }\r
+               for (i in this._panes) {\r
+                       remove(this._panes[i]);\r
+               }\r
+\r
+               this._layers = [];\r
+               this._panes = [];\r
+               delete this._mapPane;\r
+               delete this._renderer;\r
+\r
+               return this;\r
+       },\r
+\r
+       // @section Other Methods\r
+       // @method createPane(name: String, container?: HTMLElement): HTMLElement\r
+       // Creates a new [map pane](#map-pane) with the given name if it doesn't exist already,\r
+       // then returns it. The pane is created as a child of `container`, or\r
+       // as a child of the main map pane if not set.\r
+       createPane: function (name, container) {\r
+               var className = 'leaflet-pane' + (name ? ' leaflet-' + name.replace('Pane', '') + '-pane' : ''),\r
+                   pane = create$1('div', className, container || this._mapPane);\r
+\r
+               if (name) {\r
+                       this._panes[name] = pane;\r
+               }\r
+               return pane;\r
+       },\r
+\r
+       // @section Methods for Getting Map State\r
+\r
+       // @method getCenter(): LatLng\r
+       // Returns the geographical center of the map view\r
+       getCenter: function () {\r
+               this._checkIfLoaded();\r
+\r
+               if (this._lastCenter && !this._moved()) {\r
+                       return this._lastCenter;\r
+               }\r
+               return this.layerPointToLatLng(this._getCenterLayerPoint());\r
+       },\r
+\r
+       // @method getZoom(): Number\r
+       // Returns the current zoom level of the map view\r
+       getZoom: function () {\r
+               return this._zoom;\r
+       },\r
+\r
+       // @method getBounds(): LatLngBounds\r
+       // Returns the geographical bounds visible in the current map view\r
+       getBounds: function () {\r
+               var bounds = this.getPixelBounds(),\r
+                   sw = this.unproject(bounds.getBottomLeft()),\r
+                   ne = this.unproject(bounds.getTopRight());\r
+\r
+               return new LatLngBounds(sw, ne);\r
+       },\r
+\r
+       // @method getMinZoom(): Number\r
+       // 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.\r
+       getMinZoom: function () {\r
+               return this.options.minZoom === undefined ? this._layersMinZoom || 0 : this.options.minZoom;\r
+       },\r
+\r
+       // @method getMaxZoom(): Number\r
+       // Returns the maximum zoom level of the map (if set in the `maxZoom` option of the map or of any layers).\r
+       getMaxZoom: function () {\r
+               return this.options.maxZoom === undefined ?\r
+                       (this._layersMaxZoom === undefined ? Infinity : this._layersMaxZoom) :\r
+                       this.options.maxZoom;\r
+       },\r
+\r
+       // @method getBoundsZoom(bounds: LatLngBounds, inside?: Boolean): Number\r
+       // Returns the maximum zoom level on which the given bounds fit to the map\r
+       // view in its entirety. If `inside` (optional) is set to `true`, the method\r
+       // instead returns the minimum zoom level on which the map view fits into\r
+       // the given bounds in its entirety.\r
+       getBoundsZoom: function (bounds, inside, padding) { // (LatLngBounds[, Boolean, Point]) -> Number\r
+               bounds = toLatLngBounds(bounds);\r
+               padding = toPoint(padding || [0, 0]);\r
+\r
+               var zoom = this.getZoom() || 0,\r
+                   min = this.getMinZoom(),\r
+                   max = this.getMaxZoom(),\r
+                   nw = bounds.getNorthWest(),\r
+                   se = bounds.getSouthEast(),\r
+                   size = this.getSize().subtract(padding),\r
+                   boundsSize = toBounds(this.project(se, zoom), this.project(nw, zoom)).getSize(),\r
+                   snap = any3d ? this.options.zoomSnap : 1,\r
+                   scalex = size.x / boundsSize.x,\r
+                   scaley = size.y / boundsSize.y,\r
+                   scale = inside ? Math.max(scalex, scaley) : Math.min(scalex, scaley);\r
+\r
+               zoom = this.getScaleZoom(scale, zoom);\r
+\r
+               if (snap) {\r
+                       zoom = Math.round(zoom / (snap / 100)) * (snap / 100); // don't jump if within 1% of a snap level\r
+                       zoom = inside ? Math.ceil(zoom / snap) * snap : Math.floor(zoom / snap) * snap;\r
+               }\r
+\r
+               return Math.max(min, Math.min(max, zoom));\r
+       },\r
+\r
+       // @method getSize(): Point\r
+       // Returns the current size of the map container (in pixels).\r
+       getSize: function () {\r
+               if (!this._size || this._sizeChanged) {\r
+                       this._size = new Point(\r
+                               this._container.clientWidth || 0,\r
+                               this._container.clientHeight || 0);\r
+\r
+                       this._sizeChanged = false;\r
+               }\r
+               return this._size.clone();\r
+       },\r
+\r
+       // @method getPixelBounds(): Bounds\r
+       // Returns the bounds of the current map view in projected pixel\r
+       // coordinates (sometimes useful in layer and overlay implementations).\r
+       getPixelBounds: function (center, zoom) {\r
+               var topLeftPoint = this._getTopLeftPoint(center, zoom);\r
+               return new Bounds(topLeftPoint, topLeftPoint.add(this.getSize()));\r
+       },\r
+\r
+       // TODO: Check semantics - isn't the pixel origin the 0,0 coord relative to\r
+       // the map pane? "left point of the map layer" can be confusing, specially\r
+       // since there can be negative offsets.\r
+       // @method getPixelOrigin(): Point\r
+       // Returns the projected pixel coordinates of the top left point of\r
+       // the map layer (useful in custom layer and overlay implementations).\r
+       getPixelOrigin: function () {\r
+               this._checkIfLoaded();\r
+               return this._pixelOrigin;\r
+       },\r
+\r
+       // @method getPixelWorldBounds(zoom?: Number): Bounds\r
+       // Returns the world's bounds in pixel coordinates for zoom level `zoom`.\r
+       // If `zoom` is omitted, the map's current zoom level is used.\r
+       getPixelWorldBounds: function (zoom) {\r
+               return this.options.crs.getProjectedBounds(zoom === undefined ? this.getZoom() : zoom);\r
+       },\r
+\r
+       // @section Other Methods\r
+\r
+       // @method getPane(pane: String|HTMLElement): HTMLElement\r
+       // Returns a [map pane](#map-pane), given its name or its HTML element (its identity).\r
+       getPane: function (pane) {\r
+               return typeof pane === 'string' ? this._panes[pane] : pane;\r
+       },\r
+\r
+       // @method getPanes(): Object\r
+       // Returns a plain object containing the names of all [panes](#map-pane) as keys and\r
+       // the panes as values.\r
+       getPanes: function () {\r
+               return this._panes;\r
+       },\r
+\r
+       // @method getContainer: HTMLElement\r
+       // Returns the HTML element that contains the map.\r
+       getContainer: function () {\r
+               return this._container;\r
+       },\r
+\r
+\r
+       // @section Conversion Methods\r
+\r
+       // @method getZoomScale(toZoom: Number, fromZoom: Number): Number\r
+       // Returns the scale factor to be applied to a map transition from zoom level\r
+       // `fromZoom` to `toZoom`. Used internally to help with zoom animations.\r
+       getZoomScale: function (toZoom, fromZoom) {\r
+               // TODO replace with universal implementation after refactoring projections\r
+               var crs = this.options.crs;\r
+               fromZoom = fromZoom === undefined ? this._zoom : fromZoom;\r
+               return crs.scale(toZoom) / crs.scale(fromZoom);\r
+       },\r
+\r
+       // @method getScaleZoom(scale: Number, fromZoom: Number): Number\r
+       // Returns the zoom level that the map would end up at, if it is at `fromZoom`\r
+       // level and everything is scaled by a factor of `scale`. Inverse of\r
+       // [`getZoomScale`](#map-getZoomScale).\r
+       getScaleZoom: function (scale, fromZoom) {\r
+               var crs = this.options.crs;\r
+               fromZoom = fromZoom === undefined ? this._zoom : fromZoom;\r
+               var zoom = crs.zoom(scale * crs.scale(fromZoom));\r
+               return isNaN(zoom) ? Infinity : zoom;\r
+       },\r
+\r
+       // @method project(latlng: LatLng, zoom: Number): Point\r
+       // Projects a geographical coordinate `LatLng` according to the projection\r
+       // of the map's CRS, then scales it according to `zoom` and the CRS's\r
+       // `Transformation`. The result is pixel coordinate relative to\r
+       // the CRS origin.\r
+       project: function (latlng, zoom) {\r
+               zoom = zoom === undefined ? this._zoom : zoom;\r
+               return this.options.crs.latLngToPoint(toLatLng(latlng), zoom);\r
+       },\r
+\r
+       // @method unproject(point: Point, zoom: Number): LatLng\r
+       // Inverse of [`project`](#map-project).\r
+       unproject: function (point, zoom) {\r
+               zoom = zoom === undefined ? this._zoom : zoom;\r
+               return this.options.crs.pointToLatLng(toPoint(point), zoom);\r
+       },\r
+\r
+       // @method layerPointToLatLng(point: Point): LatLng\r
+       // Given a pixel coordinate relative to the [origin pixel](#map-getpixelorigin),\r
+       // returns the corresponding geographical coordinate (for the current zoom level).\r
+       layerPointToLatLng: function (point) {\r
+               var projectedPoint = toPoint(point).add(this.getPixelOrigin());\r
+               return this.unproject(projectedPoint);\r
+       },\r
+\r
+       // @method latLngToLayerPoint(latlng: LatLng): Point\r
+       // Given a geographical coordinate, returns the corresponding pixel coordinate\r
+       // relative to the [origin pixel](#map-getpixelorigin).\r
+       latLngToLayerPoint: function (latlng) {\r
+               var projectedPoint = this.project(toLatLng(latlng))._round();\r
+               return projectedPoint._subtract(this.getPixelOrigin());\r
+       },\r
+\r
+       // @method wrapLatLng(latlng: LatLng): LatLng\r
+       // Returns a `LatLng` where `lat` and `lng` has been wrapped according to the\r
+       // map's CRS's `wrapLat` and `wrapLng` properties, if they are outside the\r
+       // CRS's bounds.\r
+       // By default this means longitude is wrapped around the dateline so its\r
+       // value is between -180 and +180 degrees.\r
+       wrapLatLng: function (latlng) {\r
+               return this.options.crs.wrapLatLng(toLatLng(latlng));\r
+       },\r
+\r
+       // @method wrapLatLngBounds(bounds: LatLngBounds): LatLngBounds\r
+       // Returns a `LatLngBounds` with the same size as the given one, ensuring that\r
+       // its center is within the CRS's bounds.\r
+       // By default this means the center longitude is wrapped around the dateline so its\r
+       // value is between -180 and +180 degrees, and the majority of the bounds\r
+       // overlaps the CRS's bounds.\r
+       wrapLatLngBounds: function (latlng) {\r
+               return this.options.crs.wrapLatLngBounds(toLatLngBounds(latlng));\r
+       },\r
+\r
+       // @method distance(latlng1: LatLng, latlng2: LatLng): Number\r
+       // Returns the distance between two geographical coordinates according to\r
+       // the map's CRS. By default this measures distance in meters.\r
+       distance: function (latlng1, latlng2) {\r
+               return this.options.crs.distance(toLatLng(latlng1), toLatLng(latlng2));\r
+       },\r
+\r
+       // @method containerPointToLayerPoint(point: Point): Point\r
+       // Given a pixel coordinate relative to the map container, returns the corresponding\r
+       // pixel coordinate relative to the [origin pixel](#map-getpixelorigin).\r
+       containerPointToLayerPoint: function (point) { // (Point)\r
+               return toPoint(point).subtract(this._getMapPanePos());\r
+       },\r
+\r
+       // @method layerPointToContainerPoint(point: Point): Point\r
+       // Given a pixel coordinate relative to the [origin pixel](#map-getpixelorigin),\r
+       // returns the corresponding pixel coordinate relative to the map container.\r
+       layerPointToContainerPoint: function (point) { // (Point)\r
+               return toPoint(point).add(this._getMapPanePos());\r
+       },\r
+\r
+       // @method containerPointToLatLng(point: Point): LatLng\r
+       // Given a pixel coordinate relative to the map container, returns\r
+       // the corresponding geographical coordinate (for the current zoom level).\r
+       containerPointToLatLng: function (point) {\r
+               var layerPoint = this.containerPointToLayerPoint(toPoint(point));\r
+               return this.layerPointToLatLng(layerPoint);\r
+       },\r
+\r
+       // @method latLngToContainerPoint(latlng: LatLng): Point\r
+       // Given a geographical coordinate, returns the corresponding pixel coordinate\r
+       // relative to the map container.\r
+       latLngToContainerPoint: function (latlng) {\r
+               return this.layerPointToContainerPoint(this.latLngToLayerPoint(toLatLng(latlng)));\r
+       },\r
+\r
+       // @method mouseEventToContainerPoint(ev: MouseEvent): Point\r
+       // Given a MouseEvent object, returns the pixel coordinate relative to the\r
+       // map container where the event took place.\r
+       mouseEventToContainerPoint: function (e) {\r
+               return getMousePosition(e, this._container);\r
+       },\r
+\r
+       // @method mouseEventToLayerPoint(ev: MouseEvent): Point\r
+       // Given a MouseEvent object, returns the pixel coordinate relative to\r
+       // the [origin pixel](#map-getpixelorigin) where the event took place.\r
+       mouseEventToLayerPoint: function (e) {\r
+               return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(e));\r
+       },\r
+\r
+       // @method mouseEventToLatLng(ev: MouseEvent): LatLng\r
+       // Given a MouseEvent object, returns geographical coordinate where the\r
+       // event took place.\r
+       mouseEventToLatLng: function (e) { // (MouseEvent)\r
+               return this.layerPointToLatLng(this.mouseEventToLayerPoint(e));\r
+       },\r
+\r
+\r
+       // map initialization methods\r
+\r
+       _initContainer: function (id) {\r
+               var container = this._container = get(id);\r
+\r
+               if (!container) {\r
+                       throw new Error('Map container not found.');\r
+               } else if (container._leaflet_id) {\r
+                       throw new Error('Map container is already initialized.');\r
+               }\r
+\r
+               on(container, 'scroll', this._onScroll, this);\r
+               this._containerId = stamp(container);\r
+       },\r
+\r
+       _initLayout: function () {\r
+               var container = this._container;\r
+\r
+               this._fadeAnimated = this.options.fadeAnimation && any3d;\r
+\r
+               addClass(container, 'leaflet-container' +\r
+                       (touch ? ' leaflet-touch' : '') +\r
+                       (retina ? ' leaflet-retina' : '') +\r
+                       (ielt9 ? ' leaflet-oldie' : '') +\r
+                       (safari ? ' leaflet-safari' : '') +\r
+                       (this._fadeAnimated ? ' leaflet-fade-anim' : ''));\r
+\r
+               var position = getStyle(container, 'position');\r
+\r
+               if (position !== 'absolute' && position !== 'relative' && position !== 'fixed') {\r
+                       container.style.position = 'relative';\r
+               }\r
+\r
+               this._initPanes();\r
+\r
+               if (this._initControlPos) {\r
+                       this._initControlPos();\r
+               }\r
+       },\r
+\r
+       _initPanes: function () {\r
+               var panes = this._panes = {};\r
+               this._paneRenderers = {};\r
+\r
+               // @section\r
+               //\r
+               // Panes are DOM elements used to control the ordering of layers on the map. You\r
+               // can access panes with [`map.getPane`](#map-getpane) or\r
+               // [`map.getPanes`](#map-getpanes) methods. New panes can be created with the\r
+               // [`map.createPane`](#map-createpane) method.\r
+               //\r
+               // Every map has the following default panes that differ only in zIndex.\r
+               //\r
+               // @pane mapPane: HTMLElement = 'auto'\r
+               // Pane that contains all other map panes\r
+\r
+               this._mapPane = this.createPane('mapPane', this._container);\r
+               setPosition(this._mapPane, new Point(0, 0));\r
+\r
+               // @pane tilePane: HTMLElement = 200\r
+               // Pane for `GridLayer`s and `TileLayer`s\r
+               this.createPane('tilePane');\r
+               // @pane overlayPane: HTMLElement = 400\r
+               // Pane for vector overlays (`Path`s), like `Polyline`s and `Polygon`s\r
+               this.createPane('shadowPane');\r
+               // @pane shadowPane: HTMLElement = 500\r
+               // Pane for overlay shadows (e.g. `Marker` shadows)\r
+               this.createPane('overlayPane');\r
+               // @pane markerPane: HTMLElement = 600\r
+               // Pane for `Icon`s of `Marker`s\r
+               this.createPane('markerPane');\r
+               // @pane tooltipPane: HTMLElement = 650\r
+               // Pane for tooltip.\r
+               this.createPane('tooltipPane');\r
+               // @pane popupPane: HTMLElement = 700\r
+               // Pane for `Popup`s.\r
+               this.createPane('popupPane');\r
+\r
+               if (!this.options.markerZoomAnimation) {\r
+                       addClass(panes.markerPane, 'leaflet-zoom-hide');\r
+                       addClass(panes.shadowPane, 'leaflet-zoom-hide');\r
+               }\r
+       },\r
+\r
+\r
+       // private methods that modify map state\r
+\r
+       // @section Map state change events\r
+       _resetView: function (center, zoom) {\r
+               setPosition(this._mapPane, new Point(0, 0));\r
+\r
+               var loading = !this._loaded;\r
+               this._loaded = true;\r
+               zoom = this._limitZoom(zoom);\r
+\r
+               this.fire('viewprereset');\r
+\r
+               var zoomChanged = this._zoom !== zoom;\r
+               this\r
+                       ._moveStart(zoomChanged)\r
+                       ._move(center, zoom)\r
+                       ._moveEnd(zoomChanged);\r
+\r
+               // @event viewreset: Event\r
+               // Fired when the map needs to redraw its content (this usually happens\r
+               // on map zoom or load). Very useful for creating custom overlays.\r
+               this.fire('viewreset');\r
+\r
+               // @event load: Event\r
+               // Fired when the map is initialized (when its center and zoom are set\r
+               // for the first time).\r
+               if (loading) {\r
+                       this.fire('load');\r
+               }\r
+       },\r
+\r
+       _moveStart: function (zoomChanged) {\r
+               // @event zoomstart: Event\r
+               // Fired when the map zoom is about to change (e.g. before zoom animation).\r
+               // @event movestart: Event\r
+               // Fired when the view of the map starts changing (e.g. user starts dragging the map).\r
+               if (zoomChanged) {\r
+                       this.fire('zoomstart');\r
+               }\r
+               return this.fire('movestart');\r
+       },\r
+\r
+       _move: function (center, zoom, data) {\r
+               if (zoom === undefined) {\r
+                       zoom = this._zoom;\r
+               }\r
+               var zoomChanged = this._zoom !== zoom;\r
+\r
+               this._zoom = zoom;\r
+               this._lastCenter = center;\r
+               this._pixelOrigin = this._getNewPixelOrigin(center);\r
+\r
+               // @event zoom: Event\r
+               // Fired repeatedly during any change in zoom level, including zoom\r
+               // and fly animations.\r
+               if (zoomChanged || (data && data.pinch)) {      // Always fire 'zoom' if pinching because #3530\r
+                       this.fire('zoom', data);\r
+               }\r
+\r
+               // @event move: Event\r
+               // Fired repeatedly during any movement of the map, including pan and\r
+               // fly animations.\r
+               return this.fire('move', data);\r
+       },\r
+\r
+       _moveEnd: function (zoomChanged) {\r
+               // @event zoomend: Event\r
+               // Fired when the map has changed, after any animations.\r
+               if (zoomChanged) {\r
+                       this.fire('zoomend');\r
+               }\r
+\r
+               // @event moveend: Event\r
+               // Fired when the center of the map stops changing (e.g. user stopped\r
+               // dragging the map).\r
+               return this.fire('moveend');\r
+       },\r
+\r
+       _stop: function () {\r
+               cancelAnimFrame(this._flyToFrame);\r
+               if (this._panAnim) {\r
+                       this._panAnim.stop();\r
+               }\r
+               return this;\r
+       },\r
+\r
+       _rawPanBy: function (offset) {\r
+               setPosition(this._mapPane, this._getMapPanePos().subtract(offset));\r
+       },\r
+\r
+       _getZoomSpan: function () {\r
+               return this.getMaxZoom() - this.getMinZoom();\r
+       },\r
+\r
+       _panInsideMaxBounds: function () {\r
+               if (!this._enforcingBounds) {\r
+                       this.panInsideBounds(this.options.maxBounds);\r
+               }\r
+       },\r
+\r
+       _checkIfLoaded: function () {\r
+               if (!this._loaded) {\r
+                       throw new Error('Set map center and zoom first.');\r
+               }\r
+       },\r
+\r
+       // DOM event handling\r
+\r
+       // @section Interaction events\r
+       _initEvents: function (remove$$1) {\r
+               this._targets = {};\r
+               this._targets[stamp(this._container)] = this;\r
+\r
+               var onOff = remove$$1 ? off : on;\r
+\r
+               // @event click: MouseEvent\r
+               // Fired when the user clicks (or taps) the map.\r
+               // @event dblclick: MouseEvent\r
+               // Fired when the user double-clicks (or double-taps) the map.\r
+               // @event mousedown: MouseEvent\r
+               // Fired when the user pushes the mouse button on the map.\r
+               // @event mouseup: MouseEvent\r
+               // Fired when the user releases the mouse button on the map.\r
+               // @event mouseover: MouseEvent\r
+               // Fired when the mouse enters the map.\r
+               // @event mouseout: MouseEvent\r
+               // Fired when the mouse leaves the map.\r
+               // @event mousemove: MouseEvent\r
+               // Fired while the mouse moves over the map.\r
+               // @event contextmenu: MouseEvent\r
+               // Fired when the user pushes the right mouse button on the map, prevents\r
+               // default browser context menu from showing if there are listeners on\r
+               // this event. Also fired on mobile when the user holds a single touch\r
+               // for a second (also called long press).\r
+               // @event keypress: KeyboardEvent\r
+               // Fired when the user presses a key from the keyboard while the map is focused.\r
+               onOff(this._container, 'click dblclick mousedown mouseup ' +\r
+                       'mouseover mouseout mousemove contextmenu keypress', this._handleDOMEvent, this);\r
+\r
+               if (this.options.trackResize) {\r
+                       onOff(window, 'resize', this._onResize, this);\r
+               }\r
+\r
+               if (any3d && this.options.transform3DLimit) {\r
+                       (remove$$1 ? this.off : this.on).call(this, 'moveend', this._onMoveEnd);\r
+               }\r
+       },\r
+\r
+       _onResize: function () {\r
+               cancelAnimFrame(this._resizeRequest);\r
+               this._resizeRequest = requestAnimFrame(\r
+                       function () { this.invalidateSize({debounceMoveend: true}); }, this);\r
+       },\r
+\r
+       _onScroll: function () {\r
+               this._container.scrollTop  = 0;\r
+               this._container.scrollLeft = 0;\r
+       },\r
+\r
+       _onMoveEnd: function () {\r
+               var pos = this._getMapPanePos();\r
+               if (Math.max(Math.abs(pos.x), Math.abs(pos.y)) >= this.options.transform3DLimit) {\r
+                       // https://bugzilla.mozilla.org/show_bug.cgi?id=1203873 but Webkit also have\r
+                       // a pixel offset on very high values, see: http://jsfiddle.net/dg6r5hhb/\r
+                       this._resetView(this.getCenter(), this.getZoom());\r
+               }\r
+       },\r
+\r
+       _findEventTargets: function (e, type) {\r
+               var targets = [],\r
+                   target,\r
+                   isHover = type === 'mouseout' || type === 'mouseover',\r
+                   src = e.target || e.srcElement,\r
+                   dragging = false;\r
+\r
+               while (src) {\r
+                       target = this._targets[stamp(src)];\r
+                       if (target && (type === 'click' || type === 'preclick') && !e._simulated && this._draggableMoved(target)) {\r
+                               // Prevent firing click after you just dragged an object.\r
+                               dragging = true;\r
+                               break;\r
+                       }\r
+                       if (target && target.listens(type, true)) {\r
+                               if (isHover && !isExternalTarget(src, e)) { break; }\r
+                               targets.push(target);\r
+                               if (isHover) { break; }\r
+                       }\r
+                       if (src === this._container) { break; }\r
+                       src = src.parentNode;\r
+               }\r
+               if (!targets.length && !dragging && !isHover && isExternalTarget(src, e)) {\r
+                       targets = [this];\r
+               }\r
+               return targets;\r
+       },\r
+\r
+       _handleDOMEvent: function (e) {\r
+               if (!this._loaded || skipped(e)) { return; }\r
+\r
+               var type = e.type;\r
+\r
+               if (type === 'mousedown' || type === 'keypress') {\r
+                       // prevents outline when clicking on keyboard-focusable element\r
+                       preventOutline(e.target || e.srcElement);\r
+               }\r
+\r
+               this._fireDOMEvent(e, type);\r
+       },\r
+\r
+       _mouseEvents: ['click', 'dblclick', 'mouseover', 'mouseout', 'contextmenu'],\r
+\r
+       _fireDOMEvent: function (e, type, targets) {\r
+\r
+               if (e.type === 'click') {\r
+                       // Fire a synthetic 'preclick' event which propagates up (mainly for closing popups).\r
+                       // @event preclick: MouseEvent\r
+                       // Fired before mouse click on the map (sometimes useful when you\r
+                       // want something to happen on click before any existing click\r
+                       // handlers start running).\r
+                       var synth = extend({}, e);\r
+                       synth.type = 'preclick';\r
+                       this._fireDOMEvent(synth, synth.type, targets);\r
+               }\r
+\r
+               if (e._stopped) { return; }\r
+\r
+               // Find the layer the event is propagating from and its parents.\r
+               targets = (targets || []).concat(this._findEventTargets(e, type));\r
+\r
+               if (!targets.length) { return; }\r
+\r
+               var target = targets[0];\r
+               if (type === 'contextmenu' && target.listens(type, true)) {\r
+                       preventDefault(e);\r
+               }\r
+\r
+               var data = {\r
+                       originalEvent: e\r
+               };\r
+\r
+               if (e.type !== 'keypress') {\r
+                       var isMarker = (target.options && 'icon' in target.options);\r
+                       data.containerPoint = isMarker ?\r
+                                       this.latLngToContainerPoint(target.getLatLng()) : this.mouseEventToContainerPoint(e);\r
+                       data.layerPoint = this.containerPointToLayerPoint(data.containerPoint);\r
+                       data.latlng = isMarker ? target.getLatLng() : this.layerPointToLatLng(data.layerPoint);\r
+               }\r
+\r
+               for (var i = 0; i < targets.length; i++) {\r
+                       targets[i].fire(type, data, true);\r
+                       if (data.originalEvent._stopped ||\r
+                               (targets[i].options.bubblingMouseEvents === false && indexOf(this._mouseEvents, type) !== -1)) { return; }\r
+               }\r
+       },\r
+\r
+       _draggableMoved: function (obj) {\r
+               obj = obj.dragging && obj.dragging.enabled() ? obj : this;\r
+               return (obj.dragging && obj.dragging.moved()) || (this.boxZoom && this.boxZoom.moved());\r
+       },\r
+\r
+       _clearHandlers: function () {\r
+               for (var i = 0, len = this._handlers.length; i < len; i++) {\r
+                       this._handlers[i].disable();\r
+               }\r
+       },\r
+\r
+       // @section Other Methods\r
+\r
+       // @method whenReady(fn: Function, context?: Object): this\r
+       // Runs the given function `fn` when the map gets initialized with\r
+       // a view (center and zoom) and at least one layer, or immediately\r
+       // if it's already initialized, optionally passing a function context.\r
+       whenReady: function (callback, context) {\r
+               if (this._loaded) {\r
+                       callback.call(context || this, {target: this});\r
+               } else {\r
+                       this.on('load', callback, context);\r
+               }\r
+               return this;\r
+       },\r
+\r
+\r
+       // private methods for getting map state\r
+\r
+       _getMapPanePos: function () {\r
+               return getPosition(this._mapPane) || new Point(0, 0);\r
+       },\r
+\r
+       _moved: function () {\r
+               var pos = this._getMapPanePos();\r
+               return pos && !pos.equals([0, 0]);\r
+       },\r
+\r
+       _getTopLeftPoint: function (center, zoom) {\r
+               var pixelOrigin = center && zoom !== undefined ?\r
+                       this._getNewPixelOrigin(center, zoom) :\r
+                       this.getPixelOrigin();\r
+               return pixelOrigin.subtract(this._getMapPanePos());\r
+       },\r
+\r
+       _getNewPixelOrigin: function (center, zoom) {\r
+               var viewHalf = this.getSize()._divideBy(2);\r
+               return this.project(center, zoom)._subtract(viewHalf)._add(this._getMapPanePos())._round();\r
+       },\r
+\r
+       _latLngToNewLayerPoint: function (latlng, zoom, center) {\r
+               var topLeft = this._getNewPixelOrigin(center, zoom);\r
+               return this.project(latlng, zoom)._subtract(topLeft);\r
+       },\r
+\r
+       _latLngBoundsToNewLayerBounds: function (latLngBounds, zoom, center) {\r
+               var topLeft = this._getNewPixelOrigin(center, zoom);\r
+               return toBounds([\r
+                       this.project(latLngBounds.getSouthWest(), zoom)._subtract(topLeft),\r
+                       this.project(latLngBounds.getNorthWest(), zoom)._subtract(topLeft),\r
+                       this.project(latLngBounds.getSouthEast(), zoom)._subtract(topLeft),\r
+                       this.project(latLngBounds.getNorthEast(), zoom)._subtract(topLeft)\r
+               ]);\r
+       },\r
+\r
+       // layer point of the current center\r
+       _getCenterLayerPoint: function () {\r
+               return this.containerPointToLayerPoint(this.getSize()._divideBy(2));\r
+       },\r
+\r
+       // offset of the specified place to the current center in pixels\r
+       _getCenterOffset: function (latlng) {\r
+               return this.latLngToLayerPoint(latlng).subtract(this._getCenterLayerPoint());\r
+       },\r
+\r
+       // adjust center for view to get inside bounds\r
+       _limitCenter: function (center, zoom, bounds) {\r
+\r
+               if (!bounds) { return center; }\r
+\r
+               var centerPoint = this.project(center, zoom),\r
+                   viewHalf = this.getSize().divideBy(2),\r
+                   viewBounds = new Bounds(centerPoint.subtract(viewHalf), centerPoint.add(viewHalf)),\r
+                   offset = this._getBoundsOffset(viewBounds, bounds, zoom);\r
+\r
+               // If offset is less than a pixel, ignore.\r
+               // This prevents unstable projections from getting into\r
+               // an infinite loop of tiny offsets.\r
+               if (offset.round().equals([0, 0])) {\r
+                       return center;\r
+               }\r
+\r
+               return this.unproject(centerPoint.add(offset), zoom);\r
+       },\r
+\r
+       // adjust offset for view to get inside bounds\r
+       _limitOffset: function (offset, bounds) {\r
+               if (!bounds) { return offset; }\r
+\r
+               var viewBounds = this.getPixelBounds(),\r
+                   newBounds = new Bounds(viewBounds.min.add(offset), viewBounds.max.add(offset));\r
+\r
+               return offset.add(this._getBoundsOffset(newBounds, bounds));\r
+       },\r
+\r
+       // returns offset needed for pxBounds to get inside maxBounds at a specified zoom\r
+       _getBoundsOffset: function (pxBounds, maxBounds, zoom) {\r
+               var projectedMaxBounds = toBounds(\r
+                       this.project(maxBounds.getNorthEast(), zoom),\r
+                       this.project(maxBounds.getSouthWest(), zoom)\r
+                   ),\r
+                   minOffset = projectedMaxBounds.min.subtract(pxBounds.min),\r
+                   maxOffset = projectedMaxBounds.max.subtract(pxBounds.max),\r
+\r
+                   dx = this._rebound(minOffset.x, -maxOffset.x),\r
+                   dy = this._rebound(minOffset.y, -maxOffset.y);\r
+\r
+               return new Point(dx, dy);\r
+       },\r
+\r
+       _rebound: function (left, right) {\r
+               return left + right > 0 ?\r
+                       Math.round(left - right) / 2 :\r
+                       Math.max(0, Math.ceil(left)) - Math.max(0, Math.floor(right));\r
+       },\r
+\r
+       _limitZoom: function (zoom) {\r
+               var min = this.getMinZoom(),\r
+                   max = this.getMaxZoom(),\r
+                   snap = any3d ? this.options.zoomSnap : 1;\r
+               if (snap) {\r
+                       zoom = Math.round(zoom / snap) * snap;\r
+               }\r
+               return Math.max(min, Math.min(max, zoom));\r
+       },\r
+\r
+       _onPanTransitionStep: function () {\r
+               this.fire('move');\r
+       },\r
+\r
+       _onPanTransitionEnd: function () {\r
+               removeClass(this._mapPane, 'leaflet-pan-anim');\r
+               this.fire('moveend');\r
+       },\r
+\r
+       _tryAnimatedPan: function (center, options) {\r
+               // difference between the new and current centers in pixels\r
+               var offset = this._getCenterOffset(center)._floor();\r
+\r
+               // don't animate too far unless animate: true specified in options\r
+               if ((options && options.animate) !== true && !this.getSize().contains(offset)) { return false; }\r
+\r
+               this.panBy(offset, options);\r
+\r
+               return true;\r
+       },\r
+\r
+       _createAnimProxy: function () {\r
+\r
+               var proxy = this._proxy = create$1('div', 'leaflet-proxy leaflet-zoom-animated');\r
+               this._panes.mapPane.appendChild(proxy);\r
+\r
+               this.on('zoomanim', function (e) {\r
+                       var prop = TRANSFORM,\r
+                           transform = this._proxy.style[prop];\r
+\r
+                       setTransform(this._proxy, this.project(e.center, e.zoom), this.getZoomScale(e.zoom, 1));\r
+\r
+                       // workaround for case when transform is the same and so transitionend event is not fired\r
+                       if (transform === this._proxy.style[prop] && this._animatingZoom) {\r
+                               this._onZoomTransitionEnd();\r
+                       }\r
+               }, this);\r
+\r
+               this.on('load moveend', function () {\r
+                       var c = this.getCenter(),\r
+                           z = this.getZoom();\r
+                       setTransform(this._proxy, this.project(c, z), this.getZoomScale(z, 1));\r
+               }, this);\r
+\r
+               this._on('unload', this._destroyAnimProxy, this);\r
+       },\r
+\r
+       _destroyAnimProxy: function () {\r
+               remove(this._proxy);\r
+               delete this._proxy;\r
+       },\r
+\r
+       _catchTransitionEnd: function (e) {\r
+               if (this._animatingZoom && e.propertyName.indexOf('transform') >= 0) {\r
+                       this._onZoomTransitionEnd();\r
+               }\r
+       },\r
+\r
+       _nothingToAnimate: function () {\r
+               return !this._container.getElementsByClassName('leaflet-zoom-animated').length;\r
+       },\r
+\r
+       _tryAnimatedZoom: function (center, zoom, options) {\r
+\r
+               if (this._animatingZoom) { return true; }\r
+\r
+               options = options || {};\r
+\r
+               // don't animate if disabled, not supported or zoom difference is too large\r
+               if (!this._zoomAnimated || options.animate === false || this._nothingToAnimate() ||\r
+                       Math.abs(zoom - this._zoom) > this.options.zoomAnimationThreshold) { return false; }\r
+\r
+               // offset is the pixel coords of the zoom origin relative to the current center\r
+               var scale = this.getZoomScale(zoom),\r
+                   offset = this._getCenterOffset(center)._divideBy(1 - 1 / scale);\r
+\r
+               // don't animate if the zoom origin isn't within one screen from the current center, unless forced\r
+               if (options.animate !== true && !this.getSize().contains(offset)) { return false; }\r
+\r
+               requestAnimFrame(function () {\r
+                       this\r
+                           ._moveStart(true)\r
+                           ._animateZoom(center, zoom, true);\r
+               }, this);\r
+\r
+               return true;\r
+       },\r
+\r
+       _animateZoom: function (center, zoom, startAnim, noUpdate) {\r
+               if (startAnim) {\r
+                       this._animatingZoom = true;\r
+\r
+                       // remember what center/zoom to set after animation\r
+                       this._animateToCenter = center;\r
+                       this._animateToZoom = zoom;\r
+\r
+                       addClass(this._mapPane, 'leaflet-zoom-anim');\r
+               }\r
+\r
+               // @event zoomanim: ZoomAnimEvent\r
+               // Fired on every frame of a zoom animation\r
+               this.fire('zoomanim', {\r
+                       center: center,\r
+                       zoom: zoom,\r
+                       noUpdate: noUpdate\r
+               });\r
+\r
+               // Work around webkit not firing 'transitionend', see https://github.com/Leaflet/Leaflet/issues/3689, 2693\r
+               setTimeout(bind(this._onZoomTransitionEnd, this), 250);\r
+       },\r
+\r
+       _onZoomTransitionEnd: function () {\r
+               if (!this._animatingZoom) { return; }\r
+\r
+               removeClass(this._mapPane, 'leaflet-zoom-anim');\r
+\r
+               this._animatingZoom = false;\r
+\r
+               this._move(this._animateToCenter, this._animateToZoom);\r
+\r
+               // This anim frame should prevent an obscure iOS webkit tile loading race condition.\r
+               requestAnimFrame(function () {\r
+                       this._moveEnd(true);\r
+               }, this);\r
+       }\r
+});\r
+\r
+// @section\r
+\r
+// @factory L.map(id: String, options?: Map options)\r
+// Instantiates a map object given the DOM ID of a `<div>` element\r
+// and optionally an object literal with `Map options`.\r
+//\r
+// @alternative\r
+// @factory L.map(el: HTMLElement, options?: Map options)\r
+// Instantiates a map object given an instance of a `<div>` HTML element\r
+// and optionally an object literal with `Map options`.\r
+function createMap(id, options) {\r
+       return new Map(id, options);\r
+}
+
+/*\r
+ * @class Control\r
+ * @aka L.Control\r
+ * @inherits Class\r
+ *\r
+ * L.Control is a base class for implementing map controls. Handles positioning.\r
+ * All other controls extend from this class.\r
+ */\r
+\r
+var Control = Class.extend({\r
+       // @section\r
+       // @aka Control options\r
+       options: {\r
+               // @option position: String = 'topright'\r
+               // The position of the control (one of the map corners). Possible values are `'topleft'`,\r
+               // `'topright'`, `'bottomleft'` or `'bottomright'`\r
+               position: 'topright'\r
+       },\r
+\r
+       initialize: function (options) {\r
+               setOptions(this, options);\r
+       },\r
+\r
+       /* @section\r
+        * Classes extending L.Control will inherit the following methods:\r
+        *\r
+        * @method getPosition: string\r
+        * Returns the position of the control.\r
+        */\r
+       getPosition: function () {\r
+               return this.options.position;\r
+       },\r
+\r
+       // @method setPosition(position: string): this\r
+       // Sets the position of the control.\r
+       setPosition: function (position) {\r
+               var map = this._map;\r
+\r
+               if (map) {\r
+                       map.removeControl(this);\r
+               }\r
+\r
+               this.options.position = position;\r
+\r
+               if (map) {\r
+                       map.addControl(this);\r
+               }\r
+\r
+               return this;\r
+       },\r
+\r
+       // @method getContainer: HTMLElement\r
+       // Returns the HTMLElement that contains the control.\r
+       getContainer: function () {\r
+               return this._container;\r
+       },\r
+\r
+       // @method addTo(map: Map): this\r
+       // Adds the control to the given map.\r
+       addTo: function (map) {\r
+               this.remove();\r
+               this._map = map;\r
+\r
+               var container = this._container = this.onAdd(map),\r
+                   pos = this.getPosition(),\r
+                   corner = map._controlCorners[pos];\r
+\r
+               addClass(container, 'leaflet-control');\r
+\r
+               if (pos.indexOf('bottom') !== -1) {\r
+                       corner.insertBefore(container, corner.firstChild);\r
+               } else {\r
+                       corner.appendChild(container);\r
+               }\r
+\r
+               return this;\r
+       },\r
+\r
+       // @method remove: this\r
+       // Removes the control from the map it is currently active on.\r
+       remove: function () {\r
+               if (!this._map) {\r
+                       return this;\r
+               }\r
+\r
+               remove(this._container);\r
+\r
+               if (this.onRemove) {\r
+                       this.onRemove(this._map);\r
+               }\r
+\r
+               this._map = null;\r
+\r
+               return this;\r
+       },\r
+\r
+       _refocusOnMap: function (e) {\r
+               // if map exists and event is not a keyboard event\r
+               if (this._map && e && e.screenX > 0 && e.screenY > 0) {\r
+                       this._map.getContainer().focus();\r
+               }\r
+       }\r
+});\r
+\r
+var control = function (options) {\r
+       return new Control(options);\r
+};\r
+\r
+/* @section Extension methods\r
+ * @uninheritable\r
+ *\r
+ * Every control should extend from `L.Control` and (re-)implement the following methods.\r
+ *\r
+ * @method onAdd(map: Map): HTMLElement\r
+ * Should return the container DOM element for the control and add listeners on relevant map events. Called on [`control.addTo(map)`](#control-addTo).\r
+ *\r
+ * @method onRemove(map: Map)\r
+ * Optional method. Should contain all clean up code that removes the listeners previously added in [`onAdd`](#control-onadd). Called on [`control.remove()`](#control-remove).\r
+ */\r
+\r
+/* @namespace Map\r
+ * @section Methods for Layers and Controls\r
+ */\r
+Map.include({\r
+       // @method addControl(control: Control): this\r
+       // Adds the given control to the map\r
+       addControl: function (control) {\r
+               control.addTo(this);\r
+               return this;\r
+       },\r
+\r
+       // @method removeControl(control: Control): this\r
+       // Removes the given control from the map\r
+       removeControl: function (control) {\r
+               control.remove();\r
+               return this;\r
+       },\r
+\r
+       _initControlPos: function () {\r
+               var corners = this._controlCorners = {},\r
+                   l = 'leaflet-',\r
+                   container = this._controlContainer =\r
+                           create$1('div', l + 'control-container', this._container);\r
+\r
+               function createCorner(vSide, hSide) {\r
+                       var className = l + vSide + ' ' + l + hSide;\r
+\r
+                       corners[vSide + hSide] = create$1('div', className, container);\r
+               }\r
+\r
+               createCorner('top', 'left');\r
+               createCorner('top', 'right');\r
+               createCorner('bottom', 'left');\r
+               createCorner('bottom', 'right');\r
+       },\r
+\r
+       _clearControlPos: function () {\r
+               for (var i in this._controlCorners) {\r
+                       remove(this._controlCorners[i]);\r
+               }\r
+               remove(this._controlContainer);\r
+               delete this._controlCorners;\r
+               delete this._controlContainer;\r
+       }\r
+});
+
+/*\r
+ * @class Control.Layers\r
+ * @aka L.Control.Layers\r
+ * @inherits Control\r
+ *\r
+ * 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`.\r
+ *\r
+ * @example\r
+ *\r
+ * ```js\r
+ * var baseLayers = {\r
+ *     "Mapbox": mapbox,\r
+ *     "OpenStreetMap": osm\r
+ * };\r
+ *\r
+ * var overlays = {\r
+ *     "Marker": marker,\r
+ *     "Roads": roadsLayer\r
+ * };\r
+ *\r
+ * L.control.layers(baseLayers, overlays).addTo(map);\r
+ * ```\r
+ *\r
+ * The `baseLayers` and `overlays` parameters are object literals with layer names as keys and `Layer` objects as values:\r
+ *\r
+ * ```js\r
+ * {\r
+ *     "<someName1>": layer1,\r
+ *     "<someName2>": layer2\r
+ * }\r
+ * ```\r
+ *\r
+ * The layer names can contain HTML, which allows you to add additional styling to the items:\r
+ *\r
+ * ```js\r
+ * {"<img src='my-layer-icon' /> <span class='my-layer-item'>My Layer</span>": myLayer}\r
+ * ```\r
+ */\r
+\r
+var Layers = Control.extend({\r
+       // @section\r
+       // @aka Control.Layers options\r
+       options: {\r
+               // @option collapsed: Boolean = true\r
+               // If `true`, the control will be collapsed into an icon and expanded on mouse hover or touch.\r
+               collapsed: true,\r
+               position: 'topright',\r
+\r
+               // @option autoZIndex: Boolean = true\r
+               // 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.\r
+               autoZIndex: true,\r
+\r
+               // @option hideSingleBase: Boolean = false\r
+               // If `true`, the base layers in the control will be hidden when there is only one.\r
+               hideSingleBase: false,\r
+\r
+               // @option sortLayers: Boolean = false\r
+               // Whether to sort the layers. When `false`, layers will keep the order\r
+               // in which they were added to the control.\r
+               sortLayers: false,\r
+\r
+               // @option sortFunction: Function = *\r
+               // A [compare function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/sort)\r
+               // that will be used for sorting the layers, when `sortLayers` is `true`.\r
+               // The function receives both the `L.Layer` instances and their names, as in\r
+               // `sortFunction(layerA, layerB, nameA, nameB)`.\r
+               // By default, it sorts layers alphabetically by their name.\r
+               sortFunction: function (layerA, layerB, nameA, nameB) {\r
+                       return nameA < nameB ? -1 : (nameB < nameA ? 1 : 0);\r
+               }\r
+       },\r
+\r
+       initialize: function (baseLayers, overlays, options) {\r
+               setOptions(this, options);\r
+\r
+               this._layerControlInputs = [];\r
+               this._layers = [];\r
+               this._lastZIndex = 0;\r
+               this._handlingClick = false;\r
+\r
+               for (var i in baseLayers) {\r
+                       this._addLayer(baseLayers[i], i);\r
+               }\r
+\r
+               for (i in overlays) {\r
+                       this._addLayer(overlays[i], i, true);\r
+               }\r
+       },\r
+\r
+       onAdd: function (map) {\r
+               this._initLayout();\r
+               this._update();\r
+\r
+               this._map = map;\r
+               map.on('zoomend', this._checkDisabledLayers, this);\r
+\r
+               for (var i = 0; i < this._layers.length; i++) {\r
+                       this._layers[i].layer.on('add remove', this._onLayerChange, this);\r
+               }\r
+\r
+               return this._container;\r
+       },\r
+\r
+       addTo: function (map) {\r
+               Control.prototype.addTo.call(this, map);\r
+               // Trigger expand after Layers Control has been inserted into DOM so that is now has an actual height.\r
+               return this._expandIfNotCollapsed();\r
+       },\r
+\r
+       onRemove: function () {\r
+               this._map.off('zoomend', this._checkDisabledLayers, this);\r
+\r
+               for (var i = 0; i < this._layers.length; i++) {\r
+                       this._layers[i].layer.off('add remove', this._onLayerChange, this);\r
+               }\r
+       },\r
+\r
+       // @method addBaseLayer(layer: Layer, name: String): this\r
+       // Adds a base layer (radio button entry) with the given name to the control.\r
+       addBaseLayer: function (layer, name) {\r
+               this._addLayer(layer, name);\r
+               return (this._map) ? this._update() : this;\r
+       },\r
+\r
+       // @method addOverlay(layer: Layer, name: String): this\r
+       // Adds an overlay (checkbox entry) with the given name to the control.\r
+       addOverlay: function (layer, name) {\r
+               this._addLayer(layer, name, true);\r
+               return (this._map) ? this._update() : this;\r
+       },\r
+\r
+       // @method removeLayer(layer: Layer): this\r
+       // Remove the given layer from the control.\r
+       removeLayer: function (layer) {\r
+               layer.off('add remove', this._onLayerChange, this);\r
+\r
+               var obj = this._getLayer(stamp(layer));\r
+               if (obj) {\r
+                       this._layers.splice(this._layers.indexOf(obj), 1);\r
+               }\r
+               return (this._map) ? this._update() : this;\r
+       },\r
+\r
+       // @method expand(): this\r
+       // Expand the control container if collapsed.\r
+       expand: function () {\r
+               addClass(this._container, 'leaflet-control-layers-expanded');\r
+               this._form.style.height = null;\r
+               var acceptableHeight = this._map.getSize().y - (this._container.offsetTop + 50);\r
+               if (acceptableHeight < this._form.clientHeight) {\r
+                       addClass(this._form, 'leaflet-control-layers-scrollbar');\r
+                       this._form.style.height = acceptableHeight + 'px';\r
+               } else {\r
+                       removeClass(this._form, 'leaflet-control-layers-scrollbar');\r
+               }\r
+               this._checkDisabledLayers();\r
+               return this;\r
+       },\r
+\r
+       // @method collapse(): this\r
+       // Collapse the control container if expanded.\r
+       collapse: function () {\r
+               removeClass(this._container, 'leaflet-control-layers-expanded');\r
+               return this;\r
+       },\r
+\r
+       _initLayout: function () {\r
+               var className = 'leaflet-control-layers',\r
+                   container = this._container = create$1('div', className),\r
+                   collapsed = this.options.collapsed;\r
+\r
+               // makes this work on IE touch devices by stopping it from firing a mouseout event when the touch is released\r
+               container.setAttribute('aria-haspopup', true);\r
+\r
+               disableClickPropagation(container);\r
+               disableScrollPropagation(container);\r
+\r
+               var form = this._form = create$1('form', className + '-list');\r
+\r
+               if (collapsed) {\r
+                       this._map.on('click', this.collapse, this);\r
+\r
+                       if (!android) {\r
+                               on(container, {\r
+                                       mouseenter: this.expand,\r
+                                       mouseleave: this.collapse\r
+                               }, this);\r
+                       }\r
+               }\r
+\r
+               var link = this._layersLink = create$1('a', className + '-toggle', container);\r
+               link.href = '#';\r
+               link.title = 'Layers';\r
+\r
+               if (touch) {\r
+                       on(link, 'click', stop);\r
+                       on(link, 'click', this.expand, this);\r
+               } else {\r
+                       on(link, 'focus', this.expand, this);\r
+               }\r
+\r
+               if (!collapsed) {\r
+                       this.expand();\r
+               }\r
+\r
+               this._baseLayersList = create$1('div', className + '-base', form);\r
+               this._separator = create$1('div', className + '-separator', form);\r
+               this._overlaysList = create$1('div', className + '-overlays', form);\r
+\r
+               container.appendChild(form);\r
+       },\r
+\r
+       _getLayer: function (id) {\r
+               for (var i = 0; i < this._layers.length; i++) {\r
+\r
+                       if (this._layers[i] && stamp(this._layers[i].layer) === id) {\r
+                               return this._layers[i];\r
+                       }\r
+               }\r
+       },\r
+\r
+       _addLayer: function (layer, name, overlay) {\r
+               if (this._map) {\r
+                       layer.on('add remove', this._onLayerChange, this);\r
+               }\r
+\r
+               this._layers.push({\r
+                       layer: layer,\r
+                       name: name,\r
+                       overlay: overlay\r
+               });\r
+\r
+               if (this.options.sortLayers) {\r
+                       this._layers.sort(bind(function (a, b) {\r
+                               return this.options.sortFunction(a.layer, b.layer, a.name, b.name);\r
+                       }, this));\r
+               }\r
+\r
+               if (this.options.autoZIndex && layer.setZIndex) {\r
+                       this._lastZIndex++;\r
+                       layer.setZIndex(this._lastZIndex);\r
+               }\r
+\r
+               this._expandIfNotCollapsed();\r
+       },\r
+\r
+       _update: function () {\r
+               if (!this._container) { return this; }\r
+\r
+               empty(this._baseLayersList);\r
+               empty(this._overlaysList);\r
+\r
+               this._layerControlInputs = [];\r
+               var baseLayersPresent, overlaysPresent, i, obj, baseLayersCount = 0;\r
+\r
+               for (i = 0; i < this._layers.length; i++) {\r
+                       obj = this._layers[i];\r
+                       this._addItem(obj);\r
+                       overlaysPresent = overlaysPresent || obj.overlay;\r
+                       baseLayersPresent = baseLayersPresent || !obj.overlay;\r
+                       baseLayersCount += !obj.overlay ? 1 : 0;\r
+               }\r
+\r
+               // Hide base layers section if there's only one layer.\r
+               if (this.options.hideSingleBase) {\r
+                       baseLayersPresent = baseLayersPresent && baseLayersCount > 1;\r
+                       this._baseLayersList.style.display = baseLayersPresent ? '' : 'none';\r
+               }\r
+\r
+               this._separator.style.display = overlaysPresent && baseLayersPresent ? '' : 'none';\r
+\r
+               return this;\r
+       },\r
+\r
+       _onLayerChange: function (e) {\r
+               if (!this._handlingClick) {\r
+                       this._update();\r
+               }\r
+\r
+               var obj = this._getLayer(stamp(e.target));\r
+\r
+               // @namespace Map\r
+               // @section Layer events\r
+               // @event baselayerchange: LayersControlEvent\r
+               // Fired when the base layer is changed through the [layer control](#control-layers).\r
+               // @event overlayadd: LayersControlEvent\r
+               // Fired when an overlay is selected through the [layer control](#control-layers).\r
+               // @event overlayremove: LayersControlEvent\r
+               // Fired when an overlay is deselected through the [layer control](#control-layers).\r
+               // @namespace Control.Layers\r
+               var type = obj.overlay ?\r
+                       (e.type === 'add' ? 'overlayadd' : 'overlayremove') :\r
+                       (e.type === 'add' ? 'baselayerchange' : null);\r
+\r
+               if (type) {\r
+                       this._map.fire(type, obj);\r
+               }\r
+       },\r
+\r
+       // IE7 bugs out if you create a radio dynamically, so you have to do it this hacky way (see http://bit.ly/PqYLBe)\r
+       _createRadioElement: function (name, checked) {\r
+\r
+               var radioHtml = '<input type="radio" class="leaflet-control-layers-selector" name="' +\r
+                               name + '"' + (checked ? ' checked="checked"' : '') + '/>';\r
+\r
+               var radioFragment = document.createElement('div');\r
+               radioFragment.innerHTML = radioHtml;\r
+\r
+               return radioFragment.firstChild;\r
+       },\r
+\r
+       _addItem: function (obj) {\r
+               var label = document.createElement('label'),\r
+                   checked = this._map.hasLayer(obj.layer),\r
+                   input;\r
+\r
+               if (obj.overlay) {\r
+                       input = document.createElement('input');\r
+                       input.type = 'checkbox';\r
+                       input.className = 'leaflet-control-layers-selector';\r
+                       input.defaultChecked = checked;\r
+               } else {\r
+                       input = this._createRadioElement('leaflet-base-layers', checked);\r
+               }\r
+\r
+               this._layerControlInputs.push(input);\r
+               input.layerId = stamp(obj.layer);\r
+\r
+               on(input, 'click', this._onInputClick, this);\r
+\r
+               var name = document.createElement('span');\r
+               name.innerHTML = ' ' + obj.name;\r
+\r
+               // Helps from preventing layer control flicker when checkboxes are disabled\r
+               // https://github.com/Leaflet/Leaflet/issues/2771\r
+               var holder = document.createElement('div');\r
+\r
+               label.appendChild(holder);\r
+               holder.appendChild(input);\r
+               holder.appendChild(name);\r
+\r
+               var container = obj.overlay ? this._overlaysList : this._baseLayersList;\r
+               container.appendChild(label);\r
+\r
+               this._checkDisabledLayers();\r
+               return label;\r
+       },\r
+\r
+       _onInputClick: function () {\r
+               var inputs = this._layerControlInputs,\r
+                   input, layer;\r
+               var addedLayers = [],\r
+                   removedLayers = [];\r
+\r
+               this._handlingClick = true;\r
+\r
+               for (var i = inputs.length - 1; i >= 0; i--) {\r
+                       input = inputs[i];\r
+                       layer = this._getLayer(input.layerId).layer;\r
+\r
+                       if (input.checked) {\r
+                               addedLayers.push(layer);\r
+                       } else if (!input.checked) {\r
+                               removedLayers.push(layer);\r
+                       }\r
+               }\r
+\r
+               // Bugfix issue 2318: Should remove all old layers before readding new ones\r
+               for (i = 0; i < removedLayers.length; i++) {\r
+                       if (this._map.hasLayer(removedLayers[i])) {\r
+                               this._map.removeLayer(removedLayers[i]);\r
+                       }\r
+               }\r
+               for (i = 0; i < addedLayers.length; i++) {\r
+                       if (!this._map.hasLayer(addedLayers[i])) {\r
+                               this._map.addLayer(addedLayers[i]);\r
+                       }\r
+               }\r
+\r
+               this._handlingClick = false;\r
+\r
+               this._refocusOnMap();\r
+       },\r
+\r
+       _checkDisabledLayers: function () {\r
+               var inputs = this._layerControlInputs,\r
+                   input,\r
+                   layer,\r
+                   zoom = this._map.getZoom();\r
+\r
+               for (var i = inputs.length - 1; i >= 0; i--) {\r
+                       input = inputs[i];\r
+                       layer = this._getLayer(input.layerId).layer;\r
+                       input.disabled = (layer.options.minZoom !== undefined && zoom < layer.options.minZoom) ||\r
+                                        (layer.options.maxZoom !== undefined && zoom > layer.options.maxZoom);\r
+\r
+               }\r
+       },\r
+\r
+       _expandIfNotCollapsed: function () {\r
+               if (this._map && !this.options.collapsed) {\r
+                       this.expand();\r
+               }\r
+               return this;\r
+       },\r
+\r
+       _expand: function () {\r
+               // Backward compatibility, remove me in 1.1.\r
+               return this.expand();\r
+       },\r
+\r
+       _collapse: function () {\r
+               // Backward compatibility, remove me in 1.1.\r
+               return this.collapse();\r
+       }\r
+\r
+});\r
+\r
+\r
+// @factory L.control.layers(baselayers?: Object, overlays?: Object, options?: Control.Layers options)\r
+// Creates an attribution 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.\r
+var layers = function (baseLayers, overlays, options) {\r
+       return new Layers(baseLayers, overlays, options);\r
+};
+
+/*\r
+ * @class Control.Zoom\r
+ * @aka L.Control.Zoom\r
+ * @inherits Control\r
+ *\r
+ * 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`.\r
+ */\r
+\r
+var Zoom = Control.extend({\r
+       // @section\r
+       // @aka Control.Zoom options\r
+       options: {\r
+               position: 'topleft',\r
+\r
+               // @option zoomInText: String = '+'\r
+               // The text set on the 'zoom in' button.\r
+               zoomInText: '+',\r
+\r
+               // @option zoomInTitle: String = 'Zoom in'\r
+               // The title set on the 'zoom in' button.\r
+               zoomInTitle: 'Zoom in',\r
+\r
+               // @option zoomOutText: String = '&#x2212;'\r
+               // The text set on the 'zoom out' button.\r
+               zoomOutText: '&#x2212;',\r
+\r
+               // @option zoomOutTitle: String = 'Zoom out'\r
+               // The title set on the 'zoom out' button.\r
+               zoomOutTitle: 'Zoom out'\r
+       },\r
+\r
+       onAdd: function (map) {\r
+               var zoomName = 'leaflet-control-zoom',\r
+                   container = create$1('div', zoomName + ' leaflet-bar'),\r
+                   options = this.options;\r
+\r
+               this._zoomInButton  = this._createButton(options.zoomInText, options.zoomInTitle,\r
+                       zoomName + '-in',  container, this._zoomIn);\r
+               this._zoomOutButton = this._createButton(options.zoomOutText, options.zoomOutTitle,\r
+                       zoomName + '-out', container, this._zoomOut);\r
+\r
+               this._updateDisabled();\r
+               map.on('zoomend zoomlevelschange', this._updateDisabled, this);\r
+\r
+               return container;\r
+       },\r
+\r
+       onRemove: function (map) {\r
+               map.off('zoomend zoomlevelschange', this._updateDisabled, this);\r
+       },\r
+\r
+       disable: function () {\r
+               this._disabled = true;\r
+               this._updateDisabled();\r
+               return this;\r
+       },\r
+\r
+       enable: function () {\r
+               this._disabled = false;\r
+               this._updateDisabled();\r
+               return this;\r
+       },\r
+\r
+       _zoomIn: function (e) {\r
+               if (!this._disabled && this._map._zoom < this._map.getMaxZoom()) {\r
+                       this._map.zoomIn(this._map.options.zoomDelta * (e.shiftKey ? 3 : 1));\r
+               }\r
+       },\r
+\r
+       _zoomOut: function (e) {\r
+               if (!this._disabled && this._map._zoom > this._map.getMinZoom()) {\r
+                       this._map.zoomOut(this._map.options.zoomDelta * (e.shiftKey ? 3 : 1));\r
+               }\r
+       },\r
+\r
+       _createButton: function (html, title, className, container, fn) {\r
+               var link = create$1('a', className, container);\r
+               link.innerHTML = html;\r
+               link.href = '#';\r
+               link.title = title;\r
+\r
+               /*\r
+                * Will force screen readers like VoiceOver to read this as "Zoom in - button"\r
+                */\r
+               link.setAttribute('role', 'button');\r
+               link.setAttribute('aria-label', title);\r
+\r
+               disableClickPropagation(link);\r
+               on(link, 'click', stop);\r
+               on(link, 'click', fn, this);\r
+               on(link, 'click', this._refocusOnMap, this);\r
+\r
+               return link;\r
+       },\r
+\r
+       _updateDisabled: function () {\r
+               var map = this._map,\r
+                   className = 'leaflet-disabled';\r
+\r
+               removeClass(this._zoomInButton, className);\r
+               removeClass(this._zoomOutButton, className);\r
+\r
+               if (this._disabled || map._zoom === map.getMinZoom()) {\r
+                       addClass(this._zoomOutButton, className);\r
+               }\r
+               if (this._disabled || map._zoom === map.getMaxZoom()) {\r
+                       addClass(this._zoomInButton, className);\r
+               }\r
+       }\r
+});\r
+\r
+// @namespace Map\r
+// @section Control options\r
+// @option zoomControl: Boolean = true\r
+// Whether a [zoom control](#control-zoom) is added to the map by default.\r
+Map.mergeOptions({\r
+       zoomControl: true\r
+});\r
+\r
+Map.addInitHook(function () {\r
+       if (this.options.zoomControl) {\r
+               this.zoomControl = new Zoom();\r
+               this.addControl(this.zoomControl);\r
+       }\r
+});\r
+\r
+// @namespace Control.Zoom\r
+// @factory L.control.zoom(options: Control.Zoom options)\r
+// Creates a zoom control\r
+var zoom = function (options) {\r
+       return new Zoom(options);\r
+};
+
+/*
+ * @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);
+};
+
+/*\r
+ * @class Control.Attribution\r
+ * @aka L.Control.Attribution\r
+ * @inherits Control\r
+ *\r
+ * 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.\r
+ */\r
+\r
+var Attribution = Control.extend({\r
+       // @section\r
+       // @aka Control.Attribution options\r
+       options: {\r
+               position: 'bottomright',\r
+\r
+               // @option prefix: String = 'Leaflet'\r
+               // The HTML text shown before the attributions. Pass `false` to disable.\r
+               prefix: '<a href="http://leafletjs.com" title="A JS library for interactive maps">Leaflet</a>'\r
+       },\r
+\r
+       initialize: function (options) {\r
+               setOptions(this, options);\r
+\r
+               this._attributions = {};\r
+       },\r
+\r
+       onAdd: function (map) {\r
+               map.attributionControl = this;\r
+               this._container = create$1('div', 'leaflet-control-attribution');\r
+               disableClickPropagation(this._container);\r
+\r
+               // TODO ugly, refactor\r
+               for (var i in map._layers) {\r
+                       if (map._layers[i].getAttribution) {\r
+                               this.addAttribution(map._layers[i].getAttribution());\r
+                       }\r
+               }\r
+\r
+               this._update();\r
+\r
+               return this._container;\r
+       },\r
+\r
+       // @method setPrefix(prefix: String): this\r
+       // Sets the text before the attributions.\r
+       setPrefix: function (prefix) {\r
+               this.options.prefix = prefix;\r
+               this._update();\r
+               return this;\r
+       },\r
+\r
+       // @method addAttribution(text: String): this\r
+       // Adds an attribution text (e.g. `'Vector data &copy; Mapbox'`).\r
+       addAttribution: function (text) {\r
+               if (!text) { return this; }\r
+\r
+               if (!this._attributions[text]) {\r
+                       this._attributions[text] = 0;\r
+               }\r
+               this._attributions[text]++;\r
+\r
+               this._update();\r
+\r
+               return this;\r
+       },\r
+\r
+       // @method removeAttribution(text: String): this\r
+       // Removes an attribution text.\r
+       removeAttribution: function (text) {\r
+               if (!text) { return this; }\r
+\r
+               if (this._attributions[text]) {\r
+                       this._attributions[text]--;\r
+                       this._update();\r
+               }\r
+\r
+               return this;\r
+       },\r
+\r
+       _update: function () {\r
+               if (!this._map) { return; }\r
+\r
+               var attribs = [];\r
+\r
+               for (var i in this._attributions) {\r
+                       if (this._attributions[i]) {\r
+                               attribs.push(i);\r
+                       }\r
+               }\r
+\r
+               var prefixAndAttribs = [];\r
+\r
+               if (this.options.prefix) {\r
+                       prefixAndAttribs.push(this.options.prefix);\r
+               }\r
+               if (attribs.length) {\r
+                       prefixAndAttribs.push(attribs.join(', '));\r
+               }\r
+\r
+               this._container.innerHTML = prefixAndAttribs.join(' | ');\r
+       }\r
+});\r
+\r
+// @namespace Map\r
+// @section Control options\r
+// @option attributionControl: Boolean = true\r
+// Whether a [attribution control](#control-attribution) is added to the map by default.\r
+Map.mergeOptions({\r
+       attributionControl: true\r
+});\r
+\r
+Map.addInitHook(function () {\r
+       if (this.options.attributionControl) {\r
+               new Attribution().addTo(this);\r
+       }\r
+});\r
+\r
+// @namespace Control.Attribution\r
+// @factory L.control.attribution(options: Control.Attribution options)\r
+// Creates an attribution control.\r
+var attribution = function (options) {\r
+       return new Attribution(options);\r
+};
+
+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.
+});
+
+var Mixin = {Events: Events};
+
+/*\r
+ * @class Draggable\r
+ * @aka L.Draggable\r
+ * @inherits Evented\r
+ *\r
+ * A class for making DOM elements draggable (including touch support).\r
+ * Used internally for map and marker dragging. Only works for elements\r
+ * that were positioned with [`L.DomUtil.setPosition`](#domutil-setposition).\r
+ *\r
+ * @example\r
+ * ```js\r
+ * var draggable = new L.Draggable(elementToDrag);\r
+ * draggable.enable();\r
+ * ```\r
+ */\r
+\r
+var START = touch ? 'touchstart mousedown' : 'mousedown';\r
+var END = {\r
+       mousedown: 'mouseup',\r
+       touchstart: 'touchend',\r
+       pointerdown: 'touchend',\r
+       MSPointerDown: 'touchend'\r
+};\r
+var MOVE = {\r
+       mousedown: 'mousemove',\r
+       touchstart: 'touchmove',\r
+       pointerdown: 'touchmove',\r
+       MSPointerDown: 'touchmove'\r
+};\r
+\r
+\r
+var Draggable = Evented.extend({\r
+\r
+       options: {\r
+               // @section\r
+               // @aka Draggable options\r
+               // @option clickTolerance: Number = 3\r
+               // The max number of pixels a user can shift the mouse pointer during a click\r
+               // for it to be considered a valid click (as opposed to a mouse drag).\r
+               clickTolerance: 3\r
+       },\r
+\r
+       // @constructor L.Draggable(el: HTMLElement, dragHandle?: HTMLElement, preventOutline?: Boolean, options?: Draggable options)\r
+       // Creates a `Draggable` object for moving `el` when you start dragging the `dragHandle` element (equals `el` itself by default).\r
+       initialize: function (element, dragStartTarget, preventOutline$$1, options) {\r
+               setOptions(this, options);\r
+\r
+               this._element = element;\r
+               this._dragStartTarget = dragStartTarget || element;\r
+               this._preventOutline = preventOutline$$1;\r
+       },\r
+\r
+       // @method enable()\r
+       // Enables the dragging ability\r
+       enable: function () {\r
+               if (this._enabled) { return; }\r
+\r
+               on(this._dragStartTarget, START, this._onDown, this);\r
+\r
+               this._enabled = true;\r
+       },\r
+\r
+       // @method disable()\r
+       // Disables the dragging ability\r
+       disable: function () {\r
+               if (!this._enabled) { return; }\r
+\r
+               // If we're currently dragging this draggable,\r
+               // disabling it counts as first ending the drag.\r
+               if (Draggable._dragging === this) {\r
+                       this.finishDrag();\r
+               }\r
+\r
+               off(this._dragStartTarget, START, this._onDown, this);\r
+\r
+               this._enabled = false;\r
+               this._moved = false;\r
+       },\r
+\r
+       _onDown: function (e) {\r
+               // Ignore simulated events, since we handle both touch and\r
+               // mouse explicitly; otherwise we risk getting duplicates of\r
+               // touch events, see #4315.\r
+               // Also ignore the event if disabled; this happens in IE11\r
+               // under some circumstances, see #3666.\r
+               if (e._simulated || !this._enabled) { return; }\r
+\r
+               this._moved = false;\r
+\r
+               if (hasClass(this._element, 'leaflet-zoom-anim')) { return; }\r
+\r
+               if (Draggable._dragging || e.shiftKey || ((e.which !== 1) && (e.button !== 1) && !e.touches)) { return; }\r
+               Draggable._dragging = this;  // Prevent dragging multiple objects at once.\r
+\r
+               if (this._preventOutline) {\r
+                       preventOutline(this._element);\r
+               }\r
+\r
+               disableImageDrag();\r
+               disableTextSelection();\r
+\r
+               if (this._moving) { return; }\r
+\r
+               // @event down: Event\r
+               // Fired when a drag is about to start.\r
+               this.fire('down');\r
+\r
+               var first = e.touches ? e.touches[0] : e;\r
+\r
+               this._startPoint = new Point(first.clientX, first.clientY);\r
+\r
+               on(document, MOVE[e.type], this._onMove, this);\r
+               on(document, END[e.type], this._onUp, this);\r
+       },\r
+\r
+       _onMove: function (e) {\r
+               // Ignore simulated events, since we handle both touch and\r
+               // mouse explicitly; otherwise we risk getting duplicates of\r
+               // touch events, see #4315.\r
+               // Also ignore the event if disabled; this happens in IE11\r
+               // under some circumstances, see #3666.\r
+               if (e._simulated || !this._enabled) { return; }\r
+\r
+               if (e.touches && e.touches.length > 1) {\r
+                       this._moved = true;\r
+                       return;\r
+               }\r
+\r
+               var first = (e.touches && e.touches.length === 1 ? e.touches[0] : e),\r
+                   newPoint = new Point(first.clientX, first.clientY),\r
+                   offset = newPoint.subtract(this._startPoint);\r
+\r
+               if (!offset.x && !offset.y) { return; }\r
+               if (Math.abs(offset.x) + Math.abs(offset.y) < this.options.clickTolerance) { return; }\r
+\r
+               preventDefault(e);\r
+\r
+               if (!this._moved) {\r
+                       // @event dragstart: Event\r
+                       // Fired when a drag starts\r
+                       this.fire('dragstart');\r
+\r
+                       this._moved = true;\r
+                       this._startPos = getPosition(this._element).subtract(offset);\r
+\r
+                       addClass(document.body, 'leaflet-dragging');\r
+\r
+                       this._lastTarget = e.target || e.srcElement;\r
+                       // IE and Edge do not give the <use> element, so fetch it\r
+                       // if necessary\r
+                       if ((window.SVGElementInstance) && (this._lastTarget instanceof SVGElementInstance)) {\r
+                               this._lastTarget = this._lastTarget.correspondingUseElement;\r
+                       }\r
+                       addClass(this._lastTarget, 'leaflet-drag-target');\r
+               }\r
+\r
+               this._newPos = this._startPos.add(offset);\r
+               this._moving = true;\r
+\r
+               cancelAnimFrame(this._animRequest);\r
+               this._lastEvent = e;\r
+               this._animRequest = requestAnimFrame(this._updatePosition, this, true);\r
+       },\r
+\r
+       _updatePosition: function () {\r
+               var e = {originalEvent: this._lastEvent};\r
+\r
+               // @event predrag: Event\r
+               // Fired continuously during dragging *before* each corresponding\r
+               // update of the element's position.\r
+               this.fire('predrag', e);\r
+               setPosition(this._element, this._newPos);\r
+\r
+               // @event drag: Event\r
+               // Fired continuously during dragging.\r
+               this.fire('drag', e);\r
+       },\r
+\r
+       _onUp: function (e) {\r
+               // Ignore simulated events, since we handle both touch and\r
+               // mouse explicitly; otherwise we risk getting duplicates of\r
+               // touch events, see #4315.\r
+               // Also ignore the event if disabled; this happens in IE11\r
+               // under some circumstances, see #3666.\r
+               if (e._simulated || !this._enabled) { return; }\r
+               this.finishDrag();\r
+       },\r
+\r
+       finishDrag: function () {\r
+               removeClass(document.body, 'leaflet-dragging');\r
+\r
+               if (this._lastTarget) {\r
+                       removeClass(this._lastTarget, 'leaflet-drag-target');\r
+                       this._lastTarget = null;\r
+               }\r
+\r
+               for (var i in MOVE) {\r
+                       off(document, MOVE[i], this._onMove, this);\r
+                       off(document, END[i], this._onUp, this);\r
+               }\r
+\r
+               enableImageDrag();\r
+               enableTextSelection();\r
+\r
+               if (this._moved && this._moving) {\r
+                       // ensure drag is not fired after dragend\r
+                       cancelAnimFrame(this._animRequest);\r
+\r
+                       // @event dragend: DragEndEvent\r
+                       // Fired when the drag ends.\r
+                       this.fire('dragend', {\r
+                               distance: this._newPos.distanceTo(this._startPos)\r
+                       });\r
+               }\r
+\r
+               this._moving = false;\r
+               Draggable._dragging = false;\r
+       }\r
+\r
+});
+
+/*\r
+ * @namespace LineUtil\r
+ *\r
+ * Various utility functions for polyine points processing, used by Leaflet internally to make polylines lightning-fast.\r
+ */\r
+\r
+// Simplify polyline with vertex reduction and Douglas-Peucker simplification.\r
+// Improves rendering performance dramatically by lessening the number of points to draw.\r
+\r
+// @function simplify(points: Point[], tolerance: Number): Point[]\r
+// Dramatically reduces the number of points in a polyline while retaining\r
+// its shape and returns a new array of simplified points, using the\r
+// [Douglas-Peucker algorithm](http://en.wikipedia.org/wiki/Douglas-Peucker_algorithm).\r
+// Used for a huge performance boost when processing/displaying Leaflet polylines for\r
+// each zoom level and also reducing visual noise. tolerance affects the amount of\r
+// simplification (lesser value means higher quality but slower and with more points).\r
+// Also released as a separated micro-library [Simplify.js](http://mourner.github.com/simplify-js/).\r
+function simplify(points, tolerance) {\r
+       if (!tolerance || !points.length) {\r
+               return points.slice();\r
+       }\r
+\r
+       var sqTolerance = tolerance * tolerance;\r
+\r
+           // stage 1: vertex reduction\r
+           points = _reducePoints(points, sqTolerance);\r
+\r
+           // stage 2: Douglas-Peucker simplification\r
+           points = _simplifyDP(points, sqTolerance);\r
+\r
+       return points;\r
+}\r
+\r
+// @function pointToSegmentDistance(p: Point, p1: Point, p2: Point): Number\r
+// Returns the distance between point `p` and segment `p1` to `p2`.\r
+function pointToSegmentDistance(p, p1, p2) {\r
+       return Math.sqrt(_sqClosestPointOnSegment(p, p1, p2, true));\r
+}\r
+\r
+// @function closestPointOnSegment(p: Point, p1: Point, p2: Point): Number\r
+// Returns the closest point from a point `p` on a segment `p1` to `p2`.\r
+function closestPointOnSegment(p, p1, p2) {\r
+       return _sqClosestPointOnSegment(p, p1, p2);\r
+}\r
+\r
+// Douglas-Peucker simplification, see http://en.wikipedia.org/wiki/Douglas-Peucker_algorithm\r
+function _simplifyDP(points, sqTolerance) {\r
+\r
+       var len = points.length,\r
+           ArrayConstructor = typeof Uint8Array !== undefined + '' ? Uint8Array : Array,\r
+           markers = new ArrayConstructor(len);\r
+\r
+           markers[0] = markers[len - 1] = 1;\r
+\r
+       _simplifyDPStep(points, markers, sqTolerance, 0, len - 1);\r
+\r
+       var i,\r
+           newPoints = [];\r
+\r
+       for (i = 0; i < len; i++) {\r
+               if (markers[i]) {\r
+                       newPoints.push(points[i]);\r
+               }\r
+       }\r
+\r
+       return newPoints;\r
+}\r
+\r
+function _simplifyDPStep(points, markers, sqTolerance, first, last) {\r
+\r
+       var maxSqDist = 0,\r
+       index, i, sqDist;\r
+\r
+       for (i = first + 1; i <= last - 1; i++) {\r
+               sqDist = _sqClosestPointOnSegment(points[i], points[first], points[last], true);\r
+\r
+               if (sqDist > maxSqDist) {\r
+                       index = i;\r
+                       maxSqDist = sqDist;\r
+               }\r
+       }\r
+\r
+       if (maxSqDist > sqTolerance) {\r
+               markers[index] = 1;\r
+\r
+               _simplifyDPStep(points, markers, sqTolerance, first, index);\r
+               _simplifyDPStep(points, markers, sqTolerance, index, last);\r
+       }\r
+}\r
+\r
+// reduce points that are too close to each other to a single point\r
+function _reducePoints(points, sqTolerance) {\r
+       var reducedPoints = [points[0]];\r
+\r
+       for (var i = 1, prev = 0, len = points.length; i < len; i++) {\r
+               if (_sqDist(points[i], points[prev]) > sqTolerance) {\r
+                       reducedPoints.push(points[i]);\r
+                       prev = i;\r
+               }\r
+       }\r
+       if (prev < len - 1) {\r
+               reducedPoints.push(points[len - 1]);\r
+       }\r
+       return reducedPoints;\r
+}\r
+\r
+var _lastCode;\r
+\r
+// @function clipSegment(a: Point, b: Point, bounds: Bounds, useLastCode?: Boolean, round?: Boolean): Point[]|Boolean\r
+// Clips the segment a to b by rectangular bounds with the\r
+// [Cohen-Sutherland algorithm](https://en.wikipedia.org/wiki/Cohen%E2%80%93Sutherland_algorithm)\r
+// (modifying the segment points directly!). Used by Leaflet to only show polyline\r
+// points that are on the screen or near, increasing performance.\r
+function clipSegment(a, b, bounds, useLastCode, round) {\r
+       var codeA = useLastCode ? _lastCode : _getBitCode(a, bounds),\r
+           codeB = _getBitCode(b, bounds),\r
+\r
+           codeOut, p, newCode;\r
+\r
+           // save 2nd code to avoid calculating it on the next segment\r
+           _lastCode = codeB;\r
+\r
+       while (true) {\r
+               // if a,b is inside the clip window (trivial accept)\r
+               if (!(codeA | codeB)) {\r
+                       return [a, b];\r
+               }\r
+\r
+               // if a,b is outside the clip window (trivial reject)\r
+               if (codeA & codeB) {\r
+                       return false;\r
+               }\r
+\r
+               // other cases\r
+               codeOut = codeA || codeB;\r
+               p = _getEdgeIntersection(a, b, codeOut, bounds, round);\r
+               newCode = _getBitCode(p, bounds);\r
+\r
+               if (codeOut === codeA) {\r
+                       a = p;\r
+                       codeA = newCode;\r
+               } else {\r
+                       b = p;\r
+                       codeB = newCode;\r
+               }\r
+       }\r
+}\r
+\r
+function _getEdgeIntersection(a, b, code, bounds, round) {\r
+       var dx = b.x - a.x,\r
+           dy = b.y - a.y,\r
+           min = bounds.min,\r
+           max = bounds.max,\r
+           x, y;\r
+\r
+       if (code & 8) { // top\r
+               x = a.x + dx * (max.y - a.y) / dy;\r
+               y = max.y;\r
+\r
+       } else if (code & 4) { // bottom\r
+               x = a.x + dx * (min.y - a.y) / dy;\r
+               y = min.y;\r
+\r
+       } else if (code & 2) { // right\r
+               x = max.x;\r
+               y = a.y + dy * (max.x - a.x) / dx;\r
+\r
+       } else if (code & 1) { // left\r
+               x = min.x;\r
+               y = a.y + dy * (min.x - a.x) / dx;\r
+       }\r
+\r
+       return new Point(x, y, round);\r
+}\r
+\r
+function _getBitCode(p, bounds) {\r
+       var code = 0;\r
+\r
+       if (p.x < bounds.min.x) { // left\r
+               code |= 1;\r
+       } else if (p.x > bounds.max.x) { // right\r
+               code |= 2;\r
+       }\r
+\r
+       if (p.y < bounds.min.y) { // bottom\r
+               code |= 4;\r
+       } else if (p.y > bounds.max.y) { // top\r
+               code |= 8;\r
+       }\r
+\r
+       return code;\r
+}\r
+\r
+// square distance (to avoid unnecessary Math.sqrt calls)\r
+function _sqDist(p1, p2) {\r
+       var dx = p2.x - p1.x,\r
+           dy = p2.y - p1.y;\r
+       return dx * dx + dy * dy;\r
+}\r
+\r
+// return closest point on segment or distance to that point\r
+function _sqClosestPointOnSegment(p, p1, p2, sqDist) {\r
+       var x = p1.x,\r
+           y = p1.y,\r
+           dx = p2.x - x,\r
+           dy = p2.y - y,\r
+           dot = dx * dx + dy * dy,\r
+           t;\r
+\r
+       if (dot > 0) {\r
+               t = ((p.x - x) * dx + (p.y - y) * dy) / dot;\r
+\r
+               if (t > 1) {\r
+                       x = p2.x;\r
+                       y = p2.y;\r
+               } else if (t > 0) {\r
+                       x += dx * t;\r
+                       y += dy * t;\r
+               }\r
+       }\r
+\r
+       dx = p.x - x;\r
+       dy = p.y - y;\r
+\r
+       return sqDist ? dx * dx + dy * dy : new Point(x, y);\r
+}\r
+\r
+\r
+// @function isFlat(latlngs: LatLng[]): Boolean\r
+// Returns true if `latlngs` is a flat array, false is nested.\r
+function isFlat(latlngs) {\r
+       return !isArray(latlngs[0]) || (typeof latlngs[0][0] !== 'object' && typeof latlngs[0][0] !== 'undefined');\r
+}\r
+\r
+function _flat(latlngs) {\r
+       console.warn('Deprecated use of _flat, please use L.LineUtil.isFlat instead.');\r
+       return isFlat(latlngs);\r
+}\r
+
+
+var LineUtil = (Object.freeze || Object)({
+       simplify: simplify,
+       pointToSegmentDistance: pointToSegmentDistance,
+       closestPointOnSegment: closestPointOnSegment,
+       clipSegment: clipSegment,
+       _getEdgeIntersection: _getEdgeIntersection,
+       _getBitCode: _getBitCode,
+       _sqClosestPointOnSegment: _sqClosestPointOnSegment,
+       isFlat: isFlat,
+       _flat: _flat
+});
+
+/*\r
+ * @namespace PolyUtil\r
+ * Various utility functions for polygon geometries.\r
+ */\r
+\r
+/* @function clipPolygon(points: Point[], bounds: Bounds, round?: Boolean): Point[]\r
+ * Clips the polygon geometry defined by the given `points` by the given bounds (using the [Sutherland-Hodgeman algorithm](https://en.wikipedia.org/wiki/Sutherland%E2%80%93Hodgman_algorithm)).\r
+ * Used by Leaflet to only show polygon points that are on the screen or near, increasing\r
+ * performance. Note that polygon points needs different algorithm for clipping\r
+ * than polyline, so there's a seperate method for it.\r
+ */\r
+function clipPolygon(points, bounds, round) {\r
+       var clippedPoints,\r
+           edges = [1, 4, 2, 8],\r
+           i, j, k,\r
+           a, b,\r
+           len, edge, p;\r
+\r
+       for (i = 0, len = points.length; i < len; i++) {\r
+               points[i]._code = _getBitCode(points[i], bounds);\r
+       }\r
+\r
+       // for each edge (left, bottom, right, top)\r
+       for (k = 0; k < 4; k++) {\r
+               edge = edges[k];\r
+               clippedPoints = [];\r
+\r
+               for (i = 0, len = points.length, j = len - 1; i < len; j = i++) {\r
+                       a = points[i];\r
+                       b = points[j];\r
+\r
+                       // if a is inside the clip window\r
+                       if (!(a._code & edge)) {\r
+                               // if b is outside the clip window (a->b goes out of screen)\r
+                               if (b._code & edge) {\r
+                                       p = _getEdgeIntersection(b, a, edge, bounds, round);\r
+                                       p._code = _getBitCode(p, bounds);\r
+                                       clippedPoints.push(p);\r
+                               }\r
+                               clippedPoints.push(a);\r
+\r
+                       // else if b is inside the clip window (a->b enters the screen)\r
+                       } else if (!(b._code & edge)) {\r
+                               p = _getEdgeIntersection(b, a, edge, bounds, round);\r
+                               p._code = _getBitCode(p, bounds);\r
+                               clippedPoints.push(p);\r
+                       }\r
+               }\r
+               points = clippedPoints;\r
+       }\r
+\r
+       return points;\r
+}\r
+
+
+var PolyUtil = (Object.freeze || Object)({
+       clipPolygon: clipPolygon
+});
+
+/*\r
+ * @namespace Projection\r
+ * @section\r
+ * Leaflet comes with a set of already defined Projections out of the box:\r
+ *\r
+ * @projection L.Projection.LonLat\r
+ *\r
+ * Equirectangular, or Plate Carree projection — the most simple projection,\r
+ * mostly used by GIS enthusiasts. Directly maps `x` as longitude, and `y` as\r
+ * latitude. Also suitable for flat worlds, e.g. game maps. Used by the\r
+ * `EPSG:4326` and `Simple` CRS.\r
+ */\r
+\r
+var LonLat = {\r
+       project: function (latlng) {\r
+               return new Point(latlng.lng, latlng.lat);\r
+       },\r
+\r
+       unproject: function (point) {\r
+               return new LatLng(point.y, point.x);\r
+       },\r
+\r
+       bounds: new Bounds([-180, -90], [180, 90])\r
+};
+
+/*\r
+ * @namespace Projection\r
+ * @projection L.Projection.Mercator\r
+ *\r
+ * Elliptical Mercator projection — more complex than Spherical Mercator. Takes into account that Earth is a geoid, not a perfect sphere. Used by the EPSG:3395 CRS.\r
+ */\r
+\r
+var Mercator = {\r
+       R: 6378137,\r
+       R_MINOR: 6356752.314245179,\r
+\r
+       bounds: new Bounds([-20037508.34279, -15496570.73972], [20037508.34279, 18764656.23138]),\r
+\r
+       project: function (latlng) {\r
+               var d = Math.PI / 180,\r
+                   r = this.R,\r
+                   y = latlng.lat * d,\r
+                   tmp = this.R_MINOR / r,\r
+                   e = Math.sqrt(1 - tmp * tmp),\r
+                   con = e * Math.sin(y);\r
+\r
+               var ts = Math.tan(Math.PI / 4 - y / 2) / Math.pow((1 - con) / (1 + con), e / 2);\r
+               y = -r * Math.log(Math.max(ts, 1E-10));\r
+\r
+               return new Point(latlng.lng * d * r, y);\r
+       },\r
+\r
+       unproject: function (point) {\r
+               var d = 180 / Math.PI,\r
+                   r = this.R,\r
+                   tmp = this.R_MINOR / r,\r
+                   e = Math.sqrt(1 - tmp * tmp),\r
+                   ts = Math.exp(-point.y / r),\r
+                   phi = Math.PI / 2 - 2 * Math.atan(ts);\r
+\r
+               for (var i = 0, dphi = 0.1, con; i < 15 && Math.abs(dphi) > 1e-7; i++) {\r
+                       con = e * Math.sin(phi);\r
+                       con = Math.pow((1 - con) / (1 + con), e / 2);\r
+                       dphi = Math.PI / 2 - 2 * Math.atan(ts * con) - phi;\r
+                       phi += dphi;\r
+               }\r
+\r
+               return new LatLng(phi * d, point.x * d / r);\r
+       }\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.
+
+ */
+
+
+
+
+var index = (Object.freeze || Object)({
+       LonLat: LonLat,
+       Mercator: Mercator,
+       SphericalMercator: SphericalMercator
+});
+
+/*\r
+ * @namespace CRS\r
+ * @crs L.CRS.EPSG3395\r
+ *\r
+ * Rarely used by some commercial tile providers. Uses Elliptical Mercator projection.\r
+ */\r
+var EPSG3395 = extend({}, Earth, {\r
+       code: 'EPSG:3395',\r
+       projection: Mercator,\r
+\r
+       transformation: (function () {\r
+               var scale = 0.5 / (Math.PI * Mercator.R);\r
+               return toTransformation(scale, 0.5, -scale, 0.5);\r
+       }())\r
+});
+
+/*\r
+ * @namespace CRS\r
+ * @crs L.CRS.EPSG4326\r
+ *\r
+ * A common CRS among GIS enthusiasts. Uses simple Equirectangular projection.\r
+ *\r
+ * Leaflet 1.0.x complies with the [TMS coordinate scheme for EPSG:4326](https://wiki.osgeo.org/wiki/Tile_Map_Service_Specification#global-geodetic),\r
+ * which is a breaking change from 0.7.x behaviour.  If you are using a `TileLayer`\r
+ * with this CRS, ensure that there are two 256x256 pixel tiles covering the\r
+ * whole earth at zoom level zero, and that the tile coordinate origin is (-180,+90),\r
+ * or (-180,-90) for `TileLayer`s with [the `tms` option](#tilelayer-tms) set.\r
+ */\r
+\r
+var EPSG4326 = extend({}, Earth, {\r
+       code: 'EPSG:4326',\r
+       projection: LonLat,\r
+       transformation: toTransformation(1 / 180, 1, -1 / 180, 0.5)\r
+});
+
+/*
+ * @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, describes the layer data, e.g. "© Mapbox".
+               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
+       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);
+               }
+       }
+});
+
+/*\r
+ * @class LayerGroup\r
+ * @aka L.LayerGroup\r
+ * @inherits Layer\r
+ *\r
+ * Used to group several layers and handle them as one. If you add it to the map,\r
+ * any layers added or removed from the group will be added/removed on the map as\r
+ * well. Extends `Layer`.\r
+ *\r
+ * @example\r
+ *\r
+ * ```js\r
+ * L.layerGroup([marker1, marker2])\r
+ *     .addLayer(polyline)\r
+ *     .addTo(map);\r
+ * ```\r
+ */\r
+\r
+var LayerGroup = Layer.extend({\r
+\r
+       initialize: function (layers) {\r
+               this._layers = {};\r
+\r
+               var i, len;\r
+\r
+               if (layers) {\r
+                       for (i = 0, len = layers.length; i < len; i++) {\r
+                               this.addLayer(layers[i]);\r
+                       }\r
+               }\r
+       },\r
+\r
+       // @method addLayer(layer: Layer): this\r
+       // Adds the given layer to the group.\r
+       addLayer: function (layer) {\r
+               var id = this.getLayerId(layer);\r
+\r
+               this._layers[id] = layer;\r
+\r
+               if (this._map) {\r
+                       this._map.addLayer(layer);\r
+               }\r
+\r
+               return this;\r
+       },\r
+\r
+       // @method removeLayer(layer: Layer): this\r
+       // Removes the given layer from the group.\r
+       // @alternative\r
+       // @method removeLayer(id: Number): this\r
+       // Removes the layer with the given internal ID from the group.\r
+       removeLayer: function (layer) {\r
+               var id = layer in this._layers ? layer : this.getLayerId(layer);\r
+\r
+               if (this._map && this._layers[id]) {\r
+                       this._map.removeLayer(this._layers[id]);\r
+               }\r
+\r
+               delete this._layers[id];\r
+\r
+               return this;\r
+       },\r
+\r
+       // @method hasLayer(layer: Layer): Boolean\r
+       // Returns `true` if the given layer is currently added to the group.\r
+       // @alternative\r
+       // @method hasLayer(id: Number): Boolean\r
+       // Returns `true` if the given internal ID is currently added to the group.\r
+       hasLayer: function (layer) {\r
+               return !!layer && (layer in this._layers || this.getLayerId(layer) in this._layers);\r
+       },\r
+\r
+       // @method clearLayers(): this\r
+       // Removes all the layers from the group.\r
+       clearLayers: function () {\r
+               for (var i in this._layers) {\r
+                       this.removeLayer(this._layers[i]);\r
+               }\r
+               return this;\r
+       },\r
+\r
+       // @method invoke(methodName: String, …): this\r
+       // Calls `methodName` on every layer contained in this group, passing any\r
+       // additional parameters. Has no effect if the layers contained do not\r
+       // implement `methodName`.\r
+       invoke: function (methodName) {\r
+               var args = Array.prototype.slice.call(arguments, 1),\r
+                   i, layer;\r
+\r
+               for (i in this._layers) {\r
+                       layer = this._layers[i];\r
+\r
+                       if (layer[methodName]) {\r
+                               layer[methodName].apply(layer, args);\r
+                       }\r
+               }\r
+\r
+               return this;\r
+       },\r
+\r
+       onAdd: function (map) {\r
+               for (var i in this._layers) {\r
+                       map.addLayer(this._layers[i]);\r
+               }\r
+       },\r
+\r
+       onRemove: function (map) {\r
+               for (var i in this._layers) {\r
+                       map.removeLayer(this._layers[i]);\r
+               }\r
+       },\r
+\r
+       // @method eachLayer(fn: Function, context?: Object): this\r
+       // Iterates over the layers of the group, optionally specifying context of the iterator function.\r
+       // ```js\r
+       // group.eachLayer(function (layer) {\r
+       //      layer.bindPopup('Hello');\r
+       // });\r
+       // ```\r
+       eachLayer: function (method, context) {\r
+               for (var i in this._layers) {\r
+                       method.call(context, this._layers[i]);\r
+               }\r
+               return this;\r
+       },\r
+\r
+       // @method getLayer(id: Number): Layer\r
+       // Returns the layer with the given internal ID.\r
+       getLayer: function (id) {\r
+               return this._layers[id];\r
+       },\r
+\r
+       // @method getLayers(): Layer[]\r
+       // Returns an array of all the layers added to the group.\r
+       getLayers: function () {\r
+               var layers = [];\r
+\r
+               for (var i in this._layers) {\r
+                       layers.push(this._layers[i]);\r
+               }\r
+               return layers;\r
+       },\r
+\r
+       // @method setZIndex(zIndex: Number): this\r
+       // Calls `setZIndex` on every layer contained in this group, passing the z-index.\r
+       setZIndex: function (zIndex) {\r
+               return this.invoke('setZIndex', zIndex);\r
+       },\r
+\r
+       // @method getLayerId(layer: Layer): Number\r
+       // Returns the internal ID for a layer\r
+       getLayerId: function (layer) {\r
+               return stamp(layer);\r
+       }\r
+});\r
+\r
+\r
+// @factory L.layerGroup(layers?: Layer[])\r
+// Create a layer group, optionally given an initial set of layers.\r
+var layerGroup = function (layers) {\r
+       return new LayerGroup(layers);\r
+};
+
+/*\r
+ * @class FeatureGroup\r
+ * @aka L.FeatureGroup\r
+ * @inherits LayerGroup\r
+ *\r
+ * Extended `LayerGroup` that makes it easier to do the same thing to all its member layers:\r
+ *  * [`bindPopup`](#layer-bindpopup) binds a popup to all of the layers at once (likewise with [`bindTooltip`](#layer-bindtooltip))\r
+ *  * Events are propagated to the `FeatureGroup`, so if the group has an event\r
+ * handler, it will handle events from any of the layers. This includes mouse events\r
+ * and custom events.\r
+ *  * Has `layeradd` and `layerremove` events\r
+ *\r
+ * @example\r
+ *\r
+ * ```js\r
+ * L.featureGroup([marker1, marker2, polyline])\r
+ *     .bindPopup('Hello world!')\r
+ *     .on('click', function() { alert('Clicked on a member of the group!'); })\r
+ *     .addTo(map);\r
+ * ```\r
+ */\r
+\r
+var FeatureGroup = LayerGroup.extend({\r
+\r
+       addLayer: function (layer) {\r
+               if (this.hasLayer(layer)) {\r
+                       return this;\r
+               }\r
+\r
+               layer.addEventParent(this);\r
+\r
+               LayerGroup.prototype.addLayer.call(this, layer);\r
+\r
+               // @event layeradd: LayerEvent\r
+               // Fired when a layer is added to this `FeatureGroup`\r
+               return this.fire('layeradd', {layer: layer});\r
+       },\r
+\r
+       removeLayer: function (layer) {\r
+               if (!this.hasLayer(layer)) {\r
+                       return this;\r
+               }\r
+               if (layer in this._layers) {\r
+                       layer = this._layers[layer];\r
+               }\r
+\r
+               layer.removeEventParent(this);\r
+\r
+               LayerGroup.prototype.removeLayer.call(this, layer);\r
+\r
+               // @event layerremove: LayerEvent\r
+               // Fired when a layer is removed from this `FeatureGroup`\r
+               return this.fire('layerremove', {layer: layer});\r
+       },\r
+\r
+       // @method setStyle(style: Path options): this\r
+       // Sets the given path options to each layer of the group that has a `setStyle` method.\r
+       setStyle: function (style) {\r
+               return this.invoke('setStyle', style);\r
+       },\r
+\r
+       // @method bringToFront(): this\r
+       // Brings the layer group to the top of all other layers\r
+       bringToFront: function () {\r
+               return this.invoke('bringToFront');\r
+       },\r
+\r
+       // @method bringToBack(): this\r
+       // Brings the layer group to the top of all other layers\r
+       bringToBack: function () {\r
+               return this.invoke('bringToBack');\r
+       },\r
+\r
+       // @method getBounds(): LatLngBounds\r
+       // Returns the LatLngBounds of the Feature Group (created from bounds and coordinates of its children).\r
+       getBounds: function () {\r
+               var bounds = new LatLngBounds();\r
+\r
+               for (var id in this._layers) {\r
+                       var layer = this._layers[id];\r
+                       bounds.extend(layer.getBounds ? layer.getBounds() : layer.getLatLng());\r
+               }\r
+               return bounds;\r
+       }\r
+});\r
+\r
+// @factory L.featureGroup(layers: Layer[])\r
+// Create a feature group, optionally given an initial set of layers.\r
+var featureGroup = function (layers) {\r
+       return new FeatureGroup(layers);\r
+};
+
+/*\r
+ * @class Icon\r
+ * @aka L.Icon\r
+ *\r
+ * Represents an icon to provide when creating a marker.\r
+ *\r
+ * @example\r
+ *\r
+ * ```js\r
+ * var myIcon = L.icon({\r
+ *     iconUrl: 'my-icon.png',\r