/** * Minified by jsDelivr using UglifyJS v3.3.22. * Original file: /npm/mappa-mundi@0.0.5/dist/mappa.js * * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files */ !function (t, e) { "object" == typeof exports && "object" == typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define([], e) : "object" == typeof exports ? exports.Mappa = e() : t.Mappa = e() }(this, function () { return function (o) { var n = {}; function i(t) { if (n[t]) return n[t].exports; var e = n[t] = { i: t, l: !1, exports: {} }; return o[t].call(e.exports, e, e.exports, i), e.l = !0, e.exports } return i.m = o, i.c = n, i.i = function (t) { return t }, i.d = function (t, e, o) { i.o(t, e) || Object.defineProperty(t, e, { configurable: !1, enumerable: !0, get: o }) }, i.n = function (t) { var e = t && t.__esModule ? function () { return t.default } : function () { return t }; return i.d(e, "a", e), e }, i.o = function (t, e) { return Object.prototype.hasOwnProperty.call(t, e) }, i.p = "/dist/", i(i.s = 6) }([function (t, e, o) { "use strict"; Object.defineProperty(e, "__esModule", { value: !0 }); var n, i = function () { function n(t, e) { for (var o = 0; o < e.length; o++) { var n = e[o]; n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) } } return function (t, e, o) { return e && n(t.prototype, e), o && n(t, o), t } }(), r = o(3), a = (n = r) && n.__esModule ? n : { default: n }; var s = function () { function e(t) { !function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, e), this.options = t, this.init() } return i(e, [{ key: "init", value: function () { this.options.pixels = 256, this.options.scale || (this.options.scale = 1), 2 === this.options.scale && (this.options.pixels = 512) } }, { key: "latLngToPixel", value: function (t, e) { return { x: this.fromLngToPoint(e) - this.fromLngToPoint(this.options.lng) + this.options.width / (2 / this.options.scale), y: this.fromLatToPoint(t) - this.fromLatToPoint(this.options.lat) + this.options.height / (2 / this.options.scale) } } }, { key: "fromLatToPoint", value: function (t) { return this.options.pixels / Math.PI * Math.pow(2, this.options.zoom) * (Math.PI - Math.log(Math.tan(Math.PI / 4 + t * Math.PI / 180 / 2))) } }, { key: "fromLngToPoint", value: function (t) { return this.options.pixels / Math.PI * Math.pow(2, this.options.zoom) * (t * Math.PI / 180 + Math.PI) } }], [{ key: "geoJSON", value: function () { return (0, a.default)(arguments.length <= 0 ? void 0 : arguments[0], arguments.length <= 1 ? void 0 : arguments[1]) } }]), e }(); e.default = s }, function (t, e, o) { "use strict"; Object.defineProperty(e, "__esModule", { value: !0 }); var i = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (t) { return typeof t } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t }, n = function () { function n(t, e) { for (var o = 0; o < e.length; o++) { var n = e[o]; n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) } } return function (t, e, o) { return e && n(t.prototype, e), o && n(t, o), t } }(), r = s(o(3)), a = s(o(13)); function s(t) { return t && t.__esModule ? t : { default: t } } var l = function () { function e(t) { !function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, e), this.options = t, this.mappaDiv = null, this.id = (0, a.default)(), this.srcLoaded = !1 } return n(e, [{ key: "loadSrc", value: function () { var n = this; new Promise(function (t, e) { if (n.scriptTag = document.createElement("script"), document.body.appendChild(n.scriptTag), n.scriptTag.id = n.options.provider, n.scriptTag.onload = t, n.scriptTag.onerror = e, n.scriptTag.async = !0, n.scriptTag.src = n.scriptSrc, n.styleSrc) { var o = document.createElement("link"); document.head.appendChild(o), o.rel = "stylesheet", o.href = n.styleSrc } }).then(function () { n.srcLoaded = !0 }) } }, { key: "overlay", value: function (t, e) { var o = this; void 0 !== t.elt ? this.canvas = t.elt : this.canvas = t, this.scriptTag.onload = function () { o.mappaDiv = document.createElement("div"), o.canvas.parentElement ? o.canvas.parentElement.appendChild(o.mappaDiv) : document.body.appendChild(o.mappaDiv), o.mappaDiv.setAttribute("style", "width:" + t.width + "px;height:" + t.height + "px;"), o.mappaDiv.setAttribute("id", o.id), o.createMap(), "function" == typeof e && e() } } }, { key: "latLngToPixel", value: function () { for (var t = void 0, e = arguments.length, o = Array(e), n = 0; n < e; n++)o[n] = arguments[n]; return t = "object" === i(o[0]) ? o[0] : { lat: Number(o[0]), lng: Number(o[1]) }, this.fromLatLngToPixel(t) } }, { key: "pixelToLatLng", value: function () { return this.fromPointToLatLng.apply(this, arguments) } }, { key: "zoom", value: function () { return Math.floor(this.getZoom()) } }, { key: "geoJSON", value: function () { return (0, r.default)(arguments.length <= 0 ? void 0 : arguments[0], arguments.length <= 1 ? void 0 : arguments[1]) } }]), e }(); e.default = l }, function (t, e, o) { "use strict"; Object.defineProperty(e, "__esModule", { value: !0 }); var n, i = function () { function n(t, e) { for (var o = 0; o < e.length; o++) { var n = e[o]; n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) } } return function (t, e, o) { return e && n(t.prototype, e), o && n(t, o), t } }(), r = o(1), a = (n = r) && n.__esModule ? n : { default: n }; var s = function (t) { function o(t) { !function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, o); var e = function (t, e) { if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !e || "object" != typeof e && "function" != typeof e ? t : e }(this, (o.__proto__ || Object.getPrototypeOf(o)).call(this, t)); return e.scriptSrc = "https://unpkg.com/leaflet@1.3.0/dist/leaflet.js", e.styleSrc = "https://unpkg.com/leaflet@1.3.0/dist/leaflet.css", e.ready = !1, "Leaflet" === e.constructor.name && e.loadSrc(), e } return function (t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, enumerable: !1, writable: !0, configurable: !0 } }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e) }(o, a.default), i(o, [{ key: "createMap", value: function () { var t = this; this.map = L.map(this.id, { center: [this.options.lat, this.options.lng], zoom: this.options.zoom, inertia: !1 }), this.options.style ? (this.tiles = L.tileLayer(this.options.style).addTo(this.map), this.tiles.on("tileload", function () { t.ready = !0 })) : (o.messages().tiles(), this.ready = !0), this.canvasOverlay() } }, { key: "canvasOverlay", value: function () { var o = this; this.tiles && (this.tiles.options.opacity = this.options.opacity), L.overlay = L.Layer.extend({ onAdd: function () { var t = n.getPane(), e = L.DomUtil.create("div", "leaflet-layer"); e.appendChild(o.canvas), t.appendChild(e) }, drawLayer: function () { } }); var n = new L.overlay; this.map.addLayer(n); var e = this.canvas.getContext("webgl") || this.canvas.getContext("2d"); this.map.on("move", function () { var t = o.map.dragging._draggable; t._newPos && (e.canvas.style.transform = "translate(" + -t._newPos.x + "px, " + -t._newPos.y + "px)") }) } }, { key: "fromLatLngToPixel", value: function (t) { if (this.ready) { var e = this.map.latLngToContainerPoint(t); return { x: e.x, y: e.y } } return { x: -100, y: -100 } } }, { key: "fromPointToLatLng", value: function () { if (this.ready) { for (var t = arguments.length, e = Array(t), o = 0; o < t; o++)e[o] = arguments[o]; return this.map.containerPointToLatLng(e) } return { lat: -100, lng: -100 } } }, { key: "getZoom", value: function () { return this.ready ? this.map.getZoom() : 0 } }, { key: "onChange", value: function (t) { var e = this; this.ready ? (t(), this.map.on("move", t)) : setTimeout(function () { e.onChange(t) }, 200) } }, { key: "removeOnChange", value: function (t) { this.map.on("move", t) } }], [{ key: "messages", value: function () { return { tiles: function () { console.warn("You are not using any tiles for your map. Try with: http://{s}.tile.osm.org/{z}/{x}/{y}.png") } } } }]), o }(); e.default = s }, function (t, e, o) { "use strict"; Object.defineProperty(e, "__esModule", { value: !0 }); var i = function (e, t) { return e.hasOwnProperty("geometry") && e.geometry.type === t ? e.geometry.coordinates : e.hasOwnProperty("geometries") && e.geometries instanceof Array && e.geometry.type === t ? void e.geometries.forEach(function (t) { return e.geometry.coordinates }) : e.hasOwnProperty("coordinates") && e.geometry.type === t ? e.geometry.coordinates : null }; e.default = function (t, o) { var n = []; return "FeatureCollection" === t.type ? t.features instanceof Array && t.features.forEach(function (t) { var e = i(t, o); null != e && n.push(e) }) : n = i(t, o), n } }, function (t, e, o) { "use strict"; Object.defineProperty(e, "__esModule", { value: !0 }), e.StaticMap = e.Mapquest = e.Google = e.Mapbox = void 0; var n = s(o(8)), i = s(o(7)), r = s(o(9)), a = s(o(0)); function s(t) { return t && t.__esModule ? t : { default: t } } e.Mapbox = n.default, e.Google = i.default, e.Mapquest = r.default, e.StaticMap = a.default }, function (t, e, o) { "use strict"; Object.defineProperty(e, "__esModule", { value: !0 }), e.Mapbox = e.Leaflet = e.Google = e.MapboxGL = void 0; var n = s(o(12)), i = s(o(10)), r = s(o(2)), a = s(o(11)); function s(t) { return t && t.__esModule ? t : { default: t } } e.MapboxGL = n.default, e.Google = i.default, e.Leaflet = r.default, e.Mapbox = a.default }, function (t, e, o) { "use strict"; var r = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (t) { return typeof t } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t }, n = function () { function n(t, e) { for (var o = 0; o < e.length; o++) { var n = e[o]; n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) } } return function (t, e, o) { return e && n(t.prototype, e), o && n(t, o), t } }(), i = s(o(5)), a = s(o(4)); function s(t) { if (t && t.__esModule) return t; var e = {}; if (null != t) for (var o in t) Object.prototype.hasOwnProperty.call(t, o) && (e[o] = t[o]); return e.default = t, e } var l = function () { function o(t, e) { !function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, o), this.provider = t, this.key = e } return n(o, [{ key: "staticMap", value: function () { for (var n = {}, t = arguments.length, e = Array(t), o = 0; o < t; o++)e[o] = arguments[o]; if ("object" === r(e[0])) n = Object.assign({}, e[0]); else { var i = a[this.provider].options().userInput; e.forEach(function (t, e) { var o = i[e]; n[o] = t }) } return n.key = this.key, void 0 === this.provider && (this.provider = "StaticMap"), new a[this.provider](n) } }, { key: "tileMap", value: function () { for (var t = arguments.length, o = Array(t), e = 0; e < t; e++)o[e] = arguments[e]; var n = {}; return "object" === r(o[0]) ? n = Object.assign({}, o[0]) : ["lat", "lng", "zoom"].forEach(function (t, e) { n[t] = o[e] }), n.key = this.key, n.provider = this.provider, new i[this.provider](n) } }]), o }(); console.log("Mappa loaded!"), t.exports = l }, function (t, e, o) { "use strict"; Object.defineProperty(e, "__esModule", { value: !0 }); var n, i = function () { function n(t, e) { for (var o = 0; o < e.length; o++) { var n = e[o]; n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) } } return function (t, e, o) { return e && n(t.prototype, e), o && n(t, o), t } }(), r = o(0), a = (n = r) && n.__esModule ? n : { default: n }; var s = function (t) { function o(t) { !function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, o); var e = function (t, e) { if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !e || "object" != typeof e && "function" != typeof e ? t : e }(this, (o.__proto__ || Object.getPrototypeOf(o)).call(this, t)); return e.imgUrl = "https://maps.googleapis.com/maps/api/staticmap?", e.createImage(), e } return function (t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, enumerable: !1, writable: !0, configurable: !0 } }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e) }(o, a.default), i(o, [{ key: "init", value: function () { 1 === this.options.scale || void 0 === this.options.scale ? (this.options.pixels = 128, this.options.scale = 1) : 2 === this.options.scale && (this.options.pixels = 256), 640 < this.options.width && (o.messages().size("width", this.options.width), this.options.width = 640), 640 < this.options.height && (o.messages().size("height", this.options.height), this.options.height = 640) } }, { key: "createImage", value: function () { var e = this; return this.options.key || (delete this.options.key, o.messages().key()), this.options.center || (this.options.center = this.options.lat + "," + this.options.lng), this.options.scale || (this.options.scale = 1), this.options.size = this.options.width + "x" + this.options.height, Object.keys(this.options).forEach(function (t) { -1 < o.options().valid.indexOf(t) && (e.imgUrl += "&" + t + "=" + e.options[t]) }), this.imgUrl } }], [{ key: "options", value: function () { return { valid: ["center", "zoom", "size", "scale", "format", "maptype", "language", "region", "markers", "path", "visible", "style", "signature", "key", "signature"], userInput: ["lat", "lng", "zoom", "width", "height", "scale", "format", "maptype", "language", "region", "markers", "path", "visible", "style", "key", "signature", "center"] } } }, { key: "messages", value: function () { return { size: function (t, e) { console.warn("You requested an image with a " + t + " of " + e + "px. Google Maps Static API max " + t + " value is 640px. For larger images, change the scale to 2 and keep the " + t + " between 1-640px. i.e: if you want an image 800x800px, set the width and height to 400x400 and the scale to 2.") }, key: function () { console.warn("For better results please provide an API key for your Google Maps Static API.") } } } }]), o }(); e.default = s }, function (t, e, o) { "use strict"; Object.defineProperty(e, "__esModule", { value: !0 }); var n, i = function () { function n(t, e) { for (var o = 0; o < e.length; o++) { var n = e[o]; n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) } } return function (t, e, o) { return e && n(t.prototype, e), o && n(t, o), t } }(), r = o(0), a = (n = r) && n.__esModule ? n : { default: n }; var s = function (t) { function n(t) { !function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, n); var e = function (t, e) { if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !e || "object" != typeof e && "function" != typeof e ? t : e }(this, (n.__proto__ || Object.getPrototypeOf(n)).call(this, t)); return e.imgUrl = "https://api.mapbox.com/styles/v1/", e.createImage(), e } return function (t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, enumerable: !1, writable: !0, configurable: !0 } }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e) }(n, a.default), i(n, [{ key: "init", value: function () { this.options.pixels = 256, this.options.scale || (this.options.scale = 1), 2 === this.options.scale ? this.options.pixels = 512 : (1280 < this.options.width && (n.messages().size("width", this.options.width), this.options.width = 1280), 1280 < this.options.height && (n.messages().size("height", this.options.width), this.options.height = 1280)) } }, { key: "createImage", value: function () { var o = this; return this.options.key ? (void 0 !== this.options.username ? this.imgUrl += this.options.username + "/" : this.imgUrl += "mapbox/", void 0 !== this.options.style ? this.imgUrl += this.options.style + "/" : this.imgUrl += "streets-v10/", this.imgUrl += "static/", void 0 !== this.options.overlay && (this.imgUrl += this.options.overlay + "/"), this.imgUrl += this.options.lng + "," + this.options.lat + ",", !1 === this.options.auto || void 0 === this.options.auto ? ["zoom", "bearing", "pitch"].forEach(function (t, e) { void 0 !== o.options[t] ? o.imgUrl += o.options[t] : o.imgUrl += 0, e < 2 && (o.imgUrl += ",") }) : this.imgUrl += "auto", this.imgUrl += "/" + this.options.width + "x" + this.options.height, 2 === this.options.scale && (this.imgUrl += "@2x"), this.imgUrl += "?access_token=" + this.options.key, this.options.attribution ? this.imgUrl += "&attribution=" + this.options.attribution : this.imgUrl += "&attribution=false", this.options.logo ? this.imgUrl += "&logo=" + this.options.logo : this.imgUrl += "&logo=false", this.options.before_layer ? this.imgUrl += "&before_layer=" + this.options.before_layer : this.imgUrl += "&before_layer=false", this.imgUrl) : (n.messages().key(), null) } }], [{ key: "options", value: function () { return { valid: ["lat", "lng", "zoom", "width", "height", "scale", "bearing", "pitch", "style", "username", "overlay", "attribution", "logo", "before_layer", "center", "size"], userInput: ["lat", "lng", "zoom", "width", "height", "scale", "bearing", "pitch", "style", "username", "overlay", "attribution", "logo", "before_layer", "center", "size"] } } }, { key: "messages", value: function () { return { size: function (t, e) { return console.warn("You requested an image with a " + t + " of " + e + "px. Mapbox Static API max " + t + " value is 1280px. If you want a large image change the scale to 2.") }, key: function () { console.error("Mapbox Static API needs a key to work. To get a key visit: https://www.mapbox.com/api-documentation/#static") } } } }]), n }(); e.default = s }, function (t, e, o) { "use strict"; Object.defineProperty(e, "__esModule", { value: !0 }); var n, i = function () { function n(t, e) { for (var o = 0; o < e.length; o++) { var n = e[o]; n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) } } return function (t, e, o) { return e && n(t.prototype, e), o && n(t, o), t } }(), r = o(0), a = (n = r) && n.__esModule ? n : { default: n }; var s = function (t) { function o(t) { !function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, o); var e = function (t, e) { if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !e || "object" != typeof e && "function" != typeof e ? t : e }(this, (o.__proto__ || Object.getPrototypeOf(o)).call(this, t)); return e.imgUrl = "https://www.mapquestapi.com/staticmap/v5/map?", e.createImage(), e } return function (t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, enumerable: !1, writable: !0, configurable: !0 } }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e) }(o, a.default), i(o, [{ key: "init", value: function () { 1 === this.options.scale || void 0 === this.options.scale ? (this.options.pixels = 128, this.options.scale = 1) : 2 === this.options.scale && (this.options.pixels = 256), 1920 < this.options.width && (o.messages().size("width", this.options.width), this.options.width = 1920), 1920 < this.options.height && (o.messages().size("height", this.options.height), this.options.height = 1920) } }, { key: "createImage", value: function () { var e = this; return this.options.key ? (this.options.size = this.options.width + "," + this.options.height, 2 === this.options.scale && (this.options.size += "@2x"), this.options.center || (this.options.center = this.options.lat + "," + this.options.lng), Object.keys(this.options).forEach(function (t) { -1 < o.options().valid.indexOf(t) && (e.imgUrl += "&" + t + "=" + e.options[t]) }), this.imgUrl) : (o.messages().key(), null) } }], [{ key: "options", value: function () { return { valid: ["key", "size", "zoom", "center", "boundingBox", "margin", "format", "type", "scalebar", "locations", "declutter", "defaultMarker", "banner", "traffic", "key"], userInput: ["lat", "lng", "zoom", "width", "height", "scale", "boundingBox", "margin", "format", "type", "scalebar", "locations", "declutter", "defaultMarker", "banner", "traffic", "key"] } } }, { key: "messages", value: function () { return { size: function (t, e) { console.warn("You requested an image with a " + t + " of " + e + "px. Mapquest Static API max " + t + " value is 1920px. For larger images, change the scale to 2 and keep the " + t + " between 170x30px. i.e: if you want an 3840x3840px image, set the width and height to 1920x1920 and the scale to 2.") }, key: function () { console.warn("Please provide and API key to work with Mapquest Static API. Get one here: https://developer.mapquest.com/documentation/") } } } }]), o }(); e.default = s }, function (t, e, o) { "use strict"; Object.defineProperty(e, "__esModule", { value: !0 }); var n, i = function () { function n(t, e) { for (var o = 0; o < e.length; o++) { var n = e[o]; n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) } } return function (t, e, o) { return e && n(t.prototype, e), o && n(t, o), t } }(), r = o(1), a = (n = r) && n.__esModule ? n : { default: n }; var s = function (t) { function o(t) { !function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, o); var e = function (t, e) { if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !e || "object" != typeof e && "function" != typeof e ? t : e }(this, (o.__proto__ || Object.getPrototypeOf(o)).call(this, t)); return e.scriptSrc = "https://maps.googleapis.com/maps/api/js?v=3", e.options.key && (e.scriptSrc += "&key=" + e.options.key), e.options.language && (e.scriptSrc += "&language=" + e.options.language), e.options.region && (e.scriptSrc += "®ion=" + e.options.region), e.onChangeMethods = {}, e.loadSrc(), e } return function (t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, enumerable: !1, writable: !0, configurable: !0 } }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e) }(o, a.default), i(o, [{ key: "createMap", value: function () { var i = this; this.options.key || o.messages().key(), this.map = new google.maps.Map(document.getElementById(this.id), { center: { lat: this.options.lat, lng: this.options.lng }, zoom: this.options.zoom || 6, mapTypeId: this.options.maptype || "terrain", styles: this.options.styles || "", minZoom: 1 }); var r = new google.maps.OverlayView; r.onAdd = function () { r.getPanes().overlayLayer.appendChild(i.canvas) }, r.draw = function () { }, r.setMap(this.map), google.maps.event.addListener(this.map, "bounds_changed", function () { var t = r.getProjection().fromLatLngToDivPixel(i.map.getCenter()), e = 2; 2 <= window.devicePixelRatio && (e = 4); var o = -Math.round(i.canvas.width / e - t.x), n = -Math.round(i.canvas.height / e - t.y); (i.canvas.getContext("webgl") || i.canvas.getContext("2d")).canvas.style.transform = "translate(" + o + "px," + n + "px)" }), google.maps.event.addListenerOnce(this.map, "tilesloaded", function () { i.ready = !0 }) } }, { key: "fromLatLngToPixel", value: function (t) { if (this.ready) { var e = new google.maps.LatLng(t), o = this.map.getProjection().fromLatLngToPoint(this.map.getBounds().getNorthEast()), n = this.map.getProjection().fromLatLngToPoint(this.map.getBounds().getSouthWest()), i = Math.pow(2, this.map.getZoom()), r = this.map.getProjection().fromLatLngToPoint(e); return new google.maps.Point((r.x - n.x) * i, (r.y - o.y) * i) } return { x: -100, y: -100 } } }, { key: "fromPointToLatLng", value: function () { if (this.ready) { var t = this.map.getProjection().fromLatLngToPoint(this.map.getBounds().getNorthEast()), e = this.map.getProjection().fromLatLngToPoint(this.map.getBounds().getSouthWest()), o = Math.pow(2, this.map.getZoom()), n = new google.maps.Point((arguments.length <= 0 ? void 0 : arguments[0]) / o + e.x, (arguments.length <= 1 ? void 0 : arguments[1]) / o + t.y), i = this.map.getProjection().fromPointToLatLng(n); return { lat: i.lat(), lng: i.lng() } } return { lat: -100, lng: -100 } } }, { key: "getZoom", value: function () { return this.ready ? this.map.getZoom() : 0 } }, { key: "onChange", value: function (t) { var e = this; this.ready ? (t(), this.onChangeMethods[t] = google.maps.event.addListener(this.map, "bounds_changed", t)) : setTimeout(function () { e.onChange(t) }, 200) } }, { key: "removeOnChange", value: function (t) { google.maps.event.removeListener(this.onChangeMethods[t]) } }], [{ key: "messages", value: function () { return { key: function () { console.warn("Please provide a Goolge Maps API Key. Get one here: https://developers.google.com/maps/documentation/javascript/ ") } } } }]), o }(); e.default = s }, function (t, e, o) { "use strict"; Object.defineProperty(e, "__esModule", { value: !0 }); var n, i = function () { function n(t, e) { for (var o = 0; o < e.length; o++) { var n = e[o]; n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) } } return function (t, e, o) { return e && n(t.prototype, e), o && n(t, o), t } }(), r = o(2), a = (n = r) && n.__esModule ? n : { default: n }; var s = function (t) { function o(t) { !function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, o); var e = function (t, e) { if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !e || "object" != typeof e && "function" != typeof e ? t : e }(this, (o.__proto__ || Object.getPrototypeOf(o)).call(this, t)); return e.scriptSrc = "https://api.mapbox.com/mapbox.js/v3.1.1/mapbox.js", e.styleSrc = "https://api.mapbox.com/mapbox.js/v3.1.1/mapbox.css", e.loadSrc(), e } return function (t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, enumerable: !1, writable: !0, configurable: !0 } }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e) }(o, a.default), i(o, [{ key: "createMap", value: function () { var t = this; this.options.key ? L.mapbox.accessToken = this.options.key : o.messages().key(), this.map = L.mapbox.map(this.id).setView([this.options.lat, this.options.lng], this.options.zoom), this.options.studio ? this.tiles = L.mapbox.styleLayer(this.options.style || "mapbox://styles/mapbox/emerald-v8").addTo(this.map) : this.tiles = L.mapbox.tileLayer(this.options.style || "mapbox.streets").addTo(this.map), this.tiles.on("ready", function () { t.ready = !0 }), this.canvasOverlay() } }], [{ key: "messages", value: function () { return { key: function () { console.warn("Please provide a Mapbox API key. Get one here: https://www.mapbox.com/mapbox.js/api/v3.1.1") } } } }]), o }(); e.default = s }, function (t, e, o) { "use strict"; Object.defineProperty(e, "__esModule", { value: !0 }); var n, i = function () { function n(t, e) { for (var o = 0; o < e.length; o++) { var n = e[o]; n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) } } return function (t, e, o) { return e && n(t.prototype, e), o && n(t, o), t } }(), r = o(1), a = (n = r) && n.__esModule ? n : { default: n }; var s = function (t) { function o(t) { !function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") }(this, o); var e = function (t, e) { if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !e || "object" != typeof e && "function" != typeof e ? t : e }(this, (o.__proto__ || Object.getPrototypeOf(o)).call(this, t)); return e.scriptSrc = "https://api.mapbox.com/mapbox-gl-js/v0.43.0/mapbox-gl.js", e.styleSrc = "https://api.mapbox.com/mapbox-gl-js/v0.43.0/mapbox-gl.css", e.ready = !1, e.options.key ? e.loadSrc() : o.messages().key(), e } return function (t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + typeof e); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, enumerable: !1, writable: !0, configurable: !0 } }), e && (Object.setPrototypeOf ? Object.setPrototypeOf(t, e) : t.__proto__ = e) }(o, a.default), i(o, [{ key: "createMap", value: function () { var t = this; mapboxgl.accessToken = this.options.key, this.map = new mapboxgl.Map({ container: this.id, style: this.options.style || "mapbox://styles/mapbox/satellite-streets-v10", center: [this.options.lng, this.options.lat], zoom: this.options.zoom, minZoom: this.options.minZoom || 0, maxZoom: this.options.maxZoom || 22, bearing: this.options.bearing || 0, pitch: this.options.pitch || 0, renderWorldCopies: this.options.renderWorldCopies, maxBounds: this.options.maxBounds || void 0 }), this.map.getCanvasContainer().appendChild(this.canvas), this.canvas.style.position = "relative", this.options.opacity && (document.getElementsByClassName("mapboxgl-canvas")[0].style.opacity = this.options.opacity), this.map.on("load", function () { t.ready = !0 }) } }, { key: "fromLatLngToPixel", value: function (t) { return this.ready ? this.map.project(t) : { x: -100, y: -100 } } }, { key: "fromPointToLatLng", value: function () { if (this.ready) { for (var t = arguments.length, e = Array(t), o = 0; o < t; o++)e[o] = arguments[o]; return this.map.unproject(e) } return { lat: -100, lng: -100 } } }, { key: "getZoom", value: function () { return this.ready ? this.map.getZoom() : 0 } }, { key: "onChange", value: function (t) { var e = this; this.ready ? (t(), this.map.on("render", t)) : setTimeout(function () { e.onChange(t) }, 200) } }, { key: "removeOnChange", value: function (t) { this.map.off("render", t) } }], [{ key: "messages", value: function () { return { key: function () { console.warn("Please provide a Mapbox-gl API key. Get one here: https://www.mapbox.com/mapbox-gl-js/api/") } } } }]), o }(); e.default = s }, function (t, e, o) { "use strict"; Object.defineProperty(e, "__esModule", { value: !0 }); var n = function () { return Math.floor(65536 * (1 + Math.random())).toString(16).substring(1) }; e.default = function () { return "" + n() + n() + "-" + n() + "-" + n() + "-" + n() + "-" + n() + n() + n() } }]) }); //# sourceMappingURL=/sm/f268bb0b7a8e5c7c2686fecaf67940c4d3a61b569f3589c663fe35d412695dd9.map