You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

355 lines
735 KiB
JavaScript

/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "./index.js");
/******/ })
/************************************************************************/
/******/ ({
/***/ "./index.js":
/*!******************!*\
!*** ./index.js ***!
\******************/
/*! no exports provided */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _src_map_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./src/map.js */ \"./src/map.js\");\n/* harmony import */ var _src_currentTile_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./src/currentTile.js */ \"./src/currentTile.js\");\n\n\n\n//# sourceURL=webpack:///./index.js?");
/***/ }),
/***/ "./node_modules/css-loader/dist/cjs.js!./node_modules/leaflet/dist/leaflet.css":
/*!*************************************************************************************!*\
!*** ./node_modules/css-loader/dist/cjs.js!./node_modules/leaflet/dist/leaflet.css ***!
\*************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("exports = module.exports = __webpack_require__(/*! ../../css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\")(false);\n// Imports\nvar urlEscape = __webpack_require__(/*! ../../css-loader/dist/runtime/url-escape.js */ \"./node_modules/css-loader/dist/runtime/url-escape.js\");\nvar ___CSS_LOADER_URL___0___ = urlEscape(__webpack_require__(/*! ./images/layers.png */ \"./node_modules/leaflet/dist/images/layers.png\"));\nvar ___CSS_LOADER_URL___1___ = urlEscape(__webpack_require__(/*! ./images/layers-2x.png */ \"./node_modules/leaflet/dist/images/layers-2x.png\"));\nvar ___CSS_LOADER_URL___2___ = urlEscape(__webpack_require__(/*! ./images/marker-icon.png */ \"./node_modules/leaflet/dist/images/marker-icon.png\"));\n\n// Module\nexports.push([module.i, \"/* required styles */\\r\\n\\r\\n.leaflet-pane,\\r\\n.leaflet-tile,\\r\\n.leaflet-marker-icon,\\r\\n.leaflet-marker-shadow,\\r\\n.leaflet-tile-container,\\r\\n.leaflet-pane > svg,\\r\\n.leaflet-pane > canvas,\\r\\n.leaflet-zoom-box,\\r\\n.leaflet-image-layer,\\r\\n.leaflet-layer {\\r\\n\\tposition: absolute;\\r\\n\\tleft: 0;\\r\\n\\ttop: 0;\\r\\n\\t}\\r\\n.leaflet-container {\\r\\n\\toverflow: hidden;\\r\\n\\t}\\r\\n.leaflet-tile,\\r\\n.leaflet-marker-icon,\\r\\n.leaflet-marker-shadow {\\r\\n\\t-webkit-user-select: none;\\r\\n\\t -moz-user-select: none;\\r\\n\\t user-select: none;\\r\\n\\t -webkit-user-drag: none;\\r\\n\\t}\\r\\n/* Safari renders non-retina tile on retina better with this, but Chrome is worse */\\r\\n.leaflet-safari .leaflet-tile {\\r\\n\\timage-rendering: -webkit-optimize-contrast;\\r\\n\\t}\\r\\n/* hack that prevents hw layers \\\"stretching\\\" when loading new tiles */\\r\\n.leaflet-safari .leaflet-tile-container {\\r\\n\\twidth: 1600px;\\r\\n\\theight: 1600px;\\r\\n\\t-webkit-transform-origin: 0 0;\\r\\n\\t}\\r\\n.leaflet-marker-icon,\\r\\n.leaflet-marker-shadow {\\r\\n\\tdisplay: block;\\r\\n\\t}\\r\\n/* .leaflet-container svg: reset svg max-width decleration shipped in Joomla! (joomla.org) 3.x */\\r\\n/* .leaflet-container img: map is broken in FF if you have max-width: 100% on tiles */\\r\\n.leaflet-container .leaflet-overlay-pane svg,\\r\\n.leaflet-container .leaflet-marker-pane img,\\r\\n.leaflet-container .leaflet-shadow-pane img,\\r\\n.leaflet-container .leaflet-tile-pane img,\\r\\n.leaflet-container img.leaflet-image-layer,\\r\\n.leaflet-container .leaflet-tile {\\r\\n\\tmax-width: none !important;\\r\\n\\tmax-height: none !important;\\r\\n\\t}\\r\\n\\r\\n.leaflet-container.leaflet-touch-zoom {\\r\\n\\t-ms-touch-action: pan-x pan-y;\\r\\n\\ttouch-action: pan-x pan-y;\\r\\n\\t}\\r\\n.leaflet-container.leaflet-touch-drag {\\r\\n\\t-ms-touch-action: pinch-zoom;\\r\\n\\t/* Fallback for FF which doesn't support pinch-zoom */\\r\\n\\ttouch-action: none;\\r\\n\\ttouch-action: pinch-zoom;\\r\\n}\\r\\n.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom {\\r\\n\\t-ms-touch-action: none;\\r\\n\\ttouch-action: none;\\r\\n}\\r\\n.leaflet-container {\\r\\n\\t-webkit-tap-highlight-color: transparent;\\r\\n}\\r\\n.leaflet-container a {\\r\\n\\t-webkit-tap-highlight-color: rgba(51, 181, 229, 0.4);\\r\\n}\\r\\n.leaflet-tile {\\r\\n\\tfilter: inherit;\\r\\n\\tvisibility: hidden;\\r\\n\\t}\\r\\n.leaflet-tile-loaded {\\r\\n\\tvisibility: inherit;\\r\\n\\t}\\r\\n.leaflet-zoom-box {\\r\\n\\twidth: 0;\\r\\n\\theight: 0;\\r\\n\\t-moz-box-sizing: border-box;\\r\\n\\t box-sizing: border-box;\\r\\n\\tz-index: 800;\\r\\n\\t}\\r\\n/* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=888319 */\\r\\n.leaflet-overlay-pane svg {\\r\\n\\t-moz-user-select: none;\\r\\n\\t}\\r\\n\\r\\n.leaflet-pane { z-index: 400; }\\r\\n\\r\\n.leaflet-tile-pane { z-index: 200; }\\r\\n.leaflet-overlay-pane { z-index: 400; }\\r\\n.leaflet-shadow-pane { z-index: 500; }\\r\\n.leaflet-marker-pane { z-index: 600; }\\r\\n.leaflet-tooltip-pane { z-index: 650; }\\r\\n.leaflet-popup-pane { z-index: 700; }\\r\\n\\r\\n.leaflet-map-pane canvas { z-index: 100; }\\r\\n.leaflet-map-pane svg { z-index: 200; }\\r\\n\\r\\n.leaflet-vml-shape {\\r\\n\\twidth: 1px;\\r\\n\\theight: 1px;\\r\\n\\t}\\r\\n.lvml {\\r\\n\\tbehavior: url(#default#VML);\\r\\n\\tdisplay: inline-block;\\r\\n\\tposition: absolute;\\r\\n\\t}\\r\\n\\r\\n\\r\\n/* control positioning */\\r\\n\\r\\n.leaflet-control {\\r\\n\\tposition: relative;\\r\\n\\tz-index: 800;\\r\\n\\tpointer-events: visiblePainted; /* IE 9-10 doesn't have auto */\\r\\n\\tpointer-events: auto;\\r\\n\\t}\\r\\n.leaflet-top,\\r\\n.leaflet-bottom {\\r\\n\\tposition: absolute;\\r\\n\\tz-index: 1000;\\r\\n\\tpointer-events: none;\\r\\n\\t}\\r\\n.leaflet-top {\\r\\n\\ttop: 0;\\r\\n\\t}\\r\\n.leaflet-right {\\r\\n\\tright: 0;\\r\\n\\t}\\r\\n.leaflet-bottom {\\r\\n\\tbottom: 0;\\r\\n\\t}\\r\\n.leaflet-left {\\r\\n\\tleft: 0;\\r\\n\\t}\\r\\n.leaflet-control {\\r\\n\\tfloat: left;\\r\\n\\tclear: both;\\r\\n\\t}\\r\\n.leaflet-right .leaflet-control {\\r\\n\\tfloat: right;\\r\\n\\t}\\r\\n.leaflet-top .leaflet-control {\\r\\n\\tmargin-top: 10px;\\r\\n\\t}\\r\\n.leaflet-bottom .leaflet-control {\\r\\n\\tmargin-bottom: 10px;\\r\\n\\t}\\r\\n.leaflet-left .leaflet-control {\\r\\n\\tmargin-left: 10px;\\r\\n\\t}\\r\\n.leaflet-right .leaflet-control {\\r\\n\\tmargin-right: 10px;\\r\\n\\t}\\r\\n\\r\\n\\r\\n/* zoom and fade animations */\\r\\n\\r\\n.leaflet-fade-anim .leaflet-tile {\\r\\n\\twill-change: opacity;\\r\\n\\t}\\r\\n.leaflet-fade-anim .leaflet-popup {\\r\\n\\topacity: 0;\\r\\n\\t-webkit-transition: opacity 0.2s linear;\\r\\n\\t -moz-transition: opacity 0.2s linear;\\r\\n\\t transition: opacity 0.2s linear;\\r\\n\\t}\\r\\n.leaflet-fade-anim .leaflet-map-pane .leaflet-popup {\\r\\n\\topacity: 1;\\r\\n\\t}\\r\\n.leaflet-zoom-animated {\\r\\n\\t-webkit-transform-origin: 0 0;\\r\\n\\t -ms-transform-origin: 0 0;\\r\\n\\t transform-origin: 0 0;\\r\\n\\t}\\r\\n.leaflet-zoom-anim .leaflet-zoom-animated {\\r\\n\\twill-change: transform;\\r\\n\\t}\\r\\n.leaflet-zoom-anim .leaflet-zoom-animated {\\r\\n\\t-webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1);\\r\\n\\t -moz-transition: -moz-transform 0.25s cubic-bezier(0,0,0.25,1);\\r\\n\\t transition: transform 0.25s cubic-bezier(0,0,0.25,1);\\r\\n\\t}\\r\\n.leaflet-zoom-anim .leaflet-tile,\\r\\n.leaflet-pan-anim .leaflet-tile {\\r\\n\\t-webkit-transition: none;\\r\\n\\t -moz-transition: none;\\r\\n\\t transition: none;\\r\\n\\t}\\r\\n\\r\\n.leaflet-zoom-anim .leaflet-zoom-hide {\\r\\n\\tvisibility: hidden;\\r\\n\\t}\\r\\n\\r\\n\\r\\n/* cursors */\\r\\n\\r\\n.leaflet-interactive {\\r\\n\\tcursor: pointer;\\r\\n\\t}\\r\\n.leaflet-grab {\\r\\n\\tcursor: -webkit-grab;\\r\\n\\tcursor: -moz-grab;\\r\\n\\tcursor: grab;\\r\\n\\t}\\r\\n.leaflet-crosshair,\\r\\n.leaflet-crosshair .leaflet-interactive {\\r\\n\\tcursor: crosshair;\\r\\n\\t}\\r\\n.leaflet-popup-pane,\\r\\n.leaflet-control {\\r\\n\\tcursor: auto;\\r\\n\\t}\\r\\n.leaflet-dragging .leaflet-grab,\\r\\n.leaflet-dragging .leaflet-grab .leaflet-interactive,\\r\\n.leaflet-dragging .leaflet-marker-draggable {\\r\\n\\tcursor: move;\\r\\n\\tcursor: -webkit-grabbing;\\r\\n\\tcursor: -moz-grabbing;\\r\\n\\tcursor: grabbing;\\r\\n\\t}\\r\\n\\r\\n/* marker & overlays interactivity */\\r\\n.leaflet-marker-icon,\\r\\n.leaflet-marker-shadow,\\r\\n.leaflet-image-layer,\\r\\n.leaflet-pane > svg path,\\r\\n.leaflet-tile-container {\\r\\n\\tpointer-events: none;\\r\\n\\t}\\r\\n\\r\\n.leaflet-marker-icon.leaflet-interactive,\\r\\n.leaflet-image-layer.leaflet-interactive,\\r\\n.leaflet-pane > svg path.leaflet-interactive {\\r\\n\\tpointer-events: visiblePainted; /* IE 9-10 doesn't have auto */\\r\\n\\tpointer-events: auto;\\r\\n\\t}\\r\\n\\r\\n/* visual tweaks */\\r\\n\\r\\n.leaflet-container {\\r\\n\\tbackground: #ddd;\\r\\n\\toutline: 0;\\r\\n\\t}\\r\\n.leaflet-container a {\\r\\n\\tcolor: #0078A8;\\r\\n\\t}\\r\\n.leaflet-container a.leaflet-active {\\r\\n\\toutline: 2px solid orange;\\r\\n\\t}\\r\\n.leaflet-zoom-box {\\r\\n\\tborder: 2px dotted #38f;\\r\\n\\tbackground: rgba(255,255,255,0.5);\\r\\n\\t}\\r\\n\\r\\n\\r\\n/* general typography */\\r\\n.leaflet-container {\\r\\n\\tfont: 12px/1.5 \\\"Helvetica Neue\\\", Arial, Helvetica, sans-serif;\\r\\n\\t}\\r\\n\\r\\n\\r\\n/* general toolbar styles */\\r\\n\\r\\n.leaflet-bar {\\r\\n\\tbox-shadow: 0 1px 5px rgba(0,0,0,0.65);\\r\\n\\tborder-radius: 4px;\\r\\n\\t}\\r\\n.leaflet-bar a,\\r\\n.leaflet-bar a:hover {\\r\\n\\tbackground-color: #fff;\\r\\n\\tborder-bottom: 1px solid #ccc;\\r\\n\\twidth: 26px;\\r\\n\\theight: 26px;\\r\\n\\tline-height: 26px;\\r\\n\\tdisplay: block;\\r\\n\\ttext-align: center;\\r\\n\\ttext-decoration: none;\\r\\n\\tcolor: black;\\r\\n\\t}\\r\\n.leaflet-bar a,\\r\\n.leaflet-control-layers-toggle {\\r\\n\\tbackground-position: 50% 50%;\\r\\n\\tbackground-repeat: no-repeat;\\r\\n\\tdisplay: block;\\r\\n\\t}\\r\\n.leaflet-bar a:hover {\\r\\n\\tbackground-color: #f4f4f4;\\r\\n\\t}\\r\\n.leaflet-bar a:first-child {\\r\\n\\tborder-top-left-radius: 4px;\\r\\n\\tborder-top-right-radius: 4px;\\r\\n\\t}\\r\\n.leaflet-bar a:last-child {\\r\\n\\tborder-bottom-left-radius: 4px;\\r\\n\\tborder-bottom-right-radius: 4px;\\r\\n\\tborder-bottom: none;\\r\\n\\t}\\r\\n.leaflet-bar a.leaflet-disabled {\\r\\n\\tcursor: default;\\r\\n\\tbackground-color: #f4f4f4;\\r\\n\\tcolor: #bbb;\\r\\n\\t}\\r\\n\\r\\n.leaflet-touch .leaflet-bar a {\\r\\n\\twidth: 30px;\\r\\n\\theight: 30px;\\r\\n\\tline-height: 30px;\\r\\n\\t}\\r\\n.leaflet-touch .leaflet-bar a:first-child {\\r\\n\\tborder-top-left-radius: 2px;\\r\\n\\tborder-top-right-radius: 2px;\\r\\n\\t}\\r\\n.leaflet-touch .leaflet-bar a:last-child {\\r\\n\\tborder-bottom-left-radius: 2px;\\r\\n\\tborder-bottom-right-radius: 2px;\\r\\n\\t}\\r\\n\\r\\n/* zoom control */\\r\\n\\r\\n.leaflet-control-zoom-in,\\r\\n.leaflet-control-zoom-out {\\r\\n\\tfont: bold 18px 'Lucida Console', Monaco, monospace;\\r\\n\\ttext-indent: 1px;\\r\\n\\t}\\r\\n\\r\\n.leaflet-touch .leaflet-control-zoom-in, .leaflet-touch .leaflet-control-zoom-out {\\r\\n\\tfont-size: 22px;\\r\\n\\t}\\r\\n\\r\\n\\r\\n/* layers control */\\r\\n\\r\\n.leaflet-control-layers {\\r\\n\\tbox-shadow: 0 1px 5px rgba(0,0,0,0.4);\\r\\n\\tbackground: #fff;\\r\\n\\tborder-radius: 5px;\\r\\n\\t}\\r\\n.leaflet-control-layers-toggle {\\r\\n\\tbackground-image: url(\" + ___CSS_LOADER_URL___0___ + \");\\r\\n\\twidth: 36px;\\r\\n\\theight: 36px;\\r\\n\\t}\\r\\n.leaflet-retina .leaflet-control-layers-toggle {\\r\\n\\tbackground-image: url(\" + ___CSS_LOADER_URL___1___ + \");\\r\\n\\tbackground-size: 26px 26px;\\r\\n\\t}\\r\\n.leaflet-touch .leaflet-control-layers-toggle {\\r\\n\\twidth: 44px;\\r\\n\\theight: 44px;\\r\\n\\t}\\r\\n.leaflet-control-layers .leaflet-control-layers-list,\\r\\n.leaflet-control-layers-expanded .leaflet-control-layers-toggle {\\r\\n\\tdisplay: none;\\r\\n\\t}\\r\\n.leaflet-control-layers-expanded .leaflet-control-layers-list {\\r\\n\\tdisplay: block;\\r\\n\\tposition: relative;\\r\\n\\t}\\r\\n.leaflet-control-layers-expanded {\\r\\n\\tpadding: 6px 10px 6px 6px;\\r\\n\\tcolor: #333;\\r\\n\\tbackground: #fff;\\r\\n\\t}\\r\\n.leaflet-control-layers-scrollbar {\\r\\n\\toverflow-y: scroll;\\r\\n\\toverflow-x: hidden;\\r\\n\\tpadding-right: 5px;\\r\\n\\t}\\r\\n.leaflet-control-layers-selector {\\r\\n\\tmargin-top: 2px;\\r\\n\\tposition: relative;\\r\\n\\ttop: 1px;\\r\\n\\t}\\r\\n.leaflet-control-layers label {\\r\\n\\tdisplay: block;\\r\\n\\t}\\r\\n.leaflet-control-layers-separator {\\r\\n\\theight: 0;\\r\\n\\tborder-top: 1px solid #ddd;\\r\\n\\tmargin: 5px -10px 5px -6px;\\r\\n\\t}\\r\\n\\r\\n/* Default icon URLs */\\r\\n.leaflet-default-icon-path {\\r\\n\\tbackground-image: url(\" + ___CSS_LOADER_URL___2___ + \");\\r\\n\\t}\\r\\n\\r\\n\\r\\n/* attribution and scale controls */\\r\\n\\r\\n.leaflet-container .leaflet-control-attribution {\\r\\n\\tbackground: #fff;\\r\\n\\tbackground: rgba(255, 255, 255, 0.7);\\r\\n\\tmargin: 0;\\r\\n\\t}\\r\\n.leaflet-control-attribution,\\r\\n.leaflet-control-scale-line {\\r\\n\\tpadding: 0 5px;\\r\\n\\tcolor: #333;\\r\\n\\t}\\r\\n.leaflet-control-attribution a {\\r\\n\\ttext-decoration: none;\\r\\n\\t}\\r\\n.leaflet-control-attribution a:hover {\\r\\n\\ttext-decoration: underline;\\r\\n\\t}\\r\\n.leaflet-container .leaflet-control-attribution,\\r\\n.leaflet-container .leaflet-control-scale {\\r\\n\\tfont-size: 11px;\\r\\n\\t}\\r\\n.leaflet-left .leaflet-control-scale {\\r\\n\\tmargin-left: 5px;\\r\\n\\t}\\r\\n.leaflet-bottom .leaflet-control-scale {\\r\\n\\tmargin-bottom: 5px;\\r\\n\\t}\\r\\n.leaflet-control-scale-line {\\r\\n\\tborder: 2px solid #777;\\r\\n\\tborder-top: none;\\r\\n\\tline-height: 1.1;\\r\\n\\tpadding: 2px 5px 1px;\\r\\n\\tfont-size: 11px;\\r\\n\\twhite-space: nowrap;\\r\\n\\toverflow: hidden;\\r\\n\\t-moz-box-sizing: border-box;\\r\\n\\t box-sizing: border-box;\\r\\n\\r\\n\\tbackground: #fff;\\r\\n\\tbackground: rgba(255, 255, 255, 0.5);\\r\\n\\t}\\r\\n.leaflet-control-scale-line:not(:first-child) {\\r\\n\\tborder-top: 2px solid #777;\\r\\n\\tborder-bottom: none;\\r\\n\\tmargin-top: -2px;\\r\\n\\t}\\r\\n.leaflet-control-scale-line:not(:first-child):not(:last-child) {\\r\\n\\tborder-bottom: 2px solid #777;\\r\\n\\t}\\r\\n\\r\\n.leaflet-touch .leaflet-control-attribution,\\r\\n.leaflet-touch .leaflet-control-layers,\\r\\n.leaflet-touch .leaflet-bar {\\r\\n\\tbox-shadow: none;\\r\\n\\t}\\r\\n.leaflet-touch .leaflet-control-layers,\\r\\n.leaflet-touch .leaflet-bar {\\r\\n\\tborder: 2px solid rgba(0,0,0,0.2);\\r\\n\\tbackground-clip: padding-box;\\r\\n\\t}\\r\\n\\r\\n\\r\\n/* popup */\\r\\n\\r\\n.leaflet-popup {\\r\\n\\tposition: absolute;\\r\\n\\ttext-align: center;\\r\\n\\tmargin-bottom: 20px;\\r\\n\\t}\\r\\n.leaflet-popup-content-wrapper {\\r\\n\\tpadding: 1px;\\r\\n\\ttext-align: left;\\r\\n\\tborder-radius: 12px;\\r\\n\\t}\\r\\n.leaflet-popup-content {\\r\\n\\tmargin: 13px 19px;\\r\\n\\tline-height: 1.4;\\r\\n\\t}\\r\\n.leaflet-popup-content p {\\r\\n\\tmargin: 18px 0;\\r\\n\\t}\\r\\n.leaflet-popup-tip-container {\\r\\n\\twidth: 40px;\\r\\n\\theight: 20px;\\r\\n\\tposition: absolute;\\r\\n\\tleft: 50%;\\r\\n\\tmargin-left: -20px;\\r\\n\\toverflow: hidden;\\r\\n\\tpointer-events: none;\\r\\n\\t}\\r\\n.leaflet-popup-tip {\\r\\n\\twidth: 17px;\\r\\n\\theight: 17px;\\r\\n\\tpadding: 1px;\\r\\n\\r\\n\\tmargin: -10px auto 0;\\r\\n\\r\\n\\t-webkit-transform: rotate(45deg);\\r\\n\\t -moz-transform: rotate(45deg);\\r\\n\\t -ms-transform: rotate(45deg);\\r\\n\\t transform: rotate(45deg);\\r\\n\\t}\\r\\n.leaflet-popup-content-wrapper,\\r\\n.leaflet-popup-tip {\\r\\n\\tbackground: white;\\r\\n\\tcolor: #333;\\r\\n\\tbox-shadow: 0 3px 14px rgba(0,0,0,0.4);\\r\\n\\t}\\r\\n.leaflet-container a.leaflet-popup-close-button {\\r\\n\\tposition: absolute;\\r\\n\\ttop: 0;\\r\\n\\tright: 0;\\r\\n\\tpadding: 4px 4px 0 0;\\r\\n\\tborder: none;\\r\\n\\ttext-align: center;\\r\\n\\twidth: 18px;\\r\\n\\theight: 14px;\\r\\n\\tfont: 16px/14px Tahoma, Verdana, sans-serif;\\r\\n\\tcolor: #c3c3c3;\\r\\n\\ttext-decoration: none;\\r\\n\\tfont-weight: bold;\\r\\n\\tbackground: transparent;\\r\\n\\t}\\r\\n.leaflet-container a.leaflet-popup-close-button:hover {\\r\\n\\tcolor: #999;\\r\\n\\t}\\r\\n.leaflet-popup-scrolled {\\r\\n\\toverflow: auto;\\r\\n\\tborder-bottom: 1px solid #ddd;\\r\\n\\tborder-top: 1px solid #ddd;\\r\\n\\t}\\r\\n\\r\\n.leaflet-oldie .leaflet-popup-content-wrapper {\\r\\n\\tzoom: 1;\\r\\n\\t}\\r\\n.leaflet-oldie .leaflet-popup-tip {\\r\\n\\twidth: 24px;\\r\\n\\tmargin: 0 auto;\\r\\n\\r\\n\\t-ms-filter: \\\"progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)\\\";\\r\\n\\tfilter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678);\\r\\n\\t}\\r\\n.leaflet-oldie .leaflet-popup-tip-container {\\r\\n\\tmargin-top: -1px;\\r\\n\\t}\\r\\n\\r\\n.leaflet-oldie .leaflet-control-zoom,\\r\\n.leaflet-oldie .leaflet-control-layers,\\r\\n.leaflet-oldie .leaflet-popup-content-wrapper,\\r\\n.leaflet-oldie .leaflet-popup-tip {\\r\\n\\tborder: 1px solid #999;\\r\\n\\t}\\r\\n\\r\\n\\r\\n/* div icon */\\r\\n\\r\\n.leaflet-div-icon {\\r\\n\\tbackground: #fff;\\r\\n\\tborder: 1px solid #666;\\r\\n\\t}\\r\\n\\r\\n\\r\\n/* Tooltip */\\r\\n/* Base styles for the element that has a tooltip */\\r\\n.leaflet-tooltip {\\r\\n\\tposition: absolute;\\r\\n\\tpadding: 6px;\\r\\n\\tbackground-color: #fff;\\r\\n\\tborder: 1px solid #fff;\\r\\n\\tborder-radius: 3px;\\r\\n\\tcolor: #222;\\r\\n\\twhite-space: nowrap;\\r\\n\\t-webkit-user-select: none;\\r\\n\\t-moz-user-select: none;\\r\\n\\t-ms-user-select: none;\\r\\n\\tuser-select: none;\\r\\n\\tpointer-events: none;\\r\\n\\tbox-shadow: 0 1px 3px rgba(0,0,0,0.4);\\r\\n\\t}\\r\\n.leaflet-tooltip.leaflet-clickable {\\r\\n\\tcursor: pointer;\\r\\n\\tpointer-events: auto;\\r\\n\\t}\\r\\n.leaflet-tooltip-top:before,\\r\\n.leaflet-tooltip-bottom:before,\\r\\n.leaflet-tooltip-left:before,\\r\\n.leaflet-tooltip-right:before {\\r\\n\\tposition: absolute;\\r\\n\\tpointer-events: none;\\r\\n\\tborder: 6px solid transparent;\\r\\n\\tbackground: transparent;\\r\\n\\tcontent: \\\"\\\";\\r\\n\\t}\\r\\n\\r\\n/* Directions */\\r\\n\\r\\n.leaflet-tooltip-bottom {\\r\\n\\tmargin-top: 6px;\\r\\n}\\r\\n.leaflet-tooltip-top {\\r\\n\\tmargin-top: -6px;\\r\\n}\\r\\n.leaflet-tooltip-bottom:before,\\r\\n.leaflet-tooltip-top:before {\\r\\n\\tleft: 50%;\\r\\n\\tmargin-left: -6px;\\r\\n\\t}\\r\\n.leaflet-tooltip-top:before {\\r\\n\\tbottom: 0;\\r\\n\\tmargin-bottom: -12px;\\r\\n\\tborder-top-color: #fff;\\r\\n\\t}\\r\\n.leaflet-tooltip-bottom:before {\\r\\n\\ttop: 0;\\r\\n\\tmargin-top: -12px;\\r\\n\\tmargin-left: -6px;\\r\\n\\tborder-bottom-color: #fff;\\r\\n\\t}\\r\\n.leaflet-tooltip-left {\\r\\n\\tmargin-left: -6px;\\r\\n}\\r\\n.leaflet-tooltip-right {\\r\\n\\tmargin-left: 6px;\\r\\n}\\r\\n.leaflet-tooltip-left:before,\\r\\n.leaflet-tooltip-right:before {\\r\\n\\ttop: 50%;\\r\\n\\tmargin-top: -6px;\\r\\n\\t}\\r\\n.leaflet-tooltip-left:before {\\r\\n\\tright: 0;\\r\\n\\tmargin-right: -12px;\\r\\n\\tborder-left-color: #fff;\\r\\n\\t}\\r\\n.leaflet-tooltip-right:before {\\r\\n\\tleft: 0;\\r\\n\\tmargin-left: -12px;\\r\\n\\tborder-right-color: #fff;\\r\\n\\t}\\r\\n\", \"\"]);\n\n\n\n//# sourceURL=webpack:///./node_modules/leaflet/dist/leaflet.css?./node_modules/css-loader/dist/cjs.js");
/***/ }),
/***/ "./node_modules/css-loader/dist/runtime/api.js":
/*!*****************************************************!*\
!*** ./node_modules/css-loader/dist/runtime/api.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n/*\n MIT License http://www.opensource.org/licenses/mit-license.php\n Author Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\n\nmodule.exports = function (useSourceMap) {\n var list = []; // return the list of modules as css string\n\n list.toString = function toString() {\n return this.map(function (item) {\n var content = cssWithMappingToString(item, useSourceMap);\n\n if (item[2]) {\n return '@media ' + item[2] + '{' + content + '}';\n } else {\n return content;\n }\n }).join('');\n }; // import a list of modules into the list\n\n\n list.i = function (modules, mediaQuery) {\n if (typeof modules === 'string') {\n modules = [[null, modules, '']];\n }\n\n var alreadyImportedModules = {};\n\n for (var i = 0; i < this.length; i++) {\n var id = this[i][0];\n\n if (id != null) {\n alreadyImportedModules[id] = true;\n }\n }\n\n for (i = 0; i < modules.length; i++) {\n var item = modules[i]; // skip already imported module\n // this implementation is not 100% perfect for weird media query combinations\n // when a module is imported multiple times with different media queries.\n // I hope this will never occur (Hey this way we have smaller bundles)\n\n if (item[0] == null || !alreadyImportedModules[item[0]]) {\n if (mediaQuery && !item[2]) {\n item[2] = mediaQuery;\n } else if (mediaQuery) {\n item[2] = '(' + item[2] + ') and (' + mediaQuery + ')';\n }\n\n list.push(item);\n }\n }\n };\n\n return list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n var content = item[1] || '';\n var cssMapping = item[3];\n\n if (!cssMapping) {\n return content;\n }\n\n if (useSourceMap && typeof btoa === 'function') {\n var sourceMapping = toComment(cssMapping);\n var sourceURLs = cssMapping.sources.map(function (source) {\n return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */';\n });\n return [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n }\n\n return [content].join('\\n');\n} // Adapted from convert-source-map (MIT)\n\n\nfunction toComment(sourceMap) {\n // eslint-disable-next-line no-undef\n var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n return '/*# ' + data + ' */';\n}\n\n//# sourceURL=webpack:///./node_modules/css-loader/dist/runtime/api.js?");
/***/ }),
/***/ "./node_modules/css-loader/dist/runtime/url-escape.js":
/*!************************************************************!*\
!*** ./node_modules/css-loader/dist/runtime/url-escape.js ***!
\************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\n\nmodule.exports = function escape(url, needQuotes) {\n if (typeof url !== 'string') {\n return url;\n } // If url is already wrapped in quotes, remove them\n\n\n if (/^['\"].*['\"]$/.test(url)) {\n url = url.slice(1, -1);\n } // Should url be wrapped?\n // See https://drafts.csswg.org/css-values-3/#urls\n\n\n if (/[\"'() \\t\\n]/.test(url) || needQuotes) {\n return '\"' + url.replace(/\"/g, '\\\\\"').replace(/\\n/g, '\\\\n') + '\"';\n }\n\n return url;\n};\n\n//# sourceURL=webpack:///./node_modules/css-loader/dist/runtime/url-escape.js?");
/***/ }),
/***/ "./node_modules/leaflet/dist/images/layers-2x.png":
/*!********************************************************!*\
!*** ./node_modules/leaflet/dist/images/layers-2x.png ***!
\********************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("module.exports = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAQAAABvcdNgAAAEsklEQVR4AWL4TydIhpZK1kpWOlg0w3ZXP6D2soBtG42jeI6ZmQTHzAxiTbSJsYLjO9HhP+WOmcuhciVnmHVQcJnp7DFvScowZorad/+V/fVzMdMT2g9Cv9guXGv/7pYOrXh2U+RRR3dSd9JRx6bIFc/ekqHI29JC6pJ5ZEh1yWkhkbcFeSjxgx3L2m1cb1C7bceyxA+CNjT/Ifff+/kDk2u/w/33/IeCMOSaWZ4glosqT3DNnNZQ7Cs58/3Ce5HL78iZH/vKVIaYlqzfdLu8Vi7dnvUbEza5Idt36tquZFldl6N5Z/POLof0XLK61mZCmJSWjVF9tEjUluu74IUXvgttuVIHE7YxSkaYhJZam7yiM9Pv82JYfl9nptxZaxMJE4YSPty+vF0+Y2up9d3wwijfjZbabqm/3bZ9ecKHsiGmRflnn1MW4pjHf9oLufyn2z3y1D6n8g8TZhxyzipLNPnAUpsOiuWimg52psrTZYnOWYNDTMuWBWa0tJb4rgq1UvmutpaYEbZlwU3CLJm/ayYjHW5/h7xWLn9Hh1vepDkyf7dE7MtT5LR4e7yYpHrkhOUpEfssBLq2pPhAqoSWKUkk7EDqkmK6RrCEzqDjhNDWNE+XSMvkJRDWlZTmCW0l0PHQGRZY5t1L83kT0Y3l2SItk5JAWHl2dCOBm+fPu3fo5/3v61RMCO9Jx2EEYYhb0rmNQMX/vm7gqOEJLcXTGw3CAuRNeyaPWwjR8PRqKQ1PDA/dpv+on9Shox52WFnx0KY8onHayrJzm87i5h9xGw/tfkev0jGsQizqezUKjk12hBMKJ4kbCqGPVNXudyyrShovGw5CgxsRICxF6aRmSjlBnHRzg7Gx8fKqEubI2rahQYdR1YgDIRQO7JvQyD52hoIQx0mxa0ODtW2Iozn1le2iIRdzwWewedyZzewidueOGqlsn1MvcnQpuVwLGG3/IR1hIKxCjelIDZ8ldqWz25jWAsnldEnK0Zxro19TGVb2ffIZEsIO89EIEDvKMPrzmBOQcKQ+rroye6NgRRxqR4U8EAkz0CL6uSGOm6KQCdWjvjRiSP1BPalCRS5iQYiEIvxuBMJEWgzSoHADcVMuN7IuqqTeyUPq22qFimFtxDyBBJEwNyt6TM88blFHao/6tWWhuuOM4SAK4EI4QmFHA+SEyWlp4EQoJ13cYGzMu7yszEIBOm2rVmHUNqwAIQabISNMRstmdhNWcFLsSm+0tjJH1MdRxO5Nx0WDMhCtgD6OKgZeljJqJKc9po8juskR9XN0Y1lZ3mWjLR9JCO1jRDMd0fpYC2VnvjBSEFg7wBENc0R9HFlb0xvF1+TBEpF68d+DHR6IOWVv2BECtxo46hOFUBd/APU57WIoEwJhIi2CdpyZX0m93BZicktMj1AS9dClteUFAUNUIEygRZCtik5zSxI9MubTBH1GOiHsiLJ3OCoSZkILa9PxiN0EbvhsAo8tdAf9Seepd36lGWHmtNANTv5Jd0z4QYyeo/UEJqxKRpg5LZx6btLPsOaEmdMyxYdlc8LMaJnikDlhclqmPiQnTEpLUIZEwkRagjYkEibQErwhkTAKCLQEbUgkzJQWc/0PstHHcfEdQ+UAAAAASUVORK5CYII=\"\n\n//# sourceURL=webpack:///./node_modules/leaflet/dist/images/layers-2x.png?");
/***/ }),
/***/ "./node_modules/leaflet/dist/images/layers.png":
/*!*****************************************************!*\
!*** ./node_modules/leaflet/dist/images/layers.png ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("module.exports = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAQAAAADQ4RFAAACf0lEQVR4AY1UM3gkARTePdvdoTxXKc+qTl3aU5U6b2Kbkz3Gtq3Zw6ziLGNPzrYx7946Tr6/ee/XeCQ4D3ykPtL5tHno4n0d/h3+xfuWHGLX81cn7r0iTNzjr7LrlxCqPtkbTQEHeqOrTy4Yyt3VCi/IOB0v7rVC7q45Q3Gr5K6jt+3Gl5nCoDD4MtO+j96Wu8atmhGqcNGHObuf8OM/x3AMx38+4Z2sPqzCxRFK2aF2e5Jol56XTLyggAMTL56XOMoS1W4pOyjUcGGQdZxU6qRh7B9Zp+PfpOFlqt0zyDZckPi1ttmIp03jX8gyJ8a/PG2yutpS/Vol7peZIbZcKBAEEheEIAgFbDkz5H6Zrkm2hVWGiXKiF4Ycw0RWKdtC16Q7qe3X4iOMxruonzegJzWaXFrU9utOSsLUmrc0YjeWYjCW4PDMADElpJSSQ0vQvA1Tm6/JlKnqFs1EGyZiFCqnRZTEJJJiKRYzVYzJck2Rm6P4iH+cmSY0YzimYa8l0EtTODFWhcMIMVqdsI2uiTvKmTisIDHJ3od5GILVhBCarCfVRmo4uTjkhrhzkiBV7SsaqS+TzrzM1qpGGUFt28pIySQHR6h7F6KSwGWm97ay+Z+ZqMcEjEWebE7wxCSQwpkhJqoZA5ivCdZDjJepuJ9IQjGGUmuXJdBFUygxVqVsxFsLMbDe8ZbDYVCGKxs+W080max1hFCarCfV+C1KATwcnvE9gRRuMP2prdbWGowm1KB1y+zwMMENkM755cJ2yPDtqhTI6ED1M/82yIDtC/4j4BijjeObflpO9I9MwXTCsSX8jWAFeHr05WoLTJ5G8IQVS/7vwR6ohirYM7f6HzYpogfS3R2OAAAAAElFTkSuQmCC\"\n\n//# sourceURL=webpack:///./node_modules/leaflet/dist/images/layers.png?");
/***/ }),
/***/ "./node_modules/leaflet/dist/images/marker-icon.png":
/*!**********************************************************!*\
!*** ./node_modules/leaflet/dist/images/marker-icon.png ***!
\**********************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("module.exports = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=\"\n\n//# sourceURL=webpack:///./node_modules/leaflet/dist/images/marker-icon.png?");
/***/ }),
/***/ "./node_modules/leaflet/dist/leaflet-src.js":
/*!**************************************************!*\
!*** ./node_modules/leaflet/dist/leaflet-src.js ***!
\**************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("/* @preserve\n * Leaflet 1.4.0, a JS library for interactive maps. http://leafletjs.com\n * (c) 2010-2018 Vladimir Agafonkin, (c) 2010-2011 CloudMade\n */\n(function (global, factory) {\n true ? factory(exports) : undefined;\n})(this, function (exports) {\n 'use strict';\n\n var version = \"1.4.0\";\n /*\r\n * @namespace Util\r\n *\r\n * Various utility functions, used by Leaflet internally.\r\n */\n\n var freeze = Object.freeze;\n\n Object.freeze = function (obj) {\n return obj;\n }; // @function extend(dest: Object, src?: Object): Object\n // Merges the properties of the `src` object (or multiple objects) into `dest` object and returns the latter. Has an `L.extend` shortcut.\n\n\n function extend(dest) {\n var i, j, len, src;\n\n for (j = 1, len = arguments.length; j < len; j++) {\n src = arguments[j];\n\n for (i in src) {\n dest[i] = src[i];\n }\n }\n\n return dest;\n } // @function create(proto: Object, properties?: Object): Object\n // Compatibility polyfill for [Object.create](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/create)\n\n\n var create = Object.create || function () {\n function F() {}\n\n return function (proto) {\n F.prototype = proto;\n return new F();\n };\n }(); // @function bind(fn: Function, …): Function\n // 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).\n // Has a `L.bind()` shortcut.\n\n\n function bind(fn, obj) {\n var slice = Array.prototype.slice;\n\n if (fn.bind) {\n return fn.bind.apply(fn, slice.call(arguments, 1));\n }\n\n var args = slice.call(arguments, 2);\n return function () {\n return fn.apply(obj, args.length ? args.concat(slice.call(arguments)) : arguments);\n };\n } // @property lastId: Number\n // Last unique ID used by [`stamp()`](#util-stamp)\n\n\n var lastId = 0; // @function stamp(obj: Object): Number\n // Returns the unique ID of an object, assigning it one if it doesn't have it.\n\n function stamp(obj) {\n /*eslint-disable */\n obj._leaflet_id = obj._leaflet_id || ++lastId;\n return obj._leaflet_id;\n /* eslint-enable */\n } // @function throttle(fn: Function, time: Number, context: Object): Function\n // Returns a function which executes function `fn` with the given scope `context`\n // (so that the `this` keyword refers to `context` inside `fn`'s code). The function\n // `fn` will be called no more than one time per given amount of `time`. The arguments\n // received by the bound function will be any arguments passed when binding the\n // function, followed by any arguments passed when invoking the bound function.\n // Has an `L.throttle` shortcut.\n\n\n function throttle(fn, time, context) {\n var lock, args, wrapperFn, later;\n\n later = function () {\n // reset lock and call if queued\n lock = false;\n\n if (args) {\n wrapperFn.apply(context, args);\n args = false;\n }\n };\n\n wrapperFn = function () {\n if (lock) {\n // called too soon, queue to call later\n args = arguments;\n } else {\n // call and lock until later\n fn.apply(context, arguments);\n setTimeout(later, time);\n lock = true;\n }\n };\n\n return wrapperFn;\n } // @function wrapNum(num: Number, range: Number[], includeMax?: Boolean): Number\n // Returns the number `num` modulo `range` in such a way so it lies within\n // `range[0]` and `range[1]`. The returned value will be always smaller than\n // `range[1]` unless `includeMax` is set to `true`.\n\n\n function wrapNum(x, range, includeMax) {\n var max = range[1],\n min = range[0],\n d = max - min;\n return x === max && includeMax ? x : ((x - min) % d + d) % d + min;\n } // @function falseFn(): Function\n // Returns a function which always returns `false`.\n\n\n function falseFn() {\n return false;\n } // @function formatNum(num: Number, digits?: Number): Number\n // Returns the number `num` rounded to `digits` decimals, or to 6 decimals by default.\n\n\n function formatNum(num, digits) {\n var pow = Math.pow(10, digits === undefined ? 6 : digits);\n return Math.round(num * pow) / pow;\n } // @function trim(str: String): String\n // Compatibility polyfill for [String.prototype.trim](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim)\n\n\n function trim(str) {\n return str.trim ? str.trim() : str.replace(/^\\s+|\\s+$/g, '');\n } // @function splitWords(str: String): String[]\n // Trims and splits the string on whitespace and returns the array of parts.\n\n\n function splitWords(str) {\n return trim(str).split(/\\s+/);\n } // @function setOptions(obj: Object, options: Object): Object\n // Merges the given properties to the `options` of the `obj` object, returning the resulting options. See `Class options`. Has an `L.setOptions` shortcut.\n\n\n function setOptions(obj, options) {\n if (!obj.hasOwnProperty('options')) {\n obj.options = obj.options ? create(obj.options) : {};\n }\n\n for (var i in options) {\n obj.options[i] = options[i];\n }\n\n return obj.options;\n } // @function getParamString(obj: Object, existingUrl?: String, uppercase?: Boolean): String\n // Converts an object into a parameter URL string, e.g. `{a: \"foo\", b: \"bar\"}`\n // translates to `'?a=foo&b=bar'`. If `existingUrl` is set, the parameters will\n // be appended at the end. If `uppercase` is `true`, the parameter names will\n // be uppercased (e.g. `'?A=foo&B=bar'`)\n\n\n function getParamString(obj, existingUrl, uppercase) {\n var params = [];\n\n for (var i in obj) {\n params.push(encodeURIComponent(uppercase ? i.toUpperCase() : i) + '=' + encodeURIComponent(obj[i]));\n }\n\n return (!existingUrl || existingUrl.indexOf('?') === -1 ? '?' : '&') + params.join('&');\n }\n\n var templateRe = /\\{ *([\\w_-]+) *\\}/g; // @function template(str: String, data: Object): String\n // Simple templating facility, accepts a template string of the form `'Hello {a}, {b}'`\n // and a data object like `{a: 'foo', b: 'bar'}`, returns evaluated string\n // `('Hello foo, bar')`. You can also specify functions instead of strings for\n // data values — they will be evaluated passing `data` as an argument.\n\n function template(str, data) {\n return str.replace(templateRe, function (str, key) {\n var value = data[key];\n\n if (value === undefined) {\n throw new Error('No value provided for variable ' + str);\n } else if (typeof value === 'function') {\n value = value(data);\n }\n\n return value;\n });\n } // @function isArray(obj): Boolean\n // Compatibility polyfill for [Array.isArray](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray)\n\n\n var isArray = Array.isArray || function (obj) {\n return Object.prototype.toString.call(obj) === '[object Array]';\n }; // @function indexOf(array: Array, el: Object): Number\n // Compatibility polyfill for [Array.prototype.indexOf](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf)\n\n\n function indexOf(array, el) {\n for (var i = 0; i < array.length; i++) {\n if (array[i] === el) {\n return i;\n }\n }\n\n return -1;\n } // @property emptyImageUrl: String\n // Data URI string containing a base64-encoded empty GIF image.\n // Used as a hack to free memory from unused images on WebKit-powered\n // mobile devices (by setting image `src` to this string).\n\n\n var emptyImageUrl = 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs='; // inspired by http://paulirish.com/2011/requestanimationframe-for-smart-animating/\n\n function getPrefixed(name) {\n return window['webkit' + name] || window['moz' + name] || window['ms' + name];\n }\n\n var lastTime = 0; // fallback for IE 7-8\n\n function timeoutDefer(fn) {\n var time = +new Date(),\n timeToCall = Math.max(0, 16 - (time - lastTime));\n lastTime = time + timeToCall;\n return window.setTimeout(fn, timeToCall);\n }\n\n var requestFn = window.requestAnimationFrame || getPrefixed('RequestAnimationFrame') || timeoutDefer;\n\n var cancelFn = window.cancelAnimationFrame || getPrefixed('CancelAnimationFrame') || getPrefixed('CancelRequestAnimationFrame') || function (id) {\n window.clearTimeout(id);\n }; // @function requestAnimFrame(fn: Function, context?: Object, immediate?: Boolean): Number\n // Schedules `fn` to be executed when the browser repaints. `fn` is bound to\n // `context` if given. When `immediate` is set, `fn` is called immediately if\n // the browser doesn't have native support for\n // [`window.requestAnimationFrame`](https://developer.mozilla.org/docs/Web/API/window/requestAnimationFrame),\n // otherwise it's delayed. Returns a request ID that can be used to cancel the request.\n\n\n function requestAnimFrame(fn, context, immediate) {\n if (immediate && requestFn === timeoutDefer) {\n fn.call(context);\n } else {\n return requestFn.call(window, bind(fn, context));\n }\n } // @function cancelAnimFrame(id: Number): undefined\n // Cancels a previous `requestAnimFrame`. See also [window.cancelAnimationFrame](https://developer.mozilla.org/docs/Web/API/window/cancelAnimationFrame).\n\n\n function cancelAnimFrame(id) {\n if (id) {\n cancelFn.call(window, id);\n }\n }\n\n var Util = (Object.freeze || Object)({\n freeze: freeze,\n extend: extend,\n create: create,\n bind: bind,\n lastId: lastId,\n stamp: stamp,\n throttle: throttle,\n wrapNum: wrapNum,\n falseFn: falseFn,\n formatNum: formatNum,\n trim: trim,\n splitWords: splitWords,\n setOptions: setOptions,\n getParamString: getParamString,\n template: template,\n isArray: isArray,\n indexOf: indexOf,\n emptyImageUrl: emptyImageUrl,\n requestFn: requestFn,\n cancelFn: cancelFn,\n requestAnimFrame: requestAnimFrame,\n cancelAnimFrame: cancelAnimFrame\n }); // @class Class\n // @aka L.Class\n // @section\n // @uninheritable\n // Thanks to John Resig and Dean Edwards for inspiration!\n\n function Class() {}\n\n Class.extend = function (props) {\n // @function extend(props: Object): Function\n // [Extends the current class](#class-inheritance) given the properties to be included.\n // Returns a Javascript function that is a class constructor (to be called with `new`).\n var NewClass = function () {\n // call the constructor\n if (this.initialize) {\n this.initialize.apply(this, arguments);\n } // call all constructor hooks\n\n\n this.callInitHooks();\n };\n\n var parentProto = NewClass.__super__ = this.prototype;\n var proto = create(parentProto);\n proto.constructor = NewClass;\n NewClass.prototype = proto; // inherit parent's statics\n\n for (var i in this) {\n if (this.hasOwnProperty(i) && i !== 'prototype' && i !== '__super__') {\n NewClass[i] = this[i];\n }\n } // mix static properties into the class\n\n\n if (props.statics) {\n extend(NewClass, props.statics);\n delete props.statics;\n } // mix includes into the prototype\n\n\n if (props.includes) {\n checkDeprecatedMixinEvents(props.includes);\n extend.apply(null, [proto].concat(props.includes));\n delete props.includes;\n } // merge options\n\n\n if (proto.options) {\n props.options = extend(create(proto.options), props.options);\n } // mix given properties into the prototype\n\n\n extend(proto, props);\n proto._initHooks = []; // add method for calling all hooks\n\n proto.callInitHooks = function () {\n if (this._initHooksCalled) {\n return;\n }\n\n if (parentProto.callInitHooks) {\n parentProto.callInitHooks.call(this);\n }\n\n this._initHooksCalled = true;\n\n for (var i = 0, len = proto._initHooks.length; i < len; i++) {\n proto._initHooks[i].call(this);\n }\n };\n\n return NewClass;\n }; // @function include(properties: Object): this\n // [Includes a mixin](#class-includes) into the current class.\n\n\n Class.include = function (props) {\n extend(this.prototype, props);\n return this;\n }; // @function mergeOptions(options: Object): this\n // [Merges `options`](#class-options) into the defaults of the class.\n\n\n Class.mergeOptions = function (options) {\n extend(this.prototype.options, options);\n return this;\n }; // @function addInitHook(fn: Function): this\n // Adds a [constructor hook](#class-constructor-hooks) to the class.\n\n\n Class.addInitHook = function (fn) {\n // (Function) || (String, args...)\n var args = Array.prototype.slice.call(arguments, 1);\n var init = typeof fn === 'function' ? fn : function () {\n this[fn].apply(this, args);\n };\n this.prototype._initHooks = this.prototype._initHooks || [];\n\n this.prototype._initHooks.push(init);\n\n return this;\n };\n\n function checkDeprecatedMixinEvents(includes) {\n if (typeof L === 'undefined' || !L || !L.Mixin) {\n return;\n }\n\n includes = isArray(includes) ? includes : [includes];\n\n for (var i = 0; i < includes.length; i++) {\n if (includes[i] === L.Mixin.Events) {\n console.warn('Deprecated include of L.Mixin.Events: ' + 'this property will be removed in future releases, ' + 'please inherit from L.Evented instead.', new Error().stack);\n }\n }\n }\n /*\r\n * @class Evented\r\n * @aka L.Evented\r\n * @inherits Class\r\n *\r\n * 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\n *\r\n * @example\r\n *\r\n * ```js\r\n * map.on('click', function(e) {\r\n * \talert(e.latlng);\r\n * } );\r\n * ```\r\n *\r\n * 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\n *\r\n * ```js\r\n * function onClick(e) { ... }\r\n *\r\n * map.on('click', onClick);\r\n * map.off('click', onClick);\r\n * ```\r\n */\n\n\n var Events = {\n /* @method on(type: String, fn: Function, context?: Object): this\r\n * 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\n *\r\n * @alternative\r\n * @method on(eventMap: Object): this\r\n * Adds a set of type/listener pairs, e.g. `{click: onClick, mousemove: onMouseMove}`\r\n */\n on: function (types, fn, context) {\n // types can be a map of types/handlers\n if (typeof types === 'object') {\n for (var type in types) {\n // we don't process space-separated events here for performance;\n // it's a hot path since Layer uses the on(obj) syntax\n this._on(type, types[type], fn);\n }\n } else {\n // types can be a string of space-separated words\n types = splitWords(types);\n\n for (var i = 0, len = types.length; i < len; i++) {\n this._on(types[i], fn, context);\n }\n }\n\n return this;\n },\n\n /* @method off(type: String, fn?: Function, context?: Object): this\r\n * 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\n *\r\n * @alternative\r\n * @method off(eventMap: Object): this\r\n * Removes a set of type/listener pairs.\r\n *\r\n * @alternative\r\n * @method off: this\r\n * Removes all listeners to all events on the object.\r\n */\n off: function (types, fn, context) {\n if (!types) {\n // clear all listeners if called without arguments\n delete this._events;\n } else if (typeof types === 'object') {\n for (var type in types) {\n this._off(type, types[type], fn);\n }\n } else {\n types = splitWords(types);\n\n for (var i = 0, len = types.length; i < len; i++) {\n this._off(types[i], fn, context);\n }\n }\n\n return this;\n },\n // attach listener (without syntactic sugar now)\n _on: function (type, fn, context) {\n this._events = this._events || {};\n /* get/init listeners for type */\n\n var typeListeners = this._events[type];\n\n if (!typeListeners) {\n typeListeners = [];\n this._events[type] = typeListeners;\n }\n\n if (context === this) {\n // Less memory footprint.\n context = undefined;\n }\n\n var newListener = {\n fn: fn,\n ctx: context\n },\n listeners = typeListeners; // check if fn already there\n\n for (var i = 0, len = listeners.length; i < len; i++) {\n if (listeners[i].fn === fn && listeners[i].ctx === context) {\n return;\n }\n }\n\n listeners.push(newListener);\n },\n _off: function (type, fn, context) {\n var listeners, i, len;\n\n if (!this._events) {\n return;\n }\n\n listeners = this._events[type];\n\n if (!listeners) {\n return;\n }\n\n if (!fn) {\n // Set all removed listeners to noop so they are not called if remove happens in fire\n for (i = 0, len = listeners.length; i < len; i++) {\n listeners[i].fn = falseFn;\n } // clear all listeners for a type if function isn't specified\n\n\n delete this._events[type];\n return;\n }\n\n if (context === this) {\n context = undefined;\n }\n\n if (listeners) {\n // find fn and remove it\n for (i = 0, len = listeners.length; i < len; i++) {\n var l = listeners[i];\n\n if (l.ctx !== context) {\n continue;\n }\n\n if (l.fn === fn) {\n // set the removed listener to noop so that's not called if remove happens in fire\n l.fn = falseFn;\n\n if (this._firingCount) {\n /* copy array in case events are being fired */\n this._events[type] = listeners = listeners.slice();\n }\n\n listeners.splice(i, 1);\n return;\n }\n }\n }\n },\n // @method fire(type: String, data?: Object, propagate?: Boolean): this\n // Fires an event of the specified type. You can optionally provide an data\n // object — the first argument of the listener function will contain its\n // properties. The event can optionally be propagated to event parents.\n fire: function (type, data, propagate) {\n if (!this.listens(type, propagate)) {\n return this;\n }\n\n var event = extend({}, data, {\n type: type,\n target: this,\n sourceTarget: data && data.sourceTarget || this\n });\n\n if (this._events) {\n var listeners = this._events[type];\n\n if (listeners) {\n this._firingCount = this._firingCount + 1 || 1;\n\n for (var i = 0, len = listeners.length; i < len; i++) {\n var l = listeners[i];\n l.fn.call(l.ctx || this, event);\n }\n\n this._firingCount--;\n }\n }\n\n if (propagate) {\n // propagate the event to parents (set with addEventParent)\n this._propagateEvent(event);\n }\n\n return this;\n },\n // @method listens(type: String): Boolean\n // Returns `true` if a particular event type has any listeners attached to it.\n listens: function (type, propagate) {\n var listeners = this._events && this._events[type];\n\n if (listeners && listeners.length) {\n return true;\n }\n\n if (propagate) {\n // also check parents for listeners if event propagates\n for (var id in this._eventParents) {\n if (this._eventParents[id].listens(type, propagate)) {\n return true;\n }\n }\n }\n\n return false;\n },\n // @method once(…): this\n // Behaves as [`on(…)`](#evented-on), except the listener will only get fired once and then removed.\n once: function (types, fn, context) {\n if (typeof types === 'object') {\n for (var type in types) {\n this.once(type, types[type], fn);\n }\n\n return this;\n }\n\n var handler = bind(function () {\n this.off(types, fn, context).off(types, handler, context);\n }, this); // add a listener that's executed once and removed after that\n\n return this.on(types, fn, context).on(types, handler, context);\n },\n // @method addEventParent(obj: Evented): this\n // Adds an event parent - an `Evented` that will receive propagated events\n addEventParent: function (obj) {\n this._eventParents = this._eventParents || {};\n this._eventParents[stamp(obj)] = obj;\n return this;\n },\n // @method removeEventParent(obj: Evented): this\n // Removes an event parent, so it will stop receiving propagated events\n removeEventParent: function (obj) {\n if (this._eventParents) {\n delete this._eventParents[stamp(obj)];\n }\n\n return this;\n },\n _propagateEvent: function (e) {\n for (var id in this._eventParents) {\n this._eventParents[id].fire(e.type, extend({\n layer: e.target,\n propagatedFrom: e.target\n }, e), true);\n }\n }\n }; // aliases; we should ditch those eventually\n // @method addEventListener(…): this\n // Alias to [`on(…)`](#evented-on)\n\n Events.addEventListener = Events.on; // @method removeEventListener(…): this\n // Alias to [`off(…)`](#evented-off)\n // @method clearAllEventListeners(…): this\n // Alias to [`off()`](#evented-off)\n\n Events.removeEventListener = Events.clearAllEventListeners = Events.off; // @method addOneTimeEventListener(…): this\n // Alias to [`once(…)`](#evented-once)\n\n Events.addOneTimeEventListener = Events.once; // @method fireEvent(…): this\n // Alias to [`fire(…)`](#evented-fire)\n\n Events.fireEvent = Events.fire; // @method hasEventListeners(…): Boolean\n // Alias to [`listens(…)`](#evented-listens)\n\n Events.hasEventListeners = Events.listens;\n var Evented = Class.extend(Events);\n /*\r\n * @class Point\r\n * @aka L.Point\r\n *\r\n * Represents a point with `x` and `y` coordinates in pixels.\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * var point = L.point(200, 300);\r\n * ```\r\n *\r\n * 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\n *\r\n * ```js\r\n * map.panBy([200, 300]);\r\n * map.panBy(L.point(200, 300));\r\n * ```\r\n *\r\n * Note that `Point` does not inherit from Leafet's `Class` object,\r\n * which means new classes can't inherit from it, and new methods\r\n * can't be added to it with the `include` function.\r\n */\n\n function Point(x, y, round) {\n // @property x: Number; The `x` coordinate of the point\n this.x = round ? Math.round(x) : x; // @property y: Number; The `y` coordinate of the point\n\n this.y = round ? Math.round(y) : y;\n }\n\n var trunc = Math.trunc || function (v) {\n return v > 0 ? Math.floor(v) : Math.ceil(v);\n };\n\n Point.prototype = {\n // @method clone(): Point\n // Returns a copy of the current point.\n clone: function () {\n return new Point(this.x, this.y);\n },\n // @method add(otherPoint: Point): Point\n // Returns the result of addition of the current and the given points.\n add: function (point) {\n // non-destructive, returns a new point\n return this.clone()._add(toPoint(point));\n },\n _add: function (point) {\n // destructive, used directly for performance in situations where it's safe to modify existing point\n this.x += point.x;\n this.y += point.y;\n return this;\n },\n // @method subtract(otherPoint: Point): Point\n // Returns the result of subtraction of the given point from the current.\n subtract: function (point) {\n return this.clone()._subtract(toPoint(point));\n },\n _subtract: function (point) {\n this.x -= point.x;\n this.y -= point.y;\n return this;\n },\n // @method divideBy(num: Number): Point\n // Returns the result of division of the current point by the given number.\n divideBy: function (num) {\n return this.clone()._divideBy(num);\n },\n _divideBy: function (num) {\n this.x /= num;\n this.y /= num;\n return this;\n },\n // @method multiplyBy(num: Number): Point\n // Returns the result of multiplication of the current point by the given number.\n multiplyBy: function (num) {\n return this.clone()._multiplyBy(num);\n },\n _multiplyBy: function (num) {\n this.x *= num;\n this.y *= num;\n return this;\n },\n // @method scaleBy(scale: Point): Point\n // Multiply each coordinate of the current point by each coordinate of\n // `scale`. In linear algebra terms, multiply the point by the\n // [scaling matrix](https://en.wikipedia.org/wiki/Scaling_%28geometry%29#Matrix_representation)\n // defined by `scale`.\n scaleBy: function (point) {\n return new Point(this.x * point.x, this.y * point.y);\n },\n // @method unscaleBy(scale: Point): Point\n // Inverse of `scaleBy`. Divide each coordinate of the current point by\n // each coordinate of `scale`.\n unscaleBy: function (point) {\n return new Point(this.x / point.x, this.y / point.y);\n },\n // @method round(): Point\n // Returns a copy of the current point with rounded coordinates.\n round: function () {\n return this.clone()._round();\n },\n _round: function () {\n this.x = Math.round(this.x);\n this.y = Math.round(this.y);\n return this;\n },\n // @method floor(): Point\n // Returns a copy of the current point with floored coordinates (rounded down).\n floor: function () {\n return this.clone()._floor();\n },\n _floor: function () {\n this.x = Math.floor(this.x);\n this.y = Math.floor(this.y);\n return this;\n },\n // @method ceil(): Point\n // Returns a copy of the current point with ceiled coordinates (rounded up).\n ceil: function () {\n return this.clone()._ceil();\n },\n _ceil: function () {\n this.x = Math.ceil(this.x);\n this.y = Math.ceil(this.y);\n return this;\n },\n // @method trunc(): Point\n // Returns a copy of the current point with truncated coordinates (rounded towards zero).\n trunc: function () {\n return this.clone()._trunc();\n },\n _trunc: function () {\n this.x = trunc(this.x);\n this.y = trunc(this.y);\n return this;\n },\n // @method distanceTo(otherPoint: Point): Number\n // Returns the cartesian distance between the current and the given points.\n distanceTo: function (point) {\n point = toPoint(point);\n var x = point.x - this.x,\n y = point.y - this.y;\n return Math.sqrt(x * x + y * y);\n },\n // @method equals(otherPoint: Point): Boolean\n // Returns `true` if the given point has the same coordinates.\n equals: function (point) {\n point = toPoint(point);\n return point.x === this.x && point.y === this.y;\n },\n // @method contains(otherPoint: Point): Boolean\n // Returns `true` if both coordinates of the given point are less than the corresponding current point coordinates (in absolute values).\n contains: function (point) {\n point = toPoint(point);\n return Math.abs(point.x) <= Math.abs(this.x) && Math.abs(point.y) <= Math.abs(this.y);\n },\n // @method toString(): String\n // Returns a string representation of the point for debugging purposes.\n toString: function () {\n return 'Point(' + formatNum(this.x) + ', ' + formatNum(this.y) + ')';\n }\n }; // @factory L.point(x: Number, y: Number, round?: Boolean)\n // Creates a Point object with the given `x` and `y` coordinates. If optional `round` is set to true, rounds the `x` and `y` values.\n // @alternative\n // @factory L.point(coords: Number[])\n // Expects an array of the form `[x, y]` instead.\n // @alternative\n // @factory L.point(coords: Object)\n // Expects a plain object of the form `{x: Number, y: Number}` instead.\n\n function toPoint(x, y, round) {\n if (x instanceof Point) {\n return x;\n }\n\n if (isArray(x)) {\n return new Point(x[0], x[1]);\n }\n\n if (x === undefined || x === null) {\n return x;\n }\n\n if (typeof x === 'object' && 'x' in x && 'y' in x) {\n return new Point(x.x, x.y);\n }\n\n return new Point(x, y, round);\n }\n /*\r\n * @class Bounds\r\n * @aka L.Bounds\r\n *\r\n * Represents a rectangular area in pixel coordinates.\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * var p1 = L.point(10, 10),\r\n * p2 = L.point(40, 60),\r\n * bounds = L.bounds(p1, p2);\r\n * ```\r\n *\r\n * 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\n *\r\n * ```js\r\n * otherBounds.intersects([[10, 10], [40, 60]]);\r\n * ```\r\n *\r\n * Note that `Bounds` does not inherit from Leafet's `Class` object,\r\n * which means new classes can't inherit from it, and new methods\r\n * can't be added to it with the `include` function.\r\n */\n\n\n function Bounds(a, b) {\n if (!a) {\n return;\n }\n\n var points = b ? [a, b] : a;\n\n for (var i = 0, len = points.length; i < len; i++) {\n this.extend(points[i]);\n }\n }\n\n Bounds.prototype = {\n // @method extend(point: Point): this\n // Extends the bounds to contain the given point.\n extend: function (point) {\n // (Point)\n point = toPoint(point); // @property min: Point\n // The top left corner of the rectangle.\n // @property max: Point\n // The bottom right corner of the rectangle.\n\n if (!this.min && !this.max) {\n this.min = point.clone();\n this.max = point.clone();\n } else {\n this.min.x = Math.min(point.x, this.min.x);\n this.max.x = Math.max(point.x, this.max.x);\n this.min.y = Math.min(point.y, this.min.y);\n this.max.y = Math.max(point.y, this.max.y);\n }\n\n return this;\n },\n // @method getCenter(round?: Boolean): Point\n // Returns the center point of the bounds.\n getCenter: function (round) {\n return new Point((this.min.x + this.max.x) / 2, (this.min.y + this.max.y) / 2, round);\n },\n // @method getBottomLeft(): Point\n // Returns the bottom-left point of the bounds.\n getBottomLeft: function () {\n return new Point(this.min.x, this.max.y);\n },\n // @method getTopRight(): Point\n // Returns the top-right point of the bounds.\n getTopRight: function () {\n // -> Point\n return new Point(this.max.x, this.min.y);\n },\n // @method getTopLeft(): Point\n // Returns the top-left point of the bounds (i.e. [`this.min`](#bounds-min)).\n getTopLeft: function () {\n return this.min; // left, top\n },\n // @method getBottomRight(): Point\n // Returns the bottom-right point of the bounds (i.e. [`this.max`](#bounds-max)).\n getBottomRight: function () {\n return this.max; // right, bottom\n },\n // @method getSize(): Point\n // Returns the size of the given bounds\n getSize: function () {\n return this.max.subtract(this.min);\n },\n // @method contains(otherBounds: Bounds): Boolean\n // Returns `true` if the rectangle contains the given one.\n // @alternative\n // @method contains(point: Point): Boolean\n // Returns `true` if the rectangle contains the given point.\n contains: function (obj) {\n var min, max;\n\n if (typeof obj[0] === 'number' || obj instanceof Point) {\n obj = toPoint(obj);\n } else {\n obj = toBounds(obj);\n }\n\n if (obj instanceof Bounds) {\n min = obj.min;\n max = obj.max;\n } else {\n min = max = obj;\n }\n\n return min.x >= this.min.x && max.x <= this.max.x && min.y >= this.min.y && max.y <= this.max.y;\n },\n // @method intersects(otherBounds: Bounds): Boolean\n // Returns `true` if the rectangle intersects the given bounds. Two bounds\n // intersect if they have at least one point in common.\n intersects: function (bounds) {\n // (Bounds) -> Boolean\n bounds = toBounds(bounds);\n var min = this.min,\n max = this.max,\n min2 = bounds.min,\n max2 = bounds.max,\n xIntersects = max2.x >= min.x && min2.x <= max.x,\n yIntersects = max2.y >= min.y && min2.y <= max.y;\n return xIntersects && yIntersects;\n },\n // @method overlaps(otherBounds: Bounds): Boolean\n // Returns `true` if the rectangle overlaps the given bounds. Two bounds\n // overlap if their intersection is an area.\n overlaps: function (bounds) {\n // (Bounds) -> Boolean\n bounds = toBounds(bounds);\n var min = this.min,\n max = this.max,\n min2 = bounds.min,\n max2 = bounds.max,\n xOverlaps = max2.x > min.x && min2.x < max.x,\n yOverlaps = max2.y > min.y && min2.y < max.y;\n return xOverlaps && yOverlaps;\n },\n isValid: function () {\n return !!(this.min && this.max);\n }\n }; // @factory L.bounds(corner1: Point, corner2: Point)\n // Creates a Bounds object from two corners coordinate pairs.\n // @alternative\n // @factory L.bounds(points: Point[])\n // Creates a Bounds object from the given array of points.\n\n function toBounds(a, b) {\n if (!a || a instanceof Bounds) {\n return a;\n }\n\n return new Bounds(a, b);\n }\n /*\r\n * @class LatLngBounds\r\n * @aka L.LatLngBounds\r\n *\r\n * Represents a rectangular geographical area on a map.\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * var corner1 = L.latLng(40.712, -74.227),\r\n * corner2 = L.latLng(40.774, -74.125),\r\n * bounds = L.latLngBounds(corner1, corner2);\r\n * ```\r\n *\r\n * 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\n *\r\n * ```js\r\n * map.fitBounds([\r\n * \t[40.712, -74.227],\r\n * \t[40.774, -74.125]\r\n * ]);\r\n * ```\r\n *\r\n * 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\n *\r\n * Note that `LatLngBounds` does not inherit from Leafet's `Class` object,\r\n * which means new classes can't inherit from it, and new methods\r\n * can't be added to it with the `include` function.\r\n */\n\n\n function LatLngBounds(corner1, corner2) {\n // (LatLng, LatLng) or (LatLng[])\n if (!corner1) {\n return;\n }\n\n var latlngs = corner2 ? [corner1, corner2] : corner1;\n\n for (var i = 0, len = latlngs.length; i < len; i++) {\n this.extend(latlngs[i]);\n }\n }\n\n LatLngBounds.prototype = {\n // @method extend(latlng: LatLng): this\n // Extend the bounds to contain the given point\n // @alternative\n // @method extend(otherBounds: LatLngBounds): this\n // Extend the bounds to contain the given bounds\n extend: function (obj) {\n var sw = this._southWest,\n ne = this._northEast,\n sw2,\n ne2;\n\n if (obj instanceof LatLng) {\n sw2 = obj;\n ne2 = obj;\n } else if (obj instanceof LatLngBounds) {\n sw2 = obj._southWest;\n ne2 = obj._northEast;\n\n if (!sw2 || !ne2) {\n return this;\n }\n } else {\n return obj ? this.extend(toLatLng(obj) || toLatLngBounds(obj)) : this;\n }\n\n if (!sw && !ne) {\n this._southWest = new LatLng(sw2.lat, sw2.lng);\n this._northEast = new LatLng(ne2.lat, ne2.lng);\n } else {\n sw.lat = Math.min(sw2.lat, sw.lat);\n sw.lng = Math.min(sw2.lng, sw.lng);\n ne.lat = Math.max(ne2.lat, ne.lat);\n ne.lng = Math.max(ne2.lng, ne.lng);\n }\n\n return this;\n },\n // @method pad(bufferRatio: Number): LatLngBounds\n // Returns bounds created by extending or retracting the current bounds by a given ratio in each direction.\n // For example, a ratio of 0.5 extends the bounds by 50% in each direction.\n // Negative values will retract the bounds.\n pad: function (bufferRatio) {\n var sw = this._southWest,\n ne = this._northEast,\n heightBuffer = Math.abs(sw.lat - ne.lat) * bufferRatio,\n widthBuffer = Math.abs(sw.lng - ne.lng) * bufferRatio;\n return new LatLngBounds(new LatLng(sw.lat - heightBuffer, sw.lng - widthBuffer), new LatLng(ne.lat + heightBuffer, ne.lng + widthBuffer));\n },\n // @method getCenter(): LatLng\n // Returns the center point of the bounds.\n getCenter: function () {\n return new LatLng((this._southWest.lat + this._northEast.lat) / 2, (this._southWest.lng + this._northEast.lng) / 2);\n },\n // @method getSouthWest(): LatLng\n // Returns the south-west point of the bounds.\n getSouthWest: function () {\n return this._southWest;\n },\n // @method getNorthEast(): LatLng\n // Returns the north-east point of the bounds.\n getNorthEast: function () {\n return this._northEast;\n },\n // @method getNorthWest(): LatLng\n // Returns the north-west point of the bounds.\n getNorthWest: function () {\n return new LatLng(this.getNorth(), this.getWest());\n },\n // @method getSouthEast(): LatLng\n // Returns the south-east point of the bounds.\n getSouthEast: function () {\n return new LatLng(this.getSouth(), this.getEast());\n },\n // @method getWest(): Number\n // Returns the west longitude of the bounds\n getWest: function () {\n return this._southWest.lng;\n },\n // @method getSouth(): Number\n // Returns the south latitude of the bounds\n getSouth: function () {\n return this._southWest.lat;\n },\n // @method getEast(): Number\n // Returns the east longitude of the bounds\n getEast: function () {\n return this._northEast.lng;\n },\n // @method getNorth(): Number\n // Returns the north latitude of the bounds\n getNorth: function () {\n return this._northEast.lat;\n },\n // @method contains(otherBounds: LatLngBounds): Boolean\n // Returns `true` if the rectangle contains the given one.\n // @alternative\n // @method contains (latlng: LatLng): Boolean\n // Returns `true` if the rectangle contains the given point.\n contains: function (obj) {\n // (LatLngBounds) or (LatLng) -> Boolean\n if (typeof obj[0] === 'number' || obj instanceof LatLng || 'lat' in obj) {\n obj = toLatLng(obj);\n } else {\n obj = toLatLngBounds(obj);\n }\n\n var sw = this._southWest,\n ne = this._northEast,\n sw2,\n ne2;\n\n if (obj instanceof LatLngBounds) {\n sw2 = obj.getSouthWest();\n ne2 = obj.getNorthEast();\n } else {\n sw2 = ne2 = obj;\n }\n\n return sw2.lat >= sw.lat && ne2.lat <= ne.lat && sw2.lng >= sw.lng && ne2.lng <= ne.lng;\n },\n // @method intersects(otherBounds: LatLngBounds): Boolean\n // Returns `true` if the rectangle intersects the given bounds. Two bounds intersect if they have at least one point in common.\n intersects: function (bounds) {\n bounds = toLatLngBounds(bounds);\n var sw = this._southWest,\n ne = this._northEast,\n sw2 = bounds.getSouthWest(),\n ne2 = bounds.getNorthEast(),\n latIntersects = ne2.lat >= sw.lat && sw2.lat <= ne.lat,\n lngIntersects = ne2.lng >= sw.lng && sw2.lng <= ne.lng;\n return latIntersects && lngIntersects;\n },\n // @method overlaps(otherBounds: Bounds): Boolean\n // Returns `true` if the rectangle overlaps the given bounds. Two bounds overlap if their intersection is an area.\n overlaps: function (bounds) {\n bounds = toLatLngBounds(bounds);\n var sw = this._southWest,\n ne = this._northEast,\n sw2 = bounds.getSouthWest(),\n ne2 = bounds.getNorthEast(),\n latOverlaps = ne2.lat > sw.lat && sw2.lat < ne.lat,\n lngOverlaps = ne2.lng > sw.lng && sw2.lng < ne.lng;\n return latOverlaps && lngOverlaps;\n },\n // @method toBBoxString(): String\n // 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.\n toBBoxString: function () {\n return [this.getWest(), this.getSouth(), this.getEast(), this.getNorth()].join(',');\n },\n // @method equals(otherBounds: LatLngBounds, maxMargin?: Number): Boolean\n // Returns `true` if the rectangle is equivalent (within a small margin of error) to the given bounds. The margin of error can be overridden by setting `maxMargin` to a small number.\n equals: function (bounds, maxMargin) {\n if (!bounds) {\n return false;\n }\n\n bounds = toLatLngBounds(bounds);\n return this._southWest.equals(bounds.getSouthWest(), maxMargin) && this._northEast.equals(bounds.getNorthEast(), maxMargin);\n },\n // @method isValid(): Boolean\n // Returns `true` if the bounds are properly initialized.\n isValid: function () {\n return !!(this._southWest && this._northEast);\n }\n }; // TODO International date line?\n // @factory L.latLngBounds(corner1: LatLng, corner2: LatLng)\n // Creates a `LatLngBounds` object by defining two diagonally opposite corners of the rectangle.\n // @alternative\n // @factory L.latLngBounds(latlngs: LatLng[])\n // 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).\n\n function toLatLngBounds(a, b) {\n if (a instanceof LatLngBounds) {\n return a;\n }\n\n return new LatLngBounds(a, b);\n }\n /* @class LatLng\r\n * @aka L.LatLng\r\n *\r\n * Represents a geographical point with a certain latitude and longitude.\r\n *\r\n * @example\r\n *\r\n * ```\r\n * var latlng = L.latLng(50.5, 30.5);\r\n * ```\r\n *\r\n * 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\n *\r\n * ```\r\n * map.panTo([50, 30]);\r\n * map.panTo({lon: 30, lat: 50});\r\n * map.panTo({lat: 50, lng: 30});\r\n * map.panTo(L.latLng(50, 30));\r\n * ```\r\n *\r\n * Note that `LatLng` does not inherit from Leaflet's `Class` object,\r\n * which means new classes can't inherit from it, and new methods\r\n * can't be added to it with the `include` function.\r\n */\n\n\n function LatLng(lat, lng, alt) {\n if (isNaN(lat) || isNaN(lng)) {\n throw new Error('Invalid LatLng object: (' + lat + ', ' + lng + ')');\n } // @property lat: Number\n // Latitude in degrees\n\n\n this.lat = +lat; // @property lng: Number\n // Longitude in degrees\n\n this.lng = +lng; // @property alt: Number\n // Altitude in meters (optional)\n\n if (alt !== undefined) {\n this.alt = +alt;\n }\n }\n\n LatLng.prototype = {\n // @method equals(otherLatLng: LatLng, maxMargin?: Number): Boolean\n // Returns `true` if the given `LatLng` point is at the same position (within a small margin of error). The margin of error can be overridden by setting `maxMargin` to a small number.\n equals: function (obj, maxMargin) {\n if (!obj) {\n return false;\n }\n\n obj = toLatLng(obj);\n var margin = Math.max(Math.abs(this.lat - obj.lat), Math.abs(this.lng - obj.lng));\n return margin <= (maxMargin === undefined ? 1.0E-9 : maxMargin);\n },\n // @method toString(): String\n // Returns a string representation of the point (for debugging purposes).\n toString: function (precision) {\n return 'LatLng(' + formatNum(this.lat, precision) + ', ' + formatNum(this.lng, precision) + ')';\n },\n // @method distanceTo(otherLatLng: LatLng): Number\n // Returns the distance (in meters) to the given `LatLng` calculated using the [Spherical Law of Cosines](https://en.wikipedia.org/wiki/Spherical_law_of_cosines).\n distanceTo: function (other) {\n return Earth.distance(this, toLatLng(other));\n },\n // @method wrap(): LatLng\n // Returns a new `LatLng` object with the longitude wrapped so it's always between -180 and +180 degrees.\n wrap: function () {\n return Earth.wrapLatLng(this);\n },\n // @method toBounds(sizeInMeters: Number): LatLngBounds\n // Returns a new `LatLngBounds` object in which each boundary is `sizeInMeters/2` meters apart from the `LatLng`.\n toBounds: function (sizeInMeters) {\n var latAccuracy = 180 * sizeInMeters / 40075017,\n lngAccuracy = latAccuracy / Math.cos(Math.PI / 180 * this.lat);\n return toLatLngBounds([this.lat - latAccuracy, this.lng - lngAccuracy], [this.lat + latAccuracy, this.lng + lngAccuracy]);\n },\n clone: function () {\n return new LatLng(this.lat, this.lng, this.alt);\n }\n }; // @factory L.latLng(latitude: Number, longitude: Number, altitude?: Number): LatLng\n // Creates an object representing a geographical point with the given latitude and longitude (and optionally altitude).\n // @alternative\n // @factory L.latLng(coords: Array): LatLng\n // Expects an array of the form `[Number, Number]` or `[Number, Number, Number]` instead.\n // @alternative\n // @factory L.latLng(coords: Object): LatLng\n // Expects an plain object of the form `{lat: Number, lng: Number}` or `{lat: Number, lng: Number, alt: Number}` instead.\n\n function toLatLng(a, b, c) {\n if (a instanceof LatLng) {\n return a;\n }\n\n if (isArray(a) && typeof a[0] !== 'object') {\n if (a.length === 3) {\n return new LatLng(a[0], a[1], a[2]);\n }\n\n if (a.length === 2) {\n return new LatLng(a[0], a[1]);\n }\n\n return null;\n }\n\n if (a === undefined || a === null) {\n return a;\n }\n\n if (typeof a === 'object' && 'lat' in a) {\n return new LatLng(a.lat, 'lng' in a ? a.lng : a.lon, a.alt);\n }\n\n if (b === undefined) {\n return null;\n }\n\n return new LatLng(a, b, c);\n }\n /*\r\n * @namespace CRS\r\n * @crs L.CRS.Base\r\n * Object that defines coordinate reference systems for projecting\r\n * geographical points into pixel (screen) coordinates and back (and to\r\n * coordinates in other units for [WMS](https://en.wikipedia.org/wiki/Web_Map_Service) services). See\r\n * [spatial reference system](http://en.wikipedia.org/wiki/Coordinate_reference_system).\r\n *\r\n * Leaflet defines the most usual CRSs by default. If you want to use a\r\n * CRS not defined by default, take a look at the\r\n * [Proj4Leaflet](https://github.com/kartena/Proj4Leaflet) plugin.\r\n *\r\n * Note that the CRS instances do not inherit from Leafet's `Class` object,\r\n * and can't be instantiated. Also, new classes can't inherit from them,\r\n * and methods can't be added to them with the `include` function.\r\n */\n\n\n var CRS = {\n // @method latLngToPoint(latlng: LatLng, zoom: Number): Point\n // Projects geographical coordinates into pixel coordinates for a given zoom.\n latLngToPoint: function (latlng, zoom) {\n var projectedPoint = this.projection.project(latlng),\n scale = this.scale(zoom);\n return this.transformation._transform(projectedPoint, scale);\n },\n // @method pointToLatLng(point: Point, zoom: Number): LatLng\n // The inverse of `latLngToPoint`. Projects pixel coordinates on a given\n // zoom into geographical coordinates.\n pointToLatLng: function (point, zoom) {\n var scale = this.scale(zoom),\n untransformedPoint = this.transformation.untransform(point, scale);\n return this.projection.unproject(untransformedPoint);\n },\n // @method project(latlng: LatLng): Point\n // Projects geographical coordinates into coordinates in units accepted for\n // this CRS (e.g. meters for EPSG:3857, for passing it to WMS services).\n project: function (latlng) {\n return this.projection.project(latlng);\n },\n // @method unproject(point: Point): LatLng\n // Given a projected coordinate returns the corresponding LatLng.\n // The inverse of `project`.\n unproject: function (point) {\n return this.projection.unproject(point);\n },\n // @method scale(zoom: Number): Number\n // Returns the scale used when transforming projected coordinates into\n // pixel coordinates for a particular zoom. For example, it returns\n // `256 * 2^zoom` for Mercator-based CRS.\n scale: function (zoom) {\n return 256 * Math.pow(2, zoom);\n },\n // @method zoom(scale: Number): Number\n // Inverse of `scale()`, returns the zoom level corresponding to a scale\n // factor of `scale`.\n zoom: function (scale) {\n return Math.log(scale / 256) / Math.LN2;\n },\n // @method getProjectedBounds(zoom: Number): Bounds\n // Returns the projection's bounds scaled and transformed for the provided `zoom`.\n getProjectedBounds: function (zoom) {\n if (this.infinite) {\n return null;\n }\n\n var b = this.projection.bounds,\n s = this.scale(zoom),\n min = this.transformation.transform(b.min, s),\n max = this.transformation.transform(b.max, s);\n return new Bounds(min, max);\n },\n // @method distance(latlng1: LatLng, latlng2: LatLng): Number\n // Returns the distance between two geographical coordinates.\n // @property code: String\n // Standard code name of the CRS passed into WMS services (e.g. `'EPSG:3857'`)\n //\n // @property wrapLng: Number[]\n // An array of two numbers defining whether the longitude (horizontal) coordinate\n // axis wraps around a given range and how. Defaults to `[-180, 180]` in most\n // geographical CRSs. If `undefined`, the longitude axis does not wrap around.\n //\n // @property wrapLat: Number[]\n // Like `wrapLng`, but for the latitude (vertical) axis.\n // wrapLng: [min, max],\n // wrapLat: [min, max],\n // @property infinite: Boolean\n // If true, the coordinate space will be unbounded (infinite in both axes)\n infinite: false,\n // @method wrapLatLng(latlng: LatLng): LatLng\n // Returns a `LatLng` where lat and lng has been wrapped according to the\n // CRS's `wrapLat` and `wrapLng` properties, if they are outside the CRS's bounds.\n wrapLatLng: function (latlng) {\n var lng = this.wrapLng ? wrapNum(latlng.lng, this.wrapLng, true) : latlng.lng,\n lat = this.wrapLat ? wrapNum(latlng.lat, this.wrapLat, true) : latlng.lat,\n alt = latlng.alt;\n return new LatLng(lat, lng, alt);\n },\n // @method wrapLatLngBounds(bounds: LatLngBounds): LatLngBounds\n // Returns a `LatLngBounds` with the same size as the given one, ensuring\n // that its center is within the CRS's bounds.\n // Only accepts actual `L.LatLngBounds` instances, not arrays.\n wrapLatLngBounds: function (bounds) {\n var center = bounds.getCenter(),\n newCenter = this.wrapLatLng(center),\n latShift = center.lat - newCenter.lat,\n lngShift = center.lng - newCenter.lng;\n\n if (latShift === 0 && lngShift === 0) {\n return bounds;\n }\n\n var sw = bounds.getSouthWest(),\n ne = bounds.getNorthEast(),\n newSw = new LatLng(sw.lat - latShift, sw.lng - lngShift),\n newNe = new LatLng(ne.lat - latShift, ne.lng - lngShift);\n return new LatLngBounds(newSw, newNe);\n }\n };\n /*\n * @namespace CRS\n * @crs L.CRS.Earth\n *\n * Serves as the base for CRS that are global such that they cover the earth.\n * Can only be used as the base for other CRS and cannot be used directly,\n * since it does not have a `code`, `projection` or `transformation`. `distance()` returns\n * meters.\n */\n\n var Earth = extend({}, CRS, {\n wrapLng: [-180, 180],\n // Mean Earth Radius, as recommended for use by\n // the International Union of Geodesy and Geophysics,\n // see http://rosettacode.org/wiki/Haversine_formula\n R: 6371000,\n // distance between two geographical points using spherical law of cosines approximation\n distance: function (latlng1, latlng2) {\n var rad = Math.PI / 180,\n lat1 = latlng1.lat * rad,\n lat2 = latlng2.lat * rad,\n sinDLat = Math.sin((latlng2.lat - latlng1.lat) * rad / 2),\n sinDLon = Math.sin((latlng2.lng - latlng1.lng) * rad / 2),\n a = sinDLat * sinDLat + Math.cos(lat1) * Math.cos(lat2) * sinDLon * sinDLon,\n c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n return this.R * c;\n }\n });\n /*\r\n * @namespace Projection\r\n * @projection L.Projection.SphericalMercator\r\n *\r\n * Spherical Mercator projection — the most common projection for online maps,\r\n * used by almost all free and commercial tile providers. Assumes that Earth is\r\n * a sphere. Used by the `EPSG:3857` CRS.\r\n */\n\n var SphericalMercator = {\n R: 6378137,\n MAX_LATITUDE: 85.0511287798,\n project: function (latlng) {\n var d = Math.PI / 180,\n max = this.MAX_LATITUDE,\n lat = Math.max(Math.min(max, latlng.lat), -max),\n sin = Math.sin(lat * d);\n return new Point(this.R * latlng.lng * d, this.R * Math.log((1 + sin) / (1 - sin)) / 2);\n },\n unproject: function (point) {\n var d = 180 / Math.PI;\n return new LatLng((2 * Math.atan(Math.exp(point.y / this.R)) - Math.PI / 2) * d, point.x * d / this.R);\n },\n bounds: function () {\n var d = 6378137 * Math.PI;\n return new Bounds([-d, -d], [d, d]);\n }()\n };\n /*\r\n * @class Transformation\r\n * @aka L.Transformation\r\n *\r\n * Represents an affine transformation: a set of coefficients `a`, `b`, `c`, `d`\r\n * for transforming a point of a form `(x, y)` into `(a*x + b, c*y + d)` and doing\r\n * the reverse. Used by Leaflet in its projections code.\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * var transformation = L.transformation(2, 5, -1, 10),\r\n * \tp = L.point(1, 2),\r\n * \tp2 = transformation.transform(p), // L.point(7, 8)\r\n * \tp3 = transformation.untransform(p2); // L.point(1, 2)\r\n * ```\r\n */\n // factory new L.Transformation(a: Number, b: Number, c: Number, d: Number)\n // Creates a `Transformation` object with the given coefficients.\n\n function Transformation(a, b, c, d) {\n if (isArray(a)) {\n // use array properties\n this._a = a[0];\n this._b = a[1];\n this._c = a[2];\n this._d = a[3];\n return;\n }\n\n this._a = a;\n this._b = b;\n this._c = c;\n this._d = d;\n }\n\n Transformation.prototype = {\n // @method transform(point: Point, scale?: Number): Point\n // Returns a transformed point, optionally multiplied by the given scale.\n // Only accepts actual `L.Point` instances, not arrays.\n transform: function (point, scale) {\n // (Point, Number) -> Point\n return this._transform(point.clone(), scale);\n },\n // destructive transform (faster)\n _transform: function (point, scale) {\n scale = scale || 1;\n point.x = scale * (this._a * point.x + this._b);\n point.y = scale * (this._c * point.y + this._d);\n return point;\n },\n // @method untransform(point: Point, scale?: Number): Point\n // Returns the reverse transformation of the given point, optionally divided\n // by the given scale. Only accepts actual `L.Point` instances, not arrays.\n untransform: function (point, scale) {\n scale = scale || 1;\n return new Point((point.x / scale - this._b) / this._a, (point.y / scale - this._d) / this._c);\n }\n }; // factory L.transformation(a: Number, b: Number, c: Number, d: Number)\n // @factory L.transformation(a: Number, b: Number, c: Number, d: Number)\n // Instantiates a Transformation object with the given coefficients.\n // @alternative\n // @factory L.transformation(coefficients: Array): Transformation\n // Expects an coefficients array of the form\n // `[a: Number, b: Number, c: Number, d: Number]`.\n\n function toTransformation(a, b, c, d) {\n return new Transformation(a, b, c, d);\n }\n /*\r\n * @namespace CRS\r\n * @crs L.CRS.EPSG3857\r\n *\r\n * The most common CRS for online maps, used by almost all free and commercial\r\n * tile providers. Uses Spherical Mercator projection. Set in by default in\r\n * Map's `crs` option.\r\n */\n\n\n var EPSG3857 = extend({}, Earth, {\n code: 'EPSG:3857',\n projection: SphericalMercator,\n transformation: function () {\n var scale = 0.5 / (Math.PI * SphericalMercator.R);\n return toTransformation(scale, 0.5, -scale, 0.5);\n }()\n });\n var EPSG900913 = extend({}, EPSG3857, {\n code: 'EPSG:900913'\n }); // @namespace SVG; @section\n // There are several static functions which can be called without instantiating L.SVG:\n // @function create(name: String): SVGElement\n // Returns a instance of [SVGElement](https://developer.mozilla.org/docs/Web/API/SVGElement),\n // corresponding to the class name passed. For example, using 'line' will return\n // an instance of [SVGLineElement](https://developer.mozilla.org/docs/Web/API/SVGLineElement).\n\n function svgCreate(name) {\n return document.createElementNS('http://www.w3.org/2000/svg', name);\n } // @function pointsToPath(rings: Point[], closed: Boolean): String\n // Generates a SVG path string for multiple rings, with each ring turning\n // into \"M..L..L..\" instructions\n\n\n function pointsToPath(rings, closed) {\n var str = '',\n i,\n j,\n len,\n len2,\n points,\n p;\n\n for (i = 0, len = rings.length; i < len; i++) {\n points = rings[i];\n\n for (j = 0, len2 = points.length; j < len2; j++) {\n p = points[j];\n str += (j ? 'L' : 'M') + p.x + ' ' + p.y;\n } // closes the ring for polygons; \"x\" is VML syntax\n\n\n str += closed ? svg ? 'z' : 'x' : '';\n } // SVG complains about empty path strings\n\n\n return str || 'M0 0';\n }\n /*\r\n * @namespace Browser\r\n * @aka L.Browser\r\n *\r\n * A namespace with static properties for browser/feature detection used by Leaflet internally.\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * if (L.Browser.ielt9) {\r\n * alert('Upgrade your browser, dude!');\r\n * }\r\n * ```\r\n */\n\n\n var style$1 = document.documentElement.style; // @property ie: Boolean; `true` for all Internet Explorer versions (not Edge).\n\n var ie = 'ActiveXObject' in window; // @property ielt9: Boolean; `true` for Internet Explorer versions less than 9.\n\n var ielt9 = ie && !document.addEventListener; // @property edge: Boolean; `true` for the Edge web browser.\n\n var edge = 'msLaunchUri' in navigator && !('documentMode' in document); // @property webkit: Boolean;\n // `true` for webkit-based browsers like Chrome and Safari (including mobile versions).\n\n var webkit = userAgentContains('webkit'); // @property android: Boolean\n // `true` for any browser running on an Android platform.\n\n var android = userAgentContains('android'); // @property android23: Boolean; `true` for browsers running on Android 2 or Android 3.\n\n var android23 = userAgentContains('android 2') || userAgentContains('android 3');\n /* See https://stackoverflow.com/a/17961266 for details on detecting stock Android */\n\n var webkitVer = parseInt(/WebKit\\/([0-9]+)|$/.exec(navigator.userAgent)[1], 10); // also matches AppleWebKit\n // @property androidStock: Boolean; `true` for the Android stock browser (i.e. not Chrome)\n\n var androidStock = android && userAgentContains('Google') && webkitVer < 537 && !('AudioNode' in window); // @property opera: Boolean; `true` for the Opera browser\n\n var opera = !!window.opera; // @property chrome: Boolean; `true` for the Chrome browser.\n\n var chrome = userAgentContains('chrome'); // @property gecko: Boolean; `true` for gecko-based browsers like Firefox.\n\n var gecko = userAgentContains('gecko') && !webkit && !opera && !ie; // @property safari: Boolean; `true` for the Safari browser.\n\n var safari = !chrome && userAgentContains('safari');\n var phantom = userAgentContains('phantom'); // @property opera12: Boolean\n // `true` for the Opera browser supporting CSS transforms (version 12 or later).\n\n var opera12 = 'OTransition' in style$1; // @property win: Boolean; `true` when the browser is running in a Windows platform\n\n var win = navigator.platform.indexOf('Win') === 0; // @property ie3d: Boolean; `true` for all Internet Explorer versions supporting CSS transforms.\n\n var ie3d = ie && 'transition' in style$1; // @property webkit3d: Boolean; `true` for webkit-based browsers supporting CSS transforms.\n\n var webkit3d = 'WebKitCSSMatrix' in window && 'm11' in new window.WebKitCSSMatrix() && !android23; // @property gecko3d: Boolean; `true` for gecko-based browsers supporting CSS transforms.\n\n var gecko3d = 'MozPerspective' in style$1; // @property any3d: Boolean\n // `true` for all browsers supporting CSS transforms.\n\n var any3d = !window.L_DISABLE_3D && (ie3d || webkit3d || gecko3d) && !opera12 && !phantom; // @property mobile: Boolean; `true` for all browsers running in a mobile device.\n\n var mobile = typeof orientation !== 'undefined' || userAgentContains('mobile'); // @property mobileWebkit: Boolean; `true` for all webkit-based browsers in a mobile device.\n\n var mobileWebkit = mobile && webkit; // @property mobileWebkit3d: Boolean\n // `true` for all webkit-based browsers in a mobile device supporting CSS transforms.\n\n var mobileWebkit3d = mobile && webkit3d; // @property msPointer: Boolean\n // `true` for browsers implementing the Microsoft touch events model (notably IE10).\n\n var msPointer = !window.PointerEvent && window.MSPointerEvent; // @property pointer: Boolean\n // `true` for all browsers supporting [pointer events](https://msdn.microsoft.com/en-us/library/dn433244%28v=vs.85%29.aspx).\n\n var pointer = !!(window.PointerEvent || msPointer); // @property touch: Boolean\n // `true` for all browsers supporting [touch events](https://developer.mozilla.org/docs/Web/API/Touch_events).\n // This does not necessarily mean that the browser is running in a computer with\n // a touchscreen, it only means that the browser is capable of understanding\n // touch events.\n\n var touch = !window.L_NO_TOUCH && (pointer || 'ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch); // @property mobileOpera: Boolean; `true` for the Opera browser in a mobile device.\n\n var mobileOpera = mobile && opera; // @property mobileGecko: Boolean\n // `true` for gecko-based browsers running in a mobile device.\n\n var mobileGecko = mobile && gecko; // @property retina: Boolean\n // `true` for browsers on a high-resolution \"retina\" screen or on any screen when browser's display zoom is more than 100%.\n\n var retina = (window.devicePixelRatio || window.screen.deviceXDPI / window.screen.logicalXDPI) > 1; // @property canvas: Boolean\n // `true` when the browser supports [`<canvas>`](https://developer.mozilla.org/docs/Web/API/Canvas_API).\n\n var canvas = function () {\n return !!document.createElement('canvas').getContext;\n }(); // @property svg: Boolean\n // `true` when the browser supports [SVG](https://developer.mozilla.org/docs/Web/SVG).\n\n\n var svg = !!(document.createElementNS && svgCreate('svg').createSVGRect); // @property vml: Boolean\n // `true` if the browser supports [VML](https://en.wikipedia.org/wiki/Vector_Markup_Language).\n\n var vml = !svg && function () {\n try {\n var div = document.createElement('div');\n div.innerHTML = '<v:shape adj=\"1\"/>';\n var shape = div.firstChild;\n shape.style.behavior = 'url(#default#VML)';\n return shape && typeof shape.adj === 'object';\n } catch (e) {\n return false;\n }\n }();\n\n function userAgentContains(str) {\n return navigator.userAgent.toLowerCase().indexOf(str) >= 0;\n }\n\n var Browser = (Object.freeze || Object)({\n ie: ie,\n ielt9: ielt9,\n edge: edge,\n webkit: webkit,\n android: android,\n android23: android23,\n androidStock: androidStock,\n opera: opera,\n chrome: chrome,\n gecko: gecko,\n safari: safari,\n phantom: phantom,\n opera12: opera12,\n win: win,\n ie3d: ie3d,\n webkit3d: webkit3d,\n gecko3d: gecko3d,\n any3d: any3d,\n mobile: mobile,\n mobileWebkit: mobileWebkit,\n mobileWebkit3d: mobileWebkit3d,\n msPointer: msPointer,\n pointer: pointer,\n touch: touch,\n mobileOpera: mobileOpera,\n mobileGecko: mobileGecko,\n retina: retina,\n canvas: canvas,\n svg: svg,\n vml: vml\n });\n /*\n * Extends L.DomEvent to provide touch support for Internet Explorer and Windows-based devices.\n */\n\n var POINTER_DOWN = msPointer ? 'MSPointerDown' : 'pointerdown';\n var POINTER_MOVE = msPointer ? 'MSPointerMove' : 'pointermove';\n var POINTER_UP = msPointer ? 'MSPointerUp' : 'pointerup';\n var POINTER_CANCEL = msPointer ? 'MSPointerCancel' : 'pointercancel';\n var TAG_WHITE_LIST = ['INPUT', 'SELECT', 'OPTION'];\n var _pointers = {};\n var _pointerDocListener = false; // DomEvent.DoubleTap needs to know about this\n\n var _pointersCount = 0; // Provides a touch events wrapper for (ms)pointer events.\n // ref http://www.w3.org/TR/pointerevents/ https://www.w3.org/Bugs/Public/show_bug.cgi?id=22890\n\n function addPointerListener(obj, type, handler, id) {\n if (type === 'touchstart') {\n _addPointerStart(obj, handler, id);\n } else if (type === 'touchmove') {\n _addPointerMove(obj, handler, id);\n } else if (type === 'touchend') {\n _addPointerEnd(obj, handler, id);\n }\n\n return this;\n }\n\n function removePointerListener(obj, type, id) {\n var handler = obj['_leaflet_' + type + id];\n\n if (type === 'touchstart') {\n obj.removeEventListener(POINTER_DOWN, handler, false);\n } else if (type === 'touchmove') {\n obj.removeEventListener(POINTER_MOVE, handler, false);\n } else if (type === 'touchend') {\n obj.removeEventListener(POINTER_UP, handler, false);\n obj.removeEventListener(POINTER_CANCEL, handler, false);\n }\n\n return this;\n }\n\n function _addPointerStart(obj, handler, id) {\n var onDown = bind(function (e) {\n if (e.pointerType !== 'mouse' && e.MSPOINTER_TYPE_MOUSE && e.pointerType !== e.MSPOINTER_TYPE_MOUSE) {\n // In IE11, some touch events needs to fire for form controls, or\n // the controls will stop working. We keep a whitelist of tag names that\n // need these events. For other target tags, we prevent default on the event.\n if (TAG_WHITE_LIST.indexOf(e.target.tagName) < 0) {\n preventDefault(e);\n } else {\n return;\n }\n }\n\n _handlePointer(e, handler);\n });\n obj['_leaflet_touchstart' + id] = onDown;\n obj.addEventListener(POINTER_DOWN, onDown, false); // need to keep track of what pointers and how many are active to provide e.touches emulation\n\n if (!_pointerDocListener) {\n // we listen documentElement as any drags that end by moving the touch off the screen get fired there\n document.documentElement.addEventListener(POINTER_DOWN, _globalPointerDown, true);\n document.documentElement.addEventListener(POINTER_MOVE, _globalPointerMove, true);\n document.documentElement.addEventListener(POINTER_UP, _globalPointerUp, true);\n document.documentElement.addEventListener(POINTER_CANCEL, _globalPointerUp, true);\n _pointerDocListener = true;\n }\n }\n\n function _globalPointerDown(e) {\n _pointers[e.pointerId] = e;\n _pointersCount++;\n }\n\n function _globalPointerMove(e) {\n if (_pointers[e.pointerId]) {\n _pointers[e.pointerId] = e;\n }\n }\n\n function _globalPointerUp(e) {\n delete _pointers[e.pointerId];\n _pointersCount--;\n }\n\n function _handlePointer(e, handler) {\n e.touches = [];\n\n for (var i in _pointers) {\n e.touches.push(_pointers[i]);\n }\n\n e.changedTouches = [e];\n handler(e);\n }\n\n function _addPointerMove(obj, handler, id) {\n var onMove = function (e) {\n // don't fire touch moves when mouse isn't down\n if ((e.pointerType === e.MSPOINTER_TYPE_MOUSE || e.pointerType === 'mouse') && e.buttons === 0) {\n return;\n }\n\n _handlePointer(e, handler);\n };\n\n obj['_leaflet_touchmove' + id] = onMove;\n obj.addEventListener(POINTER_MOVE, onMove, false);\n }\n\n function _addPointerEnd(obj, handler, id) {\n var onUp = function (e) {\n _handlePointer(e, handler);\n };\n\n obj['_leaflet_touchend' + id] = onUp;\n obj.addEventListener(POINTER_UP, onUp, false);\n obj.addEventListener(POINTER_CANCEL, onUp, false);\n }\n /*\r\n * Extends the event handling code with double tap support for mobile browsers.\r\n */\n\n\n var _touchstart = msPointer ? 'MSPointerDown' : pointer ? 'pointerdown' : 'touchstart';\n\n var _touchend = msPointer ? 'MSPointerUp' : pointer ? 'pointerup' : 'touchend';\n\n var _pre = '_leaflet_'; // inspired by Zepto touch code by Thomas Fuchs\n\n function addDoubleTapListener(obj, handler, id) {\n var last,\n touch$$1,\n doubleTap = false,\n delay = 250;\n\n function onTouchStart(e) {\n var count;\n\n if (pointer) {\n if (!edge || e.pointerType === 'mouse') {\n return;\n }\n\n count = _pointersCount;\n } else {\n count = e.touches.length;\n }\n\n if (count > 1) {\n return;\n }\n\n var now = Date.now(),\n delta = now - (last || now);\n touch$$1 = e.touches ? e.touches[0] : e;\n doubleTap = delta > 0 && delta <= delay;\n last = now;\n }\n\n function onTouchEnd(e) {\n if (doubleTap && !touch$$1.cancelBubble) {\n if (pointer) {\n if (!edge || e.pointerType === 'mouse') {\n return;\n } // work around .type being readonly with MSPointer* events\n\n\n var newTouch = {},\n prop,\n i;\n\n for (i in touch$$1) {\n prop = touch$$1[i];\n newTouch[i] = prop && prop.bind ? prop.bind(touch$$1) : prop;\n }\n\n touch$$1 = newTouch;\n }\n\n touch$$1.type = 'dblclick';\n handler(touch$$1);\n last = null;\n }\n }\n\n obj[_pre + _touchstart + id] = onTouchStart;\n obj[_pre + _touchend + id] = onTouchEnd;\n obj[_pre + 'dblclick' + id] = handler;\n obj.addEventListener(_touchstart, onTouchStart, false);\n obj.addEventListener(_touchend, onTouchEnd, false); // On some platforms (notably, chrome<55 on win10 + touchscreen + mouse),\n // the browser doesn't fire touchend/pointerup events but does fire\n // native dblclicks. See #4127.\n // Edge 14 also fires native dblclicks, but only for pointerType mouse, see #5180.\n\n obj.addEventListener('dblclick', handler, false);\n return this;\n }\n\n function removeDoubleTapListener(obj, id) {\n var touchstart = obj[_pre + _touchstart + id],\n touchend = obj[_pre + _touchend + id],\n dblclick = obj[_pre + 'dblclick' + id];\n obj.removeEventListener(_touchstart, touchstart, false);\n obj.removeEventListener(_touchend, touchend, false);\n\n if (!edge) {\n obj.removeEventListener('dblclick', dblclick, false);\n }\n\n return this;\n }\n /*\r\n * @namespace DomUtil\r\n *\r\n * Utility functions to work with the [DOM](https://developer.mozilla.org/docs/Web/API/Document_Object_Model)\r\n * tree, used by Leaflet internally.\r\n *\r\n * Most functions expecting or returning a `HTMLElement` also work for\r\n * SVG elements. The only difference is that classes refer to CSS classes\r\n * in HTML and SVG classes in SVG.\r\n */\n // @property TRANSFORM: String\n // Vendor-prefixed transform style name (e.g. `'webkitTransform'` for WebKit).\n\n\n var TRANSFORM = testProp(['transform', 'webkitTransform', 'OTransform', 'MozTransform', 'msTransform']); // webkitTransition comes first because some browser versions that drop vendor prefix don't do\n // the same for the transitionend event, in particular the Android 4.1 stock browser\n // @property TRANSITION: String\n // Vendor-prefixed transition style name.\n\n var TRANSITION = testProp(['webkitTransition', 'transition', 'OTransition', 'MozTransition', 'msTransition']); // @property TRANSITION_END: String\n // Vendor-prefixed transitionend event name.\n\n var TRANSITION_END = TRANSITION === 'webkitTransition' || TRANSITION === 'OTransition' ? TRANSITION + 'End' : 'transitionend'; // @function get(id: String|HTMLElement): HTMLElement\n // Returns an element given its DOM id, or returns the element itself\n // if it was passed directly.\n\n function get(id) {\n return typeof id === 'string' ? document.getElementById(id) : id;\n } // @function getStyle(el: HTMLElement, styleAttrib: String): String\n // Returns the value for a certain style attribute on an element,\n // including computed values or values set through CSS.\n\n\n function getStyle(el, style) {\n var value = el.style[style] || el.currentStyle && el.currentStyle[style];\n\n if ((!value || value === 'auto') && document.defaultView) {\n var css = document.defaultView.getComputedStyle(el, null);\n value = css ? css[style] : null;\n }\n\n return value === 'auto' ? null : value;\n } // @function create(tagName: String, className?: String, container?: HTMLElement): HTMLElement\n // Creates an HTML element with `tagName`, sets its class to `className`, and optionally appends it to `container` element.\n\n\n function create$1(tagName, className, container) {\n var el = document.createElement(tagName);\n el.className = className || '';\n\n if (container) {\n container.appendChild(el);\n }\n\n return el;\n } // @function remove(el: HTMLElement)\n // Removes `el` from its parent element\n\n\n function remove(el) {\n var parent = el.parentNode;\n\n if (parent) {\n parent.removeChild(el);\n }\n } // @function empty(el: HTMLElement)\n // Removes all of `el`'s children elements from `el`\n\n\n function empty(el) {\n while (el.firstChild) {\n el.removeChild(el.firstChild);\n }\n } // @function toFront(el: HTMLElement)\n // Makes `el` the last child of its parent, so it renders in front of the other children.\n\n\n function toFront(el) {\n var parent = el.parentNode;\n\n if (parent && parent.lastChild !== el) {\n parent.appendChild(el);\n }\n } // @function toBack(el: HTMLElement)\n // Makes `el` the first child of its parent, so it renders behind the other children.\n\n\n function toBack(el) {\n var parent = el.parentNode;\n\n if (parent && parent.firstChild !== el) {\n parent.insertBefore(el, parent.firstChild);\n }\n } // @function hasClass(el: HTMLElement, name: String): Boolean\n // Returns `true` if the element's class attribute contains `name`.\n\n\n function hasClass(el, name) {\n if (el.classList !== undefined) {\n return el.classList.contains(name);\n }\n\n var className = getClass(el);\n return className.length > 0 && new RegExp('(^|\\\\s)' + name + '(\\\\s|$)').test(className);\n } // @function addClass(el: HTMLElement, name: String)\n // Adds `name` to the element's class attribute.\n\n\n function addClass(el, name) {\n if (el.classList !== undefined) {\n var classes = splitWords(name);\n\n for (var i = 0, len = classes.length; i < len; i++) {\n el.classList.add(classes[i]);\n }\n } else if (!hasClass(el, name)) {\n var className = getClass(el);\n setClass(el, (className ? className + ' ' : '') + name);\n }\n } // @function removeClass(el: HTMLElement, name: String)\n // Removes `name` from the element's class attribute.\n\n\n function removeClass(el, name) {\n if (el.classList !== undefined) {\n el.classList.remove(name);\n } else {\n setClass(el, trim((' ' + getClass(el) + ' ').replace(' ' + name + ' ', ' ')));\n }\n } // @function setClass(el: HTMLElement, name: String)\n // Sets the element's class.\n\n\n function setClass(el, name) {\n if (el.className.baseVal === undefined) {\n el.className = name;\n } else {\n // in case of SVG element\n el.className.baseVal = name;\n }\n } // @function getClass(el: HTMLElement): String\n // Returns the element's class.\n\n\n function getClass(el) {\n // Check if the element is an SVGElementInstance and use the correspondingElement instead\n // (Required for linked SVG elements in IE11.)\n if (el.correspondingElement) {\n el = el.correspondingElement;\n }\n\n return el.className.baseVal === undefined ? el.className : el.className.baseVal;\n } // @function setOpacity(el: HTMLElement, opacity: Number)\n // Set the opacity of an element (including old IE support).\n // `opacity` must be a number from `0` to `1`.\n\n\n function setOpacity(el, value) {\n if ('opacity' in el.style) {\n el.style.opacity = value;\n } else if ('filter' in el.style) {\n _setOpacityIE(el, value);\n }\n }\n\n function _setOpacityIE(el, value) {\n var filter = false,\n filterName = 'DXImageTransform.Microsoft.Alpha'; // filters collection throws an error if we try to retrieve a filter that doesn't exist\n\n try {\n filter = el.filters.item(filterName);\n } catch (e) {\n // don't set opacity to 1 if we haven't already set an opacity,\n // it isn't needed and breaks transparent pngs.\n if (value === 1) {\n return;\n }\n }\n\n value = Math.round(value * 100);\n\n if (filter) {\n filter.Enabled = value !== 100;\n filter.Opacity = value;\n } else {\n el.style.filter += ' progid:' + filterName + '(opacity=' + value + ')';\n }\n } // @function testProp(props: String[]): String|false\n // Goes through the array of style names and returns the first name\n // that is a valid style name for an element. If no such name is found,\n // it returns false. Useful for vendor-prefixed styles like `transform`.\n\n\n function testProp(props) {\n var style = document.documentElement.style;\n\n for (var i = 0; i < props.length; i++) {\n if (props[i] in style) {\n return props[i];\n }\n }\n\n return false;\n } // @function setTransform(el: HTMLElement, offset: Point, scale?: Number)\n // Resets the 3D CSS transform of `el` so it is translated by `offset` pixels\n // and optionally scaled by `scale`. Does not have an effect if the\n // browser doesn't support 3D CSS transforms.\n\n\n function setTransform(el, offset, scale) {\n var pos = offset || new Point(0, 0);\n el.style[TRANSFORM] = (ie3d ? 'translate(' + pos.x + 'px,' + pos.y + 'px)' : 'translate3d(' + pos.x + 'px,' + pos.y + 'px,0)') + (scale ? ' scale(' + scale + ')' : '');\n } // @function setPosition(el: HTMLElement, position: Point)\n // Sets the position of `el` to coordinates specified by `position`,\n // using CSS translate or top/left positioning depending on the browser\n // (used by Leaflet internally to position its layers).\n\n\n function setPosition(el, point) {\n /*eslint-disable */\n el._leaflet_pos = point;\n /* eslint-enable */\n\n if (any3d) {\n setTransform(el, point);\n } else {\n el.style.left = point.x + 'px';\n el.style.top = point.y + 'px';\n }\n } // @function getPosition(el: HTMLElement): Point\n // Returns the coordinates of an element previously positioned with setPosition.\n\n\n function getPosition(el) {\n // this method is only used for elements previously positioned using setPosition,\n // so it's safe to cache the position for performance\n return el._leaflet_pos || new Point(0, 0);\n } // @function disableTextSelection()\n // Prevents the user from generating `selectstart` DOM events, usually generated\n // when the user drags the mouse through a page with text. Used internally\n // by Leaflet to override the behaviour of any click-and-drag interaction on\n // the map. Affects drag interactions on the whole document.\n // @function enableTextSelection()\n // Cancels the effects of a previous [`L.DomUtil.disableTextSelection`](#domutil-disabletextselection).\n\n\n var disableTextSelection;\n var enableTextSelection;\n\n var _userSelect;\n\n if ('onselectstart' in document) {\n disableTextSelection = function () {\n on(window, 'selectstart', preventDefault);\n };\n\n enableTextSelection = function () {\n off(window, 'selectstart', preventDefault);\n };\n } else {\n var userSelectProperty = testProp(['userSelect', 'WebkitUserSelect', 'OUserSelect', 'MozUserSelect', 'msUserSelect']);\n\n disableTextSelection = function () {\n if (userSelectProperty) {\n var style = document.documentElement.style;\n _userSelect = style[userSelectProperty];\n style[userSelectProperty] = 'none';\n }\n };\n\n enableTextSelection = function () {\n if (userSelectProperty) {\n document.documentElement.style[userSelectProperty] = _userSelect;\n _userSelect = undefined;\n }\n };\n } // @function disableImageDrag()\n // As [`L.DomUtil.disableTextSelection`](#domutil-disabletextselection), but\n // for `dragstart` DOM events, usually generated when the user drags an image.\n\n\n function disableImageDrag() {\n on(window, 'dragstart', preventDefault);\n } // @function enableImageDrag()\n // Cancels the effects of a previous [`L.DomUtil.disableImageDrag`](#domutil-disabletextselection).\n\n\n function enableImageDrag() {\n off(window, 'dragstart', preventDefault);\n }\n\n var _outlineElement;\n\n var _outlineStyle; // @function preventOutline(el: HTMLElement)\n // Makes the [outline](https://developer.mozilla.org/docs/Web/CSS/outline)\n // of the element `el` invisible. Used internally by Leaflet to prevent\n // focusable elements from displaying an outline when the user performs a\n // drag interaction on them.\n\n\n function preventOutline(element) {\n while (element.tabIndex === -1) {\n element = element.parentNode;\n }\n\n if (!element.style) {\n return;\n }\n\n restoreOutline();\n _outlineElement = element;\n _outlineStyle = element.style.outline;\n element.style.outline = 'none';\n on(window, 'keydown', restoreOutline);\n } // @function restoreOutline()\n // Cancels the effects of a previous [`L.DomUtil.preventOutline`]().\n\n\n function restoreOutline() {\n if (!_outlineElement) {\n return;\n }\n\n _outlineElement.style.outline = _outlineStyle;\n _outlineElement = undefined;\n _outlineStyle = undefined;\n off(window, 'keydown', restoreOutline);\n } // @function getSizedParentNode(el: HTMLElement): HTMLElement\n // Finds the closest parent node which size (width and height) is not null.\n\n\n function getSizedParentNode(element) {\n do {\n element = element.parentNode;\n } while ((!element.offsetWidth || !element.offsetHeight) && element !== document.body);\n\n return element;\n } // @function getScale(el: HTMLElement): Object\n // Computes the CSS scale currently applied on the element.\n // Returns an object with `x` and `y` members as horizontal and vertical scales respectively,\n // and `boundingClientRect` as the result of [`getBoundingClientRect()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect).\n\n\n function getScale(element) {\n var rect = element.getBoundingClientRect(); // Read-only in old browsers.\n\n return {\n x: rect.width / element.offsetWidth || 1,\n y: rect.height / element.offsetHeight || 1,\n boundingClientRect: rect\n };\n }\n\n var DomUtil = (Object.freeze || Object)({\n TRANSFORM: TRANSFORM,\n TRANSITION: TRANSITION,\n TRANSITION_END: TRANSITION_END,\n get: get,\n getStyle: getStyle,\n create: create$1,\n remove: remove,\n empty: empty,\n toFront: toFront,\n toBack: toBack,\n hasClass: hasClass,\n addClass: addClass,\n removeClass: removeClass,\n setClass: setClass,\n getClass: getClass,\n setOpacity: setOpacity,\n testProp: testProp,\n setTransform: setTransform,\n setPosition: setPosition,\n getPosition: getPosition,\n disableTextSelection: disableTextSelection,\n enableTextSelection: enableTextSelection,\n disableImageDrag: disableImageDrag,\n enableImageDrag: enableImageDrag,\n preventOutline: preventOutline,\n restoreOutline: restoreOutline,\n getSizedParentNode: getSizedParentNode,\n getScale: getScale\n });\n /*\r\n * @namespace DomEvent\r\n * Utility functions to work with the [DOM events](https://developer.mozilla.org/docs/Web/API/Event), used by Leaflet internally.\r\n */\n // Inspired by John Resig, Dean Edwards and YUI addEvent implementations.\n // @function on(el: HTMLElement, types: String, fn: Function, context?: Object): this\n // Adds a listener function (`fn`) to a particular DOM event type of the\n // element `el`. You can optionally specify the context of the listener\n // (object the `this` keyword will point to). You can also pass several\n // space-separated types (e.g. `'click dblclick'`).\n // @alternative\n // @function on(el: HTMLElement, eventMap: Object, context?: Object): this\n // Adds a set of type/listener pairs, e.g. `{click: onClick, mousemove: onMouseMove}`\n\n function on(obj, types, fn, context) {\n if (typeof types === 'object') {\n for (var type in types) {\n addOne(obj, type, types[type], fn);\n }\n } else {\n types = splitWords(types);\n\n for (var i = 0, len = types.length; i < len; i++) {\n addOne(obj, types[i], fn, context);\n }\n }\n\n return this;\n }\n\n var eventsKey = '_leaflet_events'; // @function off(el: HTMLElement, types: String, fn: Function, context?: Object): this\n // Removes a previously added listener function.\n // Note that if you passed a custom context to on, you must pass the same\n // context to `off` in order to remove the listener.\n // @alternative\n // @function off(el: HTMLElement, eventMap: Object, context?: Object): this\n // Removes a set of type/listener pairs, e.g. `{click: onClick, mousemove: onMouseMove}`\n\n function off(obj, types, fn, context) {\n if (typeof types === 'object') {\n for (var type in types) {\n removeOne(obj, type, types[type], fn);\n }\n } else if (types) {\n types = splitWords(types);\n\n for (var i = 0, len = types.length; i < len; i++) {\n removeOne(obj, types[i], fn, context);\n }\n } else {\n for (var j in obj[eventsKey]) {\n removeOne(obj, j, obj[eventsKey][j]);\n }\n\n delete obj[eventsKey];\n }\n\n return this;\n }\n\n function addOne(obj, type, fn, context) {\n var id = type + stamp(fn) + (context ? '_' + stamp(context) : '');\n\n if (obj[eventsKey] && obj[eventsKey][id]) {\n return this;\n }\n\n var handler = function (e) {\n return fn.call(context || obj, e || window.event);\n };\n\n var originalHandler = handler;\n\n if (pointer && type.indexOf('touch') === 0) {\n // Needs DomEvent.Pointer.js\n addPointerListener(obj, type, handler, id);\n } else if (touch && type === 'dblclick' && addDoubleTapListener && !(pointer && chrome)) {\n // Chrome >55 does not need the synthetic dblclicks from addDoubleTapListener\n // See #5180\n addDoubleTapListener(obj, handler, id);\n } else if ('addEventListener' in obj) {\n if (type === 'mousewheel') {\n obj.addEventListener('onwheel' in obj ? 'wheel' : 'mousewheel', handler, false);\n } else if (type === 'mouseenter' || type === 'mouseleave') {\n handler = function (e) {\n e = e || window.event;\n\n if (isExternalTarget(obj, e)) {\n originalHandler(e);\n }\n };\n\n obj.addEventListener(type === 'mouseenter' ? 'mouseover' : 'mouseout', handler, false);\n } else {\n if (type === 'click' && android) {\n handler = function (e) {\n filterClick(e, originalHandler);\n };\n }\n\n obj.addEventListener(type, handler, false);\n }\n } else if ('attachEvent' in obj) {\n obj.attachEvent('on' + type, handler);\n }\n\n obj[eventsKey] = obj[eventsKey] || {};\n obj[eventsKey][id] = handler;\n }\n\n function removeOne(obj, type, fn, context) {\n var id = type + stamp(fn) + (context ? '_' + stamp(context) : ''),\n handler = obj[eventsKey] && obj[eventsKey][id];\n\n if (!handler) {\n return this;\n }\n\n if (pointer && type.indexOf('touch') === 0) {\n removePointerListener(obj, type, id);\n } else if (touch && type === 'dblclick' && removeDoubleTapListener && !(pointer && chrome)) {\n removeDoubleTapListener(obj, id);\n } else if ('removeEventListener' in obj) {\n if (type === 'mousewheel') {\n obj.removeEventListener('onwheel' in obj ? 'wheel' : 'mousewheel', handler, false);\n } else {\n obj.removeEventListener(type === 'mouseenter' ? 'mouseover' : type === 'mouseleave' ? 'mouseout' : type, handler, false);\n }\n } else if ('detachEvent' in obj) {\n obj.detachEvent('on' + type, handler);\n }\n\n obj[eventsKey][id] = null;\n } // @function stopPropagation(ev: DOMEvent): this\n // Stop the given event from propagation to parent elements. Used inside the listener functions:\n // ```js\n // L.DomEvent.on(div, 'click', function (ev) {\n // \tL.DomEvent.stopPropagation(ev);\n // });\n // ```\n\n\n function stopPropagation(e) {\n if (e.stopPropagation) {\n e.stopPropagation();\n } else if (e.originalEvent) {\n // In case of Leaflet event.\n e.originalEvent._stopped = true;\n } else {\n e.cancelBubble = true;\n }\n\n skipped(e);\n return this;\n } // @function disableScrollPropagation(el: HTMLElement): this\n // Adds `stopPropagation` to the element's `'mousewheel'` events (plus browser variants).\n\n\n function disableScrollPropagation(el) {\n addOne(el, 'mousewheel', stopPropagation);\n return this;\n } // @function disableClickPropagation(el: HTMLElement): this\n // Adds `stopPropagation` to the element's `'click'`, `'doubleclick'`,\n // `'mousedown'` and `'touchstart'` events (plus browser variants).\n\n\n function disableClickPropagation(el) {\n on(el, 'mousedown touchstart dblclick', stopPropagation);\n addOne(el, 'click', fakeStop);\n return this;\n } // @function preventDefault(ev: DOMEvent): this\n // Prevents the default action of the DOM Event `ev` from happening (such as\n // following a link in the href of the a element, or doing a POST request\n // with page reload when a `<form>` is submitted).\n // Use it inside listener functions.\n\n\n function preventDefault(e) {\n if (e.preventDefault) {\n e.preventDefault();\n } else {\n e.returnValue = false;\n }\n\n return this;\n } // @function stop(ev: DOMEvent): this\n // Does `stopPropagation` and `preventDefault` at the same time.\n\n\n function stop(e) {\n preventDefault(e);\n stopPropagation(e);\n return this;\n } // @function getMousePosition(ev: DOMEvent, container?: HTMLElement): Point\n // Gets normalized mouse position from a DOM event relative to the\n // `container` (border excluded) or to the whole page if not specified.\n\n\n function getMousePosition(e, container) {\n if (!container) {\n return new Point(e.clientX, e.clientY);\n }\n\n var scale = getScale(container),\n offset = scale.boundingClientRect; // left and top values are in page scale (like the event clientX/Y)\n\n return new Point( // offset.left/top values are in page scale (like clientX/Y),\n // whereas clientLeft/Top (border width) values are the original values (before CSS scale applies).\n (e.clientX - offset.left) / scale.x - container.clientLeft, (e.clientY - offset.top) / scale.y - container.clientTop);\n } // Chrome on Win scrolls double the pixels as in other platforms (see #4538),\n // and Firefox scrolls device pixels, not CSS pixels\n\n\n var wheelPxFactor = win && chrome ? 2 * window.devicePixelRatio : gecko ? window.devicePixelRatio : 1; // @function getWheelDelta(ev: DOMEvent): Number\n // Gets normalized wheel delta from a mousewheel DOM event, in vertical\n // pixels scrolled (negative if scrolling down).\n // Events from pointing devices without precise scrolling are mapped to\n // a best guess of 60 pixels.\n\n function getWheelDelta(e) {\n return edge ? e.wheelDeltaY / 2 : // Don't trust window-geometry-based delta\n e.deltaY && e.deltaMode === 0 ? -e.deltaY / wheelPxFactor : // Pixels\n e.deltaY && e.deltaMode === 1 ? -e.deltaY * 20 : // Lines\n e.deltaY && e.deltaMode === 2 ? -e.deltaY * 60 : // Pages\n e.deltaX || e.deltaZ ? 0 : // Skip horizontal/depth wheel events\n e.wheelDelta ? (e.wheelDeltaY || e.wheelDelta) / 2 : // Legacy IE pixels\n e.detail && Math.abs(e.detail) < 32765 ? -e.detail * 20 : // Legacy Moz lines\n e.detail ? e.detail / -32765 * 60 : // Legacy Moz pages\n 0;\n }\n\n var skipEvents = {};\n\n function fakeStop(e) {\n // fakes stopPropagation by setting a special event flag, checked/reset with skipped(e)\n skipEvents[e.type] = true;\n }\n\n function skipped(e) {\n var events = skipEvents[e.type]; // reset when checking, as it's only used in map container and propagates outside of the map\n\n skipEvents[e.type] = false;\n return events;\n } // check if element really left/entered the event target (for mouseenter/mouseleave)\n\n\n function isExternalTarget(el, e) {\n var related = e.relatedTarget;\n\n if (!related) {\n return true;\n }\n\n try {\n while (related && related !== el) {\n related = related.parentNode;\n }\n } catch (err) {\n return false;\n }\n\n return related !== el;\n }\n\n var lastClick; // this is a horrible workaround for a bug in Android where a single touch triggers two click events\n\n function filterClick(e, handler) {\n var timeStamp = e.timeStamp || e.originalEvent && e.originalEvent.timeStamp,\n elapsed = lastClick && timeStamp - lastClick; // are they closer together than 500ms yet more than 100ms?\n // Android typically triggers them ~300ms apart while multiple listeners\n // on the same event should be triggered far faster;\n // or check if click is simulated on the element, and if it is, reject any non-simulated events\n\n if (elapsed && elapsed > 100 && elapsed < 500 || e.target._simulatedClick && !e._simulated) {\n stop(e);\n return;\n }\n\n lastClick = timeStamp;\n handler(e);\n }\n\n var DomEvent = (Object.freeze || Object)({\n on: on,\n off: off,\n stopPropagation: stopPropagation,\n disableScrollPropagation: disableScrollPropagation,\n disableClickPropagation: disableClickPropagation,\n preventDefault: preventDefault,\n stop: stop,\n getMousePosition: getMousePosition,\n getWheelDelta: getWheelDelta,\n fakeStop: fakeStop,\n skipped: skipped,\n isExternalTarget: isExternalTarget,\n addListener: on,\n removeListener: off\n });\n /*\n * @class PosAnimation\n * @aka L.PosAnimation\n * @inherits Evented\n * Used internally for panning animations, utilizing CSS3 Transitions for modern browsers and a timer fallback for IE6-9.\n *\n * @example\n * ```js\n * var fx = new L.PosAnimation();\n * fx.run(el, [300, 500], 0.5);\n * ```\n *\n * @constructor L.PosAnimation()\n * Creates a `PosAnimation` object.\n *\n */\n\n var PosAnimation = Evented.extend({\n // @method run(el: HTMLElement, newPos: Point, duration?: Number, easeLinearity?: Number)\n // Run an animation of a given element to a new position, optionally setting\n // duration in seconds (`0.25` by default) and easing linearity factor (3rd\n // argument of the [cubic bezier curve](http://cubic-bezier.com/#0,0,.5,1),\n // `0.5` by default).\n run: function (el, newPos, duration, easeLinearity) {\n this.stop();\n this._el = el;\n this._inProgress = true;\n this._duration = duration || 0.25;\n this._easeOutPower = 1 / Math.max(easeLinearity || 0.5, 0.2);\n this._startPos = getPosition(el);\n this._offset = newPos.subtract(this._startPos);\n this._startTime = +new Date(); // @event start: Event\n // Fired when the animation starts\n\n this.fire('start');\n\n this._animate();\n },\n // @method stop()\n // Stops the animation (if currently running).\n stop: function () {\n if (!this._inProgress) {\n return;\n }\n\n this._step(true);\n\n this._complete();\n },\n _animate: function () {\n // animation loop\n this._animId = requestAnimFrame(this._animate, this);\n\n this._step();\n },\n _step: function (round) {\n var elapsed = +new Date() - this._startTime,\n duration = this._duration * 1000;\n\n if (elapsed < duration) {\n this._runFrame(this._easeOut(elapsed / duration), round);\n } else {\n this._runFrame(1);\n\n this._complete();\n }\n },\n _runFrame: function (progress, round) {\n var pos = this._startPos.add(this._offset.multiplyBy(progress));\n\n if (round) {\n pos._round();\n }\n\n setPosition(this._el, pos); // @event step: Event\n // Fired continuously during the animation.\n\n this.fire('step');\n },\n _complete: function () {\n cancelAnimFrame(this._animId);\n this._inProgress = false; // @event end: Event\n // Fired when the animation ends.\n\n this.fire('end');\n },\n _easeOut: function (t) {\n return 1 - Math.pow(1 - t, this._easeOutPower);\n }\n });\n /*\r\n * @class Map\r\n * @aka L.Map\r\n * @inherits Evented\r\n *\r\n * The central class of the API — it is used to create a map on a page and manipulate it.\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * // initialize the map on the \"map\" div with a given center and zoom\r\n * var map = L.map('map', {\r\n * \tcenter: [51.505, -0.09],\r\n * \tzoom: 13\r\n * });\r\n * ```\r\n *\r\n */\n\n var Map = Evented.extend({\n options: {\n // @section Map State Options\n // @option crs: CRS = L.CRS.EPSG3857\n // The [Coordinate Reference System](#crs) to use. Don't change this if you're not\n // sure what it means.\n crs: EPSG3857,\n // @option center: LatLng = undefined\n // Initial geographic center of the map\n center: undefined,\n // @option zoom: Number = undefined\n // Initial map zoom level\n zoom: undefined,\n // @option minZoom: Number = *\n // Minimum zoom level of the map.\n // If not specified and at least one `GridLayer` or `TileLayer` is in the map,\n // the lowest of their `minZoom` options will be used instead.\n minZoom: undefined,\n // @option maxZoom: Number = *\n // Maximum zoom level of the map.\n // If not specified and at least one `GridLayer` or `TileLayer` is in the map,\n // the highest of their `maxZoom` options will be used instead.\n maxZoom: undefined,\n // @option layers: Layer[] = []\n // Array of layers that will be added to the map initially\n layers: [],\n // @option maxBounds: LatLngBounds = null\n // When this option is set, the map restricts the view to the given\n // geographical bounds, bouncing the user back if the user tries to pan\n // outside the view. To set the restriction dynamically, use\n // [`setMaxBounds`](#map-setmaxbounds) method.\n maxBounds: undefined,\n // @option renderer: Renderer = *\n // The default method for drawing vector layers on the map. `L.SVG`\n // or `L.Canvas` by default depending on browser support.\n renderer: undefined,\n // @section Animation Options\n // @option zoomAnimation: Boolean = true\n // Whether the map zoom animation is enabled. By default it's enabled\n // in all browsers that support CSS3 Transitions except Android.\n zoomAnimation: true,\n // @option zoomAnimationThreshold: Number = 4\n // Won't animate zoom if the zoom difference exceeds this value.\n zoomAnimationThreshold: 4,\n // @option fadeAnimation: Boolean = true\n // Whether the tile fade animation is enabled. By default it's enabled\n // in all browsers that support CSS3 Transitions except Android.\n fadeAnimation: true,\n // @option markerZoomAnimation: Boolean = true\n // Whether markers animate their zoom with the zoom animation, if disabled\n // they will disappear for the length of the animation. By default it's\n // enabled in all browsers that support CSS3 Transitions except Android.\n markerZoomAnimation: true,\n // @option transform3DLimit: Number = 2^23\n // Defines the maximum size of a CSS translation transform. The default\n // value should not be changed unless a web browser positions layers in\n // the wrong place after doing a large `panBy`.\n transform3DLimit: 8388608,\n // Precision limit of a 32-bit float\n // @section Interaction Options\n // @option zoomSnap: Number = 1\n // Forces the map's zoom level to always be a multiple of this, particularly\n // right after a [`fitBounds()`](#map-fitbounds) or a pinch-zoom.\n // By default, the zoom level snaps to the nearest integer; lower values\n // (e.g. `0.5` or `0.1`) allow for greater granularity. A value of `0`\n // means the zoom level will not be snapped after `fitBounds` or a pinch-zoom.\n zoomSnap: 1,\n // @option zoomDelta: Number = 1\n // Controls how much the map's zoom level will change after a\n // [`zoomIn()`](#map-zoomin), [`zoomOut()`](#map-zoomout), pressing `+`\n // or `-` on the keyboard, or using the [zoom controls](#control-zoom).\n // Values smaller than `1` (e.g. `0.5`) allow for greater granularity.\n zoomDelta: 1,\n // @option trackResize: Boolean = true\n // Whether the map automatically handles browser window resize to update itself.\n trackResize: true\n },\n initialize: function (id, options) {\n // (HTMLElement or String, Object)\n options = setOptions(this, options); // Make sure to assign internal flags at the beginning,\n // to avoid inconsistent state in some edge cases.\n\n this._handlers = [];\n this._layers = {};\n this._zoomBoundLayers = {};\n this._sizeChanged = true;\n\n this._initContainer(id);\n\n this._initLayout(); // hack for https://github.com/Leaflet/Leaflet/issues/1980\n\n\n this._onResize = bind(this._onResize, this);\n\n this._initEvents();\n\n if (options.maxBounds) {\n this.setMaxBounds(options.maxBounds);\n }\n\n if (options.zoom !== undefined) {\n this._zoom = this._limitZoom(options.zoom);\n }\n\n if (options.center && options.zoom !== undefined) {\n this.setView(toLatLng(options.center), options.zoom, {\n reset: true\n });\n }\n\n this.callInitHooks(); // don't animate on browsers without hardware-accelerated transitions or old Android/Opera\n\n this._zoomAnimated = TRANSITION && any3d && !mobileOpera && this.options.zoomAnimation; // zoom transitions run with the same duration for all layers, so if one of transitionend events\n // happens after starting zoom animation (propagating to the map pane), we know that it ended globally\n\n if (this._zoomAnimated) {\n this._createAnimProxy();\n\n on(this._proxy, TRANSITION_END, this._catchTransitionEnd, this);\n }\n\n this._addLayers(this.options.layers);\n },\n // @section Methods for modifying map state\n // @method setView(center: LatLng, zoom: Number, options?: Zoom/pan options): this\n // Sets the view of the map (geographical center and zoom) with the given\n // animation options.\n setView: function (center, zoom, options) {\n zoom = zoom === undefined ? this._zoom : this._limitZoom(zoom);\n center = this._limitCenter(toLatLng(center), zoom, this.options.maxBounds);\n options = options || {};\n\n this._stop();\n\n if (this._loaded && !options.reset && options !== true) {\n if (options.animate !== undefined) {\n options.zoom = extend({\n animate: options.animate\n }, options.zoom);\n options.pan = extend({\n animate: options.animate,\n duration: options.duration\n }, options.pan);\n } // try animating pan or zoom\n\n\n var moved = this._zoom !== zoom ? this._tryAnimatedZoom && this._tryAnimatedZoom(center, zoom, options.zoom) : this._tryAnimatedPan(center, options.pan);\n\n if (moved) {\n // prevent resize handler call, the view will refresh after animation anyway\n clearTimeout(this._sizeTimer);\n return this;\n }\n } // animation didn't start, just reset the map view\n\n\n this._resetView(center, zoom);\n\n return this;\n },\n // @method setZoom(zoom: Number, options?: Zoom/pan options): this\n // Sets the zoom of the map.\n setZoom: function (zoom, options) {\n if (!this._loaded) {\n this._zoom = zoom;\n return this;\n }\n\n return this.setView(this.getCenter(), zoom, {\n zoom: options\n });\n },\n // @method zoomIn(delta?: Number, options?: Zoom options): this\n // Increases the zoom of the map by `delta` ([`zoomDelta`](#map-zoomdelta) by default).\n zoomIn: function (delta, options) {\n delta = delta || (any3d ? this.options.zoomDelta : 1);\n return this.setZoom(this._zoom + delta, options);\n },\n // @method zoomOut(delta?: Number, options?: Zoom options): this\n // Decreases the zoom of the map by `delta` ([`zoomDelta`](#map-zoomdelta) by default).\n zoomOut: function (delta, options) {\n delta = delta || (any3d ? this.options.zoomDelta : 1);\n return this.setZoom(this._zoom - delta, options);\n },\n // @method setZoomAround(latlng: LatLng, zoom: Number, options: Zoom options): this\n // Zooms the map while keeping a specified geographical point on the map\n // stationary (e.g. used internally for scroll zoom and double-click zoom).\n // @alternative\n // @method setZoomAround(offset: Point, zoom: Number, options: Zoom options): this\n // Zooms the map while keeping a specified pixel on the map (relative to the top-left corner) stationary.\n setZoomAround: function (latlng, zoom, options) {\n var scale = this.getZoomScale(zoom),\n viewHalf = this.getSize().divideBy(2),\n containerPoint = latlng instanceof Point ? latlng : this.latLngToContainerPoint(latlng),\n centerOffset = containerPoint.subtract(viewHalf).multiplyBy(1 - 1 / scale),\n newCenter = this.containerPointToLatLng(viewHalf.add(centerOffset));\n return this.setView(newCenter, zoom, {\n zoom: options\n });\n },\n _getBoundsCenterZoom: function (bounds, options) {\n options = options || {};\n bounds = bounds.getBounds ? bounds.getBounds() : toLatLngBounds(bounds);\n var paddingTL = toPoint(options.paddingTopLeft || options.padding || [0, 0]),\n paddingBR = toPoint(options.paddingBottomRight || options.padding || [0, 0]),\n zoom = this.getBoundsZoom(bounds, false, paddingTL.add(paddingBR));\n zoom = typeof options.maxZoom === 'number' ? Math.min(options.maxZoom, zoom) : zoom;\n\n if (zoom === Infinity) {\n return {\n center: bounds.getCenter(),\n zoom: zoom\n };\n }\n\n var paddingOffset = paddingBR.subtract(paddingTL).divideBy(2),\n swPoint = this.project(bounds.getSouthWest(), zoom),\n nePoint = this.project(bounds.getNorthEast(), zoom),\n center = this.unproject(swPoint.add(nePoint).divideBy(2).add(paddingOffset), zoom);\n return {\n center: center,\n zoom: zoom\n };\n },\n // @method fitBounds(bounds: LatLngBounds, options?: fitBounds options): this\n // Sets a map view that contains the given geographical bounds with the\n // maximum zoom level possible.\n fitBounds: function (bounds, options) {\n bounds = toLatLngBounds(bounds);\n\n if (!bounds.isValid()) {\n throw new Error('Bounds are not valid.');\n }\n\n var target = this._getBoundsCenterZoom(bounds, options);\n\n return this.setView(target.center, target.zoom, options);\n },\n // @method fitWorld(options?: fitBounds options): this\n // Sets a map view that mostly contains the whole world with the maximum\n // zoom level possible.\n fitWorld: function (options) {\n return this.fitBounds([[-90, -180], [90, 180]], options);\n },\n // @method panTo(latlng: LatLng, options?: Pan options): this\n // Pans the map to a given center.\n panTo: function (center, options) {\n // (LatLng)\n return this.setView(center, this._zoom, {\n pan: options\n });\n },\n // @method panBy(offset: Point, options?: Pan options): this\n // Pans the map by a given number of pixels (animated).\n panBy: function (offset, options) {\n offset = toPoint(offset).round();\n options = options || {};\n\n if (!offset.x && !offset.y) {\n return this.fire('moveend');\n } // If we pan too far, Chrome gets issues with tiles\n // and makes them disappear or appear in the wrong place (slightly offset) #2602\n\n\n if (options.animate !== true && !this.getSize().contains(offset)) {\n this._resetView(this.unproject(this.project(this.getCenter()).add(offset)), this.getZoom());\n\n return this;\n }\n\n if (!this._panAnim) {\n this._panAnim = new PosAnimation();\n\n this._panAnim.on({\n 'step': this._onPanTransitionStep,\n 'end': this._onPanTransitionEnd\n }, this);\n } // don't fire movestart if animating inertia\n\n\n if (!options.noMoveStart) {\n this.fire('movestart');\n } // animate pan unless animate: false specified\n\n\n if (options.animate !== false) {\n addClass(this._mapPane, 'leaflet-pan-anim');\n\n var newPos = this._getMapPanePos().subtract(offset).round();\n\n this._panAnim.run(this._mapPane, newPos, options.duration || 0.25, options.easeLinearity);\n } else {\n this._rawPanBy(offset);\n\n this.fire('move').fire('moveend');\n }\n\n return this;\n },\n // @method flyTo(latlng: LatLng, zoom?: Number, options?: Zoom/pan options): this\n // Sets the view of the map (geographical center and zoom) performing a smooth\n // pan-zoom animation.\n flyTo: function (targetCenter, targetZoom, options) {\n options = options || {};\n\n if (options.animate === false || !any3d) {\n return this.setView(targetCenter, targetZoom, options);\n }\n\n this._stop();\n\n var from = this.project(this.getCenter()),\n to = this.project(targetCenter),\n size = this.getSize(),\n startZoom = this._zoom;\n targetCenter = toLatLng(targetCenter);\n targetZoom = targetZoom === undefined ? startZoom : targetZoom;\n var w0 = Math.max(size.x, size.y),\n w1 = w0 * this.getZoomScale(startZoom, targetZoom),\n u1 = to.distanceTo(from) || 1,\n rho = 1.42,\n rho2 = rho * rho;\n\n function r(i) {\n var s1 = i ? -1 : 1,\n s2 = i ? w1 : w0,\n t1 = w1 * w1 - w0 * w0 + s1 * rho2 * rho2 * u1 * u1,\n b1 = 2 * s2 * rho2 * u1,\n b = t1 / b1,\n sq = Math.sqrt(b * b + 1) - b; // workaround for floating point precision bug when sq = 0, log = -Infinite,\n // thus triggering an infinite loop in flyTo\n\n var log = sq < 0.000000001 ? -18 : Math.log(sq);\n return log;\n }\n\n function sinh(n) {\n return (Math.exp(n) - Math.exp(-n)) / 2;\n }\n\n function cosh(n) {\n return (Math.exp(n) + Math.exp(-n)) / 2;\n }\n\n function tanh(n) {\n return sinh(n) / cosh(n);\n }\n\n var r0 = r(0);\n\n function w(s) {\n return w0 * (cosh(r0) / cosh(r0 + rho * s));\n }\n\n function u(s) {\n return w0 * (cosh(r0) * tanh(r0 + rho * s) - sinh(r0)) / rho2;\n }\n\n function easeOut(t) {\n return 1 - Math.pow(1 - t, 1.5);\n }\n\n var start = Date.now(),\n S = (r(1) - r0) / rho,\n duration = options.duration ? 1000 * options.duration : 1000 * S * 0.8;\n\n function frame() {\n var t = (Date.now() - start) / duration,\n s = easeOut(t) * S;\n\n if (t <= 1) {\n this._flyToFrame = requestAnimFrame(frame, this);\n\n this._move(this.unproject(from.add(to.subtract(from).multiplyBy(u(s) / u1)), startZoom), this.getScaleZoom(w0 / w(s), startZoom), {\n flyTo: true\n });\n } else {\n this._move(targetCenter, targetZoom)._moveEnd(true);\n }\n }\n\n this._moveStart(true, options.noMoveStart);\n\n frame.call(this);\n return this;\n },\n // @method flyToBounds(bounds: LatLngBounds, options?: fitBounds options): this\n // Sets the view of the map with a smooth animation like [`flyTo`](#map-flyto),\n // but takes a bounds parameter like [`fitBounds`](#map-fitbounds).\n flyToBounds: function (bounds, options) {\n var target = this._getBoundsCenterZoom(bounds, options);\n\n return this.flyTo(target.center, target.zoom, options);\n },\n // @method setMaxBounds(bounds: Bounds): this\n // Restricts the map view to the given bounds (see the [maxBounds](#map-maxbounds) option).\n setMaxBounds: function (bounds) {\n bounds = toLatLngBounds(bounds);\n\n if (!bounds.isValid()) {\n this.options.maxBounds = null;\n return this.off('moveend', this._panInsideMaxBounds);\n } else if (this.options.maxBounds) {\n this.off('moveend', this._panInsideMaxBounds);\n }\n\n this.options.maxBounds = bounds;\n\n if (this._loaded) {\n this._panInsideMaxBounds();\n }\n\n return this.on('moveend', this._panInsideMaxBounds);\n },\n // @method setMinZoom(zoom: Number): this\n // Sets the lower limit for the available zoom levels (see the [minZoom](#map-minzoom) option).\n setMinZoom: function (zoom) {\n var oldZoom = this.options.minZoom;\n this.options.minZoom = zoom;\n\n if (this._loaded && oldZoom !== zoom) {\n this.fire('zoomlevelschange');\n\n if (this.getZoom() < this.options.minZoom) {\n return this.setZoom(zoom);\n }\n }\n\n return this;\n },\n // @method setMaxZoom(zoom: Number): this\n // Sets the upper limit for the available zoom levels (see the [maxZoom](#map-maxzoom) option).\n setMaxZoom: function (zoom) {\n var oldZoom = this.options.maxZoom;\n this.options.maxZoom = zoom;\n\n if (this._loaded && oldZoom !== zoom) {\n this.fire('zoomlevelschange');\n\n if (this.getZoom() > this.options.maxZoom) {\n return this.setZoom(zoom);\n }\n }\n\n return this;\n },\n // @method panInsideBounds(bounds: LatLngBounds, options?: Pan options): this\n // 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.\n panInsideBounds: function (bounds, options) {\n this._enforcingBounds = true;\n\n var center = this.getCenter(),\n newCenter = this._limitCenter(center, this._zoom, toLatLngBounds(bounds));\n\n if (!center.equals(newCenter)) {\n this.panTo(newCenter, options);\n }\n\n this._enforcingBounds = false;\n return this;\n },\n // @method panInside(latlng: LatLng, options?: options): this\n // Pans the map the minimum amount to make the `latlng` visible. Use\n // `padding`, `paddingTopLeft` and `paddingTopRight` options to fit\n // the display to more restricted bounds, like [`fitBounds`](#map-fitbounds).\n // If `latlng` is already within the (optionally padded) display bounds,\n // the map will not be panned.\n panInside: function (latlng, options) {\n options = options || {};\n var paddingTL = toPoint(options.paddingTopLeft || options.padding || [0, 0]),\n paddingBR = toPoint(options.paddingBottomRight || options.padding || [0, 0]),\n center = this.getCenter(),\n pixelCenter = this.project(center),\n pixelPoint = this.project(latlng),\n pixelBounds = this.getPixelBounds(),\n halfPixelBounds = pixelBounds.getSize().divideBy(2),\n paddedBounds = toBounds([pixelBounds.min.add(paddingTL), pixelBounds.max.subtract(paddingBR)]);\n\n if (!paddedBounds.contains(pixelPoint)) {\n this._enforcingBounds = true;\n var diff = pixelCenter.subtract(pixelPoint),\n newCenter = toPoint(pixelPoint.x + diff.x, pixelPoint.y + diff.y);\n\n if (pixelPoint.x < paddedBounds.min.x || pixelPoint.x > paddedBounds.max.x) {\n newCenter.x = pixelCenter.x - diff.x;\n\n if (diff.x > 0) {\n newCenter.x += halfPixelBounds.x - paddingTL.x;\n } else {\n newCenter.x -= halfPixelBounds.x - paddingBR.x;\n }\n }\n\n if (pixelPoint.y < paddedBounds.min.y || pixelPoint.y > paddedBounds.max.y) {\n newCenter.y = pixelCenter.y - diff.y;\n\n if (diff.y > 0) {\n newCenter.y += halfPixelBounds.y - paddingTL.y;\n } else {\n newCenter.y -= halfPixelBounds.y - paddingBR.y;\n }\n }\n\n this.panTo(this.unproject(newCenter), options);\n this._enforcingBounds = false;\n }\n\n return this;\n },\n // @method invalidateSize(options: Zoom/pan options): this\n // Checks if the map container size changed and updates the map if so —\n // call it after you've changed the map size dynamically, also animating\n // pan by default. If `options.pan` is `false`, panning will not occur.\n // If `options.debounceMoveend` is `true`, it will delay `moveend` event so\n // that it doesn't happen often even if the method is called many\n // times in a row.\n // @alternative\n // @method invalidateSize(animate: Boolean): this\n // Checks if the map container size changed and updates the map if so —\n // call it after you've changed the map size dynamically, also animating\n // pan by default.\n invalidateSize: function (options) {\n if (!this._loaded) {\n return this;\n }\n\n options = extend({\n animate: false,\n pan: true\n }, options === true ? {\n animate: true\n } : options);\n var oldSize = this.getSize();\n this._sizeChanged = true;\n this._lastCenter = null;\n var newSize = this.getSize(),\n oldCenter = oldSize.divideBy(2).round(),\n newCenter = newSize.divideBy(2).round(),\n offset = oldCenter.subtract(newCenter);\n\n if (!offset.x && !offset.y) {\n return this;\n }\n\n if (options.animate && options.pan) {\n this.panBy(offset);\n } else {\n if (options.pan) {\n this._rawPanBy(offset);\n }\n\n this.fire('move');\n\n if (options.debounceMoveend) {\n clearTimeout(this._sizeTimer);\n this._sizeTimer = setTimeout(bind(this.fire, this, 'moveend'), 200);\n } else {\n this.fire('moveend');\n }\n } // @section Map state change events\n // @event resize: ResizeEvent\n // Fired when the map is resized.\n\n\n return this.fire('resize', {\n oldSize: oldSize,\n newSize: newSize\n });\n },\n // @section Methods for modifying map state\n // @method stop(): this\n // Stops the currently running `panTo` or `flyTo` animation, if any.\n stop: function () {\n this.setZoom(this._limitZoom(this._zoom));\n\n if (!this.options.zoomSnap) {\n this.fire('viewreset');\n }\n\n return this._stop();\n },\n // @section Geolocation methods\n // @method locate(options?: Locate options): this\n // Tries to locate the user using the Geolocation API, firing a [`locationfound`](#map-locationfound)\n // event with location data on success or a [`locationerror`](#map-locationerror) event on failure,\n // and optionally sets the map view to the user's location with respect to\n // detection accuracy (or to the world view if geolocation failed).\n // Note that, if your page doesn't use HTTPS, this method will fail in\n // modern browsers ([Chrome 50 and newer](https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-powerful-features-on-insecure-origins))\n // See `Locate options` for more details.\n locate: function (options) {\n options = this._locateOptions = extend({\n timeout: 10000,\n watch: false // setView: false\n // maxZoom: <Number>\n // maximumAge: 0\n // enableHighAccuracy: false\n\n }, options);\n\n if (!('geolocation' in navigator)) {\n this._handleGeolocationError({\n code: 0,\n message: 'Geolocation not supported.'\n });\n\n return this;\n }\n\n var onResponse = bind(this._handleGeolocationResponse, this),\n onError = bind(this._handleGeolocationError, this);\n\n if (options.watch) {\n this._locationWatchId = navigator.geolocation.watchPosition(onResponse, onError, options);\n } else {\n navigator.geolocation.getCurrentPosition(onResponse, onError, options);\n }\n\n return this;\n },\n // @method stopLocate(): this\n // Stops watching location previously initiated by `map.locate({watch: true})`\n // and aborts resetting the map view if map.locate was called with\n // `{setView: true}`.\n stopLocate: function () {\n if (navigator.geolocation && navigator.geolocation.clearWatch) {\n navigator.geolocation.clearWatch(this._locationWatchId);\n }\n\n if (this._locateOptions) {\n this._locateOptions.setView = false;\n }\n\n return this;\n },\n _handleGeolocationError: function (error) {\n var c = error.code,\n message = error.message || (c === 1 ? 'permission denied' : c === 2 ? 'position unavailable' : 'timeout');\n\n if (this._locateOptions.setView && !this._loaded) {\n this.fitWorld();\n } // @section Location events\n // @event locationerror: ErrorEvent\n // Fired when geolocation (using the [`locate`](#map-locate) method) failed.\n\n\n this.fire('locationerror', {\n code: c,\n message: 'Geolocation error: ' + message + '.'\n });\n },\n _handleGeolocationResponse: function (pos) {\n var lat = pos.coords.latitude,\n lng = pos.coords.longitude,\n latlng = new LatLng(lat, lng),\n bounds = latlng.toBounds(pos.coords.accuracy * 2),\n options = this._locateOptions;\n\n if (options.setView) {\n var zoom = this.getBoundsZoom(bounds);\n this.setView(latlng, options.maxZoom ? Math.min(zoom, options.maxZoom) : zoom);\n }\n\n var data = {\n latlng: latlng,\n bounds: bounds,\n timestamp: pos.timestamp\n };\n\n for (var i in pos.coords) {\n if (typeof pos.coords[i] === 'number') {\n data[i] = pos.coords[i];\n }\n } // @event locationfound: LocationEvent\n // Fired when geolocation (using the [`locate`](#map-locate) method)\n // went successfully.\n\n\n this.fire('locationfound', data);\n },\n // TODO Appropriate docs section?\n // @section Other Methods\n // @method addHandler(name: String, HandlerClass: Function): this\n // Adds a new `Handler` to the map, given its name and constructor function.\n addHandler: function (name, HandlerClass) {\n if (!HandlerClass) {\n return this;\n }\n\n var handler = this[name] = new HandlerClass(this);\n\n this._handlers.push(handler);\n\n if (this.options[name]) {\n handler.enable();\n }\n\n return this;\n },\n // @method remove(): this\n // Destroys the map and clears all related event listeners.\n remove: function () {\n this._initEvents(true);\n\n if (this._containerId !== this._container._leaflet_id) {\n throw new Error('Map container is being reused by another instance');\n }\n\n try {\n // throws error in IE6-8\n delete this._container._leaflet_id;\n delete this._containerId;\n } catch (e) {\n /*eslint-disable */\n this._container._leaflet_id = undefined;\n /* eslint-enable */\n\n this._containerId = undefined;\n }\n\n if (this._locationWatchId !== undefined) {\n this.stopLocate();\n }\n\n this._stop();\n\n remove(this._mapPane);\n\n if (this._clearControlPos) {\n this._clearControlPos();\n }\n\n if (this._resizeRequest) {\n cancelAnimFrame(this._resizeRequest);\n this._resizeRequest = null;\n }\n\n this._clearHandlers();\n\n if (this._loaded) {\n // @section Map state change events\n // @event unload: Event\n // Fired when the map is destroyed with [remove](#map-remove) method.\n this.fire('unload');\n }\n\n var i;\n\n for (i in this._layers) {\n this._layers[i].remove();\n }\n\n for (i in this._panes) {\n remove(this._panes[i]);\n }\n\n this._layers = [];\n this._panes = [];\n delete this._mapPane;\n delete this._renderer;\n return this;\n },\n // @section Other Methods\n // @method createPane(name: String, container?: HTMLElement): HTMLElement\n // Creates a new [map pane](#map-pane) with the given name if it doesn't exist already,\n // then returns it. The pane is created as a child of `container`, or\n // as a child of the main map pane if not set.\n createPane: function (name, container) {\n var className = 'leaflet-pane' + (name ? ' leaflet-' + name.replace('Pane', '') + '-pane' : ''),\n pane = create$1('div', className, container || this._mapPane);\n\n if (name) {\n this._panes[name] = pane;\n }\n\n return pane;\n },\n // @section Methods for Getting Map State\n // @method getCenter(): LatLng\n // Returns the geographical center of the map view\n getCenter: function () {\n this._checkIfLoaded();\n\n if (this._lastCenter && !this._moved()) {\n return this._lastCenter;\n }\n\n return this.layerPointToLatLng(this._getCenterLayerPoint());\n },\n // @method getZoom(): Number\n // Returns the current zoom level of the map view\n getZoom: function () {\n return this._zoom;\n },\n // @method getBounds(): LatLngBounds\n // Returns the geographical bounds visible in the current map view\n getBounds: function () {\n var bounds = this.getPixelBounds(),\n sw = this.unproject(bounds.getBottomLeft()),\n ne = this.unproject(bounds.getTopRight());\n return new LatLngBounds(sw, ne);\n },\n // @method getMinZoom(): Number\n // 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.\n getMinZoom: function () {\n return this.options.minZoom === undefined ? this._layersMinZoom || 0 : this.options.minZoom;\n },\n // @method getMaxZoom(): Number\n // Returns the maximum zoom level of the map (if set in the `maxZoom` option of the map or of any layers).\n getMaxZoom: function () {\n return this.options.maxZoom === undefined ? this._layersMaxZoom === undefined ? Infinity : this._layersMaxZoom : this.options.maxZoom;\n },\n // @method getBoundsZoom(bounds: LatLngBounds, inside?: Boolean, padding?: Point): Number\n // Returns the maximum zoom level on which the given bounds fit to the map\n // view in its entirety. If `inside` (optional) is set to `true`, the method\n // instead returns the minimum zoom level on which the map view fits into\n // the given bounds in its entirety.\n getBoundsZoom: function (bounds, inside, padding) {\n // (LatLngBounds[, Boolean, Point]) -> Number\n bounds = toLatLngBounds(bounds);\n padding = toPoint(padding || [0, 0]);\n var zoom = this.getZoom() || 0,\n min = this.getMinZoom(),\n max = this.getMaxZoom(),\n nw = bounds.getNorthWest(),\n se = bounds.getSouthEast(),\n size = this.getSize().subtract(padding),\n boundsSize = toBounds(this.project(se, zoom), this.project(nw, zoom)).getSize(),\n snap = any3d ? this.options.zoomSnap : 1,\n scalex = size.x / boundsSize.x,\n scaley = size.y / boundsSize.y,\n scale = inside ? Math.max(scalex, scaley) : Math.min(scalex, scaley);\n zoom = this.getScaleZoom(scale, zoom);\n\n if (snap) {\n zoom = Math.round(zoom / (snap / 100)) * (snap / 100); // don't jump if within 1% of a snap level\n\n zoom = inside ? Math.ceil(zoom / snap) * snap : Math.floor(zoom / snap) * snap;\n }\n\n return Math.max(min, Math.min(max, zoom));\n },\n // @method getSize(): Point\n // Returns the current size of the map container (in pixels).\n getSize: function () {\n if (!this._size || this._sizeChanged) {\n this._size = new Point(this._container.clientWidth || 0, this._container.clientHeight || 0);\n this._sizeChanged = false;\n }\n\n return this._size.clone();\n },\n // @method getPixelBounds(): Bounds\n // Returns the bounds of the current map view in projected pixel\n // coordinates (sometimes useful in layer and overlay implementations).\n getPixelBounds: function (center, zoom) {\n var topLeftPoint = this._getTopLeftPoint(center, zoom);\n\n return new Bounds(topLeftPoint, topLeftPoint.add(this.getSize()));\n },\n // TODO: Check semantics - isn't the pixel origin the 0,0 coord relative to\n // the map pane? \"left point of the map layer\" can be confusing, specially\n // since there can be negative offsets.\n // @method getPixelOrigin(): Point\n // Returns the projected pixel coordinates of the top left point of\n // the map layer (useful in custom layer and overlay implementations).\n getPixelOrigin: function () {\n this._checkIfLoaded();\n\n return this._pixelOrigin;\n },\n // @method getPixelWorldBounds(zoom?: Number): Bounds\n // Returns the world's bounds in pixel coordinates for zoom level `zoom`.\n // If `zoom` is omitted, the map's current zoom level is used.\n getPixelWorldBounds: function (zoom) {\n return this.options.crs.getProjectedBounds(zoom === undefined ? this.getZoom() : zoom);\n },\n // @section Other Methods\n // @method getPane(pane: String|HTMLElement): HTMLElement\n // Returns a [map pane](#map-pane), given its name or its HTML element (its identity).\n getPane: function (pane) {\n return typeof pane === 'string' ? this._panes[pane] : pane;\n },\n // @method getPanes(): Object\n // Returns a plain object containing the names of all [panes](#map-pane) as keys and\n // the panes as values.\n getPanes: function () {\n return this._panes;\n },\n // @method getContainer: HTMLElement\n // Returns the HTML element that contains the map.\n getContainer: function () {\n return this._container;\n },\n // @section Conversion Methods\n // @method getZoomScale(toZoom: Number, fromZoom: Number): Number\n // Returns the scale factor to be applied to a map transition from zoom level\n // `fromZoom` to `toZoom`. Used internally to help with zoom animations.\n getZoomScale: function (toZoom, fromZoom) {\n // TODO replace with universal implementation after refactoring projections\n var crs = this.options.crs;\n fromZoom = fromZoom === undefined ? this._zoom : fromZoom;\n return crs.scale(toZoom) / crs.scale(fromZoom);\n },\n // @method getScaleZoom(scale: Number, fromZoom: Number): Number\n // Returns the zoom level that the map would end up at, if it is at `fromZoom`\n // level and everything is scaled by a factor of `scale`. Inverse of\n // [`getZoomScale`](#map-getZoomScale).\n getScaleZoom: function (scale, fromZoom) {\n var crs = this.options.crs;\n fromZoom = fromZoom === undefined ? this._zoom : fromZoom;\n var zoom = crs.zoom(scale * crs.scale(fromZoom));\n return isNaN(zoom) ? Infinity : zoom;\n },\n // @method project(latlng: LatLng, zoom: Number): Point\n // Projects a geographical coordinate `LatLng` according to the projection\n // of the map's CRS, then scales it according to `zoom` and the CRS's\n // `Transformation`. The result is pixel coordinate relative to\n // the CRS origin.\n project: function (latlng, zoom) {\n zoom = zoom === undefined ? this._zoom : zoom;\n return this.options.crs.latLngToPoint(toLatLng(latlng), zoom);\n },\n // @method unproject(point: Point, zoom: Number): LatLng\n // Inverse of [`project`](#map-project).\n unproject: function (point, zoom) {\n zoom = zoom === undefined ? this._zoom : zoom;\n return this.options.crs.pointToLatLng(toPoint(point), zoom);\n },\n // @method layerPointToLatLng(point: Point): LatLng\n // Given a pixel coordinate relative to the [origin pixel](#map-getpixelorigin),\n // returns the corresponding geographical coordinate (for the current zoom level).\n layerPointToLatLng: function (point) {\n var projectedPoint = toPoint(point).add(this.getPixelOrigin());\n return this.unproject(projectedPoint);\n },\n // @method latLngToLayerPoint(latlng: LatLng): Point\n // Given a geographical coordinate, returns the corresponding pixel coordinate\n // relative to the [origin pixel](#map-getpixelorigin).\n latLngToLayerPoint: function (latlng) {\n var projectedPoint = this.project(toLatLng(latlng))._round();\n\n return projectedPoint._subtract(this.getPixelOrigin());\n },\n // @method wrapLatLng(latlng: LatLng): LatLng\n // Returns a `LatLng` where `lat` and `lng` has been wrapped according to the\n // map's CRS's `wrapLat` and `wrapLng` properties, if they are outside the\n // CRS's bounds.\n // By default this means longitude is wrapped around the dateline so its\n // value is between -180 and +180 degrees.\n wrapLatLng: function (latlng) {\n return this.options.crs.wrapLatLng(toLatLng(latlng));\n },\n // @method wrapLatLngBounds(bounds: LatLngBounds): LatLngBounds\n // Returns a `LatLngBounds` with the same size as the given one, ensuring that\n // its center is within the CRS's bounds.\n // By default this means the center longitude is wrapped around the dateline so its\n // value is between -180 and +180 degrees, and the majority of the bounds\n // overlaps the CRS's bounds.\n wrapLatLngBounds: function (latlng) {\n return this.options.crs.wrapLatLngBounds(toLatLngBounds(latlng));\n },\n // @method distance(latlng1: LatLng, latlng2: LatLng): Number\n // Returns the distance between two geographical coordinates according to\n // the map's CRS. By default this measures distance in meters.\n distance: function (latlng1, latlng2) {\n return this.options.crs.distance(toLatLng(latlng1), toLatLng(latlng2));\n },\n // @method containerPointToLayerPoint(point: Point): Point\n // Given a pixel coordinate relative to the map container, returns the corresponding\n // pixel coordinate relative to the [origin pixel](#map-getpixelorigin).\n containerPointToLayerPoint: function (point) {\n // (Point)\n return toPoint(point).subtract(this._getMapPanePos());\n },\n // @method layerPointToContainerPoint(point: Point): Point\n // Given a pixel coordinate relative to the [origin pixel](#map-getpixelorigin),\n // returns the corresponding pixel coordinate relative to the map container.\n layerPointToContainerPoint: function (point) {\n // (Point)\n return toPoint(point).add(this._getMapPanePos());\n },\n // @method containerPointToLatLng(point: Point): LatLng\n // Given a pixel coordinate relative to the map container, returns\n // the corresponding geographical coordinate (for the current zoom level).\n containerPointToLatLng: function (point) {\n var layerPoint = this.containerPointToLayerPoint(toPoint(point));\n return this.layerPointToLatLng(layerPoint);\n },\n // @method latLngToContainerPoint(latlng: LatLng): Point\n // Given a geographical coordinate, returns the corresponding pixel coordinate\n // relative to the map container.\n latLngToContainerPoint: function (latlng) {\n return this.layerPointToContainerPoint(this.latLngToLayerPoint(toLatLng(latlng)));\n },\n // @method mouseEventToContainerPoint(ev: MouseEvent): Point\n // Given a MouseEvent object, returns the pixel coordinate relative to the\n // map container where the event took place.\n mouseEventToContainerPoint: function (e) {\n return getMousePosition(e, this._container);\n },\n // @method mouseEventToLayerPoint(ev: MouseEvent): Point\n // Given a MouseEvent object, returns the pixel coordinate relative to\n // the [origin pixel](#map-getpixelorigin) where the event took place.\n mouseEventToLayerPoint: function (e) {\n return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(e));\n },\n // @method mouseEventToLatLng(ev: MouseEvent): LatLng\n // Given a MouseEvent object, returns geographical coordinate where the\n // event took place.\n mouseEventToLatLng: function (e) {\n // (MouseEvent)\n return this.layerPointToLatLng(this.mouseEventToLayerPoint(e));\n },\n // map initialization methods\n _initContainer: function (id) {\n var container = this._container = get(id);\n\n if (!container) {\n throw new Error('Map container not found.');\n } else if (container._leaflet_id) {\n throw new Error('Map container is already initialized.');\n }\n\n on(container, 'scroll', this._onScroll, this);\n this._containerId = stamp(container);\n },\n _initLayout: function () {\n var container = this._container;\n this._fadeAnimated = this.options.fadeAnimation && any3d;\n addClass(container, 'leaflet-container' + (touch ? ' leaflet-touch' : '') + (retina ? ' leaflet-retina' : '') + (ielt9 ? ' leaflet-oldie' : '') + (safari ? ' leaflet-safari' : '') + (this._fadeAnimated ? ' leaflet-fade-anim' : ''));\n var position = getStyle(container, 'position');\n\n if (position !== 'absolute' && position !== 'relative' && position !== 'fixed') {\n container.style.position = 'relative';\n }\n\n this._initPanes();\n\n if (this._initControlPos) {\n this._initControlPos();\n }\n },\n _initPanes: function () {\n var panes = this._panes = {};\n this._paneRenderers = {}; // @section\n //\n // Panes are DOM elements used to control the ordering of layers on the map. You\n // can access panes with [`map.getPane`](#map-getpane) or\n // [`map.getPanes`](#map-getpanes) methods. New panes can be created with the\n // [`map.createPane`](#map-createpane) method.\n //\n // Every map has the following default panes that differ only in zIndex.\n //\n // @pane mapPane: HTMLElement = 'auto'\n // Pane that contains all other map panes\n\n this._mapPane = this.createPane('mapPane', this._container);\n setPosition(this._mapPane, new Point(0, 0)); // @pane tilePane: HTMLElement = 200\n // Pane for `GridLayer`s and `TileLayer`s\n\n this.createPane('tilePane'); // @pane overlayPane: HTMLElement = 400\n // Pane for vectors (`Path`s, like `Polyline`s and `Polygon`s), `ImageOverlay`s and `VideoOverlay`s\n\n this.createPane('shadowPane'); // @pane shadowPane: HTMLElement = 500\n // Pane for overlay shadows (e.g. `Marker` shadows)\n\n this.createPane('overlayPane'); // @pane markerPane: HTMLElement = 600\n // Pane for `Icon`s of `Marker`s\n\n this.createPane('markerPane'); // @pane tooltipPane: HTMLElement = 650\n // Pane for `Tooltip`s.\n\n this.createPane('tooltipPane'); // @pane popupPane: HTMLElement = 700\n // Pane for `Popup`s.\n\n this.createPane('popupPane');\n\n if (!this.options.markerZoomAnimation) {\n addClass(panes.markerPane, 'leaflet-zoom-hide');\n addClass(panes.shadowPane, 'leaflet-zoom-hide');\n }\n },\n // private methods that modify map state\n // @section Map state change events\n _resetView: function (center, zoom) {\n setPosition(this._mapPane, new Point(0, 0));\n var loading = !this._loaded;\n this._loaded = true;\n zoom = this._limitZoom(zoom);\n this.fire('viewprereset');\n var zoomChanged = this._zoom !== zoom;\n\n this._moveStart(zoomChanged, false)._move(center, zoom)._moveEnd(zoomChanged); // @event viewreset: Event\n // Fired when the map needs to redraw its content (this usually happens\n // on map zoom or load). Very useful for creating custom overlays.\n\n\n this.fire('viewreset'); // @event load: Event\n // Fired when the map is initialized (when its center and zoom are set\n // for the first time).\n\n if (loading) {\n this.fire('load');\n }\n },\n _moveStart: function (zoomChanged, noMoveStart) {\n // @event zoomstart: Event\n // Fired when the map zoom is about to change (e.g. before zoom animation).\n // @event movestart: Event\n // Fired when the view of the map starts changing (e.g. user starts dragging the map).\n if (zoomChanged) {\n this.fire('zoomstart');\n }\n\n if (!noMoveStart) {\n this.fire('movestart');\n }\n\n return this;\n },\n _move: function (center, zoom, data) {\n if (zoom === undefined) {\n zoom = this._zoom;\n }\n\n var zoomChanged = this._zoom !== zoom;\n this._zoom = zoom;\n this._lastCenter = center;\n this._pixelOrigin = this._getNewPixelOrigin(center); // @event zoom: Event\n // Fired repeatedly during any change in zoom level, including zoom\n // and fly animations.\n\n if (zoomChanged || data && data.pinch) {\n // Always fire 'zoom' if pinching because #3530\n this.fire('zoom', data);\n } // @event move: Event\n // Fired repeatedly during any movement of the map, including pan and\n // fly animations.\n\n\n return this.fire('move', data);\n },\n _moveEnd: function (zoomChanged) {\n // @event zoomend: Event\n // Fired when the map has changed, after any animations.\n if (zoomChanged) {\n this.fire('zoomend');\n } // @event moveend: Event\n // Fired when the center of the map stops changing (e.g. user stopped\n // dragging the map).\n\n\n return this.fire('moveend');\n },\n _stop: function () {\n cancelAnimFrame(this._flyToFrame);\n\n if (this._panAnim) {\n this._panAnim.stop();\n }\n\n return this;\n },\n _rawPanBy: function (offset) {\n setPosition(this._mapPane, this._getMapPanePos().subtract(offset));\n },\n _getZoomSpan: function () {\n return this.getMaxZoom() - this.getMinZoom();\n },\n _panInsideMaxBounds: function () {\n if (!this._enforcingBounds) {\n this.panInsideBounds(this.options.maxBounds);\n }\n },\n _checkIfLoaded: function () {\n if (!this._loaded) {\n throw new Error('Set map center and zoom first.');\n }\n },\n // DOM event handling\n // @section Interaction events\n _initEvents: function (remove$$1) {\n this._targets = {};\n this._targets[stamp(this._container)] = this;\n var onOff = remove$$1 ? off : on; // @event click: MouseEvent\n // Fired when the user clicks (or taps) the map.\n // @event dblclick: MouseEvent\n // Fired when the user double-clicks (or double-taps) the map.\n // @event mousedown: MouseEvent\n // Fired when the user pushes the mouse button on the map.\n // @event mouseup: MouseEvent\n // Fired when the user releases the mouse button on the map.\n // @event mouseover: MouseEvent\n // Fired when the mouse enters the map.\n // @event mouseout: MouseEvent\n // Fired when the mouse leaves the map.\n // @event mousemove: MouseEvent\n // Fired while the mouse moves over the map.\n // @event contextmenu: MouseEvent\n // Fired when the user pushes the right mouse button on the map, prevents\n // default browser context menu from showing if there are listeners on\n // this event. Also fired on mobile when the user holds a single touch\n // for a second (also called long press).\n // @event keypress: KeyboardEvent\n // Fired when the user presses a key from the keyboard while the map is focused.\n\n onOff(this._container, 'click dblclick mousedown mouseup ' + 'mouseover mouseout mousemove contextmenu keypress', this._handleDOMEvent, this);\n\n if (this.options.trackResize) {\n onOff(window, 'resize', this._onResize, this);\n }\n\n if (any3d && this.options.transform3DLimit) {\n (remove$$1 ? this.off : this.on).call(this, 'moveend', this._onMoveEnd);\n }\n },\n _onResize: function () {\n cancelAnimFrame(this._resizeRequest);\n this._resizeRequest = requestAnimFrame(function () {\n this.invalidateSize({\n debounceMoveend: true\n });\n }, this);\n },\n _onScroll: function () {\n this._container.scrollTop = 0;\n this._container.scrollLeft = 0;\n },\n _onMoveEnd: function () {\n var pos = this._getMapPanePos();\n\n if (Math.max(Math.abs(pos.x), Math.abs(pos.y)) >= this.options.transform3DLimit) {\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1203873 but Webkit also have\n // a pixel offset on very high values, see: http://jsfiddle.net/dg6r5hhb/\n this._resetView(this.getCenter(), this.getZoom());\n }\n },\n _findEventTargets: function (e, type) {\n var targets = [],\n target,\n isHover = type === 'mouseout' || type === 'mouseover',\n src = e.target || e.srcElement,\n dragging = false;\n\n while (src) {\n target = this._targets[stamp(src)];\n\n if (target && (type === 'click' || type === 'preclick') && !e._simulated && this._draggableMoved(target)) {\n // Prevent firing click after you just dragged an object.\n dragging = true;\n break;\n }\n\n if (target && target.listens(type, true)) {\n if (isHover && !isExternalTarget(src, e)) {\n break;\n }\n\n targets.push(target);\n\n if (isHover) {\n break;\n }\n }\n\n if (src === this._container) {\n break;\n }\n\n src = src.parentNode;\n }\n\n if (!targets.length && !dragging && !isHover && isExternalTarget(src, e)) {\n targets = [this];\n }\n\n return targets;\n },\n _handleDOMEvent: function (e) {\n if (!this._loaded || skipped(e)) {\n return;\n }\n\n var type = e.type;\n\n if (type === 'mousedown' || type === 'keypress') {\n // prevents outline when clicking on keyboard-focusable element\n preventOutline(e.target || e.srcElement);\n }\n\n this._fireDOMEvent(e, type);\n },\n _mouseEvents: ['click', 'dblclick', 'mouseover', 'mouseout', 'contextmenu'],\n _fireDOMEvent: function (e, type, targets) {\n if (e.type === 'click') {\n // Fire a synthetic 'preclick' event which propagates up (mainly for closing popups).\n // @event preclick: MouseEvent\n // Fired before mouse click on the map (sometimes useful when you\n // want something to happen on click before any existing click\n // handlers start running).\n var synth = extend({}, e);\n synth.type = 'preclick';\n\n this._fireDOMEvent(synth, synth.type, targets);\n }\n\n if (e._stopped) {\n return;\n } // Find the layer the event is propagating from and its parents.\n\n\n targets = (targets || []).concat(this._findEventTargets(e, type));\n\n if (!targets.length) {\n return;\n }\n\n var target = targets[0];\n\n if (type === 'contextmenu' && target.listens(type, true)) {\n preventDefault(e);\n }\n\n var data = {\n originalEvent: e\n };\n\n if (e.type !== 'keypress') {\n var isMarker = target.getLatLng && (!target._radius || target._radius <= 10);\n data.containerPoint = isMarker ? this.latLngToContainerPoint(target.getLatLng()) : this.mouseEventToContainerPoint(e);\n data.layerPoint = this.containerPointToLayerPoint(data.containerPoint);\n data.latlng = isMarker ? target.getLatLng() : this.layerPointToLatLng(data.layerPoint);\n }\n\n for (var i = 0; i < targets.length; i++) {\n targets[i].fire(type, data, true);\n\n if (data.originalEvent._stopped || targets[i].options.bubblingMouseEvents === false && indexOf(this._mouseEvents, type) !== -1) {\n return;\n }\n }\n },\n _draggableMoved: function (obj) {\n obj = obj.dragging && obj.dragging.enabled() ? obj : this;\n return obj.dragging && obj.dragging.moved() || this.boxZoom && this.boxZoom.moved();\n },\n _clearHandlers: function () {\n for (var i = 0, len = this._handlers.length; i < len; i++) {\n this._handlers[i].disable();\n }\n },\n // @section Other Methods\n // @method whenReady(fn: Function, context?: Object): this\n // Runs the given function `fn` when the map gets initialized with\n // a view (center and zoom) and at least one layer, or immediately\n // if it's already initialized, optionally passing a function context.\n whenReady: function (callback, context) {\n if (this._loaded) {\n callback.call(context || this, {\n target: this\n });\n } else {\n this.on('load', callback, context);\n }\n\n return this;\n },\n // private methods for getting map state\n _getMapPanePos: function () {\n return getPosition(this._mapPane) || new Point(0, 0);\n },\n _moved: function () {\n var pos = this._getMapPanePos();\n\n return pos && !pos.equals([0, 0]);\n },\n _getTopLeftPoint: function (center, zoom) {\n var pixelOrigin = center && zoom !== undefined ? this._getNewPixelOrigin(center, zoom) : this.getPixelOrigin();\n return pixelOrigin.subtract(this._getMapPanePos());\n },\n _getNewPixelOrigin: function (center, zoom) {\n var viewHalf = this.getSize()._divideBy(2);\n\n return this.project(center, zoom)._subtract(viewHalf)._add(this._getMapPanePos())._round();\n },\n _latLngToNewLayerPoint: function (latlng, zoom, center) {\n var topLeft = this._getNewPixelOrigin(center, zoom);\n\n return this.project(latlng, zoom)._subtract(topLeft);\n },\n _latLngBoundsToNewLayerBounds: function (latLngBounds, zoom, center) {\n var topLeft = this._getNewPixelOrigin(center, zoom);\n\n return toBounds([this.project(latLngBounds.getSouthWest(), zoom)._subtract(topLeft), this.project(latLngBounds.getNorthWest(), zoom)._subtract(topLeft), this.project(latLngBounds.getSouthEast(), zoom)._subtract(topLeft), this.project(latLngBounds.getNorthEast(), zoom)._subtract(topLeft)]);\n },\n // layer point of the current center\n _getCenterLayerPoint: function () {\n return this.containerPointToLayerPoint(this.getSize()._divideBy(2));\n },\n // offset of the specified place to the current center in pixels\n _getCenterOffset: function (latlng) {\n return this.latLngToLayerPoint(latlng).subtract(this._getCenterLayerPoint());\n },\n // adjust center for view to get inside bounds\n _limitCenter: function (center, zoom, bounds) {\n if (!bounds) {\n return center;\n }\n\n var centerPoint = this.project(center, zoom),\n viewHalf = this.getSize().divideBy(2),\n viewBounds = new Bounds(centerPoint.subtract(viewHalf), centerPoint.add(viewHalf)),\n offset = this._getBoundsOffset(viewBounds, bounds, zoom); // If offset is less than a pixel, ignore.\n // This prevents unstable projections from getting into\n // an infinite loop of tiny offsets.\n\n\n if (offset.round().equals([0, 0])) {\n return center;\n }\n\n return this.unproject(centerPoint.add(offset), zoom);\n },\n // adjust offset for view to get inside bounds\n _limitOffset: function (offset, bounds) {\n if (!bounds) {\n return offset;\n }\n\n var viewBounds = this.getPixelBounds(),\n newBounds = new Bounds(viewBounds.min.add(offset), viewBounds.max.add(offset));\n return offset.add(this._getBoundsOffset(newBounds, bounds));\n },\n // returns offset needed for pxBounds to get inside maxBounds at a specified zoom\n _getBoundsOffset: function (pxBounds, maxBounds, zoom) {\n var projectedMaxBounds = toBounds(this.project(maxBounds.getNorthEast(), zoom), this.project(maxBounds.getSouthWest(), zoom)),\n minOffset = projectedMaxBounds.min.subtract(pxBounds.min),\n maxOffset = projectedMaxBounds.max.subtract(pxBounds.max),\n dx = this._rebound(minOffset.x, -maxOffset.x),\n dy = this._rebound(minOffset.y, -maxOffset.y);\n\n return new Point(dx, dy);\n },\n _rebound: function (left, right) {\n return left + right > 0 ? Math.round(left - right) / 2 : Math.max(0, Math.ceil(left)) - Math.max(0, Math.floor(right));\n },\n _limitZoom: function (zoom) {\n var min = this.getMinZoom(),\n max = this.getMaxZoom(),\n snap = any3d ? this.options.zoomSnap : 1;\n\n if (snap) {\n zoom = Math.round(zoom / snap) * snap;\n }\n\n return Math.max(min, Math.min(max, zoom));\n },\n _onPanTransitionStep: function () {\n this.fire('move');\n },\n _onPanTransitionEnd: function () {\n removeClass(this._mapPane, 'leaflet-pan-anim');\n this.fire('moveend');\n },\n _tryAnimatedPan: function (center, options) {\n // difference between the new and current centers in pixels\n var offset = this._getCenterOffset(center)._trunc(); // don't animate too far unless animate: true specified in options\n\n\n if ((options && options.animate) !== true && !this.getSize().contains(offset)) {\n return false;\n }\n\n this.panBy(offset, options);\n return true;\n },\n _createAnimProxy: function () {\n var proxy = this._proxy = create$1('div', 'leaflet-proxy leaflet-zoom-animated');\n\n this._panes.mapPane.appendChild(proxy);\n\n this.on('zoomanim', function (e) {\n var prop = TRANSFORM,\n transform = this._proxy.style[prop];\n setTransform(this._proxy, this.project(e.center, e.zoom), this.getZoomScale(e.zoom, 1)); // workaround for case when transform is the same and so transitionend event is not fired\n\n if (transform === this._proxy.style[prop] && this._animatingZoom) {\n this._onZoomTransitionEnd();\n }\n }, this);\n this.on('load moveend', function () {\n var c = this.getCenter(),\n z = this.getZoom();\n setTransform(this._proxy, this.project(c, z), this.getZoomScale(z, 1));\n }, this);\n\n this._on('unload', this._destroyAnimProxy, this);\n },\n _destroyAnimProxy: function () {\n remove(this._proxy);\n delete this._proxy;\n },\n _catchTransitionEnd: function (e) {\n if (this._animatingZoom && e.propertyName.indexOf('transform') >= 0) {\n this._onZoomTransitionEnd();\n }\n },\n _nothingToAnimate: function () {\n return !this._container.getElementsByClassName('leaflet-zoom-animated').length;\n },\n _tryAnimatedZoom: function (center, zoom, options) {\n if (this._animatingZoom) {\n return true;\n }\n\n options = options || {}; // don't animate if disabled, not supported or zoom difference is too large\n\n if (!this._zoomAnimated || options.animate === false || this._nothingToAnimate() || Math.abs(zoom - this._zoom) > this.options.zoomAnimationThreshold) {\n return false;\n } // offset is the pixel coords of the zoom origin relative to the current center\n\n\n var scale = this.getZoomScale(zoom),\n offset = this._getCenterOffset(center)._divideBy(1 - 1 / scale); // don't animate if the zoom origin isn't within one screen from the current center, unless forced\n\n\n if (options.animate !== true && !this.getSize().contains(offset)) {\n return false;\n }\n\n requestAnimFrame(function () {\n this._moveStart(true, false)._animateZoom(center, zoom, true);\n }, this);\n return true;\n },\n _animateZoom: function (center, zoom, startAnim, noUpdate) {\n if (!this._mapPane) {\n return;\n }\n\n if (startAnim) {\n this._animatingZoom = true; // remember what center/zoom to set after animation\n\n this._animateToCenter = center;\n this._animateToZoom = zoom;\n addClass(this._mapPane, 'leaflet-zoom-anim');\n } // @event zoomanim: ZoomAnimEvent\n // Fired at least once per zoom animation. For continous zoom, like pinch zooming, fired once per frame during zoom.\n\n\n this.fire('zoomanim', {\n center: center,\n zoom: zoom,\n noUpdate: noUpdate\n }); // Work around webkit not firing 'transitionend', see https://github.com/Leaflet/Leaflet/issues/3689, 2693\n\n setTimeout(bind(this._onZoomTransitionEnd, this), 250);\n },\n _onZoomTransitionEnd: function () {\n if (!this._animatingZoom) {\n return;\n }\n\n if (this._mapPane) {\n removeClass(this._mapPane, 'leaflet-zoom-anim');\n }\n\n this._animatingZoom = false;\n\n this._move(this._animateToCenter, this._animateToZoom); // This anim frame should prevent an obscure iOS webkit tile loading race condition.\n\n\n requestAnimFrame(function () {\n this._moveEnd(true);\n }, this);\n }\n }); // @section\n // @factory L.map(id: String, options?: Map options)\n // Instantiates a map object given the DOM ID of a `<div>` element\n // and optionally an object literal with `Map options`.\n //\n // @alternative\n // @factory L.map(el: HTMLElement, options?: Map options)\n // Instantiates a map object given an instance of a `<div>` HTML element\n // and optionally an object literal with `Map options`.\n\n function createMap(id, options) {\n return new Map(id, options);\n }\n /*\r\n * @class Control\r\n * @aka L.Control\r\n * @inherits Class\r\n *\r\n * L.Control is a base class for implementing map controls. Handles positioning.\r\n * All other controls extend from this class.\r\n */\n\n\n var Control = Class.extend({\n // @section\n // @aka Control options\n options: {\n // @option position: String = 'topright'\n // The position of the control (one of the map corners). Possible values are `'topleft'`,\n // `'topright'`, `'bottomleft'` or `'bottomright'`\n position: 'topright'\n },\n initialize: function (options) {\n setOptions(this, options);\n },\n\n /* @section\r\n * Classes extending L.Control will inherit the following methods:\r\n *\r\n * @method getPosition: string\r\n * Returns the position of the control.\r\n */\n getPosition: function () {\n return this.options.position;\n },\n // @method setPosition(position: string): this\n // Sets the position of the control.\n setPosition: function (position) {\n var map = this._map;\n\n if (map) {\n map.removeControl(this);\n }\n\n this.options.position = position;\n\n if (map) {\n map.addControl(this);\n }\n\n return this;\n },\n // @method getContainer: HTMLElement\n // Returns the HTMLElement that contains the control.\n getContainer: function () {\n return this._container;\n },\n // @method addTo(map: Map): this\n // Adds the control to the given map.\n addTo: function (map) {\n this.remove();\n this._map = map;\n var container = this._container = this.onAdd(map),\n pos = this.getPosition(),\n corner = map._controlCorners[pos];\n addClass(container, 'leaflet-control');\n\n if (pos.indexOf('bottom') !== -1) {\n corner.insertBefore(container, corner.firstChild);\n } else {\n corner.appendChild(container);\n }\n\n return this;\n },\n // @method remove: this\n // Removes the control from the map it is currently active on.\n remove: function () {\n if (!this._map) {\n return this;\n }\n\n remove(this._container);\n\n if (this.onRemove) {\n this.onRemove(this._map);\n }\n\n this._map = null;\n return this;\n },\n _refocusOnMap: function (e) {\n // if map exists and event is not a keyboard event\n if (this._map && e && e.screenX > 0 && e.screenY > 0) {\n this._map.getContainer().focus();\n }\n }\n });\n\n var control = function (options) {\n return new Control(options);\n };\n /* @section Extension methods\r\n * @uninheritable\r\n *\r\n * Every control should extend from `L.Control` and (re-)implement the following methods.\r\n *\r\n * @method onAdd(map: Map): HTMLElement\r\n * Should return the container DOM element for the control and add listeners on relevant map events. Called on [`control.addTo(map)`](#control-addTo).\r\n *\r\n * @method onRemove(map: Map)\r\n * 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\n */\n\n /* @namespace Map\r\n * @section Methods for Layers and Controls\r\n */\n\n\n Map.include({\n // @method addControl(control: Control): this\n // Adds the given control to the map\n addControl: function (control) {\n control.addTo(this);\n return this;\n },\n // @method removeControl(control: Control): this\n // Removes the given control from the map\n removeControl: function (control) {\n control.remove();\n return this;\n },\n _initControlPos: function () {\n var corners = this._controlCorners = {},\n l = 'leaflet-',\n container = this._controlContainer = create$1('div', l + 'control-container', this._container);\n\n function createCorner(vSide, hSide) {\n var className = l + vSide + ' ' + l + hSide;\n corners[vSide + hSide] = create$1('div', className, container);\n }\n\n createCorner('top', 'left');\n createCorner('top', 'right');\n createCorner('bottom', 'left');\n createCorner('bottom', 'right');\n },\n _clearControlPos: function () {\n for (var i in this._controlCorners) {\n remove(this._controlCorners[i]);\n }\n\n remove(this._controlContainer);\n delete this._controlCorners;\n delete this._controlContainer;\n }\n });\n /*\r\n * @class Control.Layers\r\n * @aka L.Control.Layers\r\n * @inherits Control\r\n *\r\n * 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\n *\r\n * @example\r\n *\r\n * ```js\r\n * var baseLayers = {\r\n * \t\"Mapbox\": mapbox,\r\n * \t\"OpenStreetMap\": osm\r\n * };\r\n *\r\n * var overlays = {\r\n * \t\"Marker\": marker,\r\n * \t\"Roads\": roadsLayer\r\n * };\r\n *\r\n * L.control.layers(baseLayers, overlays).addTo(map);\r\n * ```\r\n *\r\n * The `baseLayers` and `overlays` parameters are object literals with layer names as keys and `Layer` objects as values:\r\n *\r\n * ```js\r\n * {\r\n * \"<someName1>\": layer1,\r\n * \"<someName2>\": layer2\r\n * }\r\n * ```\r\n *\r\n * The layer names can contain HTML, which allows you to add additional styling to the items:\r\n *\r\n * ```js\r\n * {\"<img src='my-layer-icon' /> <span class='my-layer-item'>My Layer</span>\": myLayer}\r\n * ```\r\n */\n\n var Layers = Control.extend({\n // @section\n // @aka Control.Layers options\n options: {\n // @option collapsed: Boolean = true\n // If `true`, the control will be collapsed into an icon and expanded on mouse hover or touch.\n collapsed: true,\n position: 'topright',\n // @option autoZIndex: Boolean = true\n // 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.\n autoZIndex: true,\n // @option hideSingleBase: Boolean = false\n // If `true`, the base layers in the control will be hidden when there is only one.\n hideSingleBase: false,\n // @option sortLayers: Boolean = false\n // Whether to sort the layers. When `false`, layers will keep the order\n // in which they were added to the control.\n sortLayers: false,\n // @option sortFunction: Function = *\n // A [compare function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/sort)\n // that will be used for sorting the layers, when `sortLayers` is `true`.\n // The function receives both the `L.Layer` instances and their names, as in\n // `sortFunction(layerA, layerB, nameA, nameB)`.\n // By default, it sorts layers alphabetically by their name.\n sortFunction: function (layerA, layerB, nameA, nameB) {\n return nameA < nameB ? -1 : nameB < nameA ? 1 : 0;\n }\n },\n initialize: function (baseLayers, overlays, options) {\n setOptions(this, options);\n this._layerControlInputs = [];\n this._layers = [];\n this._lastZIndex = 0;\n this._handlingClick = false;\n\n for (var i in baseLayers) {\n this._addLayer(baseLayers[i], i);\n }\n\n for (i in overlays) {\n this._addLayer(overlays[i], i, true);\n }\n },\n onAdd: function (map) {\n this._initLayout();\n\n this._update();\n\n this._map = map;\n map.on('zoomend', this._checkDisabledLayers, this);\n\n for (var i = 0; i < this._layers.length; i++) {\n this._layers[i].layer.on('add remove', this._onLayerChange, this);\n }\n\n return this._container;\n },\n addTo: function (map) {\n Control.prototype.addTo.call(this, map); // Trigger expand after Layers Control has been inserted into DOM so that is now has an actual height.\n\n return this._expandIfNotCollapsed();\n },\n onRemove: function () {\n this._map.off('zoomend', this._checkDisabledLayers, this);\n\n for (var i = 0; i < this._layers.length; i++) {\n this._layers[i].layer.off('add remove', this._onLayerChange, this);\n }\n },\n // @method addBaseLayer(layer: Layer, name: String): this\n // Adds a base layer (radio button entry) with the given name to the control.\n addBaseLayer: function (layer, name) {\n this._addLayer(layer, name);\n\n return this._map ? this._update() : this;\n },\n // @method addOverlay(layer: Layer, name: String): this\n // Adds an overlay (checkbox entry) with the given name to the control.\n addOverlay: function (layer, name) {\n this._addLayer(layer, name, true);\n\n return this._map ? this._update() : this;\n },\n // @method removeLayer(layer: Layer): this\n // Remove the given layer from the control.\n removeLayer: function (layer) {\n layer.off('add remove', this._onLayerChange, this);\n\n var obj = this._getLayer(stamp(layer));\n\n if (obj) {\n this._layers.splice(this._layers.indexOf(obj), 1);\n }\n\n return this._map ? this._update() : this;\n },\n // @method expand(): this\n // Expand the control container if collapsed.\n expand: function () {\n addClass(this._container, 'leaflet-control-layers-expanded');\n this._section.style.height = null;\n var acceptableHeight = this._map.getSize().y - (this._container.offsetTop + 50);\n\n if (acceptableHeight < this._section.clientHeight) {\n addClass(this._section, 'leaflet-control-layers-scrollbar');\n this._section.style.height = acceptableHeight + 'px';\n } else {\n removeClass(this._section, 'leaflet-control-layers-scrollbar');\n }\n\n this._checkDisabledLayers();\n\n return this;\n },\n // @method collapse(): this\n // Collapse the control container if expanded.\n collapse: function () {\n removeClass(this._container, 'leaflet-control-layers-expanded');\n return this;\n },\n _initLayout: function () {\n var className = 'leaflet-control-layers',\n container = this._container = create$1('div', className),\n collapsed = this.options.collapsed; // makes this work on IE touch devices by stopping it from firing a mouseout event when the touch is released\n\n container.setAttribute('aria-haspopup', true);\n disableClickPropagation(container);\n disableScrollPropagation(container);\n var section = this._section = create$1('section', className + '-list');\n\n if (collapsed) {\n this._map.on('click', this.collapse, this);\n\n if (!android) {\n on(container, {\n mouseenter: this.expand,\n mouseleave: this.collapse\n }, this);\n }\n }\n\n var link = this._layersLink = create$1('a', className + '-toggle', container);\n link.href = '#';\n link.title = 'Layers';\n\n if (touch) {\n on(link, 'click', stop);\n on(link, 'click', this.expand, this);\n } else {\n on(link, 'focus', this.expand, this);\n }\n\n if (!collapsed) {\n this.expand();\n }\n\n this._baseLayersList = create$1('div', className + '-base', section);\n this._separator = create$1('div', className + '-separator', section);\n this._overlaysList = create$1('div', className + '-overlays', section);\n container.appendChild(section);\n },\n _getLayer: function (id) {\n for (var i = 0; i < this._layers.length; i++) {\n if (this._layers[i] && stamp(this._layers[i].layer) === id) {\n return this._layers[i];\n }\n }\n },\n _addLayer: function (layer, name, overlay) {\n if (this._map) {\n layer.on('add remove', this._onLayerChange, this);\n }\n\n this._layers.push({\n layer: layer,\n name: name,\n overlay: overlay\n });\n\n if (this.options.sortLayers) {\n this._layers.sort(bind(function (a, b) {\n return this.options.sortFunction(a.layer, b.layer, a.name, b.name);\n }, this));\n }\n\n if (this.options.autoZIndex && layer.setZIndex) {\n this._lastZIndex++;\n layer.setZIndex(this._lastZIndex);\n }\n\n this._expandIfNotCollapsed();\n },\n _update: function () {\n if (!this._container) {\n return this;\n }\n\n empty(this._baseLayersList);\n empty(this._overlaysList);\n this._layerControlInputs = [];\n var baseLayersPresent,\n overlaysPresent,\n i,\n obj,\n baseLayersCount = 0;\n\n for (i = 0; i < this._layers.length; i++) {\n obj = this._layers[i];\n\n this._addItem(obj);\n\n overlaysPresent = overlaysPresent || obj.overlay;\n baseLayersPresent = baseLayersPresent || !obj.overlay;\n baseLayersCount += !obj.overlay ? 1 : 0;\n } // Hide base layers section if there's only one layer.\n\n\n if (this.options.hideSingleBase) {\n baseLayersPresent = baseLayersPresent && baseLayersCount > 1;\n this._baseLayersList.style.display = baseLayersPresent ? '' : 'none';\n }\n\n this._separator.style.display = overlaysPresent && baseLayersPresent ? '' : 'none';\n return this;\n },\n _onLayerChange: function (e) {\n if (!this._handlingClick) {\n this._update();\n }\n\n var obj = this._getLayer(stamp(e.target)); // @namespace Map\n // @section Layer events\n // @event baselayerchange: LayersControlEvent\n // Fired when the base layer is changed through the [layer control](#control-layers).\n // @event overlayadd: LayersControlEvent\n // Fired when an overlay is selected through the [layer control](#control-layers).\n // @event overlayremove: LayersControlEvent\n // Fired when an overlay is deselected through the [layer control](#control-layers).\n // @namespace Control.Layers\n\n\n var type = obj.overlay ? e.type === 'add' ? 'overlayadd' : 'overlayremove' : e.type === 'add' ? 'baselayerchange' : null;\n\n if (type) {\n this._map.fire(type, obj);\n }\n },\n // IE7 bugs out if you create a radio dynamically, so you have to do it this hacky way (see http://bit.ly/PqYLBe)\n _createRadioElement: function (name, checked) {\n var radioHtml = '<input type=\"radio\" class=\"leaflet-control-layers-selector\" name=\"' + name + '\"' + (checked ? ' checked=\"checked\"' : '') + '/>';\n var radioFragment = document.createElement('div');\n radioFragment.innerHTML = radioHtml;\n return radioFragment.firstChild;\n },\n _addItem: function (obj) {\n var label = document.createElement('label'),\n checked = this._map.hasLayer(obj.layer),\n input;\n\n if (obj.overlay) {\n input = document.createElement('input');\n input.type = 'checkbox';\n input.className = 'leaflet-control-layers-selector';\n input.defaultChecked = checked;\n } else {\n input = this._createRadioElement('leaflet-base-layers', checked);\n }\n\n this._layerControlInputs.push(input);\n\n input.layerId = stamp(obj.layer);\n on(input, 'click', this._onInputClick, this);\n var name = document.createElement('span');\n name.innerHTML = ' ' + obj.name; // Helps from preventing layer control flicker when checkboxes are disabled\n // https://github.com/Leaflet/Leaflet/issues/2771\n\n var holder = document.createElement('div');\n label.appendChild(holder);\n holder.appendChild(input);\n holder.appendChild(name);\n var container = obj.overlay ? this._overlaysList : this._baseLayersList;\n container.appendChild(label);\n\n this._checkDisabledLayers();\n\n return label;\n },\n _onInputClick: function () {\n var inputs = this._layerControlInputs,\n input,\n layer;\n var addedLayers = [],\n removedLayers = [];\n this._handlingClick = true;\n\n for (var i = inputs.length - 1; i >= 0; i--) {\n input = inputs[i];\n layer = this._getLayer(input.layerId).layer;\n\n if (input.checked) {\n addedLayers.push(layer);\n } else if (!input.checked) {\n removedLayers.push(layer);\n }\n } // Bugfix issue 2318: Should remove all old layers before readding new ones\n\n\n for (i = 0; i < removedLayers.length; i++) {\n if (this._map.hasLayer(removedLayers[i])) {\n this._map.removeLayer(removedLayers[i]);\n }\n }\n\n for (i = 0; i < addedLayers.length; i++) {\n if (!this._map.hasLayer(addedLayers[i])) {\n this._map.addLayer(addedLayers[i]);\n }\n }\n\n this._handlingClick = false;\n\n this._refocusOnMap();\n },\n _checkDisabledLayers: function () {\n var inputs = this._layerControlInputs,\n input,\n layer,\n zoom = this._map.getZoom();\n\n for (var i = inputs.length - 1; i >= 0; i--) {\n input = inputs[i];\n layer = this._getLayer(input.layerId).layer;\n input.disabled = layer.options.minZoom !== undefined && zoom < layer.options.minZoom || layer.options.maxZoom !== undefined && zoom > layer.options.maxZoom;\n }\n },\n _expandIfNotCollapsed: function () {\n if (this._map && !this.options.collapsed) {\n this.expand();\n }\n\n return this;\n },\n _expand: function () {\n // Backward compatibility, remove me in 1.1.\n return this.expand();\n },\n _collapse: function () {\n // Backward compatibility, remove me in 1.1.\n return this.collapse();\n }\n }); // @factory L.control.layers(baselayers?: Object, overlays?: Object, options?: Control.Layers options)\n // 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.\n\n var layers = function (baseLayers, overlays, options) {\n return new Layers(baseLayers, overlays, options);\n };\n /*\r\n * @class Control.Zoom\r\n * @aka L.Control.Zoom\r\n * @inherits Control\r\n *\r\n * 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\n */\n\n\n var Zoom = Control.extend({\n // @section\n // @aka Control.Zoom options\n options: {\n position: 'topleft',\n // @option zoomInText: String = '+'\n // The text set on the 'zoom in' button.\n zoomInText: '+',\n // @option zoomInTitle: String = 'Zoom in'\n // The title set on the 'zoom in' button.\n zoomInTitle: 'Zoom in',\n // @option zoomOutText: String = '&#x2212;'\n // The text set on the 'zoom out' button.\n zoomOutText: '&#x2212;',\n // @option zoomOutTitle: String = 'Zoom out'\n // The title set on the 'zoom out' button.\n zoomOutTitle: 'Zoom out'\n },\n onAdd: function (map) {\n var zoomName = 'leaflet-control-zoom',\n container = create$1('div', zoomName + ' leaflet-bar'),\n options = this.options;\n this._zoomInButton = this._createButton(options.zoomInText, options.zoomInTitle, zoomName + '-in', container, this._zoomIn);\n this._zoomOutButton = this._createButton(options.zoomOutText, options.zoomOutTitle, zoomName + '-out', container, this._zoomOut);\n\n this._updateDisabled();\n\n map.on('zoomend zoomlevelschange', this._updateDisabled, this);\n return container;\n },\n onRemove: function (map) {\n map.off('zoomend zoomlevelschange', this._updateDisabled, this);\n },\n disable: function () {\n this._disabled = true;\n\n this._updateDisabled();\n\n return this;\n },\n enable: function () {\n this._disabled = false;\n\n this._updateDisabled();\n\n return this;\n },\n _zoomIn: function (e) {\n if (!this._disabled && this._map._zoom < this._map.getMaxZoom()) {\n this._map.zoomIn(this._map.options.zoomDelta * (e.shiftKey ? 3 : 1));\n }\n },\n _zoomOut: function (e) {\n if (!this._disabled && this._map._zoom > this._map.getMinZoom()) {\n this._map.zoomOut(this._map.options.zoomDelta * (e.shiftKey ? 3 : 1));\n }\n },\n _createButton: function (html, title, className, container, fn) {\n var link = create$1('a', className, container);\n link.innerHTML = html;\n link.href = '#';\n link.title = title;\n /*\r\n * Will force screen readers like VoiceOver to read this as \"Zoom in - button\"\r\n */\n\n link.setAttribute('role', 'button');\n link.setAttribute('aria-label', title);\n disableClickPropagation(link);\n on(link, 'click', stop);\n on(link, 'click', fn, this);\n on(link, 'click', this._refocusOnMap, this);\n return link;\n },\n _updateDisabled: function () {\n var map = this._map,\n className = 'leaflet-disabled';\n removeClass(this._zoomInButton, className);\n removeClass(this._zoomOutButton, className);\n\n if (this._disabled || map._zoom === map.getMinZoom()) {\n addClass(this._zoomOutButton, className);\n }\n\n if (this._disabled || map._zoom === map.getMaxZoom()) {\n addClass(this._zoomInButton, className);\n }\n }\n }); // @namespace Map\n // @section Control options\n // @option zoomControl: Boolean = true\n // Whether a [zoom control](#control-zoom) is added to the map by default.\n\n Map.mergeOptions({\n zoomControl: true\n });\n Map.addInitHook(function () {\n if (this.options.zoomControl) {\n // @section Controls\n // @property zoomControl: Control.Zoom\n // The default zoom control (only available if the\n // [`zoomControl` option](#map-zoomcontrol) was `true` when creating the map).\n this.zoomControl = new Zoom();\n this.addControl(this.zoomControl);\n }\n }); // @namespace Control.Zoom\n // @factory L.control.zoom(options: Control.Zoom options)\n // Creates a zoom control\n\n var zoom = function (options) {\n return new Zoom(options);\n };\n /*\n * @class Control.Scale\n * @aka L.Control.Scale\n * @inherits Control\n *\n * 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`.\n *\n * @example\n *\n * ```js\n * L.control.scale().addTo(map);\n * ```\n */\n\n\n var Scale = Control.extend({\n // @section\n // @aka Control.Scale options\n options: {\n position: 'bottomleft',\n // @option maxWidth: Number = 100\n // Maximum width of the control in pixels. The width is set dynamically to show round values (e.g. 100, 200, 500).\n maxWidth: 100,\n // @option metric: Boolean = True\n // Whether to show the metric scale line (m/km).\n metric: true,\n // @option imperial: Boolean = True\n // Whether to show the imperial scale line (mi/ft).\n imperial: true // @option updateWhenIdle: Boolean = false\n // If `true`, the control is updated on [`moveend`](#map-moveend), otherwise it's always up-to-date (updated on [`move`](#map-move)).\n\n },\n onAdd: function (map) {\n var className = 'leaflet-control-scale',\n container = create$1('div', className),\n options = this.options;\n\n this._addScales(options, className + '-line', container);\n\n map.on(options.updateWhenIdle ? 'moveend' : 'move', this._update, this);\n map.whenReady(this._update, this);\n return container;\n },\n onRemove: function (map) {\n map.off(this.options.updateWhenIdle ? 'moveend' : 'move', this._update, this);\n },\n _addScales: function (options, className, container) {\n if (options.metric) {\n this._mScale = create$1('div', className, container);\n }\n\n if (options.imperial) {\n this._iScale = create$1('div', className, container);\n }\n },\n _update: function () {\n var map = this._map,\n y = map.getSize().y / 2;\n var maxMeters = map.distance(map.containerPointToLatLng([0, y]), map.containerPointToLatLng([this.options.maxWidth, y]));\n\n this._updateScales(maxMeters);\n },\n _updateScales: function (maxMeters) {\n if (this.options.metric && maxMeters) {\n this._updateMetric(maxMeters);\n }\n\n if (this.options.imperial && maxMeters) {\n this._updateImperial(maxMeters);\n }\n },\n _updateMetric: function (maxMeters) {\n var meters = this._getRoundNum(maxMeters),\n label = meters < 1000 ? meters + ' m' : meters / 1000 + ' km';\n\n this._updateScale(this._mScale, label, meters / maxMeters);\n },\n _updateImperial: function (maxMeters) {\n var maxFeet = maxMeters * 3.2808399,\n maxMiles,\n miles,\n feet;\n\n if (maxFeet > 5280) {\n maxMiles = maxFeet / 5280;\n miles = this._getRoundNum(maxMiles);\n\n this._updateScale(this._iScale, miles + ' mi', miles / maxMiles);\n } else {\n feet = this._getRoundNum(maxFeet);\n\n this._updateScale(this._iScale, feet + ' ft', feet / maxFeet);\n }\n },\n _updateScale: function (scale, text, ratio) {\n scale.style.width = Math.round(this.options.maxWidth * ratio) + 'px';\n scale.innerHTML = text;\n },\n _getRoundNum: function (num) {\n var pow10 = Math.pow(10, (Math.floor(num) + '').length - 1),\n d = num / pow10;\n d = d >= 10 ? 10 : d >= 5 ? 5 : d >= 3 ? 3 : d >= 2 ? 2 : 1;\n return pow10 * d;\n }\n }); // @factory L.control.scale(options?: Control.Scale options)\n // Creates an scale control with the given options.\n\n var scale = function (options) {\n return new Scale(options);\n };\n /*\r\n * @class Control.Attribution\r\n * @aka L.Control.Attribution\r\n * @inherits Control\r\n *\r\n * 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\n */\n\n\n var Attribution = Control.extend({\n // @section\n // @aka Control.Attribution options\n options: {\n position: 'bottomright',\n // @option prefix: String = 'Leaflet'\n // The HTML text shown before the attributions. Pass `false` to disable.\n prefix: '<a href=\"http://leafletjs.com\" title=\"A JS library for interactive maps\">Leaflet</a>'\n },\n initialize: function (options) {\n setOptions(this, options);\n this._attributions = {};\n },\n onAdd: function (map) {\n map.attributionControl = this;\n this._container = create$1('div', 'leaflet-control-attribution');\n disableClickPropagation(this._container); // TODO ugly, refactor\n\n for (var i in map._layers) {\n if (map._layers[i].getAttribution) {\n this.addAttribution(map._layers[i].getAttribution());\n }\n }\n\n this._update();\n\n return this._container;\n },\n // @method setPrefix(prefix: String): this\n // Sets the text before the attributions.\n setPrefix: function (prefix) {\n this.options.prefix = prefix;\n\n this._update();\n\n return this;\n },\n // @method addAttribution(text: String): this\n // Adds an attribution text (e.g. `'Vector data &copy; Mapbox'`).\n addAttribution: function (text) {\n if (!text) {\n return this;\n }\n\n if (!this._attributions[text]) {\n this._attributions[text] = 0;\n }\n\n this._attributions[text]++;\n\n this._update();\n\n return this;\n },\n // @method removeAttribution(text: String): this\n // Removes an attribution text.\n removeAttribution: function (text) {\n if (!text) {\n return this;\n }\n\n if (this._attributions[text]) {\n this._attributions[text]--;\n\n this._update();\n }\n\n return this;\n },\n _update: function () {\n if (!this._map) {\n return;\n }\n\n var attribs = [];\n\n for (var i in this._attributions) {\n if (this._attributions[i]) {\n attribs.push(i);\n }\n }\n\n var prefixAndAttribs = [];\n\n if (this.options.prefix) {\n prefixAndAttribs.push(this.options.prefix);\n }\n\n if (attribs.length) {\n prefixAndAttribs.push(attribs.join(', '));\n }\n\n this._container.innerHTML = prefixAndAttribs.join(' | ');\n }\n }); // @namespace Map\n // @section Control options\n // @option attributionControl: Boolean = true\n // Whether a [attribution control](#control-attribution) is added to the map by default.\n\n Map.mergeOptions({\n attributionControl: true\n });\n Map.addInitHook(function () {\n if (this.options.attributionControl) {\n new Attribution().addTo(this);\n }\n }); // @namespace Control.Attribution\n // @factory L.control.attribution(options: Control.Attribution options)\n // Creates an attribution control.\n\n var attribution = function (options) {\n return new Attribution(options);\n };\n\n Control.Layers = Layers;\n Control.Zoom = Zoom;\n Control.Scale = Scale;\n Control.Attribution = Attribution;\n control.layers = layers;\n control.zoom = zoom;\n control.scale = scale;\n control.attribution = attribution;\n /*\n \tL.Handler is a base class for handler classes that are used internally to inject\n \tinteraction features like dragging to classes like Map and Marker.\n */\n // @class Handler\n // @aka L.Handler\n // Abstract class for map interaction handlers\n\n var Handler = Class.extend({\n initialize: function (map) {\n this._map = map;\n },\n // @method enable(): this\n // Enables the handler\n enable: function () {\n if (this._enabled) {\n return this;\n }\n\n this._enabled = true;\n this.addHooks();\n return this;\n },\n // @method disable(): this\n // Disables the handler\n disable: function () {\n if (!this._enabled) {\n return this;\n }\n\n this._enabled = false;\n this.removeHooks();\n return this;\n },\n // @method enabled(): Boolean\n // Returns `true` if the handler is enabled\n enabled: function () {\n return !!this._enabled;\n } // @section Extension methods\n // Classes inheriting from `Handler` must implement the two following methods:\n // @method addHooks()\n // Called when the handler is enabled, should add event hooks.\n // @method removeHooks()\n // Called when the handler is disabled, should remove the event hooks added previously.\n\n }); // @section There is static function which can be called without instantiating L.Handler:\n // @function addTo(map: Map, name: String): this\n // Adds a new Handler to the given map with the given name.\n\n Handler.addTo = function (map, name) {\n map.addHandler(name, this);\n return this;\n };\n\n var Mixin = {\n Events: Events\n };\n /*\r\n * @class Draggable\r\n * @aka L.Draggable\r\n * @inherits Evented\r\n *\r\n * A class for making DOM elements draggable (including touch support).\r\n * Used internally for map and marker dragging. Only works for elements\r\n * that were positioned with [`L.DomUtil.setPosition`](#domutil-setposition).\r\n *\r\n * @example\r\n * ```js\r\n * var draggable = new L.Draggable(elementToDrag);\r\n * draggable.enable();\r\n * ```\r\n */\n\n var START = touch ? 'touchstart mousedown' : 'mousedown';\n var END = {\n mousedown: 'mouseup',\n touchstart: 'touchend',\n pointerdown: 'touchend',\n MSPointerDown: 'touchend'\n };\n var MOVE = {\n mousedown: 'mousemove',\n touchstart: 'touchmove',\n pointerdown: 'touchmove',\n MSPointerDown: 'touchmove'\n };\n var Draggable = Evented.extend({\n options: {\n // @section\n // @aka Draggable options\n // @option clickTolerance: Number = 3\n // The max number of pixels a user can shift the mouse pointer during a click\n // for it to be considered a valid click (as opposed to a mouse drag).\n clickTolerance: 3\n },\n // @constructor L.Draggable(el: HTMLElement, dragHandle?: HTMLElement, preventOutline?: Boolean, options?: Draggable options)\n // Creates a `Draggable` object for moving `el` when you start dragging the `dragHandle` element (equals `el` itself by default).\n initialize: function (element, dragStartTarget, preventOutline$$1, options) {\n setOptions(this, options);\n this._element = element;\n this._dragStartTarget = dragStartTarget || element;\n this._preventOutline = preventOutline$$1;\n },\n // @method enable()\n // Enables the dragging ability\n enable: function () {\n if (this._enabled) {\n return;\n }\n\n on(this._dragStartTarget, START, this._onDown, this);\n this._enabled = true;\n },\n // @method disable()\n // Disables the dragging ability\n disable: function () {\n if (!this._enabled) {\n return;\n } // If we're currently dragging this draggable,\n // disabling it counts as first ending the drag.\n\n\n if (Draggable._dragging === this) {\n this.finishDrag();\n }\n\n off(this._dragStartTarget, START, this._onDown, this);\n this._enabled = false;\n this._moved = false;\n },\n _onDown: function (e) {\n // Ignore simulated events, since we handle both touch and\n // mouse explicitly; otherwise we risk getting duplicates of\n // touch events, see #4315.\n // Also ignore the event if disabled; this happens in IE11\n // under some circumstances, see #3666.\n if (e._simulated || !this._enabled) {\n return;\n }\n\n this._moved = false;\n\n if (hasClass(this._element, 'leaflet-zoom-anim')) {\n return;\n }\n\n if (Draggable._dragging || e.shiftKey || e.which !== 1 && e.button !== 1 && !e.touches) {\n return;\n }\n\n Draggable._dragging = this; // Prevent dragging multiple objects at once.\n\n if (this._preventOutline) {\n preventOutline(this._element);\n }\n\n disableImageDrag();\n disableTextSelection();\n\n if (this._moving) {\n return;\n } // @event down: Event\n // Fired when a drag is about to start.\n\n\n this.fire('down');\n var first = e.touches ? e.touches[0] : e,\n sizedParent = getSizedParentNode(this._element);\n this._startPoint = new Point(first.clientX, first.clientY); // Cache the scale, so that we can continuously compensate for it during drag (_onMove).\n\n this._parentScale = getScale(sizedParent);\n on(document, MOVE[e.type], this._onMove, this);\n on(document, END[e.type], this._onUp, this);\n },\n _onMove: function (e) {\n // Ignore simulated events, since we handle both touch and\n // mouse explicitly; otherwise we risk getting duplicates of\n // touch events, see #4315.\n // Also ignore the event if disabled; this happens in IE11\n // under some circumstances, see #3666.\n if (e._simulated || !this._enabled) {\n return;\n }\n\n if (e.touches && e.touches.length > 1) {\n this._moved = true;\n return;\n }\n\n var first = e.touches && e.touches.length === 1 ? e.touches[0] : e,\n offset = new Point(first.clientX, first.clientY)._subtract(this._startPoint);\n\n if (!offset.x && !offset.y) {\n return;\n }\n\n if (Math.abs(offset.x) + Math.abs(offset.y) < this.options.clickTolerance) {\n return;\n } // We assume that the parent container's position, border and scale do not change for the duration of the drag.\n // Therefore there is no need to account for the position and border (they are eliminated by the subtraction)\n // and we can use the cached value for the scale.\n\n\n offset.x /= this._parentScale.x;\n offset.y /= this._parentScale.y;\n preventDefault(e);\n\n if (!this._moved) {\n // @event dragstart: Event\n // Fired when a drag starts\n this.fire('dragstart');\n this._moved = true;\n this._startPos = getPosition(this._element).subtract(offset);\n addClass(document.body, 'leaflet-dragging');\n this._lastTarget = e.target || e.srcElement; // IE and Edge do not give the <use> element, so fetch it\n // if necessary\n\n if (window.SVGElementInstance && this._lastTarget instanceof SVGElementInstance) {\n this._lastTarget = this._lastTarget.correspondingUseElement;\n }\n\n addClass(this._lastTarget, 'leaflet-drag-target');\n }\n\n this._newPos = this._startPos.add(offset);\n this._moving = true;\n cancelAnimFrame(this._animRequest);\n this._lastEvent = e;\n this._animRequest = requestAnimFrame(this._updatePosition, this, true);\n },\n _updatePosition: function () {\n var e = {\n originalEvent: this._lastEvent\n }; // @event predrag: Event\n // Fired continuously during dragging *before* each corresponding\n // update of the element's position.\n\n this.fire('predrag', e);\n setPosition(this._element, this._newPos); // @event drag: Event\n // Fired continuously during dragging.\n\n this.fire('drag', e);\n },\n _onUp: function (e) {\n // Ignore simulated events, since we handle both touch and\n // mouse explicitly; otherwise we risk getting duplicates of\n // touch events, see #4315.\n // Also ignore the event if disabled; this happens in IE11\n // under some circumstances, see #3666.\n if (e._simulated || !this._enabled) {\n return;\n }\n\n this.finishDrag();\n },\n finishDrag: function () {\n removeClass(document.body, 'leaflet-dragging');\n\n if (this._lastTarget) {\n removeClass(this._lastTarget, 'leaflet-drag-target');\n this._lastTarget = null;\n }\n\n for (var i in MOVE) {\n off(document, MOVE[i], this._onMove, this);\n off(document, END[i], this._onUp, this);\n }\n\n enableImageDrag();\n enableTextSelection();\n\n if (this._moved && this._moving) {\n // ensure drag is not fired after dragend\n cancelAnimFrame(this._animRequest); // @event dragend: DragEndEvent\n // Fired when the drag ends.\n\n this.fire('dragend', {\n distance: this._newPos.distanceTo(this._startPos)\n });\n }\n\n this._moving = false;\n Draggable._dragging = false;\n }\n });\n /*\r\n * @namespace LineUtil\r\n *\r\n * Various utility functions for polyline points processing, used by Leaflet internally to make polylines lightning-fast.\r\n */\n // Simplify polyline with vertex reduction and Douglas-Peucker simplification.\n // Improves rendering performance dramatically by lessening the number of points to draw.\n // @function simplify(points: Point[], tolerance: Number): Point[]\n // Dramatically reduces the number of points in a polyline while retaining\n // its shape and returns a new array of simplified points, using the\n // [Douglas-Peucker algorithm](http://en.wikipedia.org/wiki/Douglas-Peucker_algorithm).\n // Used for a huge performance boost when processing/displaying Leaflet polylines for\n // each zoom level and also reducing visual noise. tolerance affects the amount of\n // simplification (lesser value means higher quality but slower and with more points).\n // Also released as a separated micro-library [Simplify.js](http://mourner.github.com/simplify-js/).\n\n function simplify(points, tolerance) {\n if (!tolerance || !points.length) {\n return points.slice();\n }\n\n var sqTolerance = tolerance * tolerance; // stage 1: vertex reduction\n\n points = _reducePoints(points, sqTolerance); // stage 2: Douglas-Peucker simplification\n\n points = _simplifyDP(points, sqTolerance);\n return points;\n } // @function pointToSegmentDistance(p: Point, p1: Point, p2: Point): Number\n // Returns the distance between point `p` and segment `p1` to `p2`.\n\n\n function pointToSegmentDistance(p, p1, p2) {\n return Math.sqrt(_sqClosestPointOnSegment(p, p1, p2, true));\n } // @function closestPointOnSegment(p: Point, p1: Point, p2: Point): Number\n // Returns the closest point from a point `p` on a segment `p1` to `p2`.\n\n\n function closestPointOnSegment(p, p1, p2) {\n return _sqClosestPointOnSegment(p, p1, p2);\n } // Douglas-Peucker simplification, see http://en.wikipedia.org/wiki/Douglas-Peucker_algorithm\n\n\n function _simplifyDP(points, sqTolerance) {\n var len = points.length,\n ArrayConstructor = typeof Uint8Array !== undefined + '' ? Uint8Array : Array,\n markers = new ArrayConstructor(len);\n markers[0] = markers[len - 1] = 1;\n\n _simplifyDPStep(points, markers, sqTolerance, 0, len - 1);\n\n var i,\n newPoints = [];\n\n for (i = 0; i < len; i++) {\n if (markers[i]) {\n newPoints.push(points[i]);\n }\n }\n\n return newPoints;\n }\n\n function _simplifyDPStep(points, markers, sqTolerance, first, last) {\n var maxSqDist = 0,\n index,\n i,\n sqDist;\n\n for (i = first + 1; i <= last - 1; i++) {\n sqDist = _sqClosestPointOnSegment(points[i], points[first], points[last], true);\n\n if (sqDist > maxSqDist) {\n index = i;\n maxSqDist = sqDist;\n }\n }\n\n if (maxSqDist > sqTolerance) {\n markers[index] = 1;\n\n _simplifyDPStep(points, markers, sqTolerance, first, index);\n\n _simplifyDPStep(points, markers, sqTolerance, index, last);\n }\n } // reduce points that are too close to each other to a single point\n\n\n function _reducePoints(points, sqTolerance) {\n var reducedPoints = [points[0]];\n\n for (var i = 1, prev = 0, len = points.length; i < len; i++) {\n if (_sqDist(points[i], points[prev]) > sqTolerance) {\n reducedPoints.push(points[i]);\n prev = i;\n }\n }\n\n if (prev < len - 1) {\n reducedPoints.push(points[len - 1]);\n }\n\n return reducedPoints;\n }\n\n var _lastCode; // @function clipSegment(a: Point, b: Point, bounds: Bounds, useLastCode?: Boolean, round?: Boolean): Point[]|Boolean\n // Clips the segment a to b by rectangular bounds with the\n // [Cohen-Sutherland algorithm](https://en.wikipedia.org/wiki/Cohen%E2%80%93Sutherland_algorithm)\n // (modifying the segment points directly!). Used by Leaflet to only show polyline\n // points that are on the screen or near, increasing performance.\n\n\n function clipSegment(a, b, bounds, useLastCode, round) {\n var codeA = useLastCode ? _lastCode : _getBitCode(a, bounds),\n codeB = _getBitCode(b, bounds),\n codeOut,\n p,\n newCode; // save 2nd code to avoid calculating it on the next segment\n\n\n _lastCode = codeB;\n\n while (true) {\n // if a,b is inside the clip window (trivial accept)\n if (!(codeA | codeB)) {\n return [a, b];\n } // if a,b is outside the clip window (trivial reject)\n\n\n if (codeA & codeB) {\n return false;\n } // other cases\n\n\n codeOut = codeA || codeB;\n p = _getEdgeIntersection(a, b, codeOut, bounds, round);\n newCode = _getBitCode(p, bounds);\n\n if (codeOut === codeA) {\n a = p;\n codeA = newCode;\n } else {\n b = p;\n codeB = newCode;\n }\n }\n }\n\n function _getEdgeIntersection(a, b, code, bounds, round) {\n var dx = b.x - a.x,\n dy = b.y - a.y,\n min = bounds.min,\n max = bounds.max,\n x,\n y;\n\n if (code & 8) {\n // top\n x = a.x + dx * (max.y - a.y) / dy;\n y = max.y;\n } else if (code & 4) {\n // bottom\n x = a.x + dx * (min.y - a.y) / dy;\n y = min.y;\n } else if (code & 2) {\n // right\n x = max.x;\n y = a.y + dy * (max.x - a.x) / dx;\n } else if (code & 1) {\n // left\n x = min.x;\n y = a.y + dy * (min.x - a.x) / dx;\n }\n\n return new Point(x, y, round);\n }\n\n function _getBitCode(p, bounds) {\n var code = 0;\n\n if (p.x < bounds.min.x) {\n // left\n code |= 1;\n } else if (p.x > bounds.max.x) {\n // right\n code |= 2;\n }\n\n if (p.y < bounds.min.y) {\n // bottom\n code |= 4;\n } else if (p.y > bounds.max.y) {\n // top\n code |= 8;\n }\n\n return code;\n } // square distance (to avoid unnecessary Math.sqrt calls)\n\n\n function _sqDist(p1, p2) {\n var dx = p2.x - p1.x,\n dy = p2.y - p1.y;\n return dx * dx + dy * dy;\n } // return closest point on segment or distance to that point\n\n\n function _sqClosestPointOnSegment(p, p1, p2, sqDist) {\n var x = p1.x,\n y = p1.y,\n dx = p2.x - x,\n dy = p2.y - y,\n dot = dx * dx + dy * dy,\n t;\n\n if (dot > 0) {\n t = ((p.x - x) * dx + (p.y - y) * dy) / dot;\n\n if (t > 1) {\n x = p2.x;\n y = p2.y;\n } else if (t > 0) {\n x += dx * t;\n y += dy * t;\n }\n }\n\n dx = p.x - x;\n dy = p.y - y;\n return sqDist ? dx * dx + dy * dy : new Point(x, y);\n } // @function isFlat(latlngs: LatLng[]): Boolean\n // Returns true if `latlngs` is a flat array, false is nested.\n\n\n function isFlat(latlngs) {\n return !isArray(latlngs[0]) || typeof latlngs[0][0] !== 'object' && typeof latlngs[0][0] !== 'undefined';\n }\n\n function _flat(latlngs) {\n console.warn('Deprecated use of _flat, please use L.LineUtil.isFlat instead.');\n return isFlat(latlngs);\n }\n\n var LineUtil = (Object.freeze || Object)({\n simplify: simplify,\n pointToSegmentDistance: pointToSegmentDistance,\n closestPointOnSegment: closestPointOnSegment,\n clipSegment: clipSegment,\n _getEdgeIntersection: _getEdgeIntersection,\n _getBitCode: _getBitCode,\n _sqClosestPointOnSegment: _sqClosestPointOnSegment,\n isFlat: isFlat,\n _flat: _flat\n });\n /*\r\n * @namespace PolyUtil\r\n * Various utility functions for polygon geometries.\r\n */\n\n /* @function clipPolygon(points: Point[], bounds: Bounds, round?: Boolean): Point[]\r\n * Clips the polygon geometry defined by the given `points` by the given bounds (using the [Sutherland-Hodgman algorithm](https://en.wikipedia.org/wiki/Sutherland%E2%80%93Hodgman_algorithm)).\r\n * Used by Leaflet to only show polygon points that are on the screen or near, increasing\r\n * performance. Note that polygon points needs different algorithm for clipping\r\n * than polyline, so there's a separate method for it.\r\n */\n\n function clipPolygon(points, bounds, round) {\n var clippedPoints,\n edges = [1, 4, 2, 8],\n i,\n j,\n k,\n a,\n b,\n len,\n edge,\n p;\n\n for (i = 0, len = points.length; i < len; i++) {\n points[i]._code = _getBitCode(points[i], bounds);\n } // for each edge (left, bottom, right, top)\n\n\n for (k = 0; k < 4; k++) {\n edge = edges[k];\n clippedPoints = [];\n\n for (i = 0, len = points.length, j = len - 1; i < len; j = i++) {\n a = points[i];\n b = points[j]; // if a is inside the clip window\n\n if (!(a._code & edge)) {\n // if b is outside the clip window (a->b goes out of screen)\n if (b._code & edge) {\n p = _getEdgeIntersection(b, a, edge, bounds, round);\n p._code = _getBitCode(p, bounds);\n clippedPoints.push(p);\n }\n\n clippedPoints.push(a); // else if b is inside the clip window (a->b enters the screen)\n } else if (!(b._code & edge)) {\n p = _getEdgeIntersection(b, a, edge, bounds, round);\n p._code = _getBitCode(p, bounds);\n clippedPoints.push(p);\n }\n }\n\n points = clippedPoints;\n }\n\n return points;\n }\n\n var PolyUtil = (Object.freeze || Object)({\n clipPolygon: clipPolygon\n });\n /*\r\n * @namespace Projection\r\n * @section\r\n * Leaflet comes with a set of already defined Projections out of the box:\r\n *\r\n * @projection L.Projection.LonLat\r\n *\r\n * Equirectangular, or Plate Carree projection — the most simple projection,\r\n * mostly used by GIS enthusiasts. Directly maps `x` as longitude, and `y` as\r\n * latitude. Also suitable for flat worlds, e.g. game maps. Used by the\r\n * `EPSG:4326` and `Simple` CRS.\r\n */\n\n var LonLat = {\n project: function (latlng) {\n return new Point(latlng.lng, latlng.lat);\n },\n unproject: function (point) {\n return new LatLng(point.y, point.x);\n },\n bounds: new Bounds([-180, -90], [180, 90])\n };\n /*\r\n * @namespace Projection\r\n * @projection L.Projection.Mercator\r\n *\r\n * 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\n */\n\n var Mercator = {\n R: 6378137,\n R_MINOR: 6356752.314245179,\n bounds: new Bounds([-20037508.34279, -15496570.73972], [20037508.34279, 18764656.23138]),\n project: function (latlng) {\n var d = Math.PI / 180,\n r = this.R,\n y = latlng.lat * d,\n tmp = this.R_MINOR / r,\n e = Math.sqrt(1 - tmp * tmp),\n con = e * Math.sin(y);\n var ts = Math.tan(Math.PI / 4 - y / 2) / Math.pow((1 - con) / (1 + con), e / 2);\n y = -r * Math.log(Math.max(ts, 1E-10));\n return new Point(latlng.lng * d * r, y);\n },\n unproject: function (point) {\n var d = 180 / Math.PI,\n r = this.R,\n tmp = this.R_MINOR / r,\n e = Math.sqrt(1 - tmp * tmp),\n ts = Math.exp(-point.y / r),\n phi = Math.PI / 2 - 2 * Math.atan(ts);\n\n for (var i = 0, dphi = 0.1, con; i < 15 && Math.abs(dphi) > 1e-7; i++) {\n con = e * Math.sin(phi);\n con = Math.pow((1 - con) / (1 + con), e / 2);\n dphi = Math.PI / 2 - 2 * Math.atan(ts * con) - phi;\n phi += dphi;\n }\n\n return new LatLng(phi * d, point.x * d / r);\n }\n };\n /*\n * @class Projection\n \n * An object with methods for projecting geographical coordinates of the world onto\n * a flat surface (and back). See [Map projection](http://en.wikipedia.org/wiki/Map_projection).\n \n * @property bounds: Bounds\n * The bounds (specified in CRS units) where the projection is valid\n \n * @method project(latlng: LatLng): Point\n * Projects geographical coordinates into a 2D point.\n * Only accepts actual `L.LatLng` instances, not arrays.\n \n * @method unproject(point: Point): LatLng\n * The inverse of `project`. Projects a 2D point into a geographical location.\n * Only accepts actual `L.Point` instances, not arrays.\n \n * Note that the projection instances do not inherit from Leafet's `Class` object,\n * and can't be instantiated. Also, new classes can't inherit from them,\n * and methods can't be added to them with the `include` function.\n \n */\n\n var index = (Object.freeze || Object)({\n LonLat: LonLat,\n Mercator: Mercator,\n SphericalMercator: SphericalMercator\n });\n /*\r\n * @namespace CRS\r\n * @crs L.CRS.EPSG3395\r\n *\r\n * Rarely used by some commercial tile providers. Uses Elliptical Mercator projection.\r\n */\n\n var EPSG3395 = extend({}, Earth, {\n code: 'EPSG:3395',\n projection: Mercator,\n transformation: function () {\n var scale = 0.5 / (Math.PI * Mercator.R);\n return toTransformation(scale, 0.5, -scale, 0.5);\n }()\n });\n /*\r\n * @namespace CRS\r\n * @crs L.CRS.EPSG4326\r\n *\r\n * A common CRS among GIS enthusiasts. Uses simple Equirectangular projection.\r\n *\r\n * 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\n * which is a breaking change from 0.7.x behaviour. If you are using a `TileLayer`\r\n * with this CRS, ensure that there are two 256x256 pixel tiles covering the\r\n * whole earth at zoom level zero, and that the tile coordinate origin is (-180,+90),\r\n * or (-180,-90) for `TileLayer`s with [the `tms` option](#tilelayer-tms) set.\r\n */\n\n var EPSG4326 = extend({}, Earth, {\n code: 'EPSG:4326',\n projection: LonLat,\n transformation: toTransformation(1 / 180, 1, -1 / 180, 0.5)\n });\n /*\n * @namespace CRS\n * @crs L.CRS.Simple\n *\n * A simple CRS that maps longitude and latitude into `x` and `y` directly.\n * May be used for maps of flat surfaces (e.g. game maps). Note that the `y`\n * axis should still be inverted (going from bottom to top). `distance()` returns\n * simple euclidean distance.\n */\n\n var Simple = extend({}, CRS, {\n projection: LonLat,\n transformation: toTransformation(1, 0, -1, 0),\n scale: function (zoom) {\n return Math.pow(2, zoom);\n },\n zoom: function (scale) {\n return Math.log(scale) / Math.LN2;\n },\n distance: function (latlng1, latlng2) {\n var dx = latlng2.lng - latlng1.lng,\n dy = latlng2.lat - latlng1.lat;\n return Math.sqrt(dx * dx + dy * dy);\n },\n infinite: true\n });\n CRS.Earth = Earth;\n CRS.EPSG3395 = EPSG3395;\n CRS.EPSG3857 = EPSG3857;\n CRS.EPSG900913 = EPSG900913;\n CRS.EPSG4326 = EPSG4326;\n CRS.Simple = Simple;\n /*\n * @class Layer\n * @inherits Evented\n * @aka L.Layer\n * @aka ILayer\n *\n * A set of methods from the Layer base class that all Leaflet layers use.\n * Inherits all methods, options and events from `L.Evented`.\n *\n * @example\n *\n * ```js\n * var layer = L.Marker(latlng).addTo(map);\n * layer.addTo(map);\n * layer.remove();\n * ```\n *\n * @event add: Event\n * Fired after the layer is added to a map\n *\n * @event remove: Event\n * Fired after the layer is removed from a map\n */\n\n var Layer = Evented.extend({\n // Classes extending `L.Layer` will inherit the following options:\n options: {\n // @option pane: String = 'overlayPane'\n // 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.\n pane: 'overlayPane',\n // @option attribution: String = null\n // String to be shown in the attribution control, e.g. \"© OpenStreetMap contributors\". It describes the layer data and is often a legal obligation towards copyright holders and tile providers.\n attribution: null,\n bubblingMouseEvents: true\n },\n\n /* @section\n * Classes extending `L.Layer` will inherit the following methods:\n *\n * @method addTo(map: Map|LayerGroup): this\n * Adds the layer to the given map or layer group.\n */\n addTo: function (map) {\n map.addLayer(this);\n return this;\n },\n // @method remove: this\n // Removes the layer from the map it is currently active on.\n remove: function () {\n return this.removeFrom(this._map || this._mapToAdd);\n },\n // @method removeFrom(map: Map): this\n // Removes the layer from the given map\n removeFrom: function (obj) {\n if (obj) {\n obj.removeLayer(this);\n }\n\n return this;\n },\n // @method getPane(name? : String): HTMLElement\n // Returns the `HTMLElement` representing the named pane on the map. If `name` is omitted, returns the pane for this layer.\n getPane: function (name) {\n return this._map.getPane(name ? this.options[name] || name : this.options.pane);\n },\n addInteractiveTarget: function (targetEl) {\n this._map._targets[stamp(targetEl)] = this;\n return this;\n },\n removeInteractiveTarget: function (targetEl) {\n delete this._map._targets[stamp(targetEl)];\n return this;\n },\n // @method getAttribution: String\n // Used by the `attribution control`, returns the [attribution option](#gridlayer-attribution).\n getAttribution: function () {\n return this.options.attribution;\n },\n _layerAdd: function (e) {\n var map = e.target; // check in case layer gets added and then removed before the map is ready\n\n if (!map.hasLayer(this)) {\n return;\n }\n\n this._map = map;\n this._zoomAnimated = map._zoomAnimated;\n\n if (this.getEvents) {\n var events = this.getEvents();\n map.on(events, this);\n this.once('remove', function () {\n map.off(events, this);\n }, this);\n }\n\n this.onAdd(map);\n\n if (this.getAttribution && map.attributionControl) {\n map.attributionControl.addAttribution(this.getAttribution());\n }\n\n this.fire('add');\n map.fire('layeradd', {\n layer: this\n });\n }\n });\n /* @section Extension methods\n * @uninheritable\n *\n * Every layer should extend from `L.Layer` and (re-)implement the following methods.\n *\n * @method onAdd(map: Map): this\n * 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).\n *\n * @method onRemove(map: Map): this\n * 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).\n *\n * @method getEvents(): Object\n * 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.\n *\n * @method getAttribution(): String\n * This optional method should return a string containing HTML to be shown on the `Attribution control` whenever the layer is visible.\n *\n * @method beforeAdd(map: Map): this\n * 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.\n */\n\n /* @namespace Map\n * @section Layer events\n *\n * @event layeradd: LayerEvent\n * Fired when a new layer is added to the map.\n *\n * @event layerremove: LayerEvent\n * Fired when some layer is removed from the map\n *\n * @section Methods for Layers and Controls\n */\n\n Map.include({\n // @method addLayer(layer: Layer): this\n // Adds the given layer to the map\n addLayer: function (layer) {\n if (!layer._layerAdd) {\n throw new Error('The provided object is not a Layer.');\n }\n\n var id = stamp(layer);\n\n if (this._layers[id]) {\n return this;\n }\n\n this._layers[id] = layer;\n layer._mapToAdd = this;\n\n if (layer.beforeAdd) {\n layer.beforeAdd(this);\n }\n\n this.whenReady(layer._layerAdd, layer);\n return this;\n },\n // @method removeLayer(layer: Layer): this\n // Removes the given layer from the map.\n removeLayer: function (layer) {\n var id = stamp(layer);\n\n if (!this._layers[id]) {\n return this;\n }\n\n if (this._loaded) {\n layer.onRemove(this);\n }\n\n if (layer.getAttribution && this.attributionControl) {\n this.attributionControl.removeAttribution(layer.getAttribution());\n }\n\n delete this._layers[id];\n\n if (this._loaded) {\n this.fire('layerremove', {\n layer: layer\n });\n layer.fire('remove');\n }\n\n layer._map = layer._mapToAdd = null;\n return this;\n },\n // @method hasLayer(layer: Layer): Boolean\n // Returns `true` if the given layer is currently added to the map\n hasLayer: function (layer) {\n return !!layer && stamp(layer) in this._layers;\n },\n\n /* @method eachLayer(fn: Function, context?: Object): this\n * Iterates over the layers of the map, optionally specifying context of the iterator function.\n * ```\n * map.eachLayer(function(layer){\n * layer.bindPopup('Hello');\n * });\n * ```\n */\n eachLayer: function (method, context) {\n for (var i in this._layers) {\n method.call(context, this._layers[i]);\n }\n\n return this;\n },\n _addLayers: function (layers) {\n layers = layers ? isArray(layers) ? layers : [layers] : [];\n\n for (var i = 0, len = layers.length; i < len; i++) {\n this.addLayer(layers[i]);\n }\n },\n _addZoomLimit: function (layer) {\n if (isNaN(layer.options.maxZoom) || !isNaN(layer.options.minZoom)) {\n this._zoomBoundLayers[stamp(layer)] = layer;\n\n this._updateZoomLevels();\n }\n },\n _removeZoomLimit: function (layer) {\n var id = stamp(layer);\n\n if (this._zoomBoundLayers[id]) {\n delete this._zoomBoundLayers[id];\n\n this._updateZoomLevels();\n }\n },\n _updateZoomLevels: function () {\n var minZoom = Infinity,\n maxZoom = -Infinity,\n oldZoomSpan = this._getZoomSpan();\n\n for (var i in this._zoomBoundLayers) {\n var options = this._zoomBoundLayers[i].options;\n minZoom = options.minZoom === undefined ? minZoom : Math.min(minZoom, options.minZoom);\n maxZoom = options.maxZoom === undefined ? maxZoom : Math.max(maxZoom, options.maxZoom);\n }\n\n this._layersMaxZoom = maxZoom === -Infinity ? undefined : maxZoom;\n this._layersMinZoom = minZoom === Infinity ? undefined : minZoom; // @section Map state change events\n // @event zoomlevelschange: Event\n // Fired when the number of zoomlevels on the map is changed due\n // to adding or removing a layer.\n\n if (oldZoomSpan !== this._getZoomSpan()) {\n this.fire('zoomlevelschange');\n }\n\n if (this.options.maxZoom === undefined && this._layersMaxZoom && this.getZoom() > this._layersMaxZoom) {\n this.setZoom(this._layersMaxZoom);\n }\n\n if (this.options.minZoom === undefined && this._layersMinZoom && this.getZoom() < this._layersMinZoom) {\n this.setZoom(this._layersMinZoom);\n }\n }\n });\n /*\r\n * @class LayerGroup\r\n * @aka L.LayerGroup\r\n * @inherits Layer\r\n *\r\n * Used to group several layers and handle them as one. If you add it to the map,\r\n * any layers added or removed from the group will be added/removed on the map as\r\n * well. Extends `Layer`.\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * L.layerGroup([marker1, marker2])\r\n * \t.addLayer(polyline)\r\n * \t.addTo(map);\r\n * ```\r\n */\n\n var LayerGroup = Layer.extend({\n initialize: function (layers, options) {\n setOptions(this, options);\n this._layers = {};\n var i, len;\n\n if (layers) {\n for (i = 0, len = layers.length; i < len; i++) {\n this.addLayer(layers[i]);\n }\n }\n },\n // @method addLayer(layer: Layer): this\n // Adds the given layer to the group.\n addLayer: function (layer) {\n var id = this.getLayerId(layer);\n this._layers[id] = layer;\n\n if (this._map) {\n this._map.addLayer(layer);\n }\n\n return this;\n },\n // @method removeLayer(layer: Layer): this\n // Removes the given layer from the group.\n // @alternative\n // @method removeLayer(id: Number): this\n // Removes the layer with the given internal ID from the group.\n removeLayer: function (layer) {\n var id = layer in this._layers ? layer : this.getLayerId(layer);\n\n if (this._map && this._layers[id]) {\n this._map.removeLayer(this._layers[id]);\n }\n\n delete this._layers[id];\n return this;\n },\n // @method hasLayer(layer: Layer): Boolean\n // Returns `true` if the given layer is currently added to the group.\n // @alternative\n // @method hasLayer(id: Number): Boolean\n // Returns `true` if the given internal ID is currently added to the group.\n hasLayer: function (layer) {\n return !!layer && (layer in this._layers || this.getLayerId(layer) in this._layers);\n },\n // @method clearLayers(): this\n // Removes all the layers from the group.\n clearLayers: function () {\n return this.eachLayer(this.removeLayer, this);\n },\n // @method invoke(methodName: String, …): this\n // Calls `methodName` on every layer contained in this group, passing any\n // additional parameters. Has no effect if the layers contained do not\n // implement `methodName`.\n invoke: function (methodName) {\n var args = Array.prototype.slice.call(arguments, 1),\n i,\n layer;\n\n for (i in this._layers) {\n layer = this._layers[i];\n\n if (layer[methodName]) {\n layer[methodName].apply(layer, args);\n }\n }\n\n return this;\n },\n onAdd: function (map) {\n this.eachLayer(map.addLayer, map);\n },\n onRemove: function (map) {\n this.eachLayer(map.removeLayer, map);\n },\n // @method eachLayer(fn: Function, context?: Object): this\n // Iterates over the layers of the group, optionally specifying context of the iterator function.\n // ```js\n // group.eachLayer(function (layer) {\n // \tlayer.bindPopup('Hello');\n // });\n // ```\n eachLayer: function (method, context) {\n for (var i in this._layers) {\n method.call(context, this._layers[i]);\n }\n\n return this;\n },\n // @method getLayer(id: Number): Layer\n // Returns the layer with the given internal ID.\n getLayer: function (id) {\n return this._layers[id];\n },\n // @method getLayers(): Layer[]\n // Returns an array of all the layers added to the group.\n getLayers: function () {\n var layers = [];\n this.eachLayer(layers.push, layers);\n return layers;\n },\n // @method setZIndex(zIndex: Number): this\n // Calls `setZIndex` on every layer contained in this group, passing the z-index.\n setZIndex: function (zIndex) {\n return this.invoke('setZIndex', zIndex);\n },\n // @method getLayerId(layer: Layer): Number\n // Returns the internal ID for a layer\n getLayerId: function (layer) {\n return stamp(layer);\n }\n }); // @factory L.layerGroup(layers?: Layer[], options?: Object)\n // Create a layer group, optionally given an initial set of layers and an `options` object.\n\n var layerGroup = function (layers, options) {\n return new LayerGroup(layers, options);\n };\n /*\r\n * @class FeatureGroup\r\n * @aka L.FeatureGroup\r\n * @inherits LayerGroup\r\n *\r\n * Extended `LayerGroup` that makes it easier to do the same thing to all its member layers:\r\n * * [`bindPopup`](#layer-bindpopup) binds a popup to all of the layers at once (likewise with [`bindTooltip`](#layer-bindtooltip))\r\n * * Events are propagated to the `FeatureGroup`, so if the group has an event\r\n * handler, it will handle events from any of the layers. This includes mouse events\r\n * and custom events.\r\n * * Has `layeradd` and `layerremove` events\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * L.featureGroup([marker1, marker2, polyline])\r\n * \t.bindPopup('Hello world!')\r\n * \t.on('click', function() { alert('Clicked on a member of the group!'); })\r\n * \t.addTo(map);\r\n * ```\r\n */\n\n\n var FeatureGroup = LayerGroup.extend({\n addLayer: function (layer) {\n if (this.hasLayer(layer)) {\n return this;\n }\n\n layer.addEventParent(this);\n LayerGroup.prototype.addLayer.call(this, layer); // @event layeradd: LayerEvent\n // Fired when a layer is added to this `FeatureGroup`\n\n return this.fire('layeradd', {\n layer: layer\n });\n },\n removeLayer: function (layer) {\n if (!this.hasLayer(layer)) {\n return this;\n }\n\n if (layer in this._layers) {\n layer = this._layers[layer];\n }\n\n layer.removeEventParent(this);\n LayerGroup.prototype.removeLayer.call(this, layer); // @event layerremove: LayerEvent\n // Fired when a layer is removed from this `FeatureGroup`\n\n return this.fire('layerremove', {\n layer: layer\n });\n },\n // @method setStyle(style: Path options): this\n // Sets the given path options to each layer of the group that has a `setStyle` method.\n setStyle: function (style) {\n return this.invoke('setStyle', style);\n },\n // @method bringToFront(): this\n // Brings the layer group to the top of all other layers\n bringToFront: function () {\n return this.invoke('bringToFront');\n },\n // @method bringToBack(): this\n // Brings the layer group to the back of all other layers\n bringToBack: function () {\n return this.invoke('bringToBack');\n },\n // @method getBounds(): LatLngBounds\n // Returns the LatLngBounds of the Feature Group (created from bounds and coordinates of its children).\n getBounds: function () {\n var bounds = new LatLngBounds();\n\n for (var id in this._layers) {\n var layer = this._layers[id];\n bounds.extend(layer.getBounds ? layer.getBounds() : layer.getLatLng());\n }\n\n return bounds;\n }\n }); // @factory L.featureGroup(layers: Layer[])\n // Create a feature group, optionally given an initial set of layers.\n\n var featureGroup = function (layers) {\n return new FeatureGroup(layers);\n };\n /*\r\n * @class Icon\r\n * @aka L.Icon\r\n *\r\n * Represents an icon to provide when creating a marker.\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * var myIcon = L.icon({\r\n * iconUrl: 'my-icon.png',\r\n * iconRetinaUrl: 'my-icon@2x.png',\r\n * iconSize: [38, 95],\r\n * iconAnchor: [22, 94],\r\n * popupAnchor: [-3, -76],\r\n * shadowUrl: 'my-icon-shadow.png',\r\n * shadowRetinaUrl: 'my-icon-shadow@2x.png',\r\n * shadowSize: [68, 95],\r\n * shadowAnchor: [22, 94]\r\n * });\r\n *\r\n * L.marker([50.505, 30.57], {icon: myIcon}).addTo(map);\r\n * ```\r\n *\r\n * `L.Icon.Default` extends `L.Icon` and is the blue icon Leaflet uses for markers by default.\r\n *\r\n */\n\n\n var Icon = Class.extend({\n /* @section\r\n * @aka Icon options\r\n *\r\n * @option iconUrl: String = null\r\n * **(required)** The URL to the icon image (absolute or relative to your script path).\r\n *\r\n * @option iconRetinaUrl: String = null\r\n * The URL to a retina sized version of the icon image (absolute or relative to your\r\n * script path). Used for Retina screen devices.\r\n *\r\n * @option iconSize: Point = null\r\n * Size of the icon image in pixels.\r\n *\r\n * @option iconAnchor: Point = null\r\n * The coordinates of the \"tip\" of the icon (relative to its top left corner). The icon\r\n * will be aligned so that this point is at the marker's geographical location. Centered\r\n * by default if size is specified, also can be set in CSS with negative margins.\r\n *\r\n * @option popupAnchor: Point = [0, 0]\r\n * The coordinates of the point from which popups will \"open\", relative to the icon anchor.\r\n *\r\n * @option tooltipAnchor: Point = [0, 0]\r\n * The coordinates of the point from which tooltips will \"open\", relative to the icon anchor.\r\n *\r\n * @option shadowUrl: String = null\r\n * The URL to the icon shadow image. If not specified, no shadow image will be created.\r\n *\r\n * @option shadowRetinaUrl: String = null\r\n *\r\n * @option shadowSize: Point = null\r\n * Size of the shadow image in pixels.\r\n *\r\n * @option shadowAnchor: Point = null\r\n * The coordinates of the \"tip\" of the shadow (relative to its top left corner) (the same\r\n * as iconAnchor if not specified).\r\n *\r\n * @option className: String = ''\r\n * A custom class name to assign to both icon and shadow images. Empty by default.\r\n */\n options: {\n popupAnchor: [0, 0],\n tooltipAnchor: [0, 0]\n },\n initialize: function (options) {\n setOptions(this, options);\n },\n // @method createIcon(oldIcon?: HTMLElement): HTMLElement\n // Called internally when the icon has to be shown, returns a `<img>` HTML element\n // styled according to the options.\n createIcon: function (oldIcon) {\n return this._createIcon('icon', oldIcon);\n },\n // @method createShadow(oldIcon?: HTMLElement): HTMLElement\n // As `createIcon`, but for the shadow beneath it.\n createShadow: function (oldIcon) {\n return this._createIcon('shadow', oldIcon);\n },\n _createIcon: function (name, oldIcon) {\n var src = this._getIconUrl(name);\n\n if (!src) {\n if (name === 'icon') {\n throw new Error('iconUrl not set in Icon options (see the docs).');\n }\n\n return null;\n }\n\n var img = this._createImg(src, oldIcon && oldIcon.tagName === 'IMG' ? oldIcon : null);\n\n this._setIconStyles(img, name);\n\n return img;\n },\n _setIconStyles: function (img, name) {\n var options = this.options;\n var sizeOption = options[name + 'Size'];\n\n if (typeof sizeOption === 'number') {\n sizeOption = [sizeOption, sizeOption];\n }\n\n var size = toPoint(sizeOption),\n anchor = toPoint(name === 'shadow' && options.shadowAnchor || options.iconAnchor || size && size.divideBy(2, true));\n img.className = 'leaflet-marker-' + name + ' ' + (options.className || '');\n\n if (anchor) {\n img.style.marginLeft = -anchor.x + 'px';\n img.style.marginTop = -anchor.y + 'px';\n }\n\n if (size) {\n img.style.width = size.x + 'px';\n img.style.height = size.y + 'px';\n }\n },\n _createImg: function (src, el) {\n el = el || document.createElement('img');\n el.src = src;\n return el;\n },\n _getIconUrl: function (name) {\n return retina && this.options[name + 'RetinaUrl'] || this.options[name + 'Url'];\n }\n }); // @factory L.icon(options: Icon options)\n // Creates an icon instance with the given options.\n\n function icon(options) {\n return new Icon(options);\n }\n /*\n * @miniclass Icon.Default (Icon)\n * @aka L.Icon.Default\n * @section\n *\n * A trivial subclass of `Icon`, represents the icon to use in `Marker`s when\n * no icon is specified. Points to the blue marker image distributed with Leaflet\n * releases.\n *\n * In order to customize the default icon, just change the properties of `L.Icon.Default.prototype.options`\n * (which is a set of `Icon options`).\n *\n * If you want to _completely_ replace the default icon, override the\n * `L.Marker.prototype.options.icon` with your own icon instead.\n */\n\n\n var IconDefault = Icon.extend({\n options: {\n iconUrl: 'marker-icon.png',\n iconRetinaUrl: 'marker-icon-2x.png',\n shadowUrl: 'marker-shadow.png',\n iconSize: [25, 41],\n iconAnchor: [12, 41],\n popupAnchor: [1, -34],\n tooltipAnchor: [16, -28],\n shadowSize: [41, 41]\n },\n _getIconUrl: function (name) {\n if (!IconDefault.imagePath) {\n // Deprecated, backwards-compatibility only\n IconDefault.imagePath = this._detectIconPath();\n } // @option imagePath: String\n // `Icon.Default` will try to auto-detect the location of the\n // blue icon images. If you are placing these images in a non-standard\n // way, set this option to point to the right path.\n\n\n return (this.options.imagePath || IconDefault.imagePath) + Icon.prototype._getIconUrl.call(this, name);\n },\n _detectIconPath: function () {\n var el = create$1('div', 'leaflet-default-icon-path', document.body);\n var path = getStyle(el, 'background-image') || getStyle(el, 'backgroundImage'); // IE8\n\n document.body.removeChild(el);\n\n if (path === null || path.indexOf('url') !== 0) {\n path = '';\n } else {\n path = path.replace(/^url\\([\"']?/, '').replace(/marker-icon\\.png[\"']?\\)$/, '');\n }\n\n return path;\n }\n });\n /*\n * L.Handler.MarkerDrag is used internally by L.Marker to make the markers draggable.\n */\n\n /* @namespace Marker\n * @section Interaction handlers\n *\n * Interaction handlers are properties of a marker instance that allow you to control interaction behavior in runtime, enabling or disabling certain features such as dragging (see `Handler` methods). Example:\n *\n * ```js\n * marker.dragging.disable();\n * ```\n *\n * @property dragging: Handler\n * Marker dragging handler (by both mouse and touch). Only valid when the marker is on the map (Otherwise set [`marker.options.draggable`](#marker-draggable)).\n */\n\n var MarkerDrag = Handler.extend({\n initialize: function (marker) {\n this._marker = marker;\n },\n addHooks: function () {\n var icon = this._marker._icon;\n\n if (!this._draggable) {\n this._draggable = new Draggable(icon, icon, true);\n }\n\n this._draggable.on({\n dragstart: this._onDragStart,\n predrag: this._onPreDrag,\n drag: this._onDrag,\n dragend: this._onDragEnd\n }, this).enable();\n\n addClass(icon, 'leaflet-marker-draggable');\n },\n removeHooks: function () {\n this._draggable.off({\n dragstart: this._onDragStart,\n predrag: this._onPreDrag,\n drag: this._onDrag,\n dragend: this._onDragEnd\n }, this).disable();\n\n if (this._marker._icon) {\n removeClass(this._marker._icon, 'leaflet-marker-draggable');\n }\n },\n moved: function () {\n return this._draggable && this._draggable._moved;\n },\n _adjustPan: function (e) {\n var marker = this._marker,\n map = marker._map,\n speed = this._marker.options.autoPanSpeed,\n padding = this._marker.options.autoPanPadding,\n iconPos = getPosition(marker._icon),\n bounds = map.getPixelBounds(),\n origin = map.getPixelOrigin();\n var panBounds = toBounds(bounds.min._subtract(origin).add(padding), bounds.max._subtract(origin).subtract(padding));\n\n if (!panBounds.contains(iconPos)) {\n // Compute incremental movement\n var movement = toPoint((Math.max(panBounds.max.x, iconPos.x) - panBounds.max.x) / (bounds.max.x - panBounds.max.x) - (Math.min(panBounds.min.x, iconPos.x) - panBounds.min.x) / (bounds.min.x - panBounds.min.x), (Math.max(panBounds.max.y, iconPos.y) - panBounds.max.y) / (bounds.max.y - panBounds.max.y) - (Math.min(panBounds.min.y, iconPos.y) - panBounds.min.y) / (bounds.min.y - panBounds.min.y)).multiplyBy(speed);\n map.panBy(movement, {\n animate: false\n });\n\n this._draggable._newPos._add(movement);\n\n this._draggable._startPos._add(movement);\n\n setPosition(marker._icon, this._draggable._newPos);\n\n this._onDrag(e);\n\n this._panRequest = requestAnimFrame(this._adjustPan.bind(this, e));\n }\n },\n _onDragStart: function () {\n // @section Dragging events\n // @event dragstart: Event\n // Fired when the user starts dragging the marker.\n // @event movestart: Event\n // Fired when the marker starts moving (because of dragging).\n this._oldLatLng = this._marker.getLatLng();\n\n this._marker.closePopup().fire('movestart').fire('dragstart');\n },\n _onPreDrag: function (e) {\n if (this._marker.options.autoPan) {\n cancelAnimFrame(this._panRequest);\n this._panRequest = requestAnimFrame(this._adjustPan.bind(this, e));\n }\n },\n _onDrag: function (e) {\n var marker = this._marker,\n shadow = marker._shadow,\n iconPos = getPosition(marker._icon),\n latlng = marker._map.layerPointToLatLng(iconPos); // update shadow position\n\n\n if (shadow) {\n setPosition(shadow, iconPos);\n }\n\n marker._latlng = latlng;\n e.latlng = latlng;\n e.oldLatLng = this._oldLatLng; // @event drag: Event\n // Fired repeatedly while the user drags the marker.\n\n marker.fire('move', e).fire('drag', e);\n },\n _onDragEnd: function (e) {\n // @event dragend: DragEndEvent\n // Fired when the user stops dragging the marker.\n cancelAnimFrame(this._panRequest); // @event moveend: Event\n // Fired when the marker stops moving (because of dragging).\n\n delete this._oldLatLng;\n\n this._marker.fire('moveend').fire('dragend', e);\n }\n });\n /*\r\n * @class Marker\r\n * @inherits Interactive layer\r\n * @aka L.Marker\r\n * L.Marker is used to display clickable/draggable icons on the map. Extends `Layer`.\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * L.marker([50.5, 30.5]).addTo(map);\r\n * ```\r\n */\n\n var Marker = Layer.extend({\n // @section\n // @aka Marker options\n options: {\n // @option icon: Icon = *\n // Icon instance to use for rendering the marker.\n // See [Icon documentation](#L.Icon) for details on how to customize the marker icon.\n // If not specified, a common instance of `L.Icon.Default` is used.\n icon: new IconDefault(),\n // Option inherited from \"Interactive layer\" abstract class\n interactive: true,\n // @option keyboard: Boolean = true\n // Whether the marker can be tabbed to with a keyboard and clicked by pressing enter.\n keyboard: true,\n // @option title: String = ''\n // Text for the browser tooltip that appear on marker hover (no tooltip by default).\n title: '',\n // @option alt: String = ''\n // Text for the `alt` attribute of the icon image (useful for accessibility).\n alt: '',\n // @option zIndexOffset: Number = 0\n // By default, marker images zIndex is set automatically based on its latitude. Use this option if you want to put the marker on top of all others (or below), specifying a high value like `1000` (or high negative value, respectively).\n zIndexOffset: 0,\n // @option opacity: Number = 1.0\n // The opacity of the marker.\n opacity: 1,\n // @option riseOnHover: Boolean = false\n // If `true`, the marker will get on top of others when you hover the mouse over it.\n riseOnHover: false,\n // @option riseOffset: Number = 250\n // The z-index offset used for the `riseOnHover` feature.\n riseOffset: 250,\n // @option pane: String = 'markerPane'\n // `Map pane` where the markers icon will be added.\n pane: 'markerPane',\n // @option bubblingMouseEvents: Boolean = false\n // When `true`, a mouse event on this marker will trigger the same event on the map\n // (unless [`L.DomEvent.stopPropagation`](#domevent-stoppropagation) is used).\n bubblingMouseEvents: false,\n // @section Draggable marker options\n // @option draggable: Boolean = false\n // Whether the marker is draggable with mouse/touch or not.\n draggable: false,\n // @option autoPan: Boolean = false\n // Whether to pan the map when dragging this marker near its edge or not.\n autoPan: false,\n // @option autoPanPadding: Point = Point(50, 50)\n // Distance (in pixels to the left/right and to the top/bottom) of the\n // map edge to start panning the map.\n autoPanPadding: [50, 50],\n // @option autoPanSpeed: Number = 10\n // Number of pixels the map should pan by.\n autoPanSpeed: 10\n },\n\n /* @section\r\n *\r\n * In addition to [shared layer methods](#Layer) like `addTo()` and `remove()` and [popup methods](#Popup) like bindPopup() you can also use the following methods:\r\n */\n initialize: function (latlng, options) {\n setOptions(this, options);\n this._latlng = toLatLng(latlng);\n },\n onAdd: function (map) {\n this._zoomAnimated = this._zoomAnimated && map.options.markerZoomAnimation;\n\n if (this._zoomAnimated) {\n map.on('zoomanim', this._animateZoom, this);\n }\n\n this._initIcon();\n\n this.update();\n },\n onRemove: function (map) {\n if (this.dragging && this.dragging.enabled()) {\n this.options.draggable = true;\n this.dragging.removeHooks();\n }\n\n delete this.dragging;\n\n if (this._zoomAnimated) {\n map.off('zoomanim', this._animateZoom, this);\n }\n\n this._removeIcon();\n\n this._removeShadow();\n },\n getEvents: function () {\n return {\n zoom: this.update,\n viewreset: this.update\n };\n },\n // @method getLatLng: LatLng\n // Returns the current geographical position of the marker.\n getLatLng: function () {\n return this._latlng;\n },\n // @method setLatLng(latlng: LatLng): this\n // Changes the marker position to the given point.\n setLatLng: function (latlng) {\n var oldLatLng = this._latlng;\n this._latlng = toLatLng(latlng);\n this.update(); // @event move: Event\n // Fired when the marker is moved via [`setLatLng`](#marker-setlatlng) or by [dragging](#marker-dragging). Old and new coordinates are included in event arguments as `oldLatLng`, `latlng`.\n\n return this.fire('move', {\n oldLatLng: oldLatLng,\n latlng: this._latlng\n });\n },\n // @method setZIndexOffset(offset: Number): this\n // Changes the [zIndex offset](#marker-zindexoffset) of the marker.\n setZIndexOffset: function (offset) {\n this.options.zIndexOffset = offset;\n return this.update();\n },\n // @method setIcon(icon: Icon): this\n // Changes the marker icon.\n setIcon: function (icon) {\n this.options.icon = icon;\n\n if (this._map) {\n this._initIcon();\n\n this.update();\n }\n\n if (this._popup) {\n this.bindPopup(this._popup, this._popup.options);\n }\n\n return this;\n },\n getElement: function () {\n return this._icon;\n },\n update: function () {\n if (this._icon && this._map) {\n var pos = this._map.latLngToLayerPoint(this._latlng).round();\n\n this._setPos(pos);\n }\n\n return this;\n },\n _initIcon: function () {\n var options = this.options,\n classToAdd = 'leaflet-zoom-' + (this._zoomAnimated ? 'animated' : 'hide');\n var icon = options.icon.createIcon(this._icon),\n addIcon = false; // if we're not reusing the icon, remove the old one and init new one\n\n if (icon !== this._icon) {\n if (this._icon) {\n this._removeIcon();\n }\n\n addIcon = true;\n\n if (options.title) {\n icon.title = options.title;\n }\n\n if (icon.tagName === 'IMG') {\n icon.alt = options.alt || '';\n }\n }\n\n addClass(icon, classToAdd);\n\n if (options.keyboard) {\n icon.tabIndex = '0';\n }\n\n this._icon = icon;\n\n if (options.riseOnHover) {\n this.on({\n mouseover: this._bringToFront,\n mouseout: this._resetZIndex\n });\n }\n\n var newShadow = options.icon.createShadow(this._shadow),\n addShadow = false;\n\n if (newShadow !== this._shadow) {\n this._removeShadow();\n\n addShadow = true;\n }\n\n if (newShadow) {\n addClass(newShadow, classToAdd);\n newShadow.alt = '';\n }\n\n this._shadow = newShadow;\n\n if (options.opacity < 1) {\n this._updateOpacity();\n }\n\n if (addIcon) {\n this.getPane().appendChild(this._icon);\n }\n\n this._initInteraction();\n\n if (newShadow && addShadow) {\n this.getPane('shadowPane').appendChild(this._shadow);\n }\n },\n _removeIcon: function () {\n if (this.options.riseOnHover) {\n this.off({\n mouseover: this._bringToFront,\n mouseout: this._resetZIndex\n });\n }\n\n remove(this._icon);\n this.removeInteractiveTarget(this._icon);\n this._icon = null;\n },\n _removeShadow: function () {\n if (this._shadow) {\n remove(this._shadow);\n }\n\n this._shadow = null;\n },\n _setPos: function (pos) {\n setPosition(this._icon, pos);\n\n if (this._shadow) {\n setPosition(this._shadow, pos);\n }\n\n this._zIndex = pos.y + this.options.zIndexOffset;\n\n this._resetZIndex();\n },\n _updateZIndex: function (offset) {\n this._icon.style.zIndex = this._zIndex + offset;\n },\n _animateZoom: function (opt) {\n var pos = this._map._latLngToNewLayerPoint(this._latlng, opt.zoom, opt.center).round();\n\n this._setPos(pos);\n },\n _initInteraction: function () {\n if (!this.options.interactive) {\n return;\n }\n\n addClass(this._icon, 'leaflet-interactive');\n this.addInteractiveTarget(this._icon);\n\n if (MarkerDrag) {\n var draggable = this.options.draggable;\n\n if (this.dragging) {\n draggable = this.dragging.enabled();\n this.dragging.disable();\n }\n\n this.dragging = new MarkerDrag(this);\n\n if (draggable) {\n this.dragging.enable();\n }\n }\n },\n // @method setOpacity(opacity: Number): this\n // Changes the opacity of the marker.\n setOpacity: function (opacity) {\n this.options.opacity = opacity;\n\n if (this._map) {\n this._updateOpacity();\n }\n\n return this;\n },\n _updateOpacity: function () {\n var opacity = this.options.opacity;\n setOpacity(this._icon, opacity);\n\n if (this._shadow) {\n setOpacity(this._shadow, opacity);\n }\n },\n _bringToFront: function () {\n this._updateZIndex(this.options.riseOffset);\n },\n _resetZIndex: function () {\n this._updateZIndex(0);\n },\n _getPopupAnchor: function () {\n return this.options.icon.options.popupAnchor;\n },\n _getTooltipAnchor: function () {\n return this.options.icon.options.tooltipAnchor;\n }\n }); // factory L.marker(latlng: LatLng, options? : Marker options)\n // @factory L.marker(latlng: LatLng, options? : Marker options)\n // Instantiates a Marker object given a geographical point and optionally an options object.\n\n function marker(latlng, options) {\n return new Marker(latlng, options);\n }\n /*\n * @class Path\n * @aka L.Path\n * @inherits Interactive layer\n *\n * An abstract class that contains options and constants shared between vector\n * overlays (Polygon, Polyline, Circle). Do not use it directly. Extends `Layer`.\n */\n\n\n var Path = Layer.extend({\n // @section\n // @aka Path options\n options: {\n // @option stroke: Boolean = true\n // Whether to draw stroke along the path. Set it to `false` to disable borders on polygons or circles.\n stroke: true,\n // @option color: String = '#3388ff'\n // Stroke color\n color: '#3388ff',\n // @option weight: Number = 3\n // Stroke width in pixels\n weight: 3,\n // @option opacity: Number = 1.0\n // Stroke opacity\n opacity: 1,\n // @option lineCap: String= 'round'\n // A string that defines [shape to be used at the end](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-linecap) of the stroke.\n lineCap: 'round',\n // @option lineJoin: String = 'round'\n // A string that defines [shape to be used at the corners](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-linejoin) of the stroke.\n lineJoin: 'round',\n // @option dashArray: String = null\n // A string that defines the stroke [dash pattern](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-dasharray). Doesn't work on `Canvas`-powered layers in [some old browsers](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/setLineDash#Browser_compatibility).\n dashArray: null,\n // @option dashOffset: String = null\n // A string that defines the [distance into the dash pattern to start the dash](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-dashoffset). Doesn't work on `Canvas`-powered layers in [some old browsers](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/setLineDash#Browser_compatibility).\n dashOffset: null,\n // @option fill: Boolean = depends\n // Whether to fill the path with color. Set it to `false` to disable filling on polygons or circles.\n fill: false,\n // @option fillColor: String = *\n // Fill color. Defaults to the value of the [`color`](#path-color) option\n fillColor: null,\n // @option fillOpacity: Number = 0.2\n // Fill opacity.\n fillOpacity: 0.2,\n // @option fillRule: String = 'evenodd'\n // A string that defines [how the inside of a shape](https://developer.mozilla.org/docs/Web/SVG/Attribute/fill-rule) is determined.\n fillRule: 'evenodd',\n // className: '',\n // Option inherited from \"Interactive layer\" abstract class\n interactive: true,\n // @option bubblingMouseEvents: Boolean = true\n // When `true`, a mouse event on this path will trigger the same event on the map\n // (unless [`L.DomEvent.stopPropagation`](#domevent-stoppropagation) is used).\n bubblingMouseEvents: true\n },\n beforeAdd: function (map) {\n // Renderer is set here because we need to call renderer.getEvents\n // before this.getEvents.\n this._renderer = map.getRenderer(this);\n },\n onAdd: function () {\n this._renderer._initPath(this);\n\n this._reset();\n\n this._renderer._addPath(this);\n },\n onRemove: function () {\n this._renderer._removePath(this);\n },\n // @method redraw(): this\n // Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.\n redraw: function () {\n if (this._map) {\n this._renderer._updatePath(this);\n }\n\n return this;\n },\n // @method setStyle(style: Path options): this\n // Changes the appearance of a Path based on the options in the `Path options` object.\n setStyle: function (style) {\n setOptions(this, style);\n\n if (this._renderer) {\n this._renderer._updateStyle(this);\n }\n\n return this;\n },\n // @method bringToFront(): this\n // Brings the layer to the top of all path layers.\n bringToFront: function () {\n if (this._renderer) {\n this._renderer._bringToFront(this);\n }\n\n return this;\n },\n // @method bringToBack(): this\n // Brings the layer to the bottom of all path layers.\n bringToBack: function () {\n if (this._renderer) {\n this._renderer._bringToBack(this);\n }\n\n return this;\n },\n getElement: function () {\n return this._path;\n },\n _reset: function () {\n // defined in child classes\n this._project();\n\n this._update();\n },\n _clickTolerance: function () {\n // used when doing hit detection for Canvas layers\n return (this.options.stroke ? this.options.weight / 2 : 0) + this._renderer.options.tolerance;\n }\n });\n /*\n * @class CircleMarker\n * @aka L.CircleMarker\n * @inherits Path\n *\n * A circle of a fixed size with radius specified in pixels. Extends `Path`.\n */\n\n var CircleMarker = Path.extend({\n // @section\n // @aka CircleMarker options\n options: {\n fill: true,\n // @option radius: Number = 10\n // Radius of the circle marker, in pixels\n radius: 10\n },\n initialize: function (latlng, options) {\n setOptions(this, options);\n this._latlng = toLatLng(latlng);\n this._radius = this.options.radius;\n },\n // @method setLatLng(latLng: LatLng): this\n // Sets the position of a circle marker to a new location.\n setLatLng: function (latlng) {\n this._latlng = toLatLng(latlng);\n this.redraw();\n return this.fire('move', {\n latlng: this._latlng\n });\n },\n // @method getLatLng(): LatLng\n // Returns the current geographical position of the circle marker\n getLatLng: function () {\n return this._latlng;\n },\n // @method setRadius(radius: Number): this\n // Sets the radius of a circle marker. Units are in pixels.\n setRadius: function (radius) {\n this.options.radius = this._radius = radius;\n return this.redraw();\n },\n // @method getRadius(): Number\n // Returns the current radius of the circle\n getRadius: function () {\n return this._radius;\n },\n setStyle: function (options) {\n var radius = options && options.radius || this._radius;\n Path.prototype.setStyle.call(this, options);\n this.setRadius(radius);\n return this;\n },\n _project: function () {\n this._point = this._map.latLngToLayerPoint(this._latlng);\n\n this._updateBounds();\n },\n _updateBounds: function () {\n var r = this._radius,\n r2 = this._radiusY || r,\n w = this._clickTolerance(),\n p = [r + w, r2 + w];\n\n this._pxBounds = new Bounds(this._point.subtract(p), this._point.add(p));\n },\n _update: function () {\n if (this._map) {\n this._updatePath();\n }\n },\n _updatePath: function () {\n this._renderer._updateCircle(this);\n },\n _empty: function () {\n return this._radius && !this._renderer._bounds.intersects(this._pxBounds);\n },\n // Needed by the `Canvas` renderer for interactivity\n _containsPoint: function (p) {\n return p.distanceTo(this._point) <= this._radius + this._clickTolerance();\n }\n }); // @factory L.circleMarker(latlng: LatLng, options?: CircleMarker options)\n // Instantiates a circle marker object given a geographical point, and an optional options object.\n\n function circleMarker(latlng, options) {\n return new CircleMarker(latlng, options);\n }\n /*\n * @class Circle\n * @aka L.Circle\n * @inherits CircleMarker\n *\n * A class for drawing circle overlays on a map. Extends `CircleMarker`.\n *\n * It's an approximation and starts to diverge from a real circle closer to poles (due to projection distortion).\n *\n * @example\n *\n * ```js\n * L.circle([50.5, 30.5], {radius: 200}).addTo(map);\n * ```\n */\n\n\n var Circle = CircleMarker.extend({\n initialize: function (latlng, options, legacyOptions) {\n if (typeof options === 'number') {\n // Backwards compatibility with 0.7.x factory (latlng, radius, options?)\n options = extend({}, legacyOptions, {\n radius: options\n });\n }\n\n setOptions(this, options);\n this._latlng = toLatLng(latlng);\n\n if (isNaN(this.options.radius)) {\n throw new Error('Circle radius cannot be NaN');\n } // @section\n // @aka Circle options\n // @option radius: Number; Radius of the circle, in meters.\n\n\n this._mRadius = this.options.radius;\n },\n // @method setRadius(radius: Number): this\n // Sets the radius of a circle. Units are in meters.\n setRadius: function (radius) {\n this._mRadius = radius;\n return this.redraw();\n },\n // @method getRadius(): Number\n // Returns the current radius of a circle. Units are in meters.\n getRadius: function () {\n return this._mRadius;\n },\n // @method getBounds(): LatLngBounds\n // Returns the `LatLngBounds` of the path.\n getBounds: function () {\n var half = [this._radius, this._radiusY || this._radius];\n return new LatLngBounds(this._map.layerPointToLatLng(this._point.subtract(half)), this._map.layerPointToLatLng(this._point.add(half)));\n },\n setStyle: Path.prototype.setStyle,\n _project: function () {\n var lng = this._latlng.lng,\n lat = this._latlng.lat,\n map = this._map,\n crs = map.options.crs;\n\n if (crs.distance === Earth.distance) {\n var d = Math.PI / 180,\n latR = this._mRadius / Earth.R / d,\n top = map.project([lat + latR, lng]),\n bottom = map.project([lat - latR, lng]),\n p = top.add(bottom).divideBy(2),\n lat2 = map.unproject(p).lat,\n lngR = Math.acos((Math.cos(latR * d) - Math.sin(lat * d) * Math.sin(lat2 * d)) / (Math.cos(lat * d) * Math.cos(lat2 * d))) / d;\n\n if (isNaN(lngR) || lngR === 0) {\n lngR = latR / Math.cos(Math.PI / 180 * lat); // Fallback for edge case, #2425\n }\n\n this._point = p.subtract(map.getPixelOrigin());\n this._radius = isNaN(lngR) ? 0 : p.x - map.project([lat2, lng - lngR]).x;\n this._radiusY = p.y - top.y;\n } else {\n var latlng2 = crs.unproject(crs.project(this._latlng).subtract([this._mRadius, 0]));\n this._point = map.latLngToLayerPoint(this._latlng);\n this._radius = this._point.x - map.latLngToLayerPoint(latlng2).x;\n }\n\n this._updateBounds();\n }\n }); // @factory L.circle(latlng: LatLng, options?: Circle options)\n // Instantiates a circle object given a geographical point, and an options object\n // which contains the circle radius.\n // @alternative\n // @factory L.circle(latlng: LatLng, radius: Number, options?: Circle options)\n // Obsolete way of instantiating a circle, for compatibility with 0.7.x code.\n // Do not use in new applications or plugins.\n\n function circle(latlng, options, legacyOptions) {\n return new Circle(latlng, options, legacyOptions);\n }\n /*\n * @class Polyline\n * @aka L.Polyline\n * @inherits Path\n *\n * A class for drawing polyline overlays on a map. Extends `Path`.\n *\n * @example\n *\n * ```js\n * // create a red polyline from an array of LatLng points\n * var latlngs = [\n * \t[45.51, -122.68],\n * \t[37.77, -122.43],\n * \t[34.04, -118.2]\n * ];\n *\n * var polyline = L.polyline(latlngs, {color: 'red'}).addTo(map);\n *\n * // zoom the map to the polyline\n * map.fitBounds(polyline.getBounds());\n * ```\n *\n * You can also pass a multi-dimensional array to represent a `MultiPolyline` shape:\n *\n * ```js\n * // create a red polyline from an array of arrays of LatLng points\n * var latlngs = [\n * \t[[45.51, -122.68],\n * \t [37.77, -122.43],\n * \t [34.04, -118.2]],\n * \t[[40.78, -73.91],\n * \t [41.83, -87.62],\n * \t [32.76, -96.72]]\n * ];\n * ```\n */\n\n\n var Polyline = Path.extend({\n // @section\n // @aka Polyline options\n options: {\n // @option smoothFactor: Number = 1.0\n // How much to simplify the polyline on each zoom level. More means\n // better performance and smoother look, and less means more accurate representation.\n smoothFactor: 1.0,\n // @option noClip: Boolean = false\n // Disable polyline clipping.\n noClip: false\n },\n initialize: function (latlngs, options) {\n setOptions(this, options);\n\n this._setLatLngs(latlngs);\n },\n // @method getLatLngs(): LatLng[]\n // Returns an array of the points in the path, or nested arrays of points in case of multi-polyline.\n getLatLngs: function () {\n return this._latlngs;\n },\n // @method setLatLngs(latlngs: LatLng[]): this\n // Replaces all the points in the polyline with the given array of geographical points.\n setLatLngs: function (latlngs) {\n this._setLatLngs(latlngs);\n\n return this.redraw();\n },\n // @method isEmpty(): Boolean\n // Returns `true` if the Polyline has no LatLngs.\n isEmpty: function () {\n return !this._latlngs.length;\n },\n // @method closestLayerPoint(p: Point): Point\n // Returns the point closest to `p` on the Polyline.\n closestLayerPoint: function (p) {\n var minDistance = Infinity,\n minPoint = null,\n closest = _sqClosestPointOnSegment,\n p1,\n p2;\n\n for (var j = 0, jLen = this._parts.length; j < jLen; j++) {\n var points = this._parts[j];\n\n for (var i = 1, len = points.length; i < len; i++) {\n p1 = points[i - 1];\n p2 = points[i];\n var sqDist = closest(p, p1, p2, true);\n\n if (sqDist < minDistance) {\n minDistance = sqDist;\n minPoint = closest(p, p1, p2);\n }\n }\n }\n\n if (minPoint) {\n minPoint.distance = Math.sqrt(minDistance);\n }\n\n return minPoint;\n },\n // @method getCenter(): LatLng\n // Returns the center ([centroid](http://en.wikipedia.org/wiki/Centroid)) of the polyline.\n getCenter: function () {\n // throws error when not yet added to map as this center calculation requires projected coordinates\n if (!this._map) {\n throw new Error('Must add layer to map before using getCenter()');\n }\n\n var i,\n halfDist,\n segDist,\n dist,\n p1,\n p2,\n ratio,\n points = this._rings[0],\n len = points.length;\n\n if (!len) {\n return null;\n } // polyline centroid algorithm; only uses the first ring if there are multiple\n\n\n for (i = 0, halfDist = 0; i < len - 1; i++) {\n halfDist += points[i].distanceTo(points[i + 1]) / 2;\n } // The line is so small in the current view that all points are on the same pixel.\n\n\n if (halfDist === 0) {\n return this._map.layerPointToLatLng(points[0]);\n }\n\n for (i = 0, dist = 0; i < len - 1; i++) {\n p1 = points[i];\n p2 = points[i + 1];\n segDist = p1.distanceTo(p2);\n dist += segDist;\n\n if (dist > halfDist) {\n ratio = (dist - halfDist) / segDist;\n return this._map.layerPointToLatLng([p2.x - ratio * (p2.x - p1.x), p2.y - ratio * (p2.y - p1.y)]);\n }\n }\n },\n // @method getBounds(): LatLngBounds\n // Returns the `LatLngBounds` of the path.\n getBounds: function () {\n return this._bounds;\n },\n // @method addLatLng(latlng: LatLng, latlngs? LatLng[]): this\n // Adds a given point to the polyline. By default, adds to the first ring of\n // the polyline in case of a multi-polyline, but can be overridden by passing\n // a specific ring as a LatLng array (that you can earlier access with [`getLatLngs`](#polyline-getlatlngs)).\n addLatLng: function (latlng, latlngs) {\n latlngs = latlngs || this._defaultShape();\n latlng = toLatLng(latlng);\n latlngs.push(latlng);\n\n this._bounds.extend(latlng);\n\n return this.redraw();\n },\n _setLatLngs: function (latlngs) {\n this._bounds = new LatLngBounds();\n this._latlngs = this._convertLatLngs(latlngs);\n },\n _defaultShape: function () {\n return isFlat(this._latlngs) ? this._latlngs : this._latlngs[0];\n },\n // recursively convert latlngs input into actual LatLng instances; calculate bounds along the way\n _convertLatLngs: function (latlngs) {\n var result = [],\n flat = isFlat(latlngs);\n\n for (var i = 0, len = latlngs.length; i < len; i++) {\n if (flat) {\n result[i] = toLatLng(latlngs[i]);\n\n this._bounds.extend(result[i]);\n } else {\n result[i] = this._convertLatLngs(latlngs[i]);\n }\n }\n\n return result;\n },\n _project: function () {\n var pxBounds = new Bounds();\n this._rings = [];\n\n this._projectLatlngs(this._latlngs, this._rings, pxBounds);\n\n var w = this._clickTolerance(),\n p = new Point(w, w);\n\n if (this._bounds.isValid() && pxBounds.isValid()) {\n pxBounds.min._subtract(p);\n\n pxBounds.max._add(p);\n\n this._pxBounds = pxBounds;\n }\n },\n // recursively turns latlngs into a set of rings with projected coordinates\n _projectLatlngs: function (latlngs, result, projectedBounds) {\n var flat = latlngs[0] instanceof LatLng,\n len = latlngs.length,\n i,\n ring;\n\n if (flat) {\n ring = [];\n\n for (i = 0; i < len; i++) {\n ring[i] = this._map.latLngToLayerPoint(latlngs[i]);\n projectedBounds.extend(ring[i]);\n }\n\n result.push(ring);\n } else {\n for (i = 0; i < len; i++) {\n this._projectLatlngs(latlngs[i], result, projectedBounds);\n }\n }\n },\n // clip polyline by renderer bounds so that we have less to render for performance\n _clipPoints: function () {\n var bounds = this._renderer._bounds;\n this._parts = [];\n\n if (!this._pxBounds || !this._pxBounds.intersects(bounds)) {\n return;\n }\n\n if (this.options.noClip) {\n this._parts = this._rings;\n return;\n }\n\n var parts = this._parts,\n i,\n j,\n k,\n len,\n len2,\n segment,\n points;\n\n for (i = 0, k = 0, len = this._rings.length; i < len; i++) {\n points = this._rings[i];\n\n for (j = 0, len2 = points.length; j < len2 - 1; j++) {\n segment = clipSegment(points[j], points[j + 1], bounds, j, true);\n\n if (!segment) {\n continue;\n }\n\n parts[k] = parts[k] || [];\n parts[k].push(segment[0]); // if segment goes out of screen, or it's the last one, it's the end of the line part\n\n if (segment[1] !== points[j + 1] || j === len2 - 2) {\n parts[k].push(segment[1]);\n k++;\n }\n }\n }\n },\n // simplify each clipped part of the polyline for performance\n _simplifyPoints: function () {\n var parts = this._parts,\n tolerance = this.options.smoothFactor;\n\n for (var i = 0, len = parts.length; i < len; i++) {\n parts[i] = simplify(parts[i], tolerance);\n }\n },\n _update: function () {\n if (!this._map) {\n return;\n }\n\n this._clipPoints();\n\n this._simplifyPoints();\n\n this._updatePath();\n },\n _updatePath: function () {\n this._renderer._updatePoly(this);\n },\n // Needed by the `Canvas` renderer for interactivity\n _containsPoint: function (p, closed) {\n var i,\n j,\n k,\n len,\n len2,\n part,\n w = this._clickTolerance();\n\n if (!this._pxBounds || !this._pxBounds.contains(p)) {\n return false;\n } // hit detection for polylines\n\n\n for (i = 0, len = this._parts.length; i < len; i++) {\n part = this._parts[i];\n\n for (j = 0, len2 = part.length, k = len2 - 1; j < len2; k = j++) {\n if (!closed && j === 0) {\n continue;\n }\n\n if (pointToSegmentDistance(p, part[k], part[j]) <= w) {\n return true;\n }\n }\n }\n\n return false;\n }\n }); // @factory L.polyline(latlngs: LatLng[], options?: Polyline options)\n // Instantiates a polyline object given an array of geographical points and\n // optionally an options object. You can create a `Polyline` object with\n // multiple separate lines (`MultiPolyline`) by passing an array of arrays\n // of geographic points.\n\n function polyline(latlngs, options) {\n return new Polyline(latlngs, options);\n } // Retrocompat. Allow plugins to support Leaflet versions before and after 1.1.\n\n\n Polyline._flat = _flat;\n /*\n * @class Polygon\n * @aka L.Polygon\n * @inherits Polyline\n *\n * A class for drawing polygon overlays on a map. Extends `Polyline`.\n *\n * Note that points you pass when creating a polygon shouldn't have an additional last point equal to the first one — it's better to filter out such points.\n *\n *\n * @example\n *\n * ```js\n * // create a red polygon from an array of LatLng points\n * var latlngs = [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]];\n *\n * var polygon = L.polygon(latlngs, {color: 'red'}).addTo(map);\n *\n * // zoom the map to the polygon\n * map.fitBounds(polygon.getBounds());\n * ```\n *\n * You can also pass an array of arrays of latlngs, with the first array representing the outer shape and the other arrays representing holes in the outer shape:\n *\n * ```js\n * var latlngs = [\n * [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring\n * [[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole\n * ];\n * ```\n *\n * Additionally, you can pass a multi-dimensional array to represent a MultiPolygon shape.\n *\n * ```js\n * var latlngs = [\n * [ // first polygon\n * [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring\n * [[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole\n * ],\n * [ // second polygon\n * [[41, -111.03],[45, -111.04],[45, -104.05],[41, -104.05]]\n * ]\n * ];\n * ```\n */\n\n var Polygon = Polyline.extend({\n options: {\n fill: true\n },\n isEmpty: function () {\n return !this._latlngs.length || !this._latlngs[0].length;\n },\n getCenter: function () {\n // throws error when not yet added to map as this center calculation requires projected coordinates\n if (!this._map) {\n throw new Error('Must add layer to map before using getCenter()');\n }\n\n var i,\n j,\n p1,\n p2,\n f,\n area,\n x,\n y,\n center,\n points = this._rings[0],\n len = points.length;\n\n if (!len) {\n return null;\n } // polygon centroid algorithm; only uses the first ring if there are multiple\n\n\n area = x = y = 0;\n\n for (i = 0, j = len - 1; i < len; j = i++) {\n p1 = points[i];\n p2 = points[j];\n f = p1.y * p2.x - p2.y * p1.x;\n x += (p1.x + p2.x) * f;\n y += (p1.y + p2.y) * f;\n area += f * 3;\n }\n\n if (area === 0) {\n // Polygon is so small that all points are on same pixel.\n center = points[0];\n } else {\n center = [x / area, y / area];\n }\n\n return this._map.layerPointToLatLng(center);\n },\n _convertLatLngs: function (latlngs) {\n var result = Polyline.prototype._convertLatLngs.call(this, latlngs),\n len = result.length; // remove last point if it equals first one\n\n\n if (len >= 2 && result[0] instanceof LatLng && result[0].equals(result[len - 1])) {\n result.pop();\n }\n\n return result;\n },\n _setLatLngs: function (latlngs) {\n Polyline.prototype._setLatLngs.call(this, latlngs);\n\n if (isFlat(this._latlngs)) {\n this._latlngs = [this._latlngs];\n }\n },\n _defaultShape: function () {\n return isFlat(this._latlngs[0]) ? this._latlngs[0] : this._latlngs[0][0];\n },\n _clipPoints: function () {\n // polygons need a different clipping algorithm so we redefine that\n var bounds = this._renderer._bounds,\n w = this.options.weight,\n p = new Point(w, w); // increase clip padding by stroke width to avoid stroke on clip edges\n\n bounds = new Bounds(bounds.min.subtract(p), bounds.max.add(p));\n this._parts = [];\n\n if (!this._pxBounds || !this._pxBounds.intersects(bounds)) {\n return;\n }\n\n if (this.options.noClip) {\n this._parts = this._rings;\n return;\n }\n\n for (var i = 0, len = this._rings.length, clipped; i < len; i++) {\n clipped = clipPolygon(this._rings[i], bounds, true);\n\n if (clipped.length) {\n this._parts.push(clipped);\n }\n }\n },\n _updatePath: function () {\n this._renderer._updatePoly(this, true);\n },\n // Needed by the `Canvas` renderer for interactivity\n _containsPoint: function (p) {\n var inside = false,\n part,\n p1,\n p2,\n i,\n j,\n k,\n len,\n len2;\n\n if (!this._pxBounds || !this._pxBounds.contains(p)) {\n return false;\n } // ray casting algorithm for detecting if point is in polygon\n\n\n for (i = 0, len = this._parts.length; i < len; i++) {\n part = this._parts[i];\n\n for (j = 0, len2 = part.length, k = len2 - 1; j < len2; k = j++) {\n p1 = part[j];\n p2 = part[k];\n\n if (p1.y > p.y !== p2.y > p.y && p.x < (p2.x - p1.x) * (p.y - p1.y) / (p2.y - p1.y) + p1.x) {\n inside = !inside;\n }\n }\n } // also check if it's on polygon stroke\n\n\n return inside || Polyline.prototype._containsPoint.call(this, p, true);\n }\n }); // @factory L.polygon(latlngs: LatLng[], options?: Polyline options)\n\n function polygon(latlngs, options) {\n return new Polygon(latlngs, options);\n }\n /*\r\n * @class GeoJSON\r\n * @aka L.GeoJSON\r\n * @inherits FeatureGroup\r\n *\r\n * Represents a GeoJSON object or an array of GeoJSON objects. Allows you to parse\r\n * GeoJSON data and display it on the map. Extends `FeatureGroup`.\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * L.geoJSON(data, {\r\n * \tstyle: function (feature) {\r\n * \t\treturn {color: feature.properties.color};\r\n * \t}\r\n * }).bindPopup(function (layer) {\r\n * \treturn layer.feature.properties.description;\r\n * }).addTo(map);\r\n * ```\r\n */\n\n\n var GeoJSON = FeatureGroup.extend({\n /* @section\r\n * @aka GeoJSON options\r\n *\r\n * @option pointToLayer: Function = *\r\n * A `Function` defining how GeoJSON points spawn Leaflet layers. It is internally\r\n * called when data is added, passing the GeoJSON point feature and its `LatLng`.\r\n * The default is to spawn a default `Marker`:\r\n * ```js\r\n * function(geoJsonPoint, latlng) {\r\n * \treturn L.marker(latlng);\r\n * }\r\n * ```\r\n *\r\n * @option style: Function = *\r\n * A `Function` defining the `Path options` for styling GeoJSON lines and polygons,\r\n * called internally when data is added.\r\n * The default value is to not override any defaults:\r\n * ```js\r\n * function (geoJsonFeature) {\r\n * \treturn {}\r\n * }\r\n * ```\r\n *\r\n * @option onEachFeature: Function = *\r\n * A `Function` that will be called once for each created `Feature`, after it has\r\n * been created and styled. Useful for attaching events and popups to features.\r\n * The default is to do nothing with the newly created layers:\r\n * ```js\r\n * function (feature, layer) {}\r\n * ```\r\n *\r\n * @option filter: Function = *\r\n * A `Function` that will be used to decide whether to include a feature or not.\r\n * The default is to include all features:\r\n * ```js\r\n * function (geoJsonFeature) {\r\n * \treturn true;\r\n * }\r\n * ```\r\n * Note: dynamically changing the `filter` option will have effect only on newly\r\n * added data. It will _not_ re-evaluate already included features.\r\n *\r\n * @option coordsToLatLng: Function = *\r\n * A `Function` that will be used for converting GeoJSON coordinates to `LatLng`s.\r\n * The default is the `coordsToLatLng` static method.\r\n */\n initialize: function (geojson, options) {\n setOptions(this, options);\n this._layers = {};\n\n if (geojson) {\n this.addData(geojson);\n }\n },\n // @method addData( <GeoJSON> data ): this\n // Adds a GeoJSON object to the layer.\n addData: function (geojson) {\n var features = isArray(geojson) ? geojson : geojson.features,\n i,\n len,\n feature;\n\n if (features) {\n for (i = 0, len = features.length; i < len; i++) {\n // only add this if geometry or geometries are set and not null\n feature = features[i];\n\n if (feature.geometries || feature.geometry || feature.features || feature.coordinates) {\n this.addData(feature);\n }\n }\n\n return this;\n }\n\n var options = this.options;\n\n if (options.filter && !options.filter(geojson)) {\n return this;\n }\n\n var layer = geometryToLayer(geojson, options);\n\n if (!layer) {\n return this;\n }\n\n layer.feature = asFeature(geojson);\n layer.defaultOptions = layer.options;\n this.resetStyle(layer);\n\n if (options.onEachFeature) {\n options.onEachFeature(geojson, layer);\n }\n\n return this.addLayer(layer);\n },\n // @method resetStyle( <Path> layer ): this\n // Resets the given vector layer's style to the original GeoJSON style, useful for resetting style after hover events.\n resetStyle: function (layer) {\n // reset any custom styles\n layer.options = extend({}, layer.defaultOptions);\n\n this._setLayerStyle(layer, this.options.style);\n\n return this;\n },\n // @method setStyle( <Function> style ): this\n // Changes styles of GeoJSON vector layers with the given style function.\n setStyle: function (style) {\n return this.eachLayer(function (layer) {\n this._setLayerStyle(layer, style);\n }, this);\n },\n _setLayerStyle: function (layer, style) {\n if (typeof style === 'function') {\n style = style(layer.feature);\n }\n\n if (layer.setStyle) {\n layer.setStyle(style);\n }\n }\n }); // @section\n // There are several static functions which can be called without instantiating L.GeoJSON:\n // @function geometryToLayer(featureData: Object, options?: GeoJSON options): Layer\n // Creates a `Layer` from a given GeoJSON feature. Can use a custom\n // [`pointToLayer`](#geojson-pointtolayer) and/or [`coordsToLatLng`](#geojson-coordstolatlng)\n // functions if provided as options.\n\n function geometryToLayer(geojson, options) {\n var geometry = geojson.type === 'Feature' ? geojson.geometry : geojson,\n coords = geometry ? geometry.coordinates : null,\n layers = [],\n pointToLayer = options && options.pointToLayer,\n _coordsToLatLng = options && options.coordsToLatLng || coordsToLatLng,\n latlng,\n latlngs,\n i,\n len;\n\n if (!coords && !geometry) {\n return null;\n }\n\n switch (geometry.type) {\n case 'Point':\n latlng = _coordsToLatLng(coords);\n return pointToLayer ? pointToLayer(geojson, latlng) : new Marker(latlng);\n\n case 'MultiPoint':\n for (i = 0, len = coords.length; i < len; i++) {\n latlng = _coordsToLatLng(coords[i]);\n layers.push(pointToLayer ? pointToLayer(geojson, latlng) : new Marker(latlng));\n }\n\n return new FeatureGroup(layers);\n\n case 'LineString':\n case 'MultiLineString':\n latlngs = coordsToLatLngs(coords, geometry.type === 'LineString' ? 0 : 1, _coordsToLatLng);\n return new Polyline(latlngs, options);\n\n case 'Polygon':\n case 'MultiPolygon':\n latlngs = coordsToLatLngs(coords, geometry.type === 'Polygon' ? 1 : 2, _coordsToLatLng);\n return new Polygon(latlngs, options);\n\n case 'GeometryCollection':\n for (i = 0, len = geometry.geometries.length; i < len; i++) {\n var layer = geometryToLayer({\n geometry: geometry.geometries[i],\n type: 'Feature',\n properties: geojson.properties\n }, options);\n\n if (layer) {\n layers.push(layer);\n }\n }\n\n return new FeatureGroup(layers);\n\n default:\n throw new Error('Invalid GeoJSON object.');\n }\n } // @function coordsToLatLng(coords: Array): LatLng\n // Creates a `LatLng` object from an array of 2 numbers (longitude, latitude)\n // or 3 numbers (longitude, latitude, altitude) used in GeoJSON for points.\n\n\n function coordsToLatLng(coords) {\n return new LatLng(coords[1], coords[0], coords[2]);\n } // @function coordsToLatLngs(coords: Array, levelsDeep?: Number, coordsToLatLng?: Function): Array\n // Creates a multidimensional array of `LatLng`s from a GeoJSON coordinates array.\n // `levelsDeep` specifies the nesting level (0 is for an array of points, 1 for an array of arrays of points, etc., 0 by default).\n // Can use a custom [`coordsToLatLng`](#geojson-coordstolatlng) function.\n\n\n function coordsToLatLngs(coords, levelsDeep, _coordsToLatLng) {\n var latlngs = [];\n\n for (var i = 0, len = coords.length, latlng; i < len; i++) {\n latlng = levelsDeep ? coordsToLatLngs(coords[i], levelsDeep - 1, _coordsToLatLng) : (_coordsToLatLng || coordsToLatLng)(coords[i]);\n latlngs.push(latlng);\n }\n\n return latlngs;\n } // @function latLngToCoords(latlng: LatLng, precision?: Number): Array\n // Reverse of [`coordsToLatLng`](#geojson-coordstolatlng)\n\n\n function latLngToCoords(latlng, precision) {\n precision = typeof precision === 'number' ? precision : 6;\n return latlng.alt !== undefined ? [formatNum(latlng.lng, precision), formatNum(latlng.lat, precision), formatNum(latlng.alt, precision)] : [formatNum(latlng.lng, precision), formatNum(latlng.lat, precision)];\n } // @function latLngsToCoords(latlngs: Array, levelsDeep?: Number, closed?: Boolean): Array\n // Reverse of [`coordsToLatLngs`](#geojson-coordstolatlngs)\n // `closed` determines whether the first point should be appended to the end of the array to close the feature, only used when `levelsDeep` is 0. False by default.\n\n\n function latLngsToCoords(latlngs, levelsDeep, closed, precision) {\n var coords = [];\n\n for (var i = 0, len = latlngs.length; i < len; i++) {\n coords.push(levelsDeep ? latLngsToCoords(latlngs[i], levelsDeep - 1, closed, precision) : latLngToCoords(latlngs[i], precision));\n }\n\n if (!levelsDeep && closed) {\n coords.push(coords[0]);\n }\n\n return coords;\n }\n\n function getFeature(layer, newGeometry) {\n return layer.feature ? extend({}, layer.feature, {\n geometry: newGeometry\n }) : asFeature(newGeometry);\n } // @function asFeature(geojson: Object): Object\n // Normalize GeoJSON geometries/features into GeoJSON features.\n\n\n function asFeature(geojson) {\n if (geojson.type === 'Feature' || geojson.type === 'FeatureCollection') {\n return geojson;\n }\n\n return {\n type: 'Feature',\n properties: {},\n geometry: geojson\n };\n }\n\n var PointToGeoJSON = {\n toGeoJSON: function (precision) {\n return getFeature(this, {\n type: 'Point',\n coordinates: latLngToCoords(this.getLatLng(), precision)\n });\n }\n }; // @namespace Marker\n // @method toGeoJSON(): Object\n // Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the marker (as a GeoJSON `Point` Feature).\n\n Marker.include(PointToGeoJSON); // @namespace CircleMarker\n // @method toGeoJSON(): Object\n // Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the circle marker (as a GeoJSON `Point` Feature).\n\n Circle.include(PointToGeoJSON);\n CircleMarker.include(PointToGeoJSON); // @namespace Polyline\n // @method toGeoJSON(): Object\n // Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the polyline (as a GeoJSON `LineString` or `MultiLineString` Feature).\n\n Polyline.include({\n toGeoJSON: function (precision) {\n var multi = !isFlat(this._latlngs);\n var coords = latLngsToCoords(this._latlngs, multi ? 1 : 0, false, precision);\n return getFeature(this, {\n type: (multi ? 'Multi' : '') + 'LineString',\n coordinates: coords\n });\n }\n }); // @namespace Polygon\n // @method toGeoJSON(): Object\n // Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the polygon (as a GeoJSON `Polygon` or `MultiPolygon` Feature).\n\n Polygon.include({\n toGeoJSON: function (precision) {\n var holes = !isFlat(this._latlngs),\n multi = holes && !isFlat(this._latlngs[0]);\n var coords = latLngsToCoords(this._latlngs, multi ? 2 : holes ? 1 : 0, true, precision);\n\n if (!holes) {\n coords = [coords];\n }\n\n return getFeature(this, {\n type: (multi ? 'Multi' : '') + 'Polygon',\n coordinates: coords\n });\n }\n }); // @namespace LayerGroup\n\n LayerGroup.include({\n toMultiPoint: function (precision) {\n var coords = [];\n this.eachLayer(function (layer) {\n coords.push(layer.toGeoJSON(precision).geometry.coordinates);\n });\n return getFeature(this, {\n type: 'MultiPoint',\n coordinates: coords\n });\n },\n // @method toGeoJSON(): Object\n // Returns a [`GeoJSON`](http://en.wikipedia.org/wiki/GeoJSON) representation of the layer group (as a GeoJSON `FeatureCollection`, `GeometryCollection`, or `MultiPoint`).\n toGeoJSON: function (precision) {\n var type = this.feature && this.feature.geometry && this.feature.geometry.type;\n\n if (type === 'MultiPoint') {\n return this.toMultiPoint(precision);\n }\n\n var isGeometryCollection = type === 'GeometryCollection',\n jsons = [];\n this.eachLayer(function (layer) {\n if (layer.toGeoJSON) {\n var json = layer.toGeoJSON(precision);\n\n if (isGeometryCollection) {\n jsons.push(json.geometry);\n } else {\n var feature = asFeature(json); // Squash nested feature collections\n\n if (feature.type === 'FeatureCollection') {\n jsons.push.apply(jsons, feature.features);\n } else {\n jsons.push(feature);\n }\n }\n }\n });\n\n if (isGeometryCollection) {\n return getFeature(this, {\n geometries: jsons,\n type: 'GeometryCollection'\n });\n }\n\n return {\n type: 'FeatureCollection',\n features: jsons\n };\n }\n }); // @namespace GeoJSON\n // @factory L.geoJSON(geojson?: Object, options?: GeoJSON options)\n // Creates a GeoJSON layer. Optionally accepts an object in\n // [GeoJSON format](https://tools.ietf.org/html/rfc7946) to display on the map\n // (you can alternatively add it later with `addData` method) and an `options` object.\n\n function geoJSON(geojson, options) {\n return new GeoJSON(geojson, options);\n } // Backward compatibility.\n\n\n var geoJson = geoJSON;\n /*\r\n * @class ImageOverlay\r\n * @aka L.ImageOverlay\r\n * @inherits Interactive layer\r\n *\r\n * Used to load and display a single image over specific bounds of the map. Extends `Layer`.\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * var imageUrl = 'http://www.lib.utexas.edu/maps/historical/newark_nj_1922.jpg',\r\n * \timageBounds = [[40.712216, -74.22655], [40.773941, -74.12544]];\r\n * L.imageOverlay(imageUrl, imageBounds).addTo(map);\r\n * ```\r\n */\n\n var ImageOverlay = Layer.extend({\n // @section\n // @aka ImageOverlay options\n options: {\n // @option opacity: Number = 1.0\n // The opacity of the image overlay.\n opacity: 1,\n // @option alt: String = ''\n // Text for the `alt` attribute of the image (useful for accessibility).\n alt: '',\n // @option interactive: Boolean = false\n // If `true`, the image overlay will emit [mouse events](#interactive-layer) when clicked or hovered.\n interactive: false,\n // @option crossOrigin: Boolean|String = false\n // Whether the crossOrigin attribute will be added to the image.\n // If a String is provided, the image will have its crossOrigin attribute set to the String provided. This is needed if you want to access image pixel data.\n // Refer to [CORS Settings](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes) for valid String values.\n crossOrigin: false,\n // @option errorOverlayUrl: String = ''\n // URL to the overlay image to show in place of the overlay that failed to load.\n errorOverlayUrl: '',\n // @option zIndex: Number = 1\n // The explicit [zIndex](https://developer.mozilla.org/docs/Web/CSS/CSS_Positioning/Understanding_z_index) of the overlay layer.\n zIndex: 1,\n // @option className: String = ''\n // A custom class name to assign to the image. Empty by default.\n className: ''\n },\n initialize: function (url, bounds, options) {\n // (String, LatLngBounds, Object)\n this._url = url;\n this._bounds = toLatLngBounds(bounds);\n setOptions(this, options);\n },\n onAdd: function () {\n if (!this._image) {\n this._initImage();\n\n if (this.options.opacity < 1) {\n this._updateOpacity();\n }\n }\n\n if (this.options.interactive) {\n addClass(this._image, 'leaflet-interactive');\n this.addInteractiveTarget(this._image);\n }\n\n this.getPane().appendChild(this._image);\n\n this._reset();\n },\n onRemove: function () {\n remove(this._image);\n\n if (this.options.interactive) {\n this.removeInteractiveTarget(this._image);\n }\n },\n // @method setOpacity(opacity: Number): this\n // Sets the opacity of the overlay.\n setOpacity: function (opacity) {\n this.options.opacity = opacity;\n\n if (this._image) {\n this._updateOpacity();\n }\n\n return this;\n },\n setStyle: function (styleOpts) {\n if (styleOpts.opacity) {\n this.setOpacity(styleOpts.opacity);\n }\n\n return this;\n },\n // @method bringToFront(): this\n // Brings the layer to the top of all overlays.\n bringToFront: function () {\n if (this._map) {\n toFront(this._image);\n }\n\n return this;\n },\n // @method bringToBack(): this\n // Brings the layer to the bottom of all overlays.\n bringToBack: function () {\n if (this._map) {\n toBack(this._image);\n }\n\n return this;\n },\n // @method setUrl(url: String): this\n // Changes the URL of the image.\n setUrl: function (url) {\n this._url = url;\n\n if (this._image) {\n this._image.src = url;\n }\n\n return this;\n },\n // @method setBounds(bounds: LatLngBounds): this\n // Update the bounds that this ImageOverlay covers\n setBounds: function (bounds) {\n this._bounds = toLatLngBounds(bounds);\n\n if (this._map) {\n this._reset();\n }\n\n return this;\n },\n getEvents: function () {\n var events = {\n zoom: this._reset,\n viewreset: this._reset\n };\n\n if (this._zoomAnimated) {\n events.zoomanim = this._animateZoom;\n }\n\n return events;\n },\n // @method setZIndex(value: Number): this\n // Changes the [zIndex](#imageoverlay-zindex) of the image overlay.\n setZIndex: function (value) {\n this.options.zIndex = value;\n\n this._updateZIndex();\n\n return this;\n },\n // @method getBounds(): LatLngBounds\n // Get the bounds that this ImageOverlay covers\n getBounds: function () {\n return this._bounds;\n },\n // @method getElement(): HTMLElement\n // Returns the instance of [`HTMLImageElement`](https://developer.mozilla.org/docs/Web/API/HTMLImageElement)\n // used by this overlay.\n getElement: function () {\n return this._image;\n },\n _initImage: function () {\n var wasElementSupplied = this._url.tagName === 'IMG';\n var img = this._image = wasElementSupplied ? this._url : create$1('img');\n addClass(img, 'leaflet-image-layer');\n\n if (this._zoomAnimated) {\n addClass(img, 'leaflet-zoom-animated');\n }\n\n if (this.options.className) {\n addClass(img, this.options.className);\n }\n\n img.onselectstart = falseFn;\n img.onmousemove = falseFn; // @event load: Event\n // Fired when the ImageOverlay layer has loaded its image\n\n img.onload = bind(this.fire, this, 'load');\n img.onerror = bind(this._overlayOnError, this, 'error');\n\n if (this.options.crossOrigin || this.options.crossOrigin === '') {\n img.crossOrigin = this.options.crossOrigin === true ? '' : this.options.crossOrigin;\n }\n\n if (this.options.zIndex) {\n this._updateZIndex();\n }\n\n if (wasElementSupplied) {\n this._url = img.src;\n return;\n }\n\n img.src = this._url;\n img.alt = this.options.alt;\n },\n _animateZoom: function (e) {\n var scale = this._map.getZoomScale(e.zoom),\n offset = this._map._latLngBoundsToNewLayerBounds(this._bounds, e.zoom, e.center).min;\n\n setTransform(this._image, offset, scale);\n },\n _reset: function () {\n var image = this._image,\n bounds = new Bounds(this._map.latLngToLayerPoint(this._bounds.getNorthWest()), this._map.latLngToLayerPoint(this._bounds.getSouthEast())),\n size = bounds.getSize();\n setPosition(image, bounds.min);\n image.style.width = size.x + 'px';\n image.style.height = size.y + 'px';\n },\n _updateOpacity: function () {\n setOpacity(this._image, this.options.opacity);\n },\n _updateZIndex: function () {\n if (this._image && this.options.zIndex !== undefined && this.options.zIndex !== null) {\n this._image.style.zIndex = this.options.zIndex;\n }\n },\n _overlayOnError: function () {\n // @event error: Event\n // Fired when the ImageOverlay layer fails to load its image\n this.fire('error');\n var errorUrl = this.options.errorOverlayUrl;\n\n if (errorUrl && this._url !== errorUrl) {\n this._url = errorUrl;\n this._image.src = errorUrl;\n }\n }\n }); // @factory L.imageOverlay(imageUrl: String, bounds: LatLngBounds, options?: ImageOverlay options)\n // Instantiates an image overlay object given the URL of the image and the\n // geographical bounds it is tied to.\n\n var imageOverlay = function (url, bounds, options) {\n return new ImageOverlay(url, bounds, options);\n };\n /*\r\n * @class VideoOverlay\r\n * @aka L.VideoOverlay\r\n * @inherits ImageOverlay\r\n *\r\n * Used to load and display a video player over specific bounds of the map. Extends `ImageOverlay`.\r\n *\r\n * A video overlay uses the [`<video>`](https://developer.mozilla.org/docs/Web/HTML/Element/video)\r\n * HTML5 element.\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * var videoUrl = 'https://www.mapbox.com/bites/00188/patricia_nasa.webm',\r\n * \tvideoBounds = [[ 32, -130], [ 13, -100]];\r\n * L.videoOverlay(videoUrl, videoBounds ).addTo(map);\r\n * ```\r\n */\n\n\n var VideoOverlay = ImageOverlay.extend({\n // @section\n // @aka VideoOverlay options\n options: {\n // @option autoplay: Boolean = true\n // Whether the video starts playing automatically when loaded.\n autoplay: true,\n // @option loop: Boolean = true\n // Whether the video will loop back to the beginning when played.\n loop: true\n },\n _initImage: function () {\n var wasElementSupplied = this._url.tagName === 'VIDEO';\n var vid = this._image = wasElementSupplied ? this._url : create$1('video');\n addClass(vid, 'leaflet-image-layer');\n\n if (this._zoomAnimated) {\n addClass(vid, 'leaflet-zoom-animated');\n }\n\n vid.onselectstart = falseFn;\n vid.onmousemove = falseFn; // @event load: Event\n // Fired when the video has finished loading the first frame\n\n vid.onloadeddata = bind(this.fire, this, 'load');\n\n if (wasElementSupplied) {\n var sourceElements = vid.getElementsByTagName('source');\n var sources = [];\n\n for (var j = 0; j < sourceElements.length; j++) {\n sources.push(sourceElements[j].src);\n }\n\n this._url = sourceElements.length > 0 ? sources : [vid.src];\n return;\n }\n\n if (!isArray(this._url)) {\n this._url = [this._url];\n }\n\n vid.autoplay = !!this.options.autoplay;\n vid.loop = !!this.options.loop;\n\n for (var i = 0; i < this._url.length; i++) {\n var source = create$1('source');\n source.src = this._url[i];\n vid.appendChild(source);\n }\n } // @method getElement(): HTMLVideoElement\n // Returns the instance of [`HTMLVideoElement`](https://developer.mozilla.org/docs/Web/API/HTMLVideoElement)\n // used by this overlay.\n\n }); // @factory L.videoOverlay(video: String|Array|HTMLVideoElement, bounds: LatLngBounds, options?: VideoOverlay options)\n // Instantiates an image overlay object given the URL of the video (or array of URLs, or even a video element) and the\n // geographical bounds it is tied to.\n\n function videoOverlay(video, bounds, options) {\n return new VideoOverlay(video, bounds, options);\n }\n /*\r\n * @class DivOverlay\r\n * @inherits Layer\r\n * @aka L.DivOverlay\r\n * Base model for L.Popup and L.Tooltip. Inherit from it for custom popup like plugins.\r\n */\n // @namespace DivOverlay\n\n\n var DivOverlay = Layer.extend({\n // @section\n // @aka DivOverlay options\n options: {\n // @option offset: Point = Point(0, 7)\n // The offset of the popup position. Useful to control the anchor\n // of the popup when opening it on some overlays.\n offset: [0, 7],\n // @option className: String = ''\n // A custom CSS class name to assign to the popup.\n className: '',\n // @option pane: String = 'popupPane'\n // `Map pane` where the popup will be added.\n pane: 'popupPane'\n },\n initialize: function (options, source) {\n setOptions(this, options);\n this._source = source;\n },\n onAdd: function (map) {\n this._zoomAnimated = map._zoomAnimated;\n\n if (!this._container) {\n this._initLayout();\n }\n\n if (map._fadeAnimated) {\n setOpacity(this._container, 0);\n }\n\n clearTimeout(this._removeTimeout);\n this.getPane().appendChild(this._container);\n this.update();\n\n if (map._fadeAnimated) {\n setOpacity(this._container, 1);\n }\n\n this.bringToFront();\n },\n onRemove: function (map) {\n if (map._fadeAnimated) {\n setOpacity(this._container, 0);\n this._removeTimeout = setTimeout(bind(remove, undefined, this._container), 200);\n } else {\n remove(this._container);\n }\n },\n // @namespace Popup\n // @method getLatLng: LatLng\n // Returns the geographical point of popup.\n getLatLng: function () {\n return this._latlng;\n },\n // @method setLatLng(latlng: LatLng): this\n // Sets the geographical point where the popup will open.\n setLatLng: function (latlng) {\n this._latlng = toLatLng(latlng);\n\n if (this._map) {\n this._updatePosition();\n\n this._adjustPan();\n }\n\n return this;\n },\n // @method getContent: String|HTMLElement\n // Returns the content of the popup.\n getContent: function () {\n return this._content;\n },\n // @method setContent(htmlContent: String|HTMLElement|Function): this\n // Sets the HTML content of the popup. If a function is passed the source layer will be passed to the function. The function should return a `String` or `HTMLElement` to be used in the popup.\n setContent: function (content) {\n this._content = content;\n this.update();\n return this;\n },\n // @method getElement: String|HTMLElement\n // Alias for [getContent()](#popup-getcontent)\n getElement: function () {\n return this._container;\n },\n // @method update: null\n // Updates the popup content, layout and position. Useful for updating the popup after something inside changed, e.g. image loaded.\n update: function () {\n if (!this._map) {\n return;\n }\n\n this._container.style.visibility = 'hidden';\n\n this._updateContent();\n\n this._updateLayout();\n\n this._updatePosition();\n\n this._container.style.visibility = '';\n\n this._adjustPan();\n },\n getEvents: function () {\n var events = {\n zoom: this._updatePosition,\n viewreset: this._updatePosition\n };\n\n if (this._zoomAnimated) {\n events.zoomanim = this._animateZoom;\n }\n\n return events;\n },\n // @method isOpen: Boolean\n // Returns `true` when the popup is visible on the map.\n isOpen: function () {\n return !!this._map && this._map.hasLayer(this);\n },\n // @method bringToFront: this\n // Brings this popup in front of other popups (in the same map pane).\n bringToFront: function () {\n if (this._map) {\n toFront(this._container);\n }\n\n return this;\n },\n // @method bringToBack: this\n // Brings this popup to the back of other popups (in the same map pane).\n bringToBack: function () {\n if (this._map) {\n toBack(this._container);\n }\n\n return this;\n },\n _updateContent: function () {\n if (!this._content) {\n return;\n }\n\n var node = this._contentNode;\n var content = typeof this._content === 'function' ? this._content(this._source || this) : this._content;\n\n if (typeof content === 'string') {\n node.innerHTML = content;\n } else {\n while (node.hasChildNodes()) {\n node.removeChild(node.firstChild);\n }\n\n node.appendChild(content);\n }\n\n this.fire('contentupdate');\n },\n _updatePosition: function () {\n if (!this._map) {\n return;\n }\n\n var pos = this._map.latLngToLayerPoint(this._latlng),\n offset = toPoint(this.options.offset),\n anchor = this._getAnchor();\n\n if (this._zoomAnimated) {\n setPosition(this._container, pos.add(anchor));\n } else {\n offset = offset.add(pos).add(anchor);\n }\n\n var bottom = this._containerBottom = -offset.y,\n left = this._containerLeft = -Math.round(this._containerWidth / 2) + offset.x; // bottom position the popup in case the height of the popup changes (images loading etc)\n\n this._container.style.bottom = bottom + 'px';\n this._container.style.left = left + 'px';\n },\n _getAnchor: function () {\n return [0, 0];\n }\n });\n /*\r\n * @class Popup\r\n * @inherits DivOverlay\r\n * @aka L.Popup\r\n * Used to open popups in certain places of the map. Use [Map.openPopup](#map-openpopup) to\r\n * open popups while making sure that only one popup is open at one time\r\n * (recommended for usability), or use [Map.addLayer](#map-addlayer) to open as many as you want.\r\n *\r\n * @example\r\n *\r\n * If you want to just bind a popup to marker click and then open it, it's really easy:\r\n *\r\n * ```js\r\n * marker.bindPopup(popupContent).openPopup();\r\n * ```\r\n * Path overlays like polylines also have a `bindPopup` method.\r\n * Here's a more complicated way to open a popup on a map:\r\n *\r\n * ```js\r\n * var popup = L.popup()\r\n * \t.setLatLng(latlng)\r\n * \t.setContent('<p>Hello world!<br />This is a nice popup.</p>')\r\n * \t.openOn(map);\r\n * ```\r\n */\n // @namespace Popup\n\n var Popup = DivOverlay.extend({\n // @section\n // @aka Popup options\n options: {\n // @option maxWidth: Number = 300\n // Max width of the popup, in pixels.\n maxWidth: 300,\n // @option minWidth: Number = 50\n // Min width of the popup, in pixels.\n minWidth: 50,\n // @option maxHeight: Number = null\n // If set, creates a scrollable container of the given height\n // inside a popup if its content exceeds it.\n maxHeight: null,\n // @option autoPan: Boolean = true\n // Set it to `false` if you don't want the map to do panning animation\n // to fit the opened popup.\n autoPan: true,\n // @option autoPanPaddingTopLeft: Point = null\n // The margin between the popup and the top left corner of the map\n // view after autopanning was performed.\n autoPanPaddingTopLeft: null,\n // @option autoPanPaddingBottomRight: Point = null\n // The margin between the popup and the bottom right corner of the map\n // view after autopanning was performed.\n autoPanPaddingBottomRight: null,\n // @option autoPanPadding: Point = Point(5, 5)\n // Equivalent of setting both top left and bottom right autopan padding to the same value.\n autoPanPadding: [5, 5],\n // @option keepInView: Boolean = false\n // Set it to `true` if you want to prevent users from panning the popup\n // off of the screen while it is open.\n keepInView: false,\n // @option closeButton: Boolean = true\n // Controls the presence of a close button in the popup.\n closeButton: true,\n // @option autoClose: Boolean = true\n // Set it to `false` if you want to override the default behavior of\n // the popup closing when another popup is opened.\n autoClose: true,\n // @option closeOnEscapeKey: Boolean = true\n // Set it to `false` if you want to override the default behavior of\n // the ESC key for closing of the popup.\n closeOnEscapeKey: true,\n // @option closeOnClick: Boolean = *\n // Set it if you want to override the default behavior of the popup closing when user clicks\n // on the map. Defaults to the map's [`closePopupOnClick`](#map-closepopuponclick) option.\n // @option className: String = ''\n // A custom CSS class name to assign to the popup.\n className: ''\n },\n // @namespace Popup\n // @method openOn(map: Map): this\n // Adds the popup to the map and closes the previous one. The same as `map.openPopup(popup)`.\n openOn: function (map) {\n map.openPopup(this);\n return this;\n },\n onAdd: function (map) {\n DivOverlay.prototype.onAdd.call(this, map); // @namespace Map\n // @section Popup events\n // @event popupopen: PopupEvent\n // Fired when a popup is opened in the map\n\n map.fire('popupopen', {\n popup: this\n });\n\n if (this._source) {\n // @namespace Layer\n // @section Popup events\n // @event popupopen: PopupEvent\n // Fired when a popup bound to this layer is opened\n this._source.fire('popupopen', {\n popup: this\n }, true); // For non-path layers, we toggle the popup when clicking\n // again the layer, so prevent the map to reopen it.\n\n\n if (!(this._source instanceof Path)) {\n this._source.on('preclick', stopPropagation);\n }\n }\n },\n onRemove: function (map) {\n DivOverlay.prototype.onRemove.call(this, map); // @namespace Map\n // @section Popup events\n // @event popupclose: PopupEvent\n // Fired when a popup in the map is closed\n\n map.fire('popupclose', {\n popup: this\n });\n\n if (this._source) {\n // @namespace Layer\n // @section Popup events\n // @event popupclose: PopupEvent\n // Fired when a popup bound to this layer is closed\n this._source.fire('popupclose', {\n popup: this\n }, true);\n\n if (!(this._source instanceof Path)) {\n this._source.off('preclick', stopPropagation);\n }\n }\n },\n getEvents: function () {\n var events = DivOverlay.prototype.getEvents.call(this);\n\n if (this.options.closeOnClick !== undefined ? this.options.closeOnClick : this._map.options.closePopupOnClick) {\n events.preclick = this._close;\n }\n\n if (this.options.keepInView) {\n events.moveend = this._adjustPan;\n }\n\n return events;\n },\n _close: function () {\n if (this._map) {\n this._map.closePopup(this);\n }\n },\n _initLayout: function () {\n var prefix = 'leaflet-popup',\n container = this._container = create$1('div', prefix + ' ' + (this.options.className || '') + ' leaflet-zoom-animated');\n var wrapper = this._wrapper = create$1('div', prefix + '-content-wrapper', container);\n this._contentNode = create$1('div', prefix + '-content', wrapper);\n disableClickPropagation(wrapper);\n disableScrollPropagation(this._contentNode);\n on(wrapper, 'contextmenu', stopPropagation);\n this._tipContainer = create$1('div', prefix + '-tip-container', container);\n this._tip = create$1('div', prefix + '-tip', this._tipContainer);\n\n if (this.options.closeButton) {\n var closeButton = this._closeButton = create$1('a', prefix + '-close-button', container);\n closeButton.href = '#close';\n closeButton.innerHTML = '&#215;';\n on(closeButton, 'click', this._onCloseButtonClick, this);\n }\n },\n _updateLayout: function () {\n var container = this._contentNode,\n style = container.style;\n style.width = '';\n style.whiteSpace = 'nowrap';\n var width = container.offsetWidth;\n width = Math.min(width, this.options.maxWidth);\n width = Math.max(width, this.options.minWidth);\n style.width = width + 1 + 'px';\n style.whiteSpace = '';\n style.height = '';\n var height = container.offsetHeight,\n maxHeight = this.options.maxHeight,\n scrolledClass = 'leaflet-popup-scrolled';\n\n if (maxHeight && height > maxHeight) {\n style.height = maxHeight + 'px';\n addClass(container, scrolledClass);\n } else {\n removeClass(container, scrolledClass);\n }\n\n this._containerWidth = this._container.offsetWidth;\n },\n _animateZoom: function (e) {\n var pos = this._map._latLngToNewLayerPoint(this._latlng, e.zoom, e.center),\n anchor = this._getAnchor();\n\n setPosition(this._container, pos.add(anchor));\n },\n _adjustPan: function () {\n if (!this.options.autoPan) {\n return;\n }\n\n if (this._map._panAnim) {\n this._map._panAnim.stop();\n }\n\n var map = this._map,\n marginBottom = parseInt(getStyle(this._container, 'marginBottom'), 10) || 0,\n containerHeight = this._container.offsetHeight + marginBottom,\n containerWidth = this._containerWidth,\n layerPos = new Point(this._containerLeft, -containerHeight - this._containerBottom);\n\n layerPos._add(getPosition(this._container));\n\n var containerPos = map.layerPointToContainerPoint(layerPos),\n padding = toPoint(this.options.autoPanPadding),\n paddingTL = toPoint(this.options.autoPanPaddingTopLeft || padding),\n paddingBR = toPoint(this.options.autoPanPaddingBottomRight || padding),\n size = map.getSize(),\n dx = 0,\n dy = 0;\n\n if (containerPos.x + containerWidth + paddingBR.x > size.x) {\n // right\n dx = containerPos.x + containerWidth - size.x + paddingBR.x;\n }\n\n if (containerPos.x - dx - paddingTL.x < 0) {\n // left\n dx = containerPos.x - paddingTL.x;\n }\n\n if (containerPos.y + containerHeight + paddingBR.y > size.y) {\n // bottom\n dy = containerPos.y + containerHeight - size.y + paddingBR.y;\n }\n\n if (containerPos.y - dy - paddingTL.y < 0) {\n // top\n dy = containerPos.y - paddingTL.y;\n } // @namespace Map\n // @section Popup events\n // @event autopanstart: Event\n // Fired when the map starts autopanning when opening a popup.\n\n\n if (dx || dy) {\n map.fire('autopanstart').panBy([dx, dy]);\n }\n },\n _onCloseButtonClick: function (e) {\n this._close();\n\n stop(e);\n },\n _getAnchor: function () {\n // Where should we anchor the popup on the source layer?\n return toPoint(this._source && this._source._getPopupAnchor ? this._source._getPopupAnchor() : [0, 0]);\n }\n }); // @namespace Popup\n // @factory L.popup(options?: Popup options, source?: Layer)\n // Instantiates a `Popup` object given an optional `options` object that describes its appearance and location and an optional `source` object that is used to tag the popup with a reference to the Layer to which it refers.\n\n var popup = function (options, source) {\n return new Popup(options, source);\n };\n /* @namespace Map\r\n * @section Interaction Options\r\n * @option closePopupOnClick: Boolean = true\r\n * Set it to `false` if you don't want popups to close when user clicks the map.\r\n */\n\n\n Map.mergeOptions({\n closePopupOnClick: true\n }); // @namespace Map\n // @section Methods for Layers and Controls\n\n Map.include({\n // @method openPopup(popup: Popup): this\n // Opens the specified popup while closing the previously opened (to make sure only one is opened at one time for usability).\n // @alternative\n // @method openPopup(content: String|HTMLElement, latlng: LatLng, options?: Popup options): this\n // Creates a popup with the specified content and options and opens it in the given point on a map.\n openPopup: function (popup, latlng, options) {\n if (!(popup instanceof Popup)) {\n popup = new Popup(options).setContent(popup);\n }\n\n if (latlng) {\n popup.setLatLng(latlng);\n }\n\n if (this.hasLayer(popup)) {\n return this;\n }\n\n if (this._popup && this._popup.options.autoClose) {\n this.closePopup();\n }\n\n this._popup = popup;\n return this.addLayer(popup);\n },\n // @method closePopup(popup?: Popup): this\n // Closes the popup previously opened with [openPopup](#map-openpopup) (or the given one).\n closePopup: function (popup) {\n if (!popup || popup === this._popup) {\n popup = this._popup;\n this._popup = null;\n }\n\n if (popup) {\n this.removeLayer(popup);\n }\n\n return this;\n }\n });\n /*\r\n * @namespace Layer\r\n * @section Popup methods example\r\n *\r\n * All layers share a set of methods convenient for binding popups to it.\r\n *\r\n * ```js\r\n * var layer = L.Polygon(latlngs).bindPopup('Hi There!').addTo(map);\r\n * layer.openPopup();\r\n * layer.closePopup();\r\n * ```\r\n *\r\n * Popups will also be automatically opened when the layer is clicked on and closed when the layer is removed from the map or another popup is opened.\r\n */\n // @section Popup methods\n\n Layer.include({\n // @method bindPopup(content: String|HTMLElement|Function|Popup, options?: Popup options): this\n // Binds a popup to the layer with the passed `content` and sets up the\n // necessary event listeners. If a `Function` is passed it will receive\n // the layer as the first argument and should return a `String` or `HTMLElement`.\n bindPopup: function (content, options) {\n if (content instanceof Popup) {\n setOptions(content, options);\n this._popup = content;\n content._source = this;\n } else {\n if (!this._popup || options) {\n this._popup = new Popup(options, this);\n }\n\n this._popup.setContent(content);\n }\n\n if (!this._popupHandlersAdded) {\n this.on({\n click: this._openPopup,\n keypress: this._onKeyPress,\n remove: this.closePopup,\n move: this._movePopup\n });\n this._popupHandlersAdded = true;\n }\n\n return this;\n },\n // @method unbindPopup(): this\n // Removes the popup previously bound with `bindPopup`.\n unbindPopup: function () {\n if (this._popup) {\n this.off({\n click: this._openPopup,\n keypress: this._onKeyPress,\n remove: this.closePopup,\n move: this._movePopup\n });\n this._popupHandlersAdded = false;\n this._popup = null;\n }\n\n return this;\n },\n // @method openPopup(latlng?: LatLng): this\n // Opens the bound popup at the specified `latlng` or at the default popup anchor if no `latlng` is passed.\n openPopup: function (layer, latlng) {\n if (!(layer instanceof Layer)) {\n latlng = layer;\n layer = this;\n }\n\n if (layer instanceof FeatureGroup) {\n for (var id in this._layers) {\n layer = this._layers[id];\n break;\n }\n }\n\n if (!latlng) {\n latlng = layer.getCenter ? layer.getCenter() : layer.getLatLng();\n }\n\n if (this._popup && this._map) {\n // set popup source to this layer\n this._popup._source = layer; // update the popup (content, layout, ect...)\n\n this._popup.update(); // open the popup on the map\n\n\n this._map.openPopup(this._popup, latlng);\n }\n\n return this;\n },\n // @method closePopup(): this\n // Closes the popup bound to this layer if it is open.\n closePopup: function () {\n if (this._popup) {\n this._popup._close();\n }\n\n return this;\n },\n // @method togglePopup(): this\n // Opens or closes the popup bound to this layer depending on its current state.\n togglePopup: function (target) {\n if (this._popup) {\n if (this._popup._map) {\n this.closePopup();\n } else {\n this.openPopup(target);\n }\n }\n\n return this;\n },\n // @method isPopupOpen(): boolean\n // Returns `true` if the popup bound to this layer is currently open.\n isPopupOpen: function () {\n return this._popup ? this._popup.isOpen() : false;\n },\n // @method setPopupContent(content: String|HTMLElement|Popup): this\n // Sets the content of the popup bound to this layer.\n setPopupContent: function (content) {\n if (this._popup) {\n this._popup.setContent(content);\n }\n\n return this;\n },\n // @method getPopup(): Popup\n // Returns the popup bound to this layer.\n getPopup: function () {\n return this._popup;\n },\n _openPopup: function (e) {\n var layer = e.layer || e.target;\n\n if (!this._popup) {\n return;\n }\n\n if (!this._map) {\n return;\n } // prevent map click\n\n\n stop(e); // if this inherits from Path its a vector and we can just\n // open the popup at the new location\n\n if (layer instanceof Path) {\n this.openPopup(e.layer || e.target, e.latlng);\n return;\n } // otherwise treat it like a marker and figure out\n // if we should toggle it open/closed\n\n\n if (this._map.hasLayer(this._popup) && this._popup._source === layer) {\n this.closePopup();\n } else {\n this.openPopup(layer, e.latlng);\n }\n },\n _movePopup: function (e) {\n this._popup.setLatLng(e.latlng);\n },\n _onKeyPress: function (e) {\n if (e.originalEvent.keyCode === 13) {\n this._openPopup(e);\n }\n }\n });\n /*\n * @class Tooltip\n * @inherits DivOverlay\n * @aka L.Tooltip\n * Used to display small texts on top of map layers.\n *\n * @example\n *\n * ```js\n * marker.bindTooltip(\"my tooltip text\").openTooltip();\n * ```\n * Note about tooltip offset. Leaflet takes two options in consideration\n * for computing tooltip offsetting:\n * - the `offset` Tooltip option: it defaults to [0, 0], and it's specific to one tooltip.\n * Add a positive x offset to move the tooltip to the right, and a positive y offset to\n * move it to the bottom. Negatives will move to the left and top.\n * - the `tooltipAnchor` Icon option: this will only be considered for Marker. You\n * should adapt this value if you use a custom icon.\n */\n // @namespace Tooltip\n\n var Tooltip = DivOverlay.extend({\n // @section\n // @aka Tooltip options\n options: {\n // @option pane: String = 'tooltipPane'\n // `Map pane` where the tooltip will be added.\n pane: 'tooltipPane',\n // @option offset: Point = Point(0, 0)\n // Optional offset of the tooltip position.\n offset: [0, 0],\n // @option direction: String = 'auto'\n // Direction where to open the tooltip. Possible values are: `right`, `left`,\n // `top`, `bottom`, `center`, `auto`.\n // `auto` will dynamically switch between `right` and `left` according to the tooltip\n // position on the map.\n direction: 'auto',\n // @option permanent: Boolean = false\n // Whether to open the tooltip permanently or only on mouseover.\n permanent: false,\n // @option sticky: Boolean = false\n // If true, the tooltip will follow the mouse instead of being fixed at the feature center.\n sticky: false,\n // @option interactive: Boolean = false\n // If true, the tooltip will listen to the feature events.\n interactive: false,\n // @option opacity: Number = 0.9\n // Tooltip container opacity.\n opacity: 0.9\n },\n onAdd: function (map) {\n DivOverlay.prototype.onAdd.call(this, map);\n this.setOpacity(this.options.opacity); // @namespace Map\n // @section Tooltip events\n // @event tooltipopen: TooltipEvent\n // Fired when a tooltip is opened in the map.\n\n map.fire('tooltipopen', {\n tooltip: this\n });\n\n if (this._source) {\n // @namespace Layer\n // @section Tooltip events\n // @event tooltipopen: TooltipEvent\n // Fired when a tooltip bound to this layer is opened.\n this._source.fire('tooltipopen', {\n tooltip: this\n }, true);\n }\n },\n onRemove: function (map) {\n DivOverlay.prototype.onRemove.call(this, map); // @namespace Map\n // @section Tooltip events\n // @event tooltipclose: TooltipEvent\n // Fired when a tooltip in the map is closed.\n\n map.fire('tooltipclose', {\n tooltip: this\n });\n\n if (this._source) {\n // @namespace Layer\n // @section Tooltip events\n // @event tooltipclose: TooltipEvent\n // Fired when a tooltip bound to this layer is closed.\n this._source.fire('tooltipclose', {\n tooltip: this\n }, true);\n }\n },\n getEvents: function () {\n var events = DivOverlay.prototype.getEvents.call(this);\n\n if (touch && !this.options.permanent) {\n events.preclick = this._close;\n }\n\n return events;\n },\n _close: function () {\n if (this._map) {\n this._map.closeTooltip(this);\n }\n },\n _initLayout: function () {\n var prefix = 'leaflet-tooltip',\n className = prefix + ' ' + (this.options.className || '') + ' leaflet-zoom-' + (this._zoomAnimated ? 'animated' : 'hide');\n this._contentNode = this._container = create$1('div', className);\n },\n _updateLayout: function () {},\n _adjustPan: function () {},\n _setPosition: function (pos) {\n var map = this._map,\n container = this._container,\n centerPoint = map.latLngToContainerPoint(map.getCenter()),\n tooltipPoint = map.layerPointToContainerPoint(pos),\n direction = this.options.direction,\n tooltipWidth = container.offsetWidth,\n tooltipHeight = container.offsetHeight,\n offset = toPoint(this.options.offset),\n anchor = this._getAnchor();\n\n if (direction === 'top') {\n pos = pos.add(toPoint(-tooltipWidth / 2 + offset.x, -tooltipHeight + offset.y + anchor.y, true));\n } else if (direction === 'bottom') {\n pos = pos.subtract(toPoint(tooltipWidth / 2 - offset.x, -offset.y, true));\n } else if (direction === 'center') {\n pos = pos.subtract(toPoint(tooltipWidth / 2 + offset.x, tooltipHeight / 2 - anchor.y + offset.y, true));\n } else if (direction === 'right' || direction === 'auto' && tooltipPoint.x < centerPoint.x) {\n direction = 'right';\n pos = pos.add(toPoint(offset.x + anchor.x, anchor.y - tooltipHeight / 2 + offset.y, true));\n } else {\n direction = 'left';\n pos = pos.subtract(toPoint(tooltipWidth + anchor.x - offset.x, tooltipHeight / 2 - anchor.y - offset.y, true));\n }\n\n removeClass(container, 'leaflet-tooltip-right');\n removeClass(container, 'leaflet-tooltip-left');\n removeClass(container, 'leaflet-tooltip-top');\n removeClass(container, 'leaflet-tooltip-bottom');\n addClass(container, 'leaflet-tooltip-' + direction);\n setPosition(container, pos);\n },\n _updatePosition: function () {\n var pos = this._map.latLngToLayerPoint(this._latlng);\n\n this._setPosition(pos);\n },\n setOpacity: function (opacity) {\n this.options.opacity = opacity;\n\n if (this._container) {\n setOpacity(this._container, opacity);\n }\n },\n _animateZoom: function (e) {\n var pos = this._map._latLngToNewLayerPoint(this._latlng, e.zoom, e.center);\n\n this._setPosition(pos);\n },\n _getAnchor: function () {\n // Where should we anchor the tooltip on the source layer?\n return toPoint(this._source && this._source._getTooltipAnchor && !this.options.sticky ? this._source._getTooltipAnchor() : [0, 0]);\n }\n }); // @namespace Tooltip\n // @factory L.tooltip(options?: Tooltip options, source?: Layer)\n // Instantiates a Tooltip object given an optional `options` object that describes its appearance and location and an optional `source` object that is used to tag the tooltip with a reference to the Layer to which it refers.\n\n var tooltip = function (options, source) {\n return new Tooltip(options, source);\n }; // @namespace Map\n // @section Methods for Layers and Controls\n\n\n Map.include({\n // @method openTooltip(tooltip: Tooltip): this\n // Opens the specified tooltip.\n // @alternative\n // @method openTooltip(content: String|HTMLElement, latlng: LatLng, options?: Tooltip options): this\n // Creates a tooltip with the specified content and options and open it.\n openTooltip: function (tooltip, latlng, options) {\n if (!(tooltip instanceof Tooltip)) {\n tooltip = new Tooltip(options).setContent(tooltip);\n }\n\n if (latlng) {\n tooltip.setLatLng(latlng);\n }\n\n if (this.hasLayer(tooltip)) {\n return this;\n }\n\n return this.addLayer(tooltip);\n },\n // @method closeTooltip(tooltip?: Tooltip): this\n // Closes the tooltip given as parameter.\n closeTooltip: function (tooltip) {\n if (tooltip) {\n this.removeLayer(tooltip);\n }\n\n return this;\n }\n });\n /*\n * @namespace Layer\n * @section Tooltip methods example\n *\n * All layers share a set of methods convenient for binding tooltips to it.\n *\n * ```js\n * var layer = L.Polygon(latlngs).bindTooltip('Hi There!').addTo(map);\n * layer.openTooltip();\n * layer.closeTooltip();\n * ```\n */\n // @section Tooltip methods\n\n Layer.include({\n // @method bindTooltip(content: String|HTMLElement|Function|Tooltip, options?: Tooltip options): this\n // Binds a tooltip to the layer with the passed `content` and sets up the\n // necessary event listeners. If a `Function` is passed it will receive\n // the layer as the first argument and should return a `String` or `HTMLElement`.\n bindTooltip: function (content, options) {\n if (content instanceof Tooltip) {\n setOptions(content, options);\n this._tooltip = content;\n content._source = this;\n } else {\n if (!this._tooltip || options) {\n this._tooltip = new Tooltip(options, this);\n }\n\n this._tooltip.setContent(content);\n }\n\n this._initTooltipInteractions();\n\n if (this._tooltip.options.permanent && this._map && this._map.hasLayer(this)) {\n this.openTooltip();\n }\n\n return this;\n },\n // @method unbindTooltip(): this\n // Removes the tooltip previously bound with `bindTooltip`.\n unbindTooltip: function () {\n if (this._tooltip) {\n this._initTooltipInteractions(true);\n\n this.closeTooltip();\n this._tooltip = null;\n }\n\n return this;\n },\n _initTooltipInteractions: function (remove$$1) {\n if (!remove$$1 && this._tooltipHandlersAdded) {\n return;\n }\n\n var onOff = remove$$1 ? 'off' : 'on',\n events = {\n remove: this.closeTooltip,\n move: this._moveTooltip\n };\n\n if (!this._tooltip.options.permanent) {\n events.mouseover = this._openTooltip;\n events.mouseout = this.closeTooltip;\n\n if (this._tooltip.options.sticky) {\n events.mousemove = this._moveTooltip;\n }\n\n if (touch) {\n events.click = this._openTooltip;\n }\n } else {\n events.add = this._openTooltip;\n }\n\n this[onOff](events);\n this._tooltipHandlersAdded = !remove$$1;\n },\n // @method openTooltip(latlng?: LatLng): this\n // Opens the bound tooltip at the specified `latlng` or at the default tooltip anchor if no `latlng` is passed.\n openTooltip: function (layer, latlng) {\n if (!(layer instanceof Layer)) {\n latlng = layer;\n layer = this;\n }\n\n if (layer instanceof FeatureGroup) {\n for (var id in this._layers) {\n layer = this._layers[id];\n break;\n }\n }\n\n if (!latlng) {\n latlng = layer.getCenter ? layer.getCenter() : layer.getLatLng();\n }\n\n if (this._tooltip && this._map) {\n // set tooltip source to this layer\n this._tooltip._source = layer; // update the tooltip (content, layout, ect...)\n\n this._tooltip.update(); // open the tooltip on the map\n\n\n this._map.openTooltip(this._tooltip, latlng); // Tooltip container may not be defined if not permanent and never\n // opened.\n\n\n if (this._tooltip.options.interactive && this._tooltip._container) {\n addClass(this._tooltip._container, 'leaflet-clickable');\n this.addInteractiveTarget(this._tooltip._container);\n }\n }\n\n return this;\n },\n // @method closeTooltip(): this\n // Closes the tooltip bound to this layer if it is open.\n closeTooltip: function () {\n if (this._tooltip) {\n this._tooltip._close();\n\n if (this._tooltip.options.interactive && this._tooltip._container) {\n removeClass(this._tooltip._container, 'leaflet-clickable');\n this.removeInteractiveTarget(this._tooltip._container);\n }\n }\n\n return this;\n },\n // @method toggleTooltip(): this\n // Opens or closes the tooltip bound to this layer depending on its current state.\n toggleTooltip: function (target) {\n if (this._tooltip) {\n if (this._tooltip._map) {\n this.closeTooltip();\n } else {\n this.openTooltip(target);\n }\n }\n\n return this;\n },\n // @method isTooltipOpen(): boolean\n // Returns `true` if the tooltip bound to this layer is currently open.\n isTooltipOpen: function () {\n return this._tooltip.isOpen();\n },\n // @method setTooltipContent(content: String|HTMLElement|Tooltip): this\n // Sets the content of the tooltip bound to this layer.\n setTooltipContent: function (content) {\n if (this._tooltip) {\n this._tooltip.setContent(content);\n }\n\n return this;\n },\n // @method getTooltip(): Tooltip\n // Returns the tooltip bound to this layer.\n getTooltip: function () {\n return this._tooltip;\n },\n _openTooltip: function (e) {\n var layer = e.layer || e.target;\n\n if (!this._tooltip || !this._map) {\n return;\n }\n\n this.openTooltip(layer, this._tooltip.options.sticky ? e.latlng : undefined);\n },\n _moveTooltip: function (e) {\n var latlng = e.latlng,\n containerPoint,\n layerPoint;\n\n if (this._tooltip.options.sticky && e.originalEvent) {\n containerPoint = this._map.mouseEventToContainerPoint(e.originalEvent);\n layerPoint = this._map.containerPointToLayerPoint(containerPoint);\n latlng = this._map.layerPointToLatLng(layerPoint);\n }\n\n this._tooltip.setLatLng(latlng);\n }\n });\n /*\n * @class DivIcon\n * @aka L.DivIcon\n * @inherits Icon\n *\n * Represents a lightweight icon for markers that uses a simple `<div>`\n * element instead of an image. Inherits from `Icon` but ignores the `iconUrl` and shadow options.\n *\n * @example\n * ```js\n * var myIcon = L.divIcon({className: 'my-div-icon'});\n * // you can set .my-div-icon styles in CSS\n *\n * L.marker([50.505, 30.57], {icon: myIcon}).addTo(map);\n * ```\n *\n * By default, it has a 'leaflet-div-icon' CSS class and is styled as a little white square with a shadow.\n */\n\n var DivIcon = Icon.extend({\n options: {\n // @section\n // @aka DivIcon options\n iconSize: [12, 12],\n // also can be set through CSS\n // iconAnchor: (Point),\n // popupAnchor: (Point),\n // @option html: String = ''\n // Custom HTML code to put inside the div element, empty by default.\n html: false,\n // @option bgPos: Point = [0, 0]\n // Optional relative position of the background, in pixels\n bgPos: null,\n className: 'leaflet-div-icon'\n },\n createIcon: function (oldIcon) {\n var div = oldIcon && oldIcon.tagName === 'DIV' ? oldIcon : document.createElement('div'),\n options = this.options;\n div.innerHTML = options.html !== false ? options.html : '';\n\n if (options.bgPos) {\n var bgPos = toPoint(options.bgPos);\n div.style.backgroundPosition = -bgPos.x + 'px ' + -bgPos.y + 'px';\n }\n\n this._setIconStyles(div, 'icon');\n\n return div;\n },\n createShadow: function () {\n return null;\n }\n }); // @factory L.divIcon(options: DivIcon options)\n // Creates a `DivIcon` instance with the given options.\n\n function divIcon(options) {\n return new DivIcon(options);\n }\n\n Icon.Default = IconDefault;\n /*\n * @class GridLayer\n * @inherits Layer\n * @aka L.GridLayer\n *\n * Generic class for handling a tiled grid of HTML elements. This is the base class for all tile layers and replaces `TileLayer.Canvas`.\n * GridLayer can be extended to create a tiled grid of HTML elements like `<canvas>`, `<img>` or `<div>`. GridLayer will handle creating and animating these DOM elements for you.\n *\n *\n * @section Synchronous usage\n * @example\n *\n * To create a custom layer, extend GridLayer and implement the `createTile()` method, which will be passed a `Point` object with the `x`, `y`, and `z` (zoom level) coordinates to draw your tile.\n *\n * ```js\n * var CanvasLayer = L.GridLayer.extend({\n * createTile: function(coords){\n * // create a <canvas> element for drawing\n * var tile = L.DomUtil.create('canvas', 'leaflet-tile');\n *\n * // setup tile width and height according to the options\n * var size = this.getTileSize();\n * tile.width = size.x;\n * tile.height = size.y;\n *\n * // get a canvas context and draw something on it using coords.x, coords.y and coords.z\n * var ctx = tile.getContext('2d');\n *\n * // return the tile so it can be rendered on screen\n * return tile;\n * }\n * });\n * ```\n *\n * @section Asynchronous usage\n * @example\n *\n * Tile creation can also be asynchronous, this is useful when using a third-party drawing library. Once the tile is finished drawing it can be passed to the `done()` callback.\n *\n * ```js\n * var CanvasLayer = L.GridLayer.extend({\n * createTile: function(coords, done){\n * var error;\n *\n * // create a <canvas> element for drawing\n * var tile = L.DomUtil.create('canvas', 'leaflet-tile');\n *\n * // setup tile width and height according to the options\n * var size = this.getTileSize();\n * tile.width = size.x;\n * tile.height = size.y;\n *\n * // draw something asynchronously and pass the tile to the done() callback\n * setTimeout(function() {\n * done(error, tile);\n * }, 1000);\n *\n * return tile;\n * }\n * });\n * ```\n *\n * @section\n */\n\n var GridLayer = Layer.extend({\n // @section\n // @aka GridLayer options\n options: {\n // @option tileSize: Number|Point = 256\n // Width and height of tiles in the grid. Use a number if width and height are equal, or `L.point(width, height)` otherwise.\n tileSize: 256,\n // @option opacity: Number = 1.0\n // Opacity of the tiles. Can be used in the `createTile()` function.\n opacity: 1,\n // @option updateWhenIdle: Boolean = (depends)\n // Load new tiles only when panning ends.\n // `true` by default on mobile browsers, in order to avoid too many requests and keep smooth navigation.\n // `false` otherwise in order to display new tiles _during_ panning, since it is easy to pan outside the\n // [`keepBuffer`](#gridlayer-keepbuffer) option in desktop browsers.\n updateWhenIdle: mobile,\n // @option updateWhenZooming: Boolean = true\n // By default, a smooth zoom animation (during a [touch zoom](#map-touchzoom) or a [`flyTo()`](#map-flyto)) will update grid layers every integer zoom level. Setting this option to `false` will update the grid layer only when the smooth animation ends.\n updateWhenZooming: true,\n // @option updateInterval: Number = 200\n // Tiles will not update more than once every `updateInterval` milliseconds when panning.\n updateInterval: 200,\n // @option zIndex: Number = 1\n // The explicit zIndex of the tile layer.\n zIndex: 1,\n // @option bounds: LatLngBounds = undefined\n // If set, tiles will only be loaded inside the set `LatLngBounds`.\n bounds: null,\n // @option minZoom: Number = 0\n // The minimum zoom level down to which this layer will be displayed (inclusive).\n minZoom: 0,\n // @option maxZoom: Number = undefined\n // The maximum zoom level up to which this layer will be displayed (inclusive).\n maxZoom: undefined,\n // @option maxNativeZoom: Number = undefined\n // Maximum zoom number the tile source has available. If it is specified,\n // the tiles on all zoom levels higher than `maxNativeZoom` will be loaded\n // from `maxNativeZoom` level and auto-scaled.\n maxNativeZoom: undefined,\n // @option minNativeZoom: Number = undefined\n // Minimum zoom number the tile source has available. If it is specified,\n // the tiles on all zoom levels lower than `minNativeZoom` will be loaded\n // from `minNativeZoom` level and auto-scaled.\n minNativeZoom: undefined,\n // @option noWrap: Boolean = false\n // Whether the layer is wrapped around the antimeridian. If `true`, the\n // GridLayer will only be displayed once at low zoom levels. Has no\n // effect when the [map CRS](#map-crs) doesn't wrap around. Can be used\n // in combination with [`bounds`](#gridlayer-bounds) to prevent requesting\n // tiles outside the CRS limits.\n noWrap: false,\n // @option pane: String = 'tilePane'\n // `Map pane` where the grid layer will be added.\n pane: 'tilePane',\n // @option className: String = ''\n // A custom class name to assign to the tile layer. Empty by default.\n className: '',\n // @option keepBuffer: Number = 2\n // When panning the map, keep this many rows and columns of tiles before unloading them.\n keepBuffer: 2\n },\n initialize: function (options) {\n setOptions(this, options);\n },\n onAdd: function () {\n this._initContainer();\n\n this._levels = {};\n this._tiles = {};\n\n this._resetView();\n\n this._update();\n },\n beforeAdd: function (map) {\n map._addZoomLimit(this);\n },\n onRemove: function (map) {\n this._removeAllTiles();\n\n remove(this._container);\n\n map._removeZoomLimit(this);\n\n this._container = null;\n this._tileZoom = undefined;\n },\n // @method bringToFront: this\n // Brings the tile layer to the top of all tile layers.\n bringToFront: function () {\n if (this._map) {\n toFront(this._container);\n\n this._setAutoZIndex(Math.max);\n }\n\n return this;\n },\n // @method bringToBack: this\n // Brings the tile layer to the bottom of all tile layers.\n bringToBack: function () {\n if (this._map) {\n toBack(this._container);\n\n this._setAutoZIndex(Math.min);\n }\n\n return this;\n },\n // @method getContainer: HTMLElement\n // Returns the HTML element that contains the tiles for this layer.\n getContainer: function () {\n return this._container;\n },\n // @method setOpacity(opacity: Number): this\n // Changes the [opacity](#gridlayer-opacity) of the grid layer.\n setOpacity: function (opacity) {\n this.options.opacity = opacity;\n\n this._updateOpacity();\n\n return this;\n },\n // @method setZIndex(zIndex: Number): this\n // Changes the [zIndex](#gridlayer-zindex) of the grid layer.\n setZIndex: function (zIndex) {\n this.options.zIndex = zIndex;\n\n this._updateZIndex();\n\n return this;\n },\n // @method isLoading: Boolean\n // Returns `true` if any tile in the grid layer has not finished loading.\n isLoading: function () {\n return this._loading;\n },\n // @method redraw: this\n // Causes the layer to clear all the tiles and request them again.\n redraw: function () {\n if (this._map) {\n this._removeAllTiles();\n\n this._update();\n }\n\n return this;\n },\n getEvents: function () {\n var events = {\n viewprereset: this._invalidateAll,\n viewreset: this._resetView,\n zoom: this._resetView,\n moveend: this._onMoveEnd\n };\n\n if (!this.options.updateWhenIdle) {\n // update tiles on move, but not more often than once per given interval\n if (!this._onMove) {\n this._onMove = throttle(this._onMoveEnd, this.options.updateInterval, this);\n }\n\n events.move = this._onMove;\n }\n\n if (this._zoomAnimated) {\n events.zoomanim = this._animateZoom;\n }\n\n return events;\n },\n // @section Extension methods\n // Layers extending `GridLayer` shall reimplement the following method.\n // @method createTile(coords: Object, done?: Function): HTMLElement\n // Called only internally, must be overridden by classes extending `GridLayer`.\n // Returns the `HTMLElement` corresponding to the given `coords`. If the `done` callback\n // is specified, it must be called when the tile has finished loading and drawing.\n createTile: function () {\n return document.createElement('div');\n },\n // @section\n // @method getTileSize: Point\n // Normalizes the [tileSize option](#gridlayer-tilesize) into a point. Used by the `createTile()` method.\n getTileSize: function () {\n var s = this.options.tileSize;\n return s instanceof Point ? s : new Point(s, s);\n },\n _updateZIndex: function () {\n if (this._container && this.options.zIndex !== undefined && this.options.zIndex !== null) {\n this._container.style.zIndex = this.options.zIndex;\n }\n },\n _setAutoZIndex: function (compare) {\n // go through all other layers of the same pane, set zIndex to max + 1 (front) or min - 1 (back)\n var layers = this.getPane().children,\n edgeZIndex = -compare(-Infinity, Infinity); // -Infinity for max, Infinity for min\n\n for (var i = 0, len = layers.length, zIndex; i < len; i++) {\n zIndex = layers[i].style.zIndex;\n\n if (layers[i] !== this._container && zIndex) {\n edgeZIndex = compare(edgeZIndex, +zIndex);\n }\n }\n\n if (isFinite(edgeZIndex)) {\n this.options.zIndex = edgeZIndex + compare(-1, 1);\n\n this._updateZIndex();\n }\n },\n _updateOpacity: function () {\n if (!this._map) {\n return;\n } // IE doesn't inherit filter opacity properly, so we're forced to set it on tiles\n\n\n if (ielt9) {\n return;\n }\n\n setOpacity(this._container, this.options.opacity);\n var now = +new Date(),\n nextFrame = false,\n willPrune = false;\n\n for (var key in this._tiles) {\n var tile = this._tiles[key];\n\n if (!tile.current || !tile.loaded) {\n continue;\n }\n\n var fade = Math.min(1, (now - tile.loaded) / 200);\n setOpacity(tile.el, fade);\n\n if (fade < 1) {\n nextFrame = true;\n } else {\n if (tile.active) {\n willPrune = true;\n } else {\n this._onOpaqueTile(tile);\n }\n\n tile.active = true;\n }\n }\n\n if (willPrune && !this._noPrune) {\n this._pruneTiles();\n }\n\n if (nextFrame) {\n cancelAnimFrame(this._fadeFrame);\n this._fadeFrame = requestAnimFrame(this._updateOpacity, this);\n }\n },\n _onOpaqueTile: falseFn,\n _initContainer: function () {\n if (this._container) {\n return;\n }\n\n this._container = create$1('div', 'leaflet-layer ' + (this.options.className || ''));\n\n this._updateZIndex();\n\n if (this.options.opacity < 1) {\n this._updateOpacity();\n }\n\n this.getPane().appendChild(this._container);\n },\n _updateLevels: function () {\n var zoom = this._tileZoom,\n maxZoom = this.options.maxZoom;\n\n if (zoom === undefined) {\n return undefined;\n }\n\n for (var z in this._levels) {\n if (this._levels[z].el.children.length || z === zoom) {\n this._levels[z].el.style.zIndex = maxZoom - Math.abs(zoom - z);\n\n this._onUpdateLevel(z);\n } else {\n remove(this._levels[z].el);\n\n this._removeTilesAtZoom(z);\n\n this._onRemoveLevel(z);\n\n delete this._levels[z];\n }\n }\n\n var level = this._levels[zoom],\n map = this._map;\n\n if (!level) {\n level = this._levels[zoom] = {};\n level.el = create$1('div', 'leaflet-tile-container leaflet-zoom-animated', this._container);\n level.el.style.zIndex = maxZoom;\n level.origin = map.project(map.unproject(map.getPixelOrigin()), zoom).round();\n level.zoom = zoom;\n\n this._setZoomTransform(level, map.getCenter(), map.getZoom()); // force the browser to consider the newly added element for transition\n\n\n falseFn(level.el.offsetWidth);\n\n this._onCreateLevel(level);\n }\n\n this._level = level;\n return level;\n },\n _onUpdateLevel: falseFn,\n _onRemoveLevel: falseFn,\n _onCreateLevel: falseFn,\n _pruneTiles: function () {\n if (!this._map) {\n return;\n }\n\n var key, tile;\n\n var zoom = this._map.getZoom();\n\n if (zoom > this.options.maxZoom || zoom < this.options.minZoom) {\n this._removeAllTiles();\n\n return;\n }\n\n for (key in this._tiles) {\n tile = this._tiles[key];\n tile.retain = tile.current;\n }\n\n for (key in this._tiles) {\n tile = this._tiles[key];\n\n if (tile.current && !tile.active) {\n var coords = tile.coords;\n\n if (!this._retainParent(coords.x, coords.y, coords.z, coords.z - 5)) {\n this._retainChildren(coords.x, coords.y, coords.z, coords.z + 2);\n }\n }\n }\n\n for (key in this._tiles) {\n if (!this._tiles[key].retain) {\n this._removeTile(key);\n }\n }\n },\n _removeTilesAtZoom: function (zoom) {\n for (var key in this._tiles) {\n if (this._tiles[key].coords.z !== zoom) {\n continue;\n }\n\n this._removeTile(key);\n }\n },\n _removeAllTiles: function () {\n for (var key in this._tiles) {\n this._removeTile(key);\n }\n },\n _invalidateAll: function () {\n for (var z in this._levels) {\n remove(this._levels[z].el);\n\n this._onRemoveLevel(z);\n\n delete this._levels[z];\n }\n\n this._removeAllTiles();\n\n this._tileZoom = undefined;\n },\n _retainParent: function (x, y, z, minZoom) {\n var x2 = Math.floor(x / 2),\n y2 = Math.floor(y / 2),\n z2 = z - 1,\n coords2 = new Point(+x2, +y2);\n coords2.z = +z2;\n\n var key = this._tileCoordsToKey(coords2),\n tile = this._tiles[key];\n\n if (tile && tile.active) {\n tile.retain = true;\n return true;\n } else if (tile && tile.loaded) {\n tile.retain = true;\n }\n\n if (z2 > minZoom) {\n return this._retainParent(x2, y2, z2, minZoom);\n }\n\n return false;\n },\n _retainChildren: function (x, y, z, maxZoom) {\n for (var i = 2 * x; i < 2 * x + 2; i++) {\n for (var j = 2 * y; j < 2 * y + 2; j++) {\n var coords = new Point(i, j);\n coords.z = z + 1;\n\n var key = this._tileCoordsToKey(coords),\n tile = this._tiles[key];\n\n if (tile && tile.active) {\n tile.retain = true;\n continue;\n } else if (tile && tile.loaded) {\n tile.retain = true;\n }\n\n if (z + 1 < maxZoom) {\n this._retainChildren(i, j, z + 1, maxZoom);\n }\n }\n }\n },\n _resetView: function (e) {\n var animating = e && (e.pinch || e.flyTo);\n\n this._setView(this._map.getCenter(), this._map.getZoom(), animating, animating);\n },\n _animateZoom: function (e) {\n this._setView(e.center, e.zoom, true, e.noUpdate);\n },\n _clampZoom: function (zoom) {\n var options = this.options;\n\n if (undefined !== options.minNativeZoom && zoom < options.minNativeZoom) {\n return options.minNativeZoom;\n }\n\n if (undefined !== options.maxNativeZoom && options.maxNativeZoom < zoom) {\n return options.maxNativeZoom;\n }\n\n return zoom;\n },\n _setView: function (center, zoom, noPrune, noUpdate) {\n var tileZoom = this._clampZoom(Math.round(zoom));\n\n if (this.options.maxZoom !== undefined && tileZoom > this.options.maxZoom || this.options.minZoom !== undefined && tileZoom < this.options.minZoom) {\n tileZoom = undefined;\n }\n\n var tileZoomChanged = this.options.updateWhenZooming && tileZoom !== this._tileZoom;\n\n if (!noUpdate || tileZoomChanged) {\n this._tileZoom = tileZoom;\n\n if (this._abortLoading) {\n this._abortLoading();\n }\n\n this._updateLevels();\n\n this._resetGrid();\n\n if (tileZoom !== undefined) {\n this._update(center);\n }\n\n if (!noPrune) {\n this._pruneTiles();\n } // Flag to prevent _updateOpacity from pruning tiles during\n // a zoom anim or a pinch gesture\n\n\n this._noPrune = !!noPrune;\n }\n\n this._setZoomTransforms(center, zoom);\n },\n _setZoomTransforms: function (center, zoom) {\n for (var i in this._levels) {\n this._setZoomTransform(this._levels[i], center, zoom);\n }\n },\n _setZoomTransform: function (level, center, zoom) {\n var scale = this._map.getZoomScale(zoom, level.zoom),\n translate = level.origin.multiplyBy(scale).subtract(this._map._getNewPixelOrigin(center, zoom)).round();\n\n if (any3d) {\n setTransform(level.el, translate, scale);\n } else {\n setPosition(level.el, translate);\n }\n },\n _resetGrid: function () {\n var map = this._map,\n crs = map.options.crs,\n tileSize = this._tileSize = this.getTileSize(),\n tileZoom = this._tileZoom;\n\n var bounds = this._map.getPixelWorldBounds(this._tileZoom);\n\n if (bounds) {\n this._globalTileRange = this._pxBoundsToTileRange(bounds);\n }\n\n this._wrapX = crs.wrapLng && !this.options.noWrap && [Math.floor(map.project([0, crs.wrapLng[0]], tileZoom).x / tileSize.x), Math.ceil(map.project([0, crs.wrapLng[1]], tileZoom).x / tileSize.y)];\n this._wrapY = crs.wrapLat && !this.options.noWrap && [Math.floor(map.project([crs.wrapLat[0], 0], tileZoom).y / tileSize.x), Math.ceil(map.project([crs.wrapLat[1], 0], tileZoom).y / tileSize.y)];\n },\n _onMoveEnd: function () {\n if (!this._map || this._map._animatingZoom) {\n return;\n }\n\n this._update();\n },\n _getTiledPixelBounds: function (center) {\n var map = this._map,\n mapZoom = map._animatingZoom ? Math.max(map._animateToZoom, map.getZoom()) : map.getZoom(),\n scale = map.getZoomScale(mapZoom, this._tileZoom),\n pixelCenter = map.project(center, this._tileZoom).floor(),\n halfSize = map.getSize().divideBy(scale * 2);\n return new Bounds(pixelCenter.subtract(halfSize), pixelCenter.add(halfSize));\n },\n // Private method to load tiles in the grid's active zoom level according to map bounds\n _update: function (center) {\n var map = this._map;\n\n if (!map) {\n return;\n }\n\n var zoom = this._clampZoom(map.getZoom());\n\n if (center === undefined) {\n center = map.getCenter();\n }\n\n if (this._tileZoom === undefined) {\n return;\n } // if out of minzoom/maxzoom\n\n\n var pixelBounds = this._getTiledPixelBounds(center),\n tileRange = this._pxBoundsToTileRange(pixelBounds),\n tileCenter = tileRange.getCenter(),\n queue = [],\n margin = this.options.keepBuffer,\n noPruneRange = new Bounds(tileRange.getBottomLeft().subtract([margin, -margin]), tileRange.getTopRight().add([margin, -margin])); // Sanity check: panic if the tile range contains Infinity somewhere.\n\n\n if (!(isFinite(tileRange.min.x) && isFinite(tileRange.min.y) && isFinite(tileRange.max.x) && isFinite(tileRange.max.y))) {\n throw new Error('Attempted to load an infinite number of tiles');\n }\n\n for (var key in this._tiles) {\n var c = this._tiles[key].coords;\n\n if (c.z !== this._tileZoom || !noPruneRange.contains(new Point(c.x, c.y))) {\n this._tiles[key].current = false;\n }\n } // _update just loads more tiles. If the tile zoom level differs too much\n // from the map's, let _setView reset levels and prune old tiles.\n\n\n if (Math.abs(zoom - this._tileZoom) > 1) {\n this._setView(center, zoom);\n\n return;\n } // create a queue of coordinates to load tiles from\n\n\n for (var j = tileRange.min.y; j <= tileRange.max.y; j++) {\n for (var i = tileRange.min.x; i <= tileRange.max.x; i++) {\n var coords = new Point(i, j);\n coords.z = this._tileZoom;\n\n if (!this._isValidTile(coords)) {\n continue;\n }\n\n var tile = this._tiles[this._tileCoordsToKey(coords)];\n\n if (tile) {\n tile.current = true;\n } else {\n queue.push(coords);\n }\n }\n } // sort tile queue to load tiles in order of their distance to center\n\n\n queue.sort(function (a, b) {\n return a.distanceTo(tileCenter) - b.distanceTo(tileCenter);\n });\n\n if (queue.length !== 0) {\n // if it's the first batch of tiles to load\n if (!this._loading) {\n this._loading = true; // @event loading: Event\n // Fired when the grid layer starts loading tiles.\n\n this.fire('loading');\n } // create DOM fragment to append tiles in one batch\n\n\n var fragment = document.createDocumentFragment();\n\n for (i = 0; i < queue.length; i++) {\n this._addTile(queue[i], fragment);\n }\n\n this._level.el.appendChild(fragment);\n }\n },\n _isValidTile: function (coords) {\n var crs = this._map.options.crs;\n\n if (!crs.infinite) {\n // don't load tile if it's out of bounds and not wrapped\n var bounds = this._globalTileRange;\n\n if (!crs.wrapLng && (coords.x < bounds.min.x || coords.x > bounds.max.x) || !crs.wrapLat && (coords.y < bounds.min.y || coords.y > bounds.max.y)) {\n return false;\n }\n }\n\n if (!this.options.bounds) {\n return true;\n } // don't load tile if it doesn't intersect the bounds in options\n\n\n var tileBounds = this._tileCoordsToBounds(coords);\n\n return toLatLngBounds(this.options.bounds).overlaps(tileBounds);\n },\n _keyToBounds: function (key) {\n return this._tileCoordsToBounds(this._keyToTileCoords(key));\n },\n _tileCoordsToNwSe: function (coords) {\n var map = this._map,\n tileSize = this.getTileSize(),\n nwPoint = coords.scaleBy(tileSize),\n sePoint = nwPoint.add(tileSize),\n nw = map.unproject(nwPoint, coords.z),\n se = map.unproject(sePoint, coords.z);\n return [nw, se];\n },\n // converts tile coordinates to its geographical bounds\n _tileCoordsToBounds: function (coords) {\n var bp = this._tileCoordsToNwSe(coords),\n bounds = new LatLngBounds(bp[0], bp[1]);\n\n if (!this.options.noWrap) {\n bounds = this._map.wrapLatLngBounds(bounds);\n }\n\n return bounds;\n },\n // converts tile coordinates to key for the tile cache\n _tileCoordsToKey: function (coords) {\n return coords.x + ':' + coords.y + ':' + coords.z;\n },\n // converts tile cache key to coordinates\n _keyToTileCoords: function (key) {\n var k = key.split(':'),\n coords = new Point(+k[0], +k[1]);\n coords.z = +k[2];\n return coords;\n },\n _removeTile: function (key) {\n var tile = this._tiles[key];\n\n if (!tile) {\n return;\n }\n\n remove(tile.el);\n delete this._tiles[key]; // @event tileunload: TileEvent\n // Fired when a tile is removed (e.g. when a tile goes off the screen).\n\n this.fire('tileunload', {\n tile: tile.el,\n coords: this._keyToTileCoords(key)\n });\n },\n _initTile: function (tile) {\n addClass(tile, 'leaflet-tile');\n var tileSize = this.getTileSize();\n tile.style.width = tileSize.x + 'px';\n tile.style.height = tileSize.y + 'px';\n tile.onselectstart = falseFn;\n tile.onmousemove = falseFn; // update opacity on tiles in IE7-8 because of filter inheritance problems\n\n if (ielt9 && this.options.opacity < 1) {\n setOpacity(tile, this.options.opacity);\n } // without this hack, tiles disappear after zoom on Chrome for Android\n // https://github.com/Leaflet/Leaflet/issues/2078\n\n\n if (android && !android23) {\n tile.style.WebkitBackfaceVisibility = 'hidden';\n }\n },\n _addTile: function (coords, container) {\n var tilePos = this._getTilePos(coords),\n key = this._tileCoordsToKey(coords);\n\n var tile = this.createTile(this._wrapCoords(coords), bind(this._tileReady, this, coords));\n\n this._initTile(tile); // if createTile is defined with a second argument (\"done\" callback),\n // we know that tile is async and will be ready later; otherwise\n\n\n if (this.createTile.length < 2) {\n // mark tile as ready, but delay one frame for opacity animation to happen\n requestAnimFrame(bind(this._tileReady, this, coords, null, tile));\n }\n\n setPosition(tile, tilePos); // save tile in cache\n\n this._tiles[key] = {\n el: tile,\n coords: coords,\n current: true\n };\n container.appendChild(tile); // @event tileloadstart: TileEvent\n // Fired when a tile is requested and starts loading.\n\n this.fire('tileloadstart', {\n tile: tile,\n coords: coords\n });\n },\n _tileReady: function (coords, err, tile) {\n if (err) {\n // @event tileerror: TileErrorEvent\n // Fired when there is an error loading a tile.\n this.fire('tileerror', {\n error: err,\n tile: tile,\n coords: coords\n });\n }\n\n var key = this._tileCoordsToKey(coords);\n\n tile = this._tiles[key];\n\n if (!tile) {\n return;\n }\n\n tile.loaded = +new Date();\n\n if (this._map._fadeAnimated) {\n setOpacity(tile.el, 0);\n cancelAnimFrame(this._fadeFrame);\n this._fadeFrame = requestAnimFrame(this._updateOpacity, this);\n } else {\n tile.active = true;\n\n this._pruneTiles();\n }\n\n if (!err) {\n addClass(tile.el, 'leaflet-tile-loaded'); // @event tileload: TileEvent\n // Fired when a tile loads.\n\n this.fire('tileload', {\n tile: tile.el,\n coords: coords\n });\n }\n\n if (this._noTilesToLoad()) {\n this._loading = false; // @event load: Event\n // Fired when the grid layer loaded all visible tiles.\n\n this.fire('load');\n\n if (ielt9 || !this._map._fadeAnimated) {\n requestAnimFrame(this._pruneTiles, this);\n } else {\n // Wait a bit more than 0.2 secs (the duration of the tile fade-in)\n // to trigger a pruning.\n setTimeout(bind(this._pruneTiles, this), 250);\n }\n }\n },\n _getTilePos: function (coords) {\n return coords.scaleBy(this.getTileSize()).subtract(this._level.origin);\n },\n _wrapCoords: function (coords) {\n var newCoords = new Point(this._wrapX ? wrapNum(coords.x, this._wrapX) : coords.x, this._wrapY ? wrapNum(coords.y, this._wrapY) : coords.y);\n newCoords.z = coords.z;\n return newCoords;\n },\n _pxBoundsToTileRange: function (bounds) {\n var tileSize = this.getTileSize();\n return new Bounds(bounds.min.unscaleBy(tileSize).floor(), bounds.max.unscaleBy(tileSize).ceil().subtract([1, 1]));\n },\n _noTilesToLoad: function () {\n for (var key in this._tiles) {\n if (!this._tiles[key].loaded) {\n return false;\n }\n }\n\n return true;\n }\n }); // @factory L.gridLayer(options?: GridLayer options)\n // Creates a new instance of GridLayer with the supplied options.\n\n function gridLayer(options) {\n return new GridLayer(options);\n }\n /*\r\n * @class TileLayer\r\n * @inherits GridLayer\r\n * @aka L.TileLayer\r\n * Used to load and display tile layers on the map. Note that most tile servers require attribution, which you can set under `Layer`. Extends `GridLayer`.\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png?{foo}', {foo: 'bar', attribution: 'Map data &copy; <a href=\"https://www.openstreetmap.org/\">OpenStreetMap</a> contributors, <a href=\"https://creativecommons.org/licenses/by-sa/2.0/\">CC-BY-SA</a>'}).addTo(map);\r\n * ```\r\n *\r\n * @section URL template\r\n * @example\r\n *\r\n * A string of the following form:\r\n *\r\n * ```\r\n * 'http://{s}.somedomain.com/blabla/{z}/{x}/{y}{r}.png'\r\n * ```\r\n *\r\n * `{s}` means one of the available subdomains (used sequentially to help with browser parallel requests per domain limitation; subdomain values are specified in options; `a`, `b` or `c` by default, can be omitted), `{z}` — zoom level, `{x}` and `{y}` — tile coordinates. `{r}` can be used to add \"&commat;2x\" to the URL to load retina tiles.\r\n *\r\n * You can use custom keys in the template, which will be [evaluated](#util-template) from TileLayer options, like this:\r\n *\r\n * ```\r\n * L.tileLayer('http://{s}.somedomain.com/{foo}/{z}/{x}/{y}.png', {foo: 'bar'});\r\n * ```\r\n */\n\n\n var TileLayer = GridLayer.extend({\n // @section\n // @aka TileLayer options\n options: {\n // @option minZoom: Number = 0\n // The minimum zoom level down to which this layer will be displayed (inclusive).\n minZoom: 0,\n // @option maxZoom: Number = 18\n // The maximum zoom level up to which this layer will be displayed (inclusive).\n maxZoom: 18,\n // @option subdomains: String|String[] = 'abc'\n // Subdomains of the tile service. Can be passed in the form of one string (where each letter is a subdomain name) or an array of strings.\n subdomains: 'abc',\n // @option errorTileUrl: String = ''\n // URL to the tile image to show in place of the tile that failed to load.\n errorTileUrl: '',\n // @option zoomOffset: Number = 0\n // The zoom number used in tile URLs will be offset with this value.\n zoomOffset: 0,\n // @option tms: Boolean = false\n // If `true`, inverses Y axis numbering for tiles (turn this on for [TMS](https://en.wikipedia.org/wiki/Tile_Map_Service) services).\n tms: false,\n // @option zoomReverse: Boolean = false\n // If set to true, the zoom number used in tile URLs will be reversed (`maxZoom - zoom` instead of `zoom`)\n zoomReverse: false,\n // @option detectRetina: Boolean = false\n // If `true` and user is on a retina display, it will request four tiles of half the specified size and a bigger zoom level in place of one to utilize the high resolution.\n detectRetina: false,\n // @option crossOrigin: Boolean|String = false\n // Whether the crossOrigin attribute will be added to the tiles.\n // If a String is provided, all tiles will have their crossOrigin attribute set to the String provided. This is needed if you want to access tile pixel data.\n // Refer to [CORS Settings](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes) for valid String values.\n crossOrigin: false\n },\n initialize: function (url, options) {\n this._url = url;\n options = setOptions(this, options); // detecting retina displays, adjusting tileSize and zoom levels\n\n if (options.detectRetina && retina && options.maxZoom > 0) {\n options.tileSize = Math.floor(options.tileSize / 2);\n\n if (!options.zoomReverse) {\n options.zoomOffset++;\n options.maxZoom--;\n } else {\n options.zoomOffset--;\n options.minZoom++;\n }\n\n options.minZoom = Math.max(0, options.minZoom);\n }\n\n if (typeof options.subdomains === 'string') {\n options.subdomains = options.subdomains.split('');\n } // for https://github.com/Leaflet/Leaflet/issues/137\n\n\n if (!android) {\n this.on('tileunload', this._onTileRemove);\n }\n },\n // @method setUrl(url: String, noRedraw?: Boolean): this\n // Updates the layer's URL template and redraws it (unless `noRedraw` is set to `true`).\n // If the URL does not change, the layer will not be redrawn unless\n // the noRedraw parameter is set to false.\n setUrl: function (url, noRedraw) {\n if (this._url === url && noRedraw === undefined) {\n noRedraw = true;\n }\n\n this._url = url;\n\n if (!noRedraw) {\n this.redraw();\n }\n\n return this;\n },\n // @method createTile(coords: Object, done?: Function): HTMLElement\n // Called only internally, overrides GridLayer's [`createTile()`](#gridlayer-createtile)\n // to return an `<img>` HTML element with the appropriate image URL given `coords`. The `done`\n // callback is called when the tile has been loaded.\n createTile: function (coords, done) {\n var tile = document.createElement('img');\n on(tile, 'load', bind(this._tileOnLoad, this, done, tile));\n on(tile, 'error', bind(this._tileOnError, this, done, tile));\n\n if (this.options.crossOrigin || this.options.crossOrigin === '') {\n tile.crossOrigin = this.options.crossOrigin === true ? '' : this.options.crossOrigin;\n }\n /*\r\n Alt tag is set to empty string to keep screen readers from reading URL and for compliance reasons\r\n http://www.w3.org/TR/WCAG20-TECHS/H67\r\n */\n\n\n tile.alt = '';\n /*\r\n Set role=\"presentation\" to force screen readers to ignore this\r\n https://www.w3.org/TR/wai-aria/roles#textalternativecomputation\r\n */\n\n tile.setAttribute('role', 'presentation');\n tile.src = this.getTileUrl(coords);\n return tile;\n },\n // @section Extension methods\n // @uninheritable\n // Layers extending `TileLayer` might reimplement the following method.\n // @method getTileUrl(coords: Object): String\n // Called only internally, returns the URL for a tile given its coordinates.\n // Classes extending `TileLayer` can override this function to provide custom tile URL naming schemes.\n getTileUrl: function (coords) {\n var data = {\n r: retina ? '@2x' : '',\n s: this._getSubdomain(coords),\n x: coords.x,\n y: coords.y,\n z: this._getZoomForUrl()\n };\n\n if (this._map && !this._map.options.crs.infinite) {\n var invertedY = this._globalTileRange.max.y - coords.y;\n\n if (this.options.tms) {\n data['y'] = invertedY;\n }\n\n data['-y'] = invertedY;\n }\n\n return template(this._url, extend(data, this.options));\n },\n _tileOnLoad: function (done, tile) {\n // For https://github.com/Leaflet/Leaflet/issues/3332\n if (ielt9) {\n setTimeout(bind(done, this, null, tile), 0);\n } else {\n done(null, tile);\n }\n },\n _tileOnError: function (done, tile, e) {\n var errorUrl = this.options.errorTileUrl;\n\n if (errorUrl && tile.getAttribute('src') !== errorUrl) {\n tile.src = errorUrl;\n }\n\n done(e, tile);\n },\n _onTileRemove: function (e) {\n e.tile.onload = null;\n },\n _getZoomForUrl: function () {\n var zoom = this._tileZoom,\n maxZoom = this.options.maxZoom,\n zoomReverse = this.options.zoomReverse,\n zoomOffset = this.options.zoomOffset;\n\n if (zoomReverse) {\n zoom = maxZoom - zoom;\n }\n\n return zoom + zoomOffset;\n },\n _getSubdomain: function (tilePoint) {\n var index = Math.abs(tilePoint.x + tilePoint.y) % this.options.subdomains.length;\n return this.options.subdomains[index];\n },\n // stops loading all tiles in the background layer\n _abortLoading: function () {\n var i, tile;\n\n for (i in this._tiles) {\n if (this._tiles[i].coords.z !== this._tileZoom) {\n tile = this._tiles[i].el;\n tile.onload = falseFn;\n tile.onerror = falseFn;\n\n if (!tile.complete) {\n tile.src = emptyImageUrl;\n remove(tile);\n delete this._tiles[i];\n }\n }\n }\n },\n _removeTile: function (key) {\n var tile = this._tiles[key];\n\n if (!tile) {\n return;\n } // Cancels any pending http requests associated with the tile\n // unless we're on Android's stock browser,\n // see https://github.com/Leaflet/Leaflet/issues/137\n\n\n if (!androidStock) {\n tile.el.setAttribute('src', emptyImageUrl);\n }\n\n return GridLayer.prototype._removeTile.call(this, key);\n },\n _tileReady: function (coords, err, tile) {\n if (!this._map || tile && tile.getAttribute('src') === emptyImageUrl) {\n return;\n }\n\n return GridLayer.prototype._tileReady.call(this, coords, err, tile);\n }\n }); // @factory L.tilelayer(urlTemplate: String, options?: TileLayer options)\n // Instantiates a tile layer object given a `URL template` and optionally an options object.\n\n function tileLayer(url, options) {\n return new TileLayer(url, options);\n }\n /*\r\n * @class TileLayer.WMS\r\n * @inherits TileLayer\r\n * @aka L.TileLayer.WMS\r\n * Used to display [WMS](https://en.wikipedia.org/wiki/Web_Map_Service) services as tile layers on the map. Extends `TileLayer`.\r\n *\r\n * @example\r\n *\r\n * ```js\r\n * var nexrad = L.tileLayer.wms(\"http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi\", {\r\n * \tlayers: 'nexrad-n0r-900913',\r\n * \tformat: 'image/png',\r\n * \ttransparent: true,\r\n * \tattribution: \"Weather data © 2012 IEM Nexrad\"\r\n * });\r\n * ```\r\n */\n\n\n var TileLayerWMS = TileLayer.extend({\n // @section\n // @aka TileLayer.WMS options\n // If any custom options not documented here are used, they will be sent to the\n // WMS server as extra parameters in each request URL. This can be useful for\n // [non-standard vendor WMS parameters](http://docs.geoserver.org/stable/en/user/services/wms/vendor.html).\n defaultWmsParams: {\n service: 'WMS',\n request: 'GetMap',\n // @option layers: String = ''\n // **(required)** Comma-separated list of WMS layers to show.\n layers: '',\n // @option styles: String = ''\n // Comma-separated list of WMS styles.\n styles: '',\n // @option format: String = 'image/jpeg'\n // WMS image format (use `'image/png'` for layers with transparency).\n format: 'image/jpeg',\n // @option transparent: Boolean = false\n // If `true`, the WMS service will return images with transparency.\n transparent: false,\n // @option version: String = '1.1.1'\n // Version of the WMS service to use\n version: '1.1.1'\n },\n options: {\n // @option crs: CRS = null\n // Coordinate Reference System to use for the WMS requests, defaults to\n // map CRS. Don't change this if you're not sure what it means.\n crs: null,\n // @option uppercase: Boolean = false\n // If `true`, WMS request parameter keys will be uppercase.\n uppercase: false\n },\n initialize: function (url, options) {\n this._url = url;\n var wmsParams = extend({}, this.defaultWmsParams); // all keys that are not TileLayer options go to WMS params\n\n for (var i in options) {\n if (!(i in this.options)) {\n wmsParams[i] = options[i];\n }\n }\n\n options = setOptions(this, options);\n var realRetina = options.detectRetina && retina ? 2 : 1;\n var tileSize = this.getTileSize();\n wmsParams.width = tileSize.x * realRetina;\n wmsParams.height = tileSize.y * realRetina;\n this.wmsParams = wmsParams;\n },\n onAdd: function (map) {\n this._crs = this.options.crs || map.options.crs;\n this._wmsVersion = parseFloat(this.wmsParams.version);\n var projectionKey = this._wmsVersion >= 1.3 ? 'crs' : 'srs';\n this.wmsParams[projectionKey] = this._crs.code;\n TileLayer.prototype.onAdd.call(this, map);\n },\n getTileUrl: function (coords) {\n var tileBounds = this._tileCoordsToNwSe(coords),\n crs = this._crs,\n bounds = toBounds(crs.project(tileBounds[0]), crs.project(tileBounds[1])),\n min = bounds.min,\n max = bounds.max,\n bbox = (this._wmsVersion >= 1.3 && this._crs === EPSG4326 ? [min.y, min.x, max.y, max.x] : [min.x, min.y, max.x, max.y]).join(','),\n url = TileLayer.prototype.getTileUrl.call(this, coords);\n\n return url + getParamString(this.wmsParams, url, this.options.uppercase) + (this.options.uppercase ? '&BBOX=' : '&bbox=') + bbox;\n },\n // @method setParams(params: Object, noRedraw?: Boolean): this\n // Merges an object with the new parameters and re-requests tiles on the current screen (unless `noRedraw` was set to true).\n setParams: function (params, noRedraw) {\n extend(this.wmsParams, params);\n\n if (!noRedraw) {\n this.redraw();\n }\n\n return this;\n }\n }); // @factory L.tileLayer.wms(baseUrl: String, options: TileLayer.WMS options)\n // Instantiates a WMS tile layer object given a base URL of the WMS service and a WMS parameters/options object.\n\n function tileLayerWMS(url, options) {\n return new TileLayerWMS(url, options);\n }\n\n TileLayer.WMS = TileLayerWMS;\n tileLayer.wms = tileLayerWMS;\n /*\n * @class Renderer\n * @inherits Layer\n * @aka L.Renderer\n *\n * Base class for vector renderer implementations (`SVG`, `Canvas`). Handles the\n * DOM container of the renderer, its bounds, and its zoom animation.\n *\n * A `Renderer` works as an implicit layer group for all `Path`s - the renderer\n * itself can be added or removed to the map. All paths use a renderer, which can\n * be implicit (the map will decide the type of renderer and use it automatically)\n * or explicit (using the [`renderer`](#path-renderer) option of the path).\n *\n * Do not use this class directly, use `SVG` and `Canvas` instead.\n *\n * @event update: Event\n * Fired when the renderer updates its bounds, center and zoom, for example when\n * its map has moved\n */\n\n var Renderer = Layer.extend({\n // @section\n // @aka Renderer options\n options: {\n // @option padding: Number = 0.1\n // How much to extend the clip area around the map view (relative to its size)\n // e.g. 0.1 would be 10% of map view in each direction\n padding: 0.1,\n // @option tolerance: Number = 0\n // How much to extend click tolerance round a path/object on the map\n tolerance: 0\n },\n initialize: function (options) {\n setOptions(this, options);\n stamp(this);\n this._layers = this._layers || {};\n },\n onAdd: function () {\n if (!this._container) {\n this._initContainer(); // defined by renderer implementations\n\n\n if (this._zoomAnimated) {\n addClass(this._container, 'leaflet-zoom-animated');\n }\n }\n\n this.getPane().appendChild(this._container);\n\n this._update();\n\n this.on('update', this._updatePaths, this);\n },\n onRemove: function () {\n this.off('update', this._updatePaths, this);\n\n this._destroyContainer();\n },\n getEvents: function () {\n var events = {\n viewreset: this._reset,\n zoom: this._onZoom,\n moveend: this._update,\n zoomend: this._onZoomEnd\n };\n\n if (this._zoomAnimated) {\n events.zoomanim = this._onAnimZoom;\n }\n\n return events;\n },\n _onAnimZoom: function (ev) {\n this._updateTransform(ev.center, ev.zoom);\n },\n _onZoom: function () {\n this._updateTransform(this._map.getCenter(), this._map.getZoom());\n },\n _updateTransform: function (center, zoom) {\n var scale = this._map.getZoomScale(zoom, this._zoom),\n position = getPosition(this._container),\n viewHalf = this._map.getSize().multiplyBy(0.5 + this.options.padding),\n currentCenterPoint = this._map.project(this._center, zoom),\n destCenterPoint = this._map.project(center, zoom),\n centerOffset = destCenterPoint.subtract(currentCenterPoint),\n topLeftOffset = viewHalf.multiplyBy(-scale).add(position).add(viewHalf).subtract(centerOffset);\n\n if (any3d) {\n setTransform(this._container, topLeftOffset, scale);\n } else {\n setPosition(this._container, topLeftOffset);\n }\n },\n _reset: function () {\n this._update();\n\n this._updateTransform(this._center, this._zoom);\n\n for (var id in this._layers) {\n this._layers[id]._reset();\n }\n },\n _onZoomEnd: function () {\n for (var id in this._layers) {\n this._layers[id]._project();\n }\n },\n _updatePaths: function () {\n for (var id in this._layers) {\n this._layers[id]._update();\n }\n },\n _update: function () {\n // Update pixel bounds of renderer container (for positioning/sizing/clipping later)\n // Subclasses are responsible of firing the 'update' event.\n var p = this.options.padding,\n size = this._map.getSize(),\n min = this._map.containerPointToLayerPoint(size.multiplyBy(-p)).round();\n\n this._bounds = new Bounds(min, min.add(size.multiplyBy(1 + p * 2)).round());\n this._center = this._map.getCenter();\n this._zoom = this._map.getZoom();\n }\n });\n /*\n * @class Canvas\n * @inherits Renderer\n * @aka L.Canvas\n *\n * Allows vector layers to be displayed with [`<canvas>`](https://developer.mozilla.org/docs/Web/API/Canvas_API).\n * Inherits `Renderer`.\n *\n * Due to [technical limitations](http://caniuse.com/#search=canvas), Canvas is not\n * available in all web browsers, notably IE8, and overlapping geometries might\n * not display properly in some edge cases.\n *\n * @example\n *\n * Use Canvas by default for all paths in the map:\n *\n * ```js\n * var map = L.map('map', {\n * \trenderer: L.canvas()\n * });\n * ```\n *\n * Use a Canvas renderer with extra padding for specific vector geometries:\n *\n * ```js\n * var map = L.map('map');\n * var myRenderer = L.canvas({ padding: 0.5 });\n * var line = L.polyline( coordinates, { renderer: myRenderer } );\n * var circle = L.circle( center, { renderer: myRenderer } );\n * ```\n */\n\n var Canvas = Renderer.extend({\n getEvents: function () {\n var events = Renderer.prototype.getEvents.call(this);\n events.viewprereset = this._onViewPreReset;\n return events;\n },\n _onViewPreReset: function () {\n // Set a flag so that a viewprereset+moveend+viewreset only updates&redraws once\n this._postponeUpdatePaths = true;\n },\n onAdd: function () {\n Renderer.prototype.onAdd.call(this); // Redraw vectors since canvas is cleared upon removal,\n // in case of removing the renderer itself from the map.\n\n this._draw();\n },\n _initContainer: function () {\n var container = this._container = document.createElement('canvas');\n on(container, 'mousemove', throttle(this._onMouseMove, 32, this), this);\n on(container, 'click dblclick mousedown mouseup contextmenu', this._onClick, this);\n on(container, 'mouseout', this._handleMouseOut, this);\n this._ctx = container.getContext('2d');\n },\n _destroyContainer: function () {\n cancelAnimFrame(this._redrawRequest);\n delete this._ctx;\n remove(this._container);\n off(this._container);\n delete this._container;\n },\n _updatePaths: function () {\n if (this._postponeUpdatePaths) {\n return;\n }\n\n var layer;\n this._redrawBounds = null;\n\n for (var id in this._layers) {\n layer = this._layers[id];\n\n layer._update();\n }\n\n this._redraw();\n },\n _update: function () {\n if (this._map._animatingZoom && this._bounds) {\n return;\n }\n\n Renderer.prototype._update.call(this);\n\n var b = this._bounds,\n container = this._container,\n size = b.getSize(),\n m = retina ? 2 : 1;\n setPosition(container, b.min); // set canvas size (also clearing it); use double size on retina\n\n container.width = m * size.x;\n container.height = m * size.y;\n container.style.width = size.x + 'px';\n container.style.height = size.y + 'px';\n\n if (retina) {\n this._ctx.scale(2, 2);\n } // translate so we use the same path coordinates after canvas element moves\n\n\n this._ctx.translate(-b.min.x, -b.min.y); // Tell paths to redraw themselves\n\n\n this.fire('update');\n },\n _reset: function () {\n Renderer.prototype._reset.call(this);\n\n if (this._postponeUpdatePaths) {\n this._postponeUpdatePaths = false;\n\n this._updatePaths();\n }\n },\n _initPath: function (layer) {\n this._updateDashArray(layer);\n\n this._layers[stamp(layer)] = layer;\n var order = layer._order = {\n layer: layer,\n prev: this._drawLast,\n next: null\n };\n\n if (this._drawLast) {\n this._drawLast.next = order;\n }\n\n this._drawLast = order;\n this._drawFirst = this._drawFirst || this._drawLast;\n },\n _addPath: function (layer) {\n this._requestRedraw(layer);\n },\n _removePath: function (layer) {\n var order = layer._order;\n var next = order.next;\n var prev = order.prev;\n\n if (next) {\n next.prev = prev;\n } else {\n this._drawLast = prev;\n }\n\n if (prev) {\n prev.next = next;\n } else {\n this._drawFirst = next;\n }\n\n delete layer._order;\n delete this._layers[stamp(layer)];\n\n this._requestRedraw(layer);\n },\n _updatePath: function (layer) {\n // Redraw the union of the layer's old pixel\n // bounds and the new pixel bounds.\n this._extendRedrawBounds(layer);\n\n layer._project();\n\n layer._update(); // The redraw will extend the redraw bounds\n // with the new pixel bounds.\n\n\n this._requestRedraw(layer);\n },\n _updateStyle: function (layer) {\n this._updateDashArray(layer);\n\n this._requestRedraw(layer);\n },\n _updateDashArray: function (layer) {\n if (typeof layer.options.dashArray === 'string') {\n var parts = layer.options.dashArray.split(/[, ]+/),\n dashArray = [],\n dashValue,\n i;\n\n for (i = 0; i < parts.length; i++) {\n dashValue = Number(parts[i]); // Ignore dash array containing invalid lengths\n\n if (isNaN(dashValue)) {\n return;\n }\n\n dashArray.push(dashValue);\n }\n\n layer.options._dashArray = dashArray;\n } else {\n layer.options._dashArray = layer.options.dashArray;\n }\n },\n _requestRedraw: function (layer) {\n if (!this._map) {\n return;\n }\n\n this._extendRedrawBounds(layer);\n\n this._redrawRequest = this._redrawRequest || requestAnimFrame(this._redraw, this);\n },\n _extendRedrawBounds: function (layer) {\n if (layer._pxBounds) {\n var padding = (layer.options.weight || 0) + 1;\n this._redrawBounds = this._redrawBounds || new Bounds();\n\n this._redrawBounds.extend(layer._pxBounds.min.subtract([padding, padding]));\n\n this._redrawBounds.extend(layer._pxBounds.max.add([padding, padding]));\n }\n },\n _redraw: function () {\n this._redrawRequest = null;\n\n if (this._redrawBounds) {\n this._redrawBounds.min._floor();\n\n this._redrawBounds.max._ceil();\n }\n\n this._clear(); // clear layers in redraw bounds\n\n\n this._draw(); // draw layers\n\n\n this._redrawBounds = null;\n },\n _clear: function () {\n var bounds = this._redrawBounds;\n\n if (bounds) {\n var size = bounds.getSize();\n\n this._ctx.clearRect(bounds.min.x, bounds.min.y, size.x, size.y);\n } else {\n this._ctx.clearRect(0, 0, this._container.width, this._container.height);\n }\n },\n _draw: function () {\n var layer,\n bounds = this._redrawBounds;\n\n this._ctx.save();\n\n if (bounds) {\n var size = bounds.getSize();\n\n this._ctx.beginPath();\n\n this._ctx.rect(bounds.min.x, bounds.min.y, size.x, size.y);\n\n this._ctx.clip();\n }\n\n this._drawing = true;\n\n for (var order = this._drawFirst; order; order = order.next) {\n layer = order.layer;\n\n if (!bounds || layer._pxBounds && layer._pxBounds.intersects(bounds)) {\n layer._updatePath();\n }\n }\n\n this._drawing = false;\n\n this._ctx.restore(); // Restore state before clipping.\n\n },\n _updatePoly: function (layer, closed) {\n if (!this._drawing) {\n return;\n }\n\n var i,\n j,\n len2,\n p,\n parts = layer._parts,\n len = parts.length,\n ctx = this._ctx;\n\n if (!len) {\n return;\n }\n\n ctx.beginPath();\n\n for (i = 0; i < len; i++) {\n for (j = 0, len2 = parts[i].length; j < len2; j++) {\n p = parts[i][j];\n ctx[j ? 'lineTo' : 'moveTo'](p.x, p.y);\n }\n\n if (closed) {\n ctx.closePath();\n }\n }\n\n this._fillStroke(ctx, layer); // TODO optimization: 1 fill/stroke for all features with equal style instead of 1 for each feature\n\n },\n _updateCircle: function (layer) {\n if (!this._drawing || layer._empty()) {\n return;\n }\n\n var p = layer._point,\n ctx = this._ctx,\n r = Math.max(Math.round(layer._radius), 1),\n s = (Math.max(Math.round(layer._radiusY), 1) || r) / r;\n\n if (s !== 1) {\n ctx.save();\n ctx.scale(1, s);\n }\n\n ctx.beginPath();\n ctx.arc(p.x, p.y / s, r, 0, Math.PI * 2, false);\n\n if (s !== 1) {\n ctx.restore();\n }\n\n this._fillStroke(ctx, layer);\n },\n _fillStroke: function (ctx, layer) {\n var options = layer.options;\n\n if (options.fill) {\n ctx.globalAlpha = options.fillOpacity;\n ctx.fillStyle = options.fillColor || options.color;\n ctx.fill(options.fillRule || 'evenodd');\n }\n\n if (options.stroke && options.weight !== 0) {\n if (ctx.setLineDash) {\n ctx.setLineDash(layer.options && layer.options._dashArray || []);\n }\n\n ctx.globalAlpha = options.opacity;\n ctx.lineWidth = options.weight;\n ctx.strokeStyle = options.color;\n ctx.lineCap = options.lineCap;\n ctx.lineJoin = options.lineJoin;\n ctx.stroke();\n }\n },\n // Canvas obviously doesn't have mouse events for individual drawn objects,\n // so we emulate that by calculating what's under the mouse on mousemove/click manually\n _onClick: function (e) {\n var point = this._map.mouseEventToLayerPoint(e),\n layer,\n clickedLayer;\n\n for (var order = this._drawFirst; order; order = order.next) {\n layer = order.layer;\n\n if (layer.options.interactive && layer._containsPoint(point) && !this._map._draggableMoved(layer)) {\n clickedLayer = layer;\n }\n }\n\n if (clickedLayer) {\n fakeStop(e);\n\n this._fireEvent([clickedLayer], e);\n }\n },\n _onMouseMove: function (e) {\n if (!this._map || this._map.dragging.moving() || this._map._animatingZoom) {\n return;\n }\n\n var point = this._map.mouseEventToLayerPoint(e);\n\n this._handleMouseHover(e, point);\n },\n _handleMouseOut: function (e) {\n var layer = this._hoveredLayer;\n\n if (layer) {\n // if we're leaving the layer, fire mouseout\n removeClass(this._container, 'leaflet-interactive');\n\n this._fireEvent([layer], e, 'mouseout');\n\n this._hoveredLayer = null;\n }\n },\n _handleMouseHover: function (e, point) {\n var layer, candidateHoveredLayer;\n\n for (var order = this._drawFirst; order; order = order.next) {\n layer = order.layer;\n\n if (layer.options.interactive && layer._containsPoint(point)) {\n candidateHoveredLayer = layer;\n }\n }\n\n if (candidateHoveredLayer !== this._hoveredLayer) {\n this._handleMouseOut(e);\n\n if (candidateHoveredLayer) {\n addClass(this._container, 'leaflet-interactive'); // change cursor\n\n this._fireEvent([candidateHoveredLayer], e, 'mouseover');\n\n this._hoveredLayer = candidateHoveredLayer;\n }\n }\n\n if (this._hoveredLayer) {\n this._fireEvent([this._hoveredLayer], e);\n }\n },\n _fireEvent: function (layers, e, type) {\n this._map._fireDOMEvent(e, type || e.type, layers);\n },\n _bringToFront: function (layer) {\n var order = layer._order;\n\n if (!order) {\n return;\n }\n\n var next = order.next;\n var prev = order.prev;\n\n if (next) {\n next.prev = prev;\n } else {\n // Already last\n return;\n }\n\n if (prev) {\n prev.next = next;\n } else if (next) {\n // Update first entry unless this is the\n // single entry\n this._drawFirst = next;\n }\n\n order.prev = this._drawLast;\n this._drawLast.next = order;\n order.next = null;\n this._drawLast = order;\n\n this._requestRedraw(layer);\n },\n _bringToBack: function (layer) {\n var order = layer._order;\n\n if (!order) {\n return;\n }\n\n var next = order.next;\n var prev = order.prev;\n\n if (prev) {\n prev.next = next;\n } else {\n // Already first\n return;\n }\n\n if (next) {\n next.prev = prev;\n } else if (prev) {\n // Update last entry unless this is the\n // single entry\n this._drawLast = prev;\n }\n\n order.prev = null;\n order.next = this._drawFirst;\n this._drawFirst.prev = order;\n this._drawFirst = order;\n\n this._requestRedraw(layer);\n }\n }); // @factory L.canvas(options?: Renderer options)\n // Creates a Canvas renderer with the given options.\n\n function canvas$1(options) {\n return canvas ? new Canvas(options) : null;\n }\n /*\n * Thanks to Dmitry Baranovsky and his Raphael library for inspiration!\n */\n\n\n var vmlCreate = function () {\n try {\n document.namespaces.add('lvml', 'urn:schemas-microsoft-com:vml');\n return function (name) {\n return document.createElement('<lvml:' + name + ' class=\"lvml\">');\n };\n } catch (e) {\n return function (name) {\n return document.createElement('<' + name + ' xmlns=\"urn:schemas-microsoft.com:vml\" class=\"lvml\">');\n };\n }\n }();\n /*\n * @class SVG\n *\n *\n * VML was deprecated in 2012, which means VML functionality exists only for backwards compatibility\n * with old versions of Internet Explorer.\n */\n // mixin to redefine some SVG methods to handle VML syntax which is similar but with some differences\n\n\n var vmlMixin = {\n _initContainer: function () {\n this._container = create$1('div', 'leaflet-vml-container');\n },\n _update: function () {\n if (this._map._animatingZoom) {\n return;\n }\n\n Renderer.prototype._update.call(this);\n\n this.fire('update');\n },\n _initPath: function (layer) {\n var container = layer._container = vmlCreate('shape');\n addClass(container, 'leaflet-vml-shape ' + (this.options.className || ''));\n container.coordsize = '1 1';\n layer._path = vmlCreate('path');\n container.appendChild(layer._path);\n\n this._updateStyle(layer);\n\n this._layers[stamp(layer)] = layer;\n },\n _addPath: function (layer) {\n var container = layer._container;\n\n this._container.appendChild(container);\n\n if (layer.options.interactive) {\n layer.addInteractiveTarget(container);\n }\n },\n _removePath: function (layer) {\n var container = layer._container;\n remove(container);\n layer.removeInteractiveTarget(container);\n delete this._layers[stamp(layer)];\n },\n _updateStyle: function (layer) {\n var stroke = layer._stroke,\n fill = layer._fill,\n options = layer.options,\n container = layer._container;\n container.stroked = !!options.stroke;\n container.filled = !!options.fill;\n\n if (options.stroke) {\n if (!stroke) {\n stroke = layer._stroke = vmlCreate('stroke');\n }\n\n container.appendChild(stroke);\n stroke.weight = options.weight + 'px';\n stroke.color = options.color;\n stroke.opacity = options.opacity;\n\n if (options.dashArray) {\n stroke.dashStyle = isArray(options.dashArray) ? options.dashArray.join(' ') : options.dashArray.replace(/( *, *)/g, ' ');\n } else {\n stroke.dashStyle = '';\n }\n\n stroke.endcap = options.lineCap.replace('butt', 'flat');\n stroke.joinstyle = options.lineJoin;\n } else if (stroke) {\n container.removeChild(stroke);\n layer._stroke = null;\n }\n\n if (options.fill) {\n if (!fill) {\n fill = layer._fill = vmlCreate('fill');\n }\n\n container.appendChild(fill);\n fill.color = options.fillColor || options.color;\n fill.opacity = options.fillOpacity;\n } else if (fill) {\n container.removeChild(fill);\n layer._fill = null;\n }\n },\n _updateCircle: function (layer) {\n var p = layer._point.round(),\n r = Math.round(layer._radius),\n r2 = Math.round(layer._radiusY || r);\n\n this._setPath(layer, layer._empty() ? 'M0 0' : 'AL ' + p.x + ',' + p.y + ' ' + r + ',' + r2 + ' 0,' + 65535 * 360);\n },\n _setPath: function (layer, path) {\n layer._path.v = path;\n },\n _bringToFront: function (layer) {\n toFront(layer._container);\n },\n _bringToBack: function (layer) {\n toBack(layer._container);\n }\n };\n var create$2 = vml ? vmlCreate : svgCreate;\n /*\n * @class SVG\n * @inherits Renderer\n * @aka L.SVG\n *\n * Allows vector layers to be displayed with [SVG](https://developer.mozilla.org/docs/Web/SVG).\n * Inherits `Renderer`.\n *\n * Due to [technical limitations](http://caniuse.com/#search=svg), SVG is not\n * available in all web browsers, notably Android 2.x and 3.x.\n *\n * Although SVG is not available on IE7 and IE8, these browsers support\n * [VML](https://en.wikipedia.org/wiki/Vector_Markup_Language)\n * (a now deprecated technology), and the SVG renderer will fall back to VML in\n * this case.\n *\n * @example\n *\n * Use SVG by default for all paths in the map:\n *\n * ```js\n * var map = L.map('map', {\n * \trenderer: L.svg()\n * });\n * ```\n *\n * Use a SVG renderer with extra padding for specific vector geometries:\n *\n * ```js\n * var map = L.map('map');\n * var myRenderer = L.svg({ padding: 0.5 });\n * var line = L.polyline( coordinates, { renderer: myRenderer } );\n * var circle = L.circle( center, { renderer: myRenderer } );\n * ```\n */\n\n var SVG = Renderer.extend({\n getEvents: function () {\n var events = Renderer.prototype.getEvents.call(this);\n events.zoomstart = this._onZoomStart;\n return events;\n },\n _initContainer: function () {\n this._container = create$2('svg'); // makes it possible to click through svg root; we'll reset it back in individual paths\n\n this._container.setAttribute('pointer-events', 'none');\n\n this._rootGroup = create$2('g');\n\n this._container.appendChild(this._rootGroup);\n },\n _destroyContainer: function () {\n remove(this._container);\n off(this._container);\n delete this._container;\n delete this._rootGroup;\n delete this._svgSize;\n },\n _onZoomStart: function () {\n // Drag-then-pinch interactions might mess up the center and zoom.\n // In this case, the easiest way to prevent this is re-do the renderer\n // bounds and padding when the zooming starts.\n this._update();\n },\n _update: function () {\n if (this._map._animatingZoom && this._bounds) {\n return;\n }\n\n Renderer.prototype._update.call(this);\n\n var b = this._bounds,\n size = b.getSize(),\n container = this._container; // set size of svg-container if changed\n\n if (!this._svgSize || !this._svgSize.equals(size)) {\n this._svgSize = size;\n container.setAttribute('width', size.x);\n container.setAttribute('height', size.y);\n } // movement: update container viewBox so that we don't have to change coordinates of individual layers\n\n\n setPosition(container, b.min);\n container.setAttribute('viewBox', [b.min.x, b.min.y, size.x, size.y].join(' '));\n this.fire('update');\n },\n // methods below are called by vector layers implementations\n _initPath: function (layer) {\n var path = layer._path = create$2('path'); // @namespace Path\n // @option className: String = null\n // Custom class name set on an element. Only for SVG renderer.\n\n if (layer.options.className) {\n addClass(path, layer.options.className);\n }\n\n if (layer.options.interactive) {\n addClass(path, 'leaflet-interactive');\n }\n\n this._updateStyle(layer);\n\n this._layers[stamp(layer)] = layer;\n },\n _addPath: function (layer) {\n if (!this._rootGroup) {\n this._initContainer();\n }\n\n this._rootGroup.appendChild(layer._path);\n\n layer.addInteractiveTarget(layer._path);\n },\n _removePath: function (layer) {\n remove(layer._path);\n layer.removeInteractiveTarget(layer._path);\n delete this._layers[stamp(layer)];\n },\n _updatePath: function (layer) {\n layer._project();\n\n layer._update();\n },\n _updateStyle: function (layer) {\n var path = layer._path,\n options = layer.options;\n\n if (!path) {\n return;\n }\n\n if (options.stroke) {\n path.setAttribute('stroke', options.color);\n path.setAttribute('stroke-opacity', options.opacity);\n path.setAttribute('stroke-width', options.weight);\n path.setAttribute('stroke-linecap', options.lineCap);\n path.setAttribute('stroke-linejoin', options.lineJoin);\n\n if (options.dashArray) {\n path.setAttribute('stroke-dasharray', options.dashArray);\n } else {\n path.removeAttribute('stroke-dasharray');\n }\n\n if (options.dashOffset) {\n path.setAttribute('stroke-dashoffset', options.dashOffset);\n } else {\n path.removeAttribute('stroke-dashoffset');\n }\n } else {\n path.setAttribute('stroke', 'none');\n }\n\n if (options.fill) {\n path.setAttribute('fill', options.fillColor || options.color);\n path.setAttribute('fill-opacity', options.fillOpacity);\n path.setAttribute('fill-rule', options.fillRule || 'evenodd');\n } else {\n path.setAttribute('fill', 'none');\n }\n },\n _updatePoly: function (layer, closed) {\n this._setPath(layer, pointsToPath(layer._parts, closed));\n },\n _updateCircle: function (layer) {\n var p = layer._point,\n r = Math.max(Math.round(layer._radius), 1),\n r2 = Math.max(Math.round(layer._radiusY), 1) || r,\n arc = 'a' + r + ',' + r2 + ' 0 1,0 '; // drawing a circle with two half-arcs\n\n var d = layer._empty() ? 'M0 0' : 'M' + (p.x - r) + ',' + p.y + arc + r * 2 + ',0 ' + arc + -r * 2 + ',0 ';\n\n this._setPath(layer, d);\n },\n _setPath: function (layer, path) {\n layer._path.setAttribute('d', path);\n },\n // SVG does not have the concept of zIndex so we resort to changing the DOM order of elements\n _bringToFront: function (layer) {\n toFront(layer._path);\n },\n _bringToBack: function (layer) {\n toBack(layer._path);\n }\n });\n\n if (vml) {\n SVG.include(vmlMixin);\n } // @namespace SVG\n // @factory L.svg(options?: Renderer options)\n // Creates a SVG renderer with the given options.\n\n\n function svg$1(options) {\n return svg || vml ? new SVG(options) : null;\n }\n\n Map.include({\n // @namespace Map; @method getRenderer(layer: Path): Renderer\n // Returns the instance of `Renderer` that should be used to render the given\n // `Path`. It will ensure that the `renderer` options of the map and paths\n // are respected, and that the renderers do exist on the map.\n getRenderer: function (layer) {\n // @namespace Path; @option renderer: Renderer\n // Use this specific instance of `Renderer` for this path. Takes\n // precedence over the map's [default renderer](#map-renderer).\n var renderer = layer.options.renderer || this._getPaneRenderer(layer.options.pane) || this.options.renderer || this._renderer;\n\n if (!renderer) {\n renderer = this._renderer = this._createRenderer();\n }\n\n if (!this.hasLayer(renderer)) {\n this.addLayer(renderer);\n }\n\n return renderer;\n },\n _getPaneRenderer: function (name) {\n if (name === 'overlayPane' || name === undefined) {\n return false;\n }\n\n var renderer = this._paneRenderers[name];\n\n if (renderer === undefined) {\n renderer = this._createRenderer({\n pane: name\n });\n this._paneRenderers[name] = renderer;\n }\n\n return renderer;\n },\n _createRenderer: function (options) {\n // @namespace Map; @option preferCanvas: Boolean = false\n // Whether `Path`s should be rendered on a `Canvas` renderer.\n // By default, all `Path`s are rendered in a `SVG` renderer.\n return this.options.preferCanvas && canvas$1(options) || svg$1(options);\n }\n });\n /*\n * L.Rectangle extends Polygon and creates a rectangle when passed a LatLngBounds object.\n */\n\n /*\n * @class Rectangle\n * @aka L.Rectangle\n * @inherits Polygon\n *\n * A class for drawing rectangle overlays on a map. Extends `Polygon`.\n *\n * @example\n *\n * ```js\n * // define rectangle geographical bounds\n * var bounds = [[54.559322, -5.767822], [56.1210604, -3.021240]];\n *\n * // create an orange rectangle\n * L.rectangle(bounds, {color: \"#ff7800\", weight: 1}).addTo(map);\n *\n * // zoom the map to the rectangle bounds\n * map.fitBounds(bounds);\n * ```\n *\n */\n\n var Rectangle = Polygon.extend({\n initialize: function (latLngBounds, options) {\n Polygon.prototype.initialize.call(this, this._boundsToLatLngs(latLngBounds), options);\n },\n // @method setBounds(latLngBounds: LatLngBounds): this\n // Redraws the rectangle with the passed bounds.\n setBounds: function (latLngBounds) {\n return this.setLatLngs(this._boundsToLatLngs(latLngBounds));\n },\n _boundsToLatLngs: function (latLngBounds) {\n latLngBounds = toLatLngBounds(latLngBounds);\n return [latLngBounds.getSouthWest(), latLngBounds.getNorthWest(), latLngBounds.getNorthEast(), latLngBounds.getSouthEast()];\n }\n }); // @factory L.rectangle(latLngBounds: LatLngBounds, options?: Polyline options)\n\n function rectangle(latLngBounds, options) {\n return new Rectangle(latLngBounds, options);\n }\n\n SVG.create = create$2;\n SVG.pointsToPath = pointsToPath;\n GeoJSON.geometryToLayer = geometryToLayer;\n GeoJSON.coordsToLatLng = coordsToLatLng;\n GeoJSON.coordsToLatLngs = coordsToLatLngs;\n GeoJSON.latLngToCoords = latLngToCoords;\n GeoJSON.latLngsToCoords = latLngsToCoords;\n GeoJSON.getFeature = getFeature;\n GeoJSON.asFeature = asFeature;\n /*\n * L.Handler.BoxZoom is used to add shift-drag zoom interaction to the map\n * (zoom to a selected bounding box), enabled by default.\n */\n // @namespace Map\n // @section Interaction Options\n\n Map.mergeOptions({\n // @option boxZoom: Boolean = true\n // Whether the map can be zoomed to a rectangular area specified by\n // dragging the mouse while pressing the shift key.\n boxZoom: true\n });\n var BoxZoom = Handler.extend({\n initialize: function (map) {\n this._map = map;\n this._container = map._container;\n this._pane = map._panes.overlayPane;\n this._resetStateTimeout = 0;\n map.on('unload', this._destroy, this);\n },\n addHooks: function () {\n on(this._container, 'mousedown', this._onMouseDown, this);\n },\n removeHooks: function () {\n off(this._container, 'mousedown', this._onMouseDown, this);\n },\n moved: function () {\n return this._moved;\n },\n _destroy: function () {\n remove(this._pane);\n delete this._pane;\n },\n _resetState: function () {\n this._resetStateTimeout = 0;\n this._moved = false;\n },\n _clearDeferredResetState: function () {\n if (this._resetStateTimeout !== 0) {\n clearTimeout(this._resetStateTimeout);\n this._resetStateTimeout = 0;\n }\n },\n _onMouseDown: function (e) {\n if (!e.shiftKey || e.which !== 1 && e.button !== 1) {\n return false;\n } // Clear the deferred resetState if it hasn't executed yet, otherwise it\n // will interrupt the interaction and orphan a box element in the container.\n\n\n this._clearDeferredResetState();\n\n this._resetState();\n\n disableTextSelection();\n disableImageDrag();\n this._startPoint = this._map.mouseEventToContainerPoint(e);\n on(document, {\n contextmenu: stop,\n mousemove: this._onMouseMove,\n mouseup: this._onMouseUp,\n keydown: this._onKeyDown\n }, this);\n },\n _onMouseMove: function (e) {\n if (!this._moved) {\n this._moved = true;\n this._box = create$1('div', 'leaflet-zoom-box', this._container);\n addClass(this._container, 'leaflet-crosshair');\n\n this._map.fire('boxzoomstart');\n }\n\n this._point = this._map.mouseEventToContainerPoint(e);\n var bounds = new Bounds(this._point, this._startPoint),\n size = bounds.getSize();\n setPosition(this._box, bounds.min);\n this._box.style.width = size.x + 'px';\n this._box.style.height = size.y + 'px';\n },\n _finish: function () {\n if (this._moved) {\n remove(this._box);\n removeClass(this._container, 'leaflet-crosshair');\n }\n\n enableTextSelection();\n enableImageDrag();\n off(document, {\n contextmenu: stop,\n mousemove: this._onMouseMove,\n mouseup: this._onMouseUp,\n keydown: this._onKeyDown\n }, this);\n },\n _onMouseUp: function (e) {\n if (e.which !== 1 && e.button !== 1) {\n return;\n }\n\n this._finish();\n\n if (!this._moved) {\n return;\n } // Postpone to next JS tick so internal click event handling\n // still see it as \"moved\".\n\n\n this._clearDeferredResetState();\n\n this._resetStateTimeout = setTimeout(bind(this._resetState, this), 0);\n var bounds = new LatLngBounds(this._map.containerPointToLatLng(this._startPoint), this._map.containerPointToLatLng(this._point));\n\n this._map.fitBounds(bounds).fire('boxzoomend', {\n boxZoomBounds: bounds\n });\n },\n _onKeyDown: function (e) {\n if (e.keyCode === 27) {\n this._finish();\n }\n }\n }); // @section Handlers\n // @property boxZoom: Handler\n // Box (shift-drag with mouse) zoom handler.\n\n Map.addInitHook('addHandler', 'boxZoom', BoxZoom);\n /*\n * L.Handler.DoubleClickZoom is used to handle double-click zoom on the map, enabled by default.\n */\n // @namespace Map\n // @section Interaction Options\n\n Map.mergeOptions({\n // @option doubleClickZoom: Boolean|String = true\n // Whether the map can be zoomed in by double clicking on it and\n // zoomed out by double clicking while holding shift. If passed\n // `'center'`, double-click zoom will zoom to the center of the\n // view regardless of where the mouse was.\n doubleClickZoom: true\n });\n var DoubleClickZoom = Handler.extend({\n addHooks: function () {\n this._map.on('dblclick', this._onDoubleClick, this);\n },\n removeHooks: function () {\n this._map.off('dblclick', this._onDoubleClick, this);\n },\n _onDoubleClick: function (e) {\n var map = this._map,\n oldZoom = map.getZoom(),\n delta = map.options.zoomDelta,\n zoom = e.originalEvent.shiftKey ? oldZoom - delta : oldZoom + delta;\n\n if (map.options.doubleClickZoom === 'center') {\n map.setZoom(zoom);\n } else {\n map.setZoomAround(e.containerPoint, zoom);\n }\n }\n }); // @section Handlers\n //\n // Map properties include interaction handlers that allow you to control\n // interaction behavior in runtime, enabling or disabling certain features such\n // as dragging or touch zoom (see `Handler` methods). For example:\n //\n // ```js\n // map.doubleClickZoom.disable();\n // ```\n //\n // @property doubleClickZoom: Handler\n // Double click zoom handler.\n\n Map.addInitHook('addHandler', 'doubleClickZoom', DoubleClickZoom);\n /*\n * L.Handler.MapDrag is used to make the map draggable (with panning inertia), enabled by default.\n */\n // @namespace Map\n // @section Interaction Options\n\n Map.mergeOptions({\n // @option dragging: Boolean = true\n // Whether the map be draggable with mouse/touch or not.\n dragging: true,\n // @section Panning Inertia Options\n // @option inertia: Boolean = *\n // If enabled, panning of the map will have an inertia effect where\n // the map builds momentum while dragging and continues moving in\n // the same direction for some time. Feels especially nice on touch\n // devices. Enabled by default unless running on old Android devices.\n inertia: !android23,\n // @option inertiaDeceleration: Number = 3000\n // The rate with which the inertial movement slows down, in pixels/second².\n inertiaDeceleration: 3400,\n // px/s^2\n // @option inertiaMaxSpeed: Number = Infinity\n // Max speed of the inertial movement, in pixels/second.\n inertiaMaxSpeed: Infinity,\n // px/s\n // @option easeLinearity: Number = 0.2\n easeLinearity: 0.2,\n // TODO refactor, move to CRS\n // @option worldCopyJump: Boolean = false\n // With this option enabled, the map tracks when you pan to another \"copy\"\n // of the world and seamlessly jumps to the original one so that all overlays\n // like markers and vector layers are still visible.\n worldCopyJump: false,\n // @option maxBoundsViscosity: Number = 0.0\n // If `maxBounds` is set, this option will control how solid the bounds\n // are when dragging the map around. The default value of `0.0` allows the\n // user to drag outside the bounds at normal speed, higher values will\n // slow down map dragging outside bounds, and `1.0` makes the bounds fully\n // solid, preventing the user from dragging outside the bounds.\n maxBoundsViscosity: 0.0\n });\n var Drag = Handler.extend({\n addHooks: function () {\n if (!this._draggable) {\n var map = this._map;\n this._draggable = new Draggable(map._mapPane, map._container);\n\n this._draggable.on({\n dragstart: this._onDragStart,\n drag: this._onDrag,\n dragend: this._onDragEnd\n }, this);\n\n this._draggable.on('predrag', this._onPreDragLimit, this);\n\n if (map.options.worldCopyJump) {\n this._draggable.on('predrag', this._onPreDragWrap, this);\n\n map.on('zoomend', this._onZoomEnd, this);\n map.whenReady(this._onZoomEnd, this);\n }\n }\n\n addClass(this._map._container, 'leaflet-grab leaflet-touch-drag');\n\n this._draggable.enable();\n\n this._positions = [];\n this._times = [];\n },\n removeHooks: function () {\n removeClass(this._map._container, 'leaflet-grab');\n removeClass(this._map._container, 'leaflet-touch-drag');\n\n this._draggable.disable();\n },\n moved: function () {\n return this._draggable && this._draggable._moved;\n },\n moving: function () {\n return this._draggable && this._draggable._moving;\n },\n _onDragStart: function () {\n var map = this._map;\n\n map._stop();\n\n if (this._map.options.maxBounds && this._map.options.maxBoundsViscosity) {\n var bounds = toLatLngBounds(this._map.options.maxBounds);\n this._offsetLimit = toBounds(this._map.latLngToContainerPoint(bounds.getNorthWest()).multiplyBy(-1), this._map.latLngToContainerPoint(bounds.getSouthEast()).multiplyBy(-1).add(this._map.getSize()));\n this._viscosity = Math.min(1.0, Math.max(0.0, this._map.options.maxBoundsViscosity));\n } else {\n this._offsetLimit = null;\n }\n\n map.fire('movestart').fire('dragstart');\n\n if (map.options.inertia) {\n this._positions = [];\n this._times = [];\n }\n },\n _onDrag: function (e) {\n if (this._map.options.inertia) {\n var time = this._lastTime = +new Date(),\n pos = this._lastPos = this._draggable._absPos || this._draggable._newPos;\n\n this._positions.push(pos);\n\n this._times.push(time);\n\n this._prunePositions(time);\n }\n\n this._map.fire('move', e).fire('drag', e);\n },\n _prunePositions: function (time) {\n while (this._positions.length > 1 && time - this._times[0] > 50) {\n this._positions.shift();\n\n this._times.shift();\n }\n },\n _onZoomEnd: function () {\n var pxCenter = this._map.getSize().divideBy(2),\n pxWorldCenter = this._map.latLngToLayerPoint([0, 0]);\n\n this._initialWorldOffset = pxWorldCenter.subtract(pxCenter).x;\n this._worldWidth = this._map.getPixelWorldBounds().getSize().x;\n },\n _viscousLimit: function (value, threshold) {\n return value - (value - threshold) * this._viscosity;\n },\n _onPreDragLimit: function () {\n if (!this._viscosity || !this._offsetLimit) {\n return;\n }\n\n var offset = this._draggable._newPos.subtract(this._draggable._startPos);\n\n var limit = this._offsetLimit;\n\n if (offset.x < limit.min.x) {\n offset.x = this._viscousLimit(offset.x, limit.min.x);\n }\n\n if (offset.y < limit.min.y) {\n offset.y = this._viscousLimit(offset.y, limit.min.y);\n }\n\n if (offset.x > limit.max.x) {\n offset.x = this._viscousLimit(offset.x, limit.max.x);\n }\n\n if (offset.y > limit.max.y) {\n offset.y = this._viscousLimit(offset.y, limit.max.y);\n }\n\n this._draggable._newPos = this._draggable._startPos.add(offset);\n },\n _onPreDragWrap: function () {\n // TODO refactor to be able to adjust map pane position after zoom\n var worldWidth = this._worldWidth,\n halfWidth = Math.round(worldWidth / 2),\n dx = this._initialWorldOffset,\n x = this._draggable._newPos.x,\n newX1 = (x - halfWidth + dx) % worldWidth + halfWidth - dx,\n newX2 = (x + halfWidth + dx) % worldWidth - halfWidth - dx,\n newX = Math.abs(newX1 + dx) < Math.abs(newX2 + dx) ? newX1 : newX2;\n this._draggable._absPos = this._draggable._newPos.clone();\n this._draggable._newPos.x = newX;\n },\n _onDragEnd: function (e) {\n var map = this._map,\n options = map.options,\n noInertia = !options.inertia || this._times.length < 2;\n map.fire('dragend', e);\n\n if (noInertia) {\n map.fire('moveend');\n } else {\n this._prunePositions(+new Date());\n\n var direction = this._lastPos.subtract(this._positions[0]),\n duration = (this._lastTime - this._times[0]) / 1000,\n ease = options.easeLinearity,\n speedVector = direction.multiplyBy(ease / duration),\n speed = speedVector.distanceTo([0, 0]),\n limitedSpeed = Math.min(options.inertiaMaxSpeed, speed),\n limitedSpeedVector = speedVector.multiplyBy(limitedSpeed / speed),\n decelerationDuration = limitedSpeed / (options.inertiaDeceleration * ease),\n offset = limitedSpeedVector.multiplyBy(-decelerationDuration / 2).round();\n\n if (!offset.x && !offset.y) {\n map.fire('moveend');\n } else {\n offset = map._limitOffset(offset, map.options.maxBounds);\n requestAnimFrame(function () {\n map.panBy(offset, {\n duration: decelerationDuration,\n easeLinearity: ease,\n noMoveStart: true,\n animate: true\n });\n });\n }\n }\n }\n }); // @section Handlers\n // @property dragging: Handler\n // Map dragging handler (by both mouse and touch).\n\n Map.addInitHook('addHandler', 'dragging', Drag);\n /*\n * L.Map.Keyboard is handling keyboard interaction with the map, enabled by default.\n */\n // @namespace Map\n // @section Keyboard Navigation Options\n\n Map.mergeOptions({\n // @option keyboard: Boolean = true\n // Makes the map focusable and allows users to navigate the map with keyboard\n // arrows and `+`/`-` keys.\n keyboard: true,\n // @option keyboardPanDelta: Number = 80\n // Amount of pixels to pan when pressing an arrow key.\n keyboardPanDelta: 80\n });\n var Keyboard = Handler.extend({\n keyCodes: {\n left: [37],\n right: [39],\n down: [40],\n up: [38],\n zoomIn: [187, 107, 61, 171],\n zoomOut: [189, 109, 54, 173]\n },\n initialize: function (map) {\n this._map = map;\n\n this._setPanDelta(map.options.keyboardPanDelta);\n\n this._setZoomDelta(map.options.zoomDelta);\n },\n addHooks: function () {\n var container = this._map._container; // make the container focusable by tabbing\n\n if (container.tabIndex <= 0) {\n container.tabIndex = '0';\n }\n\n on(container, {\n focus: this._onFocus,\n blur: this._onBlur,\n mousedown: this._onMouseDown\n }, this);\n\n this._map.on({\n focus: this._addHooks,\n blur: this._removeHooks\n }, this);\n },\n removeHooks: function () {\n this._removeHooks();\n\n off(this._map._container, {\n focus: this._onFocus,\n blur: this._onBlur,\n mousedown: this._onMouseDown\n }, this);\n\n this._map.off({\n focus: this._addHooks,\n blur: this._removeHooks\n }, this);\n },\n _onMouseDown: function () {\n if (this._focused) {\n return;\n }\n\n var body = document.body,\n docEl = document.documentElement,\n top = body.scrollTop || docEl.scrollTop,\n left = body.scrollLeft || docEl.scrollLeft;\n\n this._map._container.focus();\n\n window.scrollTo(left, top);\n },\n _onFocus: function () {\n this._focused = true;\n\n this._map.fire('focus');\n },\n _onBlur: function () {\n this._focused = false;\n\n this._map.fire('blur');\n },\n _setPanDelta: function (panDelta) {\n var keys = this._panKeys = {},\n codes = this.keyCodes,\n i,\n len;\n\n for (i = 0, len = codes.left.length; i < len; i++) {\n keys[codes.left[i]] = [-1 * panDelta, 0];\n }\n\n for (i = 0, len = codes.right.length; i < len; i++) {\n keys[codes.right[i]] = [panDelta, 0];\n }\n\n for (i = 0, len = codes.down.length; i < len; i++) {\n keys[codes.down[i]] = [0, panDelta];\n }\n\n for (i = 0, len = codes.up.length; i < len; i++) {\n keys[codes.up[i]] = [0, -1 * panDelta];\n }\n },\n _setZoomDelta: function (zoomDelta) {\n var keys = this._zoomKeys = {},\n codes = this.keyCodes,\n i,\n len;\n\n for (i = 0, len = codes.zoomIn.length; i < len; i++) {\n keys[codes.zoomIn[i]] = zoomDelta;\n }\n\n for (i = 0, len = codes.zoomOut.length; i < len; i++) {\n keys[codes.zoomOut[i]] = -zoomDelta;\n }\n },\n _addHooks: function () {\n on(document, 'keydown', this._onKeyDown, this);\n },\n _removeHooks: function () {\n off(document, 'keydown', this._onKeyDown, this);\n },\n _onKeyDown: function (e) {\n if (e.altKey || e.ctrlKey || e.metaKey) {\n return;\n }\n\n var key = e.keyCode,\n map = this._map,\n offset;\n\n if (key in this._panKeys) {\n if (!map._panAnim || !map._panAnim._inProgress) {\n offset = this._panKeys[key];\n\n if (e.shiftKey) {\n offset = toPoint(offset).multiplyBy(3);\n }\n\n map.panBy(offset);\n\n if (map.options.maxBounds) {\n map.panInsideBounds(map.options.maxBounds);\n }\n }\n } else if (key in this._zoomKeys) {\n map.setZoom(map.getZoom() + (e.shiftKey ? 3 : 1) * this._zoomKeys[key]);\n } else if (key === 27 && map._popup && map._popup.options.closeOnEscapeKey) {\n map.closePopup();\n } else {\n return;\n }\n\n stop(e);\n }\n }); // @section Handlers\n // @section Handlers\n // @property keyboard: Handler\n // Keyboard navigation handler.\n\n Map.addInitHook('addHandler', 'keyboard', Keyboard);\n /*\n * L.Handler.ScrollWheelZoom is used by L.Map to enable mouse scroll wheel zoom on the map.\n */\n // @namespace Map\n // @section Interaction Options\n\n Map.mergeOptions({\n // @section Mousewheel options\n // @option scrollWheelZoom: Boolean|String = true\n // Whether the map can be zoomed by using the mouse wheel. If passed `'center'`,\n // it will zoom to the center of the view regardless of where the mouse was.\n scrollWheelZoom: true,\n // @option wheelDebounceTime: Number = 40\n // Limits the rate at which a wheel can fire (in milliseconds). By default\n // user can't zoom via wheel more often than once per 40 ms.\n wheelDebounceTime: 40,\n // @option wheelPxPerZoomLevel: Number = 60\n // How many scroll pixels (as reported by [L.DomEvent.getWheelDelta](#domevent-getwheeldelta))\n // mean a change of one full zoom level. Smaller values will make wheel-zooming\n // faster (and vice versa).\n wheelPxPerZoomLevel: 60\n });\n var ScrollWheelZoom = Handler.extend({\n addHooks: function () {\n on(this._map._container, 'mousewheel', this._onWheelScroll, this);\n this._delta = 0;\n },\n removeHooks: function () {\n off(this._map._container, 'mousewheel', this._onWheelScroll, this);\n },\n _onWheelScroll: function (e) {\n var delta = getWheelDelta(e);\n var debounce = this._map.options.wheelDebounceTime;\n this._delta += delta;\n this._lastMousePos = this._map.mouseEventToContainerPoint(e);\n\n if (!this._startTime) {\n this._startTime = +new Date();\n }\n\n var left = Math.max(debounce - (+new Date() - this._startTime), 0);\n clearTimeout(this._timer);\n this._timer = setTimeout(bind(this._performZoom, this), left);\n stop(e);\n },\n _performZoom: function () {\n var map = this._map,\n zoom = map.getZoom(),\n snap = this._map.options.zoomSnap || 0;\n\n map._stop(); // stop panning and fly animations if any\n // map the delta with a sigmoid function to -4..4 range leaning on -1..1\n\n\n var d2 = this._delta / (this._map.options.wheelPxPerZoomLevel * 4),\n d3 = 4 * Math.log(2 / (1 + Math.exp(-Math.abs(d2)))) / Math.LN2,\n d4 = snap ? Math.ceil(d3 / snap) * snap : d3,\n delta = map._limitZoom(zoom + (this._delta > 0 ? d4 : -d4)) - zoom;\n this._delta = 0;\n this._startTime = null;\n\n if (!delta) {\n return;\n }\n\n if (map.options.scrollWheelZoom === 'center') {\n map.setZoom(zoom + delta);\n } else {\n map.setZoomAround(this._lastMousePos, zoom + delta);\n }\n }\n }); // @section Handlers\n // @property scrollWheelZoom: Handler\n // Scroll wheel zoom handler.\n\n Map.addInitHook('addHandler', 'scrollWheelZoom', ScrollWheelZoom);\n /*\n * L.Map.Tap is used to enable mobile hacks like quick taps and long hold.\n */\n // @namespace Map\n // @section Interaction Options\n\n Map.mergeOptions({\n // @section Touch interaction options\n // @option tap: Boolean = true\n // Enables mobile hacks for supporting instant taps (fixing 200ms click\n // delay on iOS/Android) and touch holds (fired as `contextmenu` events).\n tap: true,\n // @option tapTolerance: Number = 15\n // The max number of pixels a user can shift his finger during touch\n // for it to be considered a valid tap.\n tapTolerance: 15\n });\n var Tap = Handler.extend({\n addHooks: function () {\n on(this._map._container, 'touchstart', this._onDown, this);\n },\n removeHooks: function () {\n off(this._map._container, 'touchstart', this._onDown, this);\n },\n _onDown: function (e) {\n if (!e.touches) {\n return;\n }\n\n preventDefault(e);\n this._fireClick = true; // don't simulate click or track longpress if more than 1 touch\n\n if (e.touches.length > 1) {\n this._fireClick = false;\n clearTimeout(this._holdTimeout);\n return;\n }\n\n var first = e.touches[0],\n el = first.target;\n this._startPos = this._newPos = new Point(first.clientX, first.clientY); // if touching a link, highlight it\n\n if (el.tagName && el.tagName.toLowerCase() === 'a') {\n addClass(el, 'leaflet-active');\n } // simulate long hold but setting a timeout\n\n\n this._holdTimeout = setTimeout(bind(function () {\n if (this._isTapValid()) {\n this._fireClick = false;\n\n this._onUp();\n\n this._simulateEvent('contextmenu', first);\n }\n }, this), 1000);\n\n this._simulateEvent('mousedown', first);\n\n on(document, {\n touchmove: this._onMove,\n touchend: this._onUp\n }, this);\n },\n _onUp: function (e) {\n clearTimeout(this._holdTimeout);\n off(document, {\n touchmove: this._onMove,\n touchend: this._onUp\n }, this);\n\n if (this._fireClick && e && e.changedTouches) {\n var first = e.changedTouches[0],\n el = first.target;\n\n if (el && el.tagName && el.tagName.toLowerCase() === 'a') {\n removeClass(el, 'leaflet-active');\n }\n\n this._simulateEvent('mouseup', first); // simulate click if the touch didn't move too much\n\n\n if (this._isTapValid()) {\n this._simulateEvent('click', first);\n }\n }\n },\n _isTapValid: function () {\n return this._newPos.distanceTo(this._startPos) <= this._map.options.tapTolerance;\n },\n _onMove: function (e) {\n var first = e.touches[0];\n this._newPos = new Point(first.clientX, first.clientY);\n\n this._simulateEvent('mousemove', first);\n },\n _simulateEvent: function (type, e) {\n var simulatedEvent = document.createEvent('MouseEvents');\n simulatedEvent._simulated = true;\n e.target._simulatedClick = true;\n simulatedEvent.initMouseEvent(type, true, true, window, 1, e.screenX, e.screenY, e.clientX, e.clientY, false, false, false, false, 0, null);\n e.target.dispatchEvent(simulatedEvent);\n }\n }); // @section Handlers\n // @property tap: Handler\n // Mobile touch hacks (quick tap and touch hold) handler.\n\n if (touch && !pointer) {\n Map.addInitHook('addHandler', 'tap', Tap);\n }\n /*\n * L.Handler.TouchZoom is used by L.Map to add pinch zoom on supported mobile browsers.\n */\n // @namespace Map\n // @section Interaction Options\n\n\n Map.mergeOptions({\n // @section Touch interaction options\n // @option touchZoom: Boolean|String = *\n // Whether the map can be zoomed by touch-dragging with two fingers. If\n // passed `'center'`, it will zoom to the center of the view regardless of\n // where the touch events (fingers) were. Enabled for touch-capable web\n // browsers except for old Androids.\n touchZoom: touch && !android23,\n // @option bounceAtZoomLimits: Boolean = true\n // Set it to false if you don't want the map to zoom beyond min/max zoom\n // and then bounce back when pinch-zooming.\n bounceAtZoomLimits: true\n });\n var TouchZoom = Handler.extend({\n addHooks: function () {\n addClass(this._map._container, 'leaflet-touch-zoom');\n on(this._map._container, 'touchstart', this._onTouchStart, this);\n },\n removeHooks: function () {\n removeClass(this._map._container, 'leaflet-touch-zoom');\n off(this._map._container, 'touchstart', this._onTouchStart, this);\n },\n _onTouchStart: function (e) {\n var map = this._map;\n\n if (!e.touches || e.touches.length !== 2 || map._animatingZoom || this._zooming) {\n return;\n }\n\n var p1 = map.mouseEventToContainerPoint(e.touches[0]),\n p2 = map.mouseEventToContainerPoint(e.touches[1]);\n this._centerPoint = map.getSize()._divideBy(2);\n this._startLatLng = map.containerPointToLatLng(this._centerPoint);\n\n if (map.options.touchZoom !== 'center') {\n this._pinchStartLatLng = map.containerPointToLatLng(p1.add(p2)._divideBy(2));\n }\n\n this._startDist = p1.distanceTo(p2);\n this._startZoom = map.getZoom();\n this._moved = false;\n this._zooming = true;\n\n map._stop();\n\n on(document, 'touchmove', this._onTouchMove, this);\n on(document, 'touchend', this._onTouchEnd, this);\n preventDefault(e);\n },\n _onTouchMove: function (e) {\n if (!e.touches || e.touches.length !== 2 || !this._zooming) {\n return;\n }\n\n var map = this._map,\n p1 = map.mouseEventToContainerPoint(e.touches[0]),\n p2 = map.mouseEventToContainerPoint(e.touches[1]),\n scale = p1.distanceTo(p2) / this._startDist;\n\n this._zoom = map.getScaleZoom(scale, this._startZoom);\n\n if (!map.options.bounceAtZoomLimits && (this._zoom < map.getMinZoom() && scale < 1 || this._zoom > map.getMaxZoom() && scale > 1)) {\n this._zoom = map._limitZoom(this._zoom);\n }\n\n if (map.options.touchZoom === 'center') {\n this._center = this._startLatLng;\n\n if (scale === 1) {\n return;\n }\n } else {\n // Get delta from pinch to center, so centerLatLng is delta applied to initial pinchLatLng\n var delta = p1._add(p2)._divideBy(2)._subtract(this._centerPoint);\n\n if (scale === 1 && delta.x === 0 && delta.y === 0) {\n return;\n }\n\n this._center = map.unproject(map.project(this._pinchStartLatLng, this._zoom).subtract(delta), this._zoom);\n }\n\n if (!this._moved) {\n map._moveStart(true, false);\n\n this._moved = true;\n }\n\n cancelAnimFrame(this._animRequest);\n var moveFn = bind(map._move, map, this._center, this._zoom, {\n pinch: true,\n round: false\n });\n this._animRequest = requestAnimFrame(moveFn, this, true);\n preventDefault(e);\n },\n _onTouchEnd: function () {\n if (!this._moved || !this._zooming) {\n this._zooming = false;\n return;\n }\n\n this._zooming = false;\n cancelAnimFrame(this._animRequest);\n off(document, 'touchmove', this._onTouchMove);\n off(document, 'touchend', this._onTouchEnd); // Pinch updates GridLayers' levels only when zoomSnap is off, so zoomSnap becomes noUpdate.\n\n if (this._map.options.zoomAnimation) {\n this._map._animateZoom(this._center, this._map._limitZoom(this._zoom), true, this._map.options.zoomSnap);\n } else {\n this._map._resetView(this._center, this._map._limitZoom(this._zoom));\n }\n }\n }); // @section Handlers\n // @property touchZoom: Handler\n // Touch zoom handler.\n\n Map.addInitHook('addHandler', 'touchZoom', TouchZoom);\n Map.BoxZoom = BoxZoom;\n Map.DoubleClickZoom = DoubleClickZoom;\n Map.Drag = Drag;\n Map.Keyboard = Keyboard;\n Map.ScrollWheelZoom = ScrollWheelZoom;\n Map.Tap = Tap;\n Map.TouchZoom = TouchZoom;\n Object.freeze = freeze;\n exports.version = version;\n exports.Control = Control;\n exports.control = control;\n exports.Browser = Browser;\n exports.Evented = Evented;\n exports.Mixin = Mixin;\n exports.Util = Util;\n exports.Class = Class;\n exports.Handler = Handler;\n exports.extend = extend;\n exports.bind = bind;\n exports.stamp = stamp;\n exports.setOptions = setOptions;\n exports.DomEvent = DomEvent;\n exports.DomUtil = DomUtil;\n exports.PosAnimation = PosAnimation;\n exports.Draggable = Draggable;\n exports.LineUtil = LineUtil;\n exports.PolyUtil = PolyUtil;\n exports.Point = Point;\n exports.point = toPoint;\n exports.Bounds = Bounds;\n exports.bounds = toBounds;\n exports.Transformation = Transformation;\n exports.transformation = toTransformation;\n exports.Projection = index;\n exports.LatLng = LatLng;\n exports.latLng = toLatLng;\n exports.LatLngBounds = LatLngBounds;\n exports.latLngBounds = toLatLngBounds;\n exports.CRS = CRS;\n exports.GeoJSON = GeoJSON;\n exports.geoJSON = geoJSON;\n exports.geoJson = geoJson;\n exports.Layer = Layer;\n exports.LayerGroup = LayerGroup;\n exports.layerGroup = layerGroup;\n exports.FeatureGroup = FeatureGroup;\n exports.featureGroup = featureGroup;\n exports.ImageOverlay = ImageOverlay;\n exports.imageOverlay = imageOverlay;\n exports.VideoOverlay = VideoOverlay;\n exports.videoOverlay = videoOverlay;\n exports.DivOverlay = DivOverlay;\n exports.Popup = Popup;\n exports.popup = popup;\n exports.Tooltip = Tooltip;\n exports.tooltip = tooltip;\n exports.Icon = Icon;\n exports.icon = icon;\n exports.DivIcon = DivIcon;\n exports.divIcon = divIcon;\n exports.Marker = Marker;\n exports.marker = marker;\n exports.TileLayer = TileLayer;\n exports.tileLayer = tileLayer;\n exports.GridLayer = GridLayer;\n exports.gridLayer = gridLayer;\n exports.SVG = SVG;\n exports.svg = svg$1;\n exports.Renderer = Renderer;\n exports.Canvas = Canvas;\n exports.canvas = canvas$1;\n exports.Path = Path;\n exports.CircleMarker = CircleMarker;\n exports.circleMarker = circleMarker;\n exports.Circle = Circle;\n exports.circle = circle;\n exports.Polyline = Polyline;\n exports.polyline = polyline;\n exports.Polygon = Polygon;\n exports.polygon = polygon;\n exports.Rectangle = Rectangle;\n exports.rectangle = rectangle;\n exports.Map = Map;\n exports.map = createMap;\n var oldL = window.L;\n\n exports.noConflict = function () {\n window.L = oldL;\n return this;\n }; // Always export us to window global (see #2364)\n\n\n window.L = exports;\n});\n\n//# sourceURL=webpack:///./node_modules/leaflet/dist/leaflet-src.js?");
/***/ }),
/***/ "./node_modules/leaflet/dist/leaflet.css":
/*!***********************************************!*\
!*** ./node_modules/leaflet/dist/leaflet.css ***!
\***********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("\nvar content = __webpack_require__(/*! !../../css-loader/dist/cjs.js!./leaflet.css */ \"./node_modules/css-loader/dist/cjs.js!./node_modules/leaflet/dist/leaflet.css\");\n\nif(typeof content === 'string') content = [[module.i, content, '']];\n\nvar transform;\nvar insertInto;\n\n\n\nvar options = {\"hmr\":true}\n\noptions.transform = transform\noptions.insertInto = undefined;\n\nvar update = __webpack_require__(/*! ../../style-loader/lib/addStyles.js */ \"./node_modules/style-loader/lib/addStyles.js\")(content, options);\n\nif(content.locals) module.exports = content.locals;\n\nif(false) {}\n\n//# sourceURL=webpack:///./node_modules/leaflet/dist/leaflet.css?");
/***/ }),
/***/ "./node_modules/mobx-preact/lib/index.module.js":
/*!******************************************************!*\
!*** ./node_modules/mobx-preact/lib/index.module.js ***!
\******************************************************/
/*! exports provided: observer, Observer, useStaticRendering, connect, inject, Provider */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"observer\", function() { return observer; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Observer\", function() { return Observer; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"useStaticRendering\", function() { return useStaticRendering; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"connect\", function() { return connect; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"inject\", function() { return inject; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Provider\", function() { return Provider; });\n/* harmony import */ var preact__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! preact */ \"./node_modules/preact/dist/preact.mjs\");\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/lib/mobx.module.js\");\n\n\n\nfunction isStateless(component) {\n // `function() {}` has prototype, but `() => {}` doesn't\n // `() => {}` via Babel has prototype too.\n return !(component.prototype && component.prototype.render) && !preact__WEBPACK_IMPORTED_MODULE_0__[\"Component\"].isPrototypeOf(component);\n}\n\nfunction makeDisplayName(component) {\n var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\n _ref$prefix = _ref.prefix,\n prefix = _ref$prefix === undefined ? '' : _ref$prefix,\n _ref$suffix = _ref.suffix,\n suffix = _ref$suffix === undefined ? '' : _ref$suffix;\n\n var displayName = component.displayName || component.name || component.constructor && component.constructor.name || '<component>';\n return prefix + displayName + suffix;\n}\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) {\n return typeof obj;\n} : function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n};\n\nvar classCallCheck = function (instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n};\n\nvar createClass = function () {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n}();\n\nvar inherits = function (subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass);\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;\n};\n\nvar possibleConstructorReturn = function (self, call) {\n if (!self) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self;\n};\n\nvar isUsingStaticRendering = false;\nvar logger = console; // eslint-disable-line no-console\n\nfunction useStaticRendering(useStaticRendering) {\n isUsingStaticRendering = useStaticRendering;\n}\n/**\n Workaround\n\n allowStateChanges from mobX must be patched so that props, state and args are passed to the render() function\n */\n\n\nfunction allowStateChangesStart(allowStateChanges) {\n var prev = Object(mobx__WEBPACK_IMPORTED_MODULE_1__[\"_getGlobalState\"])().allowStateChanges;\n\n Object(mobx__WEBPACK_IMPORTED_MODULE_1__[\"_getGlobalState\"])().allowStateChanges = allowStateChanges;\n return prev;\n}\n\nfunction allowStateChangesEnd(prev) {\n Object(mobx__WEBPACK_IMPORTED_MODULE_1__[\"_getGlobalState\"])().allowStateChanges = prev;\n}\n\nfunction allowStateChanges(allowStateChanges, func, props, state, context) {\n var prev = allowStateChangesStart(allowStateChanges);\n var res = void 0;\n\n try {\n res = func(props, state, context);\n } finally {\n allowStateChangesEnd(prev);\n }\n\n return res;\n}\n/**\n * Utilities\n */\n\n\nfunction patch(target, funcName) {\n var runMixinFirst = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n var base = target[funcName];\n var mixinFunc = reactiveMixin[funcName];\n var f = !base ? mixinFunc : runMixinFirst === true ? function () {\n mixinFunc.apply(this, arguments);\n base.apply(this, arguments);\n } : function () {\n base.apply(this, arguments);\n mixinFunc.apply(this, arguments);\n }; // MWE: ideally we freeze here to protect against accidental overwrites in component instances, see #195\n // ...but that breaks react-hot-loader, see #231...\n\n target[funcName] = f;\n}\n\nfunction isObjectShallowModified(prev, next) {\n if (null == prev || null == next || (typeof prev === 'undefined' ? 'undefined' : _typeof(prev)) !== 'object' || (typeof next === 'undefined' ? 'undefined' : _typeof(next)) !== 'object') {\n return prev !== next;\n }\n\n var keys = Object.keys(prev);\n\n if (keys.length !== Object.keys(next).length) {\n return true;\n }\n\n var key = void 0;\n\n for (var i = keys.length - 1; key = keys[i]; i--) {\n if (next[key] !== prev[key]) {\n return true;\n }\n }\n\n return false;\n}\n/**\n * ReactiveMixin\n */\n\n\nvar reactiveMixin = {\n componentWillMount: function componentWillMount() {\n var _this = this;\n\n if (isUsingStaticRendering === true) {\n return;\n } // Generate friendly name for debugging\n\n\n var initialName = makeDisplayName(this);\n /**\n * If props are shallowly modified, react will render anyway,\n * so atom.reportChanged() should not result in yet another re-render\n */\n\n var skipRender = false;\n /**\n * forceUpdate will re-assign this.props. We don't want that to cause a loop,\n * so detect these changes\n */\n\n var isForcingUpdate = false;\n\n function makePropertyObservableReference(propName) {\n var valueHolder = this[propName];\n var atom = Object(mobx__WEBPACK_IMPORTED_MODULE_1__[\"createAtom\"])('reactive ' + propName);\n Object.defineProperty(this, propName, {\n configurable: true,\n enumerable: true,\n get: function get$$1() {\n atom.reportObserved();\n return valueHolder;\n },\n set: function set$$1(v) {\n if (!isForcingUpdate && isObjectShallowModified(valueHolder, v)) {\n valueHolder = v;\n skipRender = true;\n atom.reportChanged();\n skipRender = false;\n } else {\n valueHolder = v;\n }\n }\n });\n } // make this.props an observable reference, see #124\n\n\n makePropertyObservableReference.call(this, 'props'); // make state an observable reference\n\n makePropertyObservableReference.call(this, 'state'); // wire up reactive render\n\n var baseRender = this.render.bind(this);\n var reaction = null;\n var isRenderingPending = false;\n\n var initialRender = function initialRender() {\n reaction = new mobx__WEBPACK_IMPORTED_MODULE_1__[\"Reaction\"](initialName + '.render()', function () {\n if (!isRenderingPending) {\n // N.B. Getting here *before mounting* means that a component constructor has side effects (see the relevant test in misc.js)\n // This unidiomatic React usage but React will correctly warn about this so we continue as usual\n // See #85 / Pull #44\n isRenderingPending = true;\n\n if (typeof _this.componentWillReact === 'function') {\n _this.componentWillReact();\n } // TODO: wrap in action?\n\n\n if (_this.__$mobxIsUnmounted !== true) {\n // If we are unmounted at this point, componentWillReact() had a side effect causing the component to unmounted\n // TODO: remove this check? Then react will properly warn about the fact that this should not happen? See #73\n // However, people also claim this migth happen during unit tests..\n var hasError = true;\n\n try {\n isForcingUpdate = true;\n\n if (!skipRender) {\n preact__WEBPACK_IMPORTED_MODULE_0__[\"Component\"].prototype.forceUpdate.call(_this);\n }\n\n hasError = false;\n } finally {\n isForcingUpdate = false;\n\n if (hasError) {\n reaction.dispose();\n }\n }\n }\n }\n });\n reaction.reactComponent = _this;\n reactiveRender.$mobx = reaction;\n _this.render = reactiveRender;\n return reactiveRender(_this.props, _this.state, _this.context);\n };\n\n var reactiveRender = function reactiveRender(props, state, context) {\n isRenderingPending = false;\n var exception = undefined;\n var rendering = undefined;\n reaction.track(function () {\n try {\n rendering = allowStateChanges(false, baseRender, props, state, context);\n } catch (e) {\n exception = e;\n }\n });\n\n if (exception) {\n throw exception;\n }\n\n return rendering;\n };\n\n this.render = initialRender;\n },\n componentWillUnmount: function componentWillUnmount() {\n if (isUsingStaticRendering === true) {\n return;\n }\n\n this.render.$mobx && this.render.$mobx.dispose();\n this.__$mobxIsUnmounted = true;\n },\n componentDidMount: function componentDidMount() {},\n componentDidUpdate: function componentDidUpdate() {},\n shouldComponentUpdate: function shouldComponentUpdate(nextProps, nextState) {\n if (isUsingStaticRendering) {\n logger.warn('[mobx-preact] It seems that a re-rendering of a React component is triggered while in static (server-side) mode. Please make sure components are rendered only once server-side.');\n } // update on any state changes (as is the default)\n\n\n if (this.state !== nextState) {\n return true;\n } // update if props are shallowly not equal, inspired by PureRenderMixin\n // we could return just 'false' here, and avoid the `skipRender` checks etc\n // however, it is nicer if lifecycle events are triggered like usually,\n // so we return true here if props are shallowly modified.\n\n\n return isObjectShallowModified(this.props, nextProps);\n }\n};\n/**\n * Observer function / decorator\n */\n\nfunction observer(componentClass) {\n if (arguments.length > 1) {\n logger.warn('Mobx observer: Using observer to inject stores is not supported. Use `@connect([\"store1\", \"store2\"]) ComponentClass instead or preferably, use `@inject(\"store1\", \"store2\") @observer ComponentClass` or `inject(\"store1\", \"store2\")(observer(componentClass))``');\n }\n\n if (componentClass.isMobxInjector === true) {\n logger.warn('Mobx observer: You are trying to use \\'observer\\' on a component that already has \\'inject\\'. Please apply \\'observer\\' before applying \\'inject\\'');\n } // Stateless function component:\n\n\n if (isStateless(componentClass)) {\n var _class, _temp;\n\n return observer((_temp = _class = function (_Component) {\n inherits(_class, _Component);\n\n function _class() {\n classCallCheck(this, _class);\n return possibleConstructorReturn(this, (_class.__proto__ || Object.getPrototypeOf(_class)).apply(this, arguments));\n }\n\n createClass(_class, [{\n key: 'render',\n value: function render() {\n return componentClass.call(this, this.props, this.context);\n }\n }]);\n return _class;\n }(preact__WEBPACK_IMPORTED_MODULE_0__[\"Component\"]), _class.displayName = makeDisplayName(componentClass), _temp));\n }\n\n if (!componentClass) {\n throw new Error('Please pass a valid component to \\'observer\\'');\n }\n\n var target = componentClass.prototype || componentClass;\n mixinLifecycleEvents(target);\n componentClass.isMobXReactObserver = true;\n return componentClass;\n}\n\nfunction mixinLifecycleEvents(target) {\n patch(target, 'componentWillMount', true);\n patch(target, 'componentDidMount');\n\n if (!target.shouldComponentUpdate) {\n target.shouldComponentUpdate = reactiveMixin.shouldComponentUpdate;\n }\n}\n\nvar Observer = observer(function (_ref) {\n var children = _ref.children;\n return children[0]();\n});\nObserver.displayName = 'Observer';\nvar commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\n\nfunction createCommonjsModule(fn, module) {\n return module = {\n exports: {}\n }, fn(module, module.exports), module.exports;\n}\n\nvar hoistNonReactStatics = createCommonjsModule(function (module, exports) {\n /**\n * Copyright 2015, Yahoo! Inc.\n * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.\n */\n (function (global, factory) {\n module.exports = factory();\n })(commonjsGlobal, function () {\n var REACT_STATICS = {\n childContextTypes: true,\n contextTypes: true,\n defaultProps: true,\n displayName: true,\n getDefaultProps: true,\n getDerivedStateFromProps: true,\n mixins: true,\n propTypes: true,\n type: true\n };\n var KNOWN_STATICS = {\n name: true,\n length: true,\n prototype: true,\n caller: true,\n callee: true,\n arguments: true,\n arity: true\n };\n var defineProperty = Object.defineProperty;\n var getOwnPropertyNames = Object.getOwnPropertyNames;\n var getOwnPropertySymbols = Object.getOwnPropertySymbols;\n var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n var getPrototypeOf = Object.getPrototypeOf;\n var objectPrototype = getPrototypeOf && getPrototypeOf(Object);\n return function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {\n if (typeof sourceComponent !== 'string') {\n // don't hoist over string (html) components\n if (objectPrototype) {\n var inheritedComponent = getPrototypeOf(sourceComponent);\n\n if (inheritedComponent && inheritedComponent !== objectPrototype) {\n hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);\n }\n }\n\n var keys = getOwnPropertyNames(sourceComponent);\n\n if (getOwnPropertySymbols) {\n keys = keys.concat(getOwnPropertySymbols(sourceComponent));\n }\n\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n\n if (!REACT_STATICS[key] && !KNOWN_STATICS[key] && (!blacklist || !blacklist[key])) {\n var descriptor = getOwnPropertyDescriptor(sourceComponent, key);\n\n try {\n // Avoid failures from read-only properties\n defineProperty(targetComponent, key, descriptor);\n } catch (e) {}\n }\n }\n\n return targetComponent;\n }\n\n return targetComponent;\n };\n });\n});\nvar proxiedInjectorProps = {\n isMobxInjector: {\n value: true,\n writable: true,\n configurable: true,\n enumerable: true\n }\n};\n/**\n * Store Injection\n */\n\nfunction createStoreInjector(grabStoresFn, component, injectNames) {\n var _class, _temp;\n\n var prefix = 'inject-';\n var suffix = injectNames ? '-with-' + injectNames : '';\n var displayName = makeDisplayName(component, {\n prefix: prefix,\n suffix: suffix\n });\n var Injector = (_temp = _class = function (_Component) {\n inherits(Injector, _Component);\n\n function Injector() {\n classCallCheck(this, Injector);\n return possibleConstructorReturn(this, (Injector.__proto__ || Object.getPrototypeOf(Injector)).apply(this, arguments));\n }\n\n createClass(Injector, [{\n key: 'render',\n value: function render() {\n // Optimization: it might be more efficient to apply the mapper function *outside* the render method\n // (if the mapper is a function), that could avoid expensive(?) re-rendering of the injector component\n // See this test: 'using a custom injector is not too reactive' in inject.js\n var newProps = {};\n\n for (var key in this.props) {\n if (this.props.hasOwnProperty(key)) {\n newProps[key] = this.props[key];\n }\n }\n\n var additionalProps = grabStoresFn(this.context.mobxStores || {}, newProps, this.context) || {};\n\n for (var _key in additionalProps) {\n newProps[_key] = additionalProps[_key];\n }\n\n return Object(preact__WEBPACK_IMPORTED_MODULE_0__[\"h\"])(component, newProps);\n }\n }]);\n return Injector;\n }(preact__WEBPACK_IMPORTED_MODULE_0__[\"Component\"]), _class.displayName = displayName, _temp); // Static fields from component should be visible on the generated Injector\n\n hoistNonReactStatics(Injector, component);\n Injector.wrappedComponent = component;\n Object.defineProperties(Injector, proxiedInjectorProps);\n return Injector;\n}\n\nfunction grabStoresByName(storeNames) {\n return function (baseStores, nextProps) {\n storeNames.forEach(function (storeName) {\n // prefer props over stores\n if (storeName in nextProps) {\n return;\n }\n\n if (!(storeName in baseStores)) {\n throw new Error('MobX injector: Store \\'' + storeName + '\\' is not available! Make sure it is provided by some Provider');\n }\n\n nextProps[storeName] = baseStores[storeName];\n });\n return nextProps;\n };\n}\n/**\n * higher order component that injects stores to a child.\n * takes either a varargs list of strings, which are stores read from the context,\n * or a function that manually maps the available stores from the context to props:\n * storesToProps(mobxStores, props, context) => newProps\n */\n\n\nfunction inject()\n/* fn(stores, nextProps) or ...storeNames */\n{\n var grabStoresFn = void 0;\n\n if (typeof arguments[0] === 'function') {\n grabStoresFn = arguments[0];\n return function (componentClass) {\n var injected = createStoreInjector(grabStoresFn, componentClass);\n injected.isMobxInjector = false; // suppress warning\n // mark the Injector as observer, to make it react to expressions in `grabStoresFn`,\n // see #111\n\n injected = observer(injected);\n injected.isMobxInjector = true; // restore warning\n\n return injected;\n };\n } else {\n var storeNames = [];\n\n for (var i = 0; i < arguments.length; i++) {\n storeNames[i] = arguments[i];\n }\n\n grabStoresFn = grabStoresByName(storeNames);\n return function (componentClass) {\n return createStoreInjector(grabStoresFn, componentClass, storeNames.join('-'));\n };\n }\n}\n\nfunction connect(arg1, arg2) {\n if (typeof arg1 === 'string') {\n throw new Error('Store names should be provided as array');\n }\n\n if (Array.isArray(arg1)) {\n if (!arg2) {\n // invoked as decorator\n return function (componentClass) {\n return connect(arg1, componentClass);\n };\n } else {\n return inject.apply(null, arg1)(connect(arg2));\n }\n }\n\n return observer(arg1);\n}\n\nvar specialReactKeys = {\n children: true,\n key: true,\n ref: true\n};\nvar logger$1 = console; // eslint-disable-line no-console\n\nvar Provider = function (_Component) {\n inherits(Provider, _Component);\n\n function Provider() {\n classCallCheck(this, Provider);\n return possibleConstructorReturn(this, (Provider.__proto__ || Object.getPrototypeOf(Provider)).apply(this, arguments));\n }\n\n createClass(Provider, [{\n key: 'render',\n value: function render(_ref) {\n var children = _ref.children;\n return children.length > 1 ? Object(preact__WEBPACK_IMPORTED_MODULE_0__[\"h\"])('div', null, ' ', children, ' ') : children[0];\n }\n }, {\n key: 'getChildContext',\n value: function getChildContext() {\n var stores = {}; // inherit stores\n\n var baseStores = this.context.mobxStores;\n\n if (baseStores) {\n for (var key in baseStores) {\n stores[key] = baseStores[key];\n }\n } // add own stores\n\n\n for (var _key in this.props) {\n if (!specialReactKeys[_key] && _key !== 'suppressChangedStoreWarning') {\n stores[_key] = this.props[_key];\n }\n }\n\n return {\n mobxStores: stores\n };\n }\n }, {\n key: 'componentWillReceiveProps',\n value: function componentWillReceiveProps(nextProps) {\n // Maybe this warning is too aggressive?\n if (Object.keys(nextProps).length !== Object.keys(this.props).length) {\n logger$1.warn('MobX Provider: The set of provided stores has changed. Please avoid changing stores as the change might not propagate to all children');\n }\n\n if (!nextProps.suppressChangedStoreWarning) {\n for (var key in nextProps) {\n if (!specialReactKeys[key] && this.props[key] !== nextProps[key]) {\n logger$1.warn('MobX Provider: Provided store \\'' + key + '\\' has changed. Please avoid replacing stores as the change might not propagate to all children');\n }\n }\n }\n }\n }]);\n return Provider;\n}(preact__WEBPACK_IMPORTED_MODULE_0__[\"Component\"]);\n\nif (!preact__WEBPACK_IMPORTED_MODULE_0__[\"Component\"]) {\n throw new Error('mobx-preact requires Preact to be available');\n}\n\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\")))\n\n//# sourceURL=webpack:///./node_modules/mobx-preact/lib/index.module.js?");
/***/ }),
/***/ "./node_modules/mobx/lib/mobx.module.js":
/*!**********************************************!*\
!*** ./node_modules/mobx/lib/mobx.module.js ***!
\**********************************************/
/*! exports provided: Reaction, untracked, IDerivationState, createAtom, spy, comparer, isObservableObject, isBoxedObservable, isObservableArray, ObservableMap, isObservableMap, ObservableSet, isObservableSet, transaction, observable, computed, isObservable, isObservableProp, isComputed, isComputedProp, extendObservable, observe, intercept, autorun, reaction, when, action, isAction, runInAction, keys, values, entries, set, remove, has, get, decorate, configure, onBecomeObserved, onBecomeUnobserved, flow, toJS, trace, getDependencyTree, getObserverTree, _resetGlobalState, _getGlobalState, getDebugName, getAtom, _getAdministration, _allowStateChanges, _allowStateChangesInsideComputed, isArrayLike, $mobx, _isComputingDerivation, onReactionError, _interceptReads */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* WEBPACK VAR INJECTION */(function(process, global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Reaction\", function() { return Reaction$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"untracked\", function() { return untracked$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"IDerivationState\", function() { return IDerivationState; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"createAtom\", function() { return createAtom$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"spy\", function() { return spy$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"comparer\", function() { return comparer$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isObservableObject\", function() { return isObservableObject$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isBoxedObservable\", function() { return isObservableValue$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isObservableArray\", function() { return isObservableArray$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ObservableMap\", function() { return ObservableMap$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isObservableMap\", function() { return isObservableMap$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ObservableSet\", function() { return ObservableSet$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isObservableSet\", function() { return isObservableSet$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"transaction\", function() { return transaction$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"observable\", function() { return observable$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"computed\", function() { return computed$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isObservable\", function() { return isObservable$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isObservableProp\", function() { return isObservableProp$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isComputed\", function() { return isComputed$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isComputedProp\", function() { return isComputedProp$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"extendObservable\", function() { return extendObservable$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"observe\", function() { return observe$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"intercept\", function() { return intercept$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"autorun\", function() { return autorun$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"reaction\", function() { return reaction$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"when\", function() { return when$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"action\", function() { return action$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isAction\", function() { return isAction$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"runInAction\", function() { return runInAction$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"keys\", function() { return keys$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"values\", function() { return values$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"entries\", function() { return entries$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"set\", function() { return set$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"remove\", function() { return remove$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"has\", function() { return has$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"get\", function() { return get$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"decorate\", function() { return decorate$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"configure\", function() { return configure$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"onBecomeObserved\", function() { return onBecomeObserved$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"onBecomeUnobserved\", function() { return onBecomeUnobserved$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"flow\", function() { return flow$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"toJS\", function() { return toJS$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"trace\", function() { return trace$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getDependencyTree\", function() { return getDependencyTree$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getObserverTree\", function() { return getObserverTree$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_resetGlobalState\", function() { return resetGlobalState$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_getGlobalState\", function() { return getGlobalState$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getDebugName\", function() { return getDebugName$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getAtom\", function() { return getAtom$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_getAdministration\", function() { return getAdministration$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_allowStateChanges\", function() { return allowStateChanges$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_allowStateChangesInsideComputed\", function() { return allowStateChangesInsideComputed$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"isArrayLike\", function() { return isArrayLike$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"$mobx\", function() { return $mobx$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_isComputingDerivation\", function() { return isComputingDerivation$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"onReactionError\", function() { return onReactionError$$1; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_interceptReads\", function() { return interceptReads$$1; });\n/** MobX - (c) Michel Weststrate 2015 - 2018 - MIT Licensed */\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\n\n/* global Reflect, Promise */\nvar extendStatics = Object.setPrototypeOf || {\n __proto__: []\n} instanceof Array && function (d, b) {\n d.__proto__ = b;\n} || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n};\n\nfunction __extends(d, b) {\n extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nvar __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n\n return t;\n};\n\nfunction __values(o) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator],\n i = 0;\n if (m) return m.call(o);\n return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return {\n value: o && o[i++],\n done: !o\n };\n }\n };\n}\n\nfunction __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o),\n r,\n ar = [],\n e;\n\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n } catch (error) {\n e = {\n error: error\n };\n } finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n\n return ar;\n}\n\nfunction __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));\n\n return ar;\n}\n\nvar OBFUSCATED_ERROR$$1 = \"An invariant failed, however the error is obfuscated because this is an production build.\";\nvar EMPTY_ARRAY$$1 = [];\nObject.freeze(EMPTY_ARRAY$$1);\nvar EMPTY_OBJECT$$1 = {};\nObject.freeze(EMPTY_OBJECT$$1);\n\nfunction getNextId$$1() {\n return ++globalState$$1.mobxGuid;\n}\n\nfunction fail$$1(message) {\n invariant$$1(false, message);\n throw \"X\"; // unreachable\n}\n\nfunction invariant$$1(check, message) {\n if (!check) throw new Error(\"[mobx] \" + (message || OBFUSCATED_ERROR$$1));\n}\n/**\n * Prints a deprecation message, but only one time.\n * Returns false if the deprecated message was already printed before\n */\n\n\nvar deprecatedMessages = [];\n\nfunction deprecated$$1(msg, thing) {\n if (false) {}\n\n if (thing) {\n return deprecated$$1(\"'\" + msg + \"', use '\" + thing + \"' instead.\");\n }\n\n if (deprecatedMessages.indexOf(msg) !== -1) return false;\n deprecatedMessages.push(msg);\n console.error(\"[mobx] Deprecated: \" + msg);\n return true;\n}\n/**\n * Makes sure that the provided function is invoked at most once.\n */\n\n\nfunction once$$1(func) {\n var invoked = false;\n return function () {\n if (invoked) return;\n invoked = true;\n return func.apply(this, arguments);\n };\n}\n\nvar noop$$1 = function () {};\n\nfunction unique$$1(list) {\n var res = [];\n list.forEach(function (item) {\n if (res.indexOf(item) === -1) res.push(item);\n });\n return res;\n}\n\nfunction isObject$$1(value) {\n return value !== null && typeof value === \"object\";\n}\n\nfunction isPlainObject$$1(value) {\n if (value === null || typeof value !== \"object\") return false;\n var proto = Object.getPrototypeOf(value);\n return proto === Object.prototype || proto === null;\n}\n\nfunction addHiddenProp$$1(object, propName, value) {\n Object.defineProperty(object, propName, {\n enumerable: false,\n writable: true,\n configurable: true,\n value: value\n });\n}\n\nfunction addHiddenFinalProp$$1(object, propName, value) {\n Object.defineProperty(object, propName, {\n enumerable: false,\n writable: false,\n configurable: true,\n value: value\n });\n}\n\nfunction isPropertyConfigurable$$1(object, prop) {\n var descriptor = Object.getOwnPropertyDescriptor(object, prop);\n return !descriptor || descriptor.configurable !== false && descriptor.writable !== false;\n}\n\nfunction assertPropertyConfigurable$$1(object, prop) {\n if ( true && !isPropertyConfigurable$$1(object, prop)) fail$$1(\"Cannot make property '\" + prop.toString() + \"' observable, it is not configurable and writable in the target object\");\n}\n\nfunction createInstanceofPredicate$$1(name, clazz) {\n var propName = \"isMobX\" + name;\n clazz.prototype[propName] = true;\n return function (x) {\n return isObject$$1(x) && x[propName] === true;\n };\n}\n/**\n * Returns whether the argument is an array, disregarding observability.\n */\n\n\nfunction isArrayLike$$1(x) {\n return Array.isArray(x) || isObservableArray$$1(x);\n}\n\nfunction isES6Map$$1(thing) {\n return thing instanceof Map;\n}\n\nfunction isES6Set$$1(thing) {\n return thing instanceof Set;\n}\n\nfunction getMapLikeKeys$$1(map) {\n if (isPlainObject$$1(map)) return Object.keys(map);\n if (Array.isArray(map)) return map.map(function (_a) {\n var _b = __read(_a, 1),\n key = _b[0];\n\n return key;\n });\n if (isES6Map$$1(map) || isObservableMap$$1(map)) return Array.from(map.keys());\n return fail$$1(\"Cannot get keys from '\" + map + \"'\");\n}\n\nfunction toPrimitive$$1(value) {\n return value === null ? null : typeof value === \"object\" ? \"\" + value : value;\n}\n\nvar $mobx$$1 = Symbol(\"mobx administration\");\n\nvar Atom$$1 =\n/** @class */\nfunction () {\n /**\n * Create a new atom. For debugging purposes it is recommended to give it a name.\n * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.\n */\n function Atom$$1(name) {\n if (name === void 0) {\n name = \"Atom@\" + getNextId$$1();\n }\n\n this.name = name;\n this.isPendingUnobservation = false; // for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed\n\n this.isBeingObserved = false;\n this.observers = new Set();\n this.diffValue = 0;\n this.lastAccessedBy = 0;\n this.lowestObserverState = IDerivationState.NOT_TRACKING;\n }\n\n Atom$$1.prototype.onBecomeObserved = function () {\n if (this.onBecomeObservedListeners) {\n this.onBecomeObservedListeners.forEach(function (listener) {\n return listener();\n });\n }\n };\n\n Atom$$1.prototype.onBecomeUnobserved = function () {\n if (this.onBecomeUnobservedListeners) {\n this.onBecomeUnobservedListeners.forEach(function (listener) {\n return listener();\n });\n }\n };\n /**\n * Invoke this method to notify mobx that your atom has been used somehow.\n * Returns true if there is currently a reactive context.\n */\n\n\n Atom$$1.prototype.reportObserved = function () {\n return reportObserved$$1(this);\n };\n /**\n * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate.\n */\n\n\n Atom$$1.prototype.reportChanged = function () {\n startBatch$$1();\n propagateChanged$$1(this);\n endBatch$$1();\n };\n\n Atom$$1.prototype.toString = function () {\n return this.name;\n };\n\n return Atom$$1;\n}();\n\nvar isAtom$$1 = createInstanceofPredicate$$1(\"Atom\", Atom$$1);\n\nfunction createAtom$$1(name, onBecomeObservedHandler, onBecomeUnobservedHandler) {\n if (onBecomeObservedHandler === void 0) {\n onBecomeObservedHandler = noop$$1;\n }\n\n if (onBecomeUnobservedHandler === void 0) {\n onBecomeUnobservedHandler = noop$$1;\n }\n\n var atom = new Atom$$1(name); // default `noop` listener will not initialize the hook Set\n\n if (onBecomeObservedHandler !== noop$$1) {\n onBecomeObserved$$1(atom, onBecomeObservedHandler);\n }\n\n if (onBecomeUnobservedHandler !== noop$$1) {\n onBecomeUnobserved$$1(atom, onBecomeUnobservedHandler);\n }\n\n return atom;\n}\n\nfunction identityComparer(a, b) {\n return a === b;\n}\n\nfunction structuralComparer(a, b) {\n return deepEqual$$1(a, b);\n}\n\nfunction defaultComparer(a, b) {\n return Object.is(a, b);\n}\n\nvar comparer$$1 = {\n identity: identityComparer,\n structural: structuralComparer,\n default: defaultComparer\n};\nvar mobxDidRunLazyInitializersSymbol$$1 = Symbol(\"mobx did run lazy initializers\");\nvar mobxPendingDecorators$$1 = Symbol(\"mobx pending decorators\");\nvar enumerableDescriptorCache = {};\nvar nonEnumerableDescriptorCache = {};\n\nfunction createPropertyInitializerDescriptor(prop, enumerable) {\n var cache = enumerable ? enumerableDescriptorCache : nonEnumerableDescriptorCache;\n return cache[prop] || (cache[prop] = {\n configurable: true,\n enumerable: enumerable,\n get: function () {\n initializeInstance$$1(this);\n return this[prop];\n },\n set: function (value) {\n initializeInstance$$1(this);\n this[prop] = value;\n }\n });\n}\n\nfunction initializeInstance$$1(target) {\n if (target[mobxDidRunLazyInitializersSymbol$$1] === true) return;\n var decorators = target[mobxPendingDecorators$$1];\n\n if (decorators) {\n addHiddenProp$$1(target, mobxDidRunLazyInitializersSymbol$$1, true);\n\n for (var key in decorators) {\n var d = decorators[key];\n d.propertyCreator(target, d.prop, d.descriptor, d.decoratorTarget, d.decoratorArguments);\n }\n }\n}\n\nfunction createPropDecorator$$1(propertyInitiallyEnumerable, propertyCreator) {\n return function decoratorFactory() {\n var decoratorArguments;\n\n var decorator = function decorate$$1(target, prop, descriptor, applyImmediately // This is a special parameter to signal the direct application of a decorator, allow extendObservable to skip the entire type decoration part,\n // as the instance to apply the decorator to equals the target\n ) {\n if (applyImmediately === true) {\n propertyCreator(target, prop, descriptor, target, decoratorArguments);\n return null;\n }\n\n if ( true && !quacksLikeADecorator$$1(arguments)) fail$$1(\"This function is a decorator, but it wasn't invoked like a decorator\");\n\n if (!Object.prototype.hasOwnProperty.call(target, mobxPendingDecorators$$1)) {\n var inheritedDecorators = target[mobxPendingDecorators$$1];\n addHiddenProp$$1(target, mobxPendingDecorators$$1, __assign({}, inheritedDecorators));\n }\n\n target[mobxPendingDecorators$$1][prop] = {\n prop: prop,\n propertyCreator: propertyCreator,\n descriptor: descriptor,\n decoratorTarget: target,\n decoratorArguments: decoratorArguments\n };\n return createPropertyInitializerDescriptor(prop, propertyInitiallyEnumerable);\n };\n\n if (quacksLikeADecorator$$1(arguments)) {\n // @decorator\n decoratorArguments = EMPTY_ARRAY$$1;\n return decorator.apply(null, arguments);\n } else {\n // @decorator(args)\n decoratorArguments = Array.prototype.slice.call(arguments);\n return decorator;\n }\n };\n}\n\nfunction quacksLikeADecorator$$1(args) {\n return (args.length === 2 || args.length === 3) && typeof args[1] === \"string\" || args.length === 4 && args[3] === true;\n}\n\nfunction deepEnhancer$$1(v, _, name) {\n // it is an observable already, done\n if (isObservable$$1(v)) return v; // something that can be converted and mutated?\n\n if (Array.isArray(v)) return observable$$1.array(v, {\n name: name\n });\n if (isPlainObject$$1(v)) return observable$$1.object(v, undefined, {\n name: name\n });\n if (isES6Map$$1(v)) return observable$$1.map(v, {\n name: name\n });\n if (isES6Set$$1(v)) return observable$$1.set(v, {\n name: name\n });\n return v;\n}\n\nfunction shallowEnhancer$$1(v, _, name) {\n if (v === undefined || v === null) return v;\n if (isObservableObject$$1(v) || isObservableArray$$1(v) || isObservableMap$$1(v) || isObservableSet$$1(v)) return v;\n if (Array.isArray(v)) return observable$$1.array(v, {\n name: name,\n deep: false\n });\n if (isPlainObject$$1(v)) return observable$$1.object(v, undefined, {\n name: name,\n deep: false\n });\n if (isES6Map$$1(v)) return observable$$1.map(v, {\n name: name,\n deep: false\n });\n if (isES6Set$$1(v)) return observable$$1.set(v, {\n name: name,\n deep: false\n });\n return fail$$1( true && \"The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets\");\n}\n\nfunction referenceEnhancer$$1(newValue) {\n // never turn into an observable\n return newValue;\n}\n\nfunction refStructEnhancer$$1(v, oldValue, name) {\n if ( true && isObservable$$1(v)) throw \"observable.struct should not be used with observable values\";\n if (deepEqual$$1(v, oldValue)) return oldValue;\n return v;\n}\n\nfunction createDecoratorForEnhancer$$1(enhancer) {\n invariant$$1(enhancer);\n var decorator = createPropDecorator$$1(true, function (target, propertyName, descriptor, _decoratorTarget, decoratorArgs) {\n if (true) {\n invariant$$1(!descriptor || !descriptor.get, \"@observable cannot be used on getter (property \\\"\" + propertyName + \"\\\"), use @computed instead.\");\n }\n\n var initialValue = descriptor ? descriptor.initializer ? descriptor.initializer.call(target) : descriptor.value : undefined;\n asObservableObject$$1(target).addObservableProp(propertyName, initialValue, enhancer);\n });\n var res = // Extra process checks, as this happens during module initialization\n typeof process !== \"undefined\" && process.env && \"development\" !== \"production\" ? function observableDecorator() {\n // This wrapper function is just to detect illegal decorator invocations, deprecate in a next version\n // and simply return the created prop decorator\n if (arguments.length < 2) return fail$$1(\"Incorrect decorator invocation. @observable decorator doesn't expect any arguments\");\n return decorator.apply(null, arguments);\n } : decorator;\n res.enhancer = enhancer;\n return res;\n} // Predefined bags of create observable options, to avoid allocating temporarily option objects\n// in the majority of cases\n\n\nvar defaultCreateObservableOptions$$1 = {\n deep: true,\n name: undefined,\n defaultDecorator: undefined,\n proxy: true\n};\nObject.freeze(defaultCreateObservableOptions$$1);\n\nfunction assertValidOption(key) {\n if (!/^(deep|name|equals|defaultDecorator|proxy)$/.test(key)) fail$$1(\"invalid option for (extend)observable: \" + key);\n}\n\nfunction asCreateObservableOptions$$1(thing) {\n if (thing === null || thing === undefined) return defaultCreateObservableOptions$$1;\n if (typeof thing === \"string\") return {\n name: thing,\n deep: true,\n proxy: true\n };\n\n if (true) {\n if (typeof thing !== \"object\") return fail$$1(\"expected options object\");\n Object.keys(thing).forEach(assertValidOption);\n }\n\n return thing;\n}\n\nvar deepDecorator$$1 = createDecoratorForEnhancer$$1(deepEnhancer$$1);\nvar shallowDecorator = createDecoratorForEnhancer$$1(shallowEnhancer$$1);\nvar refDecorator$$1 = createDecoratorForEnhancer$$1(referenceEnhancer$$1);\nvar refStructDecorator = createDecoratorForEnhancer$$1(refStructEnhancer$$1);\n\nfunction getEnhancerFromOptions(options) {\n return options.defaultDecorator ? options.defaultDecorator.enhancer : options.deep === false ? referenceEnhancer$$1 : deepEnhancer$$1;\n}\n/**\n * Turns an object, array or function into a reactive structure.\n * @param v the value which should become observable.\n */\n\n\nfunction createObservable(v, arg2, arg3) {\n // @observable someProp;\n if (typeof arguments[1] === \"string\") {\n return deepDecorator$$1.apply(null, arguments);\n } // it is an observable already, done\n\n\n if (isObservable$$1(v)) return v; // something that can be converted and mutated?\n\n var res = isPlainObject$$1(v) ? observable$$1.object(v, arg2, arg3) : Array.isArray(v) ? observable$$1.array(v, arg2) : isES6Map$$1(v) ? observable$$1.map(v, arg2) : isES6Set$$1(v) ? observable$$1.set(v, arg2) : v; // this value could be converted to a new observable data structure, return it\n\n if (res !== v) return res; // otherwise, just box it\n\n fail$$1( true && \"The provided value could not be converted into an observable. If you want just create an observable reference to the object use 'observable.box(value)'\");\n}\n\nvar observableFactories = {\n box: function (value, options) {\n if (arguments.length > 2) incorrectlyUsedAsDecorator(\"box\");\n var o = asCreateObservableOptions$$1(options);\n return new ObservableValue$$1(value, getEnhancerFromOptions(o), o.name, true, o.equals);\n },\n array: function (initialValues, options) {\n if (arguments.length > 2) incorrectlyUsedAsDecorator(\"array\");\n var o = asCreateObservableOptions$$1(options);\n return createObservableArray$$1(initialValues, getEnhancerFromOptions(o), o.name);\n },\n map: function (initialValues, options) {\n if (arguments.length > 2) incorrectlyUsedAsDecorator(\"map\");\n var o = asCreateObservableOptions$$1(options);\n return new ObservableMap$$1(initialValues, getEnhancerFromOptions(o), o.name);\n },\n set: function (initialValues, options) {\n if (arguments.length > 2) incorrectlyUsedAsDecorator(\"set\");\n var o = asCreateObservableOptions$$1(options);\n return new ObservableSet$$1(initialValues, getEnhancerFromOptions(o), o.name);\n },\n object: function (props, decorators, options) {\n if (typeof arguments[1] === \"string\") incorrectlyUsedAsDecorator(\"object\");\n var o = asCreateObservableOptions$$1(options);\n\n if (o.proxy === false) {\n return extendObservable$$1({}, props, decorators, o);\n } else {\n var defaultDecorator = getDefaultDecoratorFromObjectOptions$$1(o);\n var base = extendObservable$$1({}, undefined, undefined, o);\n var proxy = createDynamicObservableObject$$1(base);\n extendObservableObjectWithProperties$$1(proxy, props, decorators, defaultDecorator);\n return proxy;\n }\n },\n ref: refDecorator$$1,\n shallow: shallowDecorator,\n deep: deepDecorator$$1,\n struct: refStructDecorator\n};\nvar observable$$1 = createObservable; // weird trick to keep our typings nicely with our funcs, and still extend the observable function\n\nObject.keys(observableFactories).forEach(function (name) {\n return observable$$1[name] = observableFactories[name];\n});\n\nfunction incorrectlyUsedAsDecorator(methodName) {\n fail$$1( // process.env.NODE_ENV !== \"production\" &&\n \"Expected one or two arguments to observable.\" + methodName + \". Did you accidentally try to use observable.\" + methodName + \" as decorator?\");\n}\n\nvar computedDecorator$$1 = createPropDecorator$$1(false, function (instance, propertyName, descriptor, decoratorTarget, decoratorArgs) {\n var get$$1 = descriptor.get,\n set$$1 = descriptor.set; // initialValue is the descriptor for get / set props\n // Optimization: faster on decorator target or instance? Assuming target\n // Optimization: find out if declaring on instance isn't just faster. (also makes the property descriptor simpler). But, more memory usage..\n // Forcing instance now, fixes hot reloadig issues on React Native:\n\n var options = decoratorArgs[0] || {};\n asObservableObject$$1(instance).addComputedProp(instance, propertyName, __assign({\n get: get$$1,\n set: set$$1,\n context: instance\n }, options));\n});\nvar computedStructDecorator = computedDecorator$$1({\n equals: comparer$$1.structural\n});\n/**\n * Decorator for class properties: @computed get value() { return expr; }.\n * For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`;\n */\n\nvar computed$$1 = function computed$$1(arg1, arg2, arg3) {\n if (typeof arg2 === \"string\") {\n // @computed\n return computedDecorator$$1.apply(null, arguments);\n }\n\n if (arg1 !== null && typeof arg1 === \"object\" && arguments.length === 1) {\n // @computed({ options })\n return computedDecorator$$1.apply(null, arguments);\n } // computed(expr, options?)\n\n\n if (true) {\n invariant$$1(typeof arg1 === \"function\", \"First argument to `computed` should be an expression.\");\n invariant$$1(arguments.length < 3, \"Computed takes one or two arguments if used as function\");\n }\n\n var opts = typeof arg2 === \"object\" ? arg2 : {};\n opts.get = arg1;\n opts.set = typeof arg2 === \"function\" ? arg2 : opts.set;\n opts.name = opts.name || arg1.name || \"\";\n /* for generated name */\n\n return new ComputedValue$$1(opts);\n};\n\ncomputed$$1.struct = computedStructDecorator;\n\nfunction createAction$$1(actionName, fn, ref) {\n if (true) {\n invariant$$1(typeof fn === \"function\", \"`action` can only be invoked on functions\");\n if (typeof actionName !== \"string\" || !actionName) fail$$1(\"actions should have valid names, got: '\" + actionName + \"'\");\n }\n\n var res = function () {\n return executeAction$$1(actionName, fn, ref || this, arguments);\n };\n\n res.isMobxAction = true;\n return res;\n}\n\nfunction executeAction$$1(actionName, fn, scope, args) {\n var runInfo = startAction(actionName, fn, scope, args);\n var shouldSupressReactionError = true;\n\n try {\n var res = fn.apply(scope, args);\n shouldSupressReactionError = false;\n return res;\n } finally {\n if (shouldSupressReactionError) {\n globalState$$1.suppressReactionErrors = shouldSupressReactionError;\n endAction(runInfo);\n globalState$$1.suppressReactionErrors = false;\n } else {\n endAction(runInfo);\n }\n }\n}\n\nfunction startAction(actionName, fn, scope, args) {\n var notifySpy = isSpyEnabled$$1() && !!actionName;\n var startTime = 0;\n\n if (notifySpy && \"development\" !== \"production\") {\n startTime = Date.now();\n var l = args && args.length || 0;\n var flattendArgs = new Array(l);\n if (l > 0) for (var i = 0; i < l; i++) flattendArgs[i] = args[i];\n spyReportStart$$1({\n type: \"action\",\n name: actionName,\n object: scope,\n arguments: flattendArgs\n });\n }\n\n var prevDerivation = untrackedStart$$1();\n startBatch$$1();\n var prevAllowStateChanges = allowStateChangesStart$$1(true);\n return {\n prevDerivation: prevDerivation,\n prevAllowStateChanges: prevAllowStateChanges,\n notifySpy: notifySpy,\n startTime: startTime\n };\n}\n\nfunction endAction(runInfo) {\n allowStateChangesEnd$$1(runInfo.prevAllowStateChanges);\n endBatch$$1();\n untrackedEnd$$1(runInfo.prevDerivation);\n if (runInfo.notifySpy && \"development\" !== \"production\") spyReportEnd$$1({\n time: Date.now() - runInfo.startTime\n });\n}\n\nfunction allowStateChanges$$1(allowStateChanges$$1, func) {\n var prev = allowStateChangesStart$$1(allowStateChanges$$1);\n var res;\n\n try {\n res = func();\n } finally {\n allowStateChangesEnd$$1(prev);\n }\n\n return res;\n}\n\nfunction allowStateChangesStart$$1(allowStateChanges$$1) {\n var prev = globalState$$1.allowStateChanges;\n globalState$$1.allowStateChanges = allowStateChanges$$1;\n return prev;\n}\n\nfunction allowStateChangesEnd$$1(prev) {\n globalState$$1.allowStateChanges = prev;\n}\n\nfunction allowStateChangesInsideComputed$$1(func) {\n var prev = globalState$$1.computationDepth;\n globalState$$1.computationDepth = 0;\n var res;\n\n try {\n res = func();\n } finally {\n globalState$$1.computationDepth = prev;\n }\n\n return res;\n}\n\nvar ObservableValue$$1 =\n/** @class */\nfunction (_super) {\n __extends(ObservableValue$$1, _super);\n\n function ObservableValue$$1(value, enhancer, name, notifySpy, equals) {\n if (name === void 0) {\n name = \"ObservableValue@\" + getNextId$$1();\n }\n\n if (notifySpy === void 0) {\n notifySpy = true;\n }\n\n if (equals === void 0) {\n equals = comparer$$1.default;\n }\n\n var _this = _super.call(this, name) || this;\n\n _this.enhancer = enhancer;\n _this.name = name;\n _this.equals = equals;\n _this.hasUnreportedChange = false;\n _this.value = enhancer(value, undefined, name);\n\n if (notifySpy && isSpyEnabled$$1() && \"development\" !== \"production\") {\n // only notify spy if this is a stand-alone observable\n spyReport$$1({\n type: \"create\",\n name: _this.name,\n newValue: \"\" + _this.value\n });\n }\n\n return _this;\n }\n\n ObservableValue$$1.prototype.dehanceValue = function (value) {\n if (this.dehancer !== undefined) return this.dehancer(value);\n return value;\n };\n\n ObservableValue$$1.prototype.set = function (newValue) {\n var oldValue = this.value;\n newValue = this.prepareNewValue(newValue);\n\n if (newValue !== globalState$$1.UNCHANGED) {\n var notifySpy = isSpyEnabled$$1();\n\n if (notifySpy && \"development\" !== \"production\") {\n spyReportStart$$1({\n type: \"update\",\n name: this.name,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n\n this.setNewValue(newValue);\n if (notifySpy && \"development\" !== \"production\") spyReportEnd$$1();\n }\n };\n\n ObservableValue$$1.prototype.prepareNewValue = function (newValue) {\n checkIfStateModificationsAreAllowed$$1(this);\n\n if (hasInterceptors$$1(this)) {\n var change = interceptChange$$1(this, {\n object: this,\n type: \"update\",\n newValue: newValue\n });\n if (!change) return globalState$$1.UNCHANGED;\n newValue = change.newValue;\n } // apply modifier\n\n\n newValue = this.enhancer(newValue, this.value, this.name);\n return this.equals(this.value, newValue) ? globalState$$1.UNCHANGED : newValue;\n };\n\n ObservableValue$$1.prototype.setNewValue = function (newValue) {\n var oldValue = this.value;\n this.value = newValue;\n this.reportChanged();\n\n if (hasListeners$$1(this)) {\n notifyListeners$$1(this, {\n type: \"update\",\n object: this,\n newValue: newValue,\n oldValue: oldValue\n });\n }\n };\n\n ObservableValue$$1.prototype.get = function () {\n this.reportObserved();\n return this.dehanceValue(this.value);\n };\n\n ObservableValue$$1.prototype.intercept = function (handler) {\n return registerInterceptor$$1(this, handler);\n };\n\n ObservableValue$$1.prototype.observe = function (listener, fireImmediately) {\n if (fireImmediately) listener({\n object: this,\n type: \"update\",\n newValue: this.value,\n oldValue: undefined\n });\n return registerListener$$1(this, listener);\n };\n\n ObservableValue$$1.prototype.toJSON = function () {\n return this.get();\n };\n\n ObservableValue$$1.prototype.toString = function () {\n return this.name + \"[\" + this.value + \"]\";\n };\n\n ObservableValue$$1.prototype.valueOf = function () {\n return toPrimitive$$1(this.get());\n };\n\n ObservableValue$$1.prototype[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n\n return ObservableValue$$1;\n}(Atom$$1);\n\nvar isObservableValue$$1 = createInstanceofPredicate$$1(\"ObservableValue\", ObservableValue$$1);\n/**\n * A node in the state dependency root that observes other nodes, and can be observed itself.\n *\n * ComputedValue will remember the result of the computation for the duration of the batch, or\n * while being observed.\n *\n * During this time it will recompute only when one of its direct dependencies changed,\n * but only when it is being accessed with `ComputedValue.get()`.\n *\n * Implementation description:\n * 1. First time it's being accessed it will compute and remember result\n * give back remembered result until 2. happens\n * 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3.\n * 3. When it's being accessed, recompute if any shallow dependency changed.\n * if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step.\n * go to step 2. either way\n *\n * If at any point it's outside batch and it isn't observed: reset everything and go to 1.\n */\n\nvar ComputedValue$$1 =\n/** @class */\nfunction () {\n /**\n * Create a new computed value based on a function expression.\n *\n * The `name` property is for debug purposes only.\n *\n * The `equals` property specifies the comparer function to use to determine if a newly produced\n * value differs from the previous value. Two comparers are provided in the library; `defaultComparer`\n * compares based on identity comparison (===), and `structualComparer` deeply compares the structure.\n * Structural comparison can be convenient if you always produce a new aggregated object and\n * don't want to notify observers if it is structurally the same.\n * This is useful for working with vectors, mouse coordinates etc.\n */\n function ComputedValue$$1(options) {\n this.dependenciesState = IDerivationState.NOT_TRACKING;\n this.observing = []; // nodes we are looking at. Our value depends on these nodes\n\n this.newObserving = null; // during tracking it's an array with new observed observers\n\n this.isBeingObserved = false;\n this.isPendingUnobservation = false;\n this.observers = new Set();\n this.diffValue = 0;\n this.runId = 0;\n this.lastAccessedBy = 0;\n this.lowestObserverState = IDerivationState.UP_TO_DATE;\n this.unboundDepsCount = 0;\n this.__mapid = \"#\" + getNextId$$1();\n this.value = new CaughtException$$1(null);\n this.isComputing = false; // to check for cycles\n\n this.isRunningSetter = false;\n this.isTracing = TraceMode$$1.NONE;\n if ( true && !options.get) throw \"[mobx] missing option for computed: get\";\n this.derivation = options.get;\n this.name = options.name || \"ComputedValue@\" + getNextId$$1();\n if (options.set) this.setter = createAction$$1(this.name + \"-setter\", options.set);\n this.equals = options.equals || (options.compareStructural || options.struct ? comparer$$1.structural : comparer$$1.default);\n this.scope = options.context;\n this.requiresReaction = !!options.requiresReaction;\n this.keepAlive = !!options.keepAlive;\n }\n\n ComputedValue$$1.prototype.onBecomeStale = function () {\n propagateMaybeChanged$$1(this);\n };\n\n ComputedValue$$1.prototype.onBecomeObserved = function () {\n if (this.onBecomeObservedListeners) {\n this.onBecomeObservedListeners.forEach(function (listener) {\n return listener();\n });\n }\n };\n\n ComputedValue$$1.prototype.onBecomeUnobserved = function () {\n if (this.onBecomeUnobservedListeners) {\n this.onBecomeUnobservedListeners.forEach(function (listener) {\n return listener();\n });\n }\n };\n /**\n * Returns the current value of this computed value.\n * Will evaluate its computation first if needed.\n */\n\n\n ComputedValue$$1.prototype.get = function () {\n if (this.isComputing) fail$$1(\"Cycle detected in computation \" + this.name + \": \" + this.derivation);\n\n if (globalState$$1.inBatch === 0 && this.observers.size === 0 && !this.keepAlive) {\n if (shouldCompute$$1(this)) {\n this.warnAboutUntrackedRead();\n startBatch$$1(); // See perf test 'computed memoization'\n\n this.value = this.computeValue(false);\n endBatch$$1();\n }\n } else {\n reportObserved$$1(this);\n if (shouldCompute$$1(this)) if (this.trackAndCompute()) propagateChangeConfirmed$$1(this);\n }\n\n var result = this.value;\n if (isCaughtException$$1(result)) throw result.cause;\n return result;\n };\n\n ComputedValue$$1.prototype.peek = function () {\n var res = this.computeValue(false);\n if (isCaughtException$$1(res)) throw res.cause;\n return res;\n };\n\n ComputedValue$$1.prototype.set = function (value) {\n if (this.setter) {\n invariant$$1(!this.isRunningSetter, \"The setter of computed value '\" + this.name + \"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?\");\n this.isRunningSetter = true;\n\n try {\n this.setter.call(this.scope, value);\n } finally {\n this.isRunningSetter = false;\n }\n } else invariant$$1(false, true && \"[ComputedValue '\" + this.name + \"'] It is not possible to assign a new value to a computed value.\");\n };\n\n ComputedValue$$1.prototype.trackAndCompute = function () {\n if (isSpyEnabled$$1() && \"development\" !== \"production\") {\n spyReport$$1({\n object: this.scope,\n type: \"compute\",\n name: this.name\n });\n }\n\n var oldValue = this.value;\n var wasSuspended =\n /* see #1208 */\n this.dependenciesState === IDerivationState.NOT_TRACKING;\n var newValue = this.computeValue(true);\n var changed = wasSuspended || isCaughtException$$1(oldValue) || isCaughtException$$1(newValue) || !this.equals(oldValue, newValue);\n\n if (changed) {\n this.value = newValue;\n }\n\n return changed;\n };\n\n ComputedValue$$1.prototype.computeValue = function (track) {\n this.isComputing = true;\n globalState$$1.computationDepth++;\n var res;\n\n if (track) {\n res = trackDerivedFunction$$1(this, this.derivation, this.scope);\n } else {\n if (globalState$$1.disableErrorBoundaries === true) {\n res = this.derivation.call(this.scope);\n } else {\n try {\n res = this.derivation.call(this.scope);\n } catch (e) {\n res = new CaughtException$$1(e);\n }\n }\n }\n\n globalState$$1.computationDepth--;\n this.isComputing = false;\n return res;\n };\n\n ComputedValue$$1.prototype.suspend = function () {\n if (!this.keepAlive) {\n clearObserving$$1(this);\n this.value = undefined; // don't hold on to computed value!\n }\n };\n\n ComputedValue$$1.prototype.observe = function (listener, fireImmediately) {\n var _this = this;\n\n var firstTime = true;\n var prevValue = undefined;\n return autorun$$1(function () {\n var newValue = _this.get();\n\n if (!firstTime || fireImmediately) {\n var prevU = untrackedStart$$1();\n listener({\n type: \"update\",\n object: _this,\n newValue: newValue,\n oldValue: prevValue\n });\n untrackedEnd$$1(prevU);\n }\n\n firstTime = false;\n prevValue = newValue;\n });\n };\n\n ComputedValue$$1.prototype.warnAboutUntrackedRead = function () {\n if (false) {}\n\n if (this.requiresReaction === true) {\n fail$$1(\"[mobx] Computed value \" + this.name + \" is read outside a reactive context\");\n }\n\n if (this.isTracing !== TraceMode$$1.NONE) {\n console.log(\"[mobx.trace] '\" + this.name + \"' is being read outside a reactive context. Doing a full recompute\");\n }\n\n if (globalState$$1.computedRequiresReaction) {\n console.warn(\"[mobx] Computed value \" + this.name + \" is being read outside a reactive context. Doing a full recompute\");\n }\n };\n\n ComputedValue$$1.prototype.toJSON = function () {\n return this.get();\n };\n\n ComputedValue$$1.prototype.toString = function () {\n return this.name + \"[\" + this.derivation.toString() + \"]\";\n };\n\n ComputedValue$$1.prototype.valueOf = function () {\n return toPrimitive$$1(this.get());\n };\n\n ComputedValue$$1.prototype[Symbol.toPrimitive] = function () {\n return this.valueOf();\n };\n\n return ComputedValue$$1;\n}();\n\nvar isComputedValue$$1 = createInstanceofPredicate$$1(\"ComputedValue\", ComputedValue$$1);\nvar IDerivationState;\n\n(function (IDerivationState$$1) {\n // before being run or (outside batch and not being observed)\n // at this point derivation is not holding any data about dependency tree\n IDerivationState$$1[IDerivationState$$1[\"NOT_TRACKING\"] = -1] = \"NOT_TRACKING\"; // no shallow dependency changed since last computation\n // won't recalculate derivation\n // this is what makes mobx fast\n\n IDerivationState$$1[IDerivationState$$1[\"UP_TO_DATE\"] = 0] = \"UP_TO_DATE\"; // some deep dependency changed, but don't know if shallow dependency changed\n // will require to check first if UP_TO_DATE or POSSIBLY_STALE\n // currently only ComputedValue will propagate POSSIBLY_STALE\n //\n // having this state is second big optimization:\n // don't have to recompute on every dependency change, but only when it's needed\n\n IDerivationState$$1[IDerivationState$$1[\"POSSIBLY_STALE\"] = 1] = \"POSSIBLY_STALE\"; // A shallow dependency has changed since last computation and the derivation\n // will need to recompute when it's needed next.\n\n IDerivationState$$1[IDerivationState$$1[\"STALE\"] = 2] = \"STALE\";\n})(IDerivationState || (IDerivationState = {}));\n\nvar TraceMode$$1;\n\n(function (TraceMode$$1) {\n TraceMode$$1[TraceMode$$1[\"NONE\"] = 0] = \"NONE\";\n TraceMode$$1[TraceMode$$1[\"LOG\"] = 1] = \"LOG\";\n TraceMode$$1[TraceMode$$1[\"BREAK\"] = 2] = \"BREAK\";\n})(TraceMode$$1 || (TraceMode$$1 = {}));\n\nvar CaughtException$$1 =\n/** @class */\nfunction () {\n function CaughtException$$1(cause) {\n this.cause = cause; // Empty\n }\n\n return CaughtException$$1;\n}();\n\nfunction isCaughtException$$1(e) {\n return e instanceof CaughtException$$1;\n}\n/**\n * Finds out whether any dependency of the derivation has actually changed.\n * If dependenciesState is 1 then it will recalculate dependencies,\n * if any dependency changed it will propagate it by changing dependenciesState to 2.\n *\n * By iterating over the dependencies in the same order that they were reported and\n * stopping on the first change, all the recalculations are only called for ComputedValues\n * that will be tracked by derivation. That is because we assume that if the first x\n * dependencies of the derivation doesn't change then the derivation should run the same way\n * up until accessing x-th dependency.\n */\n\n\nfunction shouldCompute$$1(derivation) {\n switch (derivation.dependenciesState) {\n case IDerivationState.UP_TO_DATE:\n return false;\n\n case IDerivationState.NOT_TRACKING:\n case IDerivationState.STALE:\n return true;\n\n case IDerivationState.POSSIBLY_STALE:\n {\n var prevUntracked = untrackedStart$$1(); // no need for those computeds to be reported, they will be picked up in trackDerivedFunction.\n\n var obs = derivation.observing,\n l = obs.length;\n\n for (var i = 0; i < l; i++) {\n var obj = obs[i];\n\n if (isComputedValue$$1(obj)) {\n if (globalState$$1.disableErrorBoundaries) {\n obj.get();\n } else {\n try {\n obj.get();\n } catch (e) {\n // we are not interested in the value *or* exception at this moment, but if there is one, notify all\n untrackedEnd$$1(prevUntracked);\n return true;\n }\n } // if ComputedValue `obj` actually changed it will be computed and propagated to its observers.\n // and `derivation` is an observer of `obj`\n // invariantShouldCompute(derivation)\n\n\n if (derivation.dependenciesState === IDerivationState.STALE) {\n untrackedEnd$$1(prevUntracked);\n return true;\n }\n }\n }\n\n changeDependenciesStateTo0$$1(derivation);\n untrackedEnd$$1(prevUntracked);\n return false;\n }\n }\n} // function invariantShouldCompute(derivation: IDerivation) {\n// const newDepState = (derivation as any).dependenciesState\n// if (\n// process.env.NODE_ENV === \"production\" &&\n// (newDepState === IDerivationState.POSSIBLY_STALE ||\n// newDepState === IDerivationState.NOT_TRACKING)\n// )\n// fail(\"Illegal dependency state\")\n// }\n\n\nfunction isComputingDerivation$$1() {\n return globalState$$1.trackingDerivation !== null; // filter out actions inside computations\n}\n\nfunction checkIfStateModificationsAreAllowed$$1(atom) {\n var hasObservers$$1 = atom.observers.size > 0; // Should never be possible to change an observed observable from inside computed, see #798\n\n if (globalState$$1.computationDepth > 0 && hasObservers$$1) fail$$1( true && \"Computed values are not allowed to cause side effects by changing observables that are already being observed. Tried to modify: \" + atom.name); // Should not be possible to change observed state outside strict mode, except during initialization, see #563\n\n if (!globalState$$1.allowStateChanges && (hasObservers$$1 || globalState$$1.enforceActions === \"strict\")) fail$$1( true && (globalState$$1.enforceActions ? \"Since strict-mode is enabled, changing observed observable values outside actions is not allowed. Please wrap the code in an `action` if this change is intended. Tried to modify: \" : \"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, the render function of a React component? Tried to modify: \") + atom.name);\n}\n/**\n * Executes the provided function `f` and tracks which observables are being accessed.\n * The tracking information is stored on the `derivation` object and the derivation is registered\n * as observer of any of the accessed observables.\n */\n\n\nfunction trackDerivedFunction$$1(derivation, f, context) {\n // pre allocate array allocation + room for variation in deps\n // array will be trimmed by bindDependencies\n changeDependenciesStateTo0$$1(derivation);\n derivation.newObserving = new Array(derivation.observing.length + 100);\n derivation.unboundDepsCount = 0;\n derivation.runId = ++globalState$$1.runId;\n var prevTracking = globalState$$1.trackingDerivation;\n globalState$$1.trackingDerivation = derivation;\n var result;\n\n if (globalState$$1.disableErrorBoundaries === true) {\n result = f.call(context);\n } else {\n try {\n result = f.call(context);\n } catch (e) {\n result = new CaughtException$$1(e);\n }\n }\n\n globalState$$1.trackingDerivation = prevTracking;\n bindDependencies(derivation);\n return result;\n}\n/**\n * diffs newObserving with observing.\n * update observing to be newObserving with unique observables\n * notify observers that become observed/unobserved\n */\n\n\nfunction bindDependencies(derivation) {\n // invariant(derivation.dependenciesState !== IDerivationState.NOT_TRACKING, \"INTERNAL ERROR bindDependencies expects derivation.dependenciesState !== -1\");\n var prevObserving = derivation.observing;\n var observing = derivation.observing = derivation.newObserving;\n var lowestNewObservingDerivationState = IDerivationState.UP_TO_DATE; // Go through all new observables and check diffValue: (this list can contain duplicates):\n // 0: first occurrence, change to 1 and keep it\n // 1: extra occurrence, drop it\n\n var i0 = 0,\n l = derivation.unboundDepsCount;\n\n for (var i = 0; i < l; i++) {\n var dep = observing[i];\n\n if (dep.diffValue === 0) {\n dep.diffValue = 1;\n if (i0 !== i) observing[i0] = dep;\n i0++;\n } // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined,\n // not hitting the condition\n\n\n if (dep.dependenciesState > lowestNewObservingDerivationState) {\n lowestNewObservingDerivationState = dep.dependenciesState;\n }\n }\n\n observing.length = i0;\n derivation.newObserving = null; // newObserving shouldn't be needed outside tracking (statement moved down to work around FF bug, see #614)\n // Go through all old observables and check diffValue: (it is unique after last bindDependencies)\n // 0: it's not in new observables, unobserve it\n // 1: it keeps being observed, don't want to notify it. change to 0\n\n l = prevObserving.length;\n\n while (l--) {\n var dep = prevObserving[l];\n\n if (dep.diffValue === 0) {\n removeObserver$$1(dep, derivation);\n }\n\n dep.diffValue = 0;\n } // Go through all new observables and check diffValue: (now it should be unique)\n // 0: it was set to 0 in last loop. don't need to do anything.\n // 1: it wasn't observed, let's observe it. set back to 0\n\n\n while (i0--) {\n var dep = observing[i0];\n\n if (dep.diffValue === 1) {\n dep.diffValue = 0;\n addObserver$$1(dep, derivation);\n }\n } // Some new observed derivations may become stale during this derivation computation\n // so they have had no chance to propagate staleness (#916)\n\n\n if (lowestNewObservingDerivationState !== IDerivationState.UP_TO_DATE) {\n derivation.dependenciesState = lowestNewObservingDerivationState;\n derivation.onBecomeStale();\n }\n}\n\nfunction clearObserving$$1(derivation) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR clearObserving should be called only inside batch\");\n var obs = derivation.observing;\n derivation.observing = [];\n var i = obs.length;\n\n while (i--) removeObserver$$1(obs[i], derivation);\n\n derivation.dependenciesState = IDerivationState.NOT_TRACKING;\n}\n\nfunction untracked$$1(action$$1) {\n var prev = untrackedStart$$1();\n\n try {\n return action$$1();\n } finally {\n untrackedEnd$$1(prev);\n }\n}\n\nfunction untrackedStart$$1() {\n var prev = globalState$$1.trackingDerivation;\n globalState$$1.trackingDerivation = null;\n return prev;\n}\n\nfunction untrackedEnd$$1(prev) {\n globalState$$1.trackingDerivation = prev;\n}\n/**\n * needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0\n *\n */\n\n\nfunction changeDependenciesStateTo0$$1(derivation) {\n if (derivation.dependenciesState === IDerivationState.UP_TO_DATE) return;\n derivation.dependenciesState = IDerivationState.UP_TO_DATE;\n var obs = derivation.observing;\n var i = obs.length;\n\n while (i--) obs[i].lowestObserverState = IDerivationState.UP_TO_DATE;\n}\n/**\n * These values will persist if global state is reset\n */\n\n\nvar persistentKeys = [\"mobxGuid\", \"spyListeners\", \"enforceActions\", \"computedRequiresReaction\", \"disableErrorBoundaries\", \"runId\", \"UNCHANGED\"];\n\nvar MobXGlobals$$1 =\n/** @class */\nfunction () {\n function MobXGlobals$$1() {\n /**\n * MobXGlobals version.\n * MobX compatiblity with other versions loaded in memory as long as this version matches.\n * It indicates that the global state still stores similar information\n *\n * N.B: this version is unrelated to the package version of MobX, and is only the version of the\n * internal state storage of MobX, and can be the same across many different package versions\n */\n this.version = 5;\n /**\n * globally unique token to signal unchanged\n */\n\n this.UNCHANGED = {};\n /**\n * Currently running derivation\n */\n\n this.trackingDerivation = null;\n /**\n * Are we running a computation currently? (not a reaction)\n */\n\n this.computationDepth = 0;\n /**\n * Each time a derivation is tracked, it is assigned a unique run-id\n */\n\n this.runId = 0;\n /**\n * 'guid' for general purpose. Will be persisted amongst resets.\n */\n\n this.mobxGuid = 0;\n /**\n * Are we in a batch block? (and how many of them)\n */\n\n this.inBatch = 0;\n /**\n * Observables that don't have observers anymore, and are about to be\n * suspended, unless somebody else accesses it in the same batch\n *\n * @type {IObservable[]}\n */\n\n this.pendingUnobservations = [];\n /**\n * List of scheduled, not yet executed, reactions.\n */\n\n this.pendingReactions = [];\n /**\n * Are we currently processing reactions?\n */\n\n this.isRunningReactions = false;\n /**\n * Is it allowed to change observables at this point?\n * In general, MobX doesn't allow that when running computations and React.render.\n * To ensure that those functions stay pure.\n */\n\n this.allowStateChanges = true;\n /**\n * If strict mode is enabled, state changes are by default not allowed\n */\n\n this.enforceActions = false;\n /**\n * Spy callbacks\n */\n\n this.spyListeners = [];\n /**\n * Globally attached error handlers that react specifically to errors in reactions\n */\n\n this.globalReactionErrorHandlers = [];\n /**\n * Warn if computed values are accessed outside a reactive context\n */\n\n this.computedRequiresReaction = false;\n /*\n * Don't catch and rethrow exceptions. This is useful for inspecting the state of\n * the stack when an exception occurs while debugging.\n */\n\n this.disableErrorBoundaries = false;\n /*\n * If true, we are already handling an exception in an action. Any errors in reactions should be supressed, as\n * they are not the cause, see: https://github.com/mobxjs/mobx/issues/1836\n */\n\n this.suppressReactionErrors = false;\n }\n\n return MobXGlobals$$1;\n}();\n\nvar canMergeGlobalState = true;\nvar isolateCalled = false;\n\nvar globalState$$1 = function () {\n var global = getGlobal$$1();\n if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) canMergeGlobalState = false;\n if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals$$1().version) canMergeGlobalState = false;\n\n if (!canMergeGlobalState) {\n setTimeout(function () {\n if (!isolateCalled) {\n fail$$1(\"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`\");\n }\n }, 1);\n return new MobXGlobals$$1();\n } else if (global.__mobxGlobals) {\n global.__mobxInstanceCount += 1;\n if (!global.__mobxGlobals.UNCHANGED) global.__mobxGlobals.UNCHANGED = {}; // make merge backward compatible\n\n return global.__mobxGlobals;\n } else {\n global.__mobxInstanceCount = 1;\n return global.__mobxGlobals = new MobXGlobals$$1();\n }\n}();\n\nfunction isolateGlobalState$$1() {\n if (globalState$$1.pendingReactions.length || globalState$$1.inBatch || globalState$$1.isRunningReactions) fail$$1(\"isolateGlobalState should be called before MobX is running any reactions\");\n isolateCalled = true;\n\n if (canMergeGlobalState) {\n if (--getGlobal$$1().__mobxInstanceCount === 0) getGlobal$$1().__mobxGlobals = undefined;\n globalState$$1 = new MobXGlobals$$1();\n }\n}\n\nfunction getGlobalState$$1() {\n return globalState$$1;\n}\n/**\n * For testing purposes only; this will break the internal state of existing observables,\n * but can be used to get back at a stable state after throwing errors\n */\n\n\nfunction resetGlobalState$$1() {\n var defaultGlobals = new MobXGlobals$$1();\n\n for (var key in defaultGlobals) if (persistentKeys.indexOf(key) === -1) globalState$$1[key] = defaultGlobals[key];\n\n globalState$$1.allowStateChanges = !globalState$$1.enforceActions;\n}\n\nfunction getGlobal$$1() {\n return typeof window !== \"undefined\" ? window : global;\n}\n\nfunction hasObservers$$1(observable$$1) {\n return observable$$1.observers && observable$$1.observers.size > 0;\n}\n\nfunction getObservers$$1(observable$$1) {\n return observable$$1.observers;\n} // function invariantObservers(observable: IObservable) {\n// const list = observable.observers\n// const map = observable.observersIndexes\n// const l = list.length\n// for (let i = 0; i < l; i++) {\n// const id = list[i].__mapid\n// if (i) {\n// invariant(map[id] === i, \"INTERNAL ERROR maps derivation.__mapid to index in list\") // for performance\n// } else {\n// invariant(!(id in map), \"INTERNAL ERROR observer on index 0 shouldn't be held in map.\") // for performance\n// }\n// }\n// invariant(\n// list.length === 0 || Object.keys(map).length === list.length - 1,\n// \"INTERNAL ERROR there is no junk in map\"\n// )\n// }\n\n\nfunction addObserver$$1(observable$$1, node) {\n // invariant(node.dependenciesState !== -1, \"INTERNAL ERROR, can add only dependenciesState !== -1\");\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR add already added node\");\n // invariantObservers(observable);\n observable$$1.observers.add(node);\n if (observable$$1.lowestObserverState > node.dependenciesState) observable$$1.lowestObserverState = node.dependenciesState; // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR didn't add node\");\n}\n\nfunction removeObserver$$1(observable$$1, node) {\n // invariant(globalState.inBatch > 0, \"INTERNAL ERROR, remove should be called only inside batch\");\n // invariant(observable._observers.indexOf(node) !== -1, \"INTERNAL ERROR remove already removed node\");\n // invariantObservers(observable);\n observable$$1.observers.delete(node);\n\n if (observable$$1.observers.size === 0) {\n // deleting last observer\n queueForUnobservation$$1(observable$$1);\n } // invariantObservers(observable);\n // invariant(observable._observers.indexOf(node) === -1, \"INTERNAL ERROR remove already removed node2\");\n\n}\n\nfunction queueForUnobservation$$1(observable$$1) {\n if (observable$$1.isPendingUnobservation === false) {\n // invariant(observable._observers.length === 0, \"INTERNAL ERROR, should only queue for unobservation unobserved observables\");\n observable$$1.isPendingUnobservation = true;\n globalState$$1.pendingUnobservations.push(observable$$1);\n }\n}\n/**\n * Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does.\n * During a batch `onBecomeUnobserved` will be called at most once per observable.\n * Avoids unnecessary recalculations.\n */\n\n\nfunction startBatch$$1() {\n globalState$$1.inBatch++;\n}\n\nfunction endBatch$$1() {\n if (--globalState$$1.inBatch === 0) {\n runReactions$$1(); // the batch is actually about to finish, all unobserving should happen here.\n\n var list = globalState$$1.pendingUnobservations;\n\n for (var i = 0; i < list.length; i++) {\n var observable$$1 = list[i];\n observable$$1.isPendingUnobservation = false;\n\n if (observable$$1.observers.size === 0) {\n if (observable$$1.isBeingObserved) {\n // if this observable had reactive observers, trigger the hooks\n observable$$1.isBeingObserved = false;\n observable$$1.onBecomeUnobserved();\n }\n\n if (observable$$1 instanceof ComputedValue$$1) {\n // computed values are automatically teared down when the last observer leaves\n // this process happens recursively, this computed might be the last observabe of another, etc..\n observable$$1.suspend();\n }\n }\n }\n\n globalState$$1.pendingUnobservations = [];\n }\n}\n\nfunction reportObserved$$1(observable$$1) {\n var derivation = globalState$$1.trackingDerivation;\n\n if (derivation !== null) {\n /**\n * Simple optimization, give each derivation run an unique id (runId)\n * Check if last time this observable was accessed the same runId is used\n * if this is the case, the relation is already known\n */\n if (derivation.runId !== observable$$1.lastAccessedBy) {\n observable$$1.lastAccessedBy = derivation.runId; // Tried storing newObserving, or observing, or both as Set, but performance didn't come close...\n\n derivation.newObserving[derivation.unboundDepsCount++] = observable$$1;\n\n if (!observable$$1.isBeingObserved) {\n observable$$1.isBeingObserved = true;\n observable$$1.onBecomeObserved();\n }\n }\n\n return true;\n } else if (observable$$1.observers.size === 0 && globalState$$1.inBatch > 0) {\n queueForUnobservation$$1(observable$$1);\n }\n\n return false;\n} // function invariantLOS(observable: IObservable, msg: string) {\n// // it's expensive so better not run it in produciton. but temporarily helpful for testing\n// const min = getObservers(observable).reduce((a, b) => Math.min(a, b.dependenciesState), 2)\n// if (min >= observable.lowestObserverState) return // <- the only assumption about `lowestObserverState`\n// throw new Error(\n// \"lowestObserverState is wrong for \" +\n// msg +\n// \" because \" +\n// min +\n// \" < \" +\n// observable.lowestObserverState\n// )\n// }\n\n/**\n * NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly\n * It will propagate changes to observers from previous run\n * It's hard or maybe impossible (with reasonable perf) to get it right with current approach\n * Hopefully self reruning autoruns aren't a feature people should depend on\n * Also most basic use cases should be ok\n */\n// Called by Atom when its value changes\n\n\nfunction propagateChanged$$1(observable$$1) {\n // invariantLOS(observable, \"changed start\");\n if (observable$$1.lowestObserverState === IDerivationState.STALE) return;\n observable$$1.lowestObserverState = IDerivationState.STALE; // Ideally we use for..of here, but the downcompiled version is really slow...\n\n observable$$1.observers.forEach(function (d) {\n if (d.dependenciesState === IDerivationState.UP_TO_DATE) {\n if (d.isTracing !== TraceMode$$1.NONE) {\n logTraceInfo(d, observable$$1);\n }\n\n d.onBecomeStale();\n }\n\n d.dependenciesState = IDerivationState.STALE;\n }); // invariantLOS(observable, \"changed end\");\n} // Called by ComputedValue when it recalculate and its value changed\n\n\nfunction propagateChangeConfirmed$$1(observable$$1) {\n // invariantLOS(observable, \"confirmed start\");\n if (observable$$1.lowestObserverState === IDerivationState.STALE) return;\n observable$$1.lowestObserverState = IDerivationState.STALE;\n observable$$1.observers.forEach(function (d) {\n if (d.dependenciesState === IDerivationState.POSSIBLY_STALE) d.dependenciesState = IDerivationState.STALE;else if (d.dependenciesState === IDerivationState.UP_TO_DATE // this happens during computing of `d`, just keep lowestObserverState up to date.\n ) observable$$1.lowestObserverState = IDerivationState.UP_TO_DATE;\n }); // invariantLOS(observable, \"confirmed end\");\n} // Used by computed when its dependency changed, but we don't wan't to immediately recompute.\n\n\nfunction propagateMaybeChanged$$1(observable$$1) {\n // invariantLOS(observable, \"maybe start\");\n if (observable$$1.lowestObserverState !== IDerivationState.UP_TO_DATE) return;\n observable$$1.lowestObserverState = IDerivationState.POSSIBLY_STALE;\n observable$$1.observers.forEach(function (d) {\n if (d.dependenciesState === IDerivationState.UP_TO_DATE) {\n d.dependenciesState = IDerivationState.POSSIBLY_STALE;\n\n if (d.isTracing !== TraceMode$$1.NONE) {\n logTraceInfo(d, observable$$1);\n }\n\n d.onBecomeStale();\n }\n }); // invariantLOS(observable, \"maybe end\");\n}\n\nfunction logTraceInfo(derivation, observable$$1) {\n console.log(\"[mobx.trace] '\" + derivation.name + \"' is invalidated due to a change in: '\" + observable$$1.name + \"'\");\n\n if (derivation.isTracing === TraceMode$$1.BREAK) {\n var lines = [];\n printDepTree(getDependencyTree$$1(derivation), lines, 1); // prettier-ignore\n\n new Function(\"debugger;\\n/*\\nTracing '\" + derivation.name + \"'\\n\\nYou are entering this break point because derivation '\" + derivation.name + \"' is being traced and '\" + observable$$1.name + \"' is now forcing it to update.\\nJust follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update\\nThe stackframe you are looking for is at least ~6-8 stack-frames up.\\n\\n\" + (derivation instanceof ComputedValue$$1 ? derivation.derivation.toString().replace(/[*]\\//g, \"/\") : \"\") + \"\\n\\nThe dependencies for this derivation are:\\n\\n\" + lines.join(\"\\n\") + \"\\n*/\\n \")();\n }\n}\n\nfunction printDepTree(tree, lines, depth) {\n if (lines.length >= 1000) {\n lines.push(\"(and many more)\");\n return;\n }\n\n lines.push(\"\" + new Array(depth).join(\"\\t\") + tree.name); // MWE: not the fastest, but the easiest way :)\n\n if (tree.dependencies) tree.dependencies.forEach(function (child) {\n return printDepTree(child, lines, depth + 1);\n });\n}\n\nvar Reaction$$1 =\n/** @class */\nfunction () {\n function Reaction$$1(name, onInvalidate, errorHandler) {\n if (name === void 0) {\n name = \"Reaction@\" + getNextId$$1();\n }\n\n this.name = name;\n this.onInvalidate = onInvalidate;\n this.errorHandler = errorHandler;\n this.observing = []; // nodes we are looking at. Our value depends on these nodes\n\n this.newObserving = [];\n this.dependenciesState = IDerivationState.NOT_TRACKING;\n this.diffValue = 0;\n this.runId = 0;\n this.unboundDepsCount = 0;\n this.__mapid = \"#\" + getNextId$$1();\n this.isDisposed = false;\n this._isScheduled = false;\n this._isTrackPending = false;\n this._isRunning = false;\n this.isTracing = TraceMode$$1.NONE;\n }\n\n Reaction$$1.prototype.onBecomeStale = function () {\n this.schedule();\n };\n\n Reaction$$1.prototype.schedule = function () {\n if (!this._isScheduled) {\n this._isScheduled = true;\n globalState$$1.pendingReactions.push(this);\n runReactions$$1();\n }\n };\n\n Reaction$$1.prototype.isScheduled = function () {\n return this._isScheduled;\n };\n /**\n * internal, use schedule() if you intend to kick off a reaction\n */\n\n\n Reaction$$1.prototype.runReaction = function () {\n if (!this.isDisposed) {\n startBatch$$1();\n this._isScheduled = false;\n\n if (shouldCompute$$1(this)) {\n this._isTrackPending = true;\n\n try {\n this.onInvalidate();\n\n if (this._isTrackPending && isSpyEnabled$$1() && \"development\" !== \"production\") {\n // onInvalidate didn't trigger track right away..\n spyReport$$1({\n name: this.name,\n type: \"scheduled-reaction\"\n });\n }\n } catch (e) {\n this.reportExceptionInDerivation(e);\n }\n }\n\n endBatch$$1();\n }\n };\n\n Reaction$$1.prototype.track = function (fn) {\n if (this.isDisposed) {\n fail$$1(\"Reaction already disposed\");\n }\n\n startBatch$$1();\n var notify = isSpyEnabled$$1();\n var startTime;\n\n if (notify && \"development\" !== \"production\") {\n startTime = Date.now();\n spyReportStart$$1({\n name: this.name,\n type: \"reaction\"\n });\n }\n\n this._isRunning = true;\n var result = trackDerivedFunction$$1(this, fn, undefined);\n this._isRunning = false;\n this._isTrackPending = false;\n\n if (this.isDisposed) {\n // disposed during last run. Clean up everything that was bound after the dispose call.\n clearObserving$$1(this);\n }\n\n if (isCaughtException$$1(result)) this.reportExceptionInDerivation(result.cause);\n\n if (notify && \"development\" !== \"production\") {\n spyReportEnd$$1({\n time: Date.now() - startTime\n });\n }\n\n endBatch$$1();\n };\n\n Reaction$$1.prototype.reportExceptionInDerivation = function (error) {\n var _this = this;\n\n if (this.errorHandler) {\n this.errorHandler(error, this);\n return;\n }\n\n if (globalState$$1.disableErrorBoundaries) throw error;\n var message = \"[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '\" + this + \"'\";\n\n if (globalState$$1.suppressReactionErrors) {\n console.warn(\"[mobx] (error in reaction '\" + this.name + \"' suppressed, fix error of causing action below)\"); // prettier-ignore\n } else {\n console.error(message, error);\n /** If debugging brought you here, please, read the above message :-). Tnx! */\n }\n\n if (isSpyEnabled$$1()) {\n spyReport$$1({\n type: \"error\",\n name: this.name,\n message: message,\n error: \"\" + error\n });\n }\n\n globalState$$1.globalReactionErrorHandlers.forEach(function (f) {\n return f(error, _this);\n });\n };\n\n Reaction$$1.prototype.dispose = function () {\n if (!this.isDisposed) {\n this.isDisposed = true;\n\n if (!this._isRunning) {\n // if disposed while running, clean up later. Maybe not optimal, but rare case\n startBatch$$1();\n clearObserving$$1(this);\n endBatch$$1();\n }\n }\n };\n\n Reaction$$1.prototype.getDisposer = function () {\n var r = this.dispose.bind(this);\n r[$mobx$$1] = this;\n return r;\n };\n\n Reaction$$1.prototype.toString = function () {\n return \"Reaction[\" + this.name + \"]\";\n };\n\n Reaction$$1.prototype.trace = function (enterBreakPoint) {\n if (enterBreakPoint === void 0) {\n enterBreakPoint = false;\n }\n\n trace$$1(this, enterBreakPoint);\n };\n\n return Reaction$$1;\n}();\n\nfunction onReactionError$$1(handler) {\n globalState$$1.globalReactionErrorHandlers.push(handler);\n return function () {\n var idx = globalState$$1.globalReactionErrorHandlers.indexOf(handler);\n if (idx >= 0) globalState$$1.globalReactionErrorHandlers.splice(idx, 1);\n };\n}\n/**\n * Magic number alert!\n * Defines within how many times a reaction is allowed to re-trigger itself\n * until it is assumed that this is gonna be a never ending loop...\n */\n\n\nvar MAX_REACTION_ITERATIONS = 100;\n\nvar reactionScheduler = function (f) {\n return f();\n};\n\nfunction runReactions$$1() {\n // Trampolining, if runReactions are already running, new reactions will be picked up\n if (globalState$$1.inBatch > 0 || globalState$$1.isRunningReactions) return;\n reactionScheduler(runReactionsHelper);\n}\n\nfunction runReactionsHelper() {\n globalState$$1.isRunningReactions = true;\n var allReactions = globalState$$1.pendingReactions;\n var iterations = 0; // While running reactions, new reactions might be triggered.\n // Hence we work with two variables and check whether\n // we converge to no remaining reactions after a while.\n\n while (allReactions.length > 0) {\n if (++iterations === MAX_REACTION_ITERATIONS) {\n console.error(\"Reaction doesn't converge to a stable state after \" + MAX_REACTION_ITERATIONS + \" iterations.\" + (\" Probably there is a cycle in the reactive function: \" + allReactions[0]));\n allReactions.splice(0); // clear reactions\n }\n\n var remainingReactions = allReactions.splice(0);\n\n for (var i = 0, l = remainingReactions.length; i < l; i++) remainingReactions[i].runReaction();\n }\n\n globalState$$1.isRunningReactions = false;\n}\n\nvar isReaction$$1 = createInstanceofPredicate$$1(\"Reaction\", Reaction$$1);\n\nfunction setReactionScheduler$$1(fn) {\n var baseScheduler = reactionScheduler;\n\n reactionScheduler = function (f) {\n return fn(function () {\n return baseScheduler(f);\n });\n };\n}\n\nfunction isSpyEnabled$$1() {\n return true && !!globalState$$1.spyListeners.length;\n}\n\nfunction spyReport$$1(event) {\n if (false) {} // dead code elimination can do the rest\n\n if (!globalState$$1.spyListeners.length) return;\n var listeners = globalState$$1.spyListeners;\n\n for (var i = 0, l = listeners.length; i < l; i++) listeners[i](event);\n}\n\nfunction spyReportStart$$1(event) {\n if (false) {}\n\n var change = __assign({}, event, {\n spyReportStart: true\n });\n\n spyReport$$1(change);\n}\n\nvar END_EVENT = {\n spyReportEnd: true\n};\n\nfunction spyReportEnd$$1(change) {\n if (false) {}\n if (change) spyReport$$1(__assign({}, change, {\n spyReportEnd: true\n }));else spyReport$$1(END_EVENT);\n}\n\nfunction spy$$1(listener) {\n if (false) {} else {\n globalState$$1.spyListeners.push(listener);\n return once$$1(function () {\n globalState$$1.spyListeners = globalState$$1.spyListeners.filter(function (l) {\n return l !== listener;\n });\n });\n }\n}\n\nfunction dontReassignFields() {\n fail$$1( true && \"@action fields are not reassignable\");\n}\n\nfunction namedActionDecorator$$1(name) {\n return function (target, prop, descriptor) {\n if (descriptor) {\n if ( true && descriptor.get !== undefined) {\n return fail$$1(\"@action cannot be used with getters\");\n } // babel / typescript\n // @action method() { }\n\n\n if (descriptor.value) {\n // typescript\n return {\n value: createAction$$1(name, descriptor.value),\n enumerable: false,\n configurable: true,\n writable: true // for typescript, this must be writable, otherwise it cannot inherit :/ (see inheritable actions test)\n\n };\n } // babel only: @action method = () => {}\n\n\n var initializer_1 = descriptor.initializer;\n return {\n enumerable: false,\n configurable: true,\n writable: true,\n initializer: function () {\n // N.B: we can't immediately invoke initializer; this would be wrong\n return createAction$$1(name, initializer_1.call(this));\n }\n };\n } // bound instance methods\n\n\n return actionFieldDecorator$$1(name).apply(this, arguments);\n };\n}\n\nfunction actionFieldDecorator$$1(name) {\n // Simple property that writes on first invocation to the current instance\n return function (target, prop, descriptor) {\n Object.defineProperty(target, prop, {\n configurable: true,\n enumerable: false,\n get: function () {\n return undefined;\n },\n set: function (value) {\n addHiddenProp$$1(this, prop, action$$1(name, value));\n }\n });\n };\n}\n\nfunction boundActionDecorator$$1(target, propertyName, descriptor, applyToInstance) {\n if (applyToInstance === true) {\n defineBoundAction$$1(target, propertyName, descriptor.value);\n return null;\n }\n\n if (descriptor) {\n // if (descriptor.value)\n // Typescript / Babel: @action.bound method() { }\n // also: babel @action.bound method = () => {}\n return {\n configurable: true,\n enumerable: false,\n get: function () {\n defineBoundAction$$1(this, propertyName, descriptor.value || descriptor.initializer.call(this));\n return this[propertyName];\n },\n set: dontReassignFields\n };\n } // field decorator Typescript @action.bound method = () => {}\n\n\n return {\n enumerable: false,\n configurable: true,\n set: function (v) {\n defineBoundAction$$1(this, propertyName, v);\n },\n get: function () {\n return undefined;\n }\n };\n}\n\nvar action$$1 = function action$$1(arg1, arg2, arg3, arg4) {\n // action(fn() {})\n if (arguments.length === 1 && typeof arg1 === \"function\") return createAction$$1(arg1.name || \"<unnamed action>\", arg1); // action(\"name\", fn() {})\n\n if (arguments.length === 2 && typeof arg2 === \"function\") return createAction$$1(arg1, arg2); // @action(\"name\") fn() {}\n\n if (arguments.length === 1 && typeof arg1 === \"string\") return namedActionDecorator$$1(arg1); // @action fn() {}\n\n if (arg4 === true) {\n // apply to instance immediately\n addHiddenProp$$1(arg1, arg2, createAction$$1(arg1.name || arg2, arg3.value, this));\n } else {\n return namedActionDecorator$$1(arg2).apply(null, arguments);\n }\n};\n\naction$$1.bound = boundActionDecorator$$1;\n\nfunction runInAction$$1(arg1, arg2) {\n var actionName = typeof arg1 === \"string\" ? arg1 : arg1.name || \"<unnamed action>\";\n var fn = typeof arg1 === \"function\" ? arg1 : arg2;\n\n if (true) {\n invariant$$1(typeof fn === \"function\" && fn.length === 0, \"`runInAction` expects a function without arguments\");\n if (typeof actionName !== \"string\" || !actionName) fail$$1(\"actions should have valid names, got: '\" + actionName + \"'\");\n }\n\n return executeAction$$1(actionName, fn, this, undefined);\n}\n\nfunction isAction$$1(thing) {\n return typeof thing === \"function\" && thing.isMobxAction === true;\n}\n\nfunction defineBoundAction$$1(target, propertyName, fn) {\n addHiddenProp$$1(target, propertyName, createAction$$1(propertyName, fn.bind(target)));\n}\n/**\n * Creates a named reactive view and keeps it alive, so that the view is always\n * updated if one of the dependencies changes, even when the view is not further used by something else.\n * @param view The reactive view\n * @returns disposer function, which can be used to stop the view from being updated in the future.\n */\n\n\nfunction autorun$$1(view, opts) {\n if (opts === void 0) {\n opts = EMPTY_OBJECT$$1;\n }\n\n if (true) {\n invariant$$1(typeof view === \"function\", \"Autorun expects a function as first argument\");\n invariant$$1(isAction$$1(view) === false, \"Autorun does not accept actions since actions are untrackable\");\n }\n\n var name = opts && opts.name || view.name || \"Autorun@\" + getNextId$$1();\n var runSync = !opts.scheduler && !opts.delay;\n var reaction$$1;\n\n if (runSync) {\n // normal autorun\n reaction$$1 = new Reaction$$1(name, function () {\n this.track(reactionRunner);\n }, opts.onError);\n } else {\n var scheduler_1 = createSchedulerFromOptions(opts); // debounced autorun\n\n var isScheduled_1 = false;\n reaction$$1 = new Reaction$$1(name, function () {\n if (!isScheduled_1) {\n isScheduled_1 = true;\n scheduler_1(function () {\n isScheduled_1 = false;\n if (!reaction$$1.isDisposed) reaction$$1.track(reactionRunner);\n });\n }\n }, opts.onError);\n }\n\n function reactionRunner() {\n view(reaction$$1);\n }\n\n reaction$$1.schedule();\n return reaction$$1.getDisposer();\n}\n\nvar run = function (f) {\n return f();\n};\n\nfunction createSchedulerFromOptions(opts) {\n return opts.scheduler ? opts.scheduler : opts.delay ? function (f) {\n return setTimeout(f, opts.delay);\n } : run;\n}\n\nfunction reaction$$1(expression, effect, opts) {\n if (opts === void 0) {\n opts = EMPTY_OBJECT$$1;\n }\n\n if (true) {\n invariant$$1(typeof expression === \"function\", \"First argument to reaction should be a function\");\n invariant$$1(typeof opts === \"object\", \"Third argument of reactions should be an object\");\n }\n\n var name = opts.name || \"Reaction@\" + getNextId$$1();\n var effectAction = action$$1(name, opts.onError ? wrapErrorHandler(opts.onError, effect) : effect);\n var runSync = !opts.scheduler && !opts.delay;\n var scheduler = createSchedulerFromOptions(opts);\n var firstTime = true;\n var isScheduled = false;\n var value;\n var equals = opts.compareStructural ? comparer$$1.structural : opts.equals || comparer$$1.default;\n var r = new Reaction$$1(name, function () {\n if (firstTime || runSync) {\n reactionRunner();\n } else if (!isScheduled) {\n isScheduled = true;\n scheduler(reactionRunner);\n }\n }, opts.onError);\n\n function reactionRunner() {\n isScheduled = false; // Q: move into reaction runner?\n\n if (r.isDisposed) return;\n var changed = false;\n r.track(function () {\n var nextValue = expression(r);\n changed = firstTime || !equals(value, nextValue);\n value = nextValue;\n });\n if (firstTime && opts.fireImmediately) effectAction(value, r);\n if (!firstTime && changed === true) effectAction(value, r);\n if (firstTime) firstTime = false;\n }\n\n r.schedule();\n return r.getDisposer();\n}\n\nfunction wrapErrorHandler(errorHandler, baseFn) {\n return function () {\n try {\n return baseFn.apply(this, arguments);\n } catch (e) {\n errorHandler.call(this, e);\n }\n };\n}\n\nfunction onBecomeObserved$$1(thing, arg2, arg3) {\n return interceptHook(\"onBecomeObserved\", thing, arg2, arg3);\n}\n\nfunction onBecomeUnobserved$$1(thing, arg2, arg3) {\n return interceptHook(\"onBecomeUnobserved\", thing, arg2, arg3);\n}\n\nfunction interceptHook(hook, thing, arg2, arg3) {\n var atom = typeof arg2 === \"string\" ? getAtom$$1(thing, arg2) : getAtom$$1(thing);\n var cb = typeof arg2 === \"string\" ? arg3 : arg2;\n var listenersKey = hook + \"Listeners\";\n\n if (atom[listenersKey]) {\n atom[listenersKey].add(cb);\n } else {\n atom[listenersKey] = new Set([cb]);\n }\n\n var orig = atom[hook];\n if (typeof orig !== \"function\") return fail$$1( true && \"Not an atom that can be (un)observed\");\n return function () {\n var hookListeners = atom[listenersKey];\n\n if (hookListeners) {\n hookListeners.delete(cb);\n\n if (hookListeners.size === 0) {\n delete atom[listenersKey];\n }\n }\n };\n}\n\nfunction configure$$1(options) {\n var enforceActions = options.enforceActions,\n computedRequiresReaction = options.computedRequiresReaction,\n disableErrorBoundaries = options.disableErrorBoundaries,\n reactionScheduler = options.reactionScheduler;\n\n if (options.isolateGlobalState === true) {\n isolateGlobalState$$1();\n }\n\n if (enforceActions !== undefined) {\n if (typeof enforceActions === \"boolean\" || enforceActions === \"strict\") deprecated$$1(\"Deprecated value for 'enforceActions', use 'false' => '\\\"never\\\"', 'true' => '\\\"observed\\\"', '\\\"strict\\\"' => \\\"'always'\\\" instead\");\n var ea = void 0;\n\n switch (enforceActions) {\n case true:\n case \"observed\":\n ea = true;\n break;\n\n case false:\n case \"never\":\n ea = false;\n break;\n\n case \"strict\":\n case \"always\":\n ea = \"strict\";\n break;\n\n default:\n fail$$1(\"Invalid value for 'enforceActions': '\" + enforceActions + \"', expected 'never', 'always' or 'observed'\");\n }\n\n globalState$$1.enforceActions = ea;\n globalState$$1.allowStateChanges = ea === true || ea === \"strict\" ? false : true;\n }\n\n if (computedRequiresReaction !== undefined) {\n globalState$$1.computedRequiresReaction = !!computedRequiresReaction;\n }\n\n if (disableErrorBoundaries !== undefined) {\n if (disableErrorBoundaries === true) console.warn(\"WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled.\");\n globalState$$1.disableErrorBoundaries = !!disableErrorBoundaries;\n }\n\n if (reactionScheduler) {\n setReactionScheduler$$1(reactionScheduler);\n }\n}\n\nfunction decorate$$1(thing, decorators) {\n true && invariant$$1(isPlainObject$$1(decorators), \"Decorators should be a key value map\");\n var target = typeof thing === \"function\" ? thing.prototype : thing;\n\n var _loop_1 = function (prop) {\n var propertyDecorators = decorators[prop];\n\n if (!Array.isArray(propertyDecorators)) {\n propertyDecorators = [propertyDecorators];\n }\n\n true && invariant$$1(propertyDecorators.every(function (decorator) {\n return typeof decorator === \"function\";\n }), \"Decorate: expected a decorator function or array of decorator functions for '\" + prop + \"'\");\n var descriptor = Object.getOwnPropertyDescriptor(target, prop);\n var newDescriptor = propertyDecorators.reduce(function (accDescriptor, decorator) {\n return decorator(target, prop, accDescriptor);\n }, descriptor);\n if (newDescriptor) Object.defineProperty(target, prop, newDescriptor);\n };\n\n for (var prop in decorators) {\n _loop_1(prop);\n }\n\n return thing;\n}\n\nfunction extendObservable$$1(target, properties, decorators, options) {\n if (true) {\n invariant$$1(arguments.length >= 2 && arguments.length <= 4, \"'extendObservable' expected 2-4 arguments\");\n invariant$$1(typeof target === \"object\", \"'extendObservable' expects an object as first argument\");\n invariant$$1(!isObservableMap$$1(target), \"'extendObservable' should not be used on maps, use map.merge instead\");\n }\n\n options = asCreateObservableOptions$$1(options);\n var defaultDecorator = getDefaultDecoratorFromObjectOptions$$1(options);\n initializeInstance$$1(target); // Fixes #1740\n\n asObservableObject$$1(target, options.name, defaultDecorator.enhancer); // make sure object is observable, even without initial props\n\n if (properties) extendObservableObjectWithProperties$$1(target, properties, decorators, defaultDecorator);\n return target;\n}\n\nfunction getDefaultDecoratorFromObjectOptions$$1(options) {\n return options.defaultDecorator || (options.deep === false ? refDecorator$$1 : deepDecorator$$1);\n}\n\nfunction extendObservableObjectWithProperties$$1(target, properties, decorators, defaultDecorator) {\n if (true) {\n invariant$$1(!isObservable$$1(properties), \"Extending an object with another observable (object) is not supported. Please construct an explicit propertymap, using `toJS` if need. See issue #540\");\n if (decorators) for (var key in decorators) if (!(key in properties)) fail$$1(\"Trying to declare a decorator for unspecified property '\" + key + \"'\");\n }\n\n startBatch$$1();\n\n try {\n for (var key in properties) {\n var descriptor = Object.getOwnPropertyDescriptor(properties, key);\n\n if (true) {\n if (Object.getOwnPropertyDescriptor(target, key)) fail$$1(\"'extendObservable' can only be used to introduce new properties. Use 'set' or 'decorate' instead. The property '\" + key + \"' already exists on '\" + target + \"'\");\n if (isComputed$$1(descriptor.value)) fail$$1(\"Passing a 'computed' as initial property value is no longer supported by extendObservable. Use a getter or decorator instead\");\n }\n\n var decorator = decorators && key in decorators ? decorators[key] : descriptor.get ? computedDecorator$$1 : defaultDecorator;\n if ( true && typeof decorator !== \"function\") fail$$1(\"Not a valid decorator for '\" + key + \"', got: \" + decorator);\n var resultDescriptor = decorator(target, key, descriptor, true);\n if (resultDescriptor // otherwise, assume already applied, due to `applyToInstance`\n ) Object.defineProperty(target, key, resultDescriptor);\n }\n } finally {\n endBatch$$1();\n }\n}\n\nfunction getDependencyTree$$1(thing, property) {\n return nodeToDependencyTree(getAtom$$1(thing, property));\n}\n\nfunction nodeToDependencyTree(node) {\n var result = {\n name: node.name\n };\n if (node.observing && node.observing.length > 0) result.dependencies = unique$$1(node.observing).map(nodeToDependencyTree);\n return result;\n}\n\nfunction getObserverTree$$1(thing, property) {\n return nodeToObserverTree(getAtom$$1(thing, property));\n}\n\nfunction nodeToObserverTree(node) {\n var result = {\n name: node.name\n };\n if (hasObservers$$1(node)) result.observers = Array.from(getObservers$$1(node)).map(nodeToObserverTree);\n return result;\n}\n\nvar generatorId = 0;\n\nfunction flow$$1(generator) {\n if (arguments.length !== 1) fail$$1( true && \"Flow expects one 1 argument and cannot be used as decorator\");\n var name = generator.name || \"<unnamed flow>\"; // Implementation based on https://github.com/tj/co/blob/master/index.js\n\n return function () {\n var ctx = this;\n var args = arguments;\n var runId = ++generatorId;\n var gen = action$$1(name + \" - runid: \" + runId + \" - init\", generator).apply(ctx, args);\n var rejector;\n var pendingPromise = undefined;\n var promise = new Promise(function (resolve, reject) {\n var stepId = 0;\n rejector = reject;\n\n function onFulfilled(res) {\n pendingPromise = undefined;\n var ret;\n\n try {\n ret = action$$1(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen.next).call(gen, res);\n } catch (e) {\n return reject(e);\n }\n\n next(ret);\n }\n\n function onRejected(err) {\n pendingPromise = undefined;\n var ret;\n\n try {\n ret = action$$1(name + \" - runid: \" + runId + \" - yield \" + stepId++, gen.throw).call(gen, err);\n } catch (e) {\n return reject(e);\n }\n\n next(ret);\n }\n\n function next(ret) {\n if (ret && typeof ret.then === \"function\") {\n // an async iterator\n ret.then(next, reject);\n return;\n }\n\n if (ret.done) return resolve(ret.value);\n pendingPromise = Promise.resolve(ret.value);\n return pendingPromise.then(onFulfilled, onRejected);\n }\n\n onFulfilled(undefined); // kick off the process\n });\n promise.cancel = action$$1(name + \" - runid: \" + runId + \" - cancel\", function () {\n try {\n if (pendingPromise) cancelPromise(pendingPromise); // Finally block can return (or yield) stuff..\n\n var res = gen.return(); // eat anything that promise would do, it's cancelled!\n\n var yieldedPromise = Promise.resolve(res.value);\n yieldedPromise.then(noop$$1, noop$$1);\n cancelPromise(yieldedPromise); // maybe it can be cancelled :)\n // reject our original promise\n\n rejector(new Error(\"FLOW_CANCELLED\"));\n } catch (e) {\n rejector(e); // there could be a throwing finally block\n }\n });\n return promise;\n };\n}\n\nfunction cancelPromise(promise) {\n if (typeof promise.cancel === \"function\") promise.cancel();\n}\n\nfunction interceptReads$$1(thing, propOrHandler, handler) {\n var target;\n\n if (isObservableMap$$1(thing) || isObservableArray$$1(thing) || isObservableValue$$1(thing)) {\n target = getAdministration$$1(thing);\n } else if (isObservableObject$$1(thing)) {\n if (typeof propOrHandler !== \"string\") return fail$$1( true && \"InterceptReads can only be used with a specific property, not with an object in general\");\n target = getAdministration$$1(thing, propOrHandler);\n } else {\n return fail$$1( true && \"Expected observable map, object or array as first array\");\n }\n\n if (target.dehancer !== undefined) return fail$$1( true && \"An intercept reader was already established\");\n target.dehancer = typeof propOrHandler === \"function\" ? propOrHandler : handler;\n return function () {\n target.dehancer = undefined;\n };\n}\n\nfunction intercept$$1(thing, propOrHandler, handler) {\n if (typeof handler === \"function\") return interceptProperty(thing, propOrHandler, handler);else return interceptInterceptable(thing, propOrHandler);\n}\n\nfunction interceptInterceptable(thing, handler) {\n return getAdministration$$1(thing).intercept(handler);\n}\n\nfunction interceptProperty(thing, property, handler) {\n return getAdministration$$1(thing, property).intercept(handler);\n}\n\nfunction _isComputed$$1(value, property) {\n if (value === null || value === undefined) return false;\n\n if (property !== undefined) {\n if (isObservableObject$$1(value) === false) return false;\n if (!value[$mobx$$1].values.has(property)) return false;\n var atom = getAtom$$1(value, property);\n return isComputedValue$$1(atom);\n }\n\n return isComputedValue$$1(value);\n}\n\nfunction isComputed$$1(value) {\n if (arguments.length > 1) return fail$$1( true && \"isComputed expects only 1 argument. Use isObservableProp to inspect the observability of a property\");\n return _isComputed$$1(value);\n}\n\nfunction isComputedProp$$1(value, propName) {\n if (typeof propName !== \"string\") return fail$$1( true && \"isComputed expected a property name as second argument\");\n return _isComputed$$1(value, propName);\n}\n\nfunction _isObservable(value, property) {\n if (value === null || value === undefined) return false;\n\n if (property !== undefined) {\n if ( true && (isObservableMap$$1(value) || isObservableArray$$1(value))) return fail$$1(\"isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.\");\n\n if (isObservableObject$$1(value)) {\n return value[$mobx$$1].values.has(property);\n }\n\n return false;\n } // For first check, see #701\n\n\n return isObservableObject$$1(value) || !!value[$mobx$$1] || isAtom$$1(value) || isReaction$$1(value) || isComputedValue$$1(value);\n}\n\nfunction isObservable$$1(value) {\n if (arguments.length !== 1) fail$$1( true && \"isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property\");\n return _isObservable(value);\n}\n\nfunction isObservableProp$$1(value, propName) {\n if (typeof propName !== \"string\") return fail$$1( true && \"expected a property name as second argument\");\n return _isObservable(value, propName);\n}\n\nfunction keys$$1(obj) {\n if (isObservableObject$$1(obj)) {\n return obj[$mobx$$1].getKeys();\n }\n\n if (isObservableMap$$1(obj)) {\n return Array.from(obj.keys());\n }\n\n if (isObservableSet$$1(obj)) {\n return Array.from(obj.keys());\n }\n\n if (isObservableArray$$1(obj)) {\n return obj.map(function (_, index) {\n return index;\n });\n }\n\n return fail$$1( true && \"'keys()' can only be used on observable objects, arrays, sets and maps\");\n}\n\nfunction values$$1(obj) {\n if (isObservableObject$$1(obj)) {\n return keys$$1(obj).map(function (key) {\n return obj[key];\n });\n }\n\n if (isObservableMap$$1(obj)) {\n return keys$$1(obj).map(function (key) {\n return obj.get(key);\n });\n }\n\n if (isObservableSet$$1(obj)) {\n return Array.from(obj.values());\n }\n\n if (isObservableArray$$1(obj)) {\n return obj.slice();\n }\n\n return fail$$1( true && \"'values()' can only be used on observable objects, arrays, sets and maps\");\n}\n\nfunction entries$$1(obj) {\n if (isObservableObject$$1(obj)) {\n return keys$$1(obj).map(function (key) {\n return [key, obj[key]];\n });\n }\n\n if (isObservableMap$$1(obj)) {\n return keys$$1(obj).map(function (key) {\n return [key, obj.get(key)];\n });\n }\n\n if (isObservableSet$$1(obj)) {\n return Array.from(obj.entries());\n }\n\n if (isObservableArray$$1(obj)) {\n return obj.map(function (key, index) {\n return [index, key];\n });\n }\n\n return fail$$1( true && \"'entries()' can only be used on observable objects, arrays and maps\");\n}\n\nfunction set$$1(obj, key, value) {\n if (arguments.length === 2) {\n startBatch$$1();\n var values_1 = key;\n\n try {\n for (var key_1 in values_1) set$$1(obj, key_1, values_1[key_1]);\n } finally {\n endBatch$$1();\n }\n\n return;\n }\n\n if (isObservableObject$$1(obj)) {\n var adm = obj[$mobx$$1];\n var existingObservable = adm.values.get(key);\n\n if (existingObservable) {\n adm.write(key, value);\n } else {\n adm.addObservableProp(key, value, adm.defaultEnhancer);\n }\n } else if (isObservableMap$$1(obj)) {\n obj.set(key, value);\n } else if (isObservableArray$$1(obj)) {\n if (typeof key !== \"number\") key = parseInt(key, 10);\n invariant$$1(key >= 0, \"Not a valid index: '\" + key + \"'\");\n startBatch$$1();\n if (key >= obj.length) obj.length = key + 1;\n obj[key] = value;\n endBatch$$1();\n } else {\n return fail$$1( true && \"'set()' can only be used on observable objects, arrays and maps\");\n }\n}\n\nfunction remove$$1(obj, key) {\n if (isObservableObject$$1(obj)) {\n obj[$mobx$$1].remove(key);\n } else if (isObservableMap$$1(obj)) {\n obj.delete(key);\n } else if (isObservableSet$$1(obj)) {\n obj.delete(key);\n } else if (isObservableArray$$1(obj)) {\n if (typeof key !== \"number\") key = parseInt(key, 10);\n invariant$$1(key >= 0, \"Not a valid index: '\" + key + \"'\");\n obj.splice(key, 1);\n } else {\n return fail$$1( true && \"'remove()' can only be used on observable objects, arrays and maps\");\n }\n}\n\nfunction has$$1(obj, key) {\n if (isObservableObject$$1(obj)) {\n // return keys(obj).indexOf(key) >= 0\n var adm = getAdministration$$1(obj);\n return adm.has(key);\n } else if (isObservableMap$$1(obj)) {\n return obj.has(key);\n } else if (isObservableSet$$1(obj)) {\n return obj.has(key);\n } else if (isObservableArray$$1(obj)) {\n return key >= 0 && key < obj.length;\n } else {\n return fail$$1( true && \"'has()' can only be used on observable objects, arrays and maps\");\n }\n}\n\nfunction get$$1(obj, key) {\n if (!has$$1(obj, key)) return undefined;\n\n if (isObservableObject$$1(obj)) {\n return obj[key];\n } else if (isObservableMap$$1(obj)) {\n return obj.get(key);\n } else if (isObservableArray$$1(obj)) {\n return obj[key];\n } else {\n return fail$$1( true && \"'get()' can only be used on observable objects, arrays and maps\");\n }\n}\n\nfunction observe$$1(thing, propOrCb, cbOrFire, fireImmediately) {\n if (typeof cbOrFire === \"function\") return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);else return observeObservable(thing, propOrCb, cbOrFire);\n}\n\nfunction observeObservable(thing, listener, fireImmediately) {\n return getAdministration$$1(thing).observe(listener, fireImmediately);\n}\n\nfunction observeObservableProperty(thing, property, listener, fireImmediately) {\n return getAdministration$$1(thing, property).observe(listener, fireImmediately);\n}\n\nvar defaultOptions = {\n detectCycles: true,\n exportMapsAsObjects: true,\n recurseEverything: false\n};\n\nfunction cache(map, key, value, options) {\n if (options.detectCycles) map.set(key, value);\n return value;\n}\n\nfunction toJSHelper(source, options, __alreadySeen) {\n if (!options.recurseEverything && !isObservable$$1(source)) return source;\n if (typeof source !== \"object\") return source; // Directly return null if source is null\n\n if (source === null) return null; // Directly return the Date object itself if contained in the observable\n\n if (source instanceof Date) return source;\n if (isObservableValue$$1(source)) return toJSHelper(source.get(), options, __alreadySeen); // make sure we track the keys of the object\n\n if (isObservable$$1(source)) keys$$1(source);\n var detectCycles = options.detectCycles === true;\n\n if (detectCycles && source !== null && __alreadySeen.has(source)) {\n return __alreadySeen.get(source);\n }\n\n if (isObservableArray$$1(source) || Array.isArray(source)) {\n var res_1 = cache(__alreadySeen, source, [], options);\n var toAdd = source.map(function (value) {\n return toJSHelper(value, options, __alreadySeen);\n });\n res_1.length = toAdd.length;\n\n for (var i = 0, l = toAdd.length; i < l; i++) res_1[i] = toAdd[i];\n\n return res_1;\n }\n\n if (isObservableSet$$1(source) || Object.getPrototypeOf(source) === Set.prototype) {\n if (options.exportMapsAsObjects === false) {\n var res_2 = cache(__alreadySeen, source, new Set(), options);\n source.forEach(function (value) {\n res_2.add(toJSHelper(value, options, __alreadySeen));\n });\n return res_2;\n } else {\n var res_3 = cache(__alreadySeen, source, [], options);\n source.forEach(function (value) {\n res_3.push(toJSHelper(value, options, __alreadySeen));\n });\n return res_3;\n }\n }\n\n if (isObservableMap$$1(source) || Object.getPrototypeOf(source) === Map.prototype) {\n if (options.exportMapsAsObjects === false) {\n var res_4 = cache(__alreadySeen, source, new Map(), options);\n source.forEach(function (value, key) {\n res_4.set(key, toJSHelper(value, options, __alreadySeen));\n });\n return res_4;\n } else {\n var res_5 = cache(__alreadySeen, source, {}, options);\n source.forEach(function (value, key) {\n res_5[key] = toJSHelper(value, options, __alreadySeen);\n });\n return res_5;\n }\n } // Fallback to the situation that source is an ObservableObject or a plain object\n\n\n var res = cache(__alreadySeen, source, {}, options);\n\n for (var key in source) {\n res[key] = toJSHelper(source[key], options, __alreadySeen);\n }\n\n return res;\n}\n\nfunction toJS$$1(source, options) {\n // backward compatibility\n if (typeof options === \"boolean\") options = {\n detectCycles: options\n };\n if (!options) options = defaultOptions;\n options.detectCycles = options.detectCycles === undefined ? options.recurseEverything === true : options.detectCycles === true;\n\n var __alreadySeen;\n\n if (options.detectCycles) __alreadySeen = new Map();\n return toJSHelper(source, options, __alreadySeen);\n}\n\nfunction trace$$1() {\n var args = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n\n var enterBreakPoint = false;\n if (typeof args[args.length - 1] === \"boolean\") enterBreakPoint = args.pop();\n var derivation = getAtomFromArgs(args);\n\n if (!derivation) {\n return fail$$1( true && \"'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly\");\n }\n\n if (derivation.isTracing === TraceMode$$1.NONE) {\n console.log(\"[mobx.trace] '\" + derivation.name + \"' tracing enabled\");\n }\n\n derivation.isTracing = enterBreakPoint ? TraceMode$$1.BREAK : TraceMode$$1.LOG;\n}\n\nfunction getAtomFromArgs(args) {\n switch (args.length) {\n case 0:\n return globalState$$1.trackingDerivation;\n\n case 1:\n return getAtom$$1(args[0]);\n\n case 2:\n return getAtom$$1(args[0], args[1]);\n }\n}\n/**\n * During a transaction no views are updated until the end of the transaction.\n * The transaction will be run synchronously nonetheless.\n *\n * @param action a function that updates some reactive state\n * @returns any value that was returned by the 'action' parameter.\n */\n\n\nfunction transaction$$1(action$$1, thisArg) {\n if (thisArg === void 0) {\n thisArg = undefined;\n }\n\n startBatch$$1();\n\n try {\n return action$$1.apply(thisArg);\n } finally {\n endBatch$$1();\n }\n}\n\nfunction when$$1(predicate, arg1, arg2) {\n if (arguments.length === 1 || arg1 && typeof arg1 === \"object\") return whenPromise(predicate, arg1);\n return _when(predicate, arg1, arg2 || {});\n}\n\nfunction _when(predicate, effect, opts) {\n var timeoutHandle;\n\n if (typeof opts.timeout === \"number\") {\n timeoutHandle = setTimeout(function () {\n if (!disposer[$mobx$$1].isDisposed) {\n disposer();\n var error = new Error(\"WHEN_TIMEOUT\");\n if (opts.onError) opts.onError(error);else throw error;\n }\n }, opts.timeout);\n }\n\n opts.name = opts.name || \"When@\" + getNextId$$1();\n var effectAction = createAction$$1(opts.name + \"-effect\", effect);\n var disposer = autorun$$1(function (r) {\n if (predicate()) {\n r.dispose();\n if (timeoutHandle) clearTimeout(timeoutHandle);\n effectAction();\n }\n }, opts);\n return disposer;\n}\n\nfunction whenPromise(predicate, opts) {\n if ( true && opts && opts.onError) return fail$$1(\"the options 'onError' and 'promise' cannot be combined\");\n var cancel;\n var res = new Promise(function (resolve, reject) {\n var disposer = _when(predicate, resolve, __assign({}, opts, {\n onError: reject\n }));\n\n cancel = function () {\n disposer();\n reject(\"WHEN_CANCELLED\");\n };\n });\n res.cancel = cancel;\n return res;\n}\n\nfunction getAdm(target) {\n return target[$mobx$$1];\n} // Optimization: we don't need the intermediate objects and could have a completely custom administration for DynamicObjects,\n// and skip either the internal values map, or the base object with its property descriptors!\n\n\nvar objectProxyTraps = {\n has: function (target, name) {\n if (name === $mobx$$1 || name === \"constructor\" || name === mobxDidRunLazyInitializersSymbol$$1) return true;\n var adm = getAdm(target); // MWE: should `in` operator be reactive? If not, below code path will be faster / more memory efficient\n // TODO: check performance stats!\n // if (adm.values.get(name as string)) return true\n\n if (typeof name === \"string\") return adm.has(name);\n return name in target;\n },\n get: function (target, name) {\n if (name === $mobx$$1 || name === \"constructor\" || name === mobxDidRunLazyInitializersSymbol$$1) return target[name];\n var adm = getAdm(target);\n var observable$$1 = adm.values.get(name);\n\n if (observable$$1 instanceof Atom$$1) {\n var result = observable$$1.get();\n\n if (result === undefined) {\n // This fixes #1796, because deleting a prop that has an\n // undefined value won't retrigger a observer (no visible effect),\n // the autorun wouldn't subscribe to future key changes (see also next comment)\n adm.has(name);\n }\n\n return result;\n } // make sure we start listening to future keys\n // note that we only do this here for optimization\n\n\n if (typeof name === \"string\") adm.has(name);\n return target[name];\n },\n set: function (target, name, value) {\n if (typeof name !== \"string\") return false;\n set$$1(target, name, value);\n return true;\n },\n deleteProperty: function (target, name) {\n if (typeof name !== \"string\") return false;\n var adm = getAdm(target);\n adm.remove(name);\n return true;\n },\n ownKeys: function (target) {\n var adm = getAdm(target);\n adm.keysAtom.reportObserved();\n return Reflect.ownKeys(target);\n },\n preventExtensions: function (target) {\n fail$$1(\"Dynamic observable objects cannot be frozen\");\n return false;\n }\n};\n\nfunction createDynamicObservableObject$$1(base) {\n var proxy = new Proxy(base, objectProxyTraps);\n base[$mobx$$1].proxy = proxy;\n return proxy;\n}\n\nfunction hasInterceptors$$1(interceptable) {\n return interceptable.interceptors !== undefined && interceptable.interceptors.length > 0;\n}\n\nfunction registerInterceptor$$1(interceptable, handler) {\n var interceptors = interceptable.interceptors || (interceptable.interceptors = []);\n interceptors.push(handler);\n return once$$1(function () {\n var idx = interceptors.indexOf(handler);\n if (idx !== -1) interceptors.splice(idx, 1);\n });\n}\n\nfunction interceptChange$$1(interceptable, change) {\n var prevU = untrackedStart$$1();\n\n try {\n var interceptors = interceptable.interceptors;\n if (interceptors) for (var i = 0, l = interceptors.length; i < l; i++) {\n change = interceptors[i](change);\n invariant$$1(!change || change.type, \"Intercept handlers should return nothing or a change object\");\n if (!change) break;\n }\n return change;\n } finally {\n untrackedEnd$$1(prevU);\n }\n}\n\nfunction hasListeners$$1(listenable) {\n return listenable.changeListeners !== undefined && listenable.changeListeners.length > 0;\n}\n\nfunction registerListener$$1(listenable, handler) {\n var listeners = listenable.changeListeners || (listenable.changeListeners = []);\n listeners.push(handler);\n return once$$1(function () {\n var idx = listeners.indexOf(handler);\n if (idx !== -1) listeners.splice(idx, 1);\n });\n}\n\nfunction notifyListeners$$1(listenable, change) {\n var prevU = untrackedStart$$1();\n var listeners = listenable.changeListeners;\n if (!listeners) return;\n listeners = listeners.slice();\n\n for (var i = 0, l = listeners.length; i < l; i++) {\n listeners[i](change);\n }\n\n untrackedEnd$$1(prevU);\n}\n\nvar MAX_SPLICE_SIZE = 10000; // See e.g. https://github.com/mobxjs/mobx/issues/859\n\nvar arrayTraps = {\n get: function (target, name) {\n if (name === $mobx$$1) return target[$mobx$$1];\n if (name === \"length\") return target[$mobx$$1].getArrayLength();\n\n if (typeof name === \"number\") {\n return arrayExtensions.get.call(target, name);\n }\n\n if (typeof name === \"string\" && !isNaN(name)) {\n return arrayExtensions.get.call(target, parseInt(name));\n }\n\n if (arrayExtensions.hasOwnProperty(name)) {\n return arrayExtensions[name];\n }\n\n return target[name];\n },\n set: function (target, name, value) {\n if (name === \"length\") {\n target[$mobx$$1].setArrayLength(value);\n return true;\n }\n\n if (typeof name === \"number\") {\n arrayExtensions.set.call(target, name, value);\n return true;\n }\n\n if (!isNaN(name)) {\n arrayExtensions.set.call(target, parseInt(name), value);\n return true;\n }\n\n return false;\n },\n preventExtensions: function (target) {\n fail$$1(\"Observable arrays cannot be frozen\");\n return false;\n }\n};\n\nfunction createObservableArray$$1(initialValues, enhancer, name, owned) {\n if (name === void 0) {\n name = \"ObservableArray@\" + getNextId$$1();\n }\n\n if (owned === void 0) {\n owned = false;\n }\n\n var adm = new ObservableArrayAdministration(name, enhancer, owned);\n addHiddenFinalProp$$1(adm.values, $mobx$$1, adm);\n var proxy = new Proxy(adm.values, arrayTraps);\n adm.proxy = proxy;\n\n if (initialValues && initialValues.length) {\n var prev = allowStateChangesStart$$1(true);\n adm.spliceWithArray(0, 0, initialValues);\n allowStateChangesEnd$$1(prev);\n }\n\n return proxy;\n}\n\nvar ObservableArrayAdministration =\n/** @class */\nfunction () {\n function ObservableArrayAdministration(name, enhancer, owned) {\n this.owned = owned;\n this.values = [];\n this.proxy = undefined;\n this.lastKnownLength = 0;\n this.atom = new Atom$$1(name || \"ObservableArray@\" + getNextId$$1());\n\n this.enhancer = function (newV, oldV) {\n return enhancer(newV, oldV, name + \"[..]\");\n };\n }\n\n ObservableArrayAdministration.prototype.dehanceValue = function (value) {\n if (this.dehancer !== undefined) return this.dehancer(value);\n return value;\n };\n\n ObservableArrayAdministration.prototype.dehanceValues = function (values$$1) {\n if (this.dehancer !== undefined && values$$1.length > 0) return values$$1.map(this.dehancer);\n return values$$1;\n };\n\n ObservableArrayAdministration.prototype.intercept = function (handler) {\n return registerInterceptor$$1(this, handler);\n };\n\n ObservableArrayAdministration.prototype.observe = function (listener, fireImmediately) {\n if (fireImmediately === void 0) {\n fireImmediately = false;\n }\n\n if (fireImmediately) {\n listener({\n object: this.proxy,\n type: \"splice\",\n index: 0,\n added: this.values.slice(),\n addedCount: this.values.length,\n removed: [],\n removedCount: 0\n });\n }\n\n return registerListener$$1(this, listener);\n };\n\n ObservableArrayAdministration.prototype.getArrayLength = function () {\n this.atom.reportObserved();\n return this.values.length;\n };\n\n ObservableArrayAdministration.prototype.setArrayLength = function (newLength) {\n if (typeof newLength !== \"number\" || newLength < 0) throw new Error(\"[mobx.array] Out of range: \" + newLength);\n var currentLength = this.values.length;\n if (newLength === currentLength) return;else if (newLength > currentLength) {\n var newItems = new Array(newLength - currentLength);\n\n for (var i = 0; i < newLength - currentLength; i++) newItems[i] = undefined; // No Array.fill everywhere...\n\n\n this.spliceWithArray(currentLength, 0, newItems);\n } else this.spliceWithArray(newLength, currentLength - newLength);\n };\n\n ObservableArrayAdministration.prototype.updateArrayLength = function (oldLength, delta) {\n if (oldLength !== this.lastKnownLength) throw new Error(\"[mobx] Modification exception: the internal structure of an observable array was changed.\");\n this.lastKnownLength += delta;\n };\n\n ObservableArrayAdministration.prototype.spliceWithArray = function (index, deleteCount, newItems) {\n var _this = this;\n\n checkIfStateModificationsAreAllowed$$1(this.atom);\n var length = this.values.length;\n if (index === undefined) index = 0;else if (index > length) index = length;else if (index < 0) index = Math.max(0, length + index);\n if (arguments.length === 1) deleteCount = length - index;else if (deleteCount === undefined || deleteCount === null) deleteCount = 0;else deleteCount = Math.max(0, Math.min(deleteCount, length - index));\n if (newItems === undefined) newItems = EMPTY_ARRAY$$1;\n\n if (hasInterceptors$$1(this)) {\n var change = interceptChange$$1(this, {\n object: this.proxy,\n type: \"splice\",\n index: index,\n removedCount: deleteCount,\n added: newItems\n });\n if (!change) return EMPTY_ARRAY$$1;\n deleteCount = change.removedCount;\n newItems = change.added;\n }\n\n newItems = newItems.length === 0 ? newItems : newItems.map(function (v) {\n return _this.enhancer(v, undefined);\n });\n\n if (true) {\n var lengthDelta = newItems.length - deleteCount;\n this.updateArrayLength(length, lengthDelta); // checks if internal array wasn't modified\n }\n\n var res = this.spliceItemsIntoValues(index, deleteCount, newItems);\n if (deleteCount !== 0 || newItems.length !== 0) this.notifyArraySplice(index, newItems, res);\n return this.dehanceValues(res);\n };\n\n ObservableArrayAdministration.prototype.spliceItemsIntoValues = function (index, deleteCount, newItems) {\n var _a;\n\n if (newItems.length < MAX_SPLICE_SIZE) {\n return (_a = this.values).splice.apply(_a, __spread([index, deleteCount], newItems));\n } else {\n var res = this.values.slice(index, index + deleteCount);\n this.values = this.values.slice(0, index).concat(newItems, this.values.slice(index + deleteCount));\n return res;\n }\n };\n\n ObservableArrayAdministration.prototype.notifyArrayChildUpdate = function (index, newValue, oldValue) {\n var notifySpy = !this.owned && isSpyEnabled$$1();\n var notify = hasListeners$$1(this);\n var change = notify || notifySpy ? {\n object: this.proxy,\n type: \"update\",\n index: index,\n newValue: newValue,\n oldValue: oldValue\n } : null; // The reason why this is on right hand side here (and not above), is this way the uglifier will drop it, but it won't\n // cause any runtime overhead in development mode without NODE_ENV set, unless spying is enabled\n\n if (notifySpy && \"development\" !== \"production\") spyReportStart$$1(__assign({}, change, {\n name: this.atom.name\n }));\n this.atom.reportChanged();\n if (notify) notifyListeners$$1(this, change);\n if (notifySpy && \"development\" !== \"production\") spyReportEnd$$1();\n };\n\n ObservableArrayAdministration.prototype.notifyArraySplice = function (index, added, removed) {\n var notifySpy = !this.owned && isSpyEnabled$$1();\n var notify = hasListeners$$1(this);\n var change = notify || notifySpy ? {\n object: this.proxy,\n type: \"splice\",\n index: index,\n removed: removed,\n added: added,\n removedCount: removed.length,\n addedCount: added.length\n } : null;\n if (notifySpy && \"development\" !== \"production\") spyReportStart$$1(__assign({}, change, {\n name: this.atom.name\n }));\n this.atom.reportChanged(); // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe\n\n if (notify) notifyListeners$$1(this, change);\n if (notifySpy && \"development\" !== \"production\") spyReportEnd$$1();\n };\n\n return ObservableArrayAdministration;\n}();\n\nvar arrayExtensions = {\n intercept: function (handler) {\n return this[$mobx$$1].intercept(handler);\n },\n observe: function (listener, fireImmediately) {\n if (fireImmediately === void 0) {\n fireImmediately = false;\n }\n\n var adm = this[$mobx$$1];\n return adm.observe(listener, fireImmediately);\n },\n clear: function () {\n return this.splice(0);\n },\n replace: function (newItems) {\n var adm = this[$mobx$$1];\n return adm.spliceWithArray(0, adm.values.length, newItems);\n },\n\n /**\n * Converts this array back to a (shallow) javascript structure.\n * For a deep clone use mobx.toJS\n */\n toJS: function () {\n return this.slice();\n },\n toJSON: function () {\n // Used by JSON.stringify\n return this.toJS();\n },\n\n /*\n * functions that do alter the internal structure of the array, (based on lib.es6.d.ts)\n * since these functions alter the inner structure of the array, the have side effects.\n * Because the have side effects, they should not be used in computed function,\n * and for that reason the do not call dependencyState.notifyObserved\n */\n splice: function (index, deleteCount) {\n var newItems = [];\n\n for (var _i = 2; _i < arguments.length; _i++) {\n newItems[_i - 2] = arguments[_i];\n }\n\n var adm = this[$mobx$$1];\n\n switch (arguments.length) {\n case 0:\n return [];\n\n case 1:\n return adm.spliceWithArray(index);\n\n case 2:\n return adm.spliceWithArray(index, deleteCount);\n }\n\n return adm.spliceWithArray(index, deleteCount, newItems);\n },\n spliceWithArray: function (index, deleteCount, newItems) {\n var adm = this[$mobx$$1];\n return adm.spliceWithArray(index, deleteCount, newItems);\n },\n push: function () {\n var items = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n items[_i] = arguments[_i];\n }\n\n var adm = this[$mobx$$1];\n adm.spliceWithArray(adm.values.length, 0, items);\n return adm.values.length;\n },\n pop: function () {\n return this.splice(Math.max(this[$mobx$$1].values.length - 1, 0), 1)[0];\n },\n shift: function () {\n return this.splice(0, 1)[0];\n },\n unshift: function () {\n var items = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n items[_i] = arguments[_i];\n }\n\n var adm = this[$mobx$$1];\n adm.spliceWithArray(0, 0, items);\n return adm.values.length;\n },\n reverse: function () {\n // reverse by default mutates in place before returning the result\n // which makes it both a 'derivation' and a 'mutation'.\n // so we deviate from the default and just make it an dervitation\n if (true) {\n console.warn(\"[mobx] `observableArray.reverse()` will not update the array in place. Use `observableArray.slice().reverse()` to supress this warning and perform the operation on a copy, or `observableArray.replace(observableArray.slice().reverse())` to reverse & update in place\");\n }\n\n var clone = this.slice();\n return clone.reverse.apply(clone, arguments);\n },\n sort: function (compareFn) {\n // sort by default mutates in place before returning the result\n // which goes against all good practices. Let's not change the array in place!\n if (true) {\n console.warn(\"[mobx] `observableArray.sort()` will not update the array in place. Use `observableArray.slice().sort()` to supress this warning and perform the operation on a copy, or `observableArray.replace(observableArray.slice().sort())` to sort & update in place\");\n }\n\n var clone = this.slice();\n return clone.sort.apply(clone, arguments);\n },\n remove: function (value) {\n var adm = this[$mobx$$1];\n var idx = adm.dehanceValues(adm.values).indexOf(value);\n\n if (idx > -1) {\n this.splice(idx, 1);\n return true;\n }\n\n return false;\n },\n get: function (index) {\n var adm = this[$mobx$$1];\n\n if (adm) {\n if (index < adm.values.length) {\n adm.atom.reportObserved();\n return adm.dehanceValue(adm.values[index]);\n }\n\n console.warn(\"[mobx.array] Attempt to read an array index (\" + index + \") that is out of bounds (\" + adm.values.length + \"). Please check length first. Out of bound indices will not be tracked by MobX\");\n }\n\n return undefined;\n },\n set: function (index, newValue) {\n var adm = this[$mobx$$1];\n var values$$1 = adm.values;\n\n if (index < values$$1.length) {\n // update at index in range\n checkIfStateModificationsAreAllowed$$1(adm.atom);\n var oldValue = values$$1[index];\n\n if (hasInterceptors$$1(adm)) {\n var change = interceptChange$$1(adm, {\n type: \"update\",\n object: this,\n index: index,\n newValue: newValue\n });\n if (!change) return;\n newValue = change.newValue;\n }\n\n newValue = adm.enhancer(newValue, oldValue);\n var changed = newValue !== oldValue;\n\n if (changed) {\n values$$1[index] = newValue;\n adm.notifyArrayChildUpdate(index, newValue, oldValue);\n }\n } else if (index === values$$1.length) {\n // add a new item\n adm.spliceWithArray(index, 0, [newValue]);\n } else {\n // out of bounds\n throw new Error(\"[mobx.array] Index out of bounds, \" + index + \" is larger than \" + values$$1.length);\n }\n }\n};\n[\"concat\", \"every\", \"filter\", \"forEach\", \"indexOf\", \"join\", \"lastIndexOf\", \"map\", \"reduce\", \"reduceRight\", \"slice\", \"some\", \"toString\", \"toLocaleString\"].forEach(function (funcName) {\n arrayExtensions[funcName] = function () {\n var adm = this[$mobx$$1];\n adm.atom.reportObserved();\n var res = adm.dehanceValues(adm.values);\n return res[funcName].apply(res, arguments);\n };\n});\nvar isObservableArrayAdministration = createInstanceofPredicate$$1(\"ObservableArrayAdministration\", ObservableArrayAdministration);\n\nfunction isObservableArray$$1(thing) {\n return isObject$$1(thing) && isObservableArrayAdministration(thing[$mobx$$1]);\n}\n\nvar _a;\n\nvar ObservableMapMarker = {}; // just extend Map? See also https://gist.github.com/nestharus/13b4d74f2ef4a2f4357dbd3fc23c1e54\n// But: https://github.com/mobxjs/mobx/issues/1556\n\nvar ObservableMap$$1 =\n/** @class */\nfunction () {\n function ObservableMap$$1(initialData, enhancer, name) {\n if (enhancer === void 0) {\n enhancer = deepEnhancer$$1;\n }\n\n if (name === void 0) {\n name = \"ObservableMap@\" + getNextId$$1();\n }\n\n this.enhancer = enhancer;\n this.name = name;\n this[_a] = ObservableMapMarker;\n this._keysAtom = createAtom$$1(this.name + \".keys()\");\n this[Symbol.toStringTag] = \"Map\";\n\n if (typeof Map !== \"function\") {\n throw new Error(\"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js\");\n }\n\n this._data = new Map();\n this._hasMap = new Map();\n this.merge(initialData);\n }\n\n ObservableMap$$1.prototype._has = function (key) {\n return this._data.has(key);\n };\n\n ObservableMap$$1.prototype.has = function (key) {\n if (this._hasMap.has(key)) return this._hasMap.get(key).get();\n return this._updateHasMapEntry(key, false).get();\n };\n\n ObservableMap$$1.prototype.set = function (key, value) {\n var hasKey = this._has(key);\n\n if (hasInterceptors$$1(this)) {\n var change = interceptChange$$1(this, {\n type: hasKey ? \"update\" : \"add\",\n object: this,\n newValue: value,\n name: key\n });\n if (!change) return this;\n value = change.newValue;\n }\n\n if (hasKey) {\n this._updateValue(key, value);\n } else {\n this._addValue(key, value);\n }\n\n return this;\n };\n\n ObservableMap$$1.prototype.delete = function (key) {\n var _this = this;\n\n if (hasInterceptors$$1(this)) {\n var change = interceptChange$$1(this, {\n type: \"delete\",\n object: this,\n name: key\n });\n if (!change) return false;\n }\n\n if (this._has(key)) {\n var notifySpy = isSpyEnabled$$1();\n var notify = hasListeners$$1(this);\n var change = notify || notifySpy ? {\n type: \"delete\",\n object: this,\n oldValue: this._data.get(key).value,\n name: key\n } : null;\n if (notifySpy && \"development\" !== \"production\") spyReportStart$$1(__assign({}, change, {\n name: this.name,\n key: key\n }));\n transaction$$1(function () {\n _this._keysAtom.reportChanged();\n\n _this._updateHasMapEntry(key, false);\n\n var observable$$1 = _this._data.get(key);\n\n observable$$1.setNewValue(undefined);\n\n _this._data.delete(key);\n });\n if (notify) notifyListeners$$1(this, change);\n if (notifySpy && \"development\" !== \"production\") spyReportEnd$$1();\n return true;\n }\n\n return false;\n };\n\n ObservableMap$$1.prototype._updateHasMapEntry = function (key, value) {\n // optimization; don't fill the hasMap if we are not observing, or remove entry if there are no observers anymore\n var entry = this._hasMap.get(key);\n\n if (entry) {\n entry.setNewValue(value);\n } else {\n entry = new ObservableValue$$1(value, referenceEnhancer$$1, this.name + \".\" + stringifyKey(key) + \"?\", false);\n\n this._hasMap.set(key, entry);\n }\n\n return entry;\n };\n\n ObservableMap$$1.prototype._updateValue = function (key, newValue) {\n var observable$$1 = this._data.get(key);\n\n newValue = observable$$1.prepareNewValue(newValue);\n\n if (newValue !== globalState$$1.UNCHANGED) {\n var notifySpy = isSpyEnabled$$1();\n var notify = hasListeners$$1(this);\n var change = notify || notifySpy ? {\n type: \"update\",\n object: this,\n oldValue: observable$$1.value,\n name: key,\n newValue: newValue\n } : null;\n if (notifySpy && \"development\" !== \"production\") spyReportStart$$1(__assign({}, change, {\n name: this.name,\n key: key\n }));\n observable$$1.setNewValue(newValue);\n if (notify) notifyListeners$$1(this, change);\n if (notifySpy && \"development\" !== \"production\") spyReportEnd$$1();\n }\n };\n\n ObservableMap$$1.prototype._addValue = function (key, newValue) {\n var _this = this;\n\n checkIfStateModificationsAreAllowed$$1(this._keysAtom);\n transaction$$1(function () {\n var observable$$1 = new ObservableValue$$1(newValue, _this.enhancer, _this.name + \".\" + stringifyKey(key), false);\n\n _this._data.set(key, observable$$1);\n\n newValue = observable$$1.value; // value might have been changed\n\n _this._updateHasMapEntry(key, true);\n\n _this._keysAtom.reportChanged();\n });\n var notifySpy = isSpyEnabled$$1();\n var notify = hasListeners$$1(this);\n var change = notify || notifySpy ? {\n type: \"add\",\n object: this,\n name: key,\n newValue: newValue\n } : null;\n if (notifySpy && \"development\" !== \"production\") spyReportStart$$1(__assign({}, change, {\n name: this.name,\n key: key\n }));\n if (notify) notifyListeners$$1(this, change);\n if (notifySpy && \"development\" !== \"production\") spyReportEnd$$1();\n };\n\n ObservableMap$$1.prototype.get = function (key) {\n if (this.has(key)) return this.dehanceValue(this._data.get(key).get());\n return this.dehanceValue(undefined);\n };\n\n ObservableMap$$1.prototype.dehanceValue = function (value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n\n return value;\n };\n\n ObservableMap$$1.prototype.keys = function () {\n this._keysAtom.reportObserved();\n\n return this._data.keys();\n };\n\n ObservableMap$$1.prototype.values = function () {\n var self = this;\n var nextIndex = 0;\n var keys$$1 = Array.from(this.keys());\n return makeIterable({\n next: function () {\n return nextIndex < keys$$1.length ? {\n value: self.get(keys$$1[nextIndex++]),\n done: false\n } : {\n done: true\n };\n }\n });\n };\n\n ObservableMap$$1.prototype.entries = function () {\n var self = this;\n var nextIndex = 0;\n var keys$$1 = Array.from(this.keys());\n return makeIterable({\n next: function () {\n if (nextIndex < keys$$1.length) {\n var key = keys$$1[nextIndex++];\n return {\n value: [key, self.get(key)],\n done: false\n };\n }\n\n return {\n done: true\n };\n }\n });\n };\n\n ObservableMap$$1.prototype[(_a = $mobx$$1, Symbol.iterator)] = function () {\n return this.entries();\n };\n\n ObservableMap$$1.prototype.forEach = function (callback, thisArg) {\n var e_1, _a;\n\n try {\n for (var _b = __values(this), _c = _b.next(); !_c.done; _c = _b.next()) {\n var _d = __read(_c.value, 2),\n key = _d[0],\n value = _d[1];\n\n callback.call(thisArg, value, key, this);\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n };\n /** Merge another object into this object, returns this. */\n\n\n ObservableMap$$1.prototype.merge = function (other) {\n var _this = this;\n\n if (isObservableMap$$1(other)) {\n other = other.toJS();\n }\n\n transaction$$1(function () {\n if (isPlainObject$$1(other)) Object.keys(other).forEach(function (key) {\n return _this.set(key, other[key]);\n });else if (Array.isArray(other)) other.forEach(function (_a) {\n var _b = __read(_a, 2),\n key = _b[0],\n value = _b[1];\n\n return _this.set(key, value);\n });else if (isES6Map$$1(other)) {\n if (other.constructor !== Map) fail$$1(\"Cannot initialize from classes that inherit from Map: \" + other.constructor.name); // prettier-ignore\n\n other.forEach(function (value, key) {\n return _this.set(key, value);\n });\n } else if (other !== null && other !== undefined) fail$$1(\"Cannot initialize map from \" + other);\n });\n return this;\n };\n\n ObservableMap$$1.prototype.clear = function () {\n var _this = this;\n\n transaction$$1(function () {\n untracked$$1(function () {\n var e_2, _a;\n\n try {\n for (var _b = __values(_this.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {\n var key = _c.value;\n\n _this.delete(key);\n }\n } catch (e_2_1) {\n e_2 = {\n error: e_2_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_2) throw e_2.error;\n }\n }\n });\n });\n };\n\n ObservableMap$$1.prototype.replace = function (values$$1) {\n var _this = this;\n\n transaction$$1(function () {\n // grab all the keys that are present in the new map but not present in the current map\n // and delete them from the map, then merge the new map\n // this will cause reactions only on changed values\n var newKeys = getMapLikeKeys$$1(values$$1);\n var oldKeys = Array.from(_this.keys());\n var missingKeys = oldKeys.filter(function (k) {\n return newKeys.indexOf(k) === -1;\n });\n missingKeys.forEach(function (k) {\n return _this.delete(k);\n });\n\n _this.merge(values$$1);\n });\n return this;\n };\n\n Object.defineProperty(ObservableMap$$1.prototype, \"size\", {\n get: function () {\n this._keysAtom.reportObserved();\n\n return this._data.size;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Returns a plain object that represents this map.\n * Note that all the keys being stringified.\n * If there are duplicating keys after converting them to strings, behaviour is undetermined.\n */\n\n ObservableMap$$1.prototype.toPOJO = function () {\n var e_3, _a;\n\n var res = {};\n\n try {\n for (var _b = __values(this), _c = _b.next(); !_c.done; _c = _b.next()) {\n var _d = __read(_c.value, 2),\n key = _d[0],\n value = _d[1]; // We lie about symbol key types due to https://github.com/Microsoft/TypeScript/issues/1863\n\n\n res[typeof key === \"symbol\" ? key : stringifyKey(key)] = value;\n }\n } catch (e_3_1) {\n e_3 = {\n error: e_3_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_3) throw e_3.error;\n }\n }\n\n return res;\n };\n /**\n * Returns a shallow non observable object clone of this map.\n * Note that the values migth still be observable. For a deep clone use mobx.toJS.\n */\n\n\n ObservableMap$$1.prototype.toJS = function () {\n return new Map(this);\n };\n\n ObservableMap$$1.prototype.toJSON = function () {\n // Used by JSON.stringify\n return this.toPOJO();\n };\n\n ObservableMap$$1.prototype.toString = function () {\n var _this = this;\n\n return this.name + \"[{ \" + Array.from(this.keys()).map(function (key) {\n return stringifyKey(key) + \": \" + (\"\" + _this.get(key));\n }).join(\", \") + \" }]\";\n };\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */\n\n\n ObservableMap$$1.prototype.observe = function (listener, fireImmediately) {\n true && invariant$$1(fireImmediately !== true, \"`observe` doesn't support fireImmediately=true in combination with maps.\");\n return registerListener$$1(this, listener);\n };\n\n ObservableMap$$1.prototype.intercept = function (handler) {\n return registerInterceptor$$1(this, handler);\n };\n\n return ObservableMap$$1;\n}();\n\nfunction stringifyKey(key) {\n if (key && key.toString) return key.toString();else return new String(key).toString();\n}\n/* 'var' fixes small-build issue */\n\n\nvar isObservableMap$$1 = createInstanceofPredicate$$1(\"ObservableMap\", ObservableMap$$1);\n\nvar _a$1;\n\nvar ObservableSetMarker = {};\n\nvar ObservableSet$$1 =\n/** @class */\nfunction () {\n function ObservableSet$$1(initialData, enhancer, name) {\n if (enhancer === void 0) {\n enhancer = deepEnhancer$$1;\n }\n\n if (name === void 0) {\n name = \"ObservableSet@\" + getNextId$$1();\n }\n\n this.name = name;\n this[_a$1] = ObservableSetMarker;\n this._data = new Set();\n this._atom = createAtom$$1(this.name);\n this[Symbol.toStringTag] = \"Set\";\n\n if (typeof Set !== \"function\") {\n throw new Error(\"mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js\");\n }\n\n this.enhancer = function (newV, oldV) {\n return enhancer(newV, oldV, name);\n };\n\n if (initialData) {\n this.replace(initialData);\n }\n }\n\n ObservableSet$$1.prototype.dehanceValue = function (value) {\n if (this.dehancer !== undefined) {\n return this.dehancer(value);\n }\n\n return value;\n };\n\n ObservableSet$$1.prototype.clear = function () {\n var _this = this;\n\n transaction$$1(function () {\n untracked$$1(function () {\n var e_1, _a;\n\n try {\n for (var _b = __values(_this._data.values()), _c = _b.next(); !_c.done; _c = _b.next()) {\n var value = _c.value;\n\n _this.delete(value);\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n });\n });\n };\n\n ObservableSet$$1.prototype.forEach = function (callbackFn, thisArg) {\n var e_2, _a;\n\n try {\n for (var _b = __values(this), _c = _b.next(); !_c.done; _c = _b.next()) {\n var value = _c.value;\n callbackFn.call(thisArg, value, value, this);\n }\n } catch (e_2_1) {\n e_2 = {\n error: e_2_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_2) throw e_2.error;\n }\n }\n };\n\n Object.defineProperty(ObservableSet$$1.prototype, \"size\", {\n get: function () {\n this._atom.reportObserved();\n\n return this._data.size;\n },\n enumerable: true,\n configurable: true\n });\n\n ObservableSet$$1.prototype.add = function (value) {\n var _this = this;\n\n checkIfStateModificationsAreAllowed$$1(this._atom);\n\n if (hasInterceptors$$1(this)) {\n var change = interceptChange$$1(this, {\n type: \"add\",\n object: this,\n newValue: value\n });\n if (!change) return this; // TODO: ideally, value = change.value would be done here, so that values can be\n // changed by interceptor. Same applies for other Set and Map api's.\n }\n\n if (!this.has(value)) {\n transaction$$1(function () {\n _this._data.add(_this.enhancer(value, undefined));\n\n _this._atom.reportChanged();\n });\n var notifySpy = isSpyEnabled$$1();\n var notify = hasListeners$$1(this);\n var change = notify || notifySpy ? {\n type: \"add\",\n object: this,\n newValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") spyReportStart$$1(change);\n if (notify) notifyListeners$$1(this, change);\n if (notifySpy && \"development\" !== \"production\") spyReportEnd$$1();\n }\n\n return this;\n };\n\n ObservableSet$$1.prototype.delete = function (value) {\n var _this = this;\n\n if (hasInterceptors$$1(this)) {\n var change = interceptChange$$1(this, {\n type: \"delete\",\n object: this,\n oldValue: value\n });\n if (!change) return false;\n }\n\n if (this.has(value)) {\n var notifySpy = isSpyEnabled$$1();\n var notify = hasListeners$$1(this);\n var change = notify || notifySpy ? {\n type: \"delete\",\n object: this,\n oldValue: value\n } : null;\n if (notifySpy && \"development\" !== \"production\") spyReportStart$$1(__assign({}, change, {\n name: this.name\n }));\n transaction$$1(function () {\n _this._atom.reportChanged();\n\n _this._data.delete(value);\n });\n if (notify) notifyListeners$$1(this, change);\n if (notifySpy && \"development\" !== \"production\") spyReportEnd$$1();\n return true;\n }\n\n return false;\n };\n\n ObservableSet$$1.prototype.has = function (value) {\n this._atom.reportObserved();\n\n return this._data.has(this.dehanceValue(value));\n };\n\n ObservableSet$$1.prototype.entries = function () {\n var nextIndex = 0;\n var keys$$1 = Array.from(this.keys());\n var values$$1 = Array.from(this.values());\n return makeIterable({\n next: function () {\n var index = nextIndex;\n nextIndex += 1;\n return index < values$$1.length ? {\n value: [keys$$1[index], values$$1[index]],\n done: false\n } : {\n done: true\n };\n }\n });\n };\n\n ObservableSet$$1.prototype.keys = function () {\n return this.values();\n };\n\n ObservableSet$$1.prototype.values = function () {\n this._atom.reportObserved();\n\n var self = this;\n var nextIndex = 0;\n var observableValues = Array.from(this._data.values());\n return makeIterable({\n next: function () {\n return nextIndex < observableValues.length ? {\n value: self.dehanceValue(observableValues[nextIndex++]),\n done: false\n } : {\n done: true\n };\n }\n });\n };\n\n ObservableSet$$1.prototype.replace = function (other) {\n var _this = this;\n\n if (isObservableSet$$1(other)) {\n other = other.toJS();\n }\n\n transaction$$1(function () {\n if (Array.isArray(other)) {\n _this.clear();\n\n other.forEach(function (value) {\n return _this.add(value);\n });\n } else if (isES6Set$$1(other)) {\n _this.clear();\n\n other.forEach(function (value) {\n return _this.add(value);\n });\n } else if (other !== null && other !== undefined) {\n fail$$1(\"Cannot initialize set from \" + other);\n }\n });\n return this;\n };\n\n ObservableSet$$1.prototype.observe = function (listener, fireImmediately) {\n // TODO 'fireImmediately' can be true?\n true && invariant$$1(fireImmediately !== true, \"`observe` doesn't support fireImmediately=true in combination with sets.\");\n return registerListener$$1(this, listener);\n };\n\n ObservableSet$$1.prototype.intercept = function (handler) {\n return registerInterceptor$$1(this, handler);\n };\n\n ObservableSet$$1.prototype.toJS = function () {\n return new Set(this);\n };\n\n ObservableSet$$1.prototype.toString = function () {\n return this.name + \"[ \" + Array.from(this).join(\", \") + \" ]\";\n };\n\n ObservableSet$$1.prototype[(_a$1 = $mobx$$1, Symbol.iterator)] = function () {\n return this.values();\n };\n\n return ObservableSet$$1;\n}();\n\nvar isObservableSet$$1 = createInstanceofPredicate$$1(\"ObservableSet\", ObservableSet$$1);\n\nvar ObservableObjectAdministration$$1 =\n/** @class */\nfunction () {\n function ObservableObjectAdministration$$1(target, values$$1, name, defaultEnhancer) {\n if (values$$1 === void 0) {\n values$$1 = new Map();\n }\n\n this.target = target;\n this.values = values$$1;\n this.name = name;\n this.defaultEnhancer = defaultEnhancer;\n this.keysAtom = new Atom$$1(name + \".keys\");\n }\n\n ObservableObjectAdministration$$1.prototype.read = function (key) {\n return this.values.get(key).get();\n };\n\n ObservableObjectAdministration$$1.prototype.write = function (key, newValue) {\n var instance = this.target;\n var observable$$1 = this.values.get(key);\n\n if (observable$$1 instanceof ComputedValue$$1) {\n observable$$1.set(newValue);\n return;\n } // intercept\n\n\n if (hasInterceptors$$1(this)) {\n var change = interceptChange$$1(this, {\n type: \"update\",\n object: this.proxy || instance,\n name: key,\n newValue: newValue\n });\n if (!change) return;\n newValue = change.newValue;\n }\n\n newValue = observable$$1.prepareNewValue(newValue); // notify spy & observers\n\n if (newValue !== globalState$$1.UNCHANGED) {\n var notify = hasListeners$$1(this);\n var notifySpy = isSpyEnabled$$1();\n var change = notify || notifySpy ? {\n type: \"update\",\n object: this.proxy || instance,\n oldValue: observable$$1.value,\n name: key,\n newValue: newValue\n } : null;\n if (notifySpy && \"development\" !== \"production\") spyReportStart$$1(__assign({}, change, {\n name: this.name,\n key: key\n }));\n observable$$1.setNewValue(newValue);\n if (notify) notifyListeners$$1(this, change);\n if (notifySpy && \"development\" !== \"production\") spyReportEnd$$1();\n }\n };\n\n ObservableObjectAdministration$$1.prototype.has = function (key) {\n var map = this.pendingKeys || (this.pendingKeys = new Map());\n var entry = map.get(key);\n if (entry) return entry.get();else {\n var exists = !!this.values.get(key); // Possible optimization: Don't have a separate map for non existing keys,\n // but store them in the values map instead, using a special symbol to denote \"not existing\"\n\n entry = new ObservableValue$$1(exists, referenceEnhancer$$1, this.name + \".\" + key.toString() + \"?\", false);\n map.set(key, entry);\n return entry.get(); // read to subscribe\n }\n };\n\n ObservableObjectAdministration$$1.prototype.addObservableProp = function (propName, newValue, enhancer) {\n if (enhancer === void 0) {\n enhancer = this.defaultEnhancer;\n }\n\n var target = this.target;\n assertPropertyConfigurable$$1(target, propName);\n\n if (hasInterceptors$$1(this)) {\n var change = interceptChange$$1(this, {\n object: this.proxy || target,\n name: propName,\n type: \"add\",\n newValue: newValue\n });\n if (!change) return;\n newValue = change.newValue;\n }\n\n var observable$$1 = new ObservableValue$$1(newValue, enhancer, this.name + \".\" + propName, false);\n this.values.set(propName, observable$$1);\n newValue = observable$$1.value; // observableValue might have changed it\n\n Object.defineProperty(target, propName, generateObservablePropConfig$$1(propName));\n this.notifyPropertyAddition(propName, newValue);\n };\n\n ObservableObjectAdministration$$1.prototype.addComputedProp = function (propertyOwner, // where is the property declared?\n propName, options) {\n var target = this.target;\n options.name = options.name || this.name + \".\" + propName;\n this.values.set(propName, new ComputedValue$$1(options));\n if (propertyOwner === target || isPropertyConfigurable$$1(propertyOwner, propName)) Object.defineProperty(propertyOwner, propName, generateComputedPropConfig$$1(propName));\n };\n\n ObservableObjectAdministration$$1.prototype.remove = function (key) {\n if (!this.values.has(key)) return;\n var target = this.target;\n\n if (hasInterceptors$$1(this)) {\n var change = interceptChange$$1(this, {\n object: this.proxy || target,\n name: key,\n type: \"remove\"\n });\n if (!change) return;\n }\n\n try {\n startBatch$$1();\n var notify = hasListeners$$1(this);\n var notifySpy = isSpyEnabled$$1();\n var oldObservable = this.values.get(key);\n var oldValue = oldObservable && oldObservable.get();\n oldObservable && oldObservable.set(undefined); // notify key and keyset listeners\n\n this.keysAtom.reportChanged();\n this.values.delete(key);\n\n if (this.pendingKeys) {\n var entry = this.pendingKeys.get(key);\n if (entry) entry.set(false);\n } // delete the prop\n\n\n delete this.target[key];\n var change = notify || notifySpy ? {\n type: \"remove\",\n object: this.proxy || target,\n oldValue: oldValue,\n name: key\n } : null;\n if (notifySpy && \"development\" !== \"production\") spyReportStart$$1(__assign({}, change, {\n name: this.name,\n key: key\n }));\n if (notify) notifyListeners$$1(this, change);\n if (notifySpy && \"development\" !== \"production\") spyReportEnd$$1();\n } finally {\n endBatch$$1();\n }\n };\n\n ObservableObjectAdministration$$1.prototype.illegalAccess = function (owner, propName) {\n /**\n * This happens if a property is accessed through the prototype chain, but the property was\n * declared directly as own property on the prototype.\n *\n * E.g.:\n * class A {\n * }\n * extendObservable(A.prototype, { x: 1 })\n *\n * classB extens A {\n * }\n * console.log(new B().x)\n *\n * It is unclear whether the property should be considered 'static' or inherited.\n * Either use `console.log(A.x)`\n * or: decorate(A, { x: observable })\n *\n * When using decorate, the property will always be redeclared as own property on the actual instance\n */\n console.warn(\"Property '\" + propName + \"' of '\" + owner + \"' was accessed through the prototype chain. Use 'decorate' instead to declare the prop or access it statically through it's owner\");\n };\n /**\n * Observes this object. Triggers for the events 'add', 'update' and 'delete'.\n * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe\n * for callback details\n */\n\n\n ObservableObjectAdministration$$1.prototype.observe = function (callback, fireImmediately) {\n true && invariant$$1(fireImmediately !== true, \"`observe` doesn't support the fire immediately property for observable objects.\");\n return registerListener$$1(this, callback);\n };\n\n ObservableObjectAdministration$$1.prototype.intercept = function (handler) {\n return registerInterceptor$$1(this, handler);\n };\n\n ObservableObjectAdministration$$1.prototype.notifyPropertyAddition = function (key, newValue) {\n var notify = hasListeners$$1(this);\n var notifySpy = isSpyEnabled$$1();\n var change = notify || notifySpy ? {\n type: \"add\",\n object: this.proxy || this.target,\n name: key,\n newValue: newValue\n } : null;\n if (notifySpy && \"development\" !== \"production\") spyReportStart$$1(__assign({}, change, {\n name: this.name,\n key: key\n }));\n if (notify) notifyListeners$$1(this, change);\n if (notifySpy && \"development\" !== \"production\") spyReportEnd$$1();\n\n if (this.pendingKeys) {\n var entry = this.pendingKeys.get(key);\n if (entry) entry.set(true);\n }\n\n this.keysAtom.reportChanged();\n };\n\n ObservableObjectAdministration$$1.prototype.getKeys = function () {\n var e_1, _a;\n\n this.keysAtom.reportObserved(); // return Reflect.ownKeys(this.values) as any\n\n var res = [];\n\n try {\n for (var _b = __values(this.values), _c = _b.next(); !_c.done; _c = _b.next()) {\n var _d = __read(_c.value, 2),\n key = _d[0],\n value = _d[1];\n\n if (value instanceof ObservableValue$$1) res.push(key);\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n\n return res;\n };\n\n return ObservableObjectAdministration$$1;\n}();\n\nfunction asObservableObject$$1(target, name, defaultEnhancer) {\n if (name === void 0) {\n name = \"\";\n }\n\n if (defaultEnhancer === void 0) {\n defaultEnhancer = deepEnhancer$$1;\n }\n\n if (Object.prototype.hasOwnProperty.call(target, $mobx$$1)) return target[$mobx$$1];\n true && invariant$$1(Object.isExtensible(target), \"Cannot make the designated object observable; it is not extensible\");\n if (!isPlainObject$$1(target)) name = (target.constructor.name || \"ObservableObject\") + \"@\" + getNextId$$1();\n if (!name) name = \"ObservableObject@\" + getNextId$$1();\n var adm = new ObservableObjectAdministration$$1(target, new Map(), name, defaultEnhancer);\n addHiddenProp$$1(target, $mobx$$1, adm);\n return adm;\n}\n\nvar observablePropertyConfigs = Object.create(null);\nvar computedPropertyConfigs = Object.create(null);\n\nfunction generateObservablePropConfig$$1(propName) {\n return observablePropertyConfigs[propName] || (observablePropertyConfigs[propName] = {\n configurable: true,\n enumerable: true,\n get: function () {\n return this[$mobx$$1].read(propName);\n },\n set: function (v) {\n this[$mobx$$1].write(propName, v);\n }\n });\n}\n\nfunction getAdministrationForComputedPropOwner(owner) {\n var adm = owner[$mobx$$1];\n\n if (!adm) {\n // because computed props are declared on proty,\n // the current instance might not have been initialized yet\n initializeInstance$$1(owner);\n return owner[$mobx$$1];\n }\n\n return adm;\n}\n\nfunction generateComputedPropConfig$$1(propName) {\n return computedPropertyConfigs[propName] || (computedPropertyConfigs[propName] = {\n configurable: false,\n enumerable: false,\n get: function () {\n return getAdministrationForComputedPropOwner(this).read(propName);\n },\n set: function (v) {\n getAdministrationForComputedPropOwner(this).write(propName, v);\n }\n });\n}\n\nvar isObservableObjectAdministration = createInstanceofPredicate$$1(\"ObservableObjectAdministration\", ObservableObjectAdministration$$1);\n\nfunction isObservableObject$$1(thing) {\n if (isObject$$1(thing)) {\n // Initializers run lazily when transpiling to babel, so make sure they are run...\n initializeInstance$$1(thing);\n return isObservableObjectAdministration(thing[$mobx$$1]);\n }\n\n return false;\n}\n\nfunction getAtom$$1(thing, property) {\n if (typeof thing === \"object\" && thing !== null) {\n if (isObservableArray$$1(thing)) {\n if (property !== undefined) fail$$1( true && \"It is not possible to get index atoms from arrays\");\n return thing[$mobx$$1].atom;\n }\n\n if (isObservableSet$$1(thing)) {\n return thing[$mobx$$1];\n }\n\n if (isObservableMap$$1(thing)) {\n var anyThing = thing;\n if (property === undefined) return anyThing._keysAtom;\n\n var observable$$1 = anyThing._data.get(property) || anyThing._hasMap.get(property);\n\n if (!observable$$1) fail$$1( true && \"the entry '\" + property + \"' does not exist in the observable map '\" + getDebugName$$1(thing) + \"'\");\n return observable$$1;\n } // Initializers run lazily when transpiling to babel, so make sure they are run...\n\n\n initializeInstance$$1(thing);\n if (property && !thing[$mobx$$1]) thing[property]; // See #1072\n\n if (isObservableObject$$1(thing)) {\n if (!property) return fail$$1( true && \"please specify a property\");\n var observable$$1 = thing[$mobx$$1].values.get(property);\n if (!observable$$1) fail$$1( true && \"no observable property '\" + property + \"' found on the observable object '\" + getDebugName$$1(thing) + \"'\");\n return observable$$1;\n }\n\n if (isAtom$$1(thing) || isComputedValue$$1(thing) || isReaction$$1(thing)) {\n return thing;\n }\n } else if (typeof thing === \"function\") {\n if (isReaction$$1(thing[$mobx$$1])) {\n // disposer function\n return thing[$mobx$$1];\n }\n }\n\n return fail$$1( true && \"Cannot obtain atom from \" + thing);\n}\n\nfunction getAdministration$$1(thing, property) {\n if (!thing) fail$$1(\"Expecting some object\");\n if (property !== undefined) return getAdministration$$1(getAtom$$1(thing, property));\n if (isAtom$$1(thing) || isComputedValue$$1(thing) || isReaction$$1(thing)) return thing;\n if (isObservableMap$$1(thing) || isObservableSet$$1(thing)) return thing; // Initializers run lazily when transpiling to babel, so make sure they are run...\n\n initializeInstance$$1(thing);\n if (thing[$mobx$$1]) return thing[$mobx$$1];\n fail$$1( true && \"Cannot obtain administration from \" + thing);\n}\n\nfunction getDebugName$$1(thing, property) {\n var named;\n if (property !== undefined) named = getAtom$$1(thing, property);else if (isObservableObject$$1(thing) || isObservableMap$$1(thing) || isObservableSet$$1(thing)) named = getAdministration$$1(thing);else named = getAtom$$1(thing); // valid for arrays as well\n\n return named.name;\n}\n\nvar toString = Object.prototype.toString;\n\nfunction deepEqual$$1(a, b) {\n return eq(a, b);\n} // Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289\n// Internal recursive comparison function for `isEqual`.\n\n\nfunction eq(a, b, aStack, bStack) {\n // Identical objects are equal. `0 === -0`, but they aren't identical.\n // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).\n if (a === b) return a !== 0 || 1 / a === 1 / b; // `null` or `undefined` only equal to itself (strict comparison).\n\n if (a == null || b == null) return false; // `NaN`s are equivalent, but non-reflexive.\n\n if (a !== a) return b !== b; // Exhaust primitive checks\n\n var type = typeof a;\n if (type !== \"function\" && type !== \"object\" && typeof b != \"object\") return false;\n return deepEq(a, b, aStack, bStack);\n} // Internal recursive comparison function for `isEqual`.\n\n\nfunction deepEq(a, b, aStack, bStack) {\n // Unwrap any wrapped objects.\n a = unwrap(a);\n b = unwrap(b); // Compare `[[Class]]` names.\n\n var className = toString.call(a);\n if (className !== toString.call(b)) return false;\n\n switch (className) {\n // Strings, numbers, regular expressions, dates, and booleans are compared by value.\n case \"[object RegExp]\": // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')\n\n case \"[object String]\":\n // Primitives and their corresponding object wrappers are equivalent; thus, `\"5\"` is\n // equivalent to `new String(\"5\")`.\n return \"\" + a === \"\" + b;\n\n case \"[object Number]\":\n // `NaN`s are equivalent, but non-reflexive.\n // Object(NaN) is equivalent to NaN.\n if (+a !== +a) return +b !== +b; // An `egal` comparison is performed for other numeric values.\n\n return +a === 0 ? 1 / +a === 1 / b : +a === +b;\n\n case \"[object Date]\":\n case \"[object Boolean]\":\n // Coerce dates and booleans to numeric primitive values. Dates are compared by their\n // millisecond representations. Note that invalid dates with millisecond representations\n // of `NaN` are not equivalent.\n return +a === +b;\n\n case \"[object Symbol]\":\n return typeof Symbol !== \"undefined\" && Symbol.valueOf.call(a) === Symbol.valueOf.call(b);\n }\n\n var areArrays = className === \"[object Array]\";\n\n if (!areArrays) {\n if (typeof a != \"object\" || typeof b != \"object\") return false; // Objects with different constructors are not equivalent, but `Object`s or `Array`s\n // from different frames are.\n\n var aCtor = a.constructor,\n bCtor = b.constructor;\n\n if (aCtor !== bCtor && !(typeof aCtor === \"function\" && aCtor instanceof aCtor && typeof bCtor === \"function\" && bCtor instanceof bCtor) && \"constructor\" in a && \"constructor\" in b) {\n return false;\n }\n } // Assume equality for cyclic structures. The algorithm for detecting cyclic\n // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.\n // Initializing stack of traversed objects.\n // It's done here since we only need them for objects and arrays comparison.\n\n\n aStack = aStack || [];\n bStack = bStack || [];\n var length = aStack.length;\n\n while (length--) {\n // Linear search. Performance is inversely proportional to the number of\n // unique nested structures.\n if (aStack[length] === a) return bStack[length] === b;\n } // Add the first object to the stack of traversed objects.\n\n\n aStack.push(a);\n bStack.push(b); // Recursively compare objects and arrays.\n\n if (areArrays) {\n // Compare array lengths to determine if a deep comparison is necessary.\n length = a.length;\n if (length !== b.length) return false; // Deep compare the contents, ignoring non-numeric properties.\n\n while (length--) {\n if (!eq(a[length], b[length], aStack, bStack)) return false;\n }\n } else {\n // Deep compare objects.\n var keys$$1 = Object.keys(a);\n var key = void 0;\n length = keys$$1.length; // Ensure that both objects contain the same number of properties before comparing deep equality.\n\n if (Object.keys(b).length !== length) return false;\n\n while (length--) {\n // Deep compare each member\n key = keys$$1[length];\n if (!(has$1(b, key) && eq(a[key], b[key], aStack, bStack))) return false;\n }\n } // Remove the first object from the stack of traversed objects.\n\n\n aStack.pop();\n bStack.pop();\n return true;\n}\n\nfunction unwrap(a) {\n if (isObservableArray$$1(a)) return a.slice();\n if (isES6Map$$1(a) || isObservableMap$$1(a)) return Array.from(a.entries());\n if (isES6Set$$1(a) || isObservableSet$$1(a)) return Array.from(a.entries());\n return a;\n}\n\nfunction has$1(a, key) {\n return Object.prototype.hasOwnProperty.call(a, key);\n}\n\nfunction makeIterable(iterator) {\n iterator[Symbol.iterator] = self;\n return iterator;\n}\n\nfunction self() {\n return this;\n}\n/*\nThe only reason for this file to exist is pure horror:\nWithout it rollup can make the bundling fail at any point in time; when it rolls up the files in the wrong order\nit will cause undefined errors (for example because super classes or local variables not being hosted).\nWith this file that will still happen,\nbut at least in this file we can magically reorder the imports with trial and error until the build succeeds again.\n*/\n\n/**\n * (c) Michel Weststrate 2015 - 2018\n * MIT Licensed\n *\n * Welcome to the mobx sources! To get an global overview of how MobX internally works,\n * this is a good place to start:\n * https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74\n *\n * Source folders:\n * ===============\n *\n * - api/ Most of the public static methods exposed by the module can be found here.\n * - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here.\n * - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`.\n * - utils/ Utility stuff.\n *\n */\n\n\nif (typeof Proxy === \"undefined\" || typeof Symbol === \"undefined\") {\n throw new Error(\"[mobx] MobX 5+ requires Proxy and Symbol objects. If your environment doesn't support Symbol or Proxy objects, please downgrade to MobX 4. For React Native Android, consider upgrading JSCore.\");\n}\n\ntry {\n // define process.env if needed\n // if this is not a production build in the first place\n // (in which case the expression below would be substituted with 'production')\n \"development\";\n} catch (e) {\n var g = typeof window !== \"undefined\" ? window : global;\n if (typeof process === \"undefined\") g.process = {};\n g.process.env = {};\n}\n\n(function () {\n function testCodeMinification() {}\n\n if (testCodeMinification.name !== \"testCodeMinification\" && \"development\" !== \"production\" && process.env.IGNORE_MOBX_MINIFY_WARNING !== \"true\") {\n console.warn( // Template literal(backtick) is used for fix issue with rollup-plugin-commonjs https://github.com/rollup/rollup-plugin-commonjs/issues/344\n \"[mobx] you are running a minified build, but 'process.env.NODE_ENV' was not set to 'production' in your bundler. This results in an unnecessarily large and slow bundle\");\n }\n})(); // Devtools support\n\n\nif (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === \"object\") {\n // See: https://github.com/andykog/mobx-devtools/\n __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({\n spy: spy$$1,\n extras: {\n getDebugName: getDebugName$$1\n },\n $mobx: $mobx$$1\n });\n}\n\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ \"./node_modules/process/browser.js\"), __webpack_require__(/*! ./../../webpack/buildin/global.js */ \"./node_modules/webpack/buildin/global.js\")))\n\n//# sourceURL=webpack:///./node_modules/mobx/lib/mobx.module.js?");
/***/ }),
/***/ "./node_modules/preact/dist/preact.mjs":
/*!*********************************************!*\
!*** ./node_modules/preact/dist/preact.mjs ***!
\*********************************************/
/*! exports provided: default, h, createElement, cloneElement, createRef, Component, render, rerender, options */
/***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"h\", function() { return h; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"createElement\", function() { return h; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"cloneElement\", function() { return cloneElement; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"createRef\", function() { return createRef; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Component\", function() { return Component; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"render\", function() { return render; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"rerender\", function() { return rerender; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"options\", function() { return options; });\nvar VNode = function VNode() {};\n\nvar options = {};\n\nvar stack = [];\n\nvar EMPTY_CHILDREN = [];\n\nfunction h(nodeName, attributes) {\n\tvar children = EMPTY_CHILDREN,\n\t lastSimple,\n\t child,\n\t simple,\n\t i;\n\tfor (i = arguments.length; i-- > 2;) {\n\t\tstack.push(arguments[i]);\n\t}\n\tif (attributes && attributes.children != null) {\n\t\tif (!stack.length) stack.push(attributes.children);\n\t\tdelete attributes.children;\n\t}\n\twhile (stack.length) {\n\t\tif ((child = stack.pop()) && child.pop !== undefined) {\n\t\t\tfor (i = child.length; i--;) {\n\t\t\t\tstack.push(child[i]);\n\t\t\t}\n\t\t} else {\n\t\t\tif (typeof child === 'boolean') child = null;\n\n\t\t\tif (simple = typeof nodeName !== 'function') {\n\t\t\t\tif (child == null) child = '';else if (typeof child === 'number') child = String(child);else if (typeof child !== 'string') simple = false;\n\t\t\t}\n\n\t\t\tif (simple && lastSimple) {\n\t\t\t\tchildren[children.length - 1] += child;\n\t\t\t} else if (children === EMPTY_CHILDREN) {\n\t\t\t\tchildren = [child];\n\t\t\t} else {\n\t\t\t\tchildren.push(child);\n\t\t\t}\n\n\t\t\tlastSimple = simple;\n\t\t}\n\t}\n\n\tvar p = new VNode();\n\tp.nodeName = nodeName;\n\tp.children = children;\n\tp.attributes = attributes == null ? undefined : attributes;\n\tp.key = attributes == null ? undefined : attributes.key;\n\n\tif (options.vnode !== undefined) options.vnode(p);\n\n\treturn p;\n}\n\nfunction extend(obj, props) {\n for (var i in props) {\n obj[i] = props[i];\n }return obj;\n}\n\nfunction applyRef(ref, value) {\n if (ref != null) {\n if (typeof ref == 'function') ref(value);else ref.current = value;\n }\n}\n\nvar defer = typeof Promise == 'function' ? Promise.resolve().then.bind(Promise.resolve()) : setTimeout;\n\nfunction cloneElement(vnode, props) {\n return h(vnode.nodeName, extend(extend({}, vnode.attributes), props), arguments.length > 2 ? [].slice.call(arguments, 2) : vnode.children);\n}\n\nvar IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i;\n\nvar items = [];\n\nfunction enqueueRender(component) {\n\tif (!component._dirty && (component._dirty = true) && items.push(component) == 1) {\n\t\t(options.debounceRendering || defer)(rerender);\n\t}\n}\n\nfunction rerender() {\n\tvar p;\n\twhile (p = items.pop()) {\n\t\tif (p._dirty) renderComponent(p);\n\t}\n}\n\nfunction isSameNodeType(node, vnode, hydrating) {\n\tif (typeof vnode === 'string' || typeof vnode === 'number') {\n\t\treturn node.splitText !== undefined;\n\t}\n\tif (typeof vnode.nodeName === 'string') {\n\t\treturn !node._componentConstructor && isNamedNode(node, vnode.nodeName);\n\t}\n\treturn hydrating || node._componentConstructor === vnode.nodeName;\n}\n\nfunction isNamedNode(node, nodeName) {\n\treturn node.normalizedNodeName === nodeName || node.nodeName.toLowerCase() === nodeName.toLowerCase();\n}\n\nfunction getNodeProps(vnode) {\n\tvar props = extend({}, vnode.attributes);\n\tprops.children = vnode.children;\n\n\tvar defaultProps = vnode.nodeName.defaultProps;\n\tif (defaultProps !== undefined) {\n\t\tfor (var i in defaultProps) {\n\t\t\tif (props[i] === undefined) {\n\t\t\t\tprops[i] = defaultProps[i];\n\t\t\t}\n\t\t}\n\t}\n\n\treturn props;\n}\n\nfunction createNode(nodeName, isSvg) {\n\tvar node = isSvg ? document.createElementNS('http://www.w3.org/2000/svg', nodeName) : document.createElement(nodeName);\n\tnode.normalizedNodeName = nodeName;\n\treturn node;\n}\n\nfunction removeNode(node) {\n\tvar parentNode = node.parentNode;\n\tif (parentNode) parentNode.removeChild(node);\n}\n\nfunction setAccessor(node, name, old, value, isSvg) {\n\tif (name === 'className') name = 'class';\n\n\tif (name === 'key') {} else if (name === 'ref') {\n\t\tapplyRef(old, null);\n\t\tapplyRef(value, node);\n\t} else if (name === 'class' && !isSvg) {\n\t\tnode.className = value || '';\n\t} else if (name === 'style') {\n\t\tif (!value || typeof value === 'string' || typeof old === 'string') {\n\t\t\tnode.style.cssText = value || '';\n\t\t}\n\t\tif (value && typeof value === 'object') {\n\t\t\tif (typeof old !== 'string') {\n\t\t\t\tfor (var i in old) {\n\t\t\t\t\tif (!(i in value)) node.style[i] = '';\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (var i in value) {\n\t\t\t\tnode.style[i] = typeof value[i] === 'number' && IS_NON_DIMENSIONAL.test(i) === false ? value[i] + 'px' : value[i];\n\t\t\t}\n\t\t}\n\t} else if (name === 'dangerouslySetInnerHTML') {\n\t\tif (value) node.innerHTML = value.__html || '';\n\t} else if (name[0] == 'o' && name[1] == 'n') {\n\t\tvar useCapture = name !== (name = name.replace(/Capture$/, ''));\n\t\tname = name.toLowerCase().substring(2);\n\t\tif (value) {\n\t\t\tif (!old) node.addEventListener(name, eventProxy, useCapture);\n\t\t} else {\n\t\t\tnode.removeEventListener(name, eventProxy, useCapture);\n\t\t}\n\t\t(node._listeners || (node._listeners = {}))[name] = value;\n\t} else if (name !== 'list' && name !== 'type' && !isSvg && name in node) {\n\t\ttry {\n\t\t\tnode[name] = value == null ? '' : value;\n\t\t} catch (e) {}\n\t\tif ((value == null || value === false) && name != 'spellcheck') node.removeAttribute(name);\n\t} else {\n\t\tvar ns = isSvg && name !== (name = name.replace(/^xlink:?/, ''));\n\n\t\tif (value == null || value === false) {\n\t\t\tif (ns) node.removeAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase());else node.removeAttribute(name);\n\t\t} else if (typeof value !== 'function') {\n\t\t\tif (ns) node.setAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase(), value);else node.setAttribute(name, value);\n\t\t}\n\t}\n}\n\nfunction eventProxy(e) {\n\treturn this._listeners[e.type](options.event && options.event(e) || e);\n}\n\nvar mounts = [];\n\nvar diffLevel = 0;\n\nvar isSvgMode = false;\n\nvar hydrating = false;\n\nfunction flushMounts() {\n\tvar c;\n\twhile (c = mounts.shift()) {\n\t\tif (options.afterMount) options.afterMount(c);\n\t\tif (c.componentDidMount) c.componentDidMount();\n\t}\n}\n\nfunction diff(dom, vnode, context, mountAll, parent, componentRoot) {\n\tif (!diffLevel++) {\n\t\tisSvgMode = parent != null && parent.ownerSVGElement !== undefined;\n\n\t\thydrating = dom != null && !('__preactattr_' in dom);\n\t}\n\n\tvar ret = idiff(dom, vnode, context, mountAll, componentRoot);\n\n\tif (parent && ret.parentNode !== parent) parent.appendChild(ret);\n\n\tif (! --diffLevel) {\n\t\thydrating = false;\n\n\t\tif (!componentRoot) flushMounts();\n\t}\n\n\treturn ret;\n}\n\nfunction idiff(dom, vnode, context, mountAll, componentRoot) {\n\tvar out = dom,\n\t prevSvgMode = isSvgMode;\n\n\tif (vnode == null || typeof vnode === 'boolean') vnode = '';\n\n\tif (typeof vnode === 'string' || typeof vnode === 'number') {\n\t\tif (dom && dom.splitText !== undefined && dom.parentNode && (!dom._component || componentRoot)) {\n\t\t\tif (dom.nodeValue != vnode) {\n\t\t\t\tdom.nodeValue = vnode;\n\t\t\t}\n\t\t} else {\n\t\t\tout = document.createTextNode(vnode);\n\t\t\tif (dom) {\n\t\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom);\n\t\t\t\trecollectNodeTree(dom, true);\n\t\t\t}\n\t\t}\n\n\t\tout['__preactattr_'] = true;\n\n\t\treturn out;\n\t}\n\n\tvar vnodeName = vnode.nodeName;\n\tif (typeof vnodeName === 'function') {\n\t\treturn buildComponentFromVNode(dom, vnode, context, mountAll);\n\t}\n\n\tisSvgMode = vnodeName === 'svg' ? true : vnodeName === 'foreignObject' ? false : isSvgMode;\n\n\tvnodeName = String(vnodeName);\n\tif (!dom || !isNamedNode(dom, vnodeName)) {\n\t\tout = createNode(vnodeName, isSvgMode);\n\n\t\tif (dom) {\n\t\t\twhile (dom.firstChild) {\n\t\t\t\tout.appendChild(dom.firstChild);\n\t\t\t}\n\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom);\n\n\t\t\trecollectNodeTree(dom, true);\n\t\t}\n\t}\n\n\tvar fc = out.firstChild,\n\t props = out['__preactattr_'],\n\t vchildren = vnode.children;\n\n\tif (props == null) {\n\t\tprops = out['__preactattr_'] = {};\n\t\tfor (var a = out.attributes, i = a.length; i--;) {\n\t\t\tprops[a[i].name] = a[i].value;\n\t\t}\n\t}\n\n\tif (!hydrating && vchildren && vchildren.length === 1 && typeof vchildren[0] === 'string' && fc != null && fc.splitText !== undefined && fc.nextSibling == null) {\n\t\tif (fc.nodeValue != vchildren[0]) {\n\t\t\tfc.nodeValue = vchildren[0];\n\t\t}\n\t} else if (vchildren && vchildren.length || fc != null) {\n\t\t\tinnerDiffNode(out, vchildren, context, mountAll, hydrating || props.dangerouslySetInnerHTML != null);\n\t\t}\n\n\tdiffAttributes(out, vnode.attributes, props);\n\n\tisSvgMode = prevSvgMode;\n\n\treturn out;\n}\n\nfunction innerDiffNode(dom, vchildren, context, mountAll, isHydrating) {\n\tvar originalChildren = dom.childNodes,\n\t children = [],\n\t keyed = {},\n\t keyedLen = 0,\n\t min = 0,\n\t len = originalChildren.length,\n\t childrenLen = 0,\n\t vlen = vchildren ? vchildren.length : 0,\n\t j,\n\t c,\n\t f,\n\t vchild,\n\t child;\n\n\tif (len !== 0) {\n\t\tfor (var i = 0; i < len; i++) {\n\t\t\tvar _child = originalChildren[i],\n\t\t\t props = _child['__preactattr_'],\n\t\t\t key = vlen && props ? _child._component ? _child._component.__key : props.key : null;\n\t\t\tif (key != null) {\n\t\t\t\tkeyedLen++;\n\t\t\t\tkeyed[key] = _child;\n\t\t\t} else if (props || (_child.splitText !== undefined ? isHydrating ? _child.nodeValue.trim() : true : isHydrating)) {\n\t\t\t\tchildren[childrenLen++] = _child;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (vlen !== 0) {\n\t\tfor (var i = 0; i < vlen; i++) {\n\t\t\tvchild = vchildren[i];\n\t\t\tchild = null;\n\n\t\t\tvar key = vchild.key;\n\t\t\tif (key != null) {\n\t\t\t\tif (keyedLen && keyed[key] !== undefined) {\n\t\t\t\t\tchild = keyed[key];\n\t\t\t\t\tkeyed[key] = undefined;\n\t\t\t\t\tkeyedLen--;\n\t\t\t\t}\n\t\t\t} else if (min < childrenLen) {\n\t\t\t\t\tfor (j = min; j < childrenLen; j++) {\n\t\t\t\t\t\tif (children[j] !== undefined && isSameNodeType(c = children[j], vchild, isHydrating)) {\n\t\t\t\t\t\t\tchild = c;\n\t\t\t\t\t\t\tchildren[j] = undefined;\n\t\t\t\t\t\t\tif (j === childrenLen - 1) childrenLen--;\n\t\t\t\t\t\t\tif (j === min) min++;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\tchild = idiff(child, vchild, context, mountAll);\n\n\t\t\tf = originalChildren[i];\n\t\t\tif (child && child !== dom && child !== f) {\n\t\t\t\tif (f == null) {\n\t\t\t\t\tdom.appendChild(child);\n\t\t\t\t} else if (child === f.nextSibling) {\n\t\t\t\t\tremoveNode(f);\n\t\t\t\t} else {\n\t\t\t\t\tdom.insertBefore(child, f);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (keyedLen) {\n\t\tfor (var i in keyed) {\n\t\t\tif (keyed[i] !== undefined) recollectNodeTree(keyed[i], false);\n\t\t}\n\t}\n\n\twhile (min <= childrenLen) {\n\t\tif ((child = children[childrenLen--]) !== undefined) recollectNodeTree(child, false);\n\t}\n}\n\nfunction recollectNodeTree(node, unmountOnly) {\n\tvar component = node._component;\n\tif (component) {\n\t\tunmountComponent(component);\n\t} else {\n\t\tif (node['__preactattr_'] != null) applyRef(node['__preactattr_'].ref, null);\n\n\t\tif (unmountOnly === false || node['__preactattr_'] == null) {\n\t\t\tremoveNode(node);\n\t\t}\n\n\t\tremoveChildren(node);\n\t}\n}\n\nfunction removeChildren(node) {\n\tnode = node.lastChild;\n\twhile (node) {\n\t\tvar next = node.previousSibling;\n\t\trecollectNodeTree(node, true);\n\t\tnode = next;\n\t}\n}\n\nfunction diffAttributes(dom, attrs, old) {\n\tvar name;\n\n\tfor (name in old) {\n\t\tif (!(attrs && attrs[name] != null) && old[name] != null) {\n\t\t\tsetAccessor(dom, name, old[name], old[name] = undefined, isSvgMode);\n\t\t}\n\t}\n\n\tfor (name in attrs) {\n\t\tif (name !== 'children' && name !== 'innerHTML' && (!(name in old) || attrs[name] !== (name === 'value' || name === 'checked' ? dom[name] : old[name]))) {\n\t\t\tsetAccessor(dom, name, old[name], old[name] = attrs[name], isSvgMode);\n\t\t}\n\t}\n}\n\nvar recyclerComponents = [];\n\nfunction createComponent(Ctor, props, context) {\n\tvar inst,\n\t i = recyclerComponents.length;\n\n\tif (Ctor.prototype && Ctor.prototype.render) {\n\t\tinst = new Ctor(props, context);\n\t\tComponent.call(inst, props, context);\n\t} else {\n\t\tinst = new Component(props, context);\n\t\tinst.constructor = Ctor;\n\t\tinst.render = doRender;\n\t}\n\n\twhile (i--) {\n\t\tif (recyclerComponents[i].constructor === Ctor) {\n\t\t\tinst.nextBase = recyclerComponents[i].nextBase;\n\t\t\trecyclerComponents.splice(i, 1);\n\t\t\treturn inst;\n\t\t}\n\t}\n\n\treturn inst;\n}\n\nfunction doRender(props, state, context) {\n\treturn this.constructor(props, context);\n}\n\nfunction setComponentProps(component, props, renderMode, context, mountAll) {\n\tif (component._disable) return;\n\tcomponent._disable = true;\n\n\tcomponent.__ref = props.ref;\n\tcomponent.__key = props.key;\n\tdelete props.ref;\n\tdelete props.key;\n\n\tif (typeof component.constructor.getDerivedStateFromProps === 'undefined') {\n\t\tif (!component.base || mountAll) {\n\t\t\tif (component.componentWillMount) component.componentWillMount();\n\t\t} else if (component.componentWillReceiveProps) {\n\t\t\tcomponent.componentWillReceiveProps(props, context);\n\t\t}\n\t}\n\n\tif (context && context !== component.context) {\n\t\tif (!component.prevContext) component.prevContext = component.context;\n\t\tcomponent.context = context;\n\t}\n\n\tif (!component.prevProps) component.prevProps = component.props;\n\tcomponent.props = props;\n\n\tcomponent._disable = false;\n\n\tif (renderMode !== 0) {\n\t\tif (renderMode === 1 || options.syncComponentUpdates !== false || !component.base) {\n\t\t\trenderComponent(component, 1, mountAll);\n\t\t} else {\n\t\t\tenqueueRender(component);\n\t\t}\n\t}\n\n\tapplyRef(component.__ref, component);\n}\n\nfunction renderComponent(component, renderMode, mountAll, isChild) {\n\tif (component._disable) return;\n\n\tvar props = component.props,\n\t state = component.state,\n\t context = component.context,\n\t previousProps = component.prevProps || props,\n\t previousState = component.prevState || state,\n\t previousContext = component.prevContext || context,\n\t isUpdate = component.base,\n\t nextBase = component.nextBase,\n\t initialBase = isUpdate || nextBase,\n\t initialChildComponent = component._component,\n\t skip = false,\n\t snapshot = previousContext,\n\t rendered,\n\t inst,\n\t cbase;\n\n\tif (component.constructor.getDerivedStateFromProps) {\n\t\tstate = extend(extend({}, state), component.constructor.getDerivedStateFromProps(props, state));\n\t\tcomponent.state = state;\n\t}\n\n\tif (isUpdate) {\n\t\tcomponent.props = previousProps;\n\t\tcomponent.state = previousState;\n\t\tcomponent.context = previousContext;\n\t\tif (renderMode !== 2 && component.shouldComponentUpdate && component.shouldComponentUpdate(props, state, context) === false) {\n\t\t\tskip = true;\n\t\t} else if (component.componentWillUpdate) {\n\t\t\tcomponent.componentWillUpdate(props, state, context);\n\t\t}\n\t\tcomponent.props = props;\n\t\tcomponent.state = state;\n\t\tcomponent.context = context;\n\t}\n\n\tcomponent.prevProps = component.prevState = component.prevContext = component.nextBase = null;\n\tcomponent._dirty = false;\n\n\tif (!skip) {\n\t\trendered = component.render(props, state, context);\n\n\t\tif (component.getChildContext) {\n\t\t\tcontext = extend(extend({}, context), component.getChildContext());\n\t\t}\n\n\t\tif (isUpdate && component.getSnapshotBeforeUpdate) {\n\t\t\tsnapshot = component.getSnapshotBeforeUpdate(previousProps, previousState);\n\t\t}\n\n\t\tvar childComponent = rendered && rendered.nodeName,\n\t\t toUnmount,\n\t\t base;\n\n\t\tif (typeof childComponent === 'function') {\n\n\t\t\tvar childProps = getNodeProps(rendered);\n\t\t\tinst = initialChildComponent;\n\n\t\t\tif (inst && inst.constructor === childComponent && childProps.key == inst.__key) {\n\t\t\t\tsetComponentProps(inst, childProps, 1, context, false);\n\t\t\t} else {\n\t\t\t\ttoUnmount = inst;\n\n\t\t\t\tcomponent._component = inst = createComponent(childComponent, childProps, context);\n\t\t\t\tinst.nextBase = inst.nextBase || nextBase;\n\t\t\t\tinst._parentComponent = component;\n\t\t\t\tsetComponentProps(inst, childProps, 0, context, false);\n\t\t\t\trenderComponent(inst, 1, mountAll, true);\n\t\t\t}\n\n\t\t\tbase = inst.base;\n\t\t} else {\n\t\t\tcbase = initialBase;\n\n\t\t\ttoUnmount = initialChildComponent;\n\t\t\tif (toUnmount) {\n\t\t\t\tcbase = component._component = null;\n\t\t\t}\n\n\t\t\tif (initialBase || renderMode === 1) {\n\t\t\t\tif (cbase) cbase._component = null;\n\t\t\t\tbase = diff(cbase, rendered, context, mountAll || !isUpdate, initialBase && initialBase.parentNode, true);\n\t\t\t}\n\t\t}\n\n\t\tif (initialBase && base !== initialBase && inst !== initialChildComponent) {\n\t\t\tvar baseParent = initialBase.parentNode;\n\t\t\tif (baseParent && base !== baseParent) {\n\t\t\t\tbaseParent.replaceChild(base, initialBase);\n\n\t\t\t\tif (!toUnmount) {\n\t\t\t\t\tinitialBase._component = null;\n\t\t\t\t\trecollectNodeTree(initialBase, false);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (toUnmount) {\n\t\t\tunmountComponent(toUnmount);\n\t\t}\n\n\t\tcomponent.base = base;\n\t\tif (base && !isChild) {\n\t\t\tvar componentRef = component,\n\t\t\t t = component;\n\t\t\twhile (t = t._parentComponent) {\n\t\t\t\t(componentRef = t).base = base;\n\t\t\t}\n\t\t\tbase._component = componentRef;\n\t\t\tbase._componentConstructor = componentRef.constructor;\n\t\t}\n\t}\n\n\tif (!isUpdate || mountAll) {\n\t\tmounts.push(component);\n\t} else if (!skip) {\n\n\t\tif (component.componentDidUpdate) {\n\t\t\tcomponent.componentDidUpdate(previousProps, previousState, snapshot);\n\t\t}\n\t\tif (options.afterUpdate) options.afterUpdate(component);\n\t}\n\n\twhile (component._renderCallbacks.length) {\n\t\tcomponent._renderCallbacks.pop().call(component);\n\t}if (!diffLevel && !isChild) flushMounts();\n}\n\nfunction buildComponentFromVNode(dom, vnode, context, mountAll) {\n\tvar c = dom && dom._component,\n\t originalComponent = c,\n\t oldDom = dom,\n\t isDirectOwner = c && dom._componentConstructor === vnode.nodeName,\n\t isOwner = isDirectOwner,\n\t props = getNodeProps(vnode);\n\twhile (c && !isOwner && (c = c._parentComponent)) {\n\t\tisOwner = c.constructor === vnode.nodeName;\n\t}\n\n\tif (c && isOwner && (!mountAll || c._component)) {\n\t\tsetComponentProps(c, props, 3, context, mountAll);\n\t\tdom = c.base;\n\t} else {\n\t\tif (originalComponent && !isDirectOwner) {\n\t\t\tunmountComponent(originalComponent);\n\t\t\tdom = oldDom = null;\n\t\t}\n\n\t\tc = createComponent(vnode.nodeName, props, context);\n\t\tif (dom && !c.nextBase) {\n\t\t\tc.nextBase = dom;\n\n\t\t\toldDom = null;\n\t\t}\n\t\tsetComponentProps(c, props, 1, context, mountAll);\n\t\tdom = c.base;\n\n\t\tif (oldDom && dom !== oldDom) {\n\t\t\toldDom._component = null;\n\t\t\trecollectNodeTree(oldDom, false);\n\t\t}\n\t}\n\n\treturn dom;\n}\n\nfunction unmountComponent(component) {\n\tif (options.beforeUnmount) options.beforeUnmount(component);\n\n\tvar base = component.base;\n\n\tcomponent._disable = true;\n\n\tif (component.componentWillUnmount) component.componentWillUnmount();\n\n\tcomponent.base = null;\n\n\tvar inner = component._component;\n\tif (inner) {\n\t\tunmountComponent(inner);\n\t} else if (base) {\n\t\tif (base['__preactattr_'] != null) applyRef(base['__preactattr_'].ref, null);\n\n\t\tcomponent.nextBase = base;\n\n\t\tremoveNode(base);\n\t\trecyclerComponents.push(component);\n\n\t\tremoveChildren(base);\n\t}\n\n\tapplyRef(component.__ref, null);\n}\n\nfunction Component(props, context) {\n\tthis._dirty = true;\n\n\tthis.context = context;\n\n\tthis.props = props;\n\n\tthis.state = this.state || {};\n\n\tthis._renderCallbacks = [];\n}\n\nextend(Component.prototype, {\n\tsetState: function setState(state, callback) {\n\t\tif (!this.prevState) this.prevState = this.state;\n\t\tthis.state = extend(extend({}, this.state), typeof state === 'function' ? state(this.state, this.props) : state);\n\t\tif (callback) this._renderCallbacks.push(callback);\n\t\tenqueueRender(this);\n\t},\n\tforceUpdate: function forceUpdate(callback) {\n\t\tif (callback) this._renderCallbacks.push(callback);\n\t\trenderComponent(this, 2);\n\t},\n\trender: function render() {}\n});\n\nfunction render(vnode, parent, merge) {\n return diff(merge, vnode, {}, false, parent, false);\n}\n\nfunction createRef() {\n\treturn {};\n}\n\nvar preact = {\n\th: h,\n\tcreateElement: h,\n\tcloneElement: cloneElement,\n\tcreateRef: createRef,\n\tComponent: Component,\n\trender: render,\n\trerender: rerender,\n\toptions: options\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (preact);\n\n//# sourceMappingURL=preact.mjs.map\n\n\n//# sourceURL=webpack:///./node_modules/preact/dist/preact.mjs?");
/***/ }),
/***/ "./node_modules/process/browser.js":
/*!*****************************************!*\
!*** ./node_modules/process/browser.js ***!
\*****************************************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("// shim for using process in browser\nvar process = module.exports = {}; // cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\n\nfunction defaultClearTimeout() {\n throw new Error('clearTimeout has not been defined');\n}\n\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n})();\n\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n } // if setTimeout wasn't available but was latter defined\n\n\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch (e) {\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch (e) {\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n}\n\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n } // if clearTimeout wasn't available but was latter defined\n\n\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e) {\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e) {\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n}\n\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n\n draining = false;\n\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n var len = queue.length;\n\n while (len) {\n currentQueue = queue;\n queue = [];\n\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n\n queueIndex = -1;\n len = queue.length;\n }\n\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n\n queue.push(new Item(fun, args));\n\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n}; // v8 likes predictible objects\n\n\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\n\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\n\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\n\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) {\n return [];\n};\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () {\n return '/';\n};\n\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\n\nprocess.umask = function () {\n return 0;\n};\n\n//# sourceURL=webpack:///./node_modules/process/browser.js?");
/***/ }),
/***/ "./node_modules/style-loader/lib/addStyles.js":
/*!****************************************************!*\
!*** ./node_modules/style-loader/lib/addStyles.js ***!
\****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n\nvar stylesInDom = {};\n\nvar\tmemoize = function (fn) {\n\tvar memo;\n\n\treturn function () {\n\t\tif (typeof memo === \"undefined\") memo = fn.apply(this, arguments);\n\t\treturn memo;\n\t};\n};\n\nvar isOldIE = memoize(function () {\n\t// Test for IE <= 9 as proposed by Browserhacks\n\t// @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805\n\t// Tests for existence of standard globals is to allow style-loader\n\t// to operate correctly into non-standard environments\n\t// @see https://github.com/webpack-contrib/style-loader/issues/177\n\treturn window && document && document.all && !window.atob;\n});\n\nvar getTarget = function (target, parent) {\n if (parent){\n return parent.querySelector(target);\n }\n return document.querySelector(target);\n};\n\nvar getElement = (function (fn) {\n\tvar memo = {};\n\n\treturn function(target, parent) {\n // If passing function in options, then use it for resolve \"head\" element.\n // Useful for Shadow Root style i.e\n // {\n // insertInto: function () { return document.querySelector(\"#foo\").shadowRoot }\n // }\n if (typeof target === 'function') {\n return target();\n }\n if (typeof memo[target] === \"undefined\") {\n\t\t\tvar styleTarget = getTarget.call(this, target, parent);\n\t\t\t// Special case to return head of iframe instead of iframe itself\n\t\t\tif (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {\n\t\t\t\ttry {\n\t\t\t\t\t// This will throw an exception if access to iframe is blocked\n\t\t\t\t\t// due to cross-origin restrictions\n\t\t\t\t\tstyleTarget = styleTarget.contentDocument.head;\n\t\t\t\t} catch(e) {\n\t\t\t\t\tstyleTarget = null;\n\t\t\t\t}\n\t\t\t}\n\t\t\tmemo[target] = styleTarget;\n\t\t}\n\t\treturn memo[target]\n\t};\n})();\n\nvar singleton = null;\nvar\tsingletonCounter = 0;\nvar\tstylesInsertedAtTop = [];\n\nvar\tfixUrls = __webpack_require__(/*! ./urls */ \"./node_modules/style-loader/lib/urls.js\");\n\nmodule.exports = function(list, options) {\n\tif (typeof DEBUG !== \"undefined\" && DEBUG) {\n\t\tif (typeof document !== \"object\") throw new Error(\"The style-loader cannot be used in a non-browser environment\");\n\t}\n\n\toptions = options || {};\n\n\toptions.attrs = typeof options.attrs === \"object\" ? options.attrs : {};\n\n\t// Force single-tag solution on IE6-9, which has a hard limit on the # of <style>\n\t// tags it will allow on a page\n\tif (!options.singleton && typeof options.singleton !== \"boolean\") options.singleton = isOldIE();\n\n\t// By default, add <style> tags to the <head> element\n if (!options.insertInto) options.insertInto = \"head\";\n\n\t// By default, add <style> tags to the bottom of the target\n\tif (!options.insertAt) options.insertAt = \"bottom\";\n\n\tvar styles = listToStyles(list, options);\n\n\taddStylesToDom(styles, options);\n\n\treturn function update (newList) {\n\t\tvar mayRemove = [];\n\n\t\tfor (var i = 0; i < styles.length; i++) {\n\t\t\tvar item = styles[i];\n\t\t\tvar domStyle = stylesInDom[item.id];\n\n\t\t\tdomStyle.refs--;\n\t\t\tmayRemove.push(domStyle);\n\t\t}\n\n\t\tif(newList) {\n\t\t\tvar newStyles = listToStyles(newList, options);\n\t\t\taddStylesToDom(newStyles, options);\n\t\t}\n\n\t\tfor (var i = 0; i < mayRemove.length; i++) {\n\t\t\tvar domStyle = mayRemove[i];\n\n\t\t\tif(domStyle.refs === 0) {\n\t\t\t\tfor (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j]();\n\n\t\t\t\tdelete stylesInDom[domStyle.id];\n\t\t\t}\n\t\t}\n\t};\n};\n\nfunction addStylesToDom (styles, options) {\n\tfor (var i = 0; i < styles.length; i++) {\n\t\tvar item = styles[i];\n\t\tvar domStyle = stylesInDom[item.id];\n\n\t\tif(domStyle) {\n\t\t\tdomStyle.refs++;\n\n\t\t\tfor(var j = 0; j < domStyle.parts.length; j++) {\n\t\t\t\tdomStyle.parts[j](item.parts[j]);\n\t\t\t}\n\n\t\t\tfor(; j < item.parts.length; j++) {\n\t\t\t\tdomStyle.parts.push(addStyle(item.parts[j], options));\n\t\t\t}\n\t\t} else {\n\t\t\tvar parts = [];\n\n\t\t\tfor(var j = 0; j < item.parts.length; j++) {\n\t\t\t\tparts.push(addStyle(item.parts[j], options));\n\t\t\t}\n\n\t\t\tstylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};\n\t\t}\n\t}\n}\n\nfunction listToStyles (list, options) {\n\tvar styles = [];\n\tvar newStyles = {};\n\n\tfor (var i = 0; i < list.length; i++) {\n\t\tvar item = list[i];\n\t\tvar id = options.base ? item[0] + options.base : item[0];\n\t\tvar css = item[1];\n\t\tvar media = item[2];\n\t\tvar sourceMap = item[3];\n\t\tvar part = {css: css, media: media, sourceMap: sourceMap};\n\n\t\tif(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]});\n\t\telse newStyles[id].parts.push(part);\n\t}\n\n\treturn styles;\n}\n\nfunction insertStyleElement (options, style) {\n\tvar target = getElement(options.insertInto)\n\n\tif (!target) {\n\t\tthrow new Error(\"Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.\");\n\t}\n\n\tvar lastStyleElementInsertedAtTop = stylesInsertedAtTop[stylesInsertedAtTop.length - 1];\n\n\tif (options.insertAt === \"top\") {\n\t\tif (!lastStyleElementInsertedAtTop) {\n\t\t\ttarget.insertBefore(style, target.firstChild);\n\t\t} else if (lastStyleElementInsertedAtTop.nextSibling) {\n\t\t\ttarget.insertBefore(style, lastStyleElementInsertedAtTop.nextSibling);\n\t\t} else {\n\t\t\ttarget.appendChild(style);\n\t\t}\n\t\tstylesInsertedAtTop.push(style);\n\t} else if (options.insertAt === \"bottom\") {\n\t\ttarget.appendChild(style);\n\t} else if (typeof options.insertAt === \"object\" && options.insertAt.before) {\n\t\tvar nextSibling = getElement(options.insertAt.before, target);\n\t\ttarget.insertBefore(style, nextSibling);\n\t} else {\n\t\tthrow new Error(\"[Style Loader]\\n\\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\\n Must be 'top', 'bottom', or Object.\\n (https://github.com/webpack-contrib/style-loader#insertat)\\n\");\n\t}\n}\n\nfunction removeStyleElement (style) {\n\tif (style.parentNode === null) return false;\n\tstyle.parentNode.removeChild(style);\n\n\tvar idx = stylesInsertedAtTop.indexOf(style);\n\tif(idx >= 0) {\n\t\tstylesInsertedAtTop.splice(idx, 1);\n\t}\n}\n\nfunction createStyleElement (options) {\n\tvar style = document.createElement(\"style\");\n\n\tif(options.attrs.type === undefined) {\n\t\toptions.attrs.type = \"text/css\";\n\t}\n\n\tif(options.attrs.nonce === undefined) {\n\t\tvar nonce = getNonce();\n\t\tif (nonce) {\n\t\t\toptions.attrs.nonce = nonce;\n\t\t}\n\t}\n\n\taddAttrs(style, options.attrs);\n\tinsertStyleElement(options, style);\n\n\treturn style;\n}\n\nfunction createLinkElement (options) {\n\tvar link = document.createElement(\"link\");\n\n\tif(options.attrs.type === undefined) {\n\t\toptions.attrs.type = \"text/css\";\n\t}\n\toptions.attrs.rel = \"stylesheet\";\n\n\taddAttrs(link, options.attrs);\n\tinsertStyleElement(options, link);\n\n\treturn link;\n}\n\nfunction addAttrs (el, attrs) {\n\tObject.keys(attrs).forEach(function (key) {\n\t\tel.setAttribute(key, attrs[key]);\n\t});\n}\n\nfunction getNonce() {\n\tif (false) {}\n\n\treturn __webpack_require__.nc;\n}\n\nfunction addStyle (obj, options) {\n\tvar style, update, remove, result;\n\n\t// If a transform function was defined, run it on the css\n\tif (options.transform && obj.css) {\n\t result = typeof options.transform === 'function'\n\t\t ? options.transform(obj.css) \n\t\t : options.transform.default(obj.css);\n\n\t if (result) {\n\t \t// If transform returns a value, use that instead of the original css.\n\t \t// This allows running runtime transformations on the css.\n\t \tobj.css = result;\n\t } else {\n\t \t// If the transform function returns a falsy value, don't add this css.\n\t \t// This allows conditional loading of css\n\t \treturn function() {\n\t \t\t// noop\n\t \t};\n\t }\n\t}\n\n\tif (options.singleton) {\n\t\tvar styleIndex = singletonCounter++;\n\n\t\tstyle = singleton || (singleton = createStyleElement(options));\n\n\t\tupdate = applyToSingletonTag.bind(null, style, styleIndex, false);\n\t\tremove = applyToSingletonTag.bind(null, style, styleIndex, true);\n\n\t} else if (\n\t\tobj.sourceMap &&\n\t\ttypeof URL === \"function\" &&\n\t\ttypeof URL.createObjectURL === \"function\" &&\n\t\ttypeof URL.revokeObjectURL === \"function\" &&\n\t\ttypeof Blob === \"function\" &&\n\t\ttypeof btoa === \"function\"\n\t) {\n\t\tstyle = createLinkElement(options);\n\t\tupdate = updateLink.bind(null, style, options);\n\t\tremove = function () {\n\t\t\tremoveStyleElement(style);\n\n\t\t\tif(style.href) URL.revokeObjectURL(style.href);\n\t\t};\n\t} else {\n\t\tstyle = createStyleElement(options);\n\t\tupdate = applyToTag.bind(null, style);\n\t\tremove = function () {\n\t\t\tremoveStyleElement(style);\n\t\t};\n\t}\n\n\tupdate(obj);\n\n\treturn function updateStyle (newObj) {\n\t\tif (newObj) {\n\t\t\tif (\n\t\t\t\tnewObj.css === obj.css &&\n\t\t\t\tnewObj.media === obj.media &&\n\t\t\t\tnewObj.sourceMap === obj.sourceMap\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tupdate(obj = newObj);\n\t\t} else {\n\t\t\tremove();\n\t\t}\n\t};\n}\n\nvar replaceText = (function () {\n\tvar textStore = [];\n\n\treturn function (index, replacement) {\n\t\ttextStore[index] = replacement;\n\n\t\treturn textStore.filter(Boolean).join('\\n');\n\t};\n})();\n\nfunction applyToSingletonTag (style, index, remove, obj) {\n\tvar css = remove ? \"\" : obj.css;\n\n\tif (style.styleSheet) {\n\t\tstyle.styleSheet.cssText = replaceText(index, css);\n\t} else {\n\t\tvar cssNode = document.createTextNode(css);\n\t\tvar childNodes = style.childNodes;\n\n\t\tif (childNodes[index]) style.removeChild(childNodes[index]);\n\n\t\tif (childNodes.length) {\n\t\t\tstyle.insertBefore(cssNode, childNodes[index]);\n\t\t} else {\n\t\t\tstyle.appendChild(cssNode);\n\t\t}\n\t}\n}\n\nfunction applyToTag (style, obj) {\n\tvar css = obj.css;\n\tvar media = obj.media;\n\n\tif(media) {\n\t\tstyle.setAttribute(\"media\", media)\n\t}\n\n\tif(style.styleSheet) {\n\t\tstyle.styleSheet.cssText = css;\n\t} else {\n\t\twhile(style.firstChild) {\n\t\t\tstyle.removeChild(style.firstChild);\n\t\t}\n\n\t\tstyle.appendChild(document.createTextNode(css));\n\t}\n}\n\nfunction updateLink (link, options, obj) {\n\tvar css = obj.css;\n\tvar sourceMap = obj.sourceMap;\n\n\t/*\n\t\tIf convertToAbsoluteUrls isn't defined, but sourcemaps are enabled\n\t\tand there is no publicPath defined then lets turn convertToAbsoluteUrls\n\t\ton by default. Otherwise default to the convertToAbsoluteUrls option\n\t\tdirectly\n\t*/\n\tvar autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap;\n\n\tif (options.convertToAbsoluteUrls || autoFixUrls) {\n\t\tcss = fixUrls(css);\n\t}\n\n\tif (sourceMap) {\n\t\t// http://stackoverflow.com/a/26603875\n\t\tcss += \"\\n/*# sourceMappingURL=data:application/json;base64,\" + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + \" */\";\n\t}\n\n\tvar blob = new Blob([css], { type: \"text/css\" });\n\n\tvar oldSrc = link.href;\n\n\tlink.href = URL.createObjectURL(blob);\n\n\tif(oldSrc) URL.revokeObjectURL(oldSrc);\n}\n\n\n//# sourceURL=webpack:///./node_modules/style-loader/lib/addStyles.js?");
/***/ }),
/***/ "./node_modules/style-loader/lib/urls.js":
/*!***********************************************!*\
!*** ./node_modules/style-loader/lib/urls.js ***!
\***********************************************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("/**\n * When source maps are enabled, `style-loader` uses a link element with a data-uri to\n * embed the css on the page. This breaks all relative urls because now they are relative to a\n * bundle instead of the current page.\n *\n * One solution is to only use full urls, but that may be impossible.\n *\n * Instead, this function \"fixes\" the relative urls to be absolute according to the current page location.\n *\n * A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command.\n *\n */\nmodule.exports = function (css) {\n // get current location\n var location = typeof window !== \"undefined\" && window.location;\n\n if (!location) {\n throw new Error(\"fixUrls requires window.location\");\n } // blank or null?\n\n\n if (!css || typeof css !== \"string\") {\n return css;\n }\n\n var baseUrl = location.protocol + \"//\" + location.host;\n var currentDir = baseUrl + location.pathname.replace(/\\/[^\\/]*$/, \"/\"); // convert each url(...)\n\n /*\n This regular expression is just a way to recursively match brackets within\n a string.\n \t /url\\s*\\( = Match on the word \"url\" with any whitespace after it and then a parens\n ( = Start a capturing group\n (?: = Start a non-capturing group\n [^)(] = Match anything that isn't a parentheses\n | = OR\n \\( = Match a start parentheses\n (?: = Start another non-capturing groups\n [^)(]+ = Match anything that isn't a parentheses\n | = OR\n \\( = Match a start parentheses\n [^)(]* = Match anything that isn't a parentheses\n \\) = Match a end parentheses\n ) = End Group\n *\\) = Match anything and then a close parens\n ) = Close non-capturing group\n * = Match anything\n ) = Close capturing group\n \\) = Match a close parens\n \t /gi = Get all matches, not the first. Be case insensitive.\n */\n\n var fixedCss = css.replace(/url\\s*\\(((?:[^)(]|\\((?:[^)(]+|\\([^)(]*\\))*\\))*)\\)/gi, function (fullMatch, origUrl) {\n // strip quotes (if they exist)\n var unquotedOrigUrl = origUrl.trim().replace(/^\"(.*)\"$/, function (o, $1) {\n return $1;\n }).replace(/^'(.*)'$/, function (o, $1) {\n return $1;\n }); // already a full url? no change\n\n if (/^(#|data:|http:\\/\\/|https:\\/\\/|file:\\/\\/\\/|\\s*$)/i.test(unquotedOrigUrl)) {\n return fullMatch;\n } // convert the url to a full url\n\n\n var newUrl;\n\n if (unquotedOrigUrl.indexOf(\"//\") === 0) {\n //TODO: should we add protocol?\n newUrl = unquotedOrigUrl;\n } else if (unquotedOrigUrl.indexOf(\"/\") === 0) {\n // path should be relative to the base url\n newUrl = baseUrl + unquotedOrigUrl; // already starts with '/'\n } else {\n // path should be relative to current directory\n newUrl = currentDir + unquotedOrigUrl.replace(/^\\.\\//, \"\"); // Strip leading './'\n } // send back the fixed url(...)\n\n\n return \"url(\" + JSON.stringify(newUrl) + \")\";\n }); // send back the fixed css\n\n return fixedCss;\n};\n\n//# sourceURL=webpack:///./node_modules/style-loader/lib/urls.js?");
/***/ }),
/***/ "./node_modules/webpack/buildin/global.js":
/*!***********************************!*\
!*** (webpack)/buildin/global.js ***!
\***********************************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("var g; // This works in non-strict mode\n\ng = function () {\n return this;\n}();\n\ntry {\n // This works if eval is allowed (see CSP)\n g = g || new Function(\"return this\")();\n} catch (e) {\n // This works if the window reference is available\n if (typeof window === \"object\") g = window;\n} // g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\n\nmodule.exports = g;\n\n//# sourceURL=webpack:///(webpack)/buildin/global.js?");
/***/ }),
/***/ "./src/currentTile.js":
/*!****************************!*\
!*** ./src/currentTile.js ***!
\****************************/
/*! exports provided: CurrentTile */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CurrentTile\", function() { return CurrentTile; });\n/* harmony import */ var preact__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! preact */ \"./node_modules/preact/dist/preact.mjs\");\n/* harmony import */ var mobx_preact__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! mobx-preact */ \"./node_modules/mobx-preact/lib/index.module.js\");\n/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./util.js */ \"./src/util.js\");\n/* harmony import */ var _state_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./state.js */ \"./src/state.js\");\n/* harmony import */ var _scratchpad_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./scratchpad.js */ \"./src/scratchpad.js\");\nvar _class, _class2;\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\n\n\n\n\n\nvar root = document.getElementById('currentTile');\n\nvar CurrentTileComponent = Object(mobx_preact__WEBPACK_IMPORTED_MODULE_1__[\"observer\"])(_class =\n/*#__PURE__*/\nfunction (_Component) {\n _inherits(CurrentTileComponent, _Component);\n\n function CurrentTileComponent() {\n _classCallCheck(this, CurrentTileComponent);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(CurrentTileComponent).apply(this, arguments));\n }\n\n _createClass(CurrentTileComponent, [{\n key: \"render\",\n value: function render() {\n var coordsPath = '/tiles/' + Object(_util_js__WEBPACK_IMPORTED_MODULE_2__[\"coordsToPath\"])(_state_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].coords);\n return Object(preact__WEBPACK_IMPORTED_MODULE_0__[\"h\"])(\"div\", null, Object(preact__WEBPACK_IMPORTED_MODULE_0__[\"h\"])(\"h2\", null, \"Current Tile: \", Object(_util_js__WEBPACK_IMPORTED_MODULE_2__[\"coordsToPath\"])(_state_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].coords)), Object(preact__WEBPACK_IMPORTED_MODULE_0__[\"h\"])(\"div\", {\n className: \"current-tile-upload\"\n }, Object(preact__WEBPACK_IMPORTED_MODULE_0__[\"h\"])(SubmitDrawingForm, {\n tilePath: coordsPath\n }), Object(preact__WEBPACK_IMPORTED_MODULE_0__[\"h\"])(UploadForm, {\n tilePath: coordsPath\n }), Object(preact__WEBPACK_IMPORTED_MODULE_0__[\"h\"])(\"img\", {\n src: coordsPath,\n className: \"tile-image\"\n })));\n }\n }]);\n\n return CurrentTileComponent;\n}(preact__WEBPACK_IMPORTED_MODULE_0__[\"Component\"])) || _class;\n\nvar SubmitDrawingForm = Object(mobx_preact__WEBPACK_IMPORTED_MODULE_1__[\"observer\"])(_class2 =\n/*#__PURE__*/\nfunction (_Component2) {\n _inherits(SubmitDrawingForm, _Component2);\n\n function SubmitDrawingForm() {\n _classCallCheck(this, SubmitDrawingForm);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(SubmitDrawingForm).apply(this, arguments));\n }\n\n _createClass(SubmitDrawingForm, [{\n key: \"render\",\n value: function render(props) {\n var _this = this;\n\n return Object(preact__WEBPACK_IMPORTED_MODULE_0__[\"h\"])(\"div\", {\n className: \"uploadForm\"\n }, Object(preact__WEBPACK_IMPORTED_MODULE_0__[\"h\"])(_scratchpad_js__WEBPACK_IMPORTED_MODULE_4__[\"Scratchpad\"], {\n ref: function ref(s) {\n _this.scratchpad = s;\n }\n }), Object(preact__WEBPACK_IMPORTED_MODULE_0__[\"h\"])(\"form\", {\n action: props.tilePath,\n method: \"POST\",\n enctype: \"multipart/form-data\",\n onSubmit: function onSubmit(e) {\n return _this.handleSubmit(e);\n }\n }, Object(preact__WEBPACK_IMPORTED_MODULE_0__[\"h\"])(\"input\", {\n type: \"hidden\",\n name: \"file\",\n ref: function ref(f) {\n _this.file = f;\n }\n }), Object(preact__WEBPACK_IMPORTED_MODULE_0__[\"h\"])(\"input\", {\n type: \"submit\",\n value: \"Upload Scratch\"\n })));\n }\n }, {\n key: \"handleSubmit\",\n value: function handleSubmit(e) {\n this.file.value = this.scratchpad.image;\n }\n }]);\n\n return SubmitDrawingForm;\n}(preact__WEBPACK_IMPORTED_MODULE_0__[\"Component\"])) || _class2;\n\nvar UploadForm =\n/*#__PURE__*/\nfunction (_Component3) {\n _inherits(UploadForm, _Component3);\n\n function UploadForm() {\n _classCallCheck(this, UploadForm);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(UploadForm).apply(this, arguments));\n }\n\n _createClass(UploadForm, [{\n key: \"render\",\n value: function render(props) {\n return Object(preact__WEBPACK_IMPORTED_MODULE_0__[\"h\"])(\"div\", {\n className: \"uploadForm\"\n }, Object(preact__WEBPACK_IMPORTED_MODULE_0__[\"h\"])(\"form\", {\n action: props.tilePath,\n method: \"POST\",\n enctype: \"multipart/form-data\"\n }, Object(preact__WEBPACK_IMPORTED_MODULE_0__[\"h\"])(\"input\", {\n type: \"file\",\n name: \"file\"\n }), Object(preact__WEBPACK_IMPORTED_MODULE_0__[\"h\"])(\"br\", null), Object(preact__WEBPACK_IMPORTED_MODULE_0__[\"h\"])(\"input\", {\n type: \"submit\",\n value: \"Upload\"\n })));\n }\n }]);\n\n return UploadForm;\n}(preact__WEBPACK_IMPORTED_MODULE_0__[\"Component\"]);\n\nvar CurrentTile = Object(preact__WEBPACK_IMPORTED_MODULE_0__[\"render\"])(Object(preact__WEBPACK_IMPORTED_MODULE_0__[\"h\"])(CurrentTileComponent, null), root);\n\n//# sourceURL=webpack:///./src/currentTile.js?");
/***/ }),
/***/ "./src/map.js":
/*!********************!*\
!*** ./src/map.js ***!
\********************/
/*! exports provided: map */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"map\", function() { return map; });\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/lib/mobx.module.js\");\n/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! leaflet */ \"./node_modules/leaflet/dist/leaflet-src.js\");\n/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(leaflet__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var leaflet_dist_leaflet_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! leaflet/dist/leaflet.css */ \"./node_modules/leaflet/dist/leaflet.css\");\n/* harmony import */ var leaflet_dist_leaflet_css__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(leaflet_dist_leaflet_css__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _state_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./state.js */ \"./src/state.js\");\n/* harmony import */ var _opacityControl_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./opacityControl.js */ \"./src/opacityControl.js\");\n/* harmony import */ var _tileLayers_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./tileLayers.js */ \"./src/tileLayers.js\");\n\n\n\n\n\n\nvar map = Object(leaflet__WEBPACK_IMPORTED_MODULE_1__[\"map\"])('map', {\n maxZoom: 14\n});\nmap.setView([0, 0], 1);\nleaflet__WEBPACK_IMPORTED_MODULE_1__[\"control\"].layers(_tileLayers_js__WEBPACK_IMPORTED_MODULE_5__[\"baseLayers\"]).addTo(map);\nleaflet__WEBPACK_IMPORTED_MODULE_1__[\"control\"].scale().addTo(map);\nnew _opacityControl_js__WEBPACK_IMPORTED_MODULE_4__[\"OpacityControl\"]({\n 'position': 'bottomright'\n}).addTo(map);\n_tileLayers_js__WEBPACK_IMPORTED_MODULE_5__[\"wundertiles\"].addTo(map); // compute Tile Coordinates\n\nvar toRad = function toRad(num) {\n return num * Math.PI / 180;\n};\n\nvar modulo = function modulo(n, mod) {\n return (n % mod + mod) % mod;\n};\n\nvar getTileCoords = function getTileCoords(lat, lon, zoom) {\n var coordMax = Math.pow(2, zoom) - 1;\n var xtile = parseInt(Math.floor((lon + 180) / 360 * (1 << zoom)));\n var ytile = parseInt(Math.floor((1 - Math.log(Math.tan(toRad(lat)) + 1 / Math.cos(toRad(lat))) / Math.PI) / 2 * (1 << zoom)));\n xtile = modulo(xtile, coordMax + 1);\n ytile = modulo(ytile, coordMax + 1);\n return {\n x: xtile,\n y: ytile,\n z: zoom\n };\n}; // get tile coords on click\n\n\nmap.on('click', function (e) {\n _state_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].coords = getTileCoords(e.latlng.lat, e.latlng.lng, map.getZoom());\n}); // react on base layer change\n\nmap.on('baselayerchange', function (e) {\n _state_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].backgroundTileServerUrl = e.layer._url;\n _tileLayers_js__WEBPACK_IMPORTED_MODULE_5__[\"wundertiles\"].bringToFront();\n e.layer.setOpacity(_state_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].backgroundOpacity);\n}); // react on opacity change\n\nObject(mobx__WEBPACK_IMPORTED_MODULE_0__[\"reaction\"])(function () {\n return _state_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"].backgroundOpacity;\n}, function (opacity) {\n map.eachLayer(function (l) {\n if (l.options.name !== 'wundertiles') {\n l.setOpacity(opacity);\n }\n });\n});\n\n//# sourceURL=webpack:///./src/map.js?");
/***/ }),
/***/ "./src/opacityControl.js":
/*!*******************************!*\
!*** ./src/opacityControl.js ***!
\*******************************/
/*! exports provided: OpacityControl */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"OpacityControl\", function() { return OpacityControl; });\n/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! leaflet */ \"./node_modules/leaflet/dist/leaflet-src.js\");\n/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(leaflet__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _state_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./state.js */ \"./src/state.js\");\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\n\n\nvar OpacityControl =\n/*#__PURE__*/\nfunction (_Control) {\n _inherits(OpacityControl, _Control);\n\n function OpacityControl() {\n _classCallCheck(this, OpacityControl);\n\n return _possibleConstructorReturn(this, _getPrototypeOf(OpacityControl).apply(this, arguments));\n }\n\n _createClass(OpacityControl, [{\n key: \"onAdd\",\n value: function onAdd(map) {\n var container = leaflet__WEBPACK_IMPORTED_MODULE_0__[\"DomUtil\"].create('div', 'leaflet-bar leaflet-control opacity-control');\n container.setAttribute('id', 'opacityControl');\n var label = leaflet__WEBPACK_IMPORTED_MODULE_0__[\"DomUtil\"].create('label', '', container);\n label.innerText = 'Background opacity: ';\n var slider = leaflet__WEBPACK_IMPORTED_MODULE_0__[\"DomUtil\"].create('input', '', container);\n slider.setAttribute('type', 'range');\n slider.addEventListener('input', function (e) {\n _state_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].backgroundOpacity = Number(e.target.value) / 100;\n }); // container.innerHTML = `<label>Background opacity: </label><input type=\"range\">`\n // prevent map dragging when mouse is over control.\n // Otherwise slider-adjustments would pan map.\n\n leaflet__WEBPACK_IMPORTED_MODULE_0__[\"DomEvent\"].on(container, 'mousedown mouseup click touchstart', leaflet__WEBPACK_IMPORTED_MODULE_0__[\"DomEvent\"].stopPropagation);\n leaflet__WEBPACK_IMPORTED_MODULE_0__[\"DomEvent\"].on(container, 'mouseenter', function (e) {\n map.dragging.disable();\n });\n leaflet__WEBPACK_IMPORTED_MODULE_0__[\"DomEvent\"].on(container, 'mouseleave', function (e) {\n map.dragging.enable();\n });\n return container;\n }\n }, {\n key: \"test\",\n value: function test() {\n console.log('lala');\n }\n }]);\n\n return OpacityControl;\n}(leaflet__WEBPACK_IMPORTED_MODULE_0__[\"Control\"]);\n\n//# sourceURL=webpack:///./src/opacityControl.js?");
/***/ }),
/***/ "./src/scratchpad.js":
/*!***************************!*\
!*** ./src/scratchpad.js ***!
\***************************/
/*! exports provided: Scratchpad */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Scratchpad\", function() { return Scratchpad; });\n/* harmony import */ var preact__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! preact */ \"./node_modules/preact/dist/preact.mjs\");\n/* harmony import */ var mobx_preact__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! mobx-preact */ \"./node_modules/mobx-preact/lib/index.module.js\");\n/* harmony import */ var _state_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./state.js */ \"./src/state.js\");\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/lib/mobx.module.js\");\nvar _class, _temp;\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\n\n\n\n\nvar Scratchpad = Object(mobx_preact__WEBPACK_IMPORTED_MODULE_1__[\"observer\"])(_class = (_temp =\n/*#__PURE__*/\nfunction (_Component) {\n _inherits(Scratchpad, _Component);\n\n function Scratchpad() {\n var _getPrototypeOf2;\n\n var _this;\n\n _classCallCheck(this, Scratchpad);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Scratchpad)).call.apply(_getPrototypeOf2, [this].concat(args)));\n _this.draw = false;\n return _this;\n }\n\n _createClass(Scratchpad, [{\n key: \"render\",\n value: function render() {\n var _this2 = this;\n\n var bgTileStyele = {\n backgroundImage: \"url(\".concat(_state_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].backgroundTileUrl, \")\"),\n opacity: _state_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"].backgroundOpacity\n };\n return Object(preact__WEBPACK_IMPORTED_MODULE_0__[\"h\"])(\"div\", null, Object(preact__WEBPACK_IMPORTED_MODULE_0__[\"h\"])(\"div\", {\n className: \"tile-image\",\n style: {\n position: ''\n }\n }, Object(preact__WEBPACK_IMPORTED_MODULE_0__[\"h\"])(\"div\", {\n className: \"background-image transparent-tile-bg\"\n }), Object(preact__WEBPACK_IMPORTED_MODULE_0__[\"h\"])(\"div\", {\n className: \"background-image\",\n style: bgTileStyele\n }), Object(preact__WEBPACK_IMPORTED_MODULE_0__[\"h\"])(\"canvas\", {\n className: \"background-image\",\n width: \"256\",\n height: \"256\",\n onMouseDown: function onMouseDown(e) {\n return _this2.handleMouseDown(e);\n },\n onMouseMove: function onMouseMove(e) {\n return _this2.handleMouseMove(e);\n },\n onMouseUp: function onMouseUp(e) {\n return _this2.handleMouseUp(e);\n },\n onMouseOut: function onMouseOut(e) {\n return _this2.handleMouseOut(e);\n },\n onMouseEnter: function onMouseEnter(e) {\n return _this2.handleMouseEnter(e);\n },\n onTouchStart: function onTouchStart(e) {\n return _this2.handleTouchStart(e);\n },\n onTouchEnd: function onTouchEnd(e) {\n return _this2.handleTouchEnd(e);\n },\n onTouchMove: function onTouchMove(e) {\n return _this2.handleTouchMove(e);\n },\n ref: function ref(c) {\n _this2.canvas = c;\n },\n style: {\n position: 'absolute'\n }\n })), Object(preact__WEBPACK_IMPORTED_MODULE_0__[\"h\"])(\"br\", null), Object(preact__WEBPACK_IMPORTED_MODULE_0__[\"h\"])(\"label\", null, \"Thickness: \"), Object(preact__WEBPACK_IMPORTED_MODULE_0__[\"h\"])(\"input\", {\n type: \"range\",\n onChange: function onChange(e) {\n return _this2.handleThicknessInput(e);\n },\n min: \"1\",\n max: \"100\",\n value: \"10\"\n }), Object(preact__WEBPACK_IMPORTED_MODULE_0__[\"h\"])(\"br\", null), Object(preact__WEBPACK_IMPORTED_MODULE_0__[\"h\"])(\"label\", null, \"Color: \"), Object(preact__WEBPACK_IMPORTED_MODULE_0__[\"h\"])(\"input\", {\n type: \"color\",\n onChange: function onChange(e) {\n return _this2.handleColorChange(e);\n }\n }), Object(preact__WEBPACK_IMPORTED_MODULE_0__[\"h\"])(\"br\", null), Object(preact__WEBPACK_IMPORTED_MODULE_0__[\"h\"])(\"button\", {\n onClick: function onClick() {\n return _this2.clear();\n }\n }, \"Clear\"));\n }\n }, {\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.ctx.lineWidth = 10;\n this.ctx.lineJoin = 'round';\n this.ctx.lineCap = 'round';\n }\n }, {\n key: \"getCoords\",\n value: function getCoords(e) {\n // handle touchevents\n e = e.touches ? e.touches[0] : e;\n return {\n x: e.pageX - this.canvas.offsetLeft,\n y: e.pageY - this.canvas.offsetTop\n };\n }\n }, {\n key: \"handleMouseDown\",\n value: function handleMouseDown(e) {\n var _this$getCoords = this.getCoords(e),\n x = _this$getCoords.x,\n y = _this$getCoords.y;\n\n this.draw = true;\n this.ctx.lineWidth = this.thickness;\n this.ctx.beginPath();\n this.ctx.moveTo(x, y);\n }\n }, {\n key: \"handleMouseMove\",\n value: function handleMouseMove(e) {\n if (this.draw === true) {\n var _this$getCoords2 = this.getCoords(e),\n x = _this$getCoords2.x,\n y = _this$getCoords2.y;\n\n this.ctx.lineTo(x, y);\n this.ctx.stroke();\n }\n }\n }, {\n key: \"handleMouseUp\",\n value: function handleMouseUp(e) {\n this.draw = false;\n }\n }, {\n key: \"handleMouseOut\",\n value: function handleMouseOut(e) {\n this.handleMouseUp(e);\n }\n }, {\n key: \"handleMouseEnter\",\n value: function handleMouseEnter(e) {\n if (e.buttons) {\n this.handleMouseDown(e);\n }\n }\n }, {\n key: \"handleThicknessInput\",\n value: function handleThicknessInput(e) {\n this.ctx.lineWidth = parseInt(e.target.value);\n }\n }, {\n key: \"handleColorChange\",\n value: function handleColorChange(e) {\n this.ctx.strokeStyle = e.target.value;\n }\n }, {\n key: \"handleTouchStart\",\n value: function handleTouchStart(e) {\n if (!e.cancelable) return;\n e.preventDefault();\n this.handleMouseDown(e);\n }\n }, {\n key: \"handleTouchEnd\",\n value: function handleTouchEnd(e) {\n if (!e.cancelable) return;\n e.preventDefault();\n this.handleMouseUp(e);\n }\n }, {\n key: \"handleTouchMove\",\n value: function handleTouchMove(e) {\n if (!e.cancelable) return;\n e.preventDefault();\n this.handleMouseMove(e);\n }\n }, {\n key: \"clear\",\n value: function clear() {\n this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);\n }\n }, {\n key: \"ctx\",\n get: function get() {\n return this.canvas.getContext('2d');\n }\n }, {\n key: \"image\",\n get: function get() {\n return this.canvas.toDataURL();\n }\n }]);\n\n return Scratchpad;\n}(preact__WEBPACK_IMPORTED_MODULE_0__[\"Component\"]), _temp)) || _class;\n\n//# sourceURL=webpack:///./src/scratchpad.js?");
/***/ }),
/***/ "./src/state.js":
/*!**********************!*\
!*** ./src/state.js ***!
\**********************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var mobx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! mobx */ \"./node_modules/mobx/lib/mobx.module.js\");\nvar _class, _descriptor, _descriptor2, _descriptor3, _temp;\n\nfunction _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }\n\nfunction _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and set to use loose mode. ' + 'To use proposal-class-properties in spec mode with decorators, wait for ' + 'the next major version of decorators in stage 2.'); }\n\n\nvar State = (_class = (_temp =\n/*#__PURE__*/\nfunction () {\n function State() {\n _classCallCheck(this, State);\n\n _initializerDefineProperty(this, \"coords\", _descriptor, this);\n\n _initializerDefineProperty(this, \"backgroundTileServerUrl\", _descriptor2, this);\n\n _initializerDefineProperty(this, \"backgroundOpacity\", _descriptor3, this);\n }\n\n _createClass(State, [{\n key: \"backgroundTileUrl\",\n get: function get() {\n var _this$coords = this.coords,\n x = _this$coords.x,\n y = _this$coords.y,\n z = _this$coords.z;\n var url = this.backgroundTileServerUrl.replace('{s}', 'a');\n url = url.replace('{x}', x);\n url = url.replace('{y}', y);\n url = url.replace('{z}', z);\n return url;\n }\n }]);\n\n return State;\n}(), _temp), (_descriptor = _applyDecoratedDescriptor(_class.prototype, \"coords\", [mobx__WEBPACK_IMPORTED_MODULE_0__[\"observable\"]], {\n configurable: true,\n enumerable: true,\n writable: true,\n initializer: function initializer() {\n return {\n x: 0,\n y: 0,\n z: 0\n };\n }\n}), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, \"backgroundTileServerUrl\", [mobx__WEBPACK_IMPORTED_MODULE_0__[\"observable\"]], {\n configurable: true,\n enumerable: true,\n writable: true,\n initializer: function initializer() {\n return '';\n }\n}), _descriptor3 = _applyDecoratedDescriptor(_class.prototype, \"backgroundOpacity\", [mobx__WEBPACK_IMPORTED_MODULE_0__[\"observable\"]], {\n configurable: true,\n enumerable: true,\n writable: true,\n initializer: function initializer() {\n return 0.5;\n }\n}), _applyDecoratedDescriptor(_class.prototype, \"backgroundTileUrl\", [mobx__WEBPACK_IMPORTED_MODULE_0__[\"computed\"]], Object.getOwnPropertyDescriptor(_class.prototype, \"backgroundTileUrl\"), _class.prototype)), _class);\n/* harmony default export */ __webpack_exports__[\"default\"] = (new State());\n\n//# sourceURL=webpack:///./src/state.js?");
/***/ }),
/***/ "./src/tileLayers.js":
/*!***************************!*\
!*** ./src/tileLayers.js ***!
\***************************/
/*! exports provided: wundertiles, baseLayers */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"wundertiles\", function() { return wundertiles; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"baseLayers\", function() { return baseLayers; });\n/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! leaflet */ \"./node_modules/leaflet/dist/leaflet-src.js\");\n/* harmony import */ var leaflet__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(leaflet__WEBPACK_IMPORTED_MODULE_0__);\n\nvar osmDE = Object(leaflet__WEBPACK_IMPORTED_MODULE_0__[\"tileLayer\"])('https://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png', {\n maxZoom: 18,\n attribution: '&copy; <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors'\n});\nvar osmMap = Object(leaflet__WEBPACK_IMPORTED_MODULE_0__[\"tileLayer\"])('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n maxZoom: 19,\n attribution: '&copy; <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors'\n});\nvar esriSat = Object(leaflet__WEBPACK_IMPORTED_MODULE_0__[\"tileLayer\"])('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {\n attribution: 'Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'\n});\nvar wundertiles = Object(leaflet__WEBPACK_IMPORTED_MODULE_0__[\"tileLayer\"])('/tiles/{z}/{x}/{y}', {\n name: 'wundertiles',\n attribution: '',\n maxZoom: 14\n});\nvar baseLayers = {\n 'OSM DE': osmDE,\n 'OSM Map': osmMap,\n 'ESRI Sattelite': esriSat\n};\n\n//# sourceURL=webpack:///./src/tileLayers.js?");
/***/ }),
/***/ "./src/util.js":
/*!*********************!*\
!*** ./src/util.js ***!
\*********************/
/*! exports provided: coordsToPath */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"coordsToPath\", function() { return coordsToPath; });\nvar coordsToPath = function coordsToPath(coords) {\n return \"\".concat(coords.z, \"/\").concat(coords.x, \"/\").concat(coords.y);\n};\n\n//# sourceURL=webpack:///./src/util.js?");
/***/ })
/******/ });