(function (factory) {
    if (typeof module === "object" && typeof module.exports === "object") {
        var v = factory(require, exports);
        if (v !== undefined) module.exports = v;
    }
    else if (typeof define === "function" && define.amd) {
        define(["require", "exports", "tslib", "@angular/core", "leaflet", "./dependencs/AgromaxLeafletController", "./leaflet-map.constants", "@angular/core"], factory);
    }
})(function (require, exports) {
    "use strict";
    /**
     * @fileoverview added by tsickle
     * Generated from: lib/leaflet-map.service.ts
     * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
     */
    Object.defineProperty(exports, "__esModule", { value: true });
    var tslib_1 = require("tslib");
    var core_1 = require("@angular/core");
    var L = require("leaflet");
    var AgromaxLeafletController_1 = require("./dependencs/AgromaxLeafletController");
    var leaflet_map_constants_1 = require("./leaflet-map.constants");
    var i0 = require("@angular/core");
    var LeafletMapService = /** @class */ (function () {
        function LeafletMapService() {
            this.defaultOptions = { center: [43.0, -79.0], zoom: 3, minZoom: 3, maxZoom: 17 };
        }
        /**
         * @template T
         * @param {?} divId
         * @param {?=} options
         * @return {?}
         */
        LeafletMapService.prototype.createMap = /**
         * @template T
         * @param {?} divId
         * @param {?=} options
         * @return {?}
         */
        function (divId, options) {
            if (options === void 0) { options = {}; }
            /** @type {?} */
            var layersControl = {
                Satélite: leaflet_map_constants_1.SATELITE,
                Mapa: leaflet_map_constants_1.STREET
            };
            /** @type {?} */
            var map = L.map(divId, tslib_1.__assign({}, this.defaultOptions, { layers: [leaflet_map_constants_1.SATELITE] }));
            map.setView(new L.LatLng(-12.7553139, -44.4046542), 4);
            if (options.layersControl) {
                L.control.layers(layersControl).addTo(map);
            }
            if (options.updateOnResize) {
                window.addEventListener('resize', (/**
                 * @return {?}
                 */
                function () {
                    console.log('resize');
                    map.invalidateSize();
                }));
            }
            return new AgromaxLeafletController_1.AgromaxLeafletController(map);
        };
        LeafletMapService.decorators = [
            { type: core_1.Injectable, args: [{
                        providedIn: 'root'
                    },] }
        ];
        /** @nocollapse */
        LeafletMapService.ctorParameters = function () { return []; };
        /** @nocollapse */ LeafletMapService.ngInjectableDef = i0.ɵɵdefineInjectable({ factory: function LeafletMapService_Factory() { return new LeafletMapService(); }, token: LeafletMapService, providedIn: "root" });
        return LeafletMapService;
    }());
    exports.LeafletMapService = LeafletMapService;
    if (false) {
        /** @type {?} */
        LeafletMapService.prototype.defaultOptions;
    }
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGVhZmxldC1tYXAuc2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0BjaWFnL2xlYWZsZXQtbWFwLyIsInNvdXJjZXMiOlsibGliL2xlYWZsZXQtbWFwLnNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7SUFBQSxzQ0FBMkM7SUFDM0MsMkJBQTZCO0lBQzdCLGtGQUFpRjtJQUVqRixpRUFBK0U7O0lBRS9FO1FBS0U7WUFEQSxtQkFBYyxHQUFpQixFQUFFLE1BQU0sRUFBRSxDQUFDLElBQUksRUFBRSxDQUFDLElBQUksQ0FBQyxFQUFFLElBQUksRUFBRSxDQUFDLEVBQUUsT0FBTyxFQUFFLENBQUMsRUFBRSxPQUFPLEVBQUUsRUFBRSxFQUFFLENBQUM7UUFDM0UsQ0FBQzs7Ozs7OztRQUNqQixxQ0FBUzs7Ozs7O1FBQVQsVUFBNEMsS0FBMkIsRUFBRSxPQUE4QjtZQUE5Qix3QkFBQSxFQUFBLFlBQThCOztnQkFDL0YsYUFBYSxHQUFHO2dCQUNwQixRQUFRLEVBQUUsZ0NBQVE7Z0JBQ2xCLElBQUksRUFBRSw4QkFBTTthQUNiOztnQkFDSyxHQUFHLEdBQUcsQ0FBQyxDQUFDLEdBQUcsQ0FBQyxLQUFLLHVCQUNsQixJQUFJLENBQUMsY0FBYyxJQUN0QixNQUFNLEVBQUUsQ0FBQyxnQ0FBUSxDQUFDLElBQ2xCO1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